# NODAL_INITIAL_CONDITION

Specifies the nodal initial conditions for a solution field.

## Type

AcuSolve Command

## Syntax

NODAL_INITIAL_CONDITION("name") {parameters...}

## Parameters

- variables [=auto]
- One of the following:
- auto
- (scalar)
- pressure or pres
- (scalar)
- pressure_time_derivative or pres_rate
- (scalar)
- velocity or vel
- (vector)
- x_velocity or xvel
- (scalar)
- y_velocity or yvel
- (scalar)
- z_velocity or zvel
- (scalar)
- acceleration or accel
- (vector)
- temperature or temp
- (scalar)
- temperature_time_derivative or temp_rate
- (scalar)
- species_1 or spec1
- (scalar)
- species_1_time_derivative or spec1_rate
- (scalar)
- species_2 or spec2
- (scalar)
- species_2_time_derivative or spec2_rate
- (scalar)
- species_3 or spec3
- (scalar)
- species_3_time_derivative or spec3_rate
- (scalar)
- species_4 or spec4
- (scalar)
- species_4_time_derivative or spec4_rate
- (scalar)
- species_5 or spec5
- (scalar)
- species_5_time_derivative or spec5_rate
- (scalar)
- species_6 or spec6
- (scalar)
- species_6_time_derivative or spec6_rate
- (scalar)
- species_7 or spec7
- (scalar)
- species_7_time_derivative or spec7_rate
- (scalar)
- species_8 or spec8
- (scalar)
- species_8_time_derivative or spec8_rate
- (scalar)
- species_9 or spec9
- (scalar)
- species_9_time_derivative or spec9_rate
- (scalar)
- eddy_viscosity or eddy
- (scalar)
- eddy_viscosity_time_derivative or eddy_rate
- (scalar)
- particle_source_temperature
- (scalar)
- particle_source_species_1
- (scalar)
- particle_source_species_2
- (scalar)
- particle_source_species_3
- (scalar)
- particle_source_species_4
- (scalar)
- particle_source_species_5
- (scalar)
- particle_source_species_6
- (scalar)
- particle_source_species_7
- (scalar)
- particle_source_species_8
- (scalar)
- particle_source_species_9
- (scalar)
- kinetic_energy or tke
- (scalar)
- kinetic_energy_time_derivative or tke_rate
- (scalar)
- eddy_frequency or tomega
- (scalar)
- eddy_frequency_time_derivative or tomega_rate
- (scalar)
- viscoelastic_stress or vest
- (symmetric tensor)
- field
- (scalar)
- relative_humidity
- (scalar)
- dewpoint_temperature
- (scalar)
- humidity_film_thickness
- (scalar)
- mesh_displacement or mesh
- (scalar)
- running_average_pressure
- (scalar)
- running_average_velocity
- (vector)
- running_average_temperature
- (scalar)
- running_average_species_1
- (scalar)
- running_average_species_2
- (scalar)
- running_average_species_3
- (scalar)
- running_average_species_4
- (scalar)
- running_average_species_5
- (scalar)
- running_average_species_6
- (scalar)
- running_average_species_7
- (scalar)
- running_average_species_8
- (scalar)
- running_average_species_9
- (scalar)
- running_average_eddy_viscosity
- (scalar)
- running_average_kinetic_energy
- (scalar)
- running_average_eddy_frequency
- (scalar)
- running_average_mesh_displacement
- (vector)

- selection_type (enumerated) [=all]
- Method of selecting node set.
- all
- All nodes.
- node_list
- Node IDs are specified in a user provided list. Requires nodes parameter.
- element_set
- Node list is extracted from the element set. Requires element_set.

- nodes (array) [no default]
- List of node IDs in this set. Used with selection_type = node_list.
- element_set or elem_set (string) [no default]
- Name of element set whose nodes are to be included in this initial condition command.
- default_value or value (real) [=0]
- The default value of the initial condition. This applies to scalar fields when type=nodal_values. If the nodal values provided in the nodal_values array do not contain all of the nodes identified for this NODAL_INITIAL_CONDITION command, the default_value is used to assign the value of the initial condition to the nodes that are missing.
- default_values or values (array) [={0,0,0}]
- The default values of the initial conditions. This applies to vector and tensor fields when type=nodal_values. If the nodal values provided in the nodal_values array do not contain all of the nodes identified for this NODAL_INITIAL_CONDITION command, the default_value is used to assign the value of the initial condition to the nodes that are missing.
- type (enumerated) [=zero]
- Type of the initial condition.
- zero
- Zero for the set.
- constant or const
- Constant value. Requires constant_value for scalar variables and constant_values for vector and tensor variables.
- nodal_values or nodal
- Nodal values. Requires nodal_values.
- piecewise_linear or linear
- Piecewise linear curve fit. Requires curve_fit_values and curve_fit_variable.
- cubic_spline or spline
- Cubic spline curve fit. Requires curve_fit_values and curve_fit_variable.
- user_function or user
- User-defined function. Requires user_function, user_values and user_strings.

- constant_value (real) [=0]
- Constant value of the initial condition. Used with constant type and scalar variables.
- constant_values (array) [{0.0,0.0,0.0}]
- Constant values of the initial condition. Used with constant type and vector/tensor variables.
- field (string) [no default]
- Value of the initial condition for field. Used with variable field.
- nodal_values or values (array) [no default]
- Array of node IDs (first column) and data values. Used with nodal_values type.
- curve_fit_values or curve_values (array) [={0,0}]
- A two-column array of independent-variable/initial condition data values. Used with piecewise_linear and cubic_spline types.
- curve_fit_variable or curve_var (enumerated) [=temperature]
- Independent variable of the curve fit. Used with piecewise_linear and
cubic_spline types.
- x_coordinate or xcrd
- X-component of coordinates.
- y_coordinate or ycrd
- Y-component of coordinates.
- z_coordinate or zcrd
- Z-component of coordinates.
- x_reference_coordinate or xrefcrd
- X-component of reference coordinates.
- y_reference_coordinate or yrefcrd
- Y-component of reference coordinates.
- z_reference_coordinate or zrefcrd
- Z-component of reference coordinates.
- x_velocity or xvel
- X-component of velocity.
- y_velocity or yvel
- U-component of velocity.
- z_velocity or zvel
- Z-component of velocity.
- velocity_magnitude or vel_mag
- Velocity magnitude.
- pressure or pres
- Pressure.
- temperature or temp
- Temperature.
- eddy_viscosity or eddy
- Turbulence kinematic eddy viscosity.
- kinetic_energy or tke
- Turbulence kinetic energy.
- eddy_frequency
- Turbulence eddy frequency.
- species_1 or spec1
- Species 1.
- species_2 or spec2
- Species 2.
- species_3 or spec3
- Species 3.
- species_4 or spec4
- Species 4.
- species_5 or spec5
- Species 5.
- species_6 or spec6
- Species 6.
- species_7 or spec7
- Species 7.
- species_8 or spec8
- Species 8.
- species_9 or spec9
- Species 9.
- mesh_x_displacement or mesh_xdisp
- X-component of mesh displacement.
- mesh_y_displacement or mesh_ydisp
- Y-component of mesh displacement.
- mesh_z_displacement or mesh_zdisp
- Z-component of mesh displacement.
- mesh_displacement_magnitude or mesh_disp_mag
- Mesh displacement magnitude.
- mesh_x_velocity or mesh_xvel
- X-component of mesh velocity.
- mesh_y_velocity or mesh_yvel
- Y-component of mesh velocity.
- mesh_z_velocity or mesh_zvel
- Z-component of mesh velocity.
- mesh_velocity_magnitude or mesh_vel_mag
- Mesh velocity magnitude.

- user_function or user (string) [no default]
- Name of the user-defined function. Used with user_function type.
- user_values (array) [={}]
- Array of values to be passed to the user-defined function. Used with user_function type.
- user_strings (list) [={}]
- Array of strings to be passed to the user-defined function. Used with user_function type.
- precedence (integer) [=1]
- Precedence of this initial condition set with respect to other sets. The set with the highest value has precedence.
- satisfy_boundary_condition (boolean) [=off]
- Flag specifying whether or not to change the initial condition data to satisfy the nodal and periodic boundary conditions.

## Description

This command specifies the nodal initial conditions of a solution field.

```
NODAL_INITIAL_CONDITION( "temperature initial condition" ) {
selection_typ e = all
variable = temperature
default_value = 273
type = nodal_values
nodal_values = { 1, 300 ;
2, 310 ; }
satisfy_boundary_condition = off
}
```

The temperature of all nodal points is set to the default value of 273, except for nodes one and two which have temperature values of 300 and 310, respectively. No modifications are made for boundary conditions.

```
NODAL_INITIAL_CONDITION( temperature ) {
default_value = 273.0
nodal_values = { 1, 300.0 ;
2, 310.0 ; }
satisfy_boundary_condition = off
}
```

```
NODAL_INITIAL_CONDITION( temperature ) {
selection_type = all
variable = auto
default_value = 273.0
nodal_values = { 1, 300.0 ;
2, 310.0 ; }
satisfy_boundary_condition = off
}
```

For scalar fields, default_value specifies a single scalar value to be used by all nodes contained in the set. The default value may be overwritten for a subset of nodes by nodal_values. This parameter expects a two-column array corresponding to the node numbers and initial values of the scalar field. Node numbers must be valid numbers, as given by the COORDINATE command.

```
NODAL_INITIAL_CONDITION( "velocity initial condition" ) {
selection_type = all
variable = velocity
default_values = { 1, 0, 0 }
type = nodal_values
nodal_values = { 1, 2.5, 0.0, 1.5 ;
2, 2.5, 1.0, 1.5 ; }
}
```

```
1 2.5 0.0 1.5
2 2.5 1.0 1.5
```

```
NODAL_INITIAL_CONDITION( "velocity other initial condition" ) {
selection_type = all
variable = velocity
default_values = { 1, 0, 0 }
type = nodal_values
nodal_values = Read( "velocity.nic" )
}
```

```
NODAL_INITIAL_CONDITION( "stress initial condition" ) {
selection_type = all
variable = viscoelastic_stress
type = nodal_values
default_values = { 1.0, 0.0, 0.0, 1.0, 0.0, 1.0 }
nodal_values = { 1, 1.1, 0.0, 0.0, 1.2, 0.0, 1.5 ;
2, 2.1, 0.0, 0.0, 2.2, 0.0, 2.5 ; }
}
```

```
1 1.1 0.0 0.0 1.2 0.0 1.5
2 2.1 0.0 0.0 2.2 0.0 2.5
```

```
NODAL_INITIAL_CONDITION( "stress initial condition" ) {
selection_type = all
variable = viscoelastic_stress
type = nodal_values
default_values = { 1.0, 0.0, 0.0, 1.0, 0.0, 1.0 }
nodal_values = Read( "viscoelastic_stress.nic" )
}
```

```
NODAL_INITIAL_CONDITION( "temperature - element set" ) {
selection_type = element_set
element_set = "fluid_elements"
variable = temperature
type = nodal_values
nodal_values = { 1, 300.0 ;
2, 310.0 ; }
default_value = 273.0
satisfy_boundary_condition = off
precedence = 1
}
```

In this case, all node IDs from the element set are collected into a single array, and their value is initialized to the default_value of 273.0. The node IDs that are listed in the nodal_values array are then overwritten with the values listed in the array. The end result is that all nodes in the element set, with the exception of nodes one and two, receive a temperature of 273.0. Nodes one and two are set to 300.0 and 310.0, respectively.

- Collect all node IDs that are contained in the node set defined by the current instance of the NODAL_INITIAL_CONDITION command.
- Compare the node IDs specified by the nodal_values array
against that of the collected node list.
- For node IDs in the nodal_values array that are contained within the collected set of nodes, their initial condition values are assigned based on the nodal_values array.
- For node IDs that are present in the collected list, but do not have a value explicitly assigned through the nodal_values array, the default_value is taken as the initial condition.
- For node IDs that appear in the nodal_values array, but are not a part of the collected node list, a warning message is issued and no initial condition value is set.

Note that this behavior is common across all methods of selecting the target nodes for the NODAL_INITIAL_CONDITION command when type=nodal_values. The nodes listed in the nodal_values array are checked for inclusion in the set of nodes that the NODAL_INITIAL_CONDITION command applies to, and then the logic listed above is invoked to set the values.

The initial condition data may be further modified to satisfy the initial nodal and periodic boundary conditions by setting satisfy_boundary_condition to on. This may smooth the solution and help convergence during the first few times steps.

- If no initial condition on the running average field is specified, then it is set to zero with N = zero. That is, its first non-zero values will be set at the end of the first time step.
- If it is initialized using this command with satisfy_boundary_condition = off, then the specified values are used for the initial values, with N = 1.
- If it is initialized using this command with satisfy_boundary_condition = on, then its initial values are set to the initial values of the corresponding solution field and N = 1.
- At restart, its values and counter are obtained from the restart file. The restart values may be overwritten by this command in which case rules two and three apply.

Note that because of the above flexibility, each variable carries its own running average counter N. However, there is only one counter for all species variables.

The particle source initial conditions are used only when running coupled particle-flow problems with AcuTrace. Except in rare cases, the default value of zero is sufficient.

```
NODAL_INITIAL_CONDITION( "curve fit IC on temperature" ) {
selection_type = node_list
variable = temperature
type = cubic_spline
nodes = { 1 ; 3 ; 6 ; }
curve_fit_values = { -1, 0.0 ;
0, 2.5 ;
1, 0.0 ; }
curve_fit_variable = y_coordinate
}
```

defines an initial condition on the temperature as a function of the y-coordinate. Note that in this example you get a parabolic profile centered at y = 0, with a width of 2 and a center-line magnitude of 2.5. The curve_fit_values parameter is a two-column array corresponding to the independent variable and the initial condition values. The independent variable values must be in ascending order. The limit point values of the curve fit are used when curve_fit_variable falls outside of the curve fit limits. Note that the initial conditions are only applied to nodes one, three, and six in this case.

```
-1 0.0
0 2.5
1 0.0
```

```
NODAL_INITIAL_CONDITION( "other curve fit IC on temperature" ) {
selection_type = node_list
variable = temperature
type = cubic_spline
node_type = specified
nodes = { 1 ; 3 ; 6 ; }
curve_fit_values = Read( "velocity.nic.fit" )
curve_fit_variable = y_coordinate
}
```

```
NODAL_INITIAL_CONDITION( field ) {
variable = "field"
field = "Gasoline"
default_value = 1
nodal_values = Read( "field.nic" )
}
```

Where the nodal_values file "field.nic" is a two column array containing node ID and field value.

A nodal initial condition of user_function type may be used to model more complex behaviors; see the AcuSolve User-Defined Functions Manual for a detailed description of user-defined functions.

```
NODAL_INITIAL_CONDITION( "UDF IC on velocity" ) {
variable = velocity
type = user_function
selection_type = node_list
nodes = Read( "inflow.nic" )
user_function = "usrNodalIcExample"
user_values = { 0, # y-center
0, # z-center
1, # radius
1 } # max velocity
}
```

```
#include "acusim.h"
#include "udf.h"
UDF_PROTOTYPE( usrNodalIcExample ) ; /* function prototype */
Void usrNodalIcExample (
UdfHd udfHd, /* Opaque handle for accessing data */
Real* outVec, /* Output vector */
Integer nItems, /* Number of BC nodes */
Integer vecDim /* = 3 */
) {
Integer node ; /* a node counter */
Real radius ; /* pipe radius */
Real scale ; /* scaling factor */
Real ve10 ; /* velocity at center line */
Real y ; /* y-location */
Real yCenter ; /* y-coordinates of flow axis */
Real z ; /* z-location */
Real zCenter ; /* y-coordinates of flow axis */
Real crd ; /* coordinates */
Real usrVals ; /* user values */
Real xCrd ; /* x-coordinates */
Real yCrd ; /* y-coordinates */
Real zCrd ; /* z-coordinates */
udfCheckNumUsrVals( udfHd, 4 ) ; /* check for error */
usrVals = udfGetUsrVals( udfHd ) ; /* get the user vals */
yCenter = usrVals[0] ; /* get y-center */
zCenter = usrVals[1] ; /* get z-center */
radius = usrVals[2] ; /* get pipe radius */
vel0 = usrVals[3] ; /* get max velocity */
scale = 1 / ( radius * radius ) /* for convenience */
crd = udfGetNbcCrd( udfHd ) ; /* get the coord. */
xCrd = &crd[0*nItems] ; /* localize x-coord. */
yCrd = &crd[1*nItems] ; /* localize y-coord. */
zCrd = &crd[2*nItems] ; /* localize z-coord. */
for ( node = 0 ; node < nItems ; node++ ) {
y = yCrd[node] - yCenter ;
z = zCrd[node] - zCenter ;
/* specifying velocity in x,y,z directions */
outVec[node+0*nItems] = vel0 * ( 1 - scale * ( y*y + z*z ) ) ;
outVec[node+1*nItems] = 0 ;
outVec[node+2*nItems] = 0 ;
}
} /* end of usrNodalIcExample() */
```

The dimension of the returned boundary condition vector, outVec, is the number of nodes times the number of dimensions.

```
NODAL_INITIAL_CONDITION( "solid temperature" ) {
variable = temperature
type = constant
constant_value = 300.0
selection_type = element_set
element_set = "solid elements"
precedence = 2
}
```

```
NODAL_INITIAL_CONDITION( "fluid temperature" ) {
variable = temperature
type = constant
constant_value = 325.0
selection_type = element_set
element_set = "fluid elements"
precedence = 1
}
```