95 virtual bool converged(
unsigned int)
override {
return true; }
99 virtual void syncSolutions(ExternalProblem::Direction direction)
override;
136 template <
typename T>
142 double (*f)(int, int);
145 int start_1d =
mesh->Nq;
147 int start_3d = start_1d * start_1d * start_1d;
148 int end_3d = end_1d * end_1d * end_1d;
155 double * Ttmp = (
double *)calloc(n_to_write,
sizeof(
double));
156 double * Telem = (
double *)calloc(start_3d,
sizeof(
double));
160 for (
int k = 0; k <
mesh->Nelements; ++k)
162 int offset = k * start_3d;
169 for (
int v = 0; v < start_3d; ++v)
170 Telem[v] = f(offset + v, 0 );
180 for (
int v = 0; v < end_3d; ++v, ++c)
181 Ttmp[c] = f(offset + indices[build][v], 0 );
187 for (
int v = 0; v < n_to_write; ++v)
202 template <
typename T>
208 double (*f)(int, int);
211 int start_1d =
mesh->Nq;
213 int start_2d = start_1d * start_1d;
214 int end_2d = end_1d * end_1d;
224 double * Ttmp = (
double *)calloc(n_to_write,
sizeof(
double));
225 double * Tface = (
double *)calloc(start_2d,
sizeof(
double));
226 double * scratch = (
double *)calloc(start_1d * end_1d,
sizeof(
double));
231 for (
int k = 0; k < bc.total_n_faces; ++k)
235 int i = bc.element[k];
237 int offset = i *
mesh->Nfaces * start_2d + j * start_2d;
244 for (
int v = 0; v < start_2d; ++v)
246 int id =
mesh->vmapM[offset + v];
247 Tface[v] = f(
id,
mesh->Nsgeo * (offset + v));
258 for (
int v = 0; v < end_2d; ++v, ++c)
260 int id =
mesh->vmapM[offset + indices[build][v]];
261 Ttmp[c] = f(
id,
mesh->Nsgeo * (offset + v));
269 for (
int v = 0; v < n_to_write; ++v)
290 const std::vector<double> * add =
nullptr);
304 const std::vector<double> * add =
nullptr);
332 const unsigned int & var_num,
333 const Real & divisor,
334 const Real & additive,
335 double ** outgoing_data);
348 const unsigned int & var_num,
349 const Real & divisor,
350 const Real & additive,
351 double ** outgoing_data);
373 const unsigned int & var_num,
374 const Real & divisor,
375 const Real & additive,
376 double ** outgoing_data);
396 double * incoming_moose_value,
397 double * outgoing_nek_value);
@ mesh
Definition CardinalEnums.h:288
void freePointer(T *ptr)
Definition CardinalUtils.h:23
Definition CardinalProblem.h:27
Definition FieldTransferBase.h:29
Definition NekRSMesh.h:51
int nBuildPerVolumeElem() const
Definition NekRSMesh.h:77
int nBuildPerSurfaceElem() const
Definition NekRSMesh.h:83
std::vector< std::vector< int > > cornerIndices() const
Definition NekRSMesh.h:308
const NekVolumeCoupling & volumeCoupling() const
Definition NekRSMesh.h:131
const NekBoundaryCoupling & boundaryCoupling() const
Definition NekRSMesh.h:125
Solve nekRS wrapped as a MOOSE app.
Definition NekRSProblem.h:37
void interpolateBoundarySolutionToNek(double *incoming_moose_value, double *outgoing_nek_value)
double _tSolveStepMin
Minimum step solve time.
Definition NekRSProblem.h:516
void mapVolumeDataToNekVolume(const unsigned int &e, const unsigned int &var_num, const Real &divisor, const Real &additive, double **outgoing_data)
const bool & _disable_fld_file_output
Whether to turn off all field file writing.
Definition NekRSProblem.h:431
bool _is_output_step
Whether the most recent time step was an output file writing step.
Definition NekRSProblem.h:468
static InputParameters validParams()
const std::vector< unsigned int > * _usrwrk_output
Slots in the nrs->o_usrwrk array to write to a field file.
Definition NekRSProblem.h:504
void copyIndividualScratchSlot(const unsigned int &slot) const
bool isUsrWrkSlotReservedForCoupling(const unsigned int &slot) const
Transient * _transient_executioner
Underlying executioner.
Definition NekRSProblem.h:480
virtual const bool hasMovingNekMesh() const
Definition NekRSProblem.h:111
virtual bool isOutputStep() const
Whether nekRS should write an output file for the current time step.
void writeVolumeSolution(const int slot, const int elem_id, double *s, const std::vector< double > *add=nullptr)
int _n_points
Number of points for interpolated fields on the MOOSE mesh.
Definition NekRSProblem.h:489
const std::vector< std::string > * _usrwrk_output_prefix
Filename prefix to use for naming the field files containing the nrs->o_usrwrk array slots.
Definition NekRSProblem.h:507
NekRSMesh * _nek_mesh
Definition NekRSProblem.h:474
void writeVolumeDisplacement(const int elem_id, double *s, const field::NekWriteEnum f, const std::vector< double > *add=nullptr)
virtual bool synchronizeOut()
void interpolateVolumeSolutionToNek(const int elem_id, double *incoming_moose_value, double *outgoing_nek_value)
static bool _first
flag to indicate whether this is the first pass to serialize the solution
Definition NekRSProblem.h:563
virtual void addExternalVariables() override
virtual void initialSetup() override
void boundarySolution(const T &field, double *s)
Definition NekRSProblem.h:203
NekTimeStepper * _timestepper
The time stepper used for selection of time step size.
Definition NekRSProblem.h:477
std::vector< FieldTransferBase * > _field_transfers
All of the FieldTransfer objects which pass data in/out of NekRS.
Definition NekRSProblem.h:566
unsigned int _n_usrwrk_slots
Definition NekRSProblem.h:444
int _n_vertices_per_volume
Number of vertices per volume element of the transfer mesh.
Definition NekRSProblem.h:462
double _elapsedTime
Sum of the total elapsed time in NekRS solves.
Definition NekRSProblem.h:513
const bool & _skip_final_field_file
Whether to skip writing a field file on NekRS's last time steo.
Definition NekRSProblem.h:450
int _n_vertices_per_surface
Number of vertices per surface element of the transfer mesh.
Definition NekRSProblem.h:456
void copyHostToDevice()
Copy the data sent from MOOSE->Nek from host to device.
virtual void syncSolutions(ExternalProblem::Direction direction) override
void mapFaceDataToNekFace(const unsigned int &e, const unsigned int &var_num, const Real &divisor, const Real &additive, double **outgoing_data)
std::string casename() const
Definition NekRSProblem.h:319
double _start_time
Start time of the simulation based on NekRS's .par file.
Definition NekRSProblem.h:465
const std::string & _casename
NekRS casename.
Definition NekRSProblem.h:412
bool isDataTransferHappening(ExternalProblem::Direction direction)
void volumeSolution(const T &field, double *s)
Definition NekRSProblem.h:137
double * _interpolation_incoming
Vandermonde interpolation matrix (for incoming transfers)
Definition NekRSProblem.h:498
virtual bool synchronizeIn()
double * _interpolation_outgoing
Vandermonde interpolation matrix (for outgoing transfers)
Definition NekRSProblem.h:495
void writeBoundarySolution(const int slot, const int elem_id, double *s)
bool _needs_interpolation
Definition NekRSProblem.h:486
void initializeInterpolationMatrices()
Initialize interpolation matrices for transfers in/out of nekRS.
std::vector< ScalarTransferBase * > _scalar_transfers
All of the ScalarTransfer objecst which pass data in/out of NekRS.
Definition NekRSProblem.h:569
std::set< unsigned int > _usrwrk_slots
Usrwrk slots managed by Cardinal.
Definition NekRSProblem.h:572
virtual bool converged(unsigned int) override
Definition NekRSProblem.h:95
virtual void externalSolve() override
synchronization::SynchronizationEnum _sync_interval
When to synchronize the NekRS solution with the mesh mirror.
Definition NekRSProblem.h:560
Transient * transientExecutioner() const
Definition NekRSProblem.h:59
unsigned int nUsrWrkSlots() const
Definition NekRSProblem.h:129
const PostprocessorValue * _transfer_in
Postprocessor containing the signal of when a synchronization has occurred.
Definition NekRSProblem.h:492
int nPoints() const
Definition NekRSProblem.h:50
const unsigned int & _constant_interval
For constant synchronization intervals, the desired frequency (in units of Nek time steps)
Definition NekRSProblem.h:447
void mapFaceDataToNekVolume(const unsigned int &e, const unsigned int &var_num, const Real &divisor, const Real &additive, double **outgoing_data)
Map nodal points on a MOOSE face element to the GLL points on a Nek volume element.
virtual bool nondimensional() const
Definition NekRSProblem.h:105
int _n_surface_elems
Number of surface elements in the data transfer mesh, across all processes.
Definition NekRSProblem.h:453
bool _nondimensional
Whether a dimensionalization action has been added.
Definition NekRSProblem.h:434
double _tSolveStepMax
Maximum step solve time.
Definition NekRSProblem.h:519
int _n_volume_elems
Number of volume elements in the data transfer mesh, across all processes.
Definition NekRSProblem.h:459
int _moose_Nq
For the MOOSE mesh, the number of quadrature points in each coordinate direction.
Definition NekRSProblem.h:501
std::string fieldFilePrefix(const int &number) const
NekRSProblem(const InputParameters ¶ms)
void writeFieldFile(const Real &time, const int &step) const
double _elapsedStepSum
Sum of the elapsed time in NekRS solves.
Definition NekRSProblem.h:510
const bool & _write_fld_files
Definition NekRSProblem.h:428
std::unique_ptr< NumericVector< Number > > _serialized_solution
Definition NekRSProblem.h:402
Time stepper that reads time step information directly from nekRS.
Definition NekTimeStepper.h:38
Definition CardinalEnums.h:93
NekWriteEnum
Enumeration of possible fields to write in nekRS.
Definition CardinalEnums.h:119
void interpolateVolumeHex3D(const double *I, double *x, int N, double *Ix, int M)
void allgatherv(const std::vector< int > &base_counts, const T *input, T *output, const int multiplier=1)
Definition NekInterface.h:1017
Real nondimensionalAdditive(const field::NekFieldEnum &field)
void interpolateSurfaceFaceHex3D(double *scratch, const double *I, double *x, int N, double *Ix, int M)
double(*)(int, int) solutionPointer(const field::NekFieldEnum &field)
Definition NekInterface.h:794
Real nondimensionalDivisor(const field::NekFieldEnum &field)
Return the reference divisor scale that defines the non-dimensional field.
SynchronizationEnum
Definition CardinalEnums.h:66