Line data Source code
1 : /********************************************************************/ 2 : /* SOFTWARE COPYRIGHT NOTIFICATION */ 3 : /* Cardinal */ 4 : /* */ 5 : /* (c) 2021 UChicago Argonne, LLC */ 6 : /* ALL RIGHTS RESERVED */ 7 : /* */ 8 : /* Prepared by UChicago Argonne, LLC */ 9 : /* Under Contract No. DE-AC02-06CH11357 */ 10 : /* With the U. S. Department of Energy */ 11 : /* */ 12 : /* Prepared by Battelle Energy Alliance, LLC */ 13 : /* Under Contract No. DE-AC07-05ID14517 */ 14 : /* With the U. S. Department of Energy */ 15 : /* */ 16 : /* See LICENSE for full restrictions */ 17 : /********************************************************************/ 18 : 19 : #pragma once 20 : 21 : #include "NekTransferBase.h" 22 : #include "AuxiliarySystem.h" 23 : 24 : /** 25 : * Base class for facilitating a data transfer between MOOSE and the NekRS 26 : * code internals for a field (a variable defined at the GLL points). 27 : */ 28 : class FieldTransferBase : public NekTransferBase 29 : { 30 : public: 31 : static InputParameters validParams(); 32 : 33 : FieldTransferBase(const InputParameters & parameters); 34 : 35 : ~FieldTransferBase(); 36 : 37 : /** 38 : * Get the mapping of usrwrk slots to variable names for all field transfers 39 : * @return map ordered as (slot number, name) 40 : */ 41 815 : static std::map<unsigned int, std::string> usrwrkMap() { return _field_usrwrk_map; } 42 : 43 : protected: 44 : /** 45 : * Fill an outgoing auxiliary variable field with nekRS solution data 46 : * @param[in] var_number auxiliary variable number 47 : * @param[in] value nekRS solution data to fill the variable with 48 : */ 49 : void fillAuxVariable(const unsigned int var_number, const double * value); 50 : 51 : /** 52 : * Add a MOOSE variable to facilitate coupling 53 : * @param[in] name variable name 54 : */ 55 : void addExternalVariable(const std::string name); 56 : 57 : /** 58 : * Add a MOOSE variable to facilitate coupling 59 : * @param[in] slot slot in usrwrk array holding this field 60 : * @param[in] name variable name 61 : */ 62 : void addExternalVariable(const unsigned int slot, const std::string name); 63 : 64 : /// Variable name (or prefix of names) to create in MOOSE to facilitate data passing 65 : std::string _variable; 66 : 67 : /// Slot in usrwrk array to use for writing data, if 'direction = to_nek' 68 : std::vector<unsigned int> _usrwrk_slot; 69 : 70 : /// Internal number for the variable(s) created in MOOSE (name, number) 71 : std::map<std::string, unsigned int> _variable_number; 72 : 73 : /** 74 : * Information about data stored in the usrwrk array for error checking and diagnostics; 75 : * stored as (slot, variable name in MOOSE) 76 : */ 77 : static std::map<unsigned int, std::string> _field_usrwrk_map; 78 : 79 : /// Number of points on the MOOSE mesh to write per element surface 80 : int _n_per_surf; 81 : 82 : /// Number of points on the MOOSE mesh to write per element volume 83 : int _n_per_vol; 84 : 85 : /// MOOSE data interpolated onto the (boundary) data transfer mesh 86 : double * _v_face = nullptr; 87 : 88 : /// MOOSE data interpolated onto the (volume) data transfer mesh 89 : double * _v_elem = nullptr; 90 : 91 : /// Scratch space to place external NekRS fields before writing into auxiliary variables 92 : double * _external_data = nullptr; 93 : };