Loading [MathJax]/extensions/tex2jax.js
https://mooseframework.inl.gov
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
TriInterWrapper1PhaseProblem Class Referenceabstract

Triangular interwrapper solver. More...

#include <TriInterWrapper1PhaseProblem.h>

Inheritance diagram for TriInterWrapper1PhaseProblem:
[legend]

Public Types

enum  Direction { Direction::TO_EXTERNAL_APP, Direction::FROM_EXTERNAL_APP }
 
enum  CoverageCheckMode {
  CoverageCheckMode::FALSE, CoverageCheckMode::TRUE, CoverageCheckMode::OFF, CoverageCheckMode::ON,
  CoverageCheckMode::SKIP_LIST, CoverageCheckMode::ONLY_LIST
}
 
typedef DataFileName DataFileParameterType
 

Public Member Functions

 TriInterWrapper1PhaseProblem (const InputParameters &params)
 
virtual void syncSolutions (Direction direction) override
 
virtual bool solverSystemConverged (const unsigned int) override
 
virtual void initialSetup () override
 
virtual void solve (unsigned int nl_sys_num=0) override final
 
virtual void addExternalVariables ()
 
virtual libMesh::EquationSystemses () override
 
virtual MooseMeshmesh () override
 
virtual const MooseMeshmesh () const override
 
const MooseMeshmesh (bool use_displaced) const override
 
void setCoordSystem (const std::vector< SubdomainName > &blocks, const MultiMooseEnum &coord_sys)
 
void setAxisymmetricCoordAxis (const MooseEnum &rz_coord_axis)
 
void setCoupling (Moose::CouplingType type)
 
Moose::CouplingType coupling ()
 
void setCouplingMatrix (std::unique_ptr< libMesh::CouplingMatrix > cm, const unsigned int nl_sys_num)
 
void setCouplingMatrix (libMesh::CouplingMatrix *cm, const unsigned int nl_sys_num)
 
const libMesh::CouplingMatrixcouplingMatrix (const unsigned int nl_sys_num) const override
 
void setNonlocalCouplingMatrix ()
 
bool areCoupled (const unsigned int ivar, const unsigned int jvar, const unsigned int nl_sys_num) const
 
bool hasUOAuxStateCheck () const
 
bool checkingUOAuxState () const
 
void trustUserCouplingMatrix ()
 
std::vector< std::pair< MooseVariableFEBase *, MooseVariableFEBase *> > & couplingEntries (const THREAD_ID tid, const unsigned int nl_sys_num)
 
std::vector< std::pair< MooseVariableFEBase *, MooseVariableFEBase *> > & nonlocalCouplingEntries (const THREAD_ID tid, const unsigned int nl_sys_num)
 
virtual bool hasVariable (const std::string &var_name) const override
 
bool hasSolverVariable (const std::string &var_name) const
 
virtual const MooseVariableFieldBasegetVariable (const THREAD_ID tid, const std::string &var_name, Moose::VarKindType expected_var_type=Moose::VarKindType::VAR_ANY, Moose::VarFieldType expected_var_field_type=Moose::VarFieldType::VAR_FIELD_ANY) const override
 
virtual const MooseVariableFieldBasegetVariable (const THREAD_ID tid, const std::string &var_name, Moose::VarKindType expected_var_type=Moose::VarKindType::VAR_ANY, Moose::VarFieldType expected_var_field_type=Moose::VarFieldType::VAR_FIELD_ANY) const =0
 
virtual MooseVariableFieldBasegetVariable (const THREAD_ID tid, const std::string &var_name, Moose::VarKindType expected_var_type=Moose::VarKindType::VAR_ANY, Moose::VarFieldType expected_var_field_type=Moose::VarFieldType::VAR_FIELD_ANY)
 
virtual MooseVariableFieldBasegetVariable (const THREAD_ID tid, const std::string &var_name, Moose::VarKindType expected_var_type=Moose::VarKindType::VAR_ANY, Moose::VarFieldType expected_var_field_type=Moose::VarFieldType::VAR_FIELD_ANY)
 
MooseVariableFieldBasegetActualFieldVariable (const THREAD_ID tid, const std::string &var_name) override
 
virtual MooseVariablegetStandardVariable (const THREAD_ID tid, const std::string &var_name) override
 
virtual VectorMooseVariablegetVectorVariable (const THREAD_ID tid, const std::string &var_name) override
 
virtual ArrayMooseVariablegetArrayVariable (const THREAD_ID tid, const std::string &var_name) override
 
virtual bool hasScalarVariable (const std::string &var_name) const override
 
virtual MooseVariableScalargetScalarVariable (const THREAD_ID tid, const std::string &var_name) override
 
virtual libMesh::SystemgetSystem (const std::string &var_name) override
 
virtual void setActiveElementalMooseVariables (const std::set< MooseVariableFEBase * > &moose_vars, const THREAD_ID tid) override
 
virtual void clearActiveElementalMooseVariables (const THREAD_ID tid) override
 
virtual void clearActiveFEVariableCoupleableMatrixTags (const THREAD_ID tid) override
 
virtual void clearActiveFEVariableCoupleableVectorTags (const THREAD_ID tid) override
 
virtual void setActiveFEVariableCoupleableVectorTags (std::set< TagID > &vtags, const THREAD_ID tid) override
 
virtual void setActiveFEVariableCoupleableMatrixTags (std::set< TagID > &mtags, const THREAD_ID tid) override
 
virtual void clearActiveScalarVariableCoupleableMatrixTags (const THREAD_ID tid) override
 
virtual void clearActiveScalarVariableCoupleableVectorTags (const THREAD_ID tid) override
 
virtual void setActiveScalarVariableCoupleableVectorTags (std::set< TagID > &vtags, const THREAD_ID tid) override
 
virtual void setActiveScalarVariableCoupleableMatrixTags (std::set< TagID > &mtags, const THREAD_ID tid) override
 
virtual void createQRules (libMesh::QuadratureType type, libMesh::Order order, libMesh::Order volume_order=libMesh::INVALID_ORDER, libMesh::Order face_order=libMesh::INVALID_ORDER, SubdomainID block=Moose::ANY_BLOCK_ID, bool allow_negative_qweights=true)
 
void bumpVolumeQRuleOrder (libMesh::Order order, SubdomainID block)
 
void bumpAllQRuleOrder (libMesh::Order order, SubdomainID block)
 
unsigned int getMaxQps () const
 
libMesh::Order getMaxScalarOrder () const
 
void checkNonlocalCoupling ()
 
void checkUserObjectJacobianRequirement (THREAD_ID tid)
 
void setVariableAllDoFMap (const std::vector< const MooseVariableFEBase * > &moose_vars)
 
const std::vector< const MooseVariableFEBase *> & getUserObjectJacobianVariables (const THREAD_ID tid) const
 
virtual Assemblyassembly (const THREAD_ID tid, const unsigned int sys_num) override
 
virtual const Assemblyassembly (const THREAD_ID tid, const unsigned int sys_num) const override
 
virtual std::vector< VariableName > getVariableNames ()
 
void checkDuplicatePostprocessorVariableNames ()
 
void timestepSetup () override
 
void customSetup (const ExecFlagType &exec_type) override
 
void residualSetup () override
 
void jacobianSetup () override
 
virtual void prepare (const Elem *elem, const THREAD_ID tid) override
 
virtual void prepare (const Elem *elem, unsigned int ivar, unsigned int jvar, const std::vector< dof_id_type > &dof_indices, const THREAD_ID tid) override
 
virtual void prepareFace (const Elem *elem, const THREAD_ID tid) override
 
virtual void setCurrentSubdomainID (const Elem *elem, const THREAD_ID tid) override
 
virtual void setNeighborSubdomainID (const Elem *elem, unsigned int side, const THREAD_ID tid) override
 
virtual void setNeighborSubdomainID (const Elem *elem, const THREAD_ID tid)
 
virtual void prepareAssembly (const THREAD_ID tid) override
 
virtual void addGhostedElem (dof_id_type elem_id) override
 
virtual void addGhostedBoundary (BoundaryID boundary_id) override
 
virtual void ghostGhostedBoundaries () override
 
virtual void sizeZeroes (unsigned int size, const THREAD_ID tid)
 
virtual bool reinitDirac (const Elem *elem, const THREAD_ID tid) override
 
virtual void reinitElem (const Elem *elem, const THREAD_ID tid) override
 
virtual void reinitElemPhys (const Elem *elem, const std::vector< Point > &phys_points_in_elem, const THREAD_ID tid) override
 
void reinitElemFace (const Elem *elem, unsigned int side, BoundaryID, const THREAD_ID tid)
 
virtual void reinitElemFace (const Elem *elem, unsigned int side, const THREAD_ID tid) override
 
virtual void reinitLowerDElem (const Elem *lower_d_elem, const THREAD_ID tid, const std::vector< Point > *const pts=nullptr, const std::vector< Real > *const weights=nullptr) override
 
virtual void reinitNode (const Node *node, const THREAD_ID tid) override
 
virtual void reinitNodeFace (const Node *node, BoundaryID bnd_id, const THREAD_ID tid) override
 
virtual void reinitNodes (const std::vector< dof_id_type > &nodes, const THREAD_ID tid) override
 
virtual void reinitNodesNeighbor (const std::vector< dof_id_type > &nodes, const THREAD_ID tid) override
 
virtual void reinitNeighbor (const Elem *elem, unsigned int side, const THREAD_ID tid) override
 
virtual void reinitNeighborPhys (const Elem *neighbor, unsigned int neighbor_side, const std::vector< Point > &physical_points, const THREAD_ID tid) override
 
virtual void reinitNeighborPhys (const Elem *neighbor, const std::vector< Point > &physical_points, const THREAD_ID tid) override
 
virtual void reinitElemNeighborAndLowerD (const Elem *elem, unsigned int side, const THREAD_ID tid) override
 
virtual void reinitScalars (const THREAD_ID tid, bool reinit_for_derivative_reordering=false) override
 
virtual void reinitOffDiagScalars (const THREAD_ID tid) override
 
virtual void getDiracElements (std::set< const Elem * > &elems) override
 
virtual void clearDiracInfo () override
 
virtual void subdomainSetup (SubdomainID subdomain, const THREAD_ID tid)
 
virtual void neighborSubdomainSetup (SubdomainID subdomain, const THREAD_ID tid)
 
virtual void newAssemblyArray (std::vector< std::shared_ptr< SolverSystem >> &solver_systems)
 
virtual void initNullSpaceVectors (const InputParameters &parameters, std::vector< std::shared_ptr< NonlinearSystemBase >> &nl)
 
virtual void init () override
 
virtual void solveLinearSystem (const unsigned int linear_sys_num, const Moose::PetscSupport::PetscOptions *po=nullptr)
 
virtual void setException (const std::string &message)
 
virtual bool hasException ()
 
virtual void checkExceptionAndStopSolve (bool print_message=true)
 
virtual unsigned int nNonlinearIterations (const unsigned int nl_sys_num) const override
 
virtual unsigned int nLinearIterations (const unsigned int nl_sys_num) const override
 
virtual Real finalNonlinearResidual (const unsigned int nl_sys_num) const override
 
virtual bool computingPreSMOResidual (const unsigned int nl_sys_num) const override
 
virtual std::string solverTypeString (unsigned int solver_sys_num=0)
 
virtual bool startedInitialSetup ()
 
virtual void onTimestepBegin () override
 
virtual void onTimestepEnd () override
 
virtual Realtime () const
 
virtual RealtimeOld () const
 
virtual inttimeStep () const
 
virtual Realdt () const
 
virtual RealdtOld () const
 
Real getTimeFromStateArg (const Moose::StateArg &state) const
 
virtual void transient (bool trans)
 
virtual bool isTransient () const override
 
virtual void addTimeIntegrator (const std::string &type, const std::string &name, InputParameters &parameters)
 
virtual void addPredictor (const std::string &type, const std::string &name, InputParameters &parameters)
 
virtual void copySolutionsBackwards ()
 
virtual void advanceState ()
 
virtual void restoreSolutions ()
 
virtual void saveOldSolutions ()
 
virtual void restoreOldSolutions ()
 
void needSolutionState (unsigned int oldest_needed, Moose::SolutionIterationType iteration_type)
 
virtual void outputStep (ExecFlagType type)
 
virtual void postExecute ()
 
void forceOutput ()
 
virtual void initPetscOutputAndSomeSolverSettings ()
 
Moose::PetscSupport::PetscOptionsgetPetscOptions ()
 
void logAdd (const std::string &system, const std::string &name, const std::string &type, const InputParameters &params) const
 
virtual void addFunction (const std::string &type, const std::string &name, InputParameters &parameters)
 
virtual bool hasFunction (const std::string &name, const THREAD_ID tid=0)
 
virtual FunctiongetFunction (const std::string &name, const THREAD_ID tid=0)
 
virtual void addMeshDivision (const std::string &type, const std::string &name, InputParameters &params)
 
MeshDivisiongetMeshDivision (const std::string &name, const THREAD_ID tid=0) const
 
virtual void addConvergence (const std::string &type, const std::string &name, InputParameters &parameters)
 
virtual ConvergencegetConvergence (const std::string &name, const THREAD_ID tid=0) const
 
virtual const std::vector< std::shared_ptr< Convergence > > & getConvergenceObjects (const THREAD_ID tid=0) const
 
virtual bool hasConvergence (const std::string &name, const THREAD_ID tid=0) const
 
bool needToAddDefaultNonlinearConvergence () const
 
void setNeedToAddDefaultNonlinearConvergence ()
 
virtual void addDefaultNonlinearConvergence (const InputParameters &params)
 
virtual bool onlyAllowDefaultNonlinearConvergence () const
 
virtual void addLineSearch (const InputParameters &)
 
virtual void lineSearch ()
 
LineSearchgetLineSearch () override
 
virtual void addDistribution (const std::string &type, const std::string &name, InputParameters &parameters)
 
virtual DistributiongetDistribution (const std::string &name)
 
virtual void addSampler (const std::string &type, const std::string &name, InputParameters &parameters)
 
virtual SamplergetSampler (const std::string &name, const THREAD_ID tid=0)
 
NonlinearSystemBasegetNonlinearSystemBase (const unsigned int sys_num)
 
const NonlinearSystemBasegetNonlinearSystemBase (const unsigned int sys_num) const
 
void setCurrentNonlinearSystem (const unsigned int nl_sys_num)
 
NonlinearSystemBasecurrentNonlinearSystem ()
 
const NonlinearSystemBasecurrentNonlinearSystem () const
 
virtual const SystemBasesystemBaseNonlinear (const unsigned int sys_num) const override
 
virtual SystemBasesystemBaseNonlinear (const unsigned int sys_num) override
 
virtual const SystemBasesystemBaseAuxiliary () const override
 
virtual SystemBasesystemBaseAuxiliary () override
 
virtual NonlinearSystemgetNonlinearSystem (const unsigned int sys_num)
 
virtual const SystemBasegetSystemBase (const unsigned int sys_num) const
 
virtual SystemBasegetSystemBase (const unsigned int sys_num)
 
LinearSystemgetLinearSystem (unsigned int sys_num)
 
const LinearSystemgetLinearSystem (unsigned int sys_num) const
 
SolverSystemgetSolverSystem (unsigned int sys_num)
 
const SolverSystemgetSolverSystem (unsigned int sys_num) const
 
void setCurrentLinearSystem (unsigned int sys_num)
 
LinearSystemcurrentLinearSystem ()
 
const LinearSystemcurrentLinearSystem () const
 
virtual const SystemBasesystemBaseLinear (unsigned int sys_num) const override
 
virtual SystemBasesystemBaseLinear (unsigned int sys_num) override
 
virtual void addVariable (const std::string &var_type, const std::string &var_name, InputParameters &params)
 
virtual void addKernel (const std::string &kernel_name, const std::string &name, InputParameters &parameters)
 
virtual void addHDGKernel (const std::string &kernel_name, const std::string &name, InputParameters &parameters)
 
virtual void addNodalKernel (const std::string &kernel_name, const std::string &name, InputParameters &parameters)
 
virtual void addScalarKernel (const std::string &kernel_name, const std::string &name, InputParameters &parameters)
 
virtual void addBoundaryCondition (const std::string &bc_name, const std::string &name, InputParameters &parameters)
 
virtual void addHDGIntegratedBC (const std::string &kernel_name, const std::string &name, InputParameters &parameters)
 
virtual void addConstraint (const std::string &c_name, const std::string &name, InputParameters &parameters)
 
virtual void setInputParametersFEProblem (InputParameters &parameters)
 
virtual void addAuxVariable (const std::string &var_type, const std::string &var_name, InputParameters &params)
 
virtual void addAuxVariable (const std::string &var_name, const libMesh::FEType &type, const std::set< SubdomainID > *const active_subdomains=NULL)
 
virtual void addAuxArrayVariable (const std::string &var_name, const libMesh::FEType &type, unsigned int components, const std::set< SubdomainID > *const active_subdomains=NULL)
 
virtual void addAuxScalarVariable (const std::string &var_name, libMesh::Order order, Real scale_factor=1., const std::set< SubdomainID > *const active_subdomains=NULL)
 
virtual void addAuxKernel (const std::string &kernel_name, const std::string &name, InputParameters &parameters)
 
virtual void addAuxScalarKernel (const std::string &kernel_name, const std::string &name, InputParameters &parameters)
 
AuxiliarySystemgetAuxiliarySystem ()
 
virtual void addDiracKernel (const std::string &kernel_name, const std::string &name, InputParameters &parameters)
 
virtual void addDGKernel (const std::string &kernel_name, const std::string &name, InputParameters &parameters)
 
virtual void addFVKernel (const std::string &kernel_name, const std::string &name, InputParameters &parameters)
 
virtual void addLinearFVKernel (const std::string &kernel_name, const std::string &name, InputParameters &parameters)
 
virtual void addFVBC (const std::string &fv_bc_name, const std::string &name, InputParameters &parameters)
 
virtual void addLinearFVBC (const std::string &fv_bc_name, const std::string &name, InputParameters &parameters)
 
virtual void addFVInterfaceKernel (const std::string &fv_ik_name, const std::string &name, InputParameters &parameters)
 
virtual void addInterfaceKernel (const std::string &kernel_name, const std::string &name, InputParameters &parameters)
 
virtual void addInitialCondition (const std::string &ic_name, const std::string &name, InputParameters &parameters)
 
virtual void addFVInitialCondition (const std::string &ic_name, const std::string &name, InputParameters &parameters)
 
void projectSolution ()
 
unsigned short getCurrentICState ()
 
void projectInitialConditionOnCustomRange (libMesh::ConstElemRange &elem_range, ConstBndNodeRange &bnd_node_range)
 
virtual void addMaterial (const std::string &material_name, const std::string &name, InputParameters &parameters)
 
virtual void addMaterialHelper (std::vector< MaterialWarehouse * > warehouse, const std::string &material_name, const std::string &name, InputParameters &parameters)
 
virtual void addInterfaceMaterial (const std::string &material_name, const std::string &name, InputParameters &parameters)
 
virtual void addFunctorMaterial (const std::string &functor_material_name, const std::string &name, InputParameters &parameters)
 
void prepareMaterials (const std::unordered_set< unsigned int > &consumer_needed_mat_props, const SubdomainID blk_id, const THREAD_ID tid)
 
void reinitMaterials (SubdomainID blk_id, const THREAD_ID tid, bool swap_stateful=true)
 
void reinitMaterialsFace (SubdomainID blk_id, const THREAD_ID tid, bool swap_stateful=true, const std::deque< MaterialBase * > *reinit_mats=nullptr)
 
void reinitMaterialsNeighbor (SubdomainID blk_id, const THREAD_ID tid, bool swap_stateful=true, const std::deque< MaterialBase * > *reinit_mats=nullptr)
 
void reinitMaterialsBoundary (BoundaryID boundary_id, const THREAD_ID tid, bool swap_stateful=true, const std::deque< MaterialBase * > *reinit_mats=nullptr)
 
void reinitMaterialsInterface (BoundaryID boundary_id, const THREAD_ID tid, bool swap_stateful=true)
 
virtual void swapBackMaterials (const THREAD_ID tid)
 
virtual void swapBackMaterialsFace (const THREAD_ID tid)
 
virtual void swapBackMaterialsNeighbor (const THREAD_ID tid)
 
void setActiveMaterialProperties (const std::unordered_set< unsigned int > &mat_prop_ids, const THREAD_ID tid)
 
bool hasActiveMaterialProperties (const THREAD_ID tid) const
 
void clearActiveMaterialProperties (const THREAD_ID tid)
 
std::vector< std::shared_ptr< T > > addObject (const std::string &type, const std::string &name, InputParameters &parameters, const bool threaded=true, const std::string &var_param_name="variable")
 
virtual void addPostprocessor (const std::string &pp_name, const std::string &name, InputParameters &parameters)
 
virtual void addVectorPostprocessor (const std::string &pp_name, const std::string &name, InputParameters &parameters)
 
virtual void addReporter (const std::string &type, const std::string &name, InputParameters &parameters)
 
const ReporterDatagetReporterData () const
 
ReporterDatagetReporterData (ReporterData::WriteKey)
 
virtual std::vector< std::shared_ptr< UserObject > > addUserObject (const std::string &user_object_name, const std::string &name, InputParameters &parameters)
 
const ExecuteMooseObjectWarehouse< UserObject > & getUserObjects () const
 
T & getUserObject (const std::string &name, unsigned int tid=0) const
 
const UserObjectgetUserObjectBase (const std::string &name, const THREAD_ID tid=0) const
 
const PositionsgetPositionsObject (const std::string &name) const
 
bool hasUserObject (const std::string &name) const
 
bool hasPostprocessorValueByName (const PostprocessorName &name) const
 
const PostprocessorValuegetPostprocessorValueByName (const PostprocessorName &name, std::size_t t_index=0) const
 
void setPostprocessorValueByName (const PostprocessorName &name, const PostprocessorValue &value, std::size_t t_index=0)
 
bool hasPostprocessor (const std::string &name) const
 
const VectorPostprocessorValuegetVectorPostprocessorValueByName (const std::string &object_name, const std::string &vector_name, std::size_t t_index=0) const
 
void setVectorPostprocessorValueByName (const std::string &object_name, const std::string &vector_name, const VectorPostprocessorValue &value, std::size_t t_index=0)
 
const VectorPostprocessorgetVectorPostprocessorObjectByName (const std::string &object_name, const THREAD_ID tid=0) const
 
virtual void addDamper (const std::string &damper_name, const std::string &name, InputParameters &parameters)
 
void setupDampers ()
 
bool hasDampers ()
 
virtual void addIndicator (const std::string &indicator_name, const std::string &name, InputParameters &parameters)
 
virtual void addMarker (const std::string &marker_name, const std::string &name, InputParameters &parameters)
 
virtual void addMultiApp (const std::string &multi_app_name, const std::string &name, InputParameters &parameters)
 
std::shared_ptr< MultiAppgetMultiApp (const std::string &multi_app_name) const
 
std::vector< std::shared_ptr< Transfer > > getTransfers (ExecFlagType type, Transfer::DIRECTION direction) const
 
std::vector< std::shared_ptr< Transfer > > getTransfers (Transfer::DIRECTION direction) const
 
const ExecuteMooseObjectWarehouse< Transfer > & getMultiAppTransferWarehouse (Transfer::DIRECTION direction) const
 
void execMultiAppTransfers (ExecFlagType type, Transfer::DIRECTION direction)
 
bool execMultiApps (ExecFlagType type, bool auto_advance=true)
 
void finalizeMultiApps ()
 
void incrementMultiAppTStep (ExecFlagType type)
 
void advanceMultiApps (ExecFlagType type)
 
void finishMultiAppStep (ExecFlagType type, bool recurse_through_multiapp_levels=false)
 
void backupMultiApps (ExecFlagType type)
 
void restoreMultiApps (ExecFlagType type, bool force=false)
 
Real computeMultiAppsDT (ExecFlagType type)
 
virtual void addTransfer (const std::string &transfer_name, const std::string &name, InputParameters &parameters)
 
void execTransfers (ExecFlagType type)
 
Real computeResidualL2Norm (NonlinearSystemBase &sys)
 
Real computeResidualL2Norm (LinearSystem &sys)
 
virtual Real computeResidualL2Norm ()
 
virtual void computeResidualSys (libMesh::NonlinearImplicitSystem &sys, const NumericVector< libMesh::Number > &soln, NumericVector< libMesh::Number > &residual)
 
void computeResidual (libMesh::NonlinearImplicitSystem &sys, const NumericVector< libMesh::Number > &soln, NumericVector< libMesh::Number > &residual)
 
virtual void computeResidual (const NumericVector< libMesh::Number > &soln, NumericVector< libMesh::Number > &residual, const unsigned int nl_sys_num)
 
void computeResidualAndJacobian (const NumericVector< libMesh::Number > &soln, NumericVector< libMesh::Number > &residual, libMesh::SparseMatrix< libMesh::Number > &jacobian)
 
virtual void computeResidualTag (const NumericVector< libMesh::Number > &soln, NumericVector< libMesh::Number > &residual, TagID tag)
 
virtual void computeResidualType (const NumericVector< libMesh::Number > &soln, NumericVector< libMesh::Number > &residual, TagID tag)
 
virtual void computeResidualInternal (const NumericVector< libMesh::Number > &soln, NumericVector< libMesh::Number > &residual, const std::set< TagID > &tags)
 
virtual void computeResidualTags (const std::set< TagID > &tags)
 
virtual void computeJacobianSys (libMesh::NonlinearImplicitSystem &sys, const NumericVector< libMesh::Number > &soln, libMesh::SparseMatrix< libMesh::Number > &jacobian)
 
virtual void computeJacobian (const NumericVector< libMesh::Number > &soln, libMesh::SparseMatrix< libMesh::Number > &jacobian, const unsigned int nl_sys_num)
 
virtual void computeJacobianTag (const NumericVector< libMesh::Number > &soln, libMesh::SparseMatrix< libMesh::Number > &jacobian, TagID tag)
 
virtual void computeJacobianInternal (const NumericVector< libMesh::Number > &soln, libMesh::SparseMatrix< libMesh::Number > &jacobian, const std::set< TagID > &tags)
 
virtual void computeJacobianTags (const std::set< TagID > &tags)
 
virtual void computeJacobianBlocks (std::vector< JacobianBlock * > &blocks, const unsigned int nl_sys_num)
 
virtual void computeJacobianBlock (libMesh::SparseMatrix< libMesh::Number > &jacobian, libMesh::System &precond_system, unsigned int ivar, unsigned int jvar)
 
void computeLinearSystemSys (libMesh::LinearImplicitSystem &sys, libMesh::SparseMatrix< libMesh::Number > &system_matrix, NumericVector< libMesh::Number > &rhs, const bool compute_gradients=true)
 
void computeLinearSystemTags (const NumericVector< libMesh::Number > &soln, libMesh::SparseMatrix< libMesh::Number > &system_matrix, NumericVector< libMesh::Number > &rhs, const std::set< TagID > &vector_tags, const std::set< TagID > &matrix_tags, const bool compute_gradients=true)
 
virtual Real computeDamping (const NumericVector< libMesh::Number > &soln, const NumericVector< libMesh::Number > &update)
 
virtual bool shouldUpdateSolution ()
 
virtual bool updateSolution (NumericVector< libMesh::Number > &vec_solution, NumericVector< libMesh::Number > &ghosted_solution)
 
virtual void predictorCleanup (NumericVector< libMesh::Number > &ghosted_solution)
 
virtual void computeBounds (libMesh::NonlinearImplicitSystem &sys, NumericVector< libMesh::Number > &lower, NumericVector< libMesh::Number > &upper)
 
virtual void computeNearNullSpace (libMesh::NonlinearImplicitSystem &sys, std::vector< NumericVector< libMesh::Number > * > &sp)
 
virtual void computeNullSpace (libMesh::NonlinearImplicitSystem &sys, std::vector< NumericVector< libMesh::Number > * > &sp)
 
virtual void computeTransposeNullSpace (libMesh::NonlinearImplicitSystem &sys, std::vector< NumericVector< libMesh::Number > * > &sp)
 
virtual void computePostCheck (libMesh::NonlinearImplicitSystem &sys, const NumericVector< libMesh::Number > &old_soln, NumericVector< libMesh::Number > &search_direction, NumericVector< libMesh::Number > &new_soln, bool &changed_search_direction, bool &changed_new_soln)
 
virtual void computeIndicatorsAndMarkers ()
 
virtual void computeIndicators ()
 
virtual void computeMarkers ()
 
virtual void addResidual (const THREAD_ID tid) override
 
virtual void addResidualNeighbor (const THREAD_ID tid) override
 
virtual void addResidualLower (const THREAD_ID tid) override
 
virtual void addResidualScalar (const THREAD_ID tid=0)
 
virtual void cacheResidual (const THREAD_ID tid) override
 
virtual void cacheResidualNeighbor (const THREAD_ID tid) override
 
virtual void addCachedResidual (const THREAD_ID tid) override
 
virtual void addCachedResidualDirectly (NumericVector< libMesh::Number > &residual, const THREAD_ID tid)
 
virtual void setResidual (NumericVector< libMesh::Number > &residual, const THREAD_ID tid) override
 
virtual void setResidual (libMesh::NumericVector< libMesh::Number > &residual, const THREAD_ID tid)=0
 
virtual void setResidualNeighbor (NumericVector< libMesh::Number > &residual, const THREAD_ID tid) override
 
virtual void setResidualNeighbor (libMesh::NumericVector< libMesh::Number > &residual, const THREAD_ID tid)=0
 
virtual void addJacobian (const THREAD_ID tid) override
 
virtual void addJacobianNeighbor (const THREAD_ID tid) override
 
virtual void addJacobianNeighbor (libMesh::SparseMatrix< libMesh::Number > &jacobian, unsigned int ivar, unsigned int jvar, const DofMap &dof_map, std::vector< dof_id_type > &dof_indices, std::vector< dof_id_type > &neighbor_dof_indices, const std::set< TagID > &tags, const THREAD_ID tid) override
 
virtual void addJacobianNeighbor (libMesh::SparseMatrix< libMesh::Number > &jacobian, unsigned int ivar, unsigned int jvar, const libMesh::DofMap &dof_map, std::vector< dof_id_type > &dof_indices, std::vector< dof_id_type > &neighbor_dof_indices, const std::set< TagID > &tags, const THREAD_ID tid)=0
 
virtual void addJacobianNeighborLowerD (const THREAD_ID tid) override
 
virtual void addJacobianLowerD (const THREAD_ID tid) override
 
virtual void addJacobianBlockTags (libMesh::SparseMatrix< libMesh::Number > &jacobian, unsigned int ivar, unsigned int jvar, const DofMap &dof_map, std::vector< dof_id_type > &dof_indices, const std::set< TagID > &tags, const THREAD_ID tid)
 
virtual void addJacobianScalar (const THREAD_ID tid=0)
 
virtual void addJacobianOffDiagScalar (unsigned int ivar, const THREAD_ID tid=0)
 
virtual void cacheJacobian (const THREAD_ID tid) override
 
virtual void cacheJacobianNeighbor (const THREAD_ID tid) override
 
virtual void addCachedJacobian (const THREAD_ID tid) override
 
virtual void prepareShapes (unsigned int var, const THREAD_ID tid) override
 
virtual void prepareFaceShapes (unsigned int var, const THREAD_ID tid) override
 
virtual void prepareNeighborShapes (unsigned int var, const THREAD_ID tid) override
 
virtual void addDisplacedProblem (std::shared_ptr< DisplacedProblem > displaced_problem)
 
virtual std::shared_ptr< const DisplacedProblemgetDisplacedProblem () const
 
virtual std::shared_ptr< DisplacedProblemgetDisplacedProblem ()
 
virtual void updateGeomSearch (GeometricSearchData::GeometricSearchType type=GeometricSearchData::ALL) override
 
virtual void updateMortarMesh ()
 
void createMortarInterface (const std::pair< BoundaryID, BoundaryID > &primary_secondary_boundary_pair, const std::pair< SubdomainID, SubdomainID > &primary_secondary_subdomain_pair, bool on_displaced, bool periodic, const bool debug, const bool correct_edge_dropping, const Real minimum_projection_angle)
 
const std::unordered_map< std::pair< BoundaryID, BoundaryID >, AutomaticMortarGeneration > & getMortarInterfaces (bool on_displaced) const
 
virtual void possiblyRebuildGeomSearchPatches ()
 
virtual GeometricSearchDatageomSearchData () override
 
void setRestartFile (const std::string &file_name)
 
const MaterialPropertyRegistrygetMaterialPropertyRegistry () const
 
const InitialConditionWarehousegetInitialConditionWarehouse () const
 
const FVInitialConditionWarehousegetFVInitialConditionWarehouse () const
 
SolverParamssolverParams (unsigned int solver_sys_num=0)
 
const SolverParamssolverParams (unsigned int solver_sys_num=0) const
 
Adaptivityadaptivity ()
 
virtual void initialAdaptMesh ()
 
virtual bool adaptMesh ()
 
unsigned int getNumCyclesCompleted ()
 
bool hasInitialAdaptivity () const
 
bool hasInitialAdaptivity () const
 
void initXFEM (std::shared_ptr< XFEMInterface > xfem)
 
std::shared_ptr< XFEMInterfacegetXFEM ()
 
bool haveXFEM ()
 
virtual bool updateMeshXFEM ()
 
virtual void meshChanged () override
 
void notifyWhenMeshChanges (MeshChangedInterface *mci)
 
void initElementStatefulProps (const libMesh::ConstElemRange &elem_range, const bool threaded)
 
virtual void checkProblemIntegrity ()
 
void registerRandomInterface (RandomInterface &random_interface, const std::string &name)
 
void setConstJacobian (bool state)
 
void setKernelCoverageCheck (CoverageCheckMode mode)
 
void setKernelCoverageCheck (bool flag)
 
void setKernelCoverageCheck (CoverageCheckMode mode)
 
void setMaterialCoverageCheck (CoverageCheckMode mode)
 
void setMaterialCoverageCheck (bool flag)
 
void setMaterialCoverageCheck (CoverageCheckMode mode)
 
void setParallelBarrierMessaging (bool flag)
 
void setVerboseProblem (bool verbose)
 
bool verboseMultiApps () const
 
void parentOutputPositionChanged ()
 
unsigned int subspaceDim (const std::string &prefix) const
 
const MaterialWarehousegetMaterialWarehouse () const
 
const MaterialWarehousegetRegularMaterialsWarehouse () const
 
const MaterialWarehousegetDiscreteMaterialWarehouse () const
 
const MaterialWarehousegetInterfaceMaterialsWarehouse () const
 
std::shared_ptr< MaterialBasegetMaterial (std::string name, Moose::MaterialDataType type, const THREAD_ID tid=0, bool no_warn=false)
 
MaterialDatagetMaterialData (Moose::MaterialDataType type, const THREAD_ID tid=0)
 
bool errorOnJacobianNonzeroReallocation () const
 
void setErrorOnJacobianNonzeroReallocation (bool state)
 
bool preserveMatrixSparsityPattern () const
 
void setPreserveMatrixSparsityPattern (bool preserve)
 
bool ignoreZerosInJacobian () const
 
void setIgnoreZerosInJacobian (bool state)
 
bool acceptInvalidSolution () const
 
bool allowInvalidSolution () const
 
bool showInvalidSolutionConsole () const
 
bool immediatelyPrintInvalidSolution () const
 
bool hasTimeIntegrator () const
 
virtual void execute (const ExecFlagType &exec_type)
 
virtual void executeAllObjects (const ExecFlagType &exec_type)
 
virtual ExecutorgetExecutor (const std::string &name)
 
virtual void computeUserObjects (const ExecFlagType &type, const Moose::AuxGroup &group)
 
virtual void computeUserObjectByName (const ExecFlagType &type, const Moose::AuxGroup &group, const std::string &name)
 
void needsPreviousNewtonIteration (bool state)
 
bool needsPreviousNewtonIteration () const
 
ExecuteMooseObjectWarehouse< Control > & getControlWarehouse ()
 
void executeControls (const ExecFlagType &exec_type)
 
void executeSamplers (const ExecFlagType &exec_type)
 
virtual void updateActiveObjects ()
 
void reportMooseObjectDependency (MooseObject *a, MooseObject *b)
 
ExecuteMooseObjectWarehouse< MultiApp > & getMultiAppWarehouse ()
 
bool hasJacobian () const
 
bool constJacobian () const
 
void addOutput (const std::string &, const std::string &, InputParameters &)
 
TheWarehousetheWarehouse () const
 
void setSNESMFReuseBase (bool reuse, bool set_by_user)
 
bool useSNESMFReuseBase ()
 
void skipExceptionCheck (bool skip_exception_check)
 
bool isSNESMFReuseBaseSetbyUser ()
 
bool & petscOptionsInserted ()
 
PetscOptions & petscOptionsDatabase ()
 
virtual void setUDotRequested (const bool u_dot_requested)
 
virtual void setUDotDotRequested (const bool u_dotdot_requested)
 
virtual void setUDotOldRequested (const bool u_dot_old_requested)
 
virtual void setUDotDotOldRequested (const bool u_dotdot_old_requested)
 
virtual bool uDotRequested ()
 
virtual bool uDotDotRequested ()
 
virtual bool uDotOldRequested ()
 
virtual bool uDotDotOldRequested ()
 
void haveADObjects (bool have_ad_objects) override
 
virtual void haveADObjects (bool have_ad_objects)
 
bool haveADObjects () const
 
bool haveADObjects () const
 
bool shouldSolve () const
 
const MortarDatamortarData () const
 
MortarDatamortarData ()
 
virtual bool hasNeighborCoupling () const
 
virtual bool hasMortarCoupling () const
 
void computingNonlinearResid (bool computing_nonlinear_residual) final
 
bool computingNonlinearResid () const
 
virtual void computingNonlinearResid (const bool computing_nonlinear_residual)
 
bool computingNonlinearResid () const
 
void setCurrentlyComputingResidual (bool currently_computing_residual) final
 
void numGridSteps (unsigned int num_grid_steps)
 
void uniformRefine ()
 
void automaticScaling (bool automatic_scaling) override
 
virtual void automaticScaling (bool automatic_scaling)
 
bool automaticScaling () const
 
bool automaticScaling () const
 
virtual void reinitElemFaceRef (const Elem *elem, unsigned int side, Real tolerance, const std::vector< Point > *const pts, const std::vector< Real > *const weights=nullptr, const THREAD_ID tid=0) override
 
virtual void reinitNeighborFaceRef (const Elem *neighbor_elem, unsigned int neighbor_side, Real tolerance, const std::vector< Point > *const pts, const std::vector< Real > *const weights=nullptr, const THREAD_ID tid=0) override
 
bool fvBCsIntegrityCheck () const
 
void fvBCsIntegrityCheck (bool fv_bcs_integrity_check)
 
void getFVMatsAndDependencies (SubdomainID block_id, std::vector< std::shared_ptr< MaterialBase >> &face_materials, std::vector< std::shared_ptr< MaterialBase >> &neighbor_materials, std::set< MooseVariableFieldBase * > &variables, const THREAD_ID tid)
 
void resizeMaterialData (Moose::MaterialDataType data_type, unsigned int nqp, const THREAD_ID tid)
 
bool haveDisplaced () const override final
 
void setNonlinearConvergenceNames (const std::vector< ConvergenceName > &convergence_names)
 
std::vector< ConvergenceName > getNonlinearConvergenceNames () const
 
void computingScalingJacobian (bool computing_scaling_jacobian)
 
bool computingScalingJacobian () const override final
 
void computingScalingResidual (bool computing_scaling_residual)
 
bool computingScalingResidual () const override final
 
MooseAppCoordTransformcoordTransform ()
 
virtual std::size_t numNonlinearSystems () const override
 
virtual std::size_t numLinearSystems () const override
 
virtual std::size_t numSolverSystems () const override
 
bool isSolverSystemNonlinear (const unsigned int sys_num)
 
virtual unsigned int currentNlSysNum () const override
 
virtual unsigned int currentLinearSysNum () const override
 
virtual unsigned int nlSysNum (const NonlinearSystemName &nl_sys_name) const override
 
unsigned int linearSysNum (const LinearSystemName &linear_sys_name) const override
 
unsigned int solverSysNum (const SolverSystemName &solver_sys_name) const override
 
unsigned int systemNumForVariable (const VariableName &variable_name) const
 
bool getFailNextNonlinearConvergenceCheck () const
 
void setFailNextNonlinearConvergenceCheck ()
 
void resetFailNextNonlinearConvergenceCheck ()
 
void setExecutionPrinting (const ExecFlagEnum &print_exec)
 
bool shouldPrintExecution (const THREAD_ID tid) const
 
void reinitMortarUserObjects (BoundaryID primary_boundary_id, BoundaryID secondary_boundary_id, bool displaced)
 
virtual const std::vector< VectorTag > & currentResidualVectorTags () const override
 
void setCurrentResidualVectorTags (const std::set< TagID > &vector_tags)
 
void clearCurrentResidualVectorTags ()
 
void clearCurrentJacobianMatrixTags ()
 
virtual void needFV () override
 
virtual bool haveFV () const override
 
virtual bool hasNonlocalCoupling () const override
 
bool identifyVariableGroupsInNL () const
 
virtual void setCurrentLowerDElem (const Elem *const lower_d_elem, const THREAD_ID tid) override
 
virtual void setCurrentBoundaryID (BoundaryID bid, const THREAD_ID tid) override
 
const std::vector< NonlinearSystemName > & getNonlinearSystemNames () const
 
const std::vector< LinearSystemName > & getLinearSystemNames () const
 
const bool & currentlyComputingResidual () const
 
const bool & currentlyComputingResidual () const
 
virtual bool checkNonlocalCouplingRequirement ()
 
virtual bool nlConverged (const unsigned int nl_sys_num)
 
virtual bool converged (const unsigned int sys_num)
 
bool defaultGhosting ()
 
virtual TagID addVectorTag (const TagName &tag_name, const Moose::VectorTagType type=Moose::VECTOR_TAG_RESIDUAL)
 
void addNotZeroedVectorTag (const TagID tag)
 
bool vectorTagNotZeroed (const TagID tag) const
 
virtual const VectorTaggetVectorTag (const TagID tag_id) const
 
std::vector< VectorTaggetVectorTags (const std::set< TagID > &tag_ids) const
 
virtual const std::vector< VectorTag > & getVectorTags (const Moose::VectorTagType type=Moose::VECTOR_TAG_ANY) const
 
virtual TagID getVectorTagID (const TagName &tag_name) const
 
virtual TagName vectorTagName (const TagID tag) const
 
virtual bool vectorTagExists (const TagID tag_id) const
 
virtual bool vectorTagExists (const TagName &tag_name) const
 
virtual unsigned int numVectorTags (const Moose::VectorTagType type=Moose::VECTOR_TAG_ANY) const
 
virtual Moose::VectorTagType vectorTagType (const TagID tag_id) const
 
virtual TagID addMatrixTag (TagName tag_name)
 
virtual TagID getMatrixTagID (const TagName &tag_name) const
 
virtual TagName matrixTagName (TagID tag)
 
virtual bool matrixTagExists (const TagName &tag_name) const
 
virtual bool matrixTagExists (TagID tag_id) const
 
virtual unsigned int numMatrixTags () const
 
virtual std::map< TagName, TagID > & getMatrixTags ()
 
virtual bool hasLinearVariable (const std::string &var_name) const
 
virtual bool hasAuxiliaryVariable (const std::string &var_name) const
 
virtual const std::set< MooseVariableFieldBase *> & getActiveElementalMooseVariables (const THREAD_ID tid) const
 
virtual bool hasActiveElementalMooseVariables (const THREAD_ID tid) const
 
Moose::CoordinateSystemType getCoordSystem (SubdomainID sid) const
 
unsigned int getAxisymmetricRadialCoord () const
 
virtual DiracKernelInfodiracKernelInfo ()
 
void reinitNeighborLowerDElem (const Elem *elem, const THREAD_ID tid=0)
 
void reinitMortarElem (const Elem *elem, const THREAD_ID tid=0)
 
virtual void storeSubdomainMatPropName (SubdomainID block_id, const std::string &name)
 
virtual void storeBoundaryMatPropName (BoundaryID boundary_id, const std::string &name)
 
virtual void storeSubdomainZeroMatProp (SubdomainID block_id, const MaterialPropertyName &name)
 
virtual void storeBoundaryZeroMatProp (BoundaryID boundary_id, const MaterialPropertyName &name)
 
virtual void storeSubdomainDelayedCheckMatProp (const std::string &requestor, SubdomainID block_id, const std::string &name)
 
virtual void storeBoundaryDelayedCheckMatProp (const std::string &requestor, BoundaryID boundary_id, const std::string &name)
 
virtual void checkBlockMatProps ()
 
virtual void checkBoundaryMatProps ()
 
virtual void markMatPropRequested (const std::string &)
 
virtual bool isMatPropRequested (const std::string &prop_name) const
 
void addConsumedPropertyName (const MooseObjectName &obj_name, const std::string &prop_name)
 
const std::map< MooseObjectName, std::set< std::string > > & getConsumedPropertyMap () const
 
virtual std::set< SubdomainIDgetMaterialPropertyBlocks (const std::string &prop_name)
 
virtual std::vector< SubdomainName > getMaterialPropertyBlockNames (const std::string &prop_name)
 
virtual bool hasBlockMaterialProperty (SubdomainID block_id, const std::string &prop_name)
 
virtual std::set< BoundaryIDgetMaterialPropertyBoundaryIDs (const std::string &prop_name)
 
virtual std::vector< BoundaryName > getMaterialPropertyBoundaryNames (const std::string &prop_name)
 
virtual bool hasBoundaryMaterialProperty (BoundaryID boundary_id, const std::string &prop_name)
 
virtual std::set< dof_id_type > & ghostedElems ()
 
const libMesh::CouplingMatrixnonlocalCouplingMatrix (const unsigned i) const
 
const bool & currentlyComputingJacobian () const
 
void setCurrentlyComputingJacobian (const bool currently_computing_jacobian)
 
const bool & currentlyComputingResidualAndJacobian () const
 
void setCurrentlyComputingResidualAndJacobian (bool currently_computing_residual_and_jacobian)
 
virtual bool safeAccessTaggedMatrices () const
 
virtual bool safeAccessTaggedVectors () const
 
const std::set< TagID > & getActiveScalarVariableCoupleableVectorTags (const THREAD_ID tid) const
 
const std::set< TagID > & getActiveScalarVariableCoupleableMatrixTags (const THREAD_ID tid) const
 
const std::set< TagID > & getActiveFEVariableCoupleableVectorTags (const THREAD_ID tid) const
 
const std::set< TagID > & getActiveFEVariableCoupleableMatrixTags (const THREAD_ID tid) const
 
void addAlgebraicGhostingFunctor (libMesh::GhostingFunctor &algebraic_gf, bool to_mesh=true)
 
void addCouplingGhostingFunctor (libMesh::GhostingFunctor &coupling_gf, bool to_mesh=true)
 
void removeAlgebraicGhostingFunctor (libMesh::GhostingFunctor &algebraic_gf)
 
void removeCouplingGhostingFunctor (libMesh::GhostingFunctor &coupling_gf)
 
void hasScalingVector (const unsigned int nl_sys_num)
 
void clearAllDofIndices ()
 
const Moose::Functor< T > & getFunctor (const std::string &name, const THREAD_ID tid, const std::string &requestor_name, bool requestor_is_ad)
 
bool hasFunctor (const std::string &name, const THREAD_ID tid) const
 
bool hasFunctorWithType (const std::string &name, const THREAD_ID tid) const
 
void addFunctor (const std::string &name, const Moose::FunctorBase< T > &functor, const THREAD_ID tid)
 
const Moose::FunctorBase< T > & addPiecewiseByBlockLambdaFunctor (const std::string &name, PolymorphicLambda my_lammy, const std::set< ExecFlagType > &clearance_schedule, const MooseMesh &mesh, const std::set< SubdomainID > &block_ids, const THREAD_ID tid)
 
void setFunctorOutput (bool set_output)
 
void registerUnfilledFunctorRequest (T *functor_interface, const std::string &functor_name, const THREAD_ID tid)
 
void reinitFVFace (const THREAD_ID tid, const FaceInfo &fi)
 
void preparePRefinement ()
 
bool doingPRefinement () const
 
bool havePRefinement () const
 
MooseVariableFEBasegetVariableHelper (const THREAD_ID tid, const std::string &var_name, Moose::VarKindType expected_var_type, Moose::VarFieldType expected_var_field_type, const std::vector< T > &systems, const SystemBase &aux) const
 
void _setCLIOption ()
 
virtual void terminateSolve ()
 
virtual bool isSolveTerminationRequested () const
 
const ConsoleStreamconsole () const
 
virtual bool enabled () const
 
std::shared_ptr< MooseObjectgetSharedPtr ()
 
std::shared_ptr< const MooseObjectgetSharedPtr () const
 
MooseAppgetMooseApp () const
 
const std::string & type () const
 
virtual const std::string & name () const
 
std::string typeAndName () const
 
std::string errorPrefix (const std::string &error_type) const
 
void callMooseError (std::string msg, const bool with_prefix) const
 
MooseObjectParameterName uniqueParameterName (const std::string &parameter_name) const
 
const InputParametersparameters () const
 
MooseObjectName uniqueName () const
 
const T & getParam (const std::string &name) const
 
std::vector< std::pair< T1, T2 > > getParam (const std::string &param1, const std::string &param2) const
 
const T & getRenamedParam (const std::string &old_name, const std::string &new_name) const
 
getCheckedPointerParam (const std::string &name, const std::string &error_string="") const
 
bool isParamValid (const std::string &name) const
 
bool isParamSetByUser (const std::string &nm) const
 
void paramError (const std::string &param, Args... args) const
 
void paramWarning (const std::string &param, Args... args) const
 
void paramInfo (const std::string &param, Args... args) const
 
void connectControllableParams (const std::string &parameter, const std::string &object_type, const std::string &object_name, const std::string &object_parameter) const
 
void mooseError (Args &&... args) const
 
void mooseErrorNonPrefixed (Args &&... args) const
 
void mooseDocumentedError (const std::string &repo_name, const unsigned int issue_num, Args &&... args) const
 
void mooseWarning (Args &&... args) const
 
void mooseWarningNonPrefixed (Args &&... args) const
 
void mooseDeprecated (Args &&... args) const
 
void mooseInfo (Args &&... args) const
 
std::string getDataFileName (const std::string &param) const
 
std::string getDataFileNameByName (const std::string &relative_path) const
 
std::string getDataFilePath (const std::string &relative_path) const
 
PerfGraphperfGraph ()
 
const libMesh::ConstElemRangegetEvaluableElementRange ()
 
const libMesh::ConstElemRangegetEvaluableElementRange ()
 
const libMesh::ConstElemRangegetNonlinearEvaluableElementRange ()
 
const libMesh::ConstElemRangegetNonlinearEvaluableElementRange ()
 
const libMesh::ConstElemRangegetCurrentAlgebraicElementRange ()
 
const libMesh::ConstElemRangegetCurrentAlgebraicElementRange ()
 
const libMesh::ConstNodeRangegetCurrentAlgebraicNodeRange ()
 
const libMesh::ConstNodeRangegetCurrentAlgebraicNodeRange ()
 
const ConstBndNodeRangegetCurrentAlgebraicBndNodeRange ()
 
const ConstBndNodeRangegetCurrentAlgebraicBndNodeRange ()
 
void setCurrentAlgebraicElementRange (libMesh::ConstElemRange *range)
 
void setCurrentAlgebraicElementRange (libMesh::ConstElemRange *range)
 
void setCurrentAlgebraicNodeRange (libMesh::ConstNodeRange *range)
 
void setCurrentAlgebraicNodeRange (libMesh::ConstNodeRange *range)
 
void setCurrentAlgebraicBndNodeRange (ConstBndNodeRange *range)
 
void setCurrentAlgebraicBndNodeRange (ConstBndNodeRange *range)
 
void allowOutput (bool state)
 
void allowOutput (bool state)
 
void allowOutput (bool state)
 
void allowOutput (bool state)
 
bool hasMultiApps () const
 
bool hasMultiApps (ExecFlagType type) const
 
bool hasMultiApps () const
 
bool hasMultiApps (ExecFlagType type) const
 
bool hasMultiApp (const std::string &name) const
 
bool hasMultiApp (const std::string &name) const
 
const AutomaticMortarGenerationgetMortarInterface (const std::pair< BoundaryID, BoundaryID > &primary_secondary_boundary_pair, const std::pair< SubdomainID, SubdomainID > &primary_secondary_subdomain_pair, bool on_displaced) const
 
AutomaticMortarGenerationgetMortarInterface (const std::pair< BoundaryID, BoundaryID > &primary_secondary_boundary_pair, const std::pair< SubdomainID, SubdomainID > &primary_secondary_subdomain_pair, bool on_displaced)
 
const AutomaticMortarGenerationgetMortarInterface (const std::pair< BoundaryID, BoundaryID > &primary_secondary_boundary_pair, const std::pair< SubdomainID, SubdomainID > &primary_secondary_subdomain_pair, bool on_displaced) const
 
AutomaticMortarGenerationgetMortarInterface (const std::pair< BoundaryID, BoundaryID > &primary_secondary_boundary_pair, const std::pair< SubdomainID, SubdomainID > &primary_secondary_subdomain_pair, bool on_displaced)
 
const MaterialPropertyStoragegetMaterialPropertyStorage ()
 
const MaterialPropertyStoragegetMaterialPropertyStorage ()
 
const MaterialPropertyStoragegetBndMaterialPropertyStorage ()
 
const MaterialPropertyStoragegetBndMaterialPropertyStorage ()
 
const MaterialPropertyStoragegetNeighborMaterialPropertyStorage ()
 
const MaterialPropertyStoragegetNeighborMaterialPropertyStorage ()
 
const MooseObjectWarehouse< Indicator > & getIndicatorWarehouse ()
 
const MooseObjectWarehouse< Indicator > & getIndicatorWarehouse ()
 
const MooseObjectWarehouse< InternalSideIndicator > & getInternalSideIndicatorWarehouse ()
 
const MooseObjectWarehouse< InternalSideIndicator > & getInternalSideIndicatorWarehouse ()
 
const MooseObjectWarehouse< Marker > & getMarkerWarehouse ()
 
const MooseObjectWarehouse< Marker > & getMarkerWarehouse ()
 
bool needBoundaryMaterialOnSide (BoundaryID bnd_id, const THREAD_ID tid)
 
bool needBoundaryMaterialOnSide (BoundaryID bnd_id, const THREAD_ID tid)
 
bool needInterfaceMaterialOnSide (BoundaryID bnd_id, const THREAD_ID tid)
 
bool needInterfaceMaterialOnSide (BoundaryID bnd_id, const THREAD_ID tid)
 
bool needSubdomainMaterialOnSide (SubdomainID subdomain_id, const THREAD_ID tid)
 
bool needSubdomainMaterialOnSide (SubdomainID subdomain_id, const THREAD_ID tid)
 
const ExecFlagTypegetCurrentExecuteOnFlag () const
 
const ExecFlagTypegetCurrentExecuteOnFlag () const
 
void setCurrentExecuteOnFlag (const ExecFlagType &)
 
void setCurrentExecuteOnFlag (const ExecFlagType &)
 
const Parallel::Communicator & comm () const
 
processor_id_type n_processors () const
 
processor_id_type processor_id () const
 

Static Public Member Functions

static InputParameters validParams ()
 
static std::string arrayVariableComponent (const std::string &var_name, unsigned int i)
 
static void selectVectorTagsFromSystem (const SystemBase &system, const std::vector< VectorTag > &input_vector_tags, std::set< TagID > &selected_tags)
 
static void selectMatrixTagsFromSystem (const SystemBase &system, const std::map< TagName, TagID > &input_matrix_tags, std::set< TagID > &selected_tags)
 
static void objectSetupHelper (const std::vector< T * > &objects, const ExecFlagType &exec_flag)
 
static void objectSetupHelper (const std::vector< T * > &objects, const ExecFlagType &exec_flag)
 
static void objectExecuteHelper (const std::vector< T * > &objects)
 
static void objectExecuteHelper (const std::vector< T * > &objects)
 

Public Attributes

std::map< std::string, std::vector< dof_id_type > > _var_dof_map
 
const ConsoleStream _console
 
std::vector< Real_real_zero
 
std::vector< VariableValue_scalar_zero
 
std::vector< VariableValue_zero
 
std::vector< VariablePhiValue_phi_zero
 
std::vector< MooseArray< ADReal > > _ad_zero
 
std::vector< VariableGradient_grad_zero
 
std::vector< MooseArray< ADRealVectorValue > > _ad_grad_zero
 
std::vector< VariablePhiGradient_grad_phi_zero
 
std::vector< VariableSecond_second_zero
 
std::vector< MooseArray< ADRealTensorValue > > _ad_second_zero
 
std::vector< VariablePhiSecond_second_phi_zero
 
std::vector< Point > _point_zero
 
std::vector< VectorVariableValue_vector_zero
 
std::vector< VectorVariableCurl_vector_curl_zero
 

Protected Member Functions

virtual Real computeFrictionFactor (Real Re) override
 Computes the axial friction factor for the sodium coolant and for each subchannel. More...
 
virtual void computeDP (int iblock) override
 computeDP(int iz) is defined/overridden in order to use the friction factor for sodium More...
 
virtual void computeh (int iblock) override
 computeMassFlowForDPDZ() and enforceUniformDPDZAtInlet() are overriden to define the sodium friction factor More...
 
virtual void externalSolve () override
 
virtual void computeWijFromSolve (int iblock)
 Computes diversion crossflow per gap for block with index iblock Block is a partition of the whole domain. More...
 
virtual void computeSumWij (int iblock)
 Computes net diversion crossflow per channel for block iblock. More...
 
virtual void computeMdot (int iblock)
 Computes mass flow per channel for block iblock. More...
 
virtual void computeWijPrime (int iblock)
 Computes turbulent crossflow per gap for block iblock. More...
 
virtual void computeP (int iblock)
 Computes Pressure per channel for block iblock. More...
 
virtual void computeT (int iblock)
 Computes Temperature per channel for block iblock. More...
 
virtual void computeRho (int iblock)
 Computes Density per channel for block iblock. More...
 
virtual void computeMu (int iblock)
 Computes Viscosity per channel for block iblock. More...
 
virtual void computeWij (int iblock)
 Computes cross fluxes for block iblock. More...
 
virtual Real computeAddedHeat (unsigned int i_ch, unsigned int iz)
 Computes added heat for channel i_ch and cell iz. More...
 
virtual libMesh::DenseVector< RealresidualFunction (int iblock, libMesh::DenseVector< Real > solution)
 Computes Residual per gap for block iblock. More...
 
virtual PetscErrorCode petscSnesSolver (int iblock, const libMesh::DenseVector< Real > &solution, libMesh::DenseVector< Real > &root)
 Computes solution of nonlinear equation using snes. More...
 
virtual PetscErrorCode implicitPetscSolve (int iblock)
 Computes implicit solve using PetSc. More...
 
virtual void initializeSolution ()
 Function to initialize the solution fields. More...
 
virtual PetscScalar computeInterpolationCoefficients (PetscScalar Peclet=0.0)
 Functions that computes the interpolation scheme given the Peclet number. More...
 
virtual PetscScalar computeInterpolatedValue (PetscScalar topValue, PetscScalar botValue, PetscScalar Peclet=0.0)
 
PetscErrorCode cleanUp ()
 
virtual PetscErrorCode createPetscVector (Vec &v, PetscInt n)
 Petsc Functions. More...
 
virtual PetscErrorCode createPetscMatrix (Mat &M, PetscInt n, PetscInt m)
 
template<class T >
PetscErrorCode populateVectorFromDense (Vec &x, const T &solution, const unsigned int first_axial_level, const unsigned int last_axial_level, const unsigned int cross_dimension)
 
template<class T >
PetscErrorCode populateDenseFromVector (const Vec &x, T &solution, const unsigned int first_axial_level, const unsigned int last_axial_level, const unsigned int cross_dimension)
 
template<class T >
PetscErrorCode populateVectorFromHandle (Vec &x, const T &solution, const unsigned int first_axial_level, const unsigned int last_axial_level, const unsigned int cross_dimension)
 
template<class T >
PetscErrorCode populateSolutionChan (const Vec &x, T &solution, const unsigned int first_axial_level, const unsigned int last_axial_level, const unsigned int cross_dimension)
 
template<class T >
PetscErrorCode populateSolutionGap (const Vec &x, T &solution, const unsigned int first_axial_level, const unsigned int last_axial_level, const unsigned int cross_dimension)
 
MooseVariableFieldBasegetVariableHelper (const THREAD_ID tid, const std::string &var_name, Moose::VarKindType expected_var_type, Moose::VarFieldType expected_var_field_type, const std::vector< T > &nls, const SystemBase &aux) const
 
void createTagVectors ()
 
void createTagSolutions ()
 
void computeSystems (const ExecFlagType &type)
 
void meshChangedHelper (bool intermediate_change=false)
 
bool duplicateVariableCheck (const std::string &var_name, const libMesh::FEType &type, bool is_aux, const std::set< SubdomainID > *const active_subdomains)
 
void computeUserObjectsInternal (const ExecFlagType &type, const Moose::AuxGroup &group, TheWarehouse::Query &query)
 
void checkDisplacementOrders ()
 
void checkUserObjects ()
 
void checkDependMaterialsHelper (const std::map< SubdomainID, std::vector< std::shared_ptr< MaterialBase >>> &materials_map)
 
void checkCoordinateSystems ()
 
void reinitBecauseOfGhostingOrNewGeomObjects (bool mortar_changed=false)
 
void addObjectParamsHelper (InputParameters &params, const std::string &object_name, const std::string &var_param_name="variable")
 
bool verifyVectorTags () const
 
void markFamilyPRefinement (const InputParameters &params)
 
PerfID registerTimedSection (const std::string &section_name, const unsigned int level) const
 
PerfID registerTimedSection (const std::string &section_name, const unsigned int level, const std::string &live_message, const bool print_dots=true) const
 
std::string timedSectionName (const std::string &section_name) const
 
T & declareRestartableData (const std::string &data_name, Args &&... args)
 
ManagedValue< T > declareManagedRestartableDataWithContext (const std::string &data_name, void *context, Args &&... args)
 
const T & getRestartableData (const std::string &data_name) const
 
T & declareRestartableDataWithContext (const std::string &data_name, void *context, Args &&... args)
 
T & declareRecoverableData (const std::string &data_name, Args &&... args)
 
T & declareRestartableDataWithObjectName (const std::string &data_name, const std::string &object_name, Args &&... args)
 
T & declareRestartableDataWithObjectNameWithContext (const std::string &data_name, const std::string &object_name, void *context, Args &&... args)
 
std::string restartableName (const std::string &data_name) const
 

Protected Attributes

Real _dpz_error
 average relative error in pressure drop of channels More...
 
const TriInterWrapperMesh_tri_sch_mesh
 
const InterWrapperMesh_subchannel_mesh
 
unsigned int _n_blocks
 number of axial blocks More...
 
libMesh::DenseMatrix< Real > & _Wij
 
libMesh::DenseMatrix< Real_Wij_old
 
libMesh::DenseMatrix< Real_WijPrime
 
libMesh::DenseMatrix< Real_Wij_residual_matrix
 
const Real _g_grav
 
const Real_kij
 
const unsigned int _n_cells
 
const unsigned int _n_gaps
 
const unsigned int _n_assemblies
 
const unsigned int _n_channels
 
const unsigned int _block_size
 
std::vector< Real_z_grid
 axial location of nodes More...
 
Real _one
 
Real _TR
 Flag that activates or deactivates the transient parts of the equations we solve by multiplication. More...
 
const bool _compute_density
 Flag that activates or deactivates the calculation of density. More...
 
const bool _compute_viscosity
 Flag that activates or deactivates the calculation of viscosity. More...
 
const bool _compute_power
 Flag that informs if we need to solve the Enthalpy/Temperature equations or not. More...
 
const bool _pin_mesh_exist
 Flag that informs if there is a pin mesh or not. More...
 
bool _converged
 Variable that informs whether we exited external solve with a converged solution or not. More...
 
const Real_dt
 Time step. More...
 
const Real_P_out
 Outlet Pressure. More...
 
const Real_beta
 Thermal diffusion coefficient used in turbulent crossflow. More...
 
const Real_CT
 Turbulent modeling parameter used in axial momentum equation. More...
 
const Real_P_tol
 Convergence tolerance for the pressure loop in external solve. More...
 
const Real_T_tol
 Convergence tolerance for the temperature loop in external solve. More...
 
const int_T_maxit
 Maximum iterations for the inner temperature loop. More...
 
const PetscReal & _rtol
 The relative convergence tolerance, (relative decrease) for the ksp linear solver. More...
 
const PetscReal & _atol
 The absolute convergence tolerance for the ksp linear solver. More...
 
const PetscReal & _dtol
 The divergence tolerance for the ksp linear solver. More...
 
const PetscInt & _maxit
 The maximum number of iterations to use for the ksp linear solver. More...
 
const MooseEnum _interpolation_scheme
 The interpolation method used in constructing the systems. More...
 
const bool _implicit_bool
 Flag to define the usage of a implicit or explicit solution. More...
 
const bool _staggered_pressure_bool
 Flag to define the usage of staggered or collocated pressure. More...
 
const bool _segregated_bool
 Segregated solve. More...
 
const bool _monolithic_thermal_bool
 Thermal monolithic bool. More...
 
const SinglePhaseFluidProperties_fp
 Solutions handles and link to TH tables properties. More...
 
std::unique_ptr< SolutionHandle_mdot_soln
 
std::unique_ptr< SolutionHandle_SumWij_soln
 
std::unique_ptr< SolutionHandle_P_soln
 
std::unique_ptr< SolutionHandle_DP_soln
 
std::unique_ptr< SolutionHandle_h_soln
 
std::unique_ptr< SolutionHandle_T_soln
 
std::unique_ptr< SolutionHandle_Tpin_soln
 
std::unique_ptr< SolutionHandle_rho_soln
 
std::unique_ptr< SolutionHandle_mu_soln
 
std::unique_ptr< SolutionHandle_S_flow_soln
 
std::unique_ptr< SolutionHandle_w_perim_soln
 
std::unique_ptr< SolutionHandle_q_prime_soln
 
Mat _mc_sumWij_mat
 Mass conservation Mass conservation - sum of cross fluxes. More...
 
Vec _Wij_vec
 
Vec _prod
 
Vec _prodp
 
Mat _mc_axial_convection_mat
 Mass conservation - axial convection. More...
 
Vec _mc_axial_convection_rhs
 
Mat _amc_turbulent_cross_flows_mat
 Mass conservation - density time derivative No implicit matrix. More...
 
Vec _amc_turbulent_cross_flows_rhs
 
Mat _amc_time_derivative_mat
 Axial momentum conservation - time derivative. More...
 
Vec _amc_time_derivative_rhs
 
Mat _amc_advective_derivative_mat
 Axial momentum conservation - advective (Eulerian) derivative. More...
 
Vec _amc_advective_derivative_rhs
 
Mat _amc_cross_derivative_mat
 Axial momentum conservation - cross flux derivative. More...
 
Vec _amc_cross_derivative_rhs
 
Mat _amc_friction_force_mat
 Axial momentum conservation - friction force. More...
 
Vec _amc_friction_force_rhs
 
Vec _amc_gravity_rhs
 Axial momentum conservation - buoyancy force No implicit matrix. More...
 
Mat _amc_pressure_force_mat
 Axial momentum conservation - pressure force. More...
 
Vec _amc_pressure_force_rhs
 
Mat _amc_sys_mdot_mat
 Axial momentum system matrix. More...
 
Vec _amc_sys_mdot_rhs
 
Mat _cmc_time_derivative_mat
 Cross momentum Cross momentum conservation - time derivative. More...
 
Vec _cmc_time_derivative_rhs
 
Mat _cmc_advective_derivative_mat
 Cross momentum conservation - advective (Eulerian) derivative. More...
 
Vec _cmc_advective_derivative_rhs
 
Mat _cmc_friction_force_mat
 Cross momentum conservation - friction force. More...
 
Vec _cmc_friction_force_rhs
 
Mat _cmc_pressure_force_mat
 Cross momentum conservation - pressure force. More...
 
Vec _cmc_pressure_force_rhs
 
Mat _cmc_sys_Wij_mat
 Lateral momentum system matrix. More...
 
Vec _cmc_sys_Wij_rhs
 
Vec _cmc_Wij_channel_dummy
 
Mat _hc_time_derivative_mat
 Enthalpy Enthalpy conservation - time derivative. More...
 
Vec _hc_time_derivative_rhs
 
Mat _hc_advective_derivative_mat
 Enthalpy conservation - advective (Eulerian) derivative;. More...
 
Vec _hc_advective_derivative_rhs
 
Mat _hc_cross_derivative_mat
 Enthalpy conservation - cross flux derivative. More...
 
Vec _hc_cross_derivative_rhs
 
Vec _hc_added_heat_rhs
 Enthalpy conservation - source and sink. More...
 
Mat _hc_sys_h_mat
 System matrices. More...
 
Vec _hc_sys_h_rhs
 
PetscInt _global_counter = 0
 No implicit matrix. More...
 
PetscScalar _added_K = 0.0
 Added resistances for monolithic convergence. More...
 
PetscScalar _added_K_old = 1000.0
 
PetscScalar _max_sumWij
 
PetscScalar _max_sumWij_new
 
PetscScalar _correction_factor = 1.0
 
MooseMesh_mesh
 
bool _initialized
 
std::vector< ConvergenceName > _nonlinear_convergence_names
 
std::set< TagID_fe_vector_tags
 
std::set< TagID_fe_matrix_tags
 
std::set< TagID_linear_vector_tags
 
std::set< TagID_linear_matrix_tags
 
const bool & _solve
 
bool _transient
 
Real_time
 
Real_time_old
 
int_t_step
 
Real_dt_old
 
bool _set_nonlinear_convergence_names
 
bool _need_to_add_default_nonlinear_convergence
 
const std::vector< LinearSystemName > _linear_sys_names
 
const std::size_t _num_linear_sys
 
std::vector< std::shared_ptr< LinearSystem > > _linear_systems
 
std::map< LinearSystemName, unsigned int_linear_sys_name_to_num
 
LinearSystem_current_linear_sys
 
const bool _using_default_nl
 
const std::vector< NonlinearSystemName > _nl_sys_names
 
const std::size_t _num_nl_sys
 
std::vector< std::shared_ptr< NonlinearSystemBase > > _nl
 
std::map< NonlinearSystemName, unsigned int_nl_sys_name_to_num
 
NonlinearSystemBase_current_nl_sys
 
SolverSystem_current_solver_sys
 
std::vector< std::shared_ptr< SolverSystem > > _solver_systems
 
std::map< SolverVariableName, unsigned int_solver_var_to_sys_num
 
std::map< SolverSystemName, unsigned int_solver_sys_name_to_num
 
std::vector< std::string > _solver_sys_names
 
std::shared_ptr< AuxiliarySystem_aux
 
Moose::CouplingType _coupling
 
std::vector< std::unique_ptr< libMesh::CouplingMatrix > > _cm
 
std::map< std::string, unsigned int_subspace_dim
 
std::vector< std::vector< std::unique_ptr< Assembly > > > _assembly
 
MooseObjectWarehouse< MeshDivision_mesh_divisions
 
MooseObjectWarehouse< Function_functions
 
MooseObjectWarehouse< Convergence_convergences
 
MooseObjectWarehouse< KernelBase_nonlocal_kernels
 
MooseObjectWarehouse< IntegratedBCBase_nonlocal_integrated_bcs
 
MaterialPropertyRegistry _material_prop_registry
 
MaterialPropertyStorage_material_props
 
MaterialPropertyStorage_bnd_material_props
 
MaterialPropertyStorage_neighbor_material_props
 
MooseObjectWarehouse< Marker_markers
 
ReporterData _reporter_data
 
ExecuteMooseObjectWarehouse< UserObject_all_user_objects
 
ExecuteMooseObjectWarehouse< MultiApp_multi_apps
 
ExecuteMooseObjectWarehouse< TransientMultiApp_transient_multi_apps
 
ExecuteMooseObjectWarehouse< Transfer_transfers
 
ExecuteMooseObjectWarehouse< Transfer_to_multi_app_transfers
 
ExecuteMooseObjectWarehouse< Transfer_from_multi_app_transfers
 
ExecuteMooseObjectWarehouse< Transfer_between_multi_app_transfers
 
std::map< std::string, std::unique_ptr< RandomData > > _random_data_objects
 
std::vector< std::unordered_map< SubdomainID, bool > > _block_mat_side_cache
 
std::vector< std::unordered_map< BoundaryID, bool > > _bnd_mat_side_cache
 
std::vector< std::unordered_map< BoundaryID, bool > > _interface_mat_side_cache
 
std::vector< MeshChangedInterface *> _notify_when_mesh_changes
 
Adaptivity _adaptivity
 
unsigned int _cycles_completed
 
std::shared_ptr< XFEMInterface_xfem
 
MooseMesh_displaced_mesh
 
std::shared_ptr< DisplacedProblem_displaced_problem
 
GeometricSearchData _geometric_search_data
 
MortarData _mortar_data
 
bool _reinit_displaced_elem
 
bool _reinit_displaced_face
 
bool _reinit_displaced_neighbor
 
bool _input_file_saved
 
bool _has_dampers
 
bool _has_constraints
 
bool _snesmf_reuse_base
 
bool _skip_exception_check
 
bool _snesmf_reuse_base_set_by_user
 
bool _has_initialized_stateful
 
bool _const_jacobian
 
bool _has_jacobian
 
bool _needs_old_newton_iter
 
bool _previous_nl_solution_required
 
bool _has_nonlocal_coupling
 
bool _calculate_jacobian_in_uo
 
std::vector< std::vector< const MooseVariableFEBase *> > _uo_jacobian_moose_vars
 
std::vector< unsigned char > _has_active_material_properties
 
std::vector< SolverParams_solver_params
 
CoverageCheckMode _kernel_coverage_check
 
std::vector< SubdomainName > _kernel_coverage_blocks
 
const bool _boundary_restricted_node_integrity_check
 
const bool _boundary_restricted_elem_integrity_check
 
CoverageCheckMode _material_coverage_check
 
std::vector< SubdomainName > _material_coverage_blocks
 
bool _fv_bcs_integrity_check
 
const bool _material_dependency_check
 
const bool _uo_aux_state_check
 
unsigned int _max_qps
 
libMesh::Order _max_scalar_order
 
bool _has_time_integrator
 
bool _has_exception
 
bool _parallel_barrier_messaging
 
MooseEnum _verbose_setup
 
bool _verbose_multiapps
 
std::string _exception_message
 
ExecFlagType _current_execute_on_flag
 
ExecuteMooseObjectWarehouse< Control_control_warehouse
 
Moose::PetscSupport::PetscOptions _petsc_options
 
PetscOptions _petsc_option_data_base
 
bool _is_petsc_options_inserted
 
std::shared_ptr< LineSearch_line_search
 
std::unique_ptr< libMesh::ConstElemRange_evaluable_local_elem_range
 
std::unique_ptr< libMesh::ConstElemRange_nl_evaluable_local_elem_range
 
std::unique_ptr< libMesh::ConstElemRange_aux_evaluable_local_elem_range
 
std::unique_ptr< libMesh::ConstElemRange_current_algebraic_elem_range
 
std::unique_ptr< libMesh::ConstNodeRange_current_algebraic_node_range
 
std::unique_ptr< ConstBndNodeRange_current_algebraic_bnd_node_range
 
bool _using_ad_mat_props
 
unsigned short _current_ic_state
 
std::map< TagName, TagID_matrix_tag_name_to_tag_id
 
std::map< TagID, TagName > _matrix_tag_id_to_tag_name
 
Factory_factory
 
std::vector< libMesh::CouplingMatrix_nonlocal_cm
 
DiracKernelInfo _dirac_kernel_info
 
std::map< SubdomainID, std::set< std::string > > _map_block_material_props
 
std::map< BoundaryID, std::set< std::string > > _map_boundary_material_props
 
std::map< SubdomainID, std::set< MaterialPropertyName > > _zero_block_material_props
 
std::map< BoundaryID, std::set< MaterialPropertyName > > _zero_boundary_material_props
 
std::set< std::string > _material_property_requested
 
std::vector< std::set< MooseVariableFieldBase *> > _active_elemental_moose_variables
 
std::vector< unsigned int_has_active_elemental_moose_variables
 
std::vector< std::set< TagID > > _active_fe_var_coupleable_matrix_tags
 
std::vector< std::set< TagID > > _active_fe_var_coupleable_vector_tags
 
std::vector< std::set< TagID > > _active_sc_var_coupleable_matrix_tags
 
std::vector< std::set< TagID > > _active_sc_var_coupleable_vector_tags
 
bool _requires_nonlocal_coupling
 
bool _default_ghosting
 
std::set< dof_id_type_ghosted_elems
 
bool _currently_computing_jacobian
 
bool _currently_computing_residual_and_jacobian
 
bool _computing_nonlinear_residual
 
bool _currently_computing_residual
 
bool _safe_access_tagged_matrices
 
bool _safe_access_tagged_vectors
 
bool _have_ad_objects
 
std::unordered_set< TagID_not_zeroed_tagged_vectors
 
bool _cli_option_found
 
bool _color_output
 
bool _termination_requested
 
const bool & _enabled
 
MooseApp_app
 
const std::string _type
 
const std::string _name
 
const InputParameters_pars
 
ActionFactory_action_factory
 
MooseApp_pg_moose_app
 
const std::string _prefix
 
MooseApp_restartable_app
 
const std::string _restartable_system_name
 
const THREAD_ID _restartable_tid
 
const bool _restartable_read_only
 
InitialConditionWarehouse _ics
 
FVInitialConditionWarehouse _fv_ics
 
ScalarInitialConditionWarehouse _scalar_ics
 
MaterialWarehouse _materials
 
MaterialWarehouse _interface_materials
 
MaterialWarehouse _discrete_materials
 
MaterialWarehouse _all_materials
 
MooseObjectWarehouse< Indicator_indicators
 
MooseObjectWarehouse< InternalSideIndicator_internal_side_indicators
 
std::map< SubdomainID, std::multimap< std::string, std::string > > _map_block_material_props_check
 
std::map< BoundaryID, std::multimap< std::string, std::string > > _map_boundary_material_props_check
 
const Parallel::Communicator & _communicator
 

Detailed Description

Triangular interwrapper solver.

Definition at line 18 of file TriInterWrapper1PhaseProblem.h.

Constructor & Destructor Documentation

◆ TriInterWrapper1PhaseProblem()

TriInterWrapper1PhaseProblem::TriInterWrapper1PhaseProblem ( const InputParameters params)

Definition at line 26 of file TriInterWrapper1PhaseProblem.C.

27  : InterWrapper1PhaseProblem(params),
28  _tri_sch_mesh(SCM::getConstMesh<TriInterWrapperMesh>(_subchannel_mesh))
29 {
30 }
const TriInterWrapperMesh & _tri_sch_mesh
const InterWrapperMesh & _subchannel_mesh
InterWrapper1PhaseProblem(const InputParameters &params)

Member Function Documentation

◆ cleanUp()

PetscErrorCode InterWrapper1PhaseProblem::cleanUp ( )
protectedinherited

Definition at line 253 of file InterWrapper1PhaseProblem.C.

Referenced by InterWrapper1PhaseProblem::~InterWrapper1PhaseProblem().

254 {
256  // We need to clean up the petsc matrices/vectors
257  // Mass conservation components
258  LibmeshPetscCall(MatDestroy(&_mc_sumWij_mat));
259  LibmeshPetscCall(VecDestroy(&_Wij_vec));
260  LibmeshPetscCall(VecDestroy(&_prod));
261  LibmeshPetscCall(VecDestroy(&_prodp));
262  LibmeshPetscCall(MatDestroy(&_mc_axial_convection_mat));
263  LibmeshPetscCall(VecDestroy(&_mc_axial_convection_rhs));
264 
265  // Axial momentum conservation components
266  LibmeshPetscCall(MatDestroy(&_amc_turbulent_cross_flows_mat));
267  LibmeshPetscCall(VecDestroy(&_amc_turbulent_cross_flows_rhs));
268  LibmeshPetscCall(MatDestroy(&_amc_time_derivative_mat));
269  LibmeshPetscCall(VecDestroy(&_amc_time_derivative_rhs));
270  LibmeshPetscCall(MatDestroy(&_amc_advective_derivative_mat));
271  LibmeshPetscCall(VecDestroy(&_amc_advective_derivative_rhs));
272  LibmeshPetscCall(MatDestroy(&_amc_cross_derivative_mat));
273  LibmeshPetscCall(VecDestroy(&_amc_cross_derivative_rhs));
274  LibmeshPetscCall(MatDestroy(&_amc_friction_force_mat));
275  LibmeshPetscCall(VecDestroy(&_amc_friction_force_rhs));
276  LibmeshPetscCall(VecDestroy(&_amc_gravity_rhs));
277  LibmeshPetscCall(MatDestroy(&_amc_pressure_force_mat));
278  LibmeshPetscCall(VecDestroy(&_amc_pressure_force_rhs));
279  LibmeshPetscCall(MatDestroy(&_amc_sys_mdot_mat));
280  LibmeshPetscCall(VecDestroy(&_amc_sys_mdot_rhs));
281 
282  // Lateral momentum conservation components
283  LibmeshPetscCall(MatDestroy(&_cmc_time_derivative_mat));
284  LibmeshPetscCall(VecDestroy(&_cmc_time_derivative_rhs));
285  LibmeshPetscCall(MatDestroy(&_cmc_advective_derivative_mat));
286  LibmeshPetscCall(VecDestroy(&_cmc_advective_derivative_rhs));
287  LibmeshPetscCall(MatDestroy(&_cmc_friction_force_mat));
288  LibmeshPetscCall(VecDestroy(&_cmc_friction_force_rhs));
289  LibmeshPetscCall(MatDestroy(&_cmc_pressure_force_mat));
290  LibmeshPetscCall(VecDestroy(&_cmc_pressure_force_rhs));
291  LibmeshPetscCall(MatDestroy(&_cmc_sys_Wij_mat));
292  LibmeshPetscCall(VecDestroy(&_cmc_sys_Wij_rhs));
293  LibmeshPetscCall(VecDestroy(&_cmc_Wij_channel_dummy));
294 
295  // Energy conservation components
296  LibmeshPetscCall(MatDestroy(&_hc_time_derivative_mat));
297  LibmeshPetscCall(VecDestroy(&_hc_time_derivative_rhs));
298  LibmeshPetscCall(MatDestroy(&_hc_advective_derivative_mat));
299  LibmeshPetscCall(VecDestroy(&_hc_advective_derivative_rhs));
300  LibmeshPetscCall(MatDestroy(&_hc_cross_derivative_mat));
301  LibmeshPetscCall(VecDestroy(&_hc_cross_derivative_rhs));
302  LibmeshPetscCall(VecDestroy(&_hc_added_heat_rhs));
303  LibmeshPetscCall(MatDestroy(&_hc_sys_h_mat));
304  LibmeshPetscCall(VecDestroy(&_hc_sys_h_rhs));
305 
306  PetscFunctionReturn(LIBMESH_PETSC_SUCCESS);
307 }
Mat _amc_turbulent_cross_flows_mat
Mass conservation - density time derivative No implicit matrix.
Mat _cmc_friction_force_mat
Cross momentum conservation - friction force.
Mat _amc_advective_derivative_mat
Axial momentum conservation - advective (Eulerian) derivative.
Mat _cmc_pressure_force_mat
Cross momentum conservation - pressure force.
Mat _mc_sumWij_mat
Mass conservation Mass conservation - sum of cross fluxes.
PetscFunctionBegin
Mat _mc_axial_convection_mat
Mass conservation - axial convection.
Mat _hc_time_derivative_mat
Enthalpy Enthalpy conservation - time derivative.
Mat _amc_cross_derivative_mat
Axial momentum conservation - cross flux derivative.
Mat _hc_advective_derivative_mat
Enthalpy conservation - advective (Eulerian) derivative;.
Mat _amc_time_derivative_mat
Axial momentum conservation - time derivative.
Mat _cmc_advective_derivative_mat
Cross momentum conservation - advective (Eulerian) derivative.
Vec _hc_added_heat_rhs
Enthalpy conservation - source and sink.
Mat _cmc_sys_Wij_mat
Lateral momentum system matrix.
Mat _amc_pressure_force_mat
Axial momentum conservation - pressure force.
PetscFunctionReturn(LIBMESH_PETSC_SUCCESS)
Mat _hc_cross_derivative_mat
Enthalpy conservation - cross flux derivative.
Vec _amc_gravity_rhs
Axial momentum conservation - buoyancy force No implicit matrix.
Mat _cmc_time_derivative_mat
Cross momentum Cross momentum conservation - time derivative.
Mat _amc_sys_mdot_mat
Axial momentum system matrix.
Mat _amc_friction_force_mat
Axial momentum conservation - friction force.

◆ computeAddedHeat()

Real InterWrapper1PhaseProblem::computeAddedHeat ( unsigned int  i_ch,
unsigned int  iz 
)
protectedvirtualinherited

Computes added heat for channel i_ch and cell iz.

Definition at line 1474 of file InterWrapper1PhaseProblem.C.

Referenced by InterWrapper1PhaseProblem::computeh().

1475 {
1476  auto dz = _z_grid[iz] - _z_grid[iz - 1];
1477  if (_pin_mesh_exist)
1478  {
1479  auto heat_rate_in = 0.0;
1480  auto heat_rate_out = 0.0;
1481  for (auto i_pin : _subchannel_mesh.getChannelPins(i_ch))
1482  {
1483  auto * node_in = _subchannel_mesh.getPinNode(i_pin, iz - 1);
1484  auto * node_out = _subchannel_mesh.getPinNode(i_pin, iz);
1485  heat_rate_out += 0.25 * (*_q_prime_soln)(node_out);
1486  heat_rate_in += 0.25 * (*_q_prime_soln)(node_in);
1487  }
1488  return (heat_rate_in + heat_rate_out) * dz / 2.0;
1489  }
1490  else
1491  {
1492  auto * node_in = _subchannel_mesh.getChannelNode(i_ch, iz - 1);
1493  auto * node_out = _subchannel_mesh.getChannelNode(i_ch, iz);
1494  return ((*_q_prime_soln)(node_out) + (*_q_prime_soln)(node_in)) * dz / 2.0;
1495  }
1496 }
virtual const std::vector< unsigned int > & getChannelPins(unsigned int i_chan) const =0
Return a vector of pin indices for a given channel index.
std::vector< Real > _z_grid
axial location of nodes
virtual Node * getPinNode(unsigned int i_pin, unsigned iz) const =0
Get the pin mesh node for a given pin index and elevation index.
const InterWrapperMesh & _subchannel_mesh
virtual Node * getChannelNode(unsigned int i_chan, unsigned iz) const =0
Get the inter-wrapper mesh node for a given channel index and elevation index.
std::unique_ptr< SolutionHandle > _q_prime_soln
const bool _pin_mesh_exist
Flag that informs if there is a pin mesh or not.

◆ computeDP()

void TriInterWrapper1PhaseProblem::computeDP ( int  iblock)
overrideprotectedvirtual

computeDP(int iz) is defined/overridden in order to use the friction factor for sodium

Reimplemented from InterWrapper1PhaseProblem.

Definition at line 59 of file TriInterWrapper1PhaseProblem.C.

60 {
61  unsigned int last_node = (iblock + 1) * _block_size;
62  unsigned int first_node = iblock * _block_size + 1;
63 
64  for (unsigned int iz = first_node; iz < last_node + 1; iz++)
65  {
66  auto z_grid = _subchannel_mesh.getZGrid();
67  auto k_grid = _subchannel_mesh.getKGrid();
68  auto dz = z_grid[iz] - z_grid[iz - 1];
69  for (unsigned int i_ch = 0; i_ch < _n_channels; i_ch++)
70  {
71  auto * node_in = _subchannel_mesh.getChannelNode(i_ch, iz - 1);
72  auto * node_out = _subchannel_mesh.getChannelNode(i_ch, iz);
73  auto rho_in = (*_rho_soln)(node_in);
74  auto rho_out = (*_rho_soln)(node_out);
75  auto mu_in = (*_mu_soln)(node_in);
76  auto S = (*_S_flow_soln)(node_in);
77  auto w_perim = (*_w_perim_soln)(node_in);
78  // hydraulic diameter in the i direction
79  auto Dh_i = 4.0 * S / w_perim;
80  auto time_term =
81  _TR * ((*_mdot_soln)(node_out)-_mdot_soln->old(node_out)) * dz / _dt -
82  dz * 2.0 * (*_mdot_soln)(node_out) * (rho_out - _rho_soln->old(node_out)) / rho_in / _dt;
83 
84  auto mass_term1 =
85  std::pow((*_mdot_soln)(node_out), 2.0) * (1.0 / S / rho_out - 1.0 / S / rho_in);
86  auto mass_term2 = -2.0 * (*_mdot_soln)(node_out) * (*_SumWij_soln)(node_out) / S / rho_in;
87 
88  auto crossflow_term = 0.0;
89  auto turbulent_term = 0.0;
90 
91  unsigned int counter = 0;
92  for (auto i_gap : _subchannel_mesh.getChannelGaps(i_ch))
93  {
94  auto chans = _subchannel_mesh.getGapChannels(i_gap);
95  unsigned int ii_ch = chans.first;
96  unsigned int jj_ch = chans.second;
97  auto * node_in_i = _subchannel_mesh.getChannelNode(ii_ch, iz - 1);
98  auto * node_in_j = _subchannel_mesh.getChannelNode(jj_ch, iz - 1);
99  auto * node_out_i = _subchannel_mesh.getChannelNode(ii_ch, iz);
100  auto * node_out_j = _subchannel_mesh.getChannelNode(jj_ch, iz);
101  auto rho_i = (*_rho_soln)(node_in_i);
102  auto rho_j = (*_rho_soln)(node_in_j);
103  auto Si = (*_S_flow_soln)(node_in_i);
104  auto Sj = (*_S_flow_soln)(node_in_j);
105  auto u_star = 0.0;
106  // figure out donor axial velocity
107  if (_Wij(i_gap, iz) > 0.0)
108  u_star = (*_mdot_soln)(node_out_i) / Si / rho_i;
109  else
110  u_star = (*_mdot_soln)(node_out_j) / Sj / rho_j;
111 
112  crossflow_term +=
113  _subchannel_mesh.getCrossflowSign(i_ch, counter) * _Wij(i_gap, iz) * u_star;
114 
115  turbulent_term += _WijPrime(i_gap, iz) * (2 * (*_mdot_soln)(node_out) / rho_in / S -
116  (*_mdot_soln)(node_out_j) / Sj / rho_j -
117  (*_mdot_soln)(node_out_i) / Si / rho_i);
118  counter++;
119  }
120  turbulent_term *= _CT;
121 
122  auto Re = (((*_mdot_soln)(node_in) / S) * Dh_i / mu_in);
123  auto fi = computeFrictionFactor(Re);
124  auto ki = k_grid[i_ch][iz - 1];
125  auto friction_term = (fi * dz / Dh_i + ki) * 0.5 * (std::pow((*_mdot_soln)(node_out), 2.0)) /
126  (S * (*_rho_soln)(node_out));
127  auto gravity_term = _g_grav * (*_rho_soln)(node_out)*dz * S;
128  auto DP = std::pow(S, -1.0) * (time_term + mass_term1 + mass_term2 + crossflow_term +
129  turbulent_term + friction_term + gravity_term); // Pa
130  _DP_soln->set(node_out, DP);
131  }
132  }
133 }
virtual const std::vector< std::vector< Real > > & getKGrid() const
Get axial cell location and value of loss coefficient.
virtual Real computeFrictionFactor(Real Re) override
Computes the axial friction factor for the sodium coolant and for each subchannel.
Real _TR
Flag that activates or deactivates the transient parts of the equations we solve by multiplication...
virtual const std::pair< unsigned int, unsigned int > & getGapChannels(unsigned int i_gap) const =0
Return a pair of inter-wrapper indices for a given gap index.
std::unique_ptr< SolutionHandle > _SumWij_soln
std::unique_ptr< SolutionHandle > _rho_soln
std::unique_ptr< SolutionHandle > _mdot_soln
static const std::string S
Definition: NS.h:163
const InterWrapperMesh & _subchannel_mesh
std::unique_ptr< SolutionHandle > _DP_soln
virtual Node * getChannelNode(unsigned int i_chan, unsigned iz) const =0
Get the inter-wrapper mesh node for a given channel index and elevation index.
virtual const std::vector< Real > & getZGrid() const
Get axial location of layers.
libMesh::DenseMatrix< Real > & _Wij
libMesh::DenseMatrix< Real > _WijPrime
MooseUnits pow(const MooseUnits &, int)
virtual const std::vector< unsigned int > & getChannelGaps(unsigned int i_chan) const =0
Return a vector of gap indices for a given channel index.
const Real & _CT
Turbulent modeling parameter used in axial momentum equation.
virtual const Real & getCrossflowSign(unsigned int i_chan, unsigned int i_local) const =0
Return a signs for the cross flow given a inter-wrapper index and local neighbor index.

◆ computeFrictionFactor()

double TriInterWrapper1PhaseProblem::computeFrictionFactor ( Real  Re)
overrideprotectedvirtual

Computes the axial friction factor for the sodium coolant and for each subchannel.

Upgraded Cheng-Todreas Correlation (2018).

Implements InterWrapper1PhaseProblem.

Definition at line 33 of file TriInterWrapper1PhaseProblem.C.

Referenced by computeDP().

34 {
35  Real a, b;
36  if (Re < 1)
37  {
38  return 64.0;
39  }
40  else if (Re >= 1 and Re < 5000)
41  {
42  a = 64.0;
43  b = -1.0;
44  }
45  else if (Re >= 5000 and Re < 30000)
46  {
47  a = 0.316;
48  b = -0.25;
49  }
50  else
51  {
52  a = 0.184;
53  b = -0.20;
54  }
55  return a * std::pow(Re, b);
56 }
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
MooseUnits pow(const MooseUnits &, int)

◆ computeh()

void TriInterWrapper1PhaseProblem::computeh ( int  iblock)
overrideprotectedvirtual

computeMassFlowForDPDZ() and enforceUniformDPDZAtInlet() are overriden to define the sodium friction factor

Reimplemented from InterWrapper1PhaseProblem.

Definition at line 136 of file TriInterWrapper1PhaseProblem.C.

Referenced by externalSolve().

137 {
138  unsigned int last_node = (iblock + 1) * _block_size;
139  unsigned int first_node = iblock * _block_size + 1;
140 
141  if (iblock == 0)
142  {
143  for (unsigned int i_ch = 0; i_ch < _n_channels; i_ch++)
144  {
145  auto * node = _subchannel_mesh.getChannelNode(i_ch, 0);
146  auto h_out = _fp->h_from_p_T((*_P_soln)(node) + _P_out, (*_T_soln)(node));
147  if (h_out < 0)
148  {
149  mooseError(
150  name(), " : Calculation of negative Enthalpy h_out = : ", h_out, " Axial Level= : ", 0);
151  }
152  _h_soln->set(node, h_out);
153  }
154  }
155 
156  for (unsigned int iz = first_node; iz < last_node + 1; iz++)
157  {
158  auto z_grid = _subchannel_mesh.getZGrid();
159  auto dz = z_grid[iz] - z_grid[iz - 1];
160  auto heated_length = _subchannel_mesh.getHeatedLength();
161  auto unheated_length_entry = _subchannel_mesh.getHeatedLengthEntry();
162 
163  Real gedge_ave = 0.0;
164  Real mdot_sum = 0.0;
165  Real si_sum = 0.0;
166  for (unsigned int i_ch = 0; i_ch < _n_channels; i_ch++)
167  {
168  auto subch_type = _subchannel_mesh.getSubchannelType(i_ch);
169  if (subch_type == EChannelType::EDGE || subch_type == EChannelType::CORNER)
170  {
171  auto * node_in = _subchannel_mesh.getChannelNode(i_ch, iz - 1);
172  auto Si = (*_S_flow_soln)(node_in);
173  auto mdot_in = (*_mdot_soln)(node_in);
174  mdot_sum = mdot_sum + mdot_in;
175  si_sum = si_sum + Si;
176  }
177  }
178  gedge_ave = mdot_sum / si_sum;
179 
180  for (unsigned int i_ch = 0; i_ch < _n_channels; i_ch++)
181  {
182  const Real & pitch = _subchannel_mesh.getPitch();
183  const Real & assembly_diameter = _subchannel_mesh.getSideX();
184  auto * node_in = _subchannel_mesh.getChannelNode(i_ch, iz - 1);
185  auto * node_out = _subchannel_mesh.getChannelNode(i_ch, iz);
186  auto mdot_in = (*_mdot_soln)(node_in);
187  auto h_in = (*_h_soln)(node_in); // J/kg
188  auto volume = dz * (*_S_flow_soln)(node_in);
189  auto mdot_out = (*_mdot_soln)(node_out);
190  auto h_out = 0.0;
191  Real sumWijh = 0.0;
192  Real sumWijPrimeDhij = 0.0;
193  Real e_cond = 0.0;
194 
195  Real added_enthalpy;
196  if (z_grid[iz] > unheated_length_entry && z_grid[iz] <= unheated_length_entry + heated_length)
197  added_enthalpy = ((*_q_prime_soln)(node_out) + (*_q_prime_soln)(node_in)) * dz / 2.0;
198  else
199  added_enthalpy = 0.0;
200 
201  // compute the sweep flow enthalpy change
202  auto subch_type = _subchannel_mesh.getSubchannelType(i_ch);
203  Real sweep_enthalpy = 0.0;
204 
205  if (subch_type == EChannelType::EDGE || subch_type == EChannelType::CORNER)
206  {
207  const Real & pitch = _subchannel_mesh.getPitch();
208  const Real & assembly_diameter = _subchannel_mesh.getSideX();
209  const Real & wire_lead_length = 0.0;
210  const Real & wire_diameter = 0.0;
211  auto gap = _tri_sch_mesh.getDuctToPinGap();
212  auto w = assembly_diameter + gap;
213  auto theta =
214  std::acos(wire_lead_length /
215  std::sqrt(std::pow(wire_lead_length, 2) +
216  std::pow(libMesh::pi * (assembly_diameter + wire_diameter), 2)));
217  // in/out channels for i_ch
218  auto sweep_in = _tri_sch_mesh.getSweepFlowChans(i_ch).first;
219  auto * node_sin = _subchannel_mesh.getChannelNode(sweep_in, iz - 1);
220  auto cs_t = 0.75 * std::pow(wire_lead_length / assembly_diameter, 0.3);
221  auto ar2 = libMesh::pi * (assembly_diameter + wire_diameter) * wire_diameter / 4.0;
222  auto a2p = pitch * (w - assembly_diameter / 2.0) -
223  libMesh::pi * std::pow(assembly_diameter, 2) / 8.0;
224  auto Sij_in = dz * gap;
225  auto Sij_out = dz * gap;
226  auto wsweep_in = gedge_ave * cs_t * std::pow((ar2 / a2p), 0.5) * std::tan(theta) * Sij_in;
227  auto wsweep_out = gedge_ave * cs_t * std::pow((ar2 / a2p), 0.5) * std::tan(theta) * Sij_out;
228  auto sweep_hin = (*_h_soln)(node_sin);
229  auto sweep_hout = (*_h_soln)(node_in);
230  sweep_enthalpy = (wsweep_in * sweep_hin - wsweep_out * sweep_hout);
231  }
232 
233  // Calculate sum of crossflow into channel i from channels j around i
234  unsigned int counter = 0;
235  for (auto i_gap : _subchannel_mesh.getChannelGaps(i_ch))
236  {
237  auto chans = _subchannel_mesh.getGapChannels(i_gap);
238  unsigned int ii_ch = chans.first;
239  // i is always the smallest and first index in the mapping
240  unsigned int jj_ch = chans.second;
241  auto * node_in_i = _subchannel_mesh.getChannelNode(ii_ch, iz - 1);
242  auto * node_in_j = _subchannel_mesh.getChannelNode(jj_ch, iz - 1);
243  // Define donor enthalpy
244  auto h_star = 0.0;
245  if (_Wij(i_gap, iz) > 0.0)
246  h_star = (*_h_soln)(node_in_i);
247  else if (_Wij(i_gap, iz) < 0.0)
248  h_star = (*_h_soln)(node_in_j);
249  // take care of the sign by applying the map, use donor cell
250  sumWijh += _subchannel_mesh.getCrossflowSign(i_ch, counter) * _Wij(i_gap, iz) * h_star;
251  sumWijPrimeDhij += _WijPrime(i_gap, iz) * (2 * (*_h_soln)(node_in) - (*_h_soln)(node_in_j) -
252  (*_h_soln)(node_in_i));
253  counter++;
254 
255  // compute the radial heat conduction through gaps
256  auto subch_type_i = _subchannel_mesh.getSubchannelType(ii_ch);
257  auto subch_type_j = _subchannel_mesh.getSubchannelType(jj_ch);
258  Real dist_ij = pitch;
259 
260  if (subch_type_i == EChannelType::EDGE && subch_type_j == EChannelType::EDGE)
261  {
262  dist_ij = pitch;
263  }
264  else if ((subch_type_i == EChannelType::CORNER && subch_type_j == EChannelType::EDGE) ||
265  (subch_type_i == EChannelType::EDGE && subch_type_j == EChannelType::CORNER))
266  {
267  dist_ij = pitch;
268  }
269  else
270  {
271  dist_ij = pitch / std::sqrt(3);
272  }
273 
274  auto Sij = dz * _subchannel_mesh.getGapWidth(i_gap);
275  auto thcon_i = _fp->k_from_p_T((*_P_soln)(node_in_i), (*_T_soln)(node_in_i));
276  auto thcon_j = _fp->k_from_p_T((*_P_soln)(node_in_j), (*_T_soln)(node_in_j));
277  auto shape_factor =
278  0.66 * (pitch / assembly_diameter) *
279  std::pow((_subchannel_mesh.getGapWidth(i_gap) / assembly_diameter), -0.3);
280  if (ii_ch == i_ch)
281  {
282  e_cond += 0.5 * (thcon_i + thcon_j) * Sij * shape_factor *
283  ((*_T_soln)(node_in_j) - (*_T_soln)(node_in_i)) / dist_ij;
284  }
285  else
286  {
287  e_cond += -0.5 * (thcon_i + thcon_j) * Sij * shape_factor *
288  ((*_T_soln)(node_in_j) - (*_T_soln)(node_in_i)) / dist_ij;
289  }
290  }
291 
292  // compute the axial heat conduction between current and lower axial node
293  auto * node_in_i = _subchannel_mesh.getChannelNode(i_ch, iz);
294  auto * node_in_j = _subchannel_mesh.getChannelNode(i_ch, iz - 1);
295  auto thcon_i = _fp->k_from_p_T((*_P_soln)(node_in_i), (*_T_soln)(node_in_i));
296  auto thcon_j = _fp->k_from_p_T((*_P_soln)(node_in_j), (*_T_soln)(node_in_j));
297  auto Si = (*_S_flow_soln)(node_in_i);
298  auto dist_ij = z_grid[iz] - z_grid[iz - 1];
299 
300  e_cond += 0.5 * (thcon_i + thcon_j) * Si * ((*_T_soln)(node_in_j) - (*_T_soln)(node_in_i)) /
301  dist_ij;
302 
303  unsigned int nz = _subchannel_mesh.getNumOfAxialCells();
304  // compute the axial heat conduction between current and upper axial node
305  if (iz < nz)
306  {
307 
308  auto * node_in_i = _subchannel_mesh.getChannelNode(i_ch, iz);
309  auto * node_in_j = _subchannel_mesh.getChannelNode(i_ch, iz + 1);
310  auto thcon_i = _fp->k_from_p_T((*_P_soln)(node_in_i), (*_T_soln)(node_in_i));
311  auto thcon_j = _fp->k_from_p_T((*_P_soln)(node_in_j), (*_T_soln)(node_in_j));
312  auto Si = (*_S_flow_soln)(node_in_i);
313  auto dist_ij = z_grid[iz + 1] - z_grid[iz];
314  e_cond += 0.5 * (thcon_i + thcon_j) * Si * ((*_T_soln)(node_in_j) - (*_T_soln)(node_in_i)) /
315  dist_ij;
316  }
317 
318  // end of radial heat conduction calc.
319 
320  h_out =
321  (mdot_in * h_in - sumWijh - sumWijPrimeDhij + added_enthalpy + e_cond + sweep_enthalpy +
322  _TR * _rho_soln->old(node_out) * _h_soln->old(node_out) * volume / _dt) /
323  (mdot_out + _TR * (*_rho_soln)(node_out)*volume / _dt);
324 
325  if (h_out < 0)
326  {
327  mooseWarning(name(),
328  " : Calculation of negative Enthalpy h_out = : ",
329  h_out,
330  " Axial Level= : ",
331  iz);
332  }
333  _h_soln->set(node_out, h_out); // J/kg
334  }
335  }
336 }
Real _TR
Flag that activates or deactivates the transient parts of the equations we solve by multiplication...
std::unique_ptr< SolutionHandle > _P_soln
virtual const unsigned int & getNumOfAxialCells() const
Return the number of axial cells.
virtual const Real & getSideX() const
Return side lengths of the assembly.
virtual const Real & getHeatedLength() const
Return heated length.
virtual const std::pair< unsigned int, unsigned int > & getGapChannels(unsigned int i_gap) const =0
Return a pair of inter-wrapper indices for a given gap index.
virtual const Real & getHeatedLengthEntry() const
Return unheated length at entry.
const TriInterWrapperMesh & _tri_sch_mesh
const Real & _P_out
Outlet Pressure.
std::unique_ptr< SolutionHandle > _rho_soln
const SinglePhaseFluidProperties * _fp
Solutions handles and link to TH tables properties.
virtual const std::string & name() const
void mooseWarning(Args &&... args) const
std::unique_ptr< SolutionHandle > _T_soln
static const std::string pitch
virtual const std::pair< unsigned int, unsigned int > & getSweepFlowChans(unsigned int i_chan) const
const InterWrapperMesh & _subchannel_mesh
Real volume(const MeshBase &mesh, unsigned int dim=libMesh::invalid_uint)
virtual Node * getChannelNode(unsigned int i_chan, unsigned iz) const =0
Get the inter-wrapper mesh node for a given channel index and elevation index.
virtual Real getGapWidth(unsigned int gap_index) const =0
Return gap width for a given gap index.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
std::unique_ptr< SolutionHandle > _q_prime_soln
virtual const std::vector< Real > & getZGrid() const
Get axial location of layers.
void mooseError(Args &&... args) const
std::unique_ptr< SolutionHandle > _h_soln
libMesh::DenseMatrix< Real > & _Wij
libMesh::DenseMatrix< Real > _WijPrime
MooseUnits pow(const MooseUnits &, int)
virtual const Real & getPitch() const
Return the pitch between 2 inter-wrappers.
virtual EChannelType getSubchannelType(unsigned int index) const =0
Return the type of the inter-wrapper for given inter-wrapper index.
virtual const std::vector< unsigned int > & getChannelGaps(unsigned int i_chan) const =0
Return a vector of gap indices for a given channel index.
const Real pi
virtual const Real & getDuctToPinGap() const
virtual const Real & getCrossflowSign(unsigned int i_chan, unsigned int i_local) const =0
Return a signs for the cross flow given a inter-wrapper index and local neighbor index.

◆ computeInterpolatedValue()

PetscScalar InterWrapper1PhaseProblem::computeInterpolatedValue ( PetscScalar  topValue,
PetscScalar  botValue,
PetscScalar  Peclet = 0.0 
)
protectedvirtualinherited

Definition at line 343 of file InterWrapper1PhaseProblem.C.

Referenced by InterWrapper1PhaseProblem::computeDP(), InterWrapper1PhaseProblem::computeh(), InterWrapper1PhaseProblem::computeP(), and InterWrapper1PhaseProblem::computeWij().

346 {
348  return alpha * botValue + (1.0 - alpha) * topValue;
349 }
auto Peclet(const T1 &volume_fraction, const T2 &cp, const T3 &rho, const T4 &vel, const T5 &D_h, const T6 &k)
Compute Peclet number.
Definition: Numerics.h:152
virtual PetscScalar computeInterpolationCoefficients(PetscScalar Peclet=0.0)
Functions that computes the interpolation scheme given the Peclet number.
static const std::string alpha
Definition: NS.h:134

◆ computeInterpolationCoefficients()

PetscScalar InterWrapper1PhaseProblem::computeInterpolationCoefficients ( PetscScalar  Peclet = 0.0)
protectedvirtualinherited

Functions that computes the interpolation scheme given the Peclet number.

Definition at line 316 of file InterWrapper1PhaseProblem.C.

Referenced by InterWrapper1PhaseProblem::computeDP(), InterWrapper1PhaseProblem::computeh(), InterWrapper1PhaseProblem::computeInterpolatedValue(), InterWrapper1PhaseProblem::computeP(), and InterWrapper1PhaseProblem::computeWij().

317 {
318  if (_interpolation_scheme == "upwind")
319  {
320  return 1.0;
321  }
322  else if (_interpolation_scheme == "downwind")
323  {
324  return 0.0;
325  }
326  else if (_interpolation_scheme == "central_difference")
327  {
328  return 0.5;
329  }
330  else if (_interpolation_scheme == "exponential")
331  {
332  return ((Peclet - 1.0) * std::exp(Peclet) + 1) / (Peclet * (std::exp(Peclet) - 1.) + 1e-10);
333  }
334  else
335  {
336  mooseError(name(),
337  ": Interpolation scheme should be a string: upwind, downwind, central_difference, "
338  "exponential");
339  }
340 }
virtual const std::string & name() const
const MooseEnum _interpolation_scheme
The interpolation method used in constructing the systems.
auto Peclet(const T1 &volume_fraction, const T2 &cp, const T3 &rho, const T4 &vel, const T5 &D_h, const T6 &k)
Compute Peclet number.
Definition: Numerics.h:152
void mooseError(Args &&... args) const

◆ computeMdot()

void InterWrapper1PhaseProblem::computeMdot ( int  iblock)
protectedvirtualinherited

Computes mass flow per channel for block iblock.

Definition at line 566 of file InterWrapper1PhaseProblem.C.

Referenced by InterWrapper1PhaseProblem::implicitPetscSolve(), and InterWrapper1PhaseProblem::residualFunction().

567 {
568  unsigned int last_node = (iblock + 1) * _block_size;
569  unsigned int first_node = iblock * _block_size + 1;
570  if (!_implicit_bool)
571  {
572  for (unsigned int iz = first_node; iz < last_node + 1; iz++)
573  {
574  auto dz = _z_grid[iz] - _z_grid[iz - 1];
575  for (unsigned int i_ch = 0; i_ch < _n_channels; i_ch++)
576  {
577  auto * node_in = _subchannel_mesh.getChannelNode(i_ch, iz - 1);
578  auto * node_out = _subchannel_mesh.getChannelNode(i_ch, iz);
579  auto volume = dz * (*_S_flow_soln)(node_in);
580  auto time_term = _TR * ((*_rho_soln)(node_out)-_rho_soln->old(node_out)) * volume / _dt;
581  // Wij positive out of i into j;
582  auto mdot_out = (*_mdot_soln)(node_in) - (*_SumWij_soln)(node_out)-time_term;
583  if (mdot_out < 0)
584  {
585  _console << "Wij = : " << _Wij << "\n";
586  mooseError(name(),
587  " : Calculation of negative mass flow mdot_out = : ",
588  mdot_out,
589  " Axial Level= : ",
590  iz,
591  " - Implicit solves are required for recirculating flow.");
592  }
593  _mdot_soln->set(node_out, mdot_out); // kg/sec
594  }
595  }
596  }
597  else
598  {
599  for (unsigned int iz = first_node; iz < last_node + 1; iz++)
600  {
601  auto dz = _z_grid[iz] - _z_grid[iz - 1];
602  auto iz_ind = iz - first_node;
603  for (unsigned int i_ch = 0; i_ch < _n_channels; i_ch++)
604  {
605  auto * node_in = _subchannel_mesh.getChannelNode(i_ch, iz - 1);
606  auto * node_out = _subchannel_mesh.getChannelNode(i_ch, iz);
607  auto volume = dz * (*_S_flow_soln)(node_in);
608 
609  // Adding time derivative to the RHS
610  auto time_term = _TR * ((*_rho_soln)(node_out)-_rho_soln->old(node_out)) * volume / _dt;
611  PetscInt row_vec = i_ch + _n_channels * iz_ind;
612  PetscScalar value_vec = -1.0 * time_term;
613  LibmeshPetscCall(
614  VecSetValues(_mc_axial_convection_rhs, 1, &row_vec, &value_vec, INSERT_VALUES));
615 
616  // Imposing bottom boundary condition or adding of diagonal elements
617  if (iz == first_node)
618  {
619  PetscScalar value_vec = (*_mdot_soln)(node_in);
620  PetscInt row_vec = i_ch + _n_channels * iz_ind;
621  LibmeshPetscCall(
622  VecSetValues(_mc_axial_convection_rhs, 1, &row_vec, &value_vec, ADD_VALUES));
623  }
624  else
625  {
626  PetscInt row = i_ch + _n_channels * iz_ind;
627  PetscInt col = i_ch + _n_channels * (iz_ind - 1);
628  PetscScalar value = -1.0;
629  LibmeshPetscCall(
630  MatSetValues(_mc_axial_convection_mat, 1, &row, 1, &col, &value, INSERT_VALUES));
631  }
632 
633  // Adding diagonal elements
634  PetscInt row = i_ch + _n_channels * iz_ind;
635  PetscInt col = i_ch + _n_channels * iz_ind;
636  PetscScalar value = 1.0;
637  LibmeshPetscCall(
638  MatSetValues(_mc_axial_convection_mat, 1, &row, 1, &col, &value, INSERT_VALUES));
639 
640  // Adding cross flows RHS
641  if (_segregated_bool)
642  {
643  PetscScalar value_vec_2 = -1.0 * (*_SumWij_soln)(node_out);
644  PetscInt row_vec_2 = i_ch + _n_channels * iz_ind;
645  LibmeshPetscCall(
646  VecSetValues(_mc_axial_convection_rhs, 1, &row_vec_2, &value_vec_2, ADD_VALUES));
647  }
648  }
649  }
650  LibmeshPetscCall(MatAssemblyBegin(_mc_axial_convection_mat, MAT_FINAL_ASSEMBLY));
651  LibmeshPetscCall(MatAssemblyEnd(_mc_axial_convection_mat, MAT_FINAL_ASSEMBLY));
652  _console << "Block: " << iblock << " - Mass conservation matrix assembled" << std::endl;
653 
654  if (_segregated_bool)
655  {
656  KSP ksploc;
657  PC pc;
658  Vec sol;
659  LibmeshPetscCall(VecDuplicate(_mc_axial_convection_rhs, &sol));
660  LibmeshPetscCall(KSPCreate(PETSC_COMM_WORLD, &ksploc));
661  LibmeshPetscCall(KSPSetOperators(ksploc, _mc_axial_convection_mat, _mc_axial_convection_mat));
662  LibmeshPetscCall(KSPGetPC(ksploc, &pc));
663  LibmeshPetscCall(PCSetType(pc, PCJACOBI));
664  LibmeshPetscCall(KSPSetTolerances(ksploc, _rtol, _atol, _dtol, _maxit));
665  LibmeshPetscCall(KSPSetFromOptions(ksploc));
666  LibmeshPetscCall(KSPSolve(ksploc, _mc_axial_convection_rhs, sol));
667  LibmeshPetscCall(populateSolutionChan<SolutionHandle>(
668  sol, *_mdot_soln, first_node, last_node, _n_channels));
669  LibmeshPetscCall(VecZeroEntries(_mc_axial_convection_rhs));
670  LibmeshPetscCall(KSPDestroy(&ksploc));
671  LibmeshPetscCall(VecDestroy(&sol));
672  }
673  }
674 }
const bool _segregated_bool
Segregated solve.
Real _TR
Flag that activates or deactivates the transient parts of the equations we solve by multiplication...
const bool _implicit_bool
Flag to define the usage of a implicit or explicit solution.
std::unique_ptr< SolutionHandle > _SumWij_soln
const PetscReal & _dtol
The divergence tolerance for the ksp linear solver.
std::unique_ptr< SolutionHandle > _rho_soln
const PetscReal & _rtol
The relative convergence tolerance, (relative decrease) for the ksp linear solver.
Mat _mc_axial_convection_mat
Mass conservation - axial convection.
std::unique_ptr< SolutionHandle > _mdot_soln
virtual const std::string & name() const
const PetscInt & _maxit
The maximum number of iterations to use for the ksp linear solver.
std::vector< Real > _z_grid
axial location of nodes
Real value(unsigned n, unsigned alpha, unsigned beta, Real x)
const InterWrapperMesh & _subchannel_mesh
Real volume(const MeshBase &mesh, unsigned int dim=libMesh::invalid_uint)
virtual Node * getChannelNode(unsigned int i_chan, unsigned iz) const =0
Get the inter-wrapper mesh node for a given channel index and elevation index.
void mooseError(Args &&... args) const
const ConsoleStream _console
libMesh::DenseMatrix< Real > & _Wij
const PetscReal & _atol
The absolute convergence tolerance for the ksp linear solver.

◆ computeMu()

void InterWrapper1PhaseProblem::computeMu ( int  iblock)
protectedvirtualinherited

Computes Viscosity per channel for block iblock.

Definition at line 1937 of file InterWrapper1PhaseProblem.C.

Referenced by InterWrapper1PhaseProblem::externalSolve(), and externalSolve().

1938 {
1939  unsigned int last_node = (iblock + 1) * _block_size;
1940  unsigned int first_node = iblock * _block_size + 1;
1941 
1942  if (iblock == 0)
1943  {
1944  for (unsigned int i_ch = 0; i_ch < _n_channels; i_ch++)
1945  {
1946  auto * node = _subchannel_mesh.getChannelNode(i_ch, 0);
1947  _mu_soln->set(node, _fp->mu_from_p_T((*_P_soln)(node) + _P_out, (*_T_soln)(node)));
1948  }
1949  }
1950 
1951  for (unsigned int iz = first_node; iz < last_node + 1; iz++)
1952  {
1953  for (unsigned int i_ch = 0; i_ch < _n_channels; i_ch++)
1954  {
1955  auto * node = _subchannel_mesh.getChannelNode(i_ch, iz);
1956  _mu_soln->set(node, _fp->mu_from_p_T((*_P_soln)(node) + _P_out, (*_T_soln)(node)));
1957  }
1958  }
1959 }
std::unique_ptr< SolutionHandle > _P_soln
const Real & _P_out
Outlet Pressure.
const SinglePhaseFluidProperties * _fp
Solutions handles and link to TH tables properties.
std::unique_ptr< SolutionHandle > _T_soln
const InterWrapperMesh & _subchannel_mesh
std::unique_ptr< SolutionHandle > _mu_soln
virtual Node * getChannelNode(unsigned int i_chan, unsigned iz) const =0
Get the inter-wrapper mesh node for a given channel index and elevation index.

◆ computeP()

void InterWrapper1PhaseProblem::computeP ( int  iblock)
protectedvirtualinherited

Computes Pressure per channel for block iblock.

Definition at line 1242 of file InterWrapper1PhaseProblem.C.

Referenced by InterWrapper1PhaseProblem::implicitPetscSolve(), and InterWrapper1PhaseProblem::residualFunction().

1243 {
1244  unsigned int last_node = (iblock + 1) * _block_size;
1245  unsigned int first_node = iblock * _block_size + 1;
1246  if (!_implicit_bool)
1247  {
1249  {
1250  for (unsigned int iz = last_node; iz > first_node - 1; iz--)
1251  {
1252  // Calculate pressure in the inlet of the cell assuming known outlet
1253  for (unsigned int i_ch = 0; i_ch < _n_channels; i_ch++)
1254  {
1255  auto * node_out = _subchannel_mesh.getChannelNode(i_ch, iz);
1256  auto * node_in = _subchannel_mesh.getChannelNode(i_ch, iz - 1);
1257  // update Pressure solution
1258  _P_soln->set(node_in, (*_P_soln)(node_out) + (*_DP_soln)(node_out));
1259  }
1260  }
1261  }
1262  else
1263  {
1264  for (unsigned int iz = last_node; iz > first_node - 1; iz--)
1265  {
1266  // Calculate pressure in the inlet of the cell assuming known outlet
1267  for (unsigned int i_ch = 0; i_ch < _n_channels; i_ch++)
1268  {
1269  auto * node_out = _subchannel_mesh.getChannelNode(i_ch, iz);
1270  auto * node_in = _subchannel_mesh.getChannelNode(i_ch, iz - 1);
1271  // update Pressure solution
1272  // Note: assuming uniform axial discretization in the curren code
1273  // We will need to update this later if we allow non-uniform refinements in the axial
1274  // direction
1275  PetscScalar Pe = 0.5;
1277  if (iz == last_node)
1278  {
1279  _P_soln->set(node_in, (*_P_soln)(node_out) + (*_DP_soln)(node_out) / 2.0);
1280  }
1281  else
1282  {
1283  _P_soln->set(node_in,
1284  (*_P_soln)(node_out) + (1.0 - alpha) * (*_DP_soln)(node_out) +
1285  alpha * (*_DP_soln)(node_in));
1286  }
1287  }
1288  }
1289  }
1290  }
1291  else
1292  {
1294  {
1295  LibmeshPetscCall(VecZeroEntries(_amc_pressure_force_rhs));
1296  for (unsigned int iz = last_node; iz > first_node - 1; iz--)
1297  {
1298  auto iz_ind = iz - first_node;
1299  // Calculate pressure in the inlet of the cell assuming known outlet
1300  for (unsigned int i_ch = 0; i_ch < _n_channels; i_ch++)
1301  {
1302  auto * node_out = _subchannel_mesh.getChannelNode(i_ch, iz);
1303  auto * node_in = _subchannel_mesh.getChannelNode(i_ch, iz - 1);
1304 
1305  // inlet, outlet, and interpolated axial surface area
1306  auto S_in = (*_S_flow_soln)(node_in);
1307  auto S_out = (*_S_flow_soln)(node_out);
1308  auto S_interp = computeInterpolatedValue(S_out, S_in);
1309 
1310  // Creating matrix of coefficients and RHS vector
1311  PetscInt row = i_ch + _n_channels * iz_ind;
1312  PetscInt col = i_ch + _n_channels * iz_ind;
1313  PetscScalar value = -1.0 * S_interp;
1314  LibmeshPetscCall(
1315  MatSetValues(_amc_pressure_force_mat, 1, &row, 1, &col, &value, INSERT_VALUES));
1316 
1317  if (iz == last_node)
1318  {
1319  PetscScalar value = -1.0 * (*_P_soln)(node_out)*S_interp;
1320  PetscInt row = i_ch + _n_channels * iz_ind;
1321  LibmeshPetscCall(VecSetValues(_amc_pressure_force_rhs, 1, &row, &value, ADD_VALUES));
1322  }
1323  else
1324  {
1325  PetscInt row = i_ch + _n_channels * iz_ind;
1326  PetscInt col = i_ch + _n_channels * (iz_ind + 1);
1327  PetscScalar value = 1.0 * S_interp;
1328  LibmeshPetscCall(
1329  MatSetValues(_amc_pressure_force_mat, 1, &row, 1, &col, &value, INSERT_VALUES));
1330  }
1331 
1332  if (_segregated_bool)
1333  {
1334  auto dp_out = (*_DP_soln)(node_out);
1335  PetscScalar value_v = -1.0 * dp_out * S_interp;
1336  PetscInt row_v = i_ch + _n_channels * iz_ind;
1337  LibmeshPetscCall(
1338  VecSetValues(_amc_pressure_force_rhs, 1, &row_v, &value_v, ADD_VALUES));
1339  }
1340  }
1341  }
1342  // Solving pressure problem
1343  LibmeshPetscCall(MatAssemblyBegin(_amc_pressure_force_mat, MAT_FINAL_ASSEMBLY));
1344  LibmeshPetscCall(MatAssemblyEnd(_amc_pressure_force_mat, MAT_FINAL_ASSEMBLY));
1345  if (_segregated_bool)
1346  {
1347  KSP ksploc;
1348  PC pc;
1349  Vec sol;
1350  LibmeshPetscCall(VecDuplicate(_amc_pressure_force_rhs, &sol));
1351  LibmeshPetscCall(KSPCreate(PETSC_COMM_WORLD, &ksploc));
1352  LibmeshPetscCall(KSPSetOperators(ksploc, _amc_pressure_force_mat, _amc_pressure_force_mat));
1353  LibmeshPetscCall(KSPGetPC(ksploc, &pc));
1354  LibmeshPetscCall(PCSetType(pc, PCJACOBI));
1355  LibmeshPetscCall(KSPSetTolerances(ksploc, _rtol, _atol, _dtol, _maxit));
1356  LibmeshPetscCall(KSPSetFromOptions(ksploc));
1357  LibmeshPetscCall(KSPSolve(ksploc, _amc_pressure_force_rhs, sol));
1358  PetscScalar * xx;
1359  LibmeshPetscCall(VecGetArray(sol, &xx));
1360  // update Pressure solution
1361  for (unsigned int iz = last_node; iz > first_node - 1; iz--)
1362  {
1363  auto iz_ind = iz - first_node;
1364  for (unsigned int i_ch = 0; i_ch < _n_channels; i_ch++)
1365  {
1366  auto * node_in = _subchannel_mesh.getChannelNode(i_ch, iz - 1);
1367  PetscScalar value = xx[iz_ind * _n_channels + i_ch];
1368  _P_soln->set(node_in, value);
1369  }
1370  }
1371  LibmeshPetscCall(VecZeroEntries(_amc_pressure_force_rhs));
1372  LibmeshPetscCall(KSPDestroy(&ksploc));
1373  LibmeshPetscCall(VecDestroy(&sol));
1374  }
1375  }
1376  else
1377  {
1378  LibmeshPetscCall(VecZeroEntries(_amc_pressure_force_rhs));
1379  for (unsigned int iz = last_node; iz > first_node - 1; iz--)
1380  {
1381  auto iz_ind = iz - first_node;
1382  // Calculate pressure in the inlet of the cell assuming known outlet
1383  for (unsigned int i_ch = 0; i_ch < _n_channels; i_ch++)
1384  {
1385  auto * node_out = _subchannel_mesh.getChannelNode(i_ch, iz);
1386  auto * node_in = _subchannel_mesh.getChannelNode(i_ch, iz - 1);
1387 
1388  // inlet, outlet, and interpolated axial surface area
1389  auto S_in = (*_S_flow_soln)(node_in);
1390  auto S_out = (*_S_flow_soln)(node_out);
1391  auto S_interp = computeInterpolatedValue(S_out, S_in);
1392 
1393  // Creating matrix of coefficients
1394  PetscInt row = i_ch + _n_channels * iz_ind;
1395  PetscInt col = i_ch + _n_channels * iz_ind;
1396  PetscScalar value = -1.0 * S_interp;
1397  LibmeshPetscCall(
1398  MatSetValues(_amc_pressure_force_mat, 1, &row, 1, &col, &value, INSERT_VALUES));
1399 
1400  if (iz == last_node)
1401  {
1402  PetscScalar value = -1.0 * (*_P_soln)(node_out)*S_interp;
1403  PetscInt row = i_ch + _n_channels * iz_ind;
1404  LibmeshPetscCall(VecSetValues(_amc_pressure_force_rhs, 1, &row, &value, ADD_VALUES));
1405 
1406  auto dp_out = (*_DP_soln)(node_out);
1407  PetscScalar value_v = -1.0 * dp_out / 2.0 * S_interp;
1408  PetscInt row_v = i_ch + _n_channels * iz_ind;
1409  LibmeshPetscCall(
1410  VecSetValues(_amc_pressure_force_rhs, 1, &row_v, &value_v, ADD_VALUES));
1411  }
1412  else
1413  {
1414  PetscInt row = i_ch + _n_channels * iz_ind;
1415  PetscInt col = i_ch + _n_channels * (iz_ind + 1);
1416  PetscScalar value = 1.0 * S_interp;
1417  LibmeshPetscCall(
1418  MatSetValues(_amc_pressure_force_mat, 1, &row, 1, &col, &value, INSERT_VALUES));
1419 
1420  if (_segregated_bool)
1421  {
1422  auto dp_in = (*_DP_soln)(node_in);
1423  auto dp_out = (*_DP_soln)(node_out);
1424  auto dp_interp = computeInterpolatedValue(dp_out, dp_in);
1425  PetscScalar value_v = -1.0 * dp_interp * S_interp;
1426  PetscInt row_v = i_ch + _n_channels * iz_ind;
1427  LibmeshPetscCall(
1428  VecSetValues(_amc_pressure_force_rhs, 1, &row_v, &value_v, ADD_VALUES));
1429  }
1430  }
1431  }
1432  }
1433  // Solving pressure problem
1434  LibmeshPetscCall(MatAssemblyBegin(_amc_pressure_force_mat, MAT_FINAL_ASSEMBLY));
1435  LibmeshPetscCall(MatAssemblyEnd(_amc_pressure_force_mat, MAT_FINAL_ASSEMBLY));
1436  _console << "Block: " << iblock << " - Axial momentum pressure force matrix assembled"
1437  << std::endl;
1438 
1439  if (_segregated_bool)
1440  {
1441  KSP ksploc;
1442  PC pc;
1443  Vec sol;
1444  LibmeshPetscCall(VecDuplicate(_amc_pressure_force_rhs, &sol));
1445  LibmeshPetscCall(KSPCreate(PETSC_COMM_WORLD, &ksploc));
1446  LibmeshPetscCall(KSPSetOperators(ksploc, _amc_pressure_force_mat, _amc_pressure_force_mat));
1447  LibmeshPetscCall(KSPGetPC(ksploc, &pc));
1448  LibmeshPetscCall(PCSetType(pc, PCJACOBI));
1449  LibmeshPetscCall(KSPSetTolerances(ksploc, _rtol, _atol, _dtol, _maxit));
1450  LibmeshPetscCall(KSPSetFromOptions(ksploc));
1451  LibmeshPetscCall(KSPSolve(ksploc, _amc_pressure_force_rhs, sol));
1452  PetscScalar * xx;
1453  LibmeshPetscCall(VecGetArray(sol, &xx));
1454  // update Pressure solution
1455  for (unsigned int iz = last_node; iz > first_node - 1; iz--)
1456  {
1457  auto iz_ind = iz - first_node;
1458  for (unsigned int i_ch = 0; i_ch < _n_channels; i_ch++)
1459  {
1460  auto * node_in = _subchannel_mesh.getChannelNode(i_ch, iz - 1);
1461  PetscScalar value = xx[iz_ind * _n_channels + i_ch];
1462  _P_soln->set(node_in, value);
1463  }
1464  }
1465  LibmeshPetscCall(VecZeroEntries(_amc_pressure_force_rhs));
1466  LibmeshPetscCall(KSPDestroy(&ksploc));
1467  LibmeshPetscCall(VecDestroy(&sol));
1468  }
1469  }
1470  }
1471 }
virtual PetscScalar computeInterpolatedValue(PetscScalar topValue, PetscScalar botValue, PetscScalar Peclet=0.0)
const bool _segregated_bool
Segregated solve.
std::unique_ptr< SolutionHandle > _P_soln
const bool _implicit_bool
Flag to define the usage of a implicit or explicit solution.
const PetscReal & _dtol
The divergence tolerance for the ksp linear solver.
const PetscReal & _rtol
The relative convergence tolerance, (relative decrease) for the ksp linear solver.
const PetscInt & _maxit
The maximum number of iterations to use for the ksp linear solver.
const bool _staggered_pressure_bool
Flag to define the usage of staggered or collocated pressure.
Real value(unsigned n, unsigned alpha, unsigned beta, Real x)
const InterWrapperMesh & _subchannel_mesh
virtual PetscScalar computeInterpolationCoefficients(PetscScalar Peclet=0.0)
Functions that computes the interpolation scheme given the Peclet number.
std::unique_ptr< SolutionHandle > _DP_soln
virtual Node * getChannelNode(unsigned int i_chan, unsigned iz) const =0
Get the inter-wrapper mesh node for a given channel index and elevation index.
static const std::string alpha
Definition: NS.h:134
Mat _amc_pressure_force_mat
Axial momentum conservation - pressure force.
const ConsoleStream _console
const PetscReal & _atol
The absolute convergence tolerance for the ksp linear solver.

◆ computeRho()

void InterWrapper1PhaseProblem::computeRho ( int  iblock)
protectedvirtualinherited

Computes Density per channel for block iblock.

Definition at line 1912 of file InterWrapper1PhaseProblem.C.

Referenced by InterWrapper1PhaseProblem::externalSolve(), and externalSolve().

1913 {
1914  unsigned int last_node = (iblock + 1) * _block_size;
1915  unsigned int first_node = iblock * _block_size + 1;
1916 
1917  if (iblock == 0)
1918  {
1919  for (unsigned int i_ch = 0; i_ch < _n_channels; i_ch++)
1920  {
1921  auto * node = _subchannel_mesh.getChannelNode(i_ch, 0);
1922  _rho_soln->set(node, _fp->rho_from_p_T((*_P_soln)(node) + _P_out, (*_T_soln)(node)));
1923  }
1924  }
1925 
1926  for (unsigned int iz = first_node; iz < last_node + 1; iz++)
1927  {
1928  for (unsigned int i_ch = 0; i_ch < _n_channels; i_ch++)
1929  {
1930  auto * node = _subchannel_mesh.getChannelNode(i_ch, iz);
1931  _rho_soln->set(node, _fp->rho_from_p_T((*_P_soln)(node) + _P_out, (*_T_soln)(node)));
1932  }
1933  }
1934 }
std::unique_ptr< SolutionHandle > _P_soln
const Real & _P_out
Outlet Pressure.
std::unique_ptr< SolutionHandle > _rho_soln
const SinglePhaseFluidProperties * _fp
Solutions handles and link to TH tables properties.
std::unique_ptr< SolutionHandle > _T_soln
const InterWrapperMesh & _subchannel_mesh
virtual Node * getChannelNode(unsigned int i_chan, unsigned iz) const =0
Get the inter-wrapper mesh node for a given channel index and elevation index.

◆ computeSumWij()

void InterWrapper1PhaseProblem::computeSumWij ( int  iblock)
protectedvirtualinherited

Computes net diversion crossflow per channel for block iblock.

Definition at line 501 of file InterWrapper1PhaseProblem.C.

Referenced by InterWrapper1PhaseProblem::implicitPetscSolve(), and InterWrapper1PhaseProblem::residualFunction().

502 {
503  unsigned int last_node = (iblock + 1) * _block_size;
504  unsigned int first_node = iblock * _block_size + 1;
505  // Add to solution vector if explicit
506  if (!_implicit_bool)
507  {
508  for (unsigned int iz = first_node; iz < last_node + 1; iz++)
509  {
510  for (unsigned int i_ch = 0; i_ch < _n_channels; i_ch++)
511  {
512  auto * node_out = _subchannel_mesh.getChannelNode(i_ch, iz);
513  Real sumWij = 0.0;
514  // Calculate sum of crossflow into channel i from channels j around i
515  unsigned int counter = 0;
516  for (auto i_gap : _subchannel_mesh.getChannelGaps(i_ch))
517  {
518  sumWij += _subchannel_mesh.getCrossflowSign(i_ch, counter) * _Wij(i_gap, iz);
519  counter++;
520  }
521  // The net crossflow coming out of cell i [kg/sec]
522  _SumWij_soln->set(node_out, sumWij);
523  }
524  }
525  }
526  // Add to matrix if implicit
527  else
528  {
529  for (unsigned int iz = first_node; iz < last_node + 1; iz++)
530  {
531  unsigned int iz_ind = iz - first_node;
532  for (unsigned int i_ch = 0; i_ch < _n_channels; i_ch++)
533  {
534  // Calculate sum of crossflow into channel i from channels j around i
535  unsigned int counter = 0;
536  for (auto i_gap : _subchannel_mesh.getChannelGaps(i_ch))
537  {
538  PetscInt row = i_ch + _n_channels * iz_ind;
539  PetscInt col = i_gap + _n_gaps * iz_ind;
540  PetscScalar value = _subchannel_mesh.getCrossflowSign(i_ch, counter);
541  LibmeshPetscCall(MatSetValues(_mc_sumWij_mat, 1, &row, 1, &col, &value, INSERT_VALUES));
542  counter++;
543  }
544  }
545  }
546  LibmeshPetscCall(MatAssemblyBegin(_mc_sumWij_mat, MAT_FINAL_ASSEMBLY));
547  LibmeshPetscCall(MatAssemblyEnd(_mc_sumWij_mat, MAT_FINAL_ASSEMBLY));
548  if (_segregated_bool)
549  {
550  Vec loc_prod;
551  Vec loc_Wij;
552  LibmeshPetscCall(VecDuplicate(_amc_sys_mdot_rhs, &loc_prod));
553  LibmeshPetscCall(VecDuplicate(_Wij_vec, &loc_Wij));
555  loc_Wij, _Wij, first_node, last_node + 1, _n_gaps));
556  LibmeshPetscCall(MatMult(_mc_sumWij_mat, loc_Wij, loc_prod));
557  LibmeshPetscCall(populateSolutionChan<SolutionHandle>(
558  loc_prod, *_SumWij_soln, first_node, last_node, _n_channels));
559  LibmeshPetscCall(VecDestroy(&loc_prod));
560  LibmeshPetscCall(VecDestroy(&loc_Wij));
561  }
562  }
563 }
const bool _segregated_bool
Segregated solve.
const bool _implicit_bool
Flag to define the usage of a implicit or explicit solution.
std::unique_ptr< SolutionHandle > _SumWij_soln
Mat _mc_sumWij_mat
Mass conservation Mass conservation - sum of cross fluxes.
Real value(unsigned n, unsigned alpha, unsigned beta, Real x)
const InterWrapperMesh & _subchannel_mesh
virtual Node * getChannelNode(unsigned int i_chan, unsigned iz) const =0
Get the inter-wrapper mesh node for a given channel index and elevation index.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
PetscErrorCode populateVectorFromDense(Vec &x, const T &solution, const unsigned int first_axial_level, const unsigned int last_axial_level, const unsigned int cross_dimension)
libMesh::DenseMatrix< Real > & _Wij
virtual const std::vector< unsigned int > & getChannelGaps(unsigned int i_chan) const =0
Return a vector of gap indices for a given channel index.
virtual const Real & getCrossflowSign(unsigned int i_chan, unsigned int i_local) const =0
Return a signs for the cross flow given a inter-wrapper index and local neighbor index.

◆ computeT()

void InterWrapper1PhaseProblem::computeT ( int  iblock)
protectedvirtualinherited

Computes Temperature per channel for block iblock.

Definition at line 1896 of file InterWrapper1PhaseProblem.C.

Referenced by InterWrapper1PhaseProblem::externalSolve(), and externalSolve().

1897 {
1898  unsigned int last_node = (iblock + 1) * _block_size;
1899  unsigned int first_node = iblock * _block_size + 1;
1900 
1901  for (unsigned int iz = first_node; iz < last_node + 1; iz++)
1902  {
1903  for (unsigned int i_ch = 0; i_ch < _n_channels; i_ch++)
1904  {
1905  auto * node = _subchannel_mesh.getChannelNode(i_ch, iz);
1906  _T_soln->set(node, _fp->T_from_p_h((*_P_soln)(node) + _P_out, (*_h_soln)(node)));
1907  }
1908  }
1909 }
std::unique_ptr< SolutionHandle > _P_soln
const Real & _P_out
Outlet Pressure.
const SinglePhaseFluidProperties * _fp
Solutions handles and link to TH tables properties.
std::unique_ptr< SolutionHandle > _T_soln
const InterWrapperMesh & _subchannel_mesh
virtual Node * getChannelNode(unsigned int i_chan, unsigned iz) const =0
Get the inter-wrapper mesh node for a given channel index and elevation index.
std::unique_ptr< SolutionHandle > _h_soln

◆ computeWij()

void InterWrapper1PhaseProblem::computeWij ( int  iblock)
protectedvirtualinherited

Computes cross fluxes for block iblock.

Assembling system

Definition at line 1962 of file InterWrapper1PhaseProblem.C.

Referenced by InterWrapper1PhaseProblem::implicitPetscSolve(), and InterWrapper1PhaseProblem::residualFunction().

1963 {
1964  // Cross flow residual
1965  if (!_implicit_bool)
1966  {
1967  unsigned int last_node = (iblock + 1) * _block_size;
1968  unsigned int first_node = iblock * _block_size;
1969 
1970  const Real & pitch = _subchannel_mesh.getPitch();
1971  for (unsigned int iz = first_node + 1; iz < last_node + 1; iz++)
1972  {
1973  auto dz = _z_grid[iz] - _z_grid[iz - 1];
1974  for (unsigned int i_gap = 0; i_gap < _n_gaps; i_gap++)
1975  {
1976  auto chans = _subchannel_mesh.getGapChannels(i_gap);
1977  unsigned int i_ch = chans.first;
1978  unsigned int j_ch = chans.second;
1979  auto * node_in_i = _subchannel_mesh.getChannelNode(i_ch, iz - 1);
1980  auto * node_out_i = _subchannel_mesh.getChannelNode(i_ch, iz);
1981  auto * node_in_j = _subchannel_mesh.getChannelNode(j_ch, iz - 1);
1982  auto * node_out_j = _subchannel_mesh.getChannelNode(j_ch, iz);
1983  auto rho_i = (*_rho_soln)(node_in_i);
1984  auto rho_j = (*_rho_soln)(node_in_j);
1985  auto Si = (*_S_flow_soln)(node_in_i);
1986  auto Sj = (*_S_flow_soln)(node_in_j);
1987  auto Sij = dz * _subchannel_mesh.getGapWidth(i_gap);
1988  auto Lij = pitch;
1989  // total local form loss in the ij direction
1990  auto friction_term = _kij * _Wij(i_gap, iz) * std::abs(_Wij(i_gap, iz));
1991  auto DPij = (*_P_soln)(node_in_i) - (*_P_soln)(node_in_j);
1992  // Figure out donor cell density
1993  auto rho_star = 0.0;
1994  if (_Wij(i_gap, iz) > 0.0)
1995  rho_star = rho_i;
1996  else if (_Wij(i_gap, iz) < 0.0)
1997  rho_star = rho_j;
1998  else
1999  rho_star = (rho_i + rho_j) / 2.0;
2000 
2001  auto mass_term_out =
2002  (*_mdot_soln)(node_out_i) / Si / rho_i + (*_mdot_soln)(node_out_j) / Sj / rho_j;
2003  auto mass_term_in =
2004  (*_mdot_soln)(node_in_i) / Si / rho_i + (*_mdot_soln)(node_in_j) / Sj / rho_j;
2005  auto term_out = Sij * rho_star * (Lij / dz) * mass_term_out * _Wij(i_gap, iz);
2006  auto term_in = Sij * rho_star * (Lij / dz) * mass_term_in * _Wij(i_gap, iz - 1);
2007  auto inertia_term = term_out - term_in;
2008  auto pressure_term = 2 * std::pow(Sij, 2.0) * DPij * rho_star;
2009  auto time_term =
2010  _TR * 2.0 * (_Wij(i_gap, iz) - _Wij_old(i_gap, iz)) * Lij * Sij * rho_star / _dt;
2011 
2012  _Wij_residual_matrix(i_gap, iz - 1 - iblock * _block_size) =
2013  time_term + friction_term + inertia_term - pressure_term;
2014  }
2015  }
2016  }
2017  else
2018  {
2019 
2020  // Initializing to zero the elements of the lateral momentum assembly
2021  LibmeshPetscCall(MatZeroEntries(_cmc_time_derivative_mat));
2022  LibmeshPetscCall(MatZeroEntries(_cmc_advective_derivative_mat));
2023  LibmeshPetscCall(MatZeroEntries(_cmc_friction_force_mat));
2024  LibmeshPetscCall(MatZeroEntries(_cmc_pressure_force_mat));
2025  LibmeshPetscCall(VecZeroEntries(_cmc_time_derivative_rhs));
2026  LibmeshPetscCall(VecZeroEntries(_cmc_advective_derivative_rhs));
2027  LibmeshPetscCall(VecZeroEntries(_cmc_friction_force_rhs));
2028  LibmeshPetscCall(VecZeroEntries(_cmc_pressure_force_rhs));
2029  LibmeshPetscCall(MatZeroEntries(_cmc_sys_Wij_mat));
2030  LibmeshPetscCall(VecZeroEntries(_cmc_sys_Wij_rhs));
2031 
2032  unsigned int last_node = (iblock + 1) * _block_size;
2033  unsigned int first_node = iblock * _block_size;
2034 
2035  const Real & pitch = _subchannel_mesh.getPitch();
2036  for (unsigned int iz = first_node + 1; iz < last_node + 1; iz++)
2037  {
2038  auto dz = _z_grid[iz] - _z_grid[iz - 1];
2039  auto iz_ind = iz - first_node - 1;
2040  for (unsigned int i_gap = 0; i_gap < _n_gaps; i_gap++)
2041  {
2042  auto chans = _subchannel_mesh.getGapChannels(i_gap);
2043  unsigned int i_ch = chans.first;
2044  unsigned int j_ch = chans.second;
2045  auto * node_in_i = _subchannel_mesh.getChannelNode(i_ch, iz - 1);
2046  auto * node_out_i = _subchannel_mesh.getChannelNode(i_ch, iz);
2047  auto * node_in_j = _subchannel_mesh.getChannelNode(j_ch, iz - 1);
2048  auto * node_out_j = _subchannel_mesh.getChannelNode(j_ch, iz);
2049 
2050  // inlet, outlet, and interpolated densities
2051  auto rho_i_in = (*_rho_soln)(node_in_i);
2052  auto rho_i_out = (*_rho_soln)(node_out_i);
2053  auto rho_i_interp = computeInterpolatedValue(rho_i_out, rho_i_in);
2054  auto rho_j_in = (*_rho_soln)(node_in_j);
2055  auto rho_j_out = (*_rho_soln)(node_out_j);
2056  auto rho_j_interp = computeInterpolatedValue(rho_j_out, rho_j_in);
2057 
2058  // inlet, outlet, and interpolated areas
2059  auto S_i_in = (*_S_flow_soln)(node_in_i);
2060  auto S_i_out = (*_S_flow_soln)(node_out_i);
2061  auto S_j_in = (*_S_flow_soln)(node_in_j);
2062  auto S_j_out = (*_S_flow_soln)(node_out_j);
2063 
2064  // Cross-sectional gap area
2065  auto Sij = dz * _subchannel_mesh.getGapWidth(i_gap);
2066  auto Lij = pitch;
2067 
2068  // Figure out donor cell density
2069  auto rho_star = 0.0;
2070  if (_Wij(i_gap, iz) > 0.0)
2071  rho_star = rho_i_interp;
2072  else if (_Wij(i_gap, iz) < 0.0)
2073  rho_star = rho_j_interp;
2074  else
2075  rho_star = (rho_i_interp + rho_j_interp) / 2.0;
2076 
2077  // Assembling time derivative
2078  PetscScalar time_factor = _TR * Lij * Sij * rho_star / _dt;
2079  PetscInt row_td = i_gap + _n_gaps * iz_ind;
2080  PetscInt col_td = i_gap + _n_gaps * iz_ind;
2081  PetscScalar value_td = time_factor;
2082  LibmeshPetscCall(MatSetValues(
2083  _cmc_time_derivative_mat, 1, &row_td, 1, &col_td, &value_td, INSERT_VALUES));
2084  PetscScalar value_td_rhs = time_factor * _Wij_old(i_gap, iz);
2085  LibmeshPetscCall(
2086  VecSetValues(_cmc_time_derivative_rhs, 1, &row_td, &value_td_rhs, INSERT_VALUES));
2087 
2088  // Assembling inertial term
2089  auto alpha = 0.0; // hard code downwind;
2090  auto mass_term_out = (*_mdot_soln)(node_out_i) / S_i_out / rho_i_out +
2091  (*_mdot_soln)(node_out_j) / S_j_out / rho_j_out;
2092  auto mass_term_in = (*_mdot_soln)(node_in_i) / S_i_in / rho_i_in +
2093  (*_mdot_soln)(node_in_j) / S_j_in / rho_j_in;
2094  auto term_out = Sij * rho_star * (Lij / dz) * mass_term_out / 2.0;
2095  auto term_in = Sij * rho_star * (Lij / dz) * mass_term_in / 2.0;
2096  if (iz == first_node + 1)
2097  {
2098  PetscInt row_ad = i_gap + _n_gaps * iz_ind;
2099  PetscScalar value_ad = term_in * alpha * _Wij(i_gap, iz - 1);
2100  LibmeshPetscCall(
2101  VecSetValues(_cmc_advective_derivative_rhs, 1, &row_ad, &value_ad, ADD_VALUES));
2102 
2103  PetscInt col_ad = i_gap + _n_gaps * iz_ind;
2104  value_ad = -1.0 * term_in * (1.0 - alpha) + term_out * alpha;
2105  LibmeshPetscCall(MatSetValues(
2106  _cmc_advective_derivative_mat, 1, &row_ad, 1, &col_ad, &value_ad, INSERT_VALUES));
2107 
2108  col_ad = i_gap + _n_gaps * (iz_ind + 1);
2109  value_ad = term_out * (1.0 - alpha);
2110  LibmeshPetscCall(MatSetValues(
2111  _cmc_advective_derivative_mat, 1, &row_ad, 1, &col_ad, &value_ad, INSERT_VALUES));
2112  }
2113  else if (iz == last_node)
2114  {
2115  PetscInt row_ad = i_gap + _n_gaps * iz_ind;
2116  PetscInt col_ad = i_gap + _n_gaps * (iz_ind - 1);
2117  PetscScalar value_ad = -1.0 * term_in * alpha;
2118  LibmeshPetscCall(MatSetValues(
2119  _cmc_advective_derivative_mat, 1, &row_ad, 1, &col_ad, &value_ad, INSERT_VALUES));
2120 
2121  col_ad = i_gap + _n_gaps * iz_ind;
2122  value_ad = -1.0 * term_in * (1.0 - alpha) + term_out * alpha;
2123  LibmeshPetscCall(MatSetValues(
2124  _cmc_advective_derivative_mat, 1, &row_ad, 1, &col_ad, &value_ad, INSERT_VALUES));
2125 
2126  value_ad = -1.0 * term_out * (1.0 - alpha) * _Wij(i_gap, iz);
2127  LibmeshPetscCall(
2128  VecSetValues(_cmc_advective_derivative_rhs, 1, &row_ad, &value_ad, ADD_VALUES));
2129  }
2130  else
2131  {
2132  PetscInt row_ad = i_gap + _n_gaps * iz_ind;
2133  PetscInt col_ad = i_gap + _n_gaps * (iz_ind - 1);
2134  PetscScalar value_ad = -1.0 * term_in * alpha;
2135  LibmeshPetscCall(MatSetValues(
2136  _cmc_advective_derivative_mat, 1, &row_ad, 1, &col_ad, &value_ad, INSERT_VALUES));
2137 
2138  col_ad = i_gap + _n_gaps * iz_ind;
2139  value_ad = -1.0 * term_in * (1.0 - alpha) + term_out * alpha;
2140  LibmeshPetscCall(MatSetValues(
2141  _cmc_advective_derivative_mat, 1, &row_ad, 1, &col_ad, &value_ad, INSERT_VALUES));
2142 
2143  col_ad = i_gap + _n_gaps * (iz_ind + 1);
2144  value_ad = term_out * (1.0 - alpha);
2145  LibmeshPetscCall(MatSetValues(
2146  _cmc_advective_derivative_mat, 1, &row_ad, 1, &col_ad, &value_ad, INSERT_VALUES));
2147  }
2148  // Assembling friction force
2149  PetscInt row_ff = i_gap + _n_gaps * iz_ind;
2150  PetscInt col_ff = i_gap + _n_gaps * iz_ind;
2151  PetscScalar value_ff = _kij * std::abs(_Wij(i_gap, iz)) / 2.0;
2152  LibmeshPetscCall(MatSetValues(
2153  _cmc_friction_force_mat, 1, &row_ff, 1, &col_ff, &value_ff, INSERT_VALUES));
2154 
2155  // Assembling pressure force
2157 
2159  {
2160  PetscScalar pressure_factor = std::pow(Sij, 2.0) * rho_star;
2161  PetscInt row_pf = i_gap + _n_gaps * iz_ind;
2162  PetscInt col_pf = i_ch + _n_channels * iz_ind;
2163  PetscScalar value_pf = -1.0 * alpha * pressure_factor;
2164  LibmeshPetscCall(
2165  MatSetValues(_cmc_pressure_force_mat, 1, &row_pf, 1, &col_pf, &value_pf, ADD_VALUES));
2166  col_pf = j_ch + _n_channels * iz_ind;
2167  value_pf = alpha * pressure_factor;
2168  LibmeshPetscCall(
2169  MatSetValues(_cmc_pressure_force_mat, 1, &row_pf, 1, &col_pf, &value_pf, ADD_VALUES));
2170 
2171  if (iz == last_node)
2172  {
2173  PetscInt row_pf = i_gap + _n_gaps * iz_ind;
2174  PetscScalar value_pf = (1.0 - alpha) * pressure_factor * (*_P_soln)(node_out_i);
2175  LibmeshPetscCall(
2176  VecSetValues(_cmc_pressure_force_rhs, 1, &row_pf, &value_pf, ADD_VALUES));
2177  value_pf = -1.0 * (1.0 - alpha) * pressure_factor * (*_P_soln)(node_out_j);
2178  LibmeshPetscCall(
2179  VecSetValues(_cmc_pressure_force_rhs, 1, &row_pf, &value_pf, ADD_VALUES));
2180  }
2181  else
2182  {
2183  row_pf = i_gap + _n_gaps * iz_ind;
2184  col_pf = i_ch + _n_channels * (iz_ind + 1);
2185  value_pf = -1.0 * (1.0 - alpha) * pressure_factor;
2186  LibmeshPetscCall(MatSetValues(
2187  _cmc_pressure_force_mat, 1, &row_pf, 1, &col_pf, &value_pf, ADD_VALUES));
2188  col_pf = j_ch + _n_channels * (iz_ind + 1);
2189  value_pf = (1.0 - alpha) * pressure_factor;
2190  LibmeshPetscCall(MatSetValues(
2191  _cmc_pressure_force_mat, 1, &row_pf, 1, &col_pf, &value_pf, ADD_VALUES));
2192  }
2193  }
2194  else
2195  {
2196  PetscScalar pressure_factor = std::pow(Sij, 2.0) * rho_star;
2197  PetscInt row_pf = i_gap + _n_gaps * iz_ind;
2198  PetscInt col_pf = i_ch + _n_channels * iz_ind;
2199  PetscScalar value_pf = -1.0 * pressure_factor;
2200  LibmeshPetscCall(
2201  MatSetValues(_cmc_pressure_force_mat, 1, &row_pf, 1, &col_pf, &value_pf, ADD_VALUES));
2202  col_pf = j_ch + _n_channels * iz_ind;
2203  value_pf = pressure_factor;
2204  LibmeshPetscCall(
2205  MatSetValues(_cmc_pressure_force_mat, 1, &row_pf, 1, &col_pf, &value_pf, ADD_VALUES));
2206  }
2207  }
2208  }
2210  LibmeshPetscCall(MatZeroEntries(_cmc_sys_Wij_mat));
2211  LibmeshPetscCall(VecZeroEntries(_cmc_sys_Wij_rhs));
2212  LibmeshPetscCall(MatAssemblyBegin(_cmc_time_derivative_mat, MAT_FINAL_ASSEMBLY));
2213  LibmeshPetscCall(MatAssemblyEnd(_cmc_time_derivative_mat, MAT_FINAL_ASSEMBLY));
2214  LibmeshPetscCall(MatAssemblyBegin(_cmc_advective_derivative_mat, MAT_FINAL_ASSEMBLY));
2215  LibmeshPetscCall(MatAssemblyEnd(_cmc_advective_derivative_mat, MAT_FINAL_ASSEMBLY));
2216  LibmeshPetscCall(MatAssemblyBegin(_cmc_friction_force_mat, MAT_FINAL_ASSEMBLY));
2217  LibmeshPetscCall(MatAssemblyEnd(_cmc_friction_force_mat, MAT_FINAL_ASSEMBLY));
2218  LibmeshPetscCall(MatAssemblyBegin(_cmc_pressure_force_mat, MAT_FINAL_ASSEMBLY));
2219  LibmeshPetscCall(MatAssemblyEnd(_cmc_pressure_force_mat, MAT_FINAL_ASSEMBLY));
2220  LibmeshPetscCall(MatAssemblyBegin(_cmc_sys_Wij_mat, MAT_FINAL_ASSEMBLY));
2221  LibmeshPetscCall(MatAssemblyEnd(_cmc_sys_Wij_mat, MAT_FINAL_ASSEMBLY));
2222  // Matrix
2223 #if !PETSC_VERSION_LESS_THAN(3, 15, 0)
2224  LibmeshPetscCall(
2225  MatAXPY(_cmc_sys_Wij_mat, 1.0, _cmc_time_derivative_mat, UNKNOWN_NONZERO_PATTERN));
2226  LibmeshPetscCall(MatAssemblyBegin(_cmc_sys_Wij_mat, MAT_FINAL_ASSEMBLY));
2227  LibmeshPetscCall(MatAssemblyEnd(_cmc_sys_Wij_mat, MAT_FINAL_ASSEMBLY));
2228  LibmeshPetscCall(
2229  MatAXPY(_cmc_sys_Wij_mat, 1.0, _cmc_advective_derivative_mat, UNKNOWN_NONZERO_PATTERN));
2230  LibmeshPetscCall(MatAssemblyBegin(_cmc_sys_Wij_mat, MAT_FINAL_ASSEMBLY));
2231  LibmeshPetscCall(MatAssemblyEnd(_cmc_sys_Wij_mat, MAT_FINAL_ASSEMBLY));
2232  LibmeshPetscCall(
2233  MatAXPY(_cmc_sys_Wij_mat, 1.0, _cmc_friction_force_mat, UNKNOWN_NONZERO_PATTERN));
2234 #else
2235  LibmeshPetscCall(
2236  MatAXPY(_cmc_sys_Wij_mat, 1.0, _cmc_time_derivative_mat, DIFFERENT_NONZERO_PATTERN));
2237  LibmeshPetscCall(MatAssemblyBegin(_cmc_sys_Wij_mat, MAT_FINAL_ASSEMBLY));
2238  LibmeshPetscCall(MatAssemblyEnd(_cmc_sys_Wij_mat, MAT_FINAL_ASSEMBLY));
2239  LibmeshPetscCall(
2240  MatAXPY(_cmc_sys_Wij_mat, 1.0, _cmc_advective_derivative_mat, DIFFERENT_NONZERO_PATTERN));
2241  LibmeshPetscCall(MatAssemblyBegin(_cmc_sys_Wij_mat, MAT_FINAL_ASSEMBLY));
2242  LibmeshPetscCall(MatAssemblyEnd(_cmc_sys_Wij_mat, MAT_FINAL_ASSEMBLY));
2243  LibmeshPetscCall(
2244  MatAXPY(_cmc_sys_Wij_mat, 1.0, _cmc_friction_force_mat, DIFFERENT_NONZERO_PATTERN));
2245 #endif
2246  LibmeshPetscCall(MatAssemblyBegin(_cmc_sys_Wij_mat, MAT_FINAL_ASSEMBLY));
2247  LibmeshPetscCall(MatAssemblyEnd(_cmc_sys_Wij_mat, MAT_FINAL_ASSEMBLY));
2248  _console << "Block: " << iblock << " - Cross flow system matrix assembled" << std::endl;
2249  _console << "Block: " << iblock << " - Cross flow pressure force matrix assembled" << std::endl;
2250  // RHS
2251  LibmeshPetscCall(VecAXPY(_cmc_sys_Wij_rhs, 1.0, _cmc_time_derivative_rhs));
2252  LibmeshPetscCall(VecAXPY(_cmc_sys_Wij_rhs, 1.0, _cmc_advective_derivative_rhs));
2253  LibmeshPetscCall(VecAXPY(_cmc_sys_Wij_rhs, 1.0, _cmc_friction_force_rhs));
2254 
2255  if (_segregated_bool)
2256  {
2257  // Assembly the matrix system
2258  Vec sol_holder_P;
2259  LibmeshPetscCall(createPetscVector(sol_holder_P, _block_size * _n_gaps));
2260  Vec sol_holder_W;
2261  LibmeshPetscCall(createPetscVector(sol_holder_W, _block_size * _n_gaps));
2262  Vec loc_holder_Wij;
2263  LibmeshPetscCall(createPetscVector(loc_holder_Wij, _block_size * _n_gaps));
2264  LibmeshPetscCall(populateVectorFromHandle<SolutionHandle>(
2265  _prodp, *_P_soln, iblock * _block_size, (iblock + 1) * _block_size - 1, _n_channels));
2267  loc_holder_Wij, _Wij, first_node, last_node, _n_gaps));
2268  LibmeshPetscCall(MatMult(_cmc_sys_Wij_mat, _Wij_vec, sol_holder_W));
2269  LibmeshPetscCall(VecAXPY(sol_holder_W, -1.0, _cmc_sys_Wij_rhs));
2270  LibmeshPetscCall(MatMult(_cmc_pressure_force_mat, _prodp, sol_holder_P));
2271  LibmeshPetscCall(VecAXPY(sol_holder_P, -1.0, _cmc_pressure_force_rhs));
2272  LibmeshPetscCall(VecAXPY(sol_holder_W, 1.0, sol_holder_P));
2273  PetscScalar * xx;
2274  LibmeshPetscCall(VecGetArray(sol_holder_W, &xx));
2275  for (unsigned int iz = first_node + 1; iz < last_node + 1; iz++)
2276  {
2277  auto iz_ind = iz - first_node - 1;
2278  for (unsigned int i_gap = 0; i_gap < _n_gaps; i_gap++)
2279  {
2280  _Wij_residual_matrix(i_gap, iz - 1 - iblock * _block_size) = xx[iz_ind * _n_gaps + i_gap];
2281  }
2282  }
2283  LibmeshPetscCall(VecDestroy(&sol_holder_P));
2284  LibmeshPetscCall(VecDestroy(&sol_holder_W));
2285  LibmeshPetscCall(VecDestroy(&loc_holder_Wij));
2286  }
2287  }
2288 }
virtual PetscScalar computeInterpolatedValue(PetscScalar topValue, PetscScalar botValue, PetscScalar Peclet=0.0)
Mat _cmc_friction_force_mat
Cross momentum conservation - friction force.
const bool _segregated_bool
Segregated solve.
Real _TR
Flag that activates or deactivates the transient parts of the equations we solve by multiplication...
std::unique_ptr< SolutionHandle > _P_soln
virtual const std::pair< unsigned int, unsigned int > & getGapChannels(unsigned int i_gap) const =0
Return a pair of inter-wrapper indices for a given gap index.
const bool _implicit_bool
Flag to define the usage of a implicit or explicit solution.
Mat _cmc_pressure_force_mat
Cross momentum conservation - pressure force.
virtual PetscErrorCode createPetscVector(Vec &v, PetscInt n)
Petsc Functions.
std::unique_ptr< SolutionHandle > _mdot_soln
std::vector< Real > _z_grid
axial location of nodes
const bool _staggered_pressure_bool
Flag to define the usage of staggered or collocated pressure.
static const std::string pitch
const InterWrapperMesh & _subchannel_mesh
virtual PetscScalar computeInterpolationCoefficients(PetscScalar Peclet=0.0)
Functions that computes the interpolation scheme given the Peclet number.
Mat _cmc_advective_derivative_mat
Cross momentum conservation - advective (Eulerian) derivative.
virtual Node * getChannelNode(unsigned int i_chan, unsigned iz) const =0
Get the inter-wrapper mesh node for a given channel index and elevation index.
virtual Real getGapWidth(unsigned int gap_index) const =0
Return gap width for a given gap index.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
static const std::string alpha
Definition: NS.h:134
Mat _cmc_sys_Wij_mat
Lateral momentum system matrix.
PetscErrorCode populateVectorFromDense(Vec &x, const T &solution, const unsigned int first_axial_level, const unsigned int last_axial_level, const unsigned int cross_dimension)
libMesh::DenseMatrix< Real > _Wij_old
const ConsoleStream _console
libMesh::DenseMatrix< Real > & _Wij
MooseUnits pow(const MooseUnits &, int)
libMesh::DenseMatrix< Real > _Wij_residual_matrix
virtual const Real & getPitch() const
Return the pitch between 2 inter-wrappers.
Mat _cmc_time_derivative_mat
Cross momentum Cross momentum conservation - time derivative.

◆ computeWijFromSolve()

void InterWrapper1PhaseProblem::computeWijFromSolve ( int  iblock)
protectedvirtualinherited

Computes diversion crossflow per gap for block with index iblock Block is a partition of the whole domain.

Definition at line 468 of file InterWrapper1PhaseProblem.C.

Referenced by InterWrapper1PhaseProblem::externalSolve(), and externalSolve().

469 {
470  unsigned int last_node = (iblock + 1) * _block_size;
471  unsigned int first_node = iblock * _block_size + 1;
472  // Initial guess, port crossflow of block (iblock) into a vector that will act as my initial guess
473  libMesh::DenseVector<Real> solution_seed(_n_gaps * _block_size, 0.0);
474  for (unsigned int iz = first_node; iz < last_node + 1; iz++)
475  {
476  for (unsigned int i_gap = 0; i_gap < _n_gaps; i_gap++)
477  {
478  int i = _n_gaps * (iz - first_node) + i_gap; // column wise transfer
479  solution_seed(i) = _Wij(i_gap, iz);
480  }
481  }
482 
483  // Solving the combined lateral momentum equation for Wij using a PETSc solver and update vector
484  // root
486  LibmeshPetscCall(petscSnesSolver(iblock, solution_seed, root));
487 
488  // Assign the solution to the cross-flow matrix
489  int i = 0;
490  for (unsigned int iz = first_node; iz < last_node + 1; iz++)
491  {
492  for (unsigned int i_gap = 0; i_gap < _n_gaps; i_gap++)
493  {
494  _Wij(i_gap, iz) = root(i);
495  i++;
496  }
497  }
498 }
virtual PetscErrorCode petscSnesSolver(int iblock, const libMesh::DenseVector< Real > &solution, libMesh::DenseVector< Real > &root)
Computes solution of nonlinear equation using snes.
Real root(std::function< Real(Real)> const &f, Real x1, Real x2, Real tol=1.0e-12)
Finds the root of a function using Brent&#39;s method.
Definition: BrentsMethod.C:66
libMesh::DenseMatrix< Real > & _Wij

◆ computeWijPrime()

void InterWrapper1PhaseProblem::computeWijPrime ( int  iblock)
protectedvirtualinherited

Computes turbulent crossflow per gap for block iblock.

Update turbulent crossflow

Definition at line 677 of file InterWrapper1PhaseProblem.C.

Referenced by InterWrapper1PhaseProblem::externalSolve(), InterWrapper1PhaseProblem::implicitPetscSolve(), and InterWrapper1PhaseProblem::residualFunction().

678 {
679  unsigned int last_node = (iblock + 1) * _block_size;
680  unsigned int first_node = iblock * _block_size + 1;
681 
682  if (!_implicit_bool)
683  {
684  for (unsigned int iz = first_node; iz < last_node + 1; iz++)
685  {
686  auto dz = _z_grid[iz] - _z_grid[iz - 1];
687  for (unsigned int i_gap = 0; i_gap < _n_gaps; i_gap++)
688  {
689  auto chans = _subchannel_mesh.getGapChannels(i_gap);
690  unsigned int i_ch = chans.first;
691  unsigned int j_ch = chans.second;
692  auto * node_in_i = _subchannel_mesh.getChannelNode(i_ch, iz - 1);
693  auto * node_out_i = _subchannel_mesh.getChannelNode(i_ch, iz);
694  auto * node_in_j = _subchannel_mesh.getChannelNode(j_ch, iz - 1);
695  auto * node_out_j = _subchannel_mesh.getChannelNode(j_ch, iz);
696  auto Si_in = (*_S_flow_soln)(node_in_i);
697  auto Sj_in = (*_S_flow_soln)(node_in_j);
698  auto Si_out = (*_S_flow_soln)(node_out_i);
699  auto Sj_out = (*_S_flow_soln)(node_out_j);
700  // crossflow area between channels i,j (dz*gap_width)
701  auto Sij = dz * _subchannel_mesh.getGapWidth(i_gap);
702  // Calculation of Turbulent Crossflow
703  _WijPrime(i_gap, iz) =
704  _beta * 0.5 *
705  (((*_mdot_soln)(node_in_i) + (*_mdot_soln)(node_in_j)) / (Si_in + Sj_in) +
706  ((*_mdot_soln)(node_out_i) + (*_mdot_soln)(node_out_j)) / (Si_out + Sj_out)) *
707  Sij;
708  }
709  }
710  }
711  else
712  {
713  for (unsigned int iz = first_node; iz < last_node + 1; iz++)
714  {
715  auto dz = _z_grid[iz] - _z_grid[iz - 1];
716  auto iz_ind = iz - first_node;
717  for (unsigned int i_gap = 0; i_gap < _n_gaps; i_gap++)
718  {
719  auto chans = _subchannel_mesh.getGapChannels(i_gap);
720  unsigned int i_ch = chans.first;
721  unsigned int j_ch = chans.second;
722  auto * node_in_i = _subchannel_mesh.getChannelNode(i_ch, iz - 1);
723  auto * node_out_i = _subchannel_mesh.getChannelNode(i_ch, iz);
724  auto * node_in_j = _subchannel_mesh.getChannelNode(j_ch, iz - 1);
725  auto * node_out_j = _subchannel_mesh.getChannelNode(j_ch, iz);
726  auto Si_in = (*_S_flow_soln)(node_in_i);
727  auto Sj_in = (*_S_flow_soln)(node_in_j);
728  auto Si_out = (*_S_flow_soln)(node_out_i);
729  auto Sj_out = (*_S_flow_soln)(node_out_j);
730  // crossflow area between channels i,j (dz*gap_width)
731  auto Sij = dz * _subchannel_mesh.getGapWidth(i_gap);
732 
733  // Base value - I don't want to write it every time
734  PetscScalar base_value = _beta * 0.5 * Sij;
735 
736  // Bottom values
737  if (iz == first_node)
738  {
739  PetscScalar value_tl = -1.0 * base_value / (Si_in + Sj_in) *
740  ((*_mdot_soln)(node_in_i) + (*_mdot_soln)(node_in_j));
741  PetscInt row = i_gap + _n_gaps * iz_ind;
742  LibmeshPetscCall(
743  VecSetValues(_amc_turbulent_cross_flows_rhs, 1, &row, &value_tl, INSERT_VALUES));
744  }
745  else
746  {
747  PetscScalar value_tl = base_value / (Si_in + Sj_in);
748  PetscInt row = i_gap + _n_gaps * iz_ind;
749 
750  PetscInt col_ich = i_ch + _n_channels * (iz_ind - 1);
751  LibmeshPetscCall(MatSetValues(
752  _amc_turbulent_cross_flows_mat, 1, &row, 1, &col_ich, &value_tl, INSERT_VALUES));
753 
754  PetscInt col_jch = j_ch + _n_channels * (iz_ind - 1);
755  LibmeshPetscCall(MatSetValues(
756  _amc_turbulent_cross_flows_mat, 1, &row, 1, &col_jch, &value_tl, INSERT_VALUES));
757  }
758 
759  // Top values
760  PetscScalar value_bl = base_value / (Si_out + Sj_out);
761  PetscInt row = i_gap + _n_gaps * iz_ind;
762 
763  PetscInt col_ich = i_ch + _n_channels * iz_ind;
764  LibmeshPetscCall(MatSetValues(
765  _amc_turbulent_cross_flows_mat, 1, &row, 1, &col_ich, &value_bl, INSERT_VALUES));
766 
767  PetscInt col_jch = j_ch + _n_channels * iz_ind;
768  LibmeshPetscCall(MatSetValues(
769  _amc_turbulent_cross_flows_mat, 1, &row, 1, &col_jch, &value_bl, INSERT_VALUES));
770  }
771  }
772  LibmeshPetscCall(MatAssemblyBegin(_amc_turbulent_cross_flows_mat, MAT_FINAL_ASSEMBLY));
773  LibmeshPetscCall(MatAssemblyEnd(_amc_turbulent_cross_flows_mat, MAT_FINAL_ASSEMBLY));
774 
776  Vec loc_prod;
777  Vec loc_Wij;
778  LibmeshPetscCall(VecDuplicate(_amc_sys_mdot_rhs, &loc_prod));
779  LibmeshPetscCall(VecDuplicate(_Wij_vec, &loc_Wij));
780  LibmeshPetscCall(populateVectorFromHandle<SolutionHandle>(
781  loc_prod, *_mdot_soln, first_node, last_node, _n_channels));
782  LibmeshPetscCall(MatMult(_amc_turbulent_cross_flows_mat, loc_prod, loc_Wij));
783  LibmeshPetscCall(VecAXPY(loc_Wij, -1.0, _amc_turbulent_cross_flows_rhs));
785  loc_Wij, _WijPrime, first_node, last_node, _n_gaps));
786  LibmeshPetscCall(VecDestroy(&loc_prod));
787  LibmeshPetscCall(VecDestroy(&loc_Wij));
788  }
789 }
Mat _amc_turbulent_cross_flows_mat
Mass conservation - density time derivative No implicit matrix.
virtual const std::pair< unsigned int, unsigned int > & getGapChannels(unsigned int i_gap) const =0
Return a pair of inter-wrapper indices for a given gap index.
const bool _implicit_bool
Flag to define the usage of a implicit or explicit solution.
std::unique_ptr< SolutionHandle > _mdot_soln
PetscErrorCode populateDenseFromVector(const Vec &x, T &solution, const unsigned int first_axial_level, const unsigned int last_axial_level, const unsigned int cross_dimension)
const Real & _beta
Thermal diffusion coefficient used in turbulent crossflow.
std::vector< Real > _z_grid
axial location of nodes
const InterWrapperMesh & _subchannel_mesh
virtual Node * getChannelNode(unsigned int i_chan, unsigned iz) const =0
Get the inter-wrapper mesh node for a given channel index and elevation index.
virtual Real getGapWidth(unsigned int gap_index) const =0
Return gap width for a given gap index.
libMesh::DenseMatrix< Real > _WijPrime

◆ createPetscMatrix()

PetscErrorCode InterWrapper1PhaseProblem::createPetscMatrix ( Mat &  M,
PetscInt  n,
PetscInt  m 
)
protectedvirtualinherited

Definition at line 364 of file InterWrapper1PhaseProblem.C.

Referenced by InterWrapper1PhaseProblem::InterWrapper1PhaseProblem().

365 {
367  LibmeshPetscCall(MatCreate(PETSC_COMM_WORLD, &M));
368  LibmeshPetscCall(MatSetSizes(M, PETSC_DECIDE, PETSC_DECIDE, n, m));
369  LibmeshPetscCall(MatSetFromOptions(M));
370  LibmeshPetscCall(MatSetUp(M));
371  PetscFunctionReturn(LIBMESH_PETSC_SUCCESS);
372 }
PetscFunctionBegin
PetscFunctionReturn(LIBMESH_PETSC_SUCCESS)

◆ createPetscVector()

PetscErrorCode InterWrapper1PhaseProblem::createPetscVector ( Vec &  v,
PetscInt  n 
)
protectedvirtualinherited

Petsc Functions.

Definition at line 352 of file InterWrapper1PhaseProblem.C.

Referenced by InterWrapper1PhaseProblem::computeWij(), InterWrapper1PhaseProblem::implicitPetscSolve(), and InterWrapper1PhaseProblem::InterWrapper1PhaseProblem().

353 {
355  LibmeshPetscCall(VecCreate(PETSC_COMM_WORLD, &v));
356  LibmeshPetscCall(PetscObjectSetName((PetscObject)v, "Solution"));
357  LibmeshPetscCall(VecSetSizes(v, PETSC_DECIDE, n));
358  LibmeshPetscCall(VecSetFromOptions(v));
359  LibmeshPetscCall(VecZeroEntries(v));
360  PetscFunctionReturn(LIBMESH_PETSC_SUCCESS);
361 }
PetscFunctionBegin
static const std::string v
Definition: NS.h:84
PetscFunctionReturn(LIBMESH_PETSC_SUCCESS)

◆ externalSolve()

void TriInterWrapper1PhaseProblem::externalSolve ( )
overrideprotectedvirtual

TODO: add a verbose print flag

Reimplemented from InterWrapper1PhaseProblem.

Definition at line 339 of file TriInterWrapper1PhaseProblem.C.

340 {
342  _console << "Executing subchannel solver\n";
343  auto P_error = 1.0;
344  unsigned int P_it = 0;
345  unsigned int P_it_max = 2 * _n_blocks;
346  if (_n_blocks == 1)
347  P_it_max = 1;
348  while (P_error > _P_tol && P_it < P_it_max)
349  {
350  P_it += 1;
351  if (P_it == P_it_max and _n_blocks != 1)
352  {
353  _console << "Reached maximum number of axial pressure iterations" << std::endl;
354  _converged = false;
355  }
356  _console << "Solving Outer Iteration : " << P_it << std::endl;
357  auto P_L2norm_old_axial = _P_soln->L2norm();
358  for (unsigned int iblock = 0; iblock < _n_blocks; iblock++)
359  {
360  int last_level = (iblock + 1) * _block_size;
361  int first_level = iblock * _block_size + 1;
362  auto T_block_error = 1.0;
363  auto T_it = 0;
364  _console << "Solving Block: " << iblock << " From first level: " << first_level
365  << " to last level: " << last_level << std::endl;
366 
367  while (T_block_error > _T_tol && T_it < _T_maxit)
368  {
369  T_it += 1;
370  if (T_it == _T_maxit)
371  {
372  _console << "Reached maximum number of temperature iterations for block: " << iblock
373  << std::endl;
374  _converged = false;
375  }
376  auto T_L2norm_old_block = _T_soln->L2norm();
377 
378  // computeWij(iblock);
379  computeWijFromSolve(iblock);
380 
381  if (_compute_power)
382  {
383  computeh(iblock);
384 
385  computeT(iblock);
386  }
387 
388  if (_compute_density)
389  computeRho(iblock);
390 
391  if (_compute_viscosity)
392  computeMu(iblock);
393 
394  // We must do a global assembly to make sure data is parallel consistent before we do things
395  // like compute L2 norms
396  _aux->solution().close();
397 
398  auto T_L2norm_new = _T_soln->L2norm();
399  T_block_error =
400  std::abs((T_L2norm_new - T_L2norm_old_block) / (T_L2norm_old_block + 1E-14));
401  _console << "T_block_error: " << T_block_error << std::endl;
402  }
403  }
404  auto P_L2norm_new_axial = _P_soln->L2norm();
405  P_error =
406  std::abs((P_L2norm_new_axial - P_L2norm_old_axial) / (P_L2norm_old_axial + _P_out + 1E-14));
407  _console << "P_error :" << P_error << std::endl;
408  }
409  // update old crossflow matrix
410  _Wij_old = _Wij;
411  _console << "Finished executing subchannel solver\n";
412  _aux->solution().close();
413 
414  auto power_in = 0.0;
415  auto power_out = 0.0;
416  for (unsigned int i_ch = 0; i_ch < _n_channels; i_ch++)
417  {
418  auto * node_in = _subchannel_mesh.getChannelNode(i_ch, 0);
419  auto * node_out = _subchannel_mesh.getChannelNode(i_ch, _n_cells);
420  power_in += (*_mdot_soln)(node_in) * (*_h_soln)(node_in);
421  power_out += (*_mdot_soln)(node_out) * (*_h_soln)(node_out);
422  }
423 
425  auto Total_surface_area = 0.0;
426  auto mass_flow_in = 0.0;
427  auto mass_flow_out = 0.0;
428  for (unsigned int i_ch = 0; i_ch < _n_channels; i_ch++)
429  {
430  auto * node_in = _subchannel_mesh.getChannelNode(i_ch, 0);
431  auto * node_out = _subchannel_mesh.getChannelNode(i_ch, _n_cells);
432  Total_surface_area += (*_S_flow_soln)(node_in);
433  mass_flow_in += (*_mdot_soln)(node_in);
434  mass_flow_out += (*_mdot_soln)(node_out);
435  }
436  auto h_bulk_out = power_out / mass_flow_out;
437  auto T_bulk_out = _fp->T_from_p_h(_P_out, h_bulk_out);
438 
439  _console << " ======================================= " << std::endl;
440  _console << " ======== Subchannel Print Outs ======== " << std::endl;
441  _console << " ======================================= " << std::endl;
442  _console << "Total Surface Area :" << Total_surface_area << " m^2" << std::endl;
443  _console << "Bulk coolant temperature at outlet :" << T_bulk_out << " K" << std::endl;
444  _console << "Power added to coolant is: " << power_out - power_in << " Watt" << std::endl;
445  _console << "Mass in: " << mass_flow_in << " kg/sec" << std::endl;
446  _console << "Mass out: " << mass_flow_out << " kg/sec" << std::endl;
447  _console << " ======================================= " << std::endl;
448 }
const bool _compute_density
Flag that activates or deactivates the calculation of density.
std::unique_ptr< SolutionHandle > _P_soln
const int & _T_maxit
Maximum iterations for the inner temperature loop.
const Real & _P_tol
Convergence tolerance for the pressure loop in external solve.
virtual void computeRho(int iblock)
Computes Density per channel for block iblock.
virtual void computeT(int iblock)
Computes Temperature per channel for block iblock.
const Real & _P_out
Outlet Pressure.
const SinglePhaseFluidProperties * _fp
Solutions handles and link to TH tables properties.
std::unique_ptr< SolutionHandle > _T_soln
virtual void computeh(int iblock) override
computeMassFlowForDPDZ() and enforceUniformDPDZAtInlet() are overriden to define the sodium friction ...
std::shared_ptr< AuxiliarySystem > _aux
unsigned int _n_blocks
number of axial blocks
const InterWrapperMesh & _subchannel_mesh
const bool _compute_viscosity
Flag that activates or deactivates the calculation of viscosity.
virtual Node * getChannelNode(unsigned int i_chan, unsigned iz) const =0
Get the inter-wrapper mesh node for a given channel index and elevation index.
virtual void computeWijFromSolve(int iblock)
Computes diversion crossflow per gap for block with index iblock Block is a partition of the whole do...
const Real & _T_tol
Convergence tolerance for the temperature loop in external solve.
virtual void initializeSolution()
Function to initialize the solution fields.
virtual void computeMu(int iblock)
Computes Viscosity per channel for block iblock.
std::unique_ptr< SolutionHandle > _h_soln
libMesh::DenseMatrix< Real > _Wij_old
const bool _compute_power
Flag that informs if we need to solve the Enthalpy/Temperature equations or not.
const ConsoleStream _console
libMesh::DenseMatrix< Real > & _Wij
bool _converged
Variable that informs whether we exited external solve with a converged solution or not...

◆ implicitPetscSolve()

PetscErrorCode InterWrapper1PhaseProblem::implicitPetscSolve ( int  iblock)
protectedvirtualinherited

Computes implicit solve using PetSc.

Initializing flags

Assembling matrices

Setting up linear solver

Solving

Destroying solver elements

Recovering the solutions

Assigning the solutions to arrays

Populating Mass flow

Populating Pressure

Populating Crossflow

Populating Enthalpy

Populating sum_Wij

Destroying arrays

Definition at line 2389 of file InterWrapper1PhaseProblem.C.

Referenced by InterWrapper1PhaseProblem::externalSolve().

2390 {
2391  Vec b_nest, x_nest; /* approx solution, RHS, exact solution */
2392  Mat A_nest; /* linear system matrix */
2393  KSP ksp; /* linear solver context */
2394  PC pc; /* preconditioner context */
2395 
2397  PetscInt Q = _monolithic_thermal_bool ? 4 : 3;
2398  std::vector<Mat> mat_array(Q * Q);
2399  std::vector<Vec> vec_array(Q);
2400 
2402  bool _axial_mass_flow_tight_coupling = true;
2403  bool _pressure_axial_momentum_tight_coupling = true;
2404  bool _pressure_cross_momentum_tight_coupling = true;
2405  unsigned int first_node = iblock * _block_size + 1;
2406  unsigned int last_node = (iblock + 1) * _block_size;
2407 
2409  // Computing sum of crossflows with previous iteration
2410  computeSumWij(iblock);
2411  // Assembling axial flux matrix
2412  computeMdot(iblock);
2413  // Computing turbulent crossflow with previous step axial mass flows
2414  computeWijPrime(iblock);
2415  // Assembling for Pressure Drop matrix
2416  computeDP(iblock);
2417  // Assembling pressure matrix
2418  computeP(iblock);
2419  // Assembling cross fluxes matrix
2420  computeWij(iblock);
2421  // If monolithic solve - Assembling enthalpy matrix
2423  computeh(iblock);
2424 
2425  _console << "Starting nested system." << std::endl;
2426  _console << "Number of simultaneous variables: " << Q << std::endl;
2427  // Mass conservation
2428  PetscInt field_num = 0;
2429  LibmeshPetscCall(
2430  MatDuplicate(_mc_axial_convection_mat, MAT_COPY_VALUES, &mat_array[Q * field_num + 0]));
2431  LibmeshPetscCall(MatAssemblyBegin(mat_array[Q * field_num + 0], MAT_FINAL_ASSEMBLY));
2432  LibmeshPetscCall(MatAssemblyEnd(mat_array[Q * field_num + 0], MAT_FINAL_ASSEMBLY));
2433  mat_array[Q * field_num + 1] = NULL;
2434  if (_axial_mass_flow_tight_coupling)
2435  {
2436  LibmeshPetscCall(MatDuplicate(_mc_sumWij_mat, MAT_COPY_VALUES, &mat_array[Q * field_num + 2]));
2437  LibmeshPetscCall(MatAssemblyBegin(mat_array[Q * field_num + 2], MAT_FINAL_ASSEMBLY));
2438  LibmeshPetscCall(MatAssemblyEnd(mat_array[Q * field_num + 2], MAT_FINAL_ASSEMBLY));
2439  }
2440  else
2441  {
2442  mat_array[Q * field_num + 2] = NULL;
2443  }
2445  {
2446  mat_array[Q * field_num + 3] = NULL;
2447  }
2448  LibmeshPetscCall(VecDuplicate(_mc_axial_convection_rhs, &vec_array[field_num]));
2449  LibmeshPetscCall(VecCopy(_mc_axial_convection_rhs, vec_array[field_num]));
2450  if (!_axial_mass_flow_tight_coupling)
2451  {
2452  Vec sumWij_loc;
2453  LibmeshPetscCall(VecDuplicate(_mc_axial_convection_rhs, &sumWij_loc));
2454  LibmeshPetscCall(VecSet(sumWij_loc, 0.0));
2455  for (unsigned int iz = first_node; iz < last_node + 1; iz++)
2456  {
2457  auto iz_ind = iz - first_node;
2458  for (unsigned int i_ch = 0; i_ch < _n_channels; i_ch++)
2459  {
2460  auto * node_out = _subchannel_mesh.getChannelNode(i_ch, iz);
2461 
2462  PetscScalar value_vec_2 = -1.0 * (*_SumWij_soln)(node_out);
2463  PetscInt row_vec_2 = i_ch + _n_channels * iz_ind;
2464  LibmeshPetscCall(VecSetValues(sumWij_loc, 1, &row_vec_2, &value_vec_2, ADD_VALUES));
2465  }
2466  }
2467  LibmeshPetscCall(VecAXPY(vec_array[field_num], 1.0, sumWij_loc));
2468  LibmeshPetscCall(VecDestroy(&sumWij_loc));
2469  }
2470 
2471  _console << "Mass ok." << std::endl;
2472  // Axial momentum conservation
2473  field_num = 1;
2474  if (_pressure_axial_momentum_tight_coupling)
2475  {
2476  LibmeshPetscCall(
2477  MatDuplicate(_amc_sys_mdot_mat, MAT_COPY_VALUES, &mat_array[Q * field_num + 0]));
2478  LibmeshPetscCall(MatAssemblyBegin(mat_array[Q * field_num + 0], MAT_FINAL_ASSEMBLY));
2479  LibmeshPetscCall(MatAssemblyEnd(mat_array[Q * field_num + 0], MAT_FINAL_ASSEMBLY));
2480  }
2481  else
2482  {
2483  mat_array[Q * field_num + 0] = NULL;
2484  }
2485  LibmeshPetscCall(
2486  MatDuplicate(_amc_pressure_force_mat, MAT_COPY_VALUES, &mat_array[Q * field_num + 1]));
2487  LibmeshPetscCall(MatAssemblyBegin(mat_array[Q * field_num + 1], MAT_FINAL_ASSEMBLY));
2488  LibmeshPetscCall(MatAssemblyEnd(mat_array[Q * field_num + 1], MAT_FINAL_ASSEMBLY));
2489  mat_array[Q * field_num + 2] = NULL;
2491  {
2492  mat_array[Q * field_num + 3] = NULL;
2493  }
2494  LibmeshPetscCall(VecDuplicate(_amc_pressure_force_rhs, &vec_array[field_num]));
2495  LibmeshPetscCall(VecCopy(_amc_pressure_force_rhs, vec_array[field_num]));
2496  if (_pressure_axial_momentum_tight_coupling)
2497  {
2498  LibmeshPetscCall(VecAXPY(vec_array[field_num], 1.0, _amc_sys_mdot_rhs));
2499  }
2500  else
2501  {
2502  unsigned int last_node = (iblock + 1) * _block_size;
2503  unsigned int first_node = iblock * _block_size + 1;
2504  LibmeshPetscCall(populateVectorFromHandle<SolutionHandle>(
2505  _prod, *_mdot_soln, first_node, last_node, _n_channels));
2506  Vec ls;
2507  LibmeshPetscCall(VecDuplicate(_amc_sys_mdot_rhs, &ls));
2508  LibmeshPetscCall(MatMult(_amc_sys_mdot_mat, _prod, ls));
2509  LibmeshPetscCall(VecAXPY(ls, -1.0, _amc_sys_mdot_rhs));
2510  LibmeshPetscCall(VecAXPY(vec_array[field_num], -1.0, ls));
2511  LibmeshPetscCall(VecDestroy(&ls));
2512  }
2513 
2514  _console << "Lin mom OK." << std::endl;
2515 
2516  // Cross momentum conservation
2517  field_num = 2;
2518  mat_array[Q * field_num + 0] = NULL;
2519  if (_pressure_cross_momentum_tight_coupling)
2520  {
2521  LibmeshPetscCall(
2522  MatDuplicate(_cmc_pressure_force_mat, MAT_COPY_VALUES, &mat_array[Q * field_num + 1]));
2523  LibmeshPetscCall(MatAssemblyBegin(mat_array[Q * field_num + 1], MAT_FINAL_ASSEMBLY));
2524  LibmeshPetscCall(MatAssemblyEnd(mat_array[Q * field_num + 1], MAT_FINAL_ASSEMBLY));
2525  }
2526  else
2527  {
2528  mat_array[Q * field_num + 1] = NULL;
2529  }
2530 
2531  LibmeshPetscCall(MatDuplicate(_cmc_sys_Wij_mat, MAT_COPY_VALUES, &mat_array[Q * field_num + 2]));
2532  LibmeshPetscCall(MatAssemblyBegin(mat_array[Q * field_num + 2], MAT_FINAL_ASSEMBLY));
2533  LibmeshPetscCall(MatAssemblyEnd(mat_array[Q * field_num + 2], MAT_FINAL_ASSEMBLY));
2535  {
2536  mat_array[Q * field_num + 3] = NULL;
2537  }
2538 
2539  LibmeshPetscCall(VecDuplicate(_cmc_sys_Wij_rhs, &vec_array[field_num]));
2540  LibmeshPetscCall(VecCopy(_cmc_sys_Wij_rhs, vec_array[field_num]));
2541  if (_pressure_cross_momentum_tight_coupling)
2542  {
2543  LibmeshPetscCall(VecAXPY(vec_array[field_num], 1.0, _cmc_pressure_force_rhs));
2544  }
2545  else
2546  {
2547  Vec sol_holder_P;
2548  LibmeshPetscCall(createPetscVector(sol_holder_P, _block_size * _n_gaps));
2549  LibmeshPetscCall(populateVectorFromHandle<SolutionHandle>(
2550  _prodp, *_P_soln, iblock * _block_size, (iblock + 1) * _block_size - 1, _n_channels));
2551 
2552  LibmeshPetscCall(MatMult(_cmc_pressure_force_mat, _prodp, sol_holder_P));
2553  LibmeshPetscCall(VecAXPY(sol_holder_P, -1.0, _cmc_pressure_force_rhs));
2554  LibmeshPetscCall(VecScale(sol_holder_P, 1.0));
2555  LibmeshPetscCall(VecAXPY(vec_array[field_num], 1.0, sol_holder_P));
2556  LibmeshPetscCall(VecDestroy(&sol_holder_P));
2557  }
2558 
2559  _console << "Cross mom ok." << std::endl;
2560 
2561  // Energy conservation
2563  {
2564  field_num = 3;
2565  mat_array[Q * field_num + 0] = NULL;
2566  mat_array[Q * field_num + 1] = NULL;
2567  mat_array[Q * field_num + 2] = NULL;
2568  LibmeshPetscCall(MatDuplicate(_hc_sys_h_mat, MAT_COPY_VALUES, &mat_array[Q * field_num + 3]));
2569  LibmeshPetscCall(MatAssemblyBegin(mat_array[Q * field_num + 3], MAT_FINAL_ASSEMBLY));
2570  LibmeshPetscCall(MatAssemblyEnd(mat_array[Q * field_num + 3], MAT_FINAL_ASSEMBLY));
2571  LibmeshPetscCall(VecDuplicate(_hc_sys_h_rhs, &vec_array[field_num]));
2572  LibmeshPetscCall(VecCopy(_hc_sys_h_rhs, vec_array[field_num]));
2573  }
2574  _console << "Energy ok." << std::endl;
2575 
2576  // Relaxing linear system
2577  // Weaker relaxation
2578  if (true)
2579  {
2580  // Estimating cross-flow resistances to achieve realizable solves
2581  LibmeshPetscCall(populateVectorFromHandle<SolutionHandle>(
2582  _prod, *_mdot_soln, first_node, last_node, _n_channels));
2583  Vec mdot_estimate;
2584  LibmeshPetscCall(createPetscVector(mdot_estimate, _block_size * _n_channels));
2585  Vec pmat_diag;
2586  LibmeshPetscCall(createPetscVector(pmat_diag, _block_size * _n_channels));
2587  Vec p_estimate;
2588  LibmeshPetscCall(createPetscVector(p_estimate, _block_size * _n_channels));
2589  Vec unity_vec;
2590  LibmeshPetscCall(createPetscVector(unity_vec, _block_size * _n_channels));
2591  LibmeshPetscCall(VecSet(unity_vec, 1.0));
2592  Vec sol_holder_P;
2593  LibmeshPetscCall(createPetscVector(sol_holder_P, _block_size * _n_gaps));
2594  Vec diag_Wij_loc;
2595  LibmeshPetscCall(createPetscVector(diag_Wij_loc, _block_size * _n_gaps));
2596  Vec Wij_estimate;
2597  LibmeshPetscCall(createPetscVector(Wij_estimate, _block_size * _n_gaps));
2598  Vec unity_vec_Wij;
2599  LibmeshPetscCall(createPetscVector(unity_vec_Wij, _block_size * _n_gaps));
2600  LibmeshPetscCall(VecSet(unity_vec_Wij, 1.0));
2601  Vec _Wij_loc_vec;
2602  LibmeshPetscCall(createPetscVector(_Wij_loc_vec, _block_size * _n_gaps));
2603  Vec _Wij_old_loc_vec;
2604  LibmeshPetscCall(createPetscVector(_Wij_old_loc_vec, _block_size * _n_gaps));
2605  LibmeshPetscCall(MatMult(mat_array[Q], _prod, mdot_estimate));
2606  LibmeshPetscCall(MatGetDiagonal(mat_array[Q + 1], pmat_diag));
2607  LibmeshPetscCall(VecAXPY(pmat_diag, 1e-10, unity_vec));
2608  LibmeshPetscCall(VecPointwiseDivide(p_estimate, mdot_estimate, pmat_diag));
2609  LibmeshPetscCall(MatMult(mat_array[2 * Q + 1], p_estimate, sol_holder_P));
2610  LibmeshPetscCall(VecAXPY(sol_holder_P, -1.0, _cmc_pressure_force_rhs));
2611  LibmeshPetscCall(MatGetDiagonal(mat_array[2 * Q + 2], diag_Wij_loc));
2612  LibmeshPetscCall(VecAXPY(diag_Wij_loc, 1e-10, unity_vec_Wij));
2613  LibmeshPetscCall(VecPointwiseDivide(Wij_estimate, sol_holder_P, diag_Wij_loc));
2614  Vec sumWij_loc;
2615  LibmeshPetscCall(createPetscVector(sumWij_loc, _block_size * _n_channels));
2616  for (unsigned int iz = first_node; iz < last_node + 1; iz++)
2617  {
2618  auto iz_ind = iz - first_node;
2619  for (unsigned int i_ch = 0; i_ch < _n_channels; i_ch++)
2620  {
2621  PetscScalar sumWij = 0.0;
2622  unsigned int counter = 0;
2623  for (auto i_gap : _subchannel_mesh.getChannelGaps(i_ch))
2624  {
2625  auto chans = _subchannel_mesh.getGapChannels(i_gap);
2626  unsigned int i_ch_loc = chans.first;
2627  PetscInt row_vec = i_ch_loc + _n_channels * iz_ind;
2628  PetscScalar loc_Wij_value;
2629  LibmeshPetscCall(VecGetValues(sol_holder_P, 1, &row_vec, &loc_Wij_value));
2630  sumWij += _subchannel_mesh.getCrossflowSign(i_ch, counter) * loc_Wij_value;
2631  counter++;
2632  }
2633  PetscInt row_vec = i_ch + _n_channels * iz_ind;
2634  LibmeshPetscCall(VecSetValues(sumWij_loc, 1, &row_vec, &sumWij, INSERT_VALUES));
2635  }
2636  }
2637 
2638  PetscScalar min_mdot;
2639  LibmeshPetscCall(VecAbs(_prod));
2640  LibmeshPetscCall(VecMin(_prod, NULL, &min_mdot));
2641  _console << "Minimum estimated mdot: " << min_mdot << std::endl;
2642 
2643  LibmeshPetscCall(VecAbs(sumWij_loc));
2644  LibmeshPetscCall(VecMax(sumWij_loc, NULL, &_max_sumWij));
2645  _max_sumWij = std::max(1e-10, _max_sumWij);
2646  _console << "Maximum estimated Wij: " << _max_sumWij << std::endl;
2647 
2649  _Wij_loc_vec, _Wij, first_node, last_node, _n_gaps));
2650  LibmeshPetscCall(VecAbs(_Wij_loc_vec));
2652  _Wij_old_loc_vec, _Wij_old, first_node, last_node, _n_gaps));
2653  LibmeshPetscCall(VecAbs(_Wij_old_loc_vec));
2654  LibmeshPetscCall(VecAXPY(_Wij_loc_vec, -1.0, _Wij_old_loc_vec));
2655  PetscScalar relax_factor;
2656  LibmeshPetscCall(VecAbs(_Wij_loc_vec));
2657 #if !PETSC_VERSION_LESS_THAN(3, 16, 0)
2658  LibmeshPetscCall(VecMean(_Wij_loc_vec, &relax_factor));
2659 #else
2660  LibmeshPetscCall(VecSum(_Wij_loc_vec, &relax_factor));
2661  relax_factor /= _block_size * _n_gaps;
2662 #endif
2663  relax_factor = relax_factor / _max_sumWij + 0.5;
2664  _console << "Relax base value: " << relax_factor << std::endl;
2665 
2666  PetscScalar resistance_relaxation = 0.9;
2667  _added_K = _max_sumWij / min_mdot;
2668  _console << "New cross resistance: " << _added_K << std::endl;
2669  _added_K = (_added_K * resistance_relaxation + (1.0 - resistance_relaxation) * _added_K_old) *
2670  relax_factor;
2671  _console << "Relaxed cross resistance: " << _added_K << std::endl;
2672  if (_added_K < 10 && _added_K >= 1.0)
2673  _added_K = 1.0; //(1.0 - resistance_relaxation);
2674  if (_added_K < 1.0 && _added_K >= 0.1)
2675  _added_K = 0.5;
2676  if (_added_K < 0.1 && _added_K >= 0.01)
2677  _added_K = 1. / 3.;
2678  if (_added_K < 1e-2 && _added_K >= 1e-3)
2679  _added_K = 0.1;
2680  if (_added_K < 1e-3)
2681  _added_K = 1.0 * _added_K;
2682  _console << "Actual added cross resistance: " << _added_K << std::endl;
2683  LibmeshPetscCall(VecScale(unity_vec_Wij, _added_K));
2685 
2686  // Adding cross resistances
2687  LibmeshPetscCall(MatDiagonalSet(mat_array[2 * Q + 2], unity_vec_Wij, ADD_VALUES));
2688  LibmeshPetscCall(VecDestroy(&mdot_estimate));
2689  LibmeshPetscCall(VecDestroy(&pmat_diag));
2690  LibmeshPetscCall(VecDestroy(&unity_vec));
2691  LibmeshPetscCall(VecDestroy(&p_estimate));
2692  LibmeshPetscCall(VecDestroy(&sol_holder_P));
2693  LibmeshPetscCall(VecDestroy(&diag_Wij_loc));
2694  LibmeshPetscCall(VecDestroy(&unity_vec_Wij));
2695  LibmeshPetscCall(VecDestroy(&Wij_estimate));
2696  LibmeshPetscCall(VecDestroy(&sumWij_loc));
2697  LibmeshPetscCall(VecDestroy(&_Wij_loc_vec));
2698  LibmeshPetscCall(VecDestroy(&_Wij_old_loc_vec));
2699 
2700  // Auto-computing relaxation factors
2701  PetscScalar relaxation_factor_mdot, relaxation_factor_P, relaxation_factor_Wij;
2702  relaxation_factor_mdot = 1.0;
2703  relaxation_factor_P = 1.0; // std::exp(-5.0);
2704  relaxation_factor_Wij = 0.1;
2705 
2706  _console << "Relax mdot: " << relaxation_factor_mdot << std::endl;
2707  _console << "Relax P: " << relaxation_factor_P << std::endl;
2708  _console << "Relax Wij: " << relaxation_factor_Wij << std::endl;
2709 
2710  PetscInt field_num = 0;
2711  Vec diag_mdot;
2712  LibmeshPetscCall(VecDuplicate(vec_array[field_num], &diag_mdot));
2713  LibmeshPetscCall(MatGetDiagonal(mat_array[Q * field_num + field_num], diag_mdot));
2714  LibmeshPetscCall(VecScale(diag_mdot, 1.0 / relaxation_factor_mdot));
2715  LibmeshPetscCall(
2716  MatDiagonalSet(mat_array[Q * field_num + field_num], diag_mdot, INSERT_VALUES));
2717  LibmeshPetscCall(populateVectorFromHandle<SolutionHandle>(
2718  _prod, *_mdot_soln, first_node, last_node, _n_channels));
2719  LibmeshPetscCall(VecScale(diag_mdot, (1.0 - relaxation_factor_mdot)));
2720  LibmeshPetscCall(VecPointwiseMult(_prod, _prod, diag_mdot));
2721  LibmeshPetscCall(VecAXPY(vec_array[field_num], 1.0, _prod));
2722  LibmeshPetscCall(VecDestroy(&diag_mdot));
2723 
2724  _console << "mdot relaxed" << std::endl;
2725 
2726  field_num = 1;
2727  Vec diag_P;
2728  LibmeshPetscCall(VecDuplicate(vec_array[field_num], &diag_P));
2729  LibmeshPetscCall(MatGetDiagonal(mat_array[Q * field_num + field_num], diag_P));
2730  LibmeshPetscCall(VecScale(diag_P, 1.0 / relaxation_factor_P));
2731  LibmeshPetscCall(MatDiagonalSet(mat_array[Q * field_num + field_num], diag_P, INSERT_VALUES));
2732  _console << "Mat assembled" << std::endl;
2733  LibmeshPetscCall(populateVectorFromHandle<SolutionHandle>(
2734  _prod, *_P_soln, first_node, last_node, _n_channels));
2735  LibmeshPetscCall(VecScale(diag_P, (1.0 - relaxation_factor_P)));
2736  LibmeshPetscCall(VecPointwiseMult(_prod, _prod, diag_P));
2737  LibmeshPetscCall(VecAXPY(vec_array[field_num], 1.0, _prod));
2738  LibmeshPetscCall(VecDestroy(&diag_P));
2739 
2740  _console << "P relaxed" << std::endl;
2741 
2742  field_num = 2;
2743  Vec diag_Wij;
2744  LibmeshPetscCall(VecDuplicate(vec_array[field_num], &diag_Wij));
2745  LibmeshPetscCall(MatGetDiagonal(mat_array[Q * field_num + field_num], diag_Wij));
2746  LibmeshPetscCall(VecScale(diag_Wij, 1.0 / relaxation_factor_Wij));
2747  LibmeshPetscCall(MatDiagonalSet(mat_array[Q * field_num + field_num], diag_Wij, INSERT_VALUES));
2749  _Wij_vec, _Wij, first_node, last_node, _n_gaps));
2750  LibmeshPetscCall(VecScale(diag_Wij, (1.0 - relaxation_factor_Wij)));
2751  LibmeshPetscCall(VecPointwiseMult(_Wij_vec, _Wij_vec, diag_Wij));
2752  LibmeshPetscCall(VecAXPY(vec_array[field_num], 1.0, _Wij_vec));
2753  LibmeshPetscCall(VecDestroy(&diag_Wij));
2754 
2755  _console << "Wij relaxed" << std::endl;
2756  }
2757  _console << "Linear solver relaxed." << std::endl;
2758 
2759  // Creating nested matrices
2760  LibmeshPetscCall(MatCreateNest(PETSC_COMM_WORLD, Q, NULL, Q, NULL, mat_array.data(), &A_nest));
2761  LibmeshPetscCall(VecCreateNest(PETSC_COMM_WORLD, Q, NULL, vec_array.data(), &b_nest));
2762  _console << "Nested system created." << std::endl;
2763 
2765  // Creating linear solver
2766  LibmeshPetscCall(KSPCreate(PETSC_COMM_WORLD, &ksp));
2767  LibmeshPetscCall(KSPSetType(ksp, KSPFGMRES));
2768  // Setting KSP operators
2769  LibmeshPetscCall(KSPSetOperators(ksp, A_nest, A_nest));
2770  // Set KSP and PC options
2771  LibmeshPetscCall(KSPGetPC(ksp, &pc));
2772  LibmeshPetscCall(PCSetType(pc, PCFIELDSPLIT));
2773  LibmeshPetscCall(KSPSetTolerances(ksp, _rtol, _atol, _dtol, _maxit));
2774  // Splitting fields
2775  std::vector<IS> rows(Q);
2776  // IS rows[Q];
2777  PetscInt M = 0;
2778  LibmeshPetscCall(MatNestGetISs(A_nest, rows.data(), NULL));
2779  for (PetscInt j = 0; j < Q; ++j)
2780  {
2781  IS expand1;
2782  LibmeshPetscCall(ISDuplicate(rows[M], &expand1));
2783  M += 1;
2784  LibmeshPetscCall(PCFieldSplitSetIS(pc, NULL, expand1));
2785  LibmeshPetscCall(ISDestroy(&expand1));
2786  }
2787  _console << "Linear solver assembled." << std::endl;
2788 
2790  LibmeshPetscCall(VecDuplicate(b_nest, &x_nest));
2791  LibmeshPetscCall(VecSet(x_nest, 0.0));
2792  LibmeshPetscCall(KSPSolve(ksp, b_nest, x_nest));
2793 
2795  LibmeshPetscCall(VecDestroy(&b_nest));
2796  LibmeshPetscCall(MatDestroy(&A_nest));
2797  LibmeshPetscCall(KSPDestroy(&ksp));
2798  for (PetscInt i = 0; i < Q * Q; i++)
2799  {
2800  LibmeshPetscCall(MatDestroy(&mat_array[i]));
2801  }
2802  for (PetscInt i = 0; i < Q; i++)
2803  {
2804  LibmeshPetscCall(VecDestroy(&vec_array[i]));
2805  }
2806 
2808  Vec sol_mdot, sol_p, sol_Wij;
2809  _console << "Vectors created." << std::endl;
2810  PetscInt num_vecs;
2811  Vec * loc_vecs;
2812  LibmeshPetscCall(VecNestGetSubVecs(x_nest, &num_vecs, &loc_vecs));
2813  _console << "Starting extraction." << std::endl;
2814  LibmeshPetscCall(VecDuplicate(_mc_axial_convection_rhs, &sol_mdot));
2815  LibmeshPetscCall(VecCopy(loc_vecs[0], sol_mdot));
2816  LibmeshPetscCall(VecDuplicate(_amc_sys_mdot_rhs, &sol_p));
2817  LibmeshPetscCall(VecCopy(loc_vecs[1], sol_p));
2818  LibmeshPetscCall(VecDuplicate(_cmc_sys_Wij_rhs, &sol_Wij));
2819  LibmeshPetscCall(VecCopy(loc_vecs[2], sol_Wij));
2820  _console << "Getting individual field solutions from coupled solver." << std::endl;
2821 
2823  PetscScalar * sol_p_array;
2824  LibmeshPetscCall(VecGetArray(sol_p, &sol_p_array));
2825  PetscScalar * sol_Wij_array;
2826  LibmeshPetscCall(VecGetArray(sol_Wij, &sol_Wij_array));
2827 
2829  LibmeshPetscCall(populateSolutionChan<SolutionHandle>(
2830  sol_mdot, *_mdot_soln, first_node, last_node, _n_channels));
2831 
2833  for (unsigned int iz = last_node; iz > first_node - 1; iz--)
2834  {
2835  auto iz_ind = iz - first_node;
2836  for (unsigned int i_ch = 0; i_ch < _n_channels; i_ch++)
2837  {
2838  auto * node_in = _subchannel_mesh.getChannelNode(i_ch, iz - 1);
2839  PetscScalar value = sol_p_array[iz_ind * _n_channels + i_ch];
2840  _P_soln->set(node_in, value);
2841  }
2842  }
2843 
2846  sol_Wij, _Wij, first_node, last_node - 1, _n_gaps));
2847 
2850  {
2851  Vec sol_h;
2852  LibmeshPetscCall(VecDuplicate(_hc_sys_h_rhs, &sol_h));
2853  LibmeshPetscCall(VecCopy(loc_vecs[3], sol_h));
2854  PetscScalar * sol_h_array;
2855  LibmeshPetscCall(VecGetArray(sol_h, &sol_h_array));
2856  for (unsigned int iz = first_node; iz < last_node + 1; iz++)
2857  {
2858  auto iz_ind = iz - first_node;
2859  for (unsigned int i_ch = 0; i_ch < _n_channels; i_ch++)
2860  {
2861  auto * node_out = _subchannel_mesh.getChannelNode(i_ch, iz);
2862  auto h_out = sol_h_array[iz_ind * _n_channels + i_ch];
2863  if (h_out < 0)
2864  {
2865  mooseError(name(),
2866  " : Calculation of negative Enthalpy h_out = : ",
2867  h_out,
2868  " Axial Level= : ",
2869  iz);
2870  }
2871  _h_soln->set(node_out, h_out);
2872  }
2873  }
2874  LibmeshPetscCall(VecDestroy(&sol_h));
2875  }
2876 
2878  LibmeshPetscCall(MatMult(_mc_sumWij_mat, sol_Wij, _prod));
2879  LibmeshPetscCall(populateSolutionChan<SolutionHandle>(
2880  _prod, *_SumWij_soln, first_node, last_node, _n_channels));
2881 
2882  Vec sumWij_loc;
2883  LibmeshPetscCall(createPetscVector(sumWij_loc, _block_size * _n_channels));
2884  LibmeshPetscCall(populateVectorFromHandle<SolutionHandle>(
2885  _prod, *_SumWij_soln, first_node, last_node, _n_channels));
2886 
2887  LibmeshPetscCall(VecAbs(_prod));
2888  LibmeshPetscCall(VecMax(_prod, NULL, &_max_sumWij_new));
2889  _console << "Maximum estimated Wij new: " << _max_sumWij_new << std::endl;
2891  _console << "Correction factor: " << _correction_factor << std::endl;
2892  _console << "Solutions assigned to MOOSE variables." << std::endl;
2893 
2895  LibmeshPetscCall(VecDestroy(&x_nest));
2896  LibmeshPetscCall(VecDestroy(&sol_mdot));
2897  LibmeshPetscCall(VecDestroy(&sol_p));
2898  LibmeshPetscCall(VecDestroy(&sol_Wij));
2899  LibmeshPetscCall(VecDestroy(&sumWij_loc));
2900  _console << "Solutions destroyed." << std::endl;
2901 
2902  PetscFunctionReturn(LIBMESH_PETSC_SUCCESS);
2903 }
std::unique_ptr< SolutionHandle > _P_soln
virtual void computeSumWij(int iblock)
Computes net diversion crossflow per channel for block iblock.
virtual void computeh(int iblock)
Computes Enthalpy per channel for block iblock.
virtual void computeDP(int iblock)
Computes Pressure Drop per channel for block iblock.
PetscScalar _added_K
Added resistances for monolithic convergence.
virtual const std::pair< unsigned int, unsigned int > & getGapChannels(unsigned int i_gap) const =0
Return a pair of inter-wrapper indices for a given gap index.
virtual void computeWijPrime(int iblock)
Computes turbulent crossflow per gap for block iblock.
std::unique_ptr< SolutionHandle > _SumWij_soln
Mat _cmc_pressure_force_mat
Cross momentum conservation - pressure force.
Mat _mc_sumWij_mat
Mass conservation Mass conservation - sum of cross fluxes.
const PetscReal & _dtol
The divergence tolerance for the ksp linear solver.
PetscFunctionBegin
virtual PetscErrorCode createPetscVector(Vec &v, PetscInt n)
Petsc Functions.
const PetscReal & _rtol
The relative convergence tolerance, (relative decrease) for the ksp linear solver.
Mat _mc_axial_convection_mat
Mass conservation - axial convection.
std::unique_ptr< SolutionHandle > _mdot_soln
virtual void computeMdot(int iblock)
Computes mass flow per channel for block iblock.
PetscErrorCode populateDenseFromVector(const Vec &x, T &solution, const unsigned int first_axial_level, const unsigned int last_axial_level, const unsigned int cross_dimension)
virtual const std::string & name() const
const PetscInt & _maxit
The maximum number of iterations to use for the ksp linear solver.
Real value(unsigned n, unsigned alpha, unsigned beta, Real x)
virtual void computeP(int iblock)
Computes Pressure per channel for block iblock.
const bool _monolithic_thermal_bool
Thermal monolithic bool.
virtual void computeWij(int iblock)
Computes cross fluxes for block iblock.
const InterWrapperMesh & _subchannel_mesh
virtual Node * getChannelNode(unsigned int i_chan, unsigned iz) const =0
Get the inter-wrapper mesh node for a given channel index and elevation index.
Mat _cmc_sys_Wij_mat
Lateral momentum system matrix.
Mat _amc_pressure_force_mat
Axial momentum conservation - pressure force.
void mooseError(Args &&... args) const
PetscErrorCode populateVectorFromDense(Vec &x, const T &solution, const unsigned int first_axial_level, const unsigned int last_axial_level, const unsigned int cross_dimension)
std::unique_ptr< SolutionHandle > _h_soln
static const std::complex< double > j(0, 1)
Complex number "j" (also known as "i")
libMesh::DenseMatrix< Real > _Wij_old
const ConsoleStream _console
libMesh::DenseMatrix< Real > & _Wij
PetscFunctionReturn(LIBMESH_PETSC_SUCCESS)
virtual const std::vector< unsigned int > & getChannelGaps(unsigned int i_chan) const =0
Return a vector of gap indices for a given channel index.
Mat _amc_sys_mdot_mat
Axial momentum system matrix.
const PetscReal & _atol
The absolute convergence tolerance for the ksp linear solver.
virtual const Real & getCrossflowSign(unsigned int i_chan, unsigned int i_local) const =0
Return a signs for the cross flow given a inter-wrapper index and local neighbor index.

◆ initializeSolution()

void InterWrapper1PhaseProblem::initializeSolution ( )
protectedvirtualinherited

Function to initialize the solution fields.

Definition at line 2906 of file InterWrapper1PhaseProblem.C.

Referenced by InterWrapper1PhaseProblem::externalSolve(), and externalSolve().

2907 {
2908  unsigned int last_node = _n_cells;
2909  unsigned int first_node = 1;
2910  for (unsigned int iz = first_node; iz < last_node + 1; iz++)
2911  {
2912  for (unsigned int i_ch = 0; i_ch < _n_channels; i_ch++)
2913  {
2914  auto * node_out = _subchannel_mesh.getChannelNode(i_ch, iz);
2915  auto * node_in = _subchannel_mesh.getChannelNode(i_ch, iz - 1);
2916  _mdot_soln->set(node_out, (*_mdot_soln)(node_in));
2917  }
2918  }
2919  _mdot_soln->close();
2920 }
std::unique_ptr< SolutionHandle > _mdot_soln
const InterWrapperMesh & _subchannel_mesh
virtual Node * getChannelNode(unsigned int i_chan, unsigned iz) const =0
Get the inter-wrapper mesh node for a given channel index and elevation index.

◆ initialSetup()

void InterWrapper1PhaseProblem::initialSetup ( )
overridevirtualinherited

Reimplemented from ExternalProblem.

Definition at line 226 of file InterWrapper1PhaseProblem.C.

227 {
229  _fp = &getUserObject<SinglePhaseFluidProperties>(getParam<UserObjectName>("fp"));
230  _mdot_soln = std::make_unique<SolutionHandle>(getVariable(0, SubChannelApp::MASS_FLOW_RATE));
231  _SumWij_soln = std::make_unique<SolutionHandle>(getVariable(0, SubChannelApp::SUM_CROSSFLOW));
232  _P_soln = std::make_unique<SolutionHandle>(getVariable(0, SubChannelApp::PRESSURE));
233  _DP_soln = std::make_unique<SolutionHandle>(getVariable(0, SubChannelApp::PRESSURE_DROP));
234  _h_soln = std::make_unique<SolutionHandle>(getVariable(0, SubChannelApp::ENTHALPY));
235  _T_soln = std::make_unique<SolutionHandle>(getVariable(0, SubChannelApp::TEMPERATURE));
236  if (_pin_mesh_exist)
237  _Tpin_soln = std::make_unique<SolutionHandle>(getVariable(0, SubChannelApp::PIN_TEMPERATURE));
238  _rho_soln = std::make_unique<SolutionHandle>(getVariable(0, SubChannelApp::DENSITY));
239  _mu_soln = std::make_unique<SolutionHandle>(getVariable(0, SubChannelApp::VISCOSITY));
240  _S_flow_soln = std::make_unique<SolutionHandle>(getVariable(0, SubChannelApp::SURFACE_AREA));
241  _w_perim_soln = std::make_unique<SolutionHandle>(getVariable(0, SubChannelApp::WETTED_PERIMETER));
242  _q_prime_soln = std::make_unique<SolutionHandle>(getVariable(0, SubChannelApp::LINEAR_HEAT_RATE));
243 }
static const std::string PRESSURE_DROP
pressure drop
Definition: SubChannelApp.h:40
static const std::string MASS_FLOW_RATE
mass flow rate
Definition: SubChannelApp.h:32
std::unique_ptr< SolutionHandle > _w_perim_soln
static const std::string DENSITY
density
Definition: SubChannelApp.h:50
std::unique_ptr< SolutionHandle > _S_flow_soln
std::unique_ptr< SolutionHandle > _P_soln
std::unique_ptr< SolutionHandle > _Tpin_soln
std::unique_ptr< SolutionHandle > _SumWij_soln
std::unique_ptr< SolutionHandle > _rho_soln
std::unique_ptr< SolutionHandle > _mdot_soln
const SinglePhaseFluidProperties * _fp
Solutions handles and link to TH tables properties.
virtual const MooseVariableFieldBase & getVariable(const THREAD_ID tid, const std::string &var_name, Moose::VarKindType expected_var_type=Moose::VarKindType::VAR_ANY, Moose::VarFieldType expected_var_field_type=Moose::VarFieldType::VAR_FIELD_ANY) const override
static const std::string WETTED_PERIMETER
wetted perimeter
Definition: SubChannelApp.h:54
static const std::string VISCOSITY
viscosity
Definition: SubChannelApp.h:52
static const std::string PIN_TEMPERATURE
pin temperature
Definition: SubChannelApp.h:46
static const std::string LINEAR_HEAT_RATE
linear heat rate
Definition: SubChannelApp.h:56
std::unique_ptr< SolutionHandle > _T_soln
static const std::string ENTHALPY
enthalpy
Definition: SubChannelApp.h:42
void initialSetup() override
std::unique_ptr< SolutionHandle > _mu_soln
std::unique_ptr< SolutionHandle > _DP_soln
static const std::string SUM_CROSSFLOW
sum of diversion crossflow
Definition: SubChannelApp.h:36
static const std::string PRESSURE
pressure
Definition: SubChannelApp.h:38
std::unique_ptr< SolutionHandle > _q_prime_soln
static const std::string SURFACE_AREA
surface area
Definition: SubChannelApp.h:34
const bool _pin_mesh_exist
Flag that informs if there is a pin mesh or not.
std::unique_ptr< SolutionHandle > _h_soln
static const std::string TEMPERATURE
temperature
Definition: SubChannelApp.h:44

◆ petscSnesSolver()

PetscErrorCode InterWrapper1PhaseProblem::petscSnesSolver ( int  iblock,
const libMesh::DenseVector< Real > &  solution,
libMesh::DenseVector< Real > &  root 
)
protectedvirtualinherited

Computes solution of nonlinear equation using snes.

Definition at line 2333 of file InterWrapper1PhaseProblem.C.

Referenced by InterWrapper1PhaseProblem::computeWijFromSolve().

2336 {
2337  SNES snes;
2338  KSP ksp;
2339  PC pc;
2340  Vec x, r;
2341  PetscMPIInt size;
2342  PetscScalar * xx;
2343 
2345  PetscCallMPI(MPI_Comm_size(PETSC_COMM_WORLD, &size));
2346  if (size > 1)
2347  SETERRQ(PETSC_COMM_WORLD, PETSC_ERR_SUP, "Example is only for sequential runs");
2348  LibmeshPetscCall(SNESCreate(PETSC_COMM_WORLD, &snes));
2349  LibmeshPetscCall(VecCreate(PETSC_COMM_WORLD, &x));
2350  LibmeshPetscCall(VecSetSizes(x, PETSC_DECIDE, _block_size * _n_gaps));
2351  LibmeshPetscCall(VecSetFromOptions(x));
2352  LibmeshPetscCall(VecDuplicate(x, &r));
2353 
2354 #if PETSC_VERSION_LESS_THAN(3, 13, 0)
2355  LibmeshPetscCall(PetscOptionsSetValue(PETSC_NULL, "-snes_mf", PETSC_NULL));
2356 #else
2357  LibmeshPetscCall(SNESSetUseMatrixFree(snes, PETSC_FALSE, PETSC_TRUE));
2358 #endif
2359  problemInfo info;
2360  info.iblock = iblock;
2361  info.schp = this;
2362  LibmeshPetscCall(SNESSetFunction(snes, r, formFunctionIW, &info));
2363 
2364  LibmeshPetscCall(SNESGetKSP(snes, &ksp));
2365  LibmeshPetscCall(KSPGetPC(ksp, &pc));
2366  LibmeshPetscCall(PCSetType(pc, PCNONE));
2367  LibmeshPetscCall(KSPSetTolerances(ksp, _rtol, _atol, _dtol, _maxit));
2368  LibmeshPetscCall(SNESSetFromOptions(snes));
2369  LibmeshPetscCall(VecGetArray(x, &xx));
2370  for (unsigned int i = 0; i < _block_size * _n_gaps; i++)
2371  {
2372  xx[i] = solution(i);
2373  }
2374  LibmeshPetscCall(VecRestoreArray(x, &xx));
2375 
2376  LibmeshPetscCall(SNESSolve(snes, NULL, x));
2377  LibmeshPetscCall(VecGetArray(x, &xx));
2378  for (unsigned int i = 0; i < _block_size * _n_gaps; i++)
2379  root(i) = xx[i];
2380 
2381  LibmeshPetscCall(VecRestoreArray(x, &xx));
2382  LibmeshPetscCall(VecDestroy(&x));
2383  LibmeshPetscCall(VecDestroy(&r));
2384  LibmeshPetscCall(SNESDestroy(&snes));
2385  PetscFunctionReturn(LIBMESH_PETSC_SUCCESS);
2386 }
MPI_Info info
const PetscReal & _dtol
The divergence tolerance for the ksp linear solver.
PetscFunctionBegin
const PetscReal & _rtol
The relative convergence tolerance, (relative decrease) for the ksp linear solver.
const PetscInt & _maxit
The maximum number of iterations to use for the ksp linear solver.
const std::vector< double > x
Real root(std::function< Real(Real)> const &f, Real x1, Real x2, Real tol=1.0e-12)
Finds the root of a function using Brent&#39;s method.
Definition: BrentsMethod.C:66
problem information to be used in the PETSc problem
PetscFunctionReturn(LIBMESH_PETSC_SUCCESS)
friend PetscErrorCode formFunctionIW(SNES snes, Vec x, Vec f, void *info)
creates the residual function to be used in the PETCs snes context
const PetscReal & _atol
The absolute convergence tolerance for the ksp linear solver.

◆ populateDenseFromVector()

template<class T >
PetscErrorCode InterWrapper1PhaseProblem::populateDenseFromVector ( const Vec &  x,
T &  solution,
const unsigned int  first_axial_level,
const unsigned int  last_axial_level,
const unsigned int  cross_dimension 
)
protectedinherited

Definition at line 294 of file InterWrapper1PhaseProblem.h.

Referenced by InterWrapper1PhaseProblem::computeWijPrime(), and InterWrapper1PhaseProblem::implicitPetscSolve().

299 {
300  PetscErrorCode ierr;
301  PetscScalar * xx;
302 
304  ierr = VecGetArray(x, &xx);
305  CHKERRQ(ierr);
306  for (unsigned int iz = first_axial_level; iz < last_axial_level + 1; iz++)
307  {
308  unsigned int iz_ind = iz - first_axial_level;
309  for (unsigned int i_l = 0; i_l < cross_dimension; i_l++)
310  {
311  loc_solution(i_l, iz) = xx[iz_ind * cross_dimension + i_l];
312  }
313  }
314  ierr = VecRestoreArray(x, &xx);
315  CHKERRQ(ierr);
316  PetscFunctionReturn(LIBMESH_PETSC_SUCCESS);
317 }
PetscFunctionBegin
const std::vector< double > x
PetscFunctionReturn(LIBMESH_PETSC_SUCCESS)

◆ populateSolutionChan()

template<class T >
PetscErrorCode InterWrapper1PhaseProblem::populateSolutionChan ( const Vec &  x,
T &  solution,
const unsigned int  first_axial_level,
const unsigned int  last_axial_level,
const unsigned int  cross_dimension 
)
protectedinherited

Definition at line 423 of file InterWrapper1PhaseProblem.C.

428 {
429  PetscScalar * xx;
431  LibmeshPetscCall(VecGetArray(x, &xx));
432  Node * loc_node;
433  for (unsigned int iz = first_axial_level; iz < last_axial_level + 1; iz++)
434  {
435  unsigned int iz_ind = iz - first_axial_level;
436  for (unsigned int i_l = 0; i_l < cross_dimension; i_l++)
437  {
438  loc_node = _subchannel_mesh.getChannelNode(i_l, iz);
439  loc_solution.set(loc_node, xx[iz_ind * cross_dimension + i_l]);
440  }
441  }
442  PetscFunctionReturn(LIBMESH_PETSC_SUCCESS);
443 }
PetscFunctionBegin
const std::vector< double > x
const InterWrapperMesh & _subchannel_mesh
virtual Node * getChannelNode(unsigned int i_chan, unsigned iz) const =0
Get the inter-wrapper mesh node for a given channel index and elevation index.
PetscFunctionReturn(LIBMESH_PETSC_SUCCESS)

◆ populateSolutionGap()

template<class T >
PetscErrorCode InterWrapper1PhaseProblem::populateSolutionGap ( const Vec &  x,
T &  solution,
const unsigned int  first_axial_level,
const unsigned int  last_axial_level,
const unsigned int  cross_dimension 
)
protectedinherited

Definition at line 447 of file InterWrapper1PhaseProblem.C.

452 {
453  PetscScalar * xx;
455  LibmeshPetscCall(VecGetArray(x, &xx));
456  for (unsigned int iz = first_axial_level; iz < last_axial_level + 1; iz++)
457  {
458  unsigned int iz_ind = iz - first_axial_level;
459  for (unsigned int i_l = 0; i_l < cross_dimension; i_l++)
460  {
461  loc_solution(iz * cross_dimension + i_l) = xx[iz_ind * cross_dimension + i_l];
462  }
463  }
464  PetscFunctionReturn(LIBMESH_PETSC_SUCCESS);
465 }
PetscFunctionBegin
const std::vector< double > x
PetscFunctionReturn(LIBMESH_PETSC_SUCCESS)

◆ populateVectorFromDense()

template<class T >
PetscErrorCode InterWrapper1PhaseProblem::populateVectorFromDense ( Vec &  x,
const T &  solution,
const unsigned int  first_axial_level,
const unsigned int  last_axial_level,
const unsigned int  cross_dimension 
)
protectedinherited

Definition at line 376 of file InterWrapper1PhaseProblem.C.

Referenced by InterWrapper1PhaseProblem::computeSumWij(), InterWrapper1PhaseProblem::computeWij(), and InterWrapper1PhaseProblem::implicitPetscSolve().

381 {
382  PetscScalar * xx;
384  LibmeshPetscCall(VecGetArray(x, &xx));
385  for (unsigned int iz = first_axial_level; iz < last_axial_level; iz++)
386  {
387  unsigned int iz_ind = iz - first_axial_level;
388  for (unsigned int i_l = 0; i_l < cross_dimension; i_l++)
389  {
390  xx[iz_ind * cross_dimension + i_l] = loc_solution(i_l, iz);
391  }
392  }
393  LibmeshPetscCall(VecRestoreArray(x, &xx));
394  PetscFunctionReturn(LIBMESH_PETSC_SUCCESS);
395 }
PetscFunctionBegin
const std::vector< double > x
PetscFunctionReturn(LIBMESH_PETSC_SUCCESS)

◆ populateVectorFromHandle()

template<class T >
PetscErrorCode InterWrapper1PhaseProblem::populateVectorFromHandle ( Vec &  x,
const T &  solution,
const unsigned int  first_axial_level,
const unsigned int  last_axial_level,
const unsigned int  cross_dimension 
)
protectedinherited

Definition at line 399 of file InterWrapper1PhaseProblem.C.

404 {
405  PetscScalar * xx;
407  LibmeshPetscCall(VecGetArray(x, &xx));
408  for (unsigned int iz = first_axial_level; iz < last_axial_level + 1; iz++)
409  {
410  unsigned int iz_ind = iz - first_axial_level;
411  for (unsigned int i_l = 0; i_l < cross_dimension; i_l++)
412  {
413  auto * loc_node = _subchannel_mesh.getChannelNode(i_l, iz);
414  xx[iz_ind * cross_dimension + i_l] = loc_solution(loc_node);
415  }
416  }
417  LibmeshPetscCall(VecRestoreArray(x, &xx));
418  PetscFunctionReturn(LIBMESH_PETSC_SUCCESS);
419 }
PetscFunctionBegin
const std::vector< double > x
const InterWrapperMesh & _subchannel_mesh
virtual Node * getChannelNode(unsigned int i_chan, unsigned iz) const =0
Get the inter-wrapper mesh node for a given channel index and elevation index.
PetscFunctionReturn(LIBMESH_PETSC_SUCCESS)

◆ residualFunction()

libMesh::DenseVector< Real > InterWrapper1PhaseProblem::residualFunction ( int  iblock,
libMesh::DenseVector< Real solution 
)
protectedvirtualinherited

Computes Residual per gap for block iblock.

Definition at line 2291 of file InterWrapper1PhaseProblem.C.

Referenced by formFunctionIW().

2292 {
2293  unsigned int last_node = (iblock + 1) * _block_size;
2294  unsigned int first_node = iblock * _block_size;
2295  libMesh::DenseVector<Real> Wij_residual_vector(_n_gaps * _block_size, 0.0);
2296  // Assign the solution to the cross-flow matrix
2297  int i = 0;
2298  for (unsigned int iz = first_node + 1; iz < last_node + 1; iz++)
2299  {
2300  for (unsigned int i_gap = 0; i_gap < _n_gaps; i_gap++)
2301  {
2302  _Wij(i_gap, iz) = solution(i);
2303  i++;
2304  }
2305  }
2306 
2307  // Calculating sum of crossflows
2308  computeSumWij(iblock);
2309  // Solving axial flux
2310  computeMdot(iblock);
2311  // Calculation of turbulent Crossflow
2312  computeWijPrime(iblock);
2313  // Solving for Pressure Drop
2314  computeDP(iblock);
2315  // Solving for pressure
2316  computeP(iblock);
2317  // Solving cross fluxes
2318  computeWij(iblock);
2319 
2320  // Turn the residual matrix into a residual vector
2321  for (unsigned int iz = 0; iz < _block_size; iz++)
2322  {
2323  for (unsigned int i_gap = 0; i_gap < _n_gaps; i_gap++)
2324  {
2325  int i = _n_gaps * iz + i_gap; // column wise transfer
2326  Wij_residual_vector(i) = _Wij_residual_matrix(i_gap, iz);
2327  }
2328  }
2329  return Wij_residual_vector;
2330 }
virtual void computeSumWij(int iblock)
Computes net diversion crossflow per channel for block iblock.
virtual void computeDP(int iblock)
Computes Pressure Drop per channel for block iblock.
virtual void computeWijPrime(int iblock)
Computes turbulent crossflow per gap for block iblock.
virtual void computeMdot(int iblock)
Computes mass flow per channel for block iblock.
virtual void computeP(int iblock)
Computes Pressure per channel for block iblock.
virtual void computeWij(int iblock)
Computes cross fluxes for block iblock.
libMesh::DenseMatrix< Real > & _Wij
libMesh::DenseMatrix< Real > _Wij_residual_matrix

◆ solverSystemConverged()

bool InterWrapper1PhaseProblem::solverSystemConverged ( const unsigned int  )
overridevirtualinherited

Reimplemented from ExternalProblem.

Definition at line 310 of file InterWrapper1PhaseProblem.C.

311 {
312  return _converged;
313 }
bool _converged
Variable that informs whether we exited external solve with a converged solution or not...

◆ syncSolutions()

void InterWrapper1PhaseProblem::syncSolutions ( Direction  direction)
overridevirtualinherited

Implements ExternalProblem.

Definition at line 3078 of file InterWrapper1PhaseProblem.C.

3079 {
3080 }

◆ validParams()

InputParameters TriInterWrapper1PhaseProblem::validParams ( )
static

Definition at line 18 of file TriInterWrapper1PhaseProblem.C.

19 {
21  params.addClassDescription(
22  "Solver class for interwrapper of assemblies in a triangular-lattice arrangement");
23  return params;
24 }
static InputParameters validParams()
void addClassDescription(const std::string &doc_string)

Member Data Documentation

◆ _added_K

PetscScalar InterWrapper1PhaseProblem::_added_K = 0.0
protectedinherited

Added resistances for monolithic convergence.

Definition at line 282 of file InterWrapper1PhaseProblem.h.

Referenced by InterWrapper1PhaseProblem::implicitPetscSolve().

◆ _added_K_old

PetscScalar InterWrapper1PhaseProblem::_added_K_old = 1000.0
protectedinherited

◆ _amc_advective_derivative_mat

Mat InterWrapper1PhaseProblem::_amc_advective_derivative_mat
protectedinherited

Axial momentum conservation - advective (Eulerian) derivative.

Definition at line 227 of file InterWrapper1PhaseProblem.h.

Referenced by InterWrapper1PhaseProblem::cleanUp(), InterWrapper1PhaseProblem::computeDP(), and InterWrapper1PhaseProblem::InterWrapper1PhaseProblem().

◆ _amc_advective_derivative_rhs

Vec InterWrapper1PhaseProblem::_amc_advective_derivative_rhs
protectedinherited

◆ _amc_cross_derivative_mat

Mat InterWrapper1PhaseProblem::_amc_cross_derivative_mat
protectedinherited

Axial momentum conservation - cross flux derivative.

Definition at line 230 of file InterWrapper1PhaseProblem.h.

Referenced by InterWrapper1PhaseProblem::cleanUp(), InterWrapper1PhaseProblem::computeDP(), and InterWrapper1PhaseProblem::InterWrapper1PhaseProblem().

◆ _amc_cross_derivative_rhs

Vec InterWrapper1PhaseProblem::_amc_cross_derivative_rhs
protectedinherited

◆ _amc_friction_force_mat

Mat InterWrapper1PhaseProblem::_amc_friction_force_mat
protectedinherited

◆ _amc_friction_force_rhs

Vec InterWrapper1PhaseProblem::_amc_friction_force_rhs
protectedinherited

◆ _amc_gravity_rhs

Vec InterWrapper1PhaseProblem::_amc_gravity_rhs
protectedinherited

Axial momentum conservation - buoyancy force No implicit matrix.

Definition at line 237 of file InterWrapper1PhaseProblem.h.

Referenced by InterWrapper1PhaseProblem::cleanUp(), InterWrapper1PhaseProblem::computeDP(), and InterWrapper1PhaseProblem::InterWrapper1PhaseProblem().

◆ _amc_pressure_force_mat

Mat InterWrapper1PhaseProblem::_amc_pressure_force_mat
protectedinherited

◆ _amc_pressure_force_rhs

Vec InterWrapper1PhaseProblem::_amc_pressure_force_rhs
protectedinherited

◆ _amc_sys_mdot_mat

Mat InterWrapper1PhaseProblem::_amc_sys_mdot_mat
protectedinherited

◆ _amc_sys_mdot_rhs

Vec InterWrapper1PhaseProblem::_amc_sys_mdot_rhs
protectedinherited

◆ _amc_time_derivative_mat

Mat InterWrapper1PhaseProblem::_amc_time_derivative_mat
protectedinherited

◆ _amc_time_derivative_rhs

Vec InterWrapper1PhaseProblem::_amc_time_derivative_rhs
protectedinherited

◆ _amc_turbulent_cross_flows_mat

Mat InterWrapper1PhaseProblem::_amc_turbulent_cross_flows_mat
protectedinherited

Mass conservation - density time derivative No implicit matrix.

Axial momentum Axial momentum conservation - compute turbulent cross fluxes

Definition at line 221 of file InterWrapper1PhaseProblem.h.

Referenced by InterWrapper1PhaseProblem::cleanUp(), InterWrapper1PhaseProblem::computeWijPrime(), and InterWrapper1PhaseProblem::InterWrapper1PhaseProblem().

◆ _amc_turbulent_cross_flows_rhs

Vec InterWrapper1PhaseProblem::_amc_turbulent_cross_flows_rhs
protectedinherited

◆ _atol

const PetscReal& InterWrapper1PhaseProblem::_atol
protectedinherited

◆ _beta

const Real& InterWrapper1PhaseProblem::_beta
protectedinherited

Thermal diffusion coefficient used in turbulent crossflow.

Definition at line 127 of file InterWrapper1PhaseProblem.h.

Referenced by InterWrapper1PhaseProblem::computeWijPrime().

◆ _block_size

const unsigned int InterWrapper1PhaseProblem::_block_size
protectedinherited

◆ _cmc_advective_derivative_mat

Mat InterWrapper1PhaseProblem::_cmc_advective_derivative_mat
protectedinherited

Cross momentum conservation - advective (Eulerian) derivative.

Definition at line 250 of file InterWrapper1PhaseProblem.h.

Referenced by InterWrapper1PhaseProblem::cleanUp(), InterWrapper1PhaseProblem::computeWij(), and InterWrapper1PhaseProblem::InterWrapper1PhaseProblem().

◆ _cmc_advective_derivative_rhs

Vec InterWrapper1PhaseProblem::_cmc_advective_derivative_rhs
protectedinherited

◆ _cmc_friction_force_mat

Mat InterWrapper1PhaseProblem::_cmc_friction_force_mat
protectedinherited

◆ _cmc_friction_force_rhs

Vec InterWrapper1PhaseProblem::_cmc_friction_force_rhs
protectedinherited

◆ _cmc_pressure_force_mat

Mat InterWrapper1PhaseProblem::_cmc_pressure_force_mat
protectedinherited

◆ _cmc_pressure_force_rhs

Vec InterWrapper1PhaseProblem::_cmc_pressure_force_rhs
protectedinherited

◆ _cmc_sys_Wij_mat

Mat InterWrapper1PhaseProblem::_cmc_sys_Wij_mat
protectedinherited

◆ _cmc_sys_Wij_rhs

Vec InterWrapper1PhaseProblem::_cmc_sys_Wij_rhs
protectedinherited

◆ _cmc_time_derivative_mat

Mat InterWrapper1PhaseProblem::_cmc_time_derivative_mat
protectedinherited

Cross momentum Cross momentum conservation - time derivative.

Definition at line 247 of file InterWrapper1PhaseProblem.h.

Referenced by InterWrapper1PhaseProblem::cleanUp(), InterWrapper1PhaseProblem::computeWij(), and InterWrapper1PhaseProblem::InterWrapper1PhaseProblem().

◆ _cmc_time_derivative_rhs

Vec InterWrapper1PhaseProblem::_cmc_time_derivative_rhs
protectedinherited

◆ _cmc_Wij_channel_dummy

Vec InterWrapper1PhaseProblem::_cmc_Wij_channel_dummy
protectedinherited

◆ _compute_density

const bool InterWrapper1PhaseProblem::_compute_density
protectedinherited

Flag that activates or deactivates the calculation of density.

Definition at line 113 of file InterWrapper1PhaseProblem.h.

Referenced by InterWrapper1PhaseProblem::externalSolve(), and externalSolve().

◆ _compute_power

const bool InterWrapper1PhaseProblem::_compute_power
protectedinherited

Flag that informs if we need to solve the Enthalpy/Temperature equations or not.

Definition at line 117 of file InterWrapper1PhaseProblem.h.

Referenced by InterWrapper1PhaseProblem::externalSolve(), and externalSolve().

◆ _compute_viscosity

const bool InterWrapper1PhaseProblem::_compute_viscosity
protectedinherited

Flag that activates or deactivates the calculation of viscosity.

Definition at line 115 of file InterWrapper1PhaseProblem.h.

Referenced by InterWrapper1PhaseProblem::externalSolve(), and externalSolve().

◆ _converged

bool InterWrapper1PhaseProblem::_converged
protectedinherited

Variable that informs whether we exited external solve with a converged solution or not.

Definition at line 121 of file InterWrapper1PhaseProblem.h.

Referenced by InterWrapper1PhaseProblem::externalSolve(), externalSolve(), InterWrapper1PhaseProblem::InterWrapper1PhaseProblem(), and InterWrapper1PhaseProblem::solverSystemConverged().

◆ _correction_factor

PetscScalar InterWrapper1PhaseProblem::_correction_factor = 1.0
protectedinherited

◆ _CT

const Real& InterWrapper1PhaseProblem::_CT
protectedinherited

Turbulent modeling parameter used in axial momentum equation.

Definition at line 129 of file InterWrapper1PhaseProblem.h.

Referenced by computeDP(), and InterWrapper1PhaseProblem::computeDP().

◆ _DP_soln

std::unique_ptr<SolutionHandle> InterWrapper1PhaseProblem::_DP_soln
protectedinherited

◆ _dpz_error

Real TriInterWrapper1PhaseProblem::_dpz_error
protected

average relative error in pressure drop of channels

Definition at line 37 of file TriInterWrapper1PhaseProblem.h.

◆ _dt

const Real& InterWrapper1PhaseProblem::_dt
protectedinherited

◆ _dtol

const PetscReal& InterWrapper1PhaseProblem::_dtol
protectedinherited

◆ _fp

const SinglePhaseFluidProperties* InterWrapper1PhaseProblem::_fp
protectedinherited

◆ _g_grav

const Real InterWrapper1PhaseProblem::_g_grav
protectedinherited

Definition at line 100 of file InterWrapper1PhaseProblem.h.

Referenced by computeDP(), and InterWrapper1PhaseProblem::computeDP().

◆ _global_counter

PetscInt InterWrapper1PhaseProblem::_global_counter = 0
protectedinherited

No implicit matrix.

Definition at line 279 of file InterWrapper1PhaseProblem.h.

◆ _h_soln

std::unique_ptr<SolutionHandle> InterWrapper1PhaseProblem::_h_soln
protectedinherited

◆ _hc_added_heat_rhs

Vec InterWrapper1PhaseProblem::_hc_added_heat_rhs
protectedinherited

◆ _hc_advective_derivative_mat

Mat InterWrapper1PhaseProblem::_hc_advective_derivative_mat
protectedinherited

Enthalpy conservation - advective (Eulerian) derivative;.

Definition at line 268 of file InterWrapper1PhaseProblem.h.

Referenced by InterWrapper1PhaseProblem::cleanUp(), InterWrapper1PhaseProblem::computeh(), and InterWrapper1PhaseProblem::InterWrapper1PhaseProblem().

◆ _hc_advective_derivative_rhs

Vec InterWrapper1PhaseProblem::_hc_advective_derivative_rhs
protectedinherited

◆ _hc_cross_derivative_mat

Mat InterWrapper1PhaseProblem::_hc_cross_derivative_mat
protectedinherited

◆ _hc_cross_derivative_rhs

Vec InterWrapper1PhaseProblem::_hc_cross_derivative_rhs
protectedinherited

◆ _hc_sys_h_mat

Mat InterWrapper1PhaseProblem::_hc_sys_h_mat
protectedinherited

◆ _hc_sys_h_rhs

Vec InterWrapper1PhaseProblem::_hc_sys_h_rhs
protectedinherited

◆ _hc_time_derivative_mat

Mat InterWrapper1PhaseProblem::_hc_time_derivative_mat
protectedinherited

Enthalpy Enthalpy conservation - time derivative.

Definition at line 265 of file InterWrapper1PhaseProblem.h.

Referenced by InterWrapper1PhaseProblem::cleanUp(), InterWrapper1PhaseProblem::computeh(), and InterWrapper1PhaseProblem::InterWrapper1PhaseProblem().

◆ _hc_time_derivative_rhs

Vec InterWrapper1PhaseProblem::_hc_time_derivative_rhs
protectedinherited

◆ _implicit_bool

const bool InterWrapper1PhaseProblem::_implicit_bool
protectedinherited

◆ _interpolation_scheme

const MooseEnum InterWrapper1PhaseProblem::_interpolation_scheme
protectedinherited

The interpolation method used in constructing the systems.

Definition at line 145 of file InterWrapper1PhaseProblem.h.

Referenced by InterWrapper1PhaseProblem::computeInterpolationCoefficients().

◆ _kij

const Real& InterWrapper1PhaseProblem::_kij
protectedinherited

Definition at line 101 of file InterWrapper1PhaseProblem.h.

Referenced by InterWrapper1PhaseProblem::computeWij().

◆ _max_sumWij

PetscScalar InterWrapper1PhaseProblem::_max_sumWij
protectedinherited

◆ _max_sumWij_new

PetscScalar InterWrapper1PhaseProblem::_max_sumWij_new
protectedinherited

◆ _maxit

const PetscInt& InterWrapper1PhaseProblem::_maxit
protectedinherited

◆ _mc_axial_convection_mat

Mat InterWrapper1PhaseProblem::_mc_axial_convection_mat
protectedinherited

◆ _mc_axial_convection_rhs

Vec InterWrapper1PhaseProblem::_mc_axial_convection_rhs
protectedinherited

◆ _mc_sumWij_mat

Mat InterWrapper1PhaseProblem::_mc_sumWij_mat
protectedinherited

◆ _mdot_soln

std::unique_ptr<SolutionHandle> InterWrapper1PhaseProblem::_mdot_soln
protectedinherited

◆ _monolithic_thermal_bool

const bool InterWrapper1PhaseProblem::_monolithic_thermal_bool
protectedinherited

◆ _mu_soln

std::unique_ptr<SolutionHandle> InterWrapper1PhaseProblem::_mu_soln
protectedinherited

◆ _n_assemblies

const unsigned int InterWrapper1PhaseProblem::_n_assemblies
protectedinherited

◆ _n_blocks

unsigned int InterWrapper1PhaseProblem::_n_blocks
protectedinherited

◆ _n_cells

const unsigned int InterWrapper1PhaseProblem::_n_cells
protectedinherited

◆ _n_channels

const unsigned int InterWrapper1PhaseProblem::_n_channels
protectedinherited

◆ _n_gaps

const unsigned int InterWrapper1PhaseProblem::_n_gaps
protectedinherited

◆ _one

Real InterWrapper1PhaseProblem::_one
protectedinherited

Definition at line 109 of file InterWrapper1PhaseProblem.h.

◆ _P_out

const Real& InterWrapper1PhaseProblem::_P_out
protectedinherited

◆ _P_soln

std::unique_ptr<SolutionHandle> InterWrapper1PhaseProblem::_P_soln
protectedinherited

◆ _P_tol

const Real& InterWrapper1PhaseProblem::_P_tol
protectedinherited

Convergence tolerance for the pressure loop in external solve.

Definition at line 131 of file InterWrapper1PhaseProblem.h.

Referenced by InterWrapper1PhaseProblem::externalSolve(), and externalSolve().

◆ _pin_mesh_exist

const bool InterWrapper1PhaseProblem::_pin_mesh_exist
protectedinherited

◆ _prod

Vec InterWrapper1PhaseProblem::_prod
protectedinherited

◆ _prodp

Vec InterWrapper1PhaseProblem::_prodp
protectedinherited

◆ _q_prime_soln

std::unique_ptr<SolutionHandle> InterWrapper1PhaseProblem::_q_prime_soln
protectedinherited

◆ _rho_soln

std::unique_ptr<SolutionHandle> InterWrapper1PhaseProblem::_rho_soln
protectedinherited

◆ _rtol

const PetscReal& InterWrapper1PhaseProblem::_rtol
protectedinherited

◆ _S_flow_soln

std::unique_ptr<SolutionHandle> InterWrapper1PhaseProblem::_S_flow_soln
protectedinherited

◆ _segregated_bool

const bool InterWrapper1PhaseProblem::_segregated_bool
protectedinherited

◆ _staggered_pressure_bool

const bool InterWrapper1PhaseProblem::_staggered_pressure_bool
protectedinherited

Flag to define the usage of staggered or collocated pressure.

Definition at line 149 of file InterWrapper1PhaseProblem.h.

Referenced by InterWrapper1PhaseProblem::computeP(), and InterWrapper1PhaseProblem::computeWij().

◆ _subchannel_mesh

const InterWrapperMesh& InterWrapper1PhaseProblem::_subchannel_mesh
protectedinherited

◆ _SumWij_soln

std::unique_ptr<SolutionHandle> InterWrapper1PhaseProblem::_SumWij_soln
protectedinherited

◆ _T_maxit

const int& InterWrapper1PhaseProblem::_T_maxit
protectedinherited

Maximum iterations for the inner temperature loop.

Definition at line 135 of file InterWrapper1PhaseProblem.h.

Referenced by InterWrapper1PhaseProblem::externalSolve(), and externalSolve().

◆ _T_soln

std::unique_ptr<SolutionHandle> InterWrapper1PhaseProblem::_T_soln
protectedinherited

◆ _T_tol

const Real& InterWrapper1PhaseProblem::_T_tol
protectedinherited

Convergence tolerance for the temperature loop in external solve.

Definition at line 133 of file InterWrapper1PhaseProblem.h.

Referenced by InterWrapper1PhaseProblem::externalSolve(), and externalSolve().

◆ _Tpin_soln

std::unique_ptr<SolutionHandle> InterWrapper1PhaseProblem::_Tpin_soln
protectedinherited

◆ _TR

Real InterWrapper1PhaseProblem::_TR
protectedinherited

Flag that activates or deactivates the transient parts of the equations we solve by multiplication.

Definition at line 111 of file InterWrapper1PhaseProblem.h.

Referenced by computeDP(), InterWrapper1PhaseProblem::computeDP(), computeh(), InterWrapper1PhaseProblem::computeh(), InterWrapper1PhaseProblem::computeMdot(), and InterWrapper1PhaseProblem::computeWij().

◆ _tri_sch_mesh

const TriInterWrapperMesh& TriInterWrapper1PhaseProblem::_tri_sch_mesh
protected

Definition at line 38 of file TriInterWrapper1PhaseProblem.h.

Referenced by computeh().

◆ _w_perim_soln

std::unique_ptr<SolutionHandle> InterWrapper1PhaseProblem::_w_perim_soln
protectedinherited

◆ _Wij

libMesh::DenseMatrix<Real>& InterWrapper1PhaseProblem::_Wij
protectedinherited

◆ _Wij_old

libMesh::DenseMatrix<Real> InterWrapper1PhaseProblem::_Wij_old
protectedinherited

◆ _Wij_residual_matrix

libMesh::DenseMatrix<Real> InterWrapper1PhaseProblem::_Wij_residual_matrix
protectedinherited

◆ _Wij_vec

Vec InterWrapper1PhaseProblem::_Wij_vec
protectedinherited

◆ _WijPrime

libMesh::DenseMatrix<Real> InterWrapper1PhaseProblem::_WijPrime
protectedinherited

◆ _z_grid

std::vector<Real> InterWrapper1PhaseProblem::_z_grid
protectedinherited

The documentation for this class was generated from the following files: