- execute_onTIMESTEP_ENDThe list of flag(s) indicating when this object should be executed, the available options include NONE, INITIAL, LINEAR, NONLINEAR, POSTCHECK, TIMESTEP_END, TIMESTEP_BEGIN, MULTIAPP_FIXED_POINT_END, MULTIAPP_FIXED_POINT_BEGIN, FINAL, CUSTOM.
Default:TIMESTEP_END
C++ Type:ExecFlagEnum
Controllable:No
Description:The list of flag(s) indicating when this object should be executed, the available options include NONE, INITIAL, LINEAR, NONLINEAR, POSTCHECK, TIMESTEP_END, TIMESTEP_BEGIN, MULTIAPP_FIXED_POINT_END, MULTIAPP_FIXED_POINT_BEGIN, FINAL, CUSTOM.
- prop_getter_suffixAn optional suffix parameter that can be appended to any attempt to retrieve/get material properties. The suffix will be prepended with a '_' character.
C++ Type:MaterialPropertyName
Controllable:No
Description:An optional suffix parameter that can be appended to any attempt to retrieve/get material properties. The suffix will be prepended with a '_' character.
- scaling1Multiplier on 'value', typically used to convert from dimensional form into NekRS's non-dimensional form, if using a non-dimensional NekRS solve.
Default:1
C++ Type:double
Controllable:No
Description:Multiplier on 'value', typically used to convert from dimensional form into NekRS's non-dimensional form, if using a non-dimensional NekRS solve.
- use_interpolated_stateFalseFor the old and older state use projected material properties interpolated at the quadrature points. To set up projection use the ProjectedStatefulMaterialStorageAction.
Default:False
C++ Type:bool
Controllable:No
Description:For the old and older state use projected material properties interpolated at the quadrature points. To set up projection use the ProjectedStatefulMaterialStorageAction.
- usrwrk_slotSlot in nrs->usrwrk into which to write the value; if not specified, this defaults to the first unused slot
C++ Type:unsigned int
Controllable:No
Description:Slot in nrs->usrwrk into which to write the value; if not specified, this defaults to the first unused slot
- value0Scalar value to pass into NekRS
Default:0
C++ Type:double
Controllable:Yes
Description:Scalar value to pass into NekRS
NekScalarValue
Writes a scalar value from MOOSE into NekRS's scratch space
Description
This user object sends a scalar value from MOOSE into NekRS's scratch space. This can be used to control NekRS simulations using MOOSE's Controls system or stochastically perturb NekRS simulations using the MOOSE stochastic tools module.
Example Input Syntax
Below is an example input file that defines two scalar user objects that we will use to control a NekRS boundary condition from MOOSE using the Controls
system.
[UserObjects]
[scalar1]
type = NekScalarValue
[]
[scalar2]
type = NekScalarValue
[]
[]
(test/tests/userobjects/nek_scalar_value/nek.i)We will control the value
in each of these parameters using a RealFunctionControl, a MOOSE object that lets us define a scalar value using a function. Here, we will use a simple constant value function, which changes value partway through the simulation.
[Controls]
[func_control]
type = RealFunctionControl
parameter = 'UserObjects/scalar1/value'
function = 'val'
execute_on = 'timestep_begin'
[]
[func_control2]
type = RealFunctionControl
parameter = 'UserObjects/scalar2/value'
function = 'val2'
execute_on = 'timestep_begin'
[]
[]
[Functions]
[val]
type = ParsedFunction
expression = 'if (t > 1, 200.0, 100.0)'
[]
[val2]
type = ParsedFunction
expression = 'if (t > 1, 400.0, 300.0)'
[]
[]
(test/tests/userobjects/nek_scalar_value/nek.i)When running the input file, you will then see a table like the following print:
===================> MAPPING FROM MOOSE TO NEKRS <===================
Slice: entry in NekRS scratch space
Quantity: physical meaning or name of data in this slice
How to Access: C++ code to use in NekRS files; for the .udf instructions,
'n' indicates a loop variable over GLL points
------------------------------------------------------------------------------------------------
| Quantity | How to Access (.oudf) | How to Access (.udf) |
------------------------------------------------------------------------------------------------
| scalar1 | bc->usrwrk[0 * bc->fieldOffset + 0] | nrs->usrwrk[0 * nrs->fieldOffset + 0] |
| scalar2 | bc->usrwrk[0 * bc->fieldOffset + 1] | nrs->usrwrk[0 * nrs->fieldOffset + 1] |
| unused | bc->usrwrk[1 * bc->fieldOffset + bc->idM] | nrs->usrwrk[1 * nrs->fieldOffset + n] |
| unused | bc->usrwrk[2 * bc->fieldOffset + bc->idM] | nrs->usrwrk[2 * nrs->fieldOffset + n] |
| unused | bc->usrwrk[3 * bc->fieldOffset + bc->idM] | nrs->usrwrk[3 * nrs->fieldOffset + n] |
| unused | bc->usrwrk[4 * bc->fieldOffset + bc->idM] | nrs->usrwrk[4 * nrs->fieldOffset + n] |
| unused | bc->usrwrk[5 * bc->fieldOffset + bc->idM] | nrs->usrwrk[5 * nrs->fieldOffset + n] |
| unused | bc->usrwrk[6 * bc->fieldOffset + bc->idM] | nrs->usrwrk[6 * nrs->fieldOffset + n] |
------------------------------------------------------------------------------------------------
Suppose we want to use these two scalar values to set a Dirichlet temperature boundary condition in NekRS. We would simply follow the instructions for the .oudf
, and do:
void scalarDirichletConditions(bcData *bc)
{
// note: when running with Cardinal, Cardinal will allocate the usrwrk
// array. If running with NekRS standalone (e.g. nrsmpi), you need to
// replace the usrwrk with some other value or allocate it youself from
// the udf and populate it with values.
if (bc->id == 5)
bc->s = bc->usrwrk[0 * bc->fieldOffset + 0]; // this is the value of scalar1
else if (bc->id == 6)
bc->s = bc->usrwrk[0 * bc->fieldOffset + 1]; // this is the value of scalar2
}
void scalarNeumannConditions(bcData *bc)
{
bc->flux = 0.0;
}
(test/tests/userobjects/nek_scalar_value/pyramid.oudf)Input Parameters
- allow_duplicate_execution_on_initialFalseIn the case where this UserObject is depended upon by an initial condition, allow it to be executed twice during the initial setup (once before the IC and again after mesh adaptivity (if applicable).
Default:False
C++ Type:bool
Controllable:No
Description:In the case where this UserObject is depended upon by an initial condition, allow it to be executed twice during the initial setup (once before the IC and again after mesh adaptivity (if applicable).
- control_tagsAdds user-defined labels for accessing object parameters via control logic.
C++ Type:std::vector<std::string>
Controllable:No
Description:Adds user-defined labels for accessing object parameters via control logic.
- enableTrueSet the enabled status of the MooseObject.
Default:True
C++ Type:bool
Controllable:Yes
Description:Set the enabled status of the MooseObject.
- execution_order_group0Execution order groups are executed in increasing order (e.g., the lowest number is executed first). Note that negative group numbers may be used to execute groups before the default (0) group. Please refer to the user object documentation for ordering of user object execution within a group.
Default:0
C++ Type:int
Controllable:No
Description:Execution order groups are executed in increasing order (e.g., the lowest number is executed first). Note that negative group numbers may be used to execute groups before the default (0) group. Please refer to the user object documentation for ordering of user object execution within a group.
- force_postauxFalseForces the UserObject to be executed in POSTAUX
Default:False
C++ Type:bool
Controllable:No
Description:Forces the UserObject to be executed in POSTAUX
- force_preauxFalseForces the UserObject to be executed in PREAUX
Default:False
C++ Type:bool
Controllable:No
Description:Forces the UserObject to be executed in PREAUX
- force_preicFalseForces the UserObject to be executed in PREIC during initial setup
Default:False
C++ Type:bool
Controllable:No
Description:Forces the UserObject to be executed in PREIC during initial setup
- use_displaced_meshFalseWhether or not this object should use the displaced mesh for computation. Note that in the case this is true but no displacements are provided in the Mesh block the undisplaced mesh will still be used.
Default:False
C++ Type:bool
Controllable:No
Description:Whether or not this object should use the displaced mesh for computation. Note that in the case this is true but no displacements are provided in the Mesh block the undisplaced mesh will still be used.
Advanced Parameters
Input Files
- (tutorials/nek_stochastic/nek.i)
- (test/tests/nek_stochastic/errors/min_gap.i)
- (test/tests/nek_stochastic/nek_multi.i)
- (test/tests/userobjects/nek_scalar_value/nek.i)
- (test/tests/userobjects/nek_scalar_value/nek_standalone.i)
- (test/tests/nek_stochastic/quiet_init/nek_multi.i)
- (test/tests/nek_stochastic/device/nek_multi.i)
- (test/tests/nek_stochastic/shift/nek.i)
- (test/tests/nek_stochastic/errors/nek_error.i)
- (test/tests/nek_stochastic/errors/gap.i)
- (test/tests/nek_stochastic/errors/nek_standalone_error.i)