NekFieldVariable

Description

NekFieldVariable is a FieldTransfer that sends a field variable between NekRS and MOOSE. A field variable is any of the solution fields computed by NekRS, such as temperature, pressure, velocity, and other passive scalars. First, this object creates an AuxVariable using the name of the object; this variable will hold the variable which NekRS reads (for direction = to_nek) or will be written by NekRS (for direction = from_nek). If not provided, the name of the auxiliary variable will be taken as the name of the object, if it can be matched to one of the enumerations for the field.

For direction = from_nek, this class provides an extremely useful manner to obtain the NekRS solution field in MOOSE. For instance, Figure 1 shows the velocity from the NekRS field files (left) and interpolated onto a second-order mesh mirror (right) using a NekFieldVariable. Because this particular example runs NekRS in a higher order than can be represented on a second-order mesh mirror, the interpolated velocity is clearly not an exact representation of the NekRS solution - only an interpolated version of the NekRS solution.

Velocity from the NekRS field files (left) and after interpolation onto a second order mesh mirror (right).

Figure 1: Velocity from the NekRS field files (left) and after interpolation onto a second order mesh mirror (right).

Example Input File Syntax

The following input sections will interpolate the NekRS pressure, velocity, and temperature for the lowMach NekRS example onto a second order representation of the NekRS mesh.

[Problem<<<{"href": "../../syntax/Problem/index.html"}>>>]
  type = NekRSProblem
  casename<<<{"description": "Case name for the NekRS input files; this is <case> in <case>.par, <case>.udf, <case>.oudf, and <case>.re2."}>>> = 'lowMach'

  [FieldTransfers<<<{"href": "../../syntax/Problem/FieldTransfers/index.html"}>>>]
    [temp]
      type = NekFieldVariable<<<{"description": "Reads/writes volumetric field data between NekRS and MOOSE."}>>>
      direction<<<{"description": "Direction in which to send data"}>>> = from_nek
      field<<<{"description": "NekRS field variable to read/write; defaults to the name of the object"}>>> = temperature
    []
    [P]
      type = NekFieldVariable<<<{"description": "Reads/writes volumetric field data between NekRS and MOOSE."}>>>
      direction<<<{"description": "Direction in which to send data"}>>> = from_nek
      field<<<{"description": "NekRS field variable to read/write; defaults to the name of the object"}>>> = pressure
    []
    [vel_x]
      type = NekFieldVariable<<<{"description": "Reads/writes volumetric field data between NekRS and MOOSE."}>>>
      direction<<<{"description": "Direction in which to send data"}>>> = from_nek
      field<<<{"description": "NekRS field variable to read/write; defaults to the name of the object"}>>> = velocity_x
    []
    [vel_y]
      type = NekFieldVariable<<<{"description": "Reads/writes volumetric field data between NekRS and MOOSE."}>>>
      direction<<<{"description": "Direction in which to send data"}>>> = from_nek
      field<<<{"description": "NekRS field variable to read/write; defaults to the name of the object"}>>> = velocity_y
    []
    [vel_z]
      type = NekFieldVariable<<<{"description": "Reads/writes volumetric field data between NekRS and MOOSE."}>>>
      direction<<<{"description": "Direction in which to send data"}>>> = from_nek
      field<<<{"description": "NekRS field variable to read/write; defaults to the name of the object"}>>> = velocity_z
    []
  []
[]
(test/tests/nek_standalone/lowMach/nek.i)

Then, the output format specified in the [Output] block will be used. Here, the NekRS solution is projected onto an Exodus mesh.

[Outputs]
  exodus = true
[]

For instance, Figure 2 shows the pressure from the NekRS field files (left) and interpolated onto a second-order mesh mirror (right). Because this particular example runs NekRS in a higher order than can be represented on a second-order mesh mirror, the interpolated pressure is clearly not an exact representation of the NekRS solution - only an interpolated version of the NekRS solution.

Pressure from the NekRS field files (left) and after interpolation onto a second order mesh mirror (right).

Figure 2: Pressure from the NekRS field files (left) and after interpolation onto a second order mesh mirror (right).

Input Parameters

  • directionDirection in which to send data

    C++ Type:MooseEnum

    Options:to_nek, from_nek

    Controllable:No

    Description:Direction in which to send data

Required Parameters

  • fieldNekRS field variable to read/write; defaults to the name of the object

    C++ Type:MooseEnum

    Options:velocity_x, velocity_y, velocity_z, velocity, velocity_component, velocity_x_squared, velocity_y_squared, velocity_z_squared, temperature, pressure, scalar01, scalar02, scalar03, unity, usrwrk00, usrwrk01, usrwrk02

    Controllable:No

    Description:NekRS field variable to read/write; defaults to the name of the object

  • usrwrk_slotWhen 'direction = to_nek', the slot(s) in the usrwrk array to write the incoming data; provide one entry for each quantity being passed

    C++ Type:std::vector<unsigned int>

    Controllable:No

    Description:When 'direction = to_nek', the slot(s) in the usrwrk array to write the incoming data; provide one entry for each quantity being passed

Optional Parameters

  • 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:No

    Description:Set the enabled status of the MooseObject.

Advanced Parameters

Input Files