Cardinal
|
#include <NekRSStandaloneProblem.h>
Public Member Functions | |
NekRSStandaloneProblem (const InputParameters ¶ms) | |
bool | isDataTransferHappening (ExternalProblem::Direction direction) |
unsigned int | minimumScratchSizeForCoupling () const |
unsigned int | firstReservedUsrwrkSlot () const |
void | sendScalarValuesToNek () |
Send values from NekScalarValue userobjects to NekRS. More... | |
void | getNekScalarValueUserObjects () |
Setup to fetch NekScalarValue user objects for sending scalar values into NekRS scratch space. More... | |
void | mapFaceDataToNekFace (const unsigned int &e, const unsigned int &var_num, const Real &multiplier, double **outgoing_data) |
void | mapVolumeDataToNekVolume (const unsigned int &e, const unsigned int &var_num, const Real &multiplier, double **outgoing_data) |
void | mapFaceDataToNekVolume (const unsigned int &e, const unsigned int &var_num, const Real &multiplier, double **outgoing_data) |
Map nodal points on a MOOSE face element to the GLL points on a Nek volume element. More... | |
void | writeFieldFile (const Real &time, const int &step) const |
virtual void | adjustNekSolution () |
virtual bool | isOutputStep () const |
Whether nekRS should write an output file for the current time step. More... | |
virtual void | initialSetup () override |
virtual void | externalSolve () override |
virtual bool | converged (unsigned int) override |
virtual void | addExternalVariables () override |
virtual void | syncSolutions (ExternalProblem::Direction direction) override |
virtual bool | nondimensional () const |
virtual const bool | hasMovingNekMesh () const |
virtual bool | synchronizeIn () |
virtual bool | synchronizeOut () |
double | L_ref () const |
unsigned int | nUsrWrkSlots () const |
template<typename T > | |
void | checkDuplicateEntries (const std::vector< T > &var, const std::string &name) const |
void | checkDuplicateVariableName (const std::string &name) const |
bool | stringHasEnding (std::string const &full, std::string const &ending) const |
Static Public Member Functions | |
static InputParameters | validParams () |
Protected Member Functions | |
void | copyScratchToDevice () |
void | interpolateBoundarySolutionToNek (double *incoming_moose_value, double *outgoing_nek_value) |
void | interpolateVolumeSolutionToNek (const int elem_id, double *incoming_moose_value, double *outgoing_nek_value) |
void | writeVolumeSolution (const int elem_id, const field::NekWriteEnum &field, double *T, const std::vector< double > *add=nullptr) |
void | writeBoundarySolution (const int elem_id, const field::NekWriteEnum &field, double *T) |
void | volumeSolution (const field::NekFieldEnum &f, double *T) |
void | boundarySolution (const field::NekFieldEnum &f, double *T) |
void | initializeInterpolationMatrices () |
Initialize interpolation matrices for transfers in/out of nekRS. More... | |
virtual void | fillAuxVariable (const unsigned int var_number, const double *value) |
virtual void | extractOutputs () |
virtual InputParameters | getExternalVariableParameters () |
virtual void | addTemperatureVariable () |
std::string | fieldFilePrefix (const int &number) const |
Protected Attributes | |
std::unique_ptr< NumericVector< Number > > | _serialized_solution |
const std::string & | _casename |
NekRS casename. More... | |
const bool & | _nondimensional |
Whether the nekRS solution is performed in nondimensional scales. More... | |
const Real & | _U_ref |
Reference characteristic velocity. More... | |
const Real & | _T_ref |
Reference characteristic temperature. More... | |
const Real & | _dT_ref |
Reference characteristic temperature delta. More... | |
const Real & | _L_ref |
Reference characteristic length. More... | |
const Real & | _rho_0 |
Reference density. More... | |
const Real & | _Cp_0 |
Reference isobaric specific heat capacity. More... | |
const bool & | _write_fld_files |
const bool & | _disable_fld_file_output |
Whether to turn off all field file writing. More... | |
unsigned int | _n_usrwrk_slots |
const unsigned int & | _constant_interval |
For constant synchronization intervals, the desired frequency (in units of Nek time steps) More... | |
const bool & | _skip_final_field_file |
Whether to skip writing a field file on NekRS's last time steo. More... | |
const unsigned int & | _first_reserved_usrwrk_slot |
First slice in usrwrk for Cardinal to read/write data from. More... | |
int | _n_surface_elems |
Number of surface elements in the data transfer mesh, across all processes. More... | |
int | _n_vertices_per_surface |
Number of vertices per surface element of the transfer mesh. More... | |
int | _n_volume_elems |
Number of volume elements in the data transfer mesh, across all processes. More... | |
int | _n_vertices_per_volume |
Number of vertices per volume element of the transfer mesh. More... | |
int | _n_vertices_per_elem |
Number of vertices per element in the data transfer mesh, which depends on whether boundary/volume coupling. More... | |
const std::vector< int > * | _boundary = nullptr |
Boundary IDs through which to couple nekRS and MOOSE. More... | |
bool | _volume |
Whether the mesh contains volume-based coupling. More... | |
double | _start_time |
Start time of the simulation based on NekRS's .par file. More... | |
bool | _is_output_step |
Whether the most recent time step was an output file writing step. More... | |
NekRSMesh * | _nek_mesh |
NekTimeStepper * | _timestepper = nullptr |
The time stepper used for selection of time step size. More... | |
Transient * | _transient_executioner = nullptr |
Underlying executioner. More... | |
bool | _needs_interpolation |
const MultiMooseEnum * | _outputs = nullptr |
NekRS solution fields to output to the mesh mirror. More... | |
std::vector< std::string > | _var_names |
Names of external variables when extracting the NekRS solution. More... | |
std::vector< unsigned int > | _external_vars |
Numeric identifiers for the external variables. More... | |
std::string | _var_string |
Descriptive string for the variables extracted from NekRS. More... | |
double * | _external_data = nullptr |
Scratch space to place external NekRS fields before writing into auxiliary variables. More... | |
int | _n_points |
Number of points for interpolated fields on the MOOSE mesh. More... | |
const PostprocessorValue * | _transfer_in = nullptr |
Postprocessor containing the signal of when a synchronization has occurred. More... | |
double * | _interpolation_outgoing = nullptr |
Vandermonde interpolation matrix (for outgoing transfers) More... | |
double * | _interpolation_incoming = nullptr |
Vandermonde interpolation matrix (for incoming transfers) More... | |
unsigned int | _minimum_scratch_size_for_coupling |
Minimum allowable scratch space size, strictly what is needed by Cardinal for coupling. More... | |
int | _moose_Nq |
For the MOOSE mesh, the number of quadrature points in each coordinate direction. More... | |
const std::vector< unsigned int > * | _usrwrk_output = nullptr |
Slots in the nrs->o_usrwrk array to write to a field file. More... | |
const std::vector< std::string > * | _usrwrk_output_prefix = nullptr |
Filename prefix to use for naming the field files containing the nrs->o_usrwrk array slots. More... | |
double | _elapsedStepSum |
Sum of the elapsed time in NekRS solves. More... | |
double | _elapsedTime |
Sum of the total elapsed time in NekRS solves. More... | |
double | _tSolveStepMin |
Minimum step solve time. More... | |
double | _tSolveStepMax |
Maximum step solve time. More... | |
synchronization::SynchronizationEnum | _synchronization_interval |
When to synchronize the NekRS solution with the mesh mirror. More... | |
std::vector< std::string > | _usrwrk_indices |
quantities to write to nrs->usrwrk (and the order to write them) More... | |
std::vector< NekScalarValue * > | _nek_uos |
Userobjects containing stochastic input data. More... | |
unsigned int | _scratch_counter |
Counter for any potential NekScalarValue objects in the input file. More... | |
unsigned int | _n_uo_slots |
Number of scratch space slots used for NekScalarValue usage. More... | |
Static Protected Attributes | |
static bool | _first |
flag to indicate whether this is the first pass to serialize the solution More... | |
Run NekRS as a standalone application, without any data transfers to/from MOOSE.
NekRSStandaloneProblem::NekRSStandaloneProblem | ( | const InputParameters & | params | ) |
|
overridevirtualinherited |
Reimplemented in NekRSProblem, and NekRSSeparateDomainProblem.
|
protectedvirtualinherited |
Add a variable to represent the temperature of the NekRS solution. We allow this to be an entry point for derived classes because they might already be adding a temperature variable for coupling purposes.
Reimplemented in NekRSProblem.
|
inlinevirtualinherited |
Optional entry point called in externalSolve() where we can adjust the NekRS solution (such as to clip out high/low values of temperature). This is called after runStep(), but before writing anything to the Nek5000 backend or to output files.
Reimplemented in NekRSProblem.
|
protectedinherited |
Interpolate the NekRS boundary solution onto the boundary MOOSE mesh mirror (re2 -> mirror)
[in] | f | field to interpolate |
[out] | T | interpolated boundary value |
|
inlineinherited |
Check for duplicate entries in a 1-d vector
[in] | var | input vector |
[in] | name | string to use for printing error message |
|
inherited |
Check whether the user has already created a variable using one of the protected names that the wrapping is using.
[in] | name | variable name |
|
inlineoverridevirtualinherited |
|
protectedinherited |
Copy the data sent from MOOSE->Nek from host to device.
|
overridevirtualinherited |
|
protectedvirtualinherited |
Extract user-specified parts of the NekRS CFD solution onto the mesh mirror
|
protectedinherited |
Get a three-character prefix for use in writing output files for repeated Nek sibling apps.
[in] | number | multi-app number |
|
protectedvirtualinherited |
Fill an outgoing auxiliary variable field with nekRS solution data
[in] | var_number | auxiliary variable number |
[in] | value | nekRS solution data to fill the variable with |
|
inlineinherited |
Get the index of the first slot in the usrwrk that Cardinal is managing
|
protectedvirtualinherited |
Get the parameters for the external variables to be added
|
inherited |
Setup to fetch NekScalarValue user objects for sending scalar values into NekRS scratch space.
|
inlinevirtualinherited |
|
protectedinherited |
Initialize interpolation matrices for transfers in/out of nekRS.
|
overridevirtualinherited |
Reimplemented in NekRSProblem, and NekRSSeparateDomainProblem.
|
protectedinherited |
Interpolate the MOOSE mesh mirror solution onto the NekRS boundary mesh (mirror -> re2)
[in] | incoming_moose_value | MOOSE face values |
[out] | outgoing_nek_value | interpolated MOOSE face values onto the NekRS boundary mesh |
|
protectedinherited |
Interpolate the MOOSE mesh mirror solution onto the NekRS volume mesh (mirror -> re2)
[in] | elem_id | element ID |
[in] | incoming_moose_value | MOOSE face values |
[out] | outgoing_nek_value | interpolated MOOSE face values onto the NekRS volume mesh |
|
inherited |
|
virtualinherited |
Whether nekRS should write an output file for the current time step.
A nekRS output file (suffix .f000xx) is written if the time step is an integer multiple of the output writing interval or if the time step is the last time step.
|
inlineinherited |
Get the characteristic length
|
inherited |
Map nodal points on a MOOSE face element to the GLL points on a Nek face element.
|
inherited |
Map nodal points on a MOOSE face element to the GLL points on a Nek volume element.
This function is to be used when MOOSE variables are defined over the entire volume (maybe the MOOSE transfer only sent meaningful values to the coupling boundaries), so we need to do a volume interpolation of the incoming MOOSE data into nrs->usrwrk, rather than a face interpolation. This could be optimized in the future to truly only just write the boundary values into the nekRS scratch space rather than the volume values, but it looks right now that our biggest expense occurs in the MOOSE transfer system, not these transfers internally to nekRS.
|
inherited |
Map nodal points on a MOOSE volume element to the GLL points on a Nek volume element.
|
inlineinherited |
Get the minimum scratch space required for coupling; this space is guaranteed to be filled with data incoming from MOOSE, like heat flux boundary conditions or mesh displacements
|
inlinevirtualinherited |
Whether the solve is in nondimensional form
|
inlineinherited |
Get the number of usrwrk slots allocated
|
inherited |
Send values from NekScalarValue userobjects to NekRS.
|
inherited |
Whether a string ends in a particular sub-string
[in] | full | full string |
[in] | ending | sub-string ending |
|
virtualinherited |
Whether data should be synchronized in to nekRS
|
virtualinherited |
Whether data should be synchronized out of nekRS
|
overridevirtualinherited |
Reimplemented in NekRSProblem, and NekRSSeparateDomainProblem.
|
static |
|
protectedinherited |
Interpolate the NekRS volume solution onto the volume MOOSE mesh mirror (re2 -> mirror)
[in] | f | field to interpolate |
[out] | T | interpolated volume value |
|
protectedinherited |
Write into the NekRS solution space for coupling boundaries; for setting a mesh position in terms of a displacement, we need to add the displacement to the initial mesh coordinates.
[in] | elem_id | element ID |
[in] | field | field to write |
[in] | T | solution values to write for the field for the given element |
|
inherited |
Write NekRS solution field file
[in] | time | solution time in NekRS (if NekRS is non-dimensional, this will be non-dimensional) |
[in] | step | time step index |
|
protectedinherited |
Write into the NekRS solution space for coupling volumes; for setting a mesh position in terms of a displacement, we need to add the displacement to the initial mesh coordinates. For this, the 'add' parameter lets you pass in a vector of values (in NekRS's mesh order, i.e. the re2 order) to add.
[in] | elem_id | element ID |
[in] | field | field to write |
[in] | T | solution values to write for the field for the given element |
[in] | add | optional vector of values to add to each value set on the NekRS end |
|
protectedinherited |
Boundary IDs through which to couple nekRS and MOOSE.
|
protectedinherited |
NekRS casename.
|
protectedinherited |
For constant synchronization intervals, the desired frequency (in units of Nek time steps)
|
protectedinherited |
Reference isobaric specific heat capacity.
|
protectedinherited |
Whether to turn off all field file writing.
|
protectedinherited |
Reference characteristic temperature delta.
|
protectedinherited |
Sum of the elapsed time in NekRS solves.
|
protectedinherited |
Sum of the total elapsed time in NekRS solves.
|
protectedinherited |
Scratch space to place external NekRS fields before writing into auxiliary variables.
|
protectedinherited |
Numeric identifiers for the external variables.
|
staticprotectedinherited |
flag to indicate whether this is the first pass to serialize the solution
|
protectedinherited |
First slice in usrwrk for Cardinal to read/write data from.
|
protectedinherited |
Vandermonde interpolation matrix (for incoming transfers)
|
protectedinherited |
Vandermonde interpolation matrix (for outgoing transfers)
|
protectedinherited |
Whether the most recent time step was an output file writing step.
|
protectedinherited |
Reference characteristic length.
|
protectedinherited |
Minimum allowable scratch space size, strictly what is needed by Cardinal for coupling.
|
protectedinherited |
For the MOOSE mesh, the number of quadrature points in each coordinate direction.
|
protectedinherited |
Number of points for interpolated fields on the MOOSE mesh.
|
protectedinherited |
Number of surface elements in the data transfer mesh, across all processes.
|
protectedinherited |
Number of scratch space slots used for NekScalarValue usage.
|
protectedinherited |
Number of slices/slots to allocate in nrs->usrwrk to hold fields for coupling (i.e. data going into NekRS, written by Cardinal), or used for custom user actions, but not for coupling. By default, we just allocate 7 slots (no inherent reason, just a fairly big amount). For memory-limited cases, you can reduce this number to just the bare minimum necessary for your use case.
|
protectedinherited |
Number of vertices per element in the data transfer mesh, which depends on whether boundary/volume coupling.
|
protectedinherited |
Number of vertices per surface element of the transfer mesh.
|
protectedinherited |
Number of vertices per volume element of the transfer mesh.
|
protectedinherited |
Number of volume elements in the data transfer mesh, across all processes.
|
protectedinherited |
Whether an interpolation needs to be performed on the nekRS temperature solution, or if we can just grab the solution at specified points
|
protectedinherited |
Underlying mesh object on which NekRS exchanges fields with MOOSE or extracts NekRS's solution for I/O features
|
protectedinherited |
Userobjects containing stochastic input data.
|
protectedinherited |
Whether the nekRS solution is performed in nondimensional scales.
If nekRS is solving in non-dimensional form, this means that the nekRS solution is performed for:
In terms of heat flux boundary conditions, the entire energy conservation equation in nekRS is multiplied by \(\frac{L_{ref}}{\rho_{0}C_{p,0}U_{ref}\Delta T_{ref}}\) in order to clear the coefficient on the convective. Therefore, the heat source in nekRS is expressed in nondimensional form as \(q^\dagger=\frac{q}{\rho_{0}C_{p,0}U_{ref}\Delta T_{ref}}\). Here, 'Cp_0' is the specific heat capacity scale.
Unfortunately, there is no systematic way to get these reference scales from nekRS, so we need to inform MOOSE of any possible scaling so that we can appropriately scale the nekRS temperature to the dimensional form that is usually expected in MOOSE. Therefore, these scales just need to match what is used in the nekRS input files used to specify boundary conditions. Conversion between dimensional MOOSE heat flux to dimensionless nekRS heat flux is performed automatically, and does not require any special treatment in the nekRS scalarNeumannBC kernel.
|
protectedinherited |
NekRS solution fields to output to the mesh mirror.
|
protectedinherited |
Reference density.
|
protectedinherited |
Counter for any potential NekScalarValue objects in the input file.
|
protectedinherited |
|
protectedinherited |
Whether to skip writing a field file on NekRS's last time steo.
|
protectedinherited |
Start time of the simulation based on NekRS's .par file.
|
protectedinherited |
When to synchronize the NekRS solution with the mesh mirror.
This parameter determines when to synchronize the NekRS solution with the mesh mirror - this entails:
Several options are available:
'parent_app' will only send data between NekRS and a parent application when (1) the main application has just sent "new" information to NekRS, and when (2) the main application is just about to run a new time step (with updated BCs/source terms from NekRS).
nekRS is often subcycled relative to the application controlling it - that is, nekRS may be run with a time step 10x smaller than a conduction MOOSE app. If 'interpolate_transfers = false' in the master application, then the data going into nekRS is fixed for each of the subcycled time steps it takes, so these extra data transfers are completely unnecssary. This flag indicates that the information sent from MOOSE to NekRS should only be updated if the data from MOOSE is "new", and likewise whether the NekRS solution should only be interpolated to the mesh mirror once MOOSE is actually "ready" to solve a time step using it.
NOTE: if 'interpolate_transfers = true' in the master application, then the data coming into nekRS is unique on each subcycled time step, so setting this to true will in effect override interpolate_transfers
to be false. For the best performance, you should set interpolate_transfers
to false so that you don't even bother computing the interpolated data, since it's not used if this parameter is set to true.
|
protectedinherited |
Reference characteristic temperature.
|
protectedinherited |
The time stepper used for selection of time step size.
|
protectedinherited |
Postprocessor containing the signal of when a synchronization has occurred.
|
protectedinherited |
Underlying executioner.
|
protectedinherited |
Maximum step solve time.
|
protectedinherited |
Minimum step solve time.
|
protectedinherited |
Reference characteristic velocity.
|
protectedinherited |
quantities to write to nrs->usrwrk (and the order to write them)
|
protectedinherited |
Slots in the nrs->o_usrwrk array to write to a field file.
|
protectedinherited |
Filename prefix to use for naming the field files containing the nrs->o_usrwrk array slots.
|
protectedinherited |
Names of external variables when extracting the NekRS solution.
|
protectedinherited |
Descriptive string for the variables extracted from NekRS.
|
protectedinherited |
Whether the mesh contains volume-based coupling.
|
protectedinherited |
Whether to disable output file writing by NekRS and replace it by output file writing in Cardinal. Suppose the case name is 'channel'. If this parameter is false, then NekRS will write output files as usual, with names like channel0.f00001 for write step 1, channel0.f00002 for write step 2, and so on. If true, then NekRS itself does not output any files like this, and instead output files are written with names a01channel0.f00001, a01channel0.f00002 (for first Nek app), a02channel0.f00001, a02channel0.f00002 (for second Nek app), and so on. This feature should only be used when running repeated Nek sub apps so that the output from each app is retained. Otherwise, if running N repeated Nek sub apps, only a single output file is obtained because each app overwrites the output files of the other apps in the order that the apps reach the nekrs::outfld function.