# NODAL_INITIAL_CONDITION

Specifies the nodal initial conditions for a solution field.

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.

For example, the nodal initial conditions of the temperature field may be specified by:
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.

Starting in AcuSolve 14.0, the target variable of the initial condition is specified through the variable entry. Alternatively, the variable can be specified via the name of the NODAL_INITIAL_CONDITION entry by selecting the variable = auto option, or omitted altogether since it is the default value. This behavior exists only to preserve backward compatibility. For example, the legacy use of this command was as follows:
NODAL_INITIAL_CONDITION( temperature ) {
default_value              = 273.0
nodal_values               = { 1, 300.0 ;
2, 310.0 ; }
satisfy_boundary_condition = off
}
Which sets the initial condition on temperature to a default value of 273.0 except at nodes one and two, which are set to 300.0 and 310.0, respectively. The full version of this command, including the default values, is as follows:
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.

For vector fields, such as velocity and acceleration, default_values provides the default field. This parameter is a vector of three components in the global xyz coordinate system. Again, the default values may be overwritten for a subset of the nodes by nodal_values. In this case, however, the array has four columns, corresponding to the node number and the x, y, and z components of the vector field. For example,
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 ; }
}
The nodal values may be read from a file. For the above example, the velocity values may be placed in a file, such as, velocity.nic:
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
}
For symmetric tensor fields, such as viscoelastic_stress, default_values requires six components. The default values may be overwritten for a subset of the nodes by nodal_values. In this case, however, the array has seven columns, corresponding to the node number and the xx, yy,zz,xy,yz,zx components of the stress field. For example,
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 ; }
}
The nodal values may be read from a file. For the above example, the viscoelastic stress values may be placed in a file, such as viscoelastic.nic:
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 }
}
Note that the default_value and default_values parameters are restricted to the set of nodes that the instance of the NODAL_INITIAL_CONDITION command applies to. For example, the following command selects all nodes from the element set named "fluid elements", but then only explicitly defines nodal values for a portion of that set.
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.

The process of setting initial conditions when type = nodal is as follows:
• 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 a running average variable is defined, then its initial condition may be set here. See the EQUATION command for the definition of running average fields and the counter N used below. The following rules are used to initialize each running average field:
• 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 conditions of types piecewise_linear and cubic_spline may be used to define initial values as a function of a single independent variable. For example,
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.

The curve_fit_values data may be read from a file. For the above example, the curve fit values may be placed in a file, such as temperature.nic.fit:
-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_variable = y_coordinate
}
The nodal initial conditions for multi field simulations can be defined by using the nodal_values command to define the field. This may be specified by:
NODAL_INITIAL_CONDITION( field ) {
variable       = "field"
field          = "Gasoline"
default_value  = 1
}

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.

For example, consider the case where the velocity is initialized to a parabolic profile inside a circular pipe. Then the input command may be given by:
NODAL_INITIAL_CONDITION( "UDF IC on velocity" ) {
variable        = velocity
type            = user_function
selection_type  = node_list
user_function   = "usrNodalIcExample"
user_values     = { 0,  # y-center
0,  # z-center
1 } # max velocity
}
where the user-defined function "usrNodalIcExample" may be implemented as follows:
#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       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                     */
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.

Any number of NODAL_INITIAL_CONDITION commands can be present for a given variable. The precedence option determines which instance of the command will override the others. Higher precedence values override lower precedence values. For example, the following set of commands can be used to define initial conditions on the temperature field for a conjugate heat transfer simulation. The temperature in the solid is initialized to a temperature of 300 and the temperature in the fluid is initialized to 325. The nodes on the shared surface between the element sets are present in both commands. The higher precedence assigned to the nodes in the solid ensure that the temperature on these nodes is enforced at 300.
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
}