Cardinal
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
NekRSProblem Class Reference

Solve nekRS wrapped as a MOOSE app. More...

#include <NekRSProblem.h>

Inheritance diagram for NekRSProblem:
[legend]

Public Member Functions

 NekRSProblem (const InputParameters &params)
 
 ~NekRSProblem ()
 Write nekRS's solution at the last output step. More...
 
virtual void initialSetup () override
 Perform some sanity checks on the problem setup. More...
 
void sendBoundaryHeatFluxToNek ()
 Send boundary heat flux to nekRS. More...
 
void sendBoundaryDeformationToNek ()
 Send boundary deformation to nekRS. More...
 
void sendVolumeDeformationToNek ()
 Send volume mesh deformation flux to nekRS. More...
 
void sendVolumeHeatSourceToNek ()
 Send volume heat source to nekRS. More...
 
void getBoundaryTemperatureFromNek ()
 Get boundary temperature from nekRS. More...
 
void getVolumeTemperatureFromNek ()
 Get volume temperature from nekRS. More...
 
virtual void adjustNekSolution () override
 
virtual void syncSolutions (ExternalProblem::Direction direction) override
 
virtual void addExternalVariables () override
 
virtual double maxInterpolatedTemperature () const
 
virtual double minInterpolatedTemperature () const
 
virtual const bool hasMovingNekMesh () const override
 
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 bool isOutputStep () const
 Whether nekRS should write an output file for the current time step. More...
 
virtual void externalSolve () override
 
virtual bool converged (unsigned int) override
 
virtual bool nondimensional () 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

bool normalizeHeatSource (const double moose_integral, const double nek_integral, double &normalized_nek_integral)
 
void checkInitialFluxValues (const Real &nek_flux, const Real &moose_flux) const
 
virtual void addTemperatureVariable () override
 
void calculateMeshVelocity (int e, const field::NekWriteEnum &field)
 
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 ()
 
std::string fieldFilePrefix (const int &number) const
 

Protected Attributes

const bool & _has_heat_source
 Whether a heat source will be applied to NekRS from MOOSE. More...
 
const bool & _conserve_flux_by_sideset
 
const Real & _abs_tol
 Absolute tolerance for checking flux/heat source normalizations. More...
 
const Real & _rel_tol
 Relative tolerance for checking flux/heat source normalizations. More...
 
const PostprocessorValue * _flux_integral = nullptr
 Total surface-integrated flux coming from the coupled MOOSE app. More...
 
const VectorPostprocessorValue * _flux_integral_vpp = nullptr
 Sideset-wise surface-integrated flux coming from the coupled MOOSE app. More...
 
const PostprocessorValue * _source_integral = nullptr
 Total volume-integrated heat source coming from the coupled MOOSE app. More...
 
const PostprocessorValue * _min_T = nullptr
 Postprocessor to limit the minimum temperature. More...
 
const PostprocessorValue * _max_T = nullptr
 Postprocessor to limit the maximum temperature. More...
 
double * _T = nullptr
 nekRS temperature interpolated onto the data transfer mesh More...
 
double * _flux_face = nullptr
 MOOSE flux interpolated onto the (boundary) data transfer mesh. More...
 
double * _flux_elem = nullptr
 MOOSE flux interpolated onto the (volume) data transfer mesh. More...
 
double * _source_elem = nullptr
 MOOSE heat source interpolated onto the data transfer mesh. More...
 
double * _displacement_x = nullptr
 displacement in x for all nodes from MOOSE, for moving mesh problems More...
 
double * _displacement_y = nullptr
 displacement in y for all nodes from MOOSE, for moving mesh problems More...
 
double * _displacement_z = nullptr
 displacement in z for all nodes from MOOSE, for moving mesh problems More...
 
double * _mesh_velocity_elem = nullptr
 mesh velocity for a given element, used internally for calculating mesh velocity over one element More...
 
unsigned int _temp_var
 temperature transfer variable written to be nekRS More...
 
unsigned int _avg_flux_var
 flux transfer variable read from by nekRS More...
 
unsigned int _disp_x_var
 x-displacment transfer variable read for moving mesh problems More...
 
unsigned int _disp_y_var
 y-displacment transfer variable read for moving mesh problems More...
 
unsigned int _disp_z_var
 z-displacment transfer variable read for moving mesh problems More...
 
unsigned int _heat_source_var
 volumetric heat source variable read from by nekRS More...
 
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...
 

Detailed Description

Solve nekRS wrapped as a MOOSE app.

This object controls all of the execution of and data transfers to/from nekRS, fully abstracted from the Nek5000 backend.

The nekRS temperature solution is interpolated onto the NekRSMesh by multiplying the nekRS temperature by an interpolation matrix. In the opposite direction, the flux from MOOSE is interpolated onto the nekRS mesh by a similar interpolation matrix. This interpolation matrix expresses the nekRS/MOOSE solutions in terms of interpolating Legendre polynomials, and is equal to \(V_{moose}V_{nek}^{-1}\), where \(V_{moose}\) is the Vandermonde matrix of the MOOSE mesh's node points and \(V_{nek}\) is the Vandermonde matrix of the nekRS mesh's 1-D quadrature points. If the interpolation matrix is unity, this means that the libMesh node points exactly coincide with the nekRS quadrature point locations, and hence no interpolation is actually needed.

Constructor & Destructor Documentation

◆ NekRSProblem()

NekRSProblem::NekRSProblem ( const InputParameters &  params)

◆ ~NekRSProblem()

NekRSProblem::~NekRSProblem ( )

Write nekRS's solution at the last output step.

If Nek is not the master app, the number of time steps it takes is controlled by the master app. Depending on the settings in the .par file, it becomes possible that nekRS may not write an output file on the simulation's actual last time step, because Nek may not know when that last time step is. Therefore, here we can force nekRS to write its output.

Member Function Documentation

◆ addExternalVariables()

virtual void NekRSProblem::addExternalVariables ( )
overridevirtual

Reimplemented from NekRSProblemBase.

◆ addTemperatureVariable()

virtual void NekRSProblem::addTemperatureVariable ( )
inlineoverrideprotectedvirtual

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 from NekRSProblemBase.

◆ adjustNekSolution()

virtual void NekRSProblem::adjustNekSolution ( )
overridevirtual

Adjust the NekRS solution by introducing max/min temperature clipping to help with underresolved flow

Reimplemented from NekRSProblemBase.

◆ boundarySolution()

void NekRSProblemBase::boundarySolution ( const field::NekFieldEnum f,
double *  T 
)
protectedinherited

Interpolate the NekRS boundary solution onto the boundary MOOSE mesh mirror (re2 -> mirror)

Parameters
[in]ffield to interpolate
[out]Tinterpolated boundary value

◆ calculateMeshVelocity()

void NekRSProblem::calculateMeshVelocity ( int  e,
const field::NekWriteEnum field 
)
protected

Calculate mesh velocity for NekRS's blending solver using current and previous displacement values and write it to nrs->usrwrk, from where it can be accessed in nekRS's .oudf file.

Parameters
[in]eBoundary element that the displacement values belong to
[in]fieldNekWriteEnum mesh_velocity_x/y/z field

◆ checkDuplicateEntries()

template<typename T >
void CardinalProblem::checkDuplicateEntries ( const std::vector< T > &  var,
const std::string &  name 
) const
inlineinherited

Check for duplicate entries in a 1-d vector

Parameters
[in]varinput vector
[in]namestring to use for printing error message

◆ checkDuplicateVariableName()

void CardinalProblem::checkDuplicateVariableName ( const std::string &  name) const
inherited

Check whether the user has already created a variable using one of the protected names that the wrapping is using.

Parameters
[in]namevariable name

◆ checkInitialFluxValues()

void NekRSProblem::checkInitialFluxValues ( const Real &  nek_flux,
const Real &  moose_flux 
) const
protected

Print a warning to the user if the initial fluxes (before normalization) differ significantly, since this can indicate an error with model setup.

Parameters
[in]nek_fluxflux to be received by Nek
[in]moose_fluxflux sent by MOOSE

◆ converged()

virtual bool NekRSProblemBase::converged ( unsigned int  )
inlineoverridevirtualinherited

◆ copyScratchToDevice()

void NekRSProblemBase::copyScratchToDevice ( )
protectedinherited

Copy the data sent from MOOSE->Nek from host to device.

◆ externalSolve()

virtual void NekRSProblemBase::externalSolve ( )
overridevirtualinherited

◆ extractOutputs()

virtual void NekRSProblemBase::extractOutputs ( )
protectedvirtualinherited

Extract user-specified parts of the NekRS CFD solution onto the mesh mirror

◆ fieldFilePrefix()

std::string NekRSProblemBase::fieldFilePrefix ( const int &  number) const
protectedinherited

Get a three-character prefix for use in writing output files for repeated Nek sibling apps.

Parameters
[in]numbermulti-app number

◆ fillAuxVariable()

virtual void NekRSProblemBase::fillAuxVariable ( const unsigned int  var_number,
const double *  value 
)
protectedvirtualinherited

Fill an outgoing auxiliary variable field with nekRS solution data

Parameters
[in]var_numberauxiliary variable number
[in]valuenekRS solution data to fill the variable with

◆ firstReservedUsrwrkSlot()

unsigned int NekRSProblemBase::firstReservedUsrwrkSlot ( ) const
inlineinherited

Get the index of the first slot in the usrwrk that Cardinal is managing

Returns
index of first slot

◆ getBoundaryTemperatureFromNek()

void NekRSProblem::getBoundaryTemperatureFromNek ( )

Get boundary temperature from nekRS.

◆ getExternalVariableParameters()

virtual InputParameters NekRSProblemBase::getExternalVariableParameters ( )
protectedvirtualinherited

Get the parameters for the external variables to be added

Returns
external variable parameters

◆ getNekScalarValueUserObjects()

void NekRSProblemBase::getNekScalarValueUserObjects ( )
inherited

Setup to fetch NekScalarValue user objects for sending scalar values into NekRS scratch space.

◆ getVolumeTemperatureFromNek()

void NekRSProblem::getVolumeTemperatureFromNek ( )

Get volume temperature from nekRS.

◆ hasMovingNekMesh()

virtual const bool NekRSProblem::hasMovingNekMesh ( ) const
inlineoverridevirtual

Whether the mesh is moving

Returns
whether the mesh is moving

Reimplemented from NekRSProblemBase.

◆ initializeInterpolationMatrices()

void NekRSProblemBase::initializeInterpolationMatrices ( )
protectedinherited

Initialize interpolation matrices for transfers in/out of nekRS.

◆ initialSetup()

virtual void NekRSProblem::initialSetup ( )
overridevirtual

Perform some sanity checks on the problem setup.

This function performs checks like making sure that a transient executioner is used to wrap nekRS, that no time shift has been requested to the start of nekRS, that the correct NekTimeStepper is used, etc.

Reimplemented from NekRSProblemBase.

◆ interpolateBoundarySolutionToNek()

void NekRSProblemBase::interpolateBoundarySolutionToNek ( double *  incoming_moose_value,
double *  outgoing_nek_value 
)
protectedinherited

Interpolate the MOOSE mesh mirror solution onto the NekRS boundary mesh (mirror -> re2)

Parameters
[in]incoming_moose_valueMOOSE face values
[out]outgoing_nek_valueinterpolated MOOSE face values onto the NekRS boundary mesh

◆ interpolateVolumeSolutionToNek()

void NekRSProblemBase::interpolateVolumeSolutionToNek ( const int  elem_id,
double *  incoming_moose_value,
double *  outgoing_nek_value 
)
protectedinherited

Interpolate the MOOSE mesh mirror solution onto the NekRS volume mesh (mirror -> re2)

Parameters
[in]elem_idelement ID
[in]incoming_moose_valueMOOSE face values
[out]outgoing_nek_valueinterpolated MOOSE face values onto the NekRS volume mesh

◆ isDataTransferHappening()

bool NekRSProblemBase::isDataTransferHappening ( ExternalProblem::Direction  direction)
inherited

Whether a data transfer to/from Nek is occurring

Parameters
[in]directiondirection of data transfer
Returns
whether a data transfer to Nek is about to occur

◆ isOutputStep()

virtual bool NekRSProblemBase::isOutputStep ( ) const
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.

Returns
whether to write a nekRS output file

◆ L_ref()

double NekRSProblemBase::L_ref ( ) const
inlineinherited

Get the characteristic length

Returns
characteristic length

◆ mapFaceDataToNekFace()

void NekRSProblemBase::mapFaceDataToNekFace ( const unsigned int &  e,
const unsigned int &  var_num,
const Real &  multiplier,
double **  outgoing_data 
)
inherited

Map nodal points on a MOOSE face element to the GLL points on a Nek face element.

Parameters
[in]eMOOSE element ID
[in]var_numvariable index to fetch MOOSE data from
[in]multipliermultiplier to apply to the MOOSE data before sending to Nek
[out]outgoing_datadata represented on Nek's GLL points, ready to be applied in Nek

◆ mapFaceDataToNekVolume()

void NekRSProblemBase::mapFaceDataToNekVolume ( const unsigned int &  e,
const unsigned int &  var_num,
const Real &  multiplier,
double **  outgoing_data 
)
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.

Parameters
[in]eMOOSE element ID
[in]var_numvariable index to fetch MOOSE data from
[in]multipliermultiplier to apply to the MOOSE data before sending to Nek
[out]outgoing_datadata represented on Nek's GLL points, ready to be applied in Nek

◆ mapVolumeDataToNekVolume()

void NekRSProblemBase::mapVolumeDataToNekVolume ( const unsigned int &  e,
const unsigned int &  var_num,
const Real &  multiplier,
double **  outgoing_data 
)
inherited

Map nodal points on a MOOSE volume element to the GLL points on a Nek volume element.

Parameters
[in]eMOOSE element ID
[in]var_numvariable index to fetch MOOSE data from
[in]multipliermultiplier to apply to the MOOSE data before sending to Nek
[out]outgoing_datadata represented on Nek's GLL points, ready to be applied in Nek

◆ maxInterpolatedTemperature()

virtual double NekRSProblem::maxInterpolatedTemperature ( ) const
virtual

Determine the maximum interpolated temperature on the NekRSMesh for diagnostic info

Returns
maximum interpolated surface temperature

◆ minimumScratchSizeForCoupling()

unsigned int NekRSProblemBase::minimumScratchSizeForCoupling ( ) const
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

Returns
minimum scratch space reserved for coupling

◆ minInterpolatedTemperature()

virtual double NekRSProblem::minInterpolatedTemperature ( ) const
virtual

Determine the minimum interpolated temperature on the NekRSMesh for diagnostic info

Returns
minimum interpolated surface temperature

◆ nondimensional()

virtual bool NekRSProblemBase::nondimensional ( ) const
inlinevirtualinherited

Whether the solve is in nondimensional form

Returns
whether solve is in nondimensional form

◆ normalizeHeatSource()

bool NekRSProblem::normalizeHeatSource ( const double  moose_integral,
const double  nek_integral,
double &  normalized_nek_integral 
)
protected

Normalize the volumetric heat source sent to NekRS

Parameters
[in]moose_integraltotal integrated value from MOOSE to conserve
[in]nek_integraltotal integrated value in nekRS to adjust
[out]normalized_nek_integralfinal normalized value
Returns
whether normalization was successful, i.e. normalized_nek_integral equals moose_integral

◆ nUsrWrkSlots()

unsigned int NekRSProblemBase::nUsrWrkSlots ( ) const
inlineinherited

Get the number of usrwrk slots allocated

Returns
number of allocated usrwrk slots

◆ sendBoundaryDeformationToNek()

void NekRSProblem::sendBoundaryDeformationToNek ( )

Send boundary deformation to nekRS.

◆ sendBoundaryHeatFluxToNek()

void NekRSProblem::sendBoundaryHeatFluxToNek ( )

Send boundary heat flux to nekRS.

◆ sendScalarValuesToNek()

void NekRSProblemBase::sendScalarValuesToNek ( )
inherited

Send values from NekScalarValue userobjects to NekRS.

◆ sendVolumeDeformationToNek()

void NekRSProblem::sendVolumeDeformationToNek ( )

Send volume mesh deformation flux to nekRS.

◆ sendVolumeHeatSourceToNek()

void NekRSProblem::sendVolumeHeatSourceToNek ( )

Send volume heat source to nekRS.

◆ stringHasEnding()

bool CardinalProblem::stringHasEnding ( std::string const &  full,
std::string const &  ending 
) const
inherited

Whether a string ends in a particular sub-string

Parameters
[in]fullfull string
[in]endingsub-string ending
Returns
whether full string has ending

◆ synchronizeIn()

virtual bool NekRSProblemBase::synchronizeIn ( )
virtualinherited

Whether data should be synchronized in to nekRS

Returns
whether inward data synchronization should occur

◆ synchronizeOut()

virtual bool NekRSProblemBase::synchronizeOut ( )
virtualinherited

Whether data should be synchronized out of nekRS

Returns
whether outward data synchronization should occur

◆ syncSolutions()

virtual void NekRSProblem::syncSolutions ( ExternalProblem::Direction  direction)
overridevirtual

Reimplemented from NekRSProblemBase.

◆ validParams()

static InputParameters NekRSProblem::validParams ( )
static

◆ volumeSolution()

void NekRSProblemBase::volumeSolution ( const field::NekFieldEnum f,
double *  T 
)
protectedinherited

Interpolate the NekRS volume solution onto the volume MOOSE mesh mirror (re2 -> mirror)

Parameters
[in]ffield to interpolate
[out]Tinterpolated volume value

◆ writeBoundarySolution()

void NekRSProblemBase::writeBoundarySolution ( const int  elem_id,
const field::NekWriteEnum field,
double *  T 
)
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.

Parameters
[in]elem_idelement ID
[in]fieldfield to write
[in]Tsolution values to write for the field for the given element

◆ writeFieldFile()

void NekRSProblemBase::writeFieldFile ( const Real &  time,
const int &  step 
) const
inherited

Write NekRS solution field file

Parameters
[in]timesolution time in NekRS (if NekRS is non-dimensional, this will be non-dimensional)
[in]steptime step index

◆ writeVolumeSolution()

void NekRSProblemBase::writeVolumeSolution ( const int  elem_id,
const field::NekWriteEnum field,
double *  T,
const std::vector< double > *  add = nullptr 
)
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.

Parameters
[in]elem_idelement ID
[in]fieldfield to write
[in]Tsolution values to write for the field for the given element
[in]addoptional vector of values to add to each value set on the NekRS end

Member Data Documentation

◆ _abs_tol

const Real& NekRSProblem::_abs_tol
protected

Absolute tolerance for checking flux/heat source normalizations.

◆ _avg_flux_var

unsigned int NekRSProblem::_avg_flux_var
protected

flux transfer variable read from by nekRS

◆ _boundary

const std::vector<int>* NekRSProblemBase::_boundary = nullptr
protectedinherited

Boundary IDs through which to couple nekRS and MOOSE.

◆ _casename

const std::string& NekRSProblemBase::_casename
protectedinherited

NekRS casename.

◆ _conserve_flux_by_sideset

const bool& NekRSProblem::_conserve_flux_by_sideset
protected

Whether to conserve heat flux received in NekRS by individually re-normalizing with integrals over individual sideset. This approach is technically more accurate, but places limitations on how the sidesets are defined (they should NOT share any nodes with one another) and more effort with vector postprocessors, so it is not the default.

◆ _constant_interval

const unsigned int& NekRSProblemBase::_constant_interval
protectedinherited

For constant synchronization intervals, the desired frequency (in units of Nek time steps)

◆ _Cp_0

const Real& NekRSProblemBase::_Cp_0
protectedinherited

Reference isobaric specific heat capacity.

◆ _disable_fld_file_output

const bool& NekRSProblemBase::_disable_fld_file_output
protectedinherited

Whether to turn off all field file writing.

◆ _disp_x_var

unsigned int NekRSProblem::_disp_x_var
protected

x-displacment transfer variable read for moving mesh problems

◆ _disp_y_var

unsigned int NekRSProblem::_disp_y_var
protected

y-displacment transfer variable read for moving mesh problems

◆ _disp_z_var

unsigned int NekRSProblem::_disp_z_var
protected

z-displacment transfer variable read for moving mesh problems

◆ _displacement_x

double* NekRSProblem::_displacement_x = nullptr
protected

displacement in x for all nodes from MOOSE, for moving mesh problems

◆ _displacement_y

double* NekRSProblem::_displacement_y = nullptr
protected

displacement in y for all nodes from MOOSE, for moving mesh problems

◆ _displacement_z

double* NekRSProblem::_displacement_z = nullptr
protected

displacement in z for all nodes from MOOSE, for moving mesh problems

◆ _dT_ref

const Real& NekRSProblemBase::_dT_ref
protectedinherited

Reference characteristic temperature delta.

◆ _elapsedStepSum

double NekRSProblemBase::_elapsedStepSum
protectedinherited

Sum of the elapsed time in NekRS solves.

◆ _elapsedTime

double NekRSProblemBase::_elapsedTime
protectedinherited

Sum of the total elapsed time in NekRS solves.

◆ _external_data

double* NekRSProblemBase::_external_data = nullptr
protectedinherited

Scratch space to place external NekRS fields before writing into auxiliary variables.

◆ _external_vars

std::vector<unsigned int> NekRSProblemBase::_external_vars
protectedinherited

Numeric identifiers for the external variables.

◆ _first

bool NekRSProblemBase::_first
staticprotectedinherited

flag to indicate whether this is the first pass to serialize the solution

◆ _first_reserved_usrwrk_slot

const unsigned int& NekRSProblemBase::_first_reserved_usrwrk_slot
protectedinherited

First slice in usrwrk for Cardinal to read/write data from.

◆ _flux_elem

double* NekRSProblem::_flux_elem = nullptr
protected

MOOSE flux interpolated onto the (volume) data transfer mesh.

◆ _flux_face

double* NekRSProblem::_flux_face = nullptr
protected

MOOSE flux interpolated onto the (boundary) data transfer mesh.

◆ _flux_integral

const PostprocessorValue* NekRSProblem::_flux_integral = nullptr
protected

Total surface-integrated flux coming from the coupled MOOSE app.

The mesh used for the MOOSE app may be very different from the mesh used by nekRS. Elements may be much finer/coarser, and one element on the MOOSE app may not be a clear subset/superset of the elements on the nekRS mesh. Therefore, to ensure conservation of energy, we send the total flux integral to nekRS for internal normalization of the heat flux applied on the nekRS mesh.

◆ _flux_integral_vpp

const VectorPostprocessorValue* NekRSProblem::_flux_integral_vpp = nullptr
protected

Sideset-wise surface-integrated flux coming from the coupled MOOSE app.

The mesh used for the MOOSE app may be very different from the mesh used by nekRS. Elements may be much finer/coarser, and one element on the MOOSE app may not be a clear subset/superset of the elements on the nekRS mesh. Therefore, to ensure conservation of energy, we send the flux integrals for each sideset to nekRS for internal normalization of the heat flux applied on the nekRS mesh.

◆ _has_heat_source

const bool& NekRSProblem::_has_heat_source
protected

Whether a heat source will be applied to NekRS from MOOSE.

◆ _heat_source_var

unsigned int NekRSProblem::_heat_source_var
protected

volumetric heat source variable read from by nekRS

◆ _interpolation_incoming

double* NekRSProblemBase::_interpolation_incoming = nullptr
protectedinherited

Vandermonde interpolation matrix (for incoming transfers)

◆ _interpolation_outgoing

double* NekRSProblemBase::_interpolation_outgoing = nullptr
protectedinherited

Vandermonde interpolation matrix (for outgoing transfers)

◆ _is_output_step

bool NekRSProblemBase::_is_output_step
protectedinherited

Whether the most recent time step was an output file writing step.

◆ _L_ref

const Real& NekRSProblemBase::_L_ref
protectedinherited

Reference characteristic length.

◆ _max_T

const PostprocessorValue* NekRSProblem::_max_T = nullptr
protected

Postprocessor to limit the maximum temperature.

◆ _mesh_velocity_elem

double* NekRSProblem::_mesh_velocity_elem = nullptr
protected

mesh velocity for a given element, used internally for calculating mesh velocity over one element

◆ _min_T

const PostprocessorValue* NekRSProblem::_min_T = nullptr
protected

Postprocessor to limit the minimum temperature.

◆ _minimum_scratch_size_for_coupling

unsigned int NekRSProblemBase::_minimum_scratch_size_for_coupling
protectedinherited

Minimum allowable scratch space size, strictly what is needed by Cardinal for coupling.

◆ _moose_Nq

int NekRSProblemBase::_moose_Nq
protectedinherited

For the MOOSE mesh, the number of quadrature points in each coordinate direction.

◆ _n_points

int NekRSProblemBase::_n_points
protectedinherited

Number of points for interpolated fields on the MOOSE mesh.

◆ _n_surface_elems

int NekRSProblemBase::_n_surface_elems
protectedinherited

Number of surface elements in the data transfer mesh, across all processes.

◆ _n_uo_slots

unsigned int NekRSProblemBase::_n_uo_slots
protectedinherited

Number of scratch space slots used for NekScalarValue usage.

◆ _n_usrwrk_slots

unsigned int NekRSProblemBase::_n_usrwrk_slots
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.

◆ _n_vertices_per_elem

int NekRSProblemBase::_n_vertices_per_elem
protectedinherited

Number of vertices per element in the data transfer mesh, which depends on whether boundary/volume coupling.

◆ _n_vertices_per_surface

int NekRSProblemBase::_n_vertices_per_surface
protectedinherited

Number of vertices per surface element of the transfer mesh.

◆ _n_vertices_per_volume

int NekRSProblemBase::_n_vertices_per_volume
protectedinherited

Number of vertices per volume element of the transfer mesh.

◆ _n_volume_elems

int NekRSProblemBase::_n_volume_elems
protectedinherited

Number of volume elements in the data transfer mesh, across all processes.

◆ _needs_interpolation

bool NekRSProblemBase::_needs_interpolation
protectedinherited

Whether an interpolation needs to be performed on the nekRS temperature solution, or if we can just grab the solution at specified points

◆ _nek_mesh

NekRSMesh* NekRSProblemBase::_nek_mesh
protectedinherited

Underlying mesh object on which NekRS exchanges fields with MOOSE or extracts NekRS's solution for I/O features

◆ _nek_uos

std::vector<NekScalarValue *> NekRSProblemBase::_nek_uos
protectedinherited

Userobjects containing stochastic input data.

◆ _nondimensional

const bool& NekRSProblemBase::_nondimensional
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:

  • nondimensional temperature \(T^\dagger\), defined as \(T^\dagger=\frac{T-T_{ref}}{\Delta T_{ref}}\). The 'T_ref' and 'dT_ref' variables here represent these scales.
  • nondimensional velocity \(U^\dagger=\frac{u}{U_{ref}}\). The 'U_ref' variable here represents this velocity scale.
  • nondimensional pressure \(P^dagger=\frac{P}{\rho_{0}U_{ref}^2}\). The 'rho_0' variable here represents this density parameter.

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.

◆ _outputs

const MultiMooseEnum* NekRSProblemBase::_outputs = nullptr
protectedinherited

NekRS solution fields to output to the mesh mirror.

◆ _rel_tol

const Real& NekRSProblem::_rel_tol
protected

Relative tolerance for checking flux/heat source normalizations.

◆ _rho_0

const Real& NekRSProblemBase::_rho_0
protectedinherited

Reference density.

◆ _scratch_counter

unsigned int NekRSProblemBase::_scratch_counter
protectedinherited

Counter for any potential NekScalarValue objects in the input file.

◆ _serialized_solution

std::unique_ptr<NumericVector<Number> > NekRSProblemBase::_serialized_solution
protectedinherited

◆ _skip_final_field_file

const bool& NekRSProblemBase::_skip_final_field_file
protectedinherited

Whether to skip writing a field file on NekRS's last time steo.

◆ _source_elem

double* NekRSProblem::_source_elem = nullptr
protected

MOOSE heat source interpolated onto the data transfer mesh.

◆ _source_integral

const PostprocessorValue* NekRSProblem::_source_integral = nullptr
protected

Total volume-integrated heat source coming from the coupled MOOSE app.

The mesh used for the MOOSE app may be very different from the mesh used by nekRS. Elements may be much finer/coarser, and one element on the MOOSE app may not be a clear subset/superset of the elements on the nekRS mesh. Therefore, to ensure conservation of energy, we send the total source integral to nekRS for internal normalization of the heat source applied on the nekRS mesh.

◆ _start_time

double NekRSProblemBase::_start_time
protectedinherited

Start time of the simulation based on NekRS's .par file.

◆ _synchronization_interval

synchronization::SynchronizationEnum NekRSProblemBase::_synchronization_interval
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:

  • Mapping from the NekRS spectral element mesh to the finite element mesh mirror, to extract information from NekRS and make it available to MOOSE
  • Mapping from the finite element mesh mirror into the NekRS spectral element mesh, to send information from MOOSE into NekRS

Several options are available:

  • 'constant' will simply keep the NekRS solution and the mesh mirror entirely consistent with one another on a given constant frequency of time steps. By default, the 'constant_interval' is 1, so that NekRS and MOOSE communicate with each other on every single time step
  • '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.

◆ _T

double* NekRSProblem::_T = nullptr
protected

nekRS temperature interpolated onto the data transfer mesh

◆ _T_ref

const Real& NekRSProblemBase::_T_ref
protectedinherited

Reference characteristic temperature.

◆ _temp_var

unsigned int NekRSProblem::_temp_var
protected

temperature transfer variable written to be nekRS

◆ _timestepper

NekTimeStepper* NekRSProblemBase::_timestepper = nullptr
protectedinherited

The time stepper used for selection of time step size.

◆ _transfer_in

const PostprocessorValue* NekRSProblemBase::_transfer_in = nullptr
protectedinherited

Postprocessor containing the signal of when a synchronization has occurred.

◆ _transient_executioner

Transient* NekRSProblemBase::_transient_executioner = nullptr
protectedinherited

Underlying executioner.

◆ _tSolveStepMax

double NekRSProblemBase::_tSolveStepMax
protectedinherited

Maximum step solve time.

◆ _tSolveStepMin

double NekRSProblemBase::_tSolveStepMin
protectedinherited

Minimum step solve time.

◆ _U_ref

const Real& NekRSProblemBase::_U_ref
protectedinherited

Reference characteristic velocity.

◆ _usrwrk_indices

std::vector<std::string> NekRSProblemBase::_usrwrk_indices
protectedinherited

quantities to write to nrs->usrwrk (and the order to write them)

◆ _usrwrk_output

const std::vector<unsigned int>* NekRSProblemBase::_usrwrk_output = nullptr
protectedinherited

Slots in the nrs->o_usrwrk array to write to a field file.

◆ _usrwrk_output_prefix

const std::vector<std::string>* NekRSProblemBase::_usrwrk_output_prefix = nullptr
protectedinherited

Filename prefix to use for naming the field files containing the nrs->o_usrwrk array slots.

◆ _var_names

std::vector<std::string> NekRSProblemBase::_var_names
protectedinherited

Names of external variables when extracting the NekRS solution.

◆ _var_string

std::string NekRSProblemBase::_var_string
protectedinherited

Descriptive string for the variables extracted from NekRS.

◆ _volume

bool NekRSProblemBase::_volume
protectedinherited

Whether the mesh contains volume-based coupling.

◆ _write_fld_files

const bool& NekRSProblemBase::_write_fld_files
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.


The documentation for this class was generated from the following file: