LCOV - code coverage report
Current view: top level - include/transfers - FieldTransferBase.h (source / functions) Hit Total Coverage
Test: neams-th-coe/cardinal: ddd5f2 Lines: 2 2 100.0 %
Date: 2026-06-07 19:35:24 Functions: 0 0 -
Legend: Lines: hit not hit

          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         783 :   static std::map<unsigned int, std::string> usrwrkMap() { return _field_usrwrk_map; }
      42             : 
      43             :   /**
      44             :    * Get the mapping of usrwrk slots to their scalings
      45             :    * @return map ordered as (MOOSE variable name, (additive, divisor))
      46             :    */
      47             :   static std::map<std::string, std::pair<Real, Real>> usrwrkScales()
      48             :   {
      49         739 :     return _field_usrwrk_scales;
      50             :   }
      51             : 
      52             : protected:
      53             :   /**
      54             :    * Fill an outgoing auxiliary variable field with nekRS solution data
      55             :    * @param[in] var_number auxiliary variable number
      56             :    * @param[in] value nekRS solution data to fill the variable with
      57             :    */
      58             :   void fillAuxVariable(const unsigned int var_number, const double * value);
      59             : 
      60             :   /**
      61             :    * Add a MOOSE variable to facilitate coupling
      62             :    * @param[in] name variable name
      63             :    */
      64             :   void addExternalVariable(const std::string name);
      65             : 
      66             :   /**
      67             :    * Add a MOOSE variable to facilitate coupling
      68             :    * @param[in] slot slot in usrwrk array holding this field
      69             :    * @param[in] name variable name
      70             :    * @param[in] additive shift to apply to the non-dimensional variable
      71             :    * @param[in] divisor division to apply to the non-dimensional variable
      72             :    */
      73             :   void addExternalVariable(const unsigned int slot,
      74             :                            const std::string name,
      75             :                            const Real additive,
      76             :                            const Real divisor);
      77             : 
      78             :   /// Variable name (or prefix of names) to create in MOOSE to facilitate data passing
      79             :   std::string _variable;
      80             : 
      81             :   /// Slot in usrwrk array to use for writing data, if 'direction = to_nek'
      82             :   std::vector<unsigned int> _usrwrk_slot;
      83             : 
      84             :   /// Internal number for the variable(s) created in MOOSE (name, number)
      85             :   std::map<std::string, unsigned int> _variable_number;
      86             : 
      87             :   /**
      88             :    * Information about data stored in the usrwrk array for error checking and diagnostics;
      89             :    * stored as (slot, variable name in MOOSE)
      90             :    */
      91             :   static std::map<unsigned int, std::string> _field_usrwrk_map;
      92             : 
      93             :   /**
      94             :    * Information about nondimensional scaling to be applied to a MOOSE variable, stored as
      95             :    * (slot, {shift, divisor})
      96             :    */
      97             :   static std::map<std::string, std::pair<Real, Real>> _field_usrwrk_scales;
      98             : 
      99             :   /// Number of points on the MOOSE mesh to write per element surface
     100             :   int _n_per_surf;
     101             : 
     102             :   /// Number of points on the MOOSE mesh to write per element volume
     103             :   int _n_per_vol;
     104             : 
     105             :   /// MOOSE data interpolated onto the (boundary) data transfer mesh
     106             :   double * _v_face = nullptr;
     107             : 
     108             :   /// MOOSE data interpolated onto the (volume) data transfer mesh
     109             :   double * _v_elem = nullptr;
     110             : 
     111             :   /// Scratch space to place external NekRS fields before writing into auxiliary variables
     112             :   double * _external_data = nullptr;
     113             : };

Generated by: LCOV version 1.14