# ICs System

## Description

The `ICs`

block within an input file is utilized to define the initial (starting) conditions for the variables within your simulation. Initial conditions may be applied to both the "unknowns" (nonlinear or scalar variables) or auxiliary variables. The interface for defining an Initial Condition is to support a function that returns a value at a "Point", and optionally higher order derivatives at that point (e.g. Gradient, Second).

## ICs Block

The preferred syntax is to create a top-level "ICs" block with subblocks defining the initial conditions for one or more variables.

```
[ICs]
[./u_ic]
type = FunctionIC
variable = 'u'
function = parsed_function
[../]
[]
```

(test/tests/ics/function_ic/parsed_function.i)## ICs from an Exodus File

MOOSE contains a shortcut syntax for reading solutions from an Exodus file for the initial condition from right within the Variables. The name of the variable and the time step from which to read the solution must be supplied.

```
[Variables]
active = 'u v'
[./u]
order = FIRST
family = LAGRANGE
initial_from_file_var = u
initial_from_file_timestep = 6
[../]
[./v]
order = FIRST
family = LAGRANGE
[./InitialCondition]
type = BoundingBoxIC
x1 = 0.0
x2 = 1.0
y1 = 0.0
y2 = 1.0
inside = 3.0
outside = 1.0
[../]
[../]
[]
```

(test/tests/ics/from_exodus_solution/nodal_part2.i)## Initial Condition Coupling

Initial Conditions objects in MOOSE can couple to other variables in the system. When this occurs MOOSE will automatically evaluate dependencies and evaluate initial conditions in an order that supports the valid inspection of variables when computing initial conditions for other variables.

## Gradients

Some shape function families support gradient degrees of freedom (Hermite). To properly initialize these DOFs, the initial condition system has an optional override for supplying gradient values.

## Inspecting Current Node or Element Pointers

The initial condition system uses a generic projection algorithm for setting the initial condition for each supported discritization scheme. In the general case, the projection system may choose to sample anywhere within the domain and not necessarily right on a mesh node or at an element center position. However, for common FE discritizations suchs as Lagrange, all of the initial condition samples are taken at nodes. To support these common cases, InitialCondition derived objects have access to pointers to both current nodes and current elements. These will be non-null when samples are taken at the corresponding mesh entity and null otherwise.

## Sanity checks on ICs

Multiple initial conditions may not be applied to the same variable on the same block

Multiple initial conditions may not be applied to the same variable on the same boundary

Global initial conditions will conflict with subdomain or boundary restricted ICs on the same variable

## Block/Boundary Restrictions

The ICs system support both the BlockRestrictable Interface and BoundaryRestrictable Interface interfaces. When using nodal variables with block restriction, there is an ambiguity that can occur at inter-block interfaces where a node sits in elements of two or more different blocks. To resolve this ambiguity on multi-block nodes, MOOSE chooses the IC object defined on the lowest block ID for a node to "win" along the interface; the winning object's variable *must* be defined on the block - otherwise the IC for the next lowest block ID for the node is used - and so forth until one has the variable defined.

## Available Objects

- Moose App
- ArrayConstantICSets constant component values for an array field variable.
- ArrayFunctionICAn initial condition that uses a normal function of x, y, z to produce values (and optionally gradients) for a field variable.
- BoundingBoxICBoundingBoxIC allows setting the initial condition of a value inside and outside of a specified box. The box is aligned with the x, y, z axes
- ConstantICSets a constant field value.
- FunctionICAn initial condition that uses a normal function of x, y, z to produce values (and optionally gradients) for a field variable.
- FunctionScalarIC
- RandomICInitialize a variable with randomly generated numbers following either a uniform distribution or a user-defined distribution
- ScalarComponentIC
- ScalarConstantIC
- VectorConstantICSets constant component values for a vector field variable.
- VectorFunctionICSets component values for a vector field variable based on a vector function.
- Navier Stokes App
- NSInitialConditionNSInitialCondition sets intial constant values for all variables.
- Fluid Properties App
- RhoFromPressureTemperatureICComputes the density from pressure and temperature.
- RhoVaporMixtureFromPressureTemperatureICComputes the density of a vapor mixture from pressure and temperature.
- SpecificEnthalpyFromPressureTemperatureICComputes the specific enthalpy from pressure and temperature.
- Porous Flow App
- PorousFlowFluidPropertyICAn initial condition to calculate one fluid property (such as enthalpy) from pressure and temperature
- PorousFlowFluidStateBrineCO2ICAn initial condition to calculate z from saturation for brine and CO2
- PorousFlowFluidStateICAn initial condition to calculate z from saturation
- PorousFlowFluidStateWaterNCGICAn initial condition to calculate z from saturation for water and non-condensable gas
- Tensor Mechanics App
- VolumeWeightedWeibullInitialize a variable with randomly generated numbers following a volume-weighted Weibull distribution
- Phase Field App
- BimodalInverseSuperellipsoidsICBimodal size distribution of large particles (specified in input file, value invalue) and small particles (placed randomly inside the larger particles, value outvalue)
- BimodalSuperellipsoidsICBimodal size distribution of large particles (specified in input file) and small particles (placed randomly outside the larger particles)
- BndsCalcICInitialize the location of grain boundaries in a polycrystalline sample
- ClosePackICClose packed arrangement of smooth circles
- CrossICCross-shaped initial condition
- IsolatedBoundingBoxICSpecify variable values inside and outside a list of isolated boxes shaped axis-aligned regions defined by pairs of opposing corners
- LatticeSmoothCircleICPerturbed square lattice of smooth circles
- MultiBoundingBoxICAllows setting the initial condition of a value of a field inside and outside multiple bounding boxes.
- MultiSmoothCircleICRandom distribution of smooth circles with given minimum spacing
- MultiSmoothSuperellipsoidICRandom distribution of smooth ellipse with given minimum spacing
- NestedBoundingBoxICSpecify variable values inside a list of nested boxes shaped axis-aligned regions defined by pairs of opposing corners
- PFCFreezingICBase class for generating a random field for a variable.
- PolycrystalColoringICRandom Voronoi tesselation polycrystal (used by PolycrystalVoronoiICAction)
- PolycrystalRandomICRandom initial condition for a polycrystalline material
- PolycrystalVoronoiVoidICRandom distribution of smooth circles with given minimum spacing
- RampICLinear ramp along the x-axis with given values at the left and right extreme points.
- ReconPhaseVarIC
- RndBoundingBoxICRandom noise with different min/max inside/outside of a bounding box
- RndSmoothCircleICRandom noise with different min/max inside/outside of a smooth circle
- SmoothCircleFromFileICMultiple smooth circles read from a text file
- SmoothCircleICCircle with a smooth interface
- SmoothSuperellipsoidICSuperellipsoid with a smooth interface
- SpecifiedSmoothCircleICMultiple smooth circles with manually specified radii and center points
- SpecifiedSmoothSuperellipsoidICMultiple smooth superellipsoids with manually specified center points; semiaxes a,b,c; and exponents n
- ThumbICThumb shaped bicrystal for grain boundary mobility tests
- Tricrystal2CircleGrainsICTricrystal with two circles/bubbles
- TricrystalTripleJunctionICTricrystal with a triple junction

## Available Subsystems

- Phase Field App
- PolycrystalICs

## Available Actions

- Moose App
- AddInitialConditionAction