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 : /** 36 : * Get the mapping of usrwrk slots to variable names for all field transfers 37 : * @return map ordered as (slot number, name) 38 : */ 39 791 : static std::map<unsigned int, std::string> usrwrkMap() { return _field_usrwrk_map; } 40 : 41 : protected: 42 : /** 43 : * Fill an outgoing auxiliary variable field with nekRS solution data 44 : * @param[in] var_number auxiliary variable number 45 : * @param[in] value nekRS solution data to fill the variable with 46 : */ 47 : void fillAuxVariable(const unsigned int var_number, const double * value); 48 : 49 : /** 50 : * Add a MOOSE variable to facilitate coupling 51 : * @param[in] name variable name 52 : */ 53 : void addExternalVariable(const std::string name); 54 : 55 : /** 56 : * Add a MOOSE variable to facilitate coupling 57 : * @param[in] slot slot in usrwrk array holding this field 58 : * @param[in] name variable name 59 : */ 60 : void addExternalVariable(const unsigned int slot, const std::string name); 61 : 62 : /// Variable name (or prefix of names) to create in MOOSE to facilitate data passing 63 : std::string _variable; 64 : 65 : /// Slot in usrwrk array to use for writing data, if 'direction = to_nek' 66 : std::vector<unsigned int> _usrwrk_slot; 67 : 68 : /// Internal number for the variable(s) created in MOOSE (name, number) 69 : std::map<std::string, unsigned int> _variable_number; 70 : 71 : /// Number of points on the MOOSE mesh to write per element surface 72 : int _n_per_surf; 73 : 74 : /// Number of points on the MOOSE mesh to write per element volume 75 : int _n_per_vol; 76 : 77 : /** 78 : * Information about data stored in the usrwrk array for error checking and diagnostics; 79 : * stored as (slot, variable name in MOOSE) 80 : */ 81 : static std::map<unsigned int, std::string> _field_usrwrk_map; 82 : };