LCOV - code coverage report
Current view: top level - include/transfers - MultiAppConservativeTransfer.h (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 2bf808 Lines: 2 2 100.0 %
Date: 2025-07-17 01:28:37 Functions: 2 2 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : //* This file is part of the MOOSE framework
       2             : //* https://mooseframework.inl.gov
       3             : //*
       4             : //* All rights reserved, see COPYRIGHT for full restrictions
       5             : //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
       6             : //*
       7             : //* Licensed under LGPL 2.1, please see LICENSE for details
       8             : //* https://www.gnu.org/licenses/lgpl-2.1.html
       9             : 
      10             : #pragma once
      11             : 
      12             : #include "MultiAppFieldTransfer.h"
      13             : 
      14             : /**
      15             :  *  Transfers variables on possibly different meshes while conserving a user
      16             :  *  defined property (Postprocessor) for each variable
      17             :  */
      18             : class MultiAppConservativeTransfer : public MultiAppFieldTransfer
      19             : {
      20             : public:
      21             :   static InputParameters validParams();
      22             : 
      23             :   MultiAppConservativeTransfer(const InputParameters & parameters);
      24             : 
      25             :   virtual void initialSetup() override;
      26             : 
      27             :   /**
      28             :    * Add some extra work if necessary after execute(). For example, adjust the solution
      29             :    * to preserve some physics quality of interest.
      30             :    */
      31             :   virtual void postExecute();
      32             : 
      33             : protected:
      34        4778 :   virtual std::vector<VariableName> getFromVarNames() const override { return _from_var_names; }
      35        4544 :   virtual std::vector<AuxVariableName> getToVarNames() const override { return _to_var_names; }
      36             : 
      37             :   bool performAdjustment(const PostprocessorValue & from, const PostprocessorValue & to) const;
      38             : 
      39             :   /// Name of variables transferring from
      40             :   const std::vector<VariableName> _from_var_names;
      41             :   /// Name of variables transferring to
      42             :   const std::vector<AuxVariableName> _to_var_names;
      43             : 
      44             :   /// This values are used if a derived class only supports one variable
      45             :   VariableName _from_var_name;
      46             :   AuxVariableName _to_var_name;
      47             : 
      48             :   /// If this transfer is going to conserve the physics
      49             :   bool _preserve_transfer;
      50             :   /// Postprocessor evaluates an adjuster for the source physics
      51             :   std::vector<PostprocessorName> _from_postprocessors_to_be_preserved;
      52             :   /// Postprocessor evaluates an adjuster for the target physics
      53             :   std::vector<PostprocessorName> _to_postprocessors_to_be_preserved;
      54             : 
      55             : private:
      56             :   void adjustTransferredSolution(FEProblemBase * from_problem,
      57             :                                  PostprocessorName & from_postprocessor,
      58             :                                  FEProblemBase & to_problem,
      59             :                                  PostprocessorName & to_postprocessor);
      60             : 
      61             :   void adjustTransferredSolutionNearestPoint(unsigned int i,
      62             :                                              FEProblemBase * from_problem,
      63             :                                              PostprocessorName & from_postprocessor,
      64             :                                              FEProblemBase & to_problem,
      65             :                                              PostprocessorName & to_postprocessor);
      66             : 
      67             :   /// Whether to use a nearest point UserObject to obtain the conservation factor
      68             :   bool _use_nearestpoint_pps;
      69             :   /// Whether the adjustment may be skipped when the postprocessor values are 0 / of different signs
      70             :   bool _allow_skipped_adjustment;
      71             : };

Generated by: LCOV version 1.14