https://mooseframework.inl.gov
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | Protected Attributes | Static Protected Attributes | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
TriSubChannel1PhaseProblem Class Referenceabstract

Triangular subchannel solver. More...

#include <TriSubChannel1PhaseProblem.h>

Inheritance diagram for TriSubChannel1PhaseProblem:
[legend]

Public Types

enum  Direction
 
enum  CoverageCheckMode
 
typedef DataFileName DataFileParameterType
 

Public Member Functions

 TriSubChannel1PhaseProblem (const InputParameters &params)
 
virtual ~TriSubChannel1PhaseProblem ()
 
virtual void externalSolve () override
 
virtual void syncSolutions (Direction direction) override
 
virtual bool solverSystemConverged (const unsigned int) override
 
virtual void initialSetup () override
 
const SCMHTCClosureBase * getDuctHTCClosure () const
 
const SCMHTCClosureBase * getPinHTCClosure () const
 
const SCMFrictionClosureBase * getFrictionClosure () const
 
Real getBulkReynoldsNumber () const
 
Real getBulkVelocity () const
 
Real getAddedHeatPin (unsigned int i_ch, unsigned int iz) const
 Return the added heat coming from the fuel pins.
 
Real getAddedHeatDuct (unsigned int i_ch, unsigned int iz) const
 Return the added heat coming from the duct.
 
const PostprocessorValue & getOutletPressure () const
 Get outlet pressure.
 
const SinglePhaseFluidProperties * getSinglePhaseFluidProperties () const
 Get fluid properties object.
 
bool isImplicit () const
 Whether the flow and enthalpy equations are solved implicitly.
 
PetscScalar interpolateFaceValue (PetscScalar topValue, PetscScalar botValue) const
 Interpolate a face value from its top and bottom nodes with the configured scheme.
 
virtual void solve (unsigned int nl_sys_num=0) override final
 
virtual void addExternalVariables ()
 
bool initialized () const
 
virtual libMesh::EquationSystems & es () override
 
virtual MooseMesh & mesh () override
 
virtual const MooseMesh & mesh () const override
 
const MooseMesh & mesh (bool use_displaced) const override
 
MooseMesh & mesh (bool use_displaced)
 
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 () const
 
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::CouplingMatrix * couplingMatrix (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
 
virtual bool checkResidualForNans () const override
 
void setCheckResidualForNans (bool check_residual_for_nans)
 
void trustUserCouplingMatrix ()
 
std::vector< std::pair< MooseVariableFieldBase *, MooseVariableFieldBase * > > & couplingEntries (const THREAD_ID tid, const unsigned int nl_sys_num)
 
std::vector< std::pair< MooseVariableFieldBase *, MooseVariableFieldBase * > > & nonlocalCouplingEntries (const THREAD_ID tid, const unsigned int nl_sys_num)
 
const std::vector< std::pair< MooseVariableFieldBase *, MooseVariableScalar * > > & fieldScalarCouplingEntries (const THREAD_ID tid, const unsigned int nl_sys_num) const
 
virtual bool hasVariable (const std::string &var_name) const override
 
bool hasSolverVariable (const std::string &var_name) const
 
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
 
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 =0
 
virtual 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)
 
MooseVariableFieldBase & getActualFieldVariable (const THREAD_ID tid, const std::string &var_name) override
 
virtual MooseVariable & getStandardVariable (const THREAD_ID tid, const std::string &var_name) override
 
virtual VectorMooseVariable & getVectorVariable (const THREAD_ID tid, const std::string &var_name) override
 
virtual ArrayMooseVariable & getArrayVariable (const THREAD_ID tid, const std::string &var_name) override
 
virtual bool hasScalarVariable (const std::string &var_name) const override
 
virtual MooseVariableScalar & getScalarVariable (const THREAD_ID tid, const std::string &var_name) override
 
virtual libMesh::System & getSystem (const std::string &var_name) override
 
const RestartableEquationSystems & getRestartableEquationSystems () const
 
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 Assembly & assembly (const THREAD_ID tid, const unsigned int sys_num) override
 
virtual const Assembly & assembly (const THREAD_ID tid, const unsigned int sys_num) const override
 
Moose::Kokkos::Assembly & kokkosAssembly ()
 
const Moose::Kokkos::Assembly & kokkosAssembly () const
 
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 prepareAssemblyNeighbor (const THREAD_ID tid)
 
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 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
 
void initKokkos ()
 
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 Real & time () const
 
virtual Real & timeOld () const
 
virtual Real & timeOlder () const
 
virtual int & timeStep () const
 
virtual Real & dt () const
 
virtual Real & dtOld () 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 ()
 
void skipNextForwardSolutionCopyToOld ()
 
virtual void advanceState ()
 
virtual void restoreSolutions ()
 
void backupGeometricSearchState ()
 
void restoreGeometricSearchState ()
 
virtual void saveOldSolutions ()
 
virtual void restoreOldSolutions ()
 
void needSolutionState (unsigned int oldest_needed, Moose::SolutionIterationType iteration_type)
 
bool hasSolutionState (unsigned int state, Moose::SolutionIterationType iteration_type) const
 
virtual void outputStep (ExecFlagType type)
 
virtual void postExecute ()
 
void forceOutput ()
 
virtual void initPetscOutputAndSomeSolverSettings ()
 
Moose::PetscSupport::PetscOptions & getPetscOptions ()
 
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 Function & getFunction (const std::string &name, const THREAD_ID tid=0)
 
virtual void addKokkosFunction (const std::string &type, const std::string &name, InputParameters &parameters)
 
virtual bool hasKokkosFunction (const std::string &name) const
 
virtual Moose::Kokkos::Function getKokkosFunction (const std::string &name)
 
T & getKokkosFunction (const std::string &name)
 
virtual void addMeshDivision (const std::string &type, const std::string &name, InputParameters &params)
 
MeshDivision & getMeshDivision (const std::string &name, const THREAD_ID tid=0) const
 
virtual void addConvergence (const std::string &type, const std::string &name, InputParameters &parameters)
 
virtual Convergence & getConvergence (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
 
bool needToAddDefaultMultiAppFixedPointConvergence () const
 
bool needToAddDefaultSteadyStateConvergence () const
 
void setNeedToAddDefaultNonlinearConvergence ()
 
void setNeedToAddDefaultMultiAppFixedPointConvergence ()
 
void setNeedToAddDefaultSteadyStateConvergence ()
 
bool hasSetMultiAppFixedPointConvergenceName () const
 
bool hasSetSteadyStateConvergenceName () const
 
virtual void addDefaultNonlinearConvergence (const InputParameters &params)
 
virtual bool onlyAllowDefaultNonlinearConvergence () const
 
void addDefaultMultiAppFixedPointConvergence (const InputParameters &params)
 
void addDefaultSteadyStateConvergence (const InputParameters &params)
 
virtual void addLineSearch (const InputParameters &)
 
virtual void lineSearch ()
 
LineSearch * getLineSearch () override
 
virtual void addDistribution (const std::string &type, const std::string &name, InputParameters &parameters)
 
virtual bool hasDistribution (const std::string &name) const
 
virtual Distribution & getDistribution (const std::string &name)
 
virtual void addSampler (const std::string &type, const std::string &name, InputParameters &parameters)
 
virtual Sampler & getSampler (const std::string &name, const THREAD_ID tid=0)
 
NonlinearSystemBase & getNonlinearSystemBase (const unsigned int sys_num)
 
const NonlinearSystemBase & getNonlinearSystemBase (const unsigned int sys_num) const
 
void setCurrentNonlinearSystem (const unsigned int nl_sys_num)
 
NonlinearSystemBase & currentNonlinearSystem ()
 
const NonlinearSystemBase & currentNonlinearSystem () const
 
virtual const SystemBase & systemBaseNonlinear (const unsigned int sys_num) const override
 
virtual SystemBase & systemBaseNonlinear (const unsigned int sys_num) override
 
virtual const SystemBase & systemBaseSolver (const unsigned int sys_num) const override
 
virtual SystemBase & systemBaseSolver (const unsigned int sys_num) override
 
virtual const SystemBase & systemBaseAuxiliary () const override
 
virtual SystemBase & systemBaseAuxiliary () override
 
virtual NonlinearSystem & getNonlinearSystem (const unsigned int sys_num)
 
virtual const SystemBase & getSystemBase (const unsigned int sys_num) const
 
virtual SystemBase & getSystemBase (const unsigned int sys_num)
 
SystemBase & getSystemBase (const std::string &sys_name)
 
LinearSystem & getLinearSystem (unsigned int sys_num)
 
const LinearSystem & getLinearSystem (unsigned int sys_num) const
 
SolverSystem & getSolverSystem (unsigned int sys_num)
 
const SolverSystem & getSolverSystem (unsigned int sys_num) const
 
void setCurrentLinearSystem (unsigned int sys_num)
 
LinearSystem & currentLinearSystem ()
 
const LinearSystem & currentLinearSystem () const
 
virtual const SystemBase & systemBaseLinear (unsigned int sys_num) const override
 
virtual SystemBase & systemBaseLinear (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 addKokkosKernel (const std::string &kernel_name, const std::string &name, InputParameters &parameters)
 
virtual void addKokkosNodalKernel (const std::string &kernel_name, const std::string &name, InputParameters &parameters)
 
virtual void addKokkosBoundaryCondition (const std::string &bc_name, const std::string &name, InputParameters &parameters)
 
virtual void addKokkosLinearFVKernel (const std::string &kernel_name, const std::string &name, InputParameters &parameters)
 
virtual void addKokkosLinearFVBC (const std::string &bc_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 addElementalFieldVariable (const std::string &var_type, const std::string &var_name, InputParameters &params)
 
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)
 
virtual void addKokkosAuxKernel (const std::string &kernel_name, const std::string &name, InputParameters &parameters)
 
AuxiliarySystem & getAuxiliarySystem ()
 
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, const std::optional< std::set< VariableName > > &target_vars=std::nullopt)
 
void projectFunctionOnCustomRange (ConstElemRange &elem_range, Number(*func)(const Point &, const libMesh::Parameters &, const std::string &, const std::string &), Gradient(*func_grad)(const Point &, const libMesh::Parameters &, const std::string &, const std::string &), const libMesh::Parameters &params, const std::vector< VariableName > &target_vars)
 
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)
 
virtual void addKokkosMaterial (const std::string &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 reinitMaterialsFaceOnBoundary (const BoundaryID boundary_id, const SubdomainID blk_id, const THREAD_ID tid, const bool swap_stateful=true, const std::deque< MaterialBase * > *const reinit_mats=nullptr)
 
void reinitMaterialsNeighborOnBoundary (const BoundaryID boundary_id, const SubdomainID blk_id, const THREAD_ID tid, const bool swap_stateful=true, const std::deque< MaterialBase * > *const 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)
 
void prepareKokkosMaterials (const std::unordered_set< unsigned int > &consumer_needed_mat_props)
 
void reinitKokkosMaterials ()
 
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)
 
virtual void addKokkosPostprocessor (const std::string &pp_name, const std::string &name, InputParameters &parameters)
 
virtual void addKokkosVectorPostprocessor (const std::string &pp_name, const std::string &name, InputParameters &parameters)
 
virtual void addKokkosReporter (const std::string &type, const std::string &name, InputParameters &parameters)
 
const ReporterData & getReporterData () const
 
ReporterData & getReporterData (ReporterData::WriteKey)
 
virtual std::vector< std::shared_ptr< UserObject > > addUserObject (const std::string &user_object_name, const std::string &name, InputParameters &parameters)
 
T & getUserObject (const std::string &name, unsigned int tid=0) const
 
const UserObject & getUserObjectBase (const std::string &name, const THREAD_ID tid=0) const
 
bool hasUserObject (const std::string &name) const
 
virtual void addKokkosUserObject (const std::string &user_object_name, const std::string &name, InputParameters &parameters)
 
const T & getKokkosUserObject (const std::string &name) const
 
bool hasKokkosUserObject (const std::string &name) const
 
void checkUserObjectNameCollision (const std::string &name, const std::string &type) const
 
const Positions & getPositionsObject (const std::string &name) const
 
virtual void addFVInterpolationMethod (const std::string &method_type, const std::string &name, InputParameters &parameters)
 
virtual void addFVGradientMethod (const std::string &method_type, const std::string &name, InputParameters &parameters)
 
FVGradientMethod & getFVGradientMethod (const GradientMethodName &name, const THREAD_ID tid=0)
 
const FVGradientMethod & getFVGradientMethod (const GradientMethodName &name, const THREAD_ID tid=0) const
 
bool hasFVGradientMethod (const GradientMethodName &name) const
 
const FVInterpolationMethod & getFVInterpolationMethod (const InterpolationMethodName &name, const THREAD_ID tid=0) const
 
const FVFaceInterpolationMethod & getFVFaceInterpolationMethod (const InterpolationMethodName &name, const THREAD_ID tid=0) const
 
const FVAdvectedInterpolationMethod & getFVAdvectedInterpolationMethod (const InterpolationMethodName &name, const THREAD_ID tid=0) const
 
bool hasFVInterpolationMethod (const InterpolationMethodName &name) const
 
bool hasPostprocessorValueByName (const PostprocessorName &name) const
 
const Postprocessor & getPostprocessorObjectByName (const PostprocessorName &object_name, const THREAD_ID tid=0) const
 
const PostprocessorValue & getPostprocessorValueByName (const PostprocessorName &name, std::size_t t_index=0) const
 
virtual const PostprocessorValue & getPostprocessorValueByName (const PostprocessorName &name) const
 
void setPostprocessorValueByName (const PostprocessorName &name, const PostprocessorValue &value, std::size_t t_index=0)
 
bool hasPostprocessor (const std::string &name) const
 
bool hasPostprocessor (const std::string &param_name, const unsigned int index=0) const
 
const VectorPostprocessorValue & getVectorPostprocessorValueByName (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 VectorPostprocessor & getVectorPostprocessorObjectByName (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< MultiApp > getMultiApp (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, const MultiAppName &source_app="")
 
bool execMultiApps (ExecFlagType type, bool auto_advance=true)
 
unsigned int numConcurrentMultiApps () const
 
void partitionConcurrentMultiApps ()
 
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)
 
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)
 
virtual 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, 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)
 
void appendConstantModes (const std::vector< VariableName > &vars, const std::string &prefix, 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 DisplacedProblem > getDisplacedProblem () const
 
virtual std::shared_ptr< DisplacedProblem > getDisplacedProblem ()
 
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 Mortar3DSubpatchPlane mortar_3d_subpatch_plane, const MooseEnum &triangulation, const bool triangulate_triangles, const Mortar3DQuadraturePointMapping mortar_3d_qp_mapping=Mortar3DQuadraturePointMapping::NORMAL_PROJECTION)
 
const std::unordered_map< std::pair< BoundaryID, BoundaryID >, MortarInterfaceConfig > & getMortarInterfaces (bool on_displaced) const
 
virtual void possiblyRebuildGeomSearchPatches ()
 
virtual GeometricSearchData & geomSearchData () override
 
void setRestartFile (const std::string &file_name)
 
const MaterialPropertyRegistry & getMaterialPropertyRegistry () const
 
const InitialConditionWarehouse & getInitialConditionWarehouse () const
 
const FVInitialConditionWarehouse & getFVInitialConditionWarehouse () const
 
SolverParams & solverParams (unsigned int solver_sys_num=0)
 
const SolverParams & solverParams (unsigned int solver_sys_num=0) const
 
Adaptivity & adaptivity ()
 
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< XFEMInterface > getXFEM ()
 
bool haveXFEM ()
 
virtual bool updateMeshXFEM ()
 
virtual bool allowMeshContractionAfterMeshChanged () const
 
virtual void meshChanged (bool intermediate_change, bool contract_mesh, bool clean_refinement_flags)
 
void notifyWhenMeshChanges (MeshChangedInterface *mci)
 
void notifyWhenMeshDisplaces (MeshDisplacedInterface *mdi)
 
void initElementStatefulProps (const libMesh::ConstElemRange &elem_range, const bool threaded)
 
void initKokkosStatefulProps ()
 
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 MooseObjectWarehouse< Function > & getFunctionWarehouse ()
 
const MaterialWarehouse & getMaterialWarehouse () const
 
const MaterialWarehouse & getRegularMaterialsWarehouse () const
 
const MaterialWarehouse & getDiscreteMaterialWarehouse () const
 
const MaterialWarehouse & getInterfaceMaterialsWarehouse () const
 
const MaterialWarehouse & getKokkosMaterialsWarehouse () const
 
std::shared_ptr< MaterialBase > getMaterial (std::string name, Moose::MaterialDataType type, const THREAD_ID tid=0, bool no_warn=false)
 
MaterialData & getMaterialData (Moose::MaterialDataType type, const THREAD_ID tid=0, const MooseObject *object=nullptr) const
 
MaterialData & getKokkosMaterialData (Moose::MaterialDataType type, const MooseObject *object=nullptr) const
 
const std::set< const MooseObject * > & getMaterialPropertyStorageConsumers (Moose::MaterialDataType type) const
 
const std::set< const MooseObject * > & getKokkosMaterialPropertyStorageConsumers (Moose::MaterialDataType type) const
 
bool restoreOriginalNonzeroPattern () const
 
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 Executor & getExecutor (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
 
void needsPreviousMultiAppFixedPointIterationSolution (bool needed, const unsigned int solver_sys_num)
 
bool needsPreviousMultiAppFixedPointIterationSolution (const unsigned int solver_sys_num) const
 
void needsPreviousMultiAppFixedPointIterationAuxiliary (bool state)
 
bool needsPreviousMultiAppFixedPointIterationAuxiliary () const
 
void needsPreviousMultiSystemFixedPointIterationSolution (bool needed, const unsigned int solver_sys_num)
 
bool needsPreviousMultiSystemFixedPointIterationSolution (const unsigned int solver_sys_num) const
 
void needsPreviousMultiSystemFixedPointIterationAuxiliary (bool state)
 
bool needsPreviousMultiSystemFixedPointIterationAuxiliary () 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 &)
 
TheWarehouse & theWarehouse () 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 shouldSolve () const
 
const MortarInterfaceWarehouse & mortarData () const
 
MortarInterfaceWarehouse & mortarData ()
 
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)
 
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
 
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
 
virtual void reinitNeighborSurfaceElemRef (const Elem *neighbor_elem, const std::vector< Point > &pts, const THREAD_ID tid=0) override
 
bool fvBCsIntegrityCheck () const
 
void fvBCsIntegrityCheck (bool fv_bcs_integrity_check)
 
bool sideUOInterfaceMatPropIntegrityCheck () const
 
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
 
bool hasLinearConvergenceObjects () const
 
void setNonlinearConvergenceNames (const std::vector< ConvergenceName > &convergence_names)
 
void setLinearConvergenceNames (const std::vector< ConvergenceName > &convergence_names)
 
void setMultiAppFixedPointConvergenceName (const ConvergenceName &convergence_name)
 
void setSteadyStateConvergenceName (const ConvergenceName &convergence_name)
 
const std::vector< ConvergenceName > & getNonlinearConvergenceNames () const
 
const std::vector< ConvergenceName > & getLinearConvergenceNames () const
 
const ConvergenceName & getMultiAppFixedPointConvergenceName () const
 
const ConvergenceName & getSteadyStateConvergenceName () const
 
void computingScalingJacobian (bool computing_scaling_jacobian)
 
bool computingScalingJacobian () const override final
 
void computingScalingResidual (bool computing_scaling_residual)
 
bool computingScalingResidual () const override final
 
MooseAppCoordTransform & coordTransform ()
 
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
 
bool getFailNextSystemConvergenceCheck () const
 
void setFailNextNonlinearConvergenceCheck ()
 
void setFailNextSystemConvergenceCheck ()
 
void resetFailNextNonlinearConvergenceCheck ()
 
void resetFailNextSystemConvergenceCheck ()
 
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 std::vector< SolverSystemName > & getSolverSystemNames () const
 
virtual const libMesh::CouplingMatrix & nonlocalCouplingMatrix (const unsigned i) const override
 
virtual bool checkNonlocalCouplingRequirement () const override
 
virtual Moose::FEBackend feBackend () const
 
void createTagMatrices (CreateTaggedMatrixKey)
 
bool useHashTableMatrixAssembly () const
 
bool hasKokkosObjects () const
 
bool hasKokkosResidualObjects () const
 
void addKokkosMeshInitializationHook (std::function< void()> function)
 
const bool & currentlyComputingResidual () const
 
THREAD_ID numThreads () const
 
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 VectorTag & getVectorTag (const TagID tag_id) const
 
std::vector< VectorTag > getVectorTags (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 DiracKernelInfo & diracKernelInfo ()
 
void reinitNodes (const std::vector< dof_id_type > &nodes, const THREAD_ID tid)
 
void reinitNodesNeighbor (const std::vector< dof_id_type > &nodes, const THREAD_ID tid)
 
void reinitNeighborLowerDElem (const Elem *elem, const THREAD_ID tid=0)
 
void reinitMortarElem (const Elem *elem, const THREAD_ID tid=0)
 
void reinitGeomSearch ()
 
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< SubdomainID > getMaterialPropertyBlocks (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< BoundaryID > getMaterialPropertyBoundaryIDs (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 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 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 setChainControlDataOutput (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
 
MooseVariableFEBase & getVariableHelper (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 ConsoleStream & console () const
 
virtual bool enabled () const
 
std::shared_ptr< MooseObject > getSharedPtr ()
 
std::shared_ptr< const MooseObject > getSharedPtr () const
 
bool isKokkosObject () const
 
MooseApp & getMooseApp () const
 
const std::string & type () const
 
const std::string & name () const
 
std::string typeAndName () const
 
MooseObjectParameterName uniqueParameterName (const std::string &parameter_name) const
 
MooseObjectName uniqueName () const
 
const InputParameters & parameters () const
 
const hit::Node * getHitNode () const
 
bool hasBase () const
 
const std::string & getBase () 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 * queryParam (const std::string &name) const
 
const T & getRenamedParam (const std::string &old_name, const std::string &new_name) const
 
T getCheckedPointerParam (const std::string &name, const std::string &error_string="") const
 
bool isParamValid (const std::string &name) const
 
bool isParamSetByUser (const std::string &name) const
 
void connectControllableParams (const std::string &parameter, const std::string &object_type, const std::string &object_name, const std::string &object_parameter) const
 
void paramError (const std::string &param, Args... args) const
 
void paramWarning (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
 
std::string messagePrefix (const bool hit_prefix=true) const
 
std::string errorPrefix (const std::string &) const
 
void mooseError (Args &&... args) const
 
void mooseDocumentedError (const std::string &repo_name, const unsigned int issue_num, Args &&... args) const
 
void mooseErrorNonPrefixed (Args &&... args) const
 
void mooseWarning (Args &&... args) const
 
void mooseWarning (Args &&... args) const
 
void mooseWarningNonPrefixed (Args &&... args) const
 
void mooseWarningNonPrefixed (Args &&... args) const
 
void mooseDeprecated (Args &&... args) const
 
void mooseDeprecated (Args &&... args) const
 
void mooseDeprecatedNoTrace (Args &&... args) const
 
void mooseInfo (Args &&... args) const
 
void callMooseError (std::string msg, const bool with_prefix, const hit::Node *node=nullptr, const bool show_trace=true) 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
 
PerfGraph & perfGraph ()
 
const libMesh::ConstElemRange & getEvaluableElementRange ()
 
const libMesh::ConstElemRange & getEvaluableElementRange ()
 
const libMesh::ConstElemRange & getNonlinearEvaluableElementRange ()
 
const libMesh::ConstElemRange & getNonlinearEvaluableElementRange ()
 
const libMesh::ConstElemRange & getCurrentAlgebraicElementRange ()
 
const libMesh::ConstElemRange & getCurrentAlgebraicElementRange ()
 
const libMesh::ConstNodeRange & getCurrentAlgebraicNodeRange ()
 
const libMesh::ConstNodeRange & getCurrentAlgebraicNodeRange ()
 
const ConstBndNodeRange & getCurrentAlgebraicBndNodeRange ()
 
const ConstBndNodeRange & getCurrentAlgebraicBndNodeRange ()
 
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)
 
Moose::Kokkos::Array< Moose::Kokkos::System > & getKokkosSystems ()
 
const Moose::Kokkos::Array< Moose::Kokkos::System > & getKokkosSystems () const
 
Moose::Kokkos::Array< Moose::Kokkos::System > & getKokkosSystems ()
 
const Moose::Kokkos::Array< Moose::Kokkos::System > & getKokkosSystems () const
 
Moose::Kokkos::Array< Moose::Kokkos::FESystem > & getKokkosFESystems ()
 
const Moose::Kokkos::Array< Moose::Kokkos::FESystem > & getKokkosFESystems () const
 
Moose::Kokkos::Array< Moose::Kokkos::FESystem > & getKokkosFESystems ()
 
const Moose::Kokkos::Array< Moose::Kokkos::FESystem > & getKokkosFESystems () const
 
Moose::Kokkos::System & getKokkosSystem (const unsigned int sys_num)
 
const Moose::Kokkos::System & getKokkosSystem (const unsigned int sys_num) const
 
Moose::Kokkos::System & getKokkosSystem (const unsigned int sys_num)
 
const Moose::Kokkos::System & getKokkosSystem (const unsigned int sys_num) const
 
Moose::Kokkos::FESystem & getKokkosFESystem (const unsigned int sys_num)
 
const Moose::Kokkos::FESystem & getKokkosFESystem (const unsigned int sys_num) const
 
Moose::Kokkos::FESystem & getKokkosFESystem (const unsigned int sys_num)
 
const Moose::Kokkos::FESystem & getKokkosFESystem (const unsigned int sys_num) const
 
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 AutomaticMortarGeneration & getMortarInterface (const std::pair< BoundaryID, BoundaryID > &primary_secondary_boundary_pair, const std::pair< SubdomainID, SubdomainID > &primary_secondary_subdomain_pair, bool on_displaced) const
 
AutomaticMortarGeneration & getMortarInterface (const std::pair< BoundaryID, BoundaryID > &primary_secondary_boundary_pair, const std::pair< SubdomainID, SubdomainID > &primary_secondary_subdomain_pair, bool on_displaced)
 
const AutomaticMortarGeneration & getMortarInterface (const std::pair< BoundaryID, BoundaryID > &primary_secondary_boundary_pair, const std::pair< SubdomainID, SubdomainID > &primary_secondary_subdomain_pair, bool on_displaced) const
 
AutomaticMortarGeneration & getMortarInterface (const std::pair< BoundaryID, BoundaryID > &primary_secondary_boundary_pair, const std::pair< SubdomainID, SubdomainID > &primary_secondary_subdomain_pair, bool on_displaced)
 
const MaterialPropertyStorage & getMaterialPropertyStorage ()
 
const MaterialPropertyStorage & getMaterialPropertyStorage ()
 
const MaterialPropertyStorage & getBndMaterialPropertyStorage ()
 
const MaterialPropertyStorage & getBndMaterialPropertyStorage ()
 
const MaterialPropertyStorage & getNeighborMaterialPropertyStorage ()
 
const MaterialPropertyStorage & getNeighborMaterialPropertyStorage ()
 
Moose::Kokkos::MaterialPropertyStorage & getKokkosMaterialPropertyStorage ()
 
Moose::Kokkos::MaterialPropertyStorage & getKokkosMaterialPropertyStorage ()
 
Moose::Kokkos::MaterialPropertyStorage & getKokkosBndMaterialPropertyStorage ()
 
Moose::Kokkos::MaterialPropertyStorage & getKokkosBndMaterialPropertyStorage ()
 
Moose::Kokkos::MaterialPropertyStorage & getKokkosNeighborMaterialPropertyStorage ()
 
Moose::Kokkos::MaterialPropertyStorage & getKokkosNeighborMaterialPropertyStorage ()
 
const MooseObjectWarehouse< Indicator > & getIndicatorWarehouse ()
 
const MooseObjectWarehouse< Indicator > & getIndicatorWarehouse ()
 
const MooseObjectWarehouse< InternalSideIndicatorBase > & getInternalSideIndicatorWarehouse ()
 
const MooseObjectWarehouse< InternalSideIndicatorBase > & 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 needInternalNeighborSideMaterial (SubdomainID subdomain_id, const THREAD_ID tid)
 
bool needInternalNeighborSideMaterial (SubdomainID subdomain_id, const THREAD_ID tid)
 
const ExecFlagType & getCurrentExecuteOnFlag () const
 
const ExecFlagType & getCurrentExecuteOnFlag () 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
 
bool isDefaultPostprocessorValue (const std::string &param_name, const unsigned int index=0) const
 
bool hasPostprocessorByName (const PostprocessorName &name) const
 
std::size_t coupledPostprocessors (const std::string &param_name) const
 
const PostprocessorName & getPostprocessorName (const std::string &param_name, const unsigned int index=0) const
 
const PostprocessorValue & getPostprocessorValue (const std::string &param_name, const unsigned int index=0) const
 
const PostprocessorValue & getPostprocessorValue (const std::string &param_name, const unsigned int index=0) const
 
const PostprocessorValue & getPostprocessorValueOld (const std::string &param_name, const unsigned int index=0) const
 
const PostprocessorValue & getPostprocessorValueOld (const std::string &param_name, const unsigned int index=0) const
 
const PostprocessorValue & getPostprocessorValueOlder (const std::string &param_name, const unsigned int index=0) const
 
const PostprocessorValue & getPostprocessorValueOlder (const std::string &param_name, const unsigned int index=0) const
 
const PostprocessorValue & getPostprocessorValueOldByName (const PostprocessorName &name) const
 
const PostprocessorValue & getPostprocessorValueOldByName (const PostprocessorName &name) const
 
const PostprocessorValue & getPostprocessorValueOlderByName (const PostprocessorName &name) const
 
const PostprocessorValue & getPostprocessorValueOlderByName (const PostprocessorName &name) const
 

Static Public Member Functions

static InputParameters validParams ()
 
static void callMooseError (MooseApp *const app, const InputParameters &params, std::string msg, const bool with_prefix, const hit::Node *node, const bool show_trace=true)
 
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

struct SubChannel1PhaseProblem::FrictionStruct _friction_args
 
struct SubChannel1PhaseProblem::NusseltStruct _nusselt_args
 
const PostprocessorValue & _P_out
 Outlet pressure postprocessor value.
 
const SinglePhaseFluidProperties * _fp
 Non-owning pointer to fluid properties user object.
 
std::map< std::string, std::vector< dof_id_type > > _var_dof_map
 
 usingCombinedWarningSolutionWarnings
 
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
 

Static Public Attributes

static const std::string type_param
 
static const std::string name_param
 
static const std::string unique_name_param
 
static const std::string app_param
 
static const std::string moose_base_param
 
static const std::string kokkos_object_param
 

Protected Member Functions

virtual void initializeSolution () override
 Function to initialize the solution & geometry fields.
 
virtual Real computeAddedHeatPin (unsigned int i_ch, unsigned int iz) const override
 Pure virtual: daughters provide different implementations.
 
virtual Real getSubChannelPeripheralDuctWidth (unsigned int i_ch) const override
 Function that computes the width of the duct cell that the peripheral subchannel i_ch sees.
 
virtual void computeh (int iblock) override
 Computes Enthalpy per channel for block iblock.
 
PetscErrorCode cleanUp ()
 
virtual Real computeAddedHeatDuct (unsigned int i_ch, unsigned int iz) const
 Non-pure: implemented in the base (or override in a child if needed)
 
void computeWijFromSolve (int iblock)
 Computes diversion crossflow per gap for block iblock.
 
void computeSumWij (int iblock)
 Computes net diversion crossflow per channel for block iblock.
 
void computeMdot (int iblock)
 Computes mass flow per channel for block iblock.
 
void computeWijPrime (int iblock)
 Computes turbulent crossflow per gap for block iblock.
 
Real computeMixingParameter (unsigned int i_gap, unsigned int iz) const
 Computes and validates the turbulent mixing parameter.
 
Real computeSweepFlowMixingParameter (unsigned int i_gap, unsigned int iz) const
 Computes and validates the sweep-flow mixing parameter.
 
void computeDP (int iblock)
 Computes Pressure Drop per channel for block iblock.
 
void computeP (int iblock)
 Computes Pressure per channel for block iblock.
 
Real computeT (int iblock)
 Computes and relaxes Temperature per channel for block iblock.
 
void computeRho (int iblock)
 Computes Density per channel for block iblock.
 
void computeMu (int iblock)
 Computes Viscosity per channel for block iblock.
 
void computeWijResidual (int iblock)
 Computes Residual Matrix based on the lateral momentum conservation equation for block iblock.
 
libMesh::DenseVector< Real > residualFunction (int iblock, libMesh::DenseVector< Real > solution)
 Computes Residual Vector based on the lateral momentum conservation equation for block iblock & updates flow variables based on current crossflow solution.
 
PetscErrorCode petscSnesSolver (int iblock, const libMesh::DenseVector< Real > &solution, libMesh::DenseVector< Real > &root)
 Computes solution of nonlinear equation using snes and provided a residual in a formFunction.
 
PetscErrorCode implicitPetscSolve (int iblock)
 Computes implicit solve using PetSc.
 
PetscErrorCode addCrossflowDamping (Mat M_ww, Mat M_wp, Vec b_w, Vec Wij_iter, int iblock, PetscScalar &inv_dtau)
 Add the pseudo-time damping added_K_ij (Wij - Wij_iter) to the cross-momentum equation of the monolithic solve, M_ww Wij + M_wp P + added_K_ij (Wij - Wij_iter) = b_w, where Wij is the crossflow the monolithic solve computes and Wij_iter the crossflow of the current outer iterate.
 
PetscErrorCode shiftCrossflowDamping (Mat M_ww, Vec b_w, Vec Wij_iter, PetscScalar inv_dtau)
 Add the damping of the inverse pseudo-time step inv_dtau to the cross-momentum equation: inv_dtau L_ij S_ij rho* on the diagonal of M_ww and inv_dtau L_ij S_ij rho* Wij_iter on b_w.
 
void detectDeformation ()
 Detects whether pin diameter or duct displacement fields require geometry recalculation.
 
void computeBulkReynoldsNumber ()
 Computes the assembly bulk Reynolds number from inlet flow conditions.
 
PetscScalar computeInterpolationCoefficients (PetscScalar Peclet=0.0) const
 Functions that computes the interpolation scheme given the Peclet number.
 
PetscScalar computeInterpolatedValue (PetscScalar topValue, PetscScalar botValue, PetscScalar Peclet=0.0)
 
Real computeGravityDir (const MooseEnum &dir) const
 inline function that is used to define the gravity direction
 
PetscErrorCode solveAndPopulateEnthalpy (Mat A, Vec rhs, unsigned int first_node, unsigned int last_node, const char *ksp_prefix)
 Solve a linear system (A * x = rhs) with a simple PCJACOBI KSP and populate the enthalpy solution into _h_soln for nodes [first_node, last_node].
 
PetscErrorCode addTermMatrices (Mat system, const std::vector< Mat > &terms, bool &pattern_set)
 Add the term matrices to a system matrix that was zeroed beforehand.
 
PetscErrorCode createPetscVector (Vec &v, PetscInt n)
 Petsc Functions.
 
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)
 
virtual void meshChanged ()
 
MooseVariableFieldBase & getVariableHelper (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 ()
 
virtual void meshDisplaced ()
 
void computeSystems (const ExecFlagType &type)
 
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, TheWarehouse::Query &query)
 
void computeKokkosUserObjectsInternal (const ExecFlagType &type, TheWarehouse::Query &query)
 
void checkDisplacementNodes ()
 
void checkUserObjects ()
 
void checkGradientMethods ()
 
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 flagInvalidSolutionInternal (const InvalidSolutionID invalid_solution_id) const
 
InvalidSolutionID registerInvalidSolutionInternal (const std::string &message, const bool warning) const
 
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
 
virtual void addPostprocessorDependencyHelper (const PostprocessorName &) const
 

Protected Attributes

TriSubChannelMesh & _tri_sch_mesh
 
Mat _hc_axial_heat_conduction_mat
 
Vec _hc_axial_heat_conduction_rhs
 
Mat _hc_radial_heat_conduction_mat
 
Vec _hc_radial_heat_conduction_rhs
 
Mat _hc_sweep_enthalpy_mat
 
Vec _hc_sweep_enthalpy_rhs
 
SubChannelMesh & _subchannel_mesh
 
unsigned int _n_blocks
 number of axial blocks
 
libMesh::DenseMatrix< Real > _DP
 
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
 
unsigned int _n_cells
 
unsigned int _n_gaps
 
unsigned int _n_pins
 
unsigned int _n_channels
 
unsigned int _block_size
 
std::vector< Real > _z_grid
 axial location of nodes
 
Real _one
 
Real _TR
 Flag that activates or deactivates the transient parts of the equations we solve by multiplication.
 
const bool _compute_density
 Flag that activates or deactivates the calculation of density.
 
const bool _compute_viscosity
 Flag that activates or deactivates the calculation of viscosity.
 
const bool _compute_power
 Flag that informs if we need to solve the Enthalpy/Temperature equations or not.
 
const bool _pin_mesh_exist
 Flag that informs if there is a pin mesh or not.
 
const bool _duct_mesh_exist
 Flag that informs if there is a duct mesh or not.
 
bool _converged
 Variable that informs whether we exited external solve with a converged solution or not.
 
Real _bulk_Re
 Assembly bulk Reynolds number.
 
Real _bulk_V
 Assembly bulk velocity.
 
bool _time_integrator_checked = false
 Whether the time integrator has been checked for consistency with the implementation.
 
Real _dt
 Time step.
 
Real _CT
 Turbulent modeling parameter used in axial momentum equation.
 
const Real & _P_tol
 Convergence tolerance for the pressure loop in external solve.
 
const int & _P_maxit
 Maximum number of pressure iterations; zero selects the solver's existing automatic limit.
 
const Real & _T_tol
 Convergence tolerance for the temperature loop in internal solve.
 
const int & _T_maxit
 Maximum iterations for the inner temperature loop.
 
const Real & _T_relaxation
 Relaxation factor for temperature updates in the inner thermal-hydraulic iteration.
 
const unsigned int & _enthalpy_subcycles
 Number of enthalpy, temperature, and property updates performed per flow solve.
 
const Real & _mass_flow_equation_relaxation
 Equation relaxation factor for mass flow rate in the monolithic solve.
 
const Real & _pressure_equation_relaxation
 Equation relaxation factor for pressure in the monolithic solve.
 
const Real & _crossflow_equation_relaxation
 Equation relaxation factor for crossflow in the monolithic solve.
 
const Real & _mass_flow_relaxation
 Relaxation factor for mass flow rate updates in the monolithic solve.
 
const Real & _pressure_relaxation
 Relaxation factor for pressure updates in the monolithic solve.
 
const Real & _crossflow_relaxation
 Relaxation factor for crossflow updates in the monolithic solve.
 
const PetscReal & _rtol
 The relative convergence tolerance, (relative decrease) for the ksp linear solver.
 
const PetscReal & _atol
 The absolute convergence tolerance for the ksp linear solver.
 
const PetscReal & _dtol
 The divergence tolerance for the ksp linear solver.
 
const PetscInt _maxit
 The maximum number of iterations to use for the ksp linear solver.
 
const PetscInt _monolithic_gmres_restart
 Restart length of the FGMRES solver of the monolithic flow system.
 
const PetscInt _monolithic_retry_maxit
 Largest number of FGMRES iterations of a monolithic solve before it is retried with more damping.
 
const Real & _crossflow_pseudo_time_step
 Initial pseudo-time step of the crossflow damping.
 
const bool _crossflow_pseudo_time_damping
 Whether the crossflow of the monolithic solve is damped with a pseudo-time derivative.
 
const MooseEnum _monolithic_preconditioner
 Preconditioner of the monolithic flow system.
 
const MooseEnum _interpolation_scheme
 The interpolation method used in constructing the systems.
 
const MooseEnum _gravity_direction
 The direction of gravity.
 
const Real _dir_grav
 
const bool _implicit_bool
 Flag to define the usage of a implicit or explicit solution.
 
const bool _segregated_bool
 Segregated solve.
 
const bool _verbose_subchannel
 Boolean to printout information related to subchannel solve.
 
bool _deformation = false
 Flag that activates the effect of deformation (pin/duct) based on the auxvalues for displacement, Dpin.
 
const SCMFrictionClosureBase * _friction_closure
 Friction closure object.
 
const SCMMixingClosureBase * _mixing_closure
 Turbulent Mixing closure object.
 
const SCMHTCClosureBase * _pin_HTC_closure
 HTC closure objects.
 
const SCMHTCClosureBase * _duct_HTC_closure
 
std::unique_ptr< SolutionHandle > _mdot_soln
 Solutions handles and link to TH tables properties.
 
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 > _Dpin_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
 
std::unique_ptr< SolutionHandle > _duct_heat_flux_soln
 
std::unique_ptr< SolutionHandle > _Tduct_soln
 
std::unique_ptr< SolutionHandle > _displacement_soln
 
std::unique_ptr< SolutionHandle > _ff_soln
 
std::unique_ptr< SolutionHandle > _HTC_soln
 
Mat _mc_sumWij_mat
 Matrices and vectors to be used in implicit assembly Mass conservation Mass conservation - sum of cross fluxes.
 
Vec _Wij_vec
 
Vec _prod
 
Vec _prodp
 
Mat _mc_axial_convection_mat
 Mass conservation - axial convection.
 
Vec _mc_axial_convection_rhs
 
Mat _mc_density_pressure_mat
 Mass conservation - pressure derivative of transient density.
 
Mat _amc_turbulent_cross_flows_mat
 Axial momentum Axial momentum conservation - compute turbulent cross fluxes.
 
Vec _amc_turbulent_cross_flows_rhs
 
Mat _amc_time_derivative_mat
 Axial momentum conservation - time derivative.
 
Vec _amc_time_derivative_rhs
 
Mat _amc_advective_derivative_mat
 Axial momentum conservation - advective (Eulerian) derivative.
 
Vec _amc_advective_derivative_rhs
 
Mat _amc_cross_derivative_mat
 Axial momentum conservation - cross flux derivative.
 
Vec _amc_cross_derivative_rhs
 
Mat _amc_friction_force_mat
 Axial momentum conservation - friction force.
 
Vec _amc_friction_force_rhs
 
Vec _amc_gravity_rhs
 Axial momentum conservation - buoyancy force No implicit matrix.
 
Mat _amc_pressure_force_mat
 Axial momentum conservation - pressure force.
 
Vec _amc_pressure_force_rhs
 
Mat _amc_sys_mdot_mat
 Axial momentum system matrix.
 
Vec _amc_sys_mdot_rhs
 
Mat _cmc_time_derivative_mat
 Cross momentum Cross momentum conservation - time derivative.
 
Vec _cmc_time_derivative_rhs
 
Mat _cmc_advective_derivative_mat
 Cross momentum conservation - advective (Eulerian) derivative.
 
Vec _cmc_advective_derivative_rhs
 
Vec _cmc_pseudo_time_inertia
 Crossflow inertia L_ij S_ij rho* of each gap of the block, the coefficient of the pseudo-time derivative of the crossflow damping.
 
Mat _cmc_friction_force_mat
 Cross momentum conservation - friction force.
 
Vec _cmc_friction_force_rhs
 
Mat _cmc_pressure_force_mat
 Cross momentum conservation - pressure force.
 
Vec _cmc_pressure_force_rhs
 
Mat _cmc_sys_Wij_mat
 Lateral momentum system matrix.
 
Vec _cmc_sys_Wij_rhs
 
Mat _hc_time_derivative_mat
 Enthalpy Enthalpy conservation - time derivative.
 
Vec _hc_time_derivative_rhs
 
Mat _hc_advective_derivative_mat
 Enthalpy conservation - advective (Eulerian) derivative;.
 
Vec _hc_advective_derivative_rhs
 
Mat _hc_cross_derivative_mat
 Enthalpy conservation - cross flux derivative.
 
Vec _hc_cross_derivative_rhs
 
Vec _hc_added_heat_rhs
 Enthalpy conservation - source and sink.
 
Mat _hc_sys_h_mat
 System matrices.
 
Vec _hc_sys_h_rhs
 
bool _amc_sys_mdot_pattern_set = false
 Whether the nonzero patterns of the assembled system matrices have been established.
 
bool _cmc_sys_Wij_pattern_set = false
 
bool _hc_sys_h_pattern_set = false
 
Real _pressure_fixed_point_error = 1.0
 Maximum pressure fixed-point update before solution relaxation over the blocks.
 
std::vector< Real > _crossflow_residual_ref
 Per-block largest cross-momentum residual norm of the solve, which scales the crossflow damping in the monolithic solve.
 
std::vector< Real > _crossflow_pseudo_time_step_reduction
 Per-block factor, raised after monolithic linear-solve failures, that divides the crossflow pseudo-time step and so delays its growth.
 
MooseMesh & _mesh
 
bool _initialized
 
std::optional< std::vector< ConvergenceName > > _nonlinear_convergence_names
 
std::optional< std::vector< ConvergenceName > > _linear_convergence_names
 
std::optional< ConvergenceName > _multiapp_fixed_point_convergence_name
 
std::optional< ConvergenceName > _steady_state_convergence_name
 
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
 
Real & _time_older
 
int & _t_step
 
Real & _dt_old
 
bool _need_to_add_default_nonlinear_convergence
 
bool _need_to_add_default_multiapp_fixed_point_convergence
 
bool _need_to_add_default_steady_state_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< SolverSystemName > _solver_sys_names
 
std::shared_ptr< AuxiliarySystem > _aux
 
Moose::CouplingType _coupling
 
std::vector< std::unique_ptr< libMesh::CouplingMatrix > > _cm
 
Moose::Kokkos::Array< Moose::Kokkos::System > _kokkos_systems
 
Moose::Kokkos::Array< Moose::Kokkos::FESystem > _kokkos_fe_systems
 
std::map< std::string, unsigned int > _subspace_dim
 
std::vector< std::vector< std::unique_ptr< Assembly > > > _assembly
 
Moose::Kokkos::Assembly _kokkos_assembly
 
MooseObjectWarehouse< MeshDivision > _mesh_divisions
 
MooseObjectWarehouse< Function > _functions
 
MooseObjectWarehouse< Moose::FunctionBase > _kokkos_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
 
Moose::Kokkos::MaterialPropertyStorage & _kokkos_material_props
 
Moose::Kokkos::MaterialPropertyStorage & _kokkos_bnd_material_props
 
Moose::Kokkos::MaterialPropertyStorage & _kokkos_neighbor_material_props
 
MooseObjectWarehouse< Marker > _markers
 
ReporterData _reporter_data
 
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
 
const unsigned int _num_concurrent_multiapps
 
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
 
std::vector< MeshDisplacedInterface * > _notify_when_mesh_displaces
 
Adaptivity _adaptivity
 
unsigned int _cycles_completed
 
std::shared_ptr< XFEMInterface > _xfem
 
MooseMesh * _displaced_mesh
 
std::shared_ptr< DisplacedProblem > _displaced_problem
 
GeometricSearchData _geometric_search_data
 
std::unique_ptr< MortarInterfaceWarehouse > _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
 
std::vector< bool > _previous_multiapp_fp_nl_solution_required
 
bool _previous_multiapp_fp_aux_solution_required
 
std::vector< bool > _previous_multisystem_fp_nl_solution_required
 
bool _previous_multisystem_fp_aux_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
 
const bool _interface_kernel_integrity_check
 
const bool _side_uo_interface_mat_prop_integrity_check
 
CoverageCheckMode _material_coverage_check
 
std::vector< SubdomainName > _material_coverage_blocks
 
bool _fv_bcs_integrity_check
 
const bool _fv_face_integrity_check
 
const bool _material_dependency_check
 
const bool _uo_aux_state_check
 
bool _check_residual_for_nans
 
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
 
bool _verbose_restore
 
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
 
const std::vector< VariableName > _constant_null_space_vars
 
const std::vector< VariableName > _constant_transpose_null_space_vars
 
const bool _use_hash_table_matrix_assembly
 
std::map< TagName, TagID > _matrix_tag_name_to_tag_id
 
std::map< TagID, TagName > _matrix_tag_id_to_tag_name
 
Factory & _factory
 
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 _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
 
ActionFactory & _action_factory
 
const std::string & _type
 
const std::string & _name
 
const InputParameters & _pars
 
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
 
MaterialWarehouse _kokkos_materials
 
MooseObjectWarehouse< Indicator > _indicators
 
MooseObjectWarehouse< InternalSideIndicatorBase > _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
 

Static Protected Attributes

static constexpr unsigned int _max_crossflow_retries = 8
 Number of monolithic linear-solve retries, each halving the crossflow pseudo-time step.
 
static constexpr Real _max_crossflow_pseudo_time_step_reduction = 1 << _max_crossflow_retries
 Cap on the pseudo-time step reduction: the reduction one fully retried monolithic solve provides.
 

Private Types

enum  TrueFunctorIs
 

Private Member Functions

void setResidualObjectParamsAndLog (const std::string &ro_name, const std::string &name, InputParameters &parameters, const unsigned int nl_sys_num, const std::string &base_name, bool &reinit_displaced)
 
void setAuxKernelParamsAndLog (const std::string &ak_name, const std::string &name, InputParameters &parameters, const std::string &base_name)
 
TheWarehouse::Query getUOQuery (const std::string &system, const ExecFlagType &type, const Moose::AuxGroup &group) const
 
void getUOExecutionGroups (TheWarehouse::Query &query, std::set< int > &execution_groups) const
 
void translateCaughtException (const std::string &calling_method)
 
void handleException (const std::string &calling_method)
 
void translateUserObjectExceptions (const std::function< void()> &work)
 
std::vector< MortarUserObject * > getMortarUserObjects (BoundaryID primary_boundary_id, BoundaryID secondary_boundary_id, bool displaced, const std::vector< MortarUserObject * > &mortar_uo_superset)
 
std::vector< MortarUserObject * > getMortarUserObjects (BoundaryID primary_boundary_id, BoundaryID secondary_boundary_id, bool displaced)
 
virtual std::pair< bool, unsigned int > determineSolverSystem (const std::string &var_name, bool error_if_not_found=false) const override
 
void checkICRestartError (const std::string &ic_name, const std::string &name, const VariableName &var_name)
 
void addAnyRedistributers ()
 
void updateMaxQps ()
 
void joinAndFinalize (TheWarehouse::Query query, bool isgen=false)
 
void kokkosJoinAndFinalize (const std::vector< Moose::Kokkos::UserObject * > &userobjs)
 
virtual void resetState ()
 
void cloneAlgebraicGhostingFunctor (libMesh::GhostingFunctor &algebraic_gf, bool to_mesh=true)
 
void cloneCouplingGhostingFunctor (libMesh::GhostingFunctor &coupling_gf, bool to_mesh=true)
 
void showFunctors () const
 
void showFunctorRequestors () const
 
bool suppressInfo () const
 
RestartableDataValue & registerRestartableDataOnApp (std::unique_ptr< RestartableDataValue > data, THREAD_ID tid) const
 
void registerRestartableNameWithFilterOnApp (const std::string &name, Moose::RESTARTABLE_FILTER filter)
 
RestartableData< T > & declareRestartableDataHelper (const std::string &data_name, void *context, Args &&... args) const
 
std::string restrictionSubdomainCheckName (SubdomainID check_id)
 
std::string restrictionSubdomainCheckName (SubdomainID check_id)
 
std::string restrictionBoundaryCheckName (BoundaryID check_id)
 
std::string restrictionBoundaryCheckName (BoundaryID check_id)
 
const PostprocessorName & getPostprocessorNameInternal (const std::string &param_name, const unsigned int index, const bool allow_default_value=true) const
 
bool isDefaultPostprocessorValueByName (const PostprocessorName &name) const
 
PostprocessorValue getDefaultPostprocessorValueByName (const PostprocessorName &name) const
 
void checkParam (const std::string &param_name, const unsigned int index=std::numeric_limits< unsigned int >::max()) const
 
bool postprocessorsAdded () const
 
const PostprocessorValue & getPostprocessorValueInternal (const std::string &param_name, unsigned int index, std::size_t t_index) const
 
const PostprocessorValue & getPostprocessorValueInternal (const std::string &param_name, unsigned int index, std::size_t t_index) const
 
const PostprocessorValue & getPostprocessorValueByNameInternal (const PostprocessorName &name, std::size_t t_index) const
 
const PostprocessorValue & getPostprocessorValueByNameInternal (const PostprocessorName &name, std::size_t t_index) const
 

Static Private Member Functions

static const hit::Node * getHitNode (const InputParameters &params)
 
static std::string messagePrefix (const InputParameters &params, const bool hit_prefix)
 
static SolverParams makeLinearSolverParams ()
 

Private Attributes

Restartable::ManagedValue< RestartableEquationSystems > _req
 
bool _error_on_jacobian_nonzero_reallocation
 
const bool _restore_original_nonzero_pattern
 
bool _ignore_zeros_in_jacobian
 
bool _preserve_matrix_sparsity_pattern
 
const bool _force_restart
 
const bool _allow_ics_during_restart
 
const bool _skip_nl_system_check
 
bool _fail_next_system_convergence_check
 
const bool _allow_invalid_solution
 
const bool _show_invalid_solution_console
 
const bool & _immediately_print_invalid_solution
 
bool _started_initial_setup
 
bool _has_internal_edge_residual_objects
 
bool _u_dot_requested
 
bool _u_dotdot_requested
 
bool _u_dot_old_requested
 
bool _u_dotdot_old_requested
 
bool _has_mortar
 
unsigned int _num_grid_steps
 
bool _trust_user_coupling_matrix
 
bool _computing_scaling_jacobian
 
bool _computing_scaling_residual
 
bool _checking_uo_aux_state
 
ExecFlagEnum _print_execution_on
 
const bool _identify_variable_groups_in_nl
 
std::vector< VectorTag > _current_residual_vector_tags
 
bool _have_fv
 
const bool _regard_general_exceptions_as_errors
 
std::vector< libMesh::CouplingMatrix > _nonlocal_cm
 
bool _requires_nonlocal_coupling
 
bool _has_kokkos_objects
 
bool _has_kokkos_residual_objects
 
std::vector< std::function< void()> > _kokkos_mesh_initialization_hooks
 
std::vector< std::multimap< std::string, std::tuple< TrueFunctorIs, std::unique_ptr< Moose::FunctorEnvelopeBase >, std::unique_ptr< Moose::FunctorEnvelopeBase > > > > _functors
 
std::vector< std::map< std::string, std::unique_ptr< Moose::FunctorAbstract > > > _pbblf_functors
 
std::map< std::string, std::set< std::string > > _functor_to_requestors
 
std::vector< std::multimap< std::string, std::pair< bool, bool > > > _functor_to_request_info
 
bool _show_functors
 
bool _show_chain_control_data
 
std::vector< VectorTag > _vector_tags
 
std::vector< std::vector< VectorTag > > _typed_vector_tags
 
std::map< TagName, TagID > _vector_tags_name_map
 
std::map< MooseObjectName, std::set< std::string > > _consumed_material_properties
 
std::unordered_map< libMesh::GhostingFunctor *, std::vector< std::shared_ptr< libMesh::GhostingFunctor > > > _root_alg_gf_to_sys_clones
 
std::unordered_map< libMesh::GhostingFunctor *, std::vector< std::shared_ptr< libMesh::GhostingFunctor > > > _root_coupling_gf_to_sys_clones
 
const ParallelParamObject & _parent
 
const MooseBase & _si_moose_base
 
const FEProblemBase * _si_problem
 
const RestartableDataMapName _metaname
 
std::string _restartable_name
 
const MooseObject & _ppi_moose_object
 
const InputParameters & _ppi_params
 
const FEProblemBase & _ppi_feproblem
 
std::map< PostprocessorName, std::unique_ptr< PostprocessorValue > > _default_values
 

Detailed Description

Triangular subchannel solver.

Definition at line 19 of file TriSubChannel1PhaseProblem.h.

Constructor & Destructor Documentation

◆ TriSubChannel1PhaseProblem()

TriSubChannel1PhaseProblem::TriSubChannel1PhaseProblem ( const InputParameters &  params)

Definition at line 32 of file TriSubChannel1PhaseProblem.C.

34 _tri_sch_mesh(SCM::getMesh<TriSubChannelMesh>(_subchannel_mesh))
35{
36 // Initializing heat conduction system
37 LibmeshPetscCall(createPetscMatrix(
40 LibmeshPetscCall(createPetscMatrix(
43 LibmeshPetscCall(createPetscMatrix(
46}
Base class for the 1-phase steady-state/transient subchannel solver.
PetscErrorCode createPetscVector(Vec &v, PetscInt n)
Petsc Functions.
PetscErrorCode createPetscMatrix(Mat &M, PetscInt n, PetscInt m)

◆ ~TriSubChannel1PhaseProblem()

TriSubChannel1PhaseProblem::~TriSubChannel1PhaseProblem ( )
virtual

Definition at line 48 of file TriSubChannel1PhaseProblem.C.

49{
50 PetscErrorCode ierr = cleanUp();
51 if (ierr)
52 mooseError(name(), ": Error in memory cleanup");
53}
const std::string & name() const
void mooseError(Args &&... args) const

Member Function Documentation

◆ addCrossflowDamping()

PetscErrorCode SubChannel1PhaseProblem::addCrossflowDamping ( Mat  M_ww,
Mat  M_wp,
Vec  b_w,
Vec  Wij_iter,
int  iblock,
PetscScalar &  inv_dtau 
)
protectedinherited

Add the pseudo-time damping added_K_ij (Wij - Wij_iter) to the cross-momentum equation of the monolithic solve, M_ww Wij + M_wp P + added_K_ij (Wij - Wij_iter) = b_w, where Wij is the crossflow the monolithic solve computes and Wij_iter the crossflow of the current outer iterate.

Each gap is damped by its crossflow inertia over a pseudo-time step, added_K_ij = L_ij S_ij rho* / dtau, which makes each monolithic solve a step of pseudo-transient continuation: it keeps the monolithic linear solve well conditioned, and the term vanishes at the fixed point Wij = Wij_iter, so it does not change the converged solution. The step grows from crossflow_pseudo_time_step as the cross-momentum residual decreases (switched evolution relaxation), so the damping vanishes as the outer iteration converges.

Parameters
M_wwcross-momentum block acting on the crossflow; added_K_ij is added to its diagonal
M_wpcross-momentum block acting on the pressure
b_wcross-momentum right-hand side; added_K_ij Wij_iter is added to it
Wij_itercrossflow at the current outer iterate
iblockaxial block
inv_dtauinverse of the pseudo-time step applied

Definition at line 2279 of file SubChannel1PhaseProblem.C.

2281{
2283 const unsigned int first_node = iblock * _block_size + 1;
2284 const unsigned int last_node = (iblock + 1) * _block_size;
2285 Vec residual;
2286 LibmeshPetscCall(createPetscVector(residual, _block_size * _n_gaps));
2287 LibmeshPetscCall(populateVectorFromHandle<SolutionHandle>(
2288 _prodp, *_P_soln, first_node - 1, last_node - 1, _n_channels));
2289
2290 // residual = M_ww Wij_iter + M_wp P - b_w at the current iterate
2291 LibmeshPetscCall(MatMult(M_ww, Wij_iter, residual));
2292 LibmeshPetscCall(MatMultAdd(M_wp, _prodp, residual, residual));
2293 LibmeshPetscCall(VecAXPY(residual, -1.0, b_w));
2294 PetscReal residual_norm;
2295 LibmeshPetscCall(VecNorm(residual, NORM_2, &residual_norm));
2296
2297 // The largest residual of this solve so far sets the reference. The uniform initial state has a
2298 // residual that is zero up to round-off, depending on the input; taking the first residual as the
2299 // reference would then hold the pseudo-time step at its initial value for the whole solve. A zero
2300 // reference applies the full damping.
2301 auto & residual_ref = _crossflow_residual_ref[iblock];
2302 residual_ref = std::max(residual_ref, residual_norm);
2303 const Real residual_ratio = residual_ref > 0.0 ? residual_norm / residual_ref : 1.0;
2304
2305 // Pseudo-transient continuation with switched evolution relaxation: the pseudo-time step grows
2306 // from its initial value as the residual decreases, dtau = dtau_0 / (residual ratio * reduction),
2307 // and each gap is damped by its crossflow inertia over it, added_K_ij = L_ij S_ij rho* / dtau.
2308 // The reduction raised by failed monolithic linear solves delays, but does not prevent, the
2309 // growth of the step.
2310 const PetscScalar max_inv_dtau = 1.0 / _crossflow_pseudo_time_step;
2311 inv_dtau = std::min(
2312 max_inv_dtau, max_inv_dtau * residual_ratio * _crossflow_pseudo_time_step_reduction[iblock]);
2314 {
2315 _console << "Crossflow residual ratio: " + std::to_string(residual_ratio) << std::endl;
2316 _console << "Crossflow pseudo-time step: " + std::to_string(1.0 / inv_dtau) << std::endl;
2317 }
2318
2319 LibmeshPetscCall(shiftCrossflowDamping(M_ww, b_w, Wij_iter, inv_dtau));
2320
2321 LibmeshPetscCall(VecDestroy(&residual));
2322 PetscFunctionReturn(LIBMESH_PETSC_SUCCESS);
2323}
PetscFunctionBegin
const ConsoleStream _console
PetscErrorCode shiftCrossflowDamping(Mat M_ww, Vec b_w, Vec Wij_iter, PetscScalar inv_dtau)
Add the damping of the inverse pseudo-time step inv_dtau to the cross-momentum equation: inv_dtau L_i...
std::unique_ptr< SolutionHandle > _P_soln
const Real & _crossflow_pseudo_time_step
Initial pseudo-time step of the crossflow damping.
std::vector< Real > _crossflow_residual_ref
Per-block largest cross-momentum residual norm of the solve, which scales the crossflow damping in th...
std::vector< Real > _crossflow_pseudo_time_step_reduction
Per-block factor, raised after monolithic linear-solve failures, that divides the crossflow pseudo-ti...
const bool _verbose_subchannel
Boolean to printout information related to subchannel solve.
PetscFunctionReturn(LIBMESH_PETSC_SUCCESS)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real

Referenced by SubChannel1PhaseProblem::implicitPetscSolve().

◆ addTermMatrices()

PetscErrorCode SubChannel1PhaseProblem::addTermMatrices ( Mat  system,
const std::vector< Mat > &  terms,
bool &  pattern_set 
)
protectedinherited

Add the term matrices to a system matrix that was zeroed beforehand.

The first call determines the nonzero pattern of the sum; later calls add into that pattern instead of rebuilding the matrix, which gives the same entries.

Definition at line 563 of file SubChannel1PhaseProblem.C.

566{
568#if !PETSC_VERSION_LESS_THAN(3, 15, 0)
569 const MatStructure first_pattern = UNKNOWN_NONZERO_PATTERN;
570#else
571 const MatStructure first_pattern = DIFFERENT_NONZERO_PATTERN;
572#endif
573 for (const auto term : terms)
574 LibmeshPetscCall(
575 MatAXPY(system, 1.0, term, pattern_set ? SUBSET_NONZERO_PATTERN : first_pattern));
576 if (!pattern_set)
577 {
578 // A term can gain entries later, e.g. when a crossflow changes sign, so let the pattern grow
579 LibmeshPetscCall(MatSetOption(system, MAT_NEW_NONZERO_ALLOCATION_ERR, PETSC_FALSE));
580 pattern_set = true;
581 }
582 PetscFunctionReturn(LIBMESH_PETSC_SUCCESS);
583}

Referenced by SubChannel1PhaseProblem::computeDP(), QuadSubChannel1PhaseProblem::computeh(), computeh(), and SubChannel1PhaseProblem::computeWijResidual().

◆ cleanUp()

PetscErrorCode TriSubChannel1PhaseProblem::cleanUp ( )
protected

Definition at line 56 of file TriSubChannel1PhaseProblem.C.

57{
59 // Clean up heat conduction system
60 LibmeshPetscCall(MatDestroy(&_hc_axial_heat_conduction_mat));
61 LibmeshPetscCall(VecDestroy(&_hc_axial_heat_conduction_rhs));
62 LibmeshPetscCall(MatDestroy(&_hc_radial_heat_conduction_mat));
63 LibmeshPetscCall(VecDestroy(&_hc_radial_heat_conduction_rhs));
64 LibmeshPetscCall(MatDestroy(&_hc_sweep_enthalpy_mat));
65 LibmeshPetscCall(VecDestroy(&_hc_sweep_enthalpy_rhs));
66 PetscFunctionReturn(LIBMESH_PETSC_SUCCESS);
67}

Referenced by ~TriSubChannel1PhaseProblem().

◆ computeAddedHeatDuct()

Real SubChannel1PhaseProblem::computeAddedHeatDuct ( unsigned int  i_ch,
unsigned int  iz 
) const
protectedvirtualinherited

Non-pure: implemented in the base (or override in a child if needed)

Definition at line 2226 of file SubChannel1PhaseProblem.C.

2227{
2228 mooseAssert(iz > 0, "Trapezoidal rule requires starting at index 1 at least");
2229 if (_duct_mesh_exist)
2230 {
2231 auto subch_type = _subchannel_mesh.getSubchannelType(i_ch);
2232 if (subch_type == EChannelType::EDGE || subch_type == EChannelType::CORNER)
2233 {
2234 auto dz = _z_grid[iz] - _z_grid[iz - 1];
2235 auto * node_in_chan = _subchannel_mesh.getChannelNode(i_ch, iz - 1);
2236 auto * node_out_chan = _subchannel_mesh.getChannelNode(i_ch, iz);
2237 auto * node_in_duct = _subchannel_mesh.getDuctNodeFromChannel(node_in_chan);
2238 auto * node_out_duct = _subchannel_mesh.getDuctNodeFromChannel(node_out_chan);
2239 auto heat_rate_in = (*_duct_heat_flux_soln)(node_in_duct);
2240 auto heat_rate_out = (*_duct_heat_flux_soln)(node_out_duct);
2241 auto width = getSubChannelPeripheralDuctWidth(i_ch);
2242 return 0.5 * (heat_rate_in + heat_rate_out) * dz * width;
2243 }
2244 else
2245 {
2246 return 0.0;
2247 }
2248 }
2249 else
2250 {
2251 return 0.0;
2252 }
2253}
virtual Real getSubChannelPeripheralDuctWidth(unsigned int i_ch) const =0
Function that computes the width of the duct cell that the peripheral subchannel i_ch sees.
const bool _duct_mesh_exist
Flag that informs if there is a duct mesh or not.
std::vector< Real > _z_grid
axial location of nodes
Node * getDuctNodeFromChannel(Node *channel_node) const
Function that gets the duct node from the channel node.
virtual EChannelType getSubchannelType(unsigned int index) const =0
Return the type of the subchannel for given subchannel index.
virtual Node * getChannelNode(unsigned int i_chan, unsigned int iz) const =0
Get the subchannel mesh node for a given channel index and elevation index.

Referenced by computeh(), and SubChannel1PhaseProblem::getAddedHeatDuct().

◆ computeAddedHeatPin()

Real TriSubChannel1PhaseProblem::computeAddedHeatPin ( unsigned int  i_ch,
unsigned int  iz 
) const
overrideprotectedvirtual

Pure virtual: daughters provide different implementations.

Implements SubChannel1PhaseProblem.

Definition at line 263 of file TriSubChannel1PhaseProblem.C.

264{
265 if (!_pin_mesh_exist)
266 return 0.0;
267
268 // Compute axial location of nodes.
269 auto z2 = _z_grid[iz];
270 auto z1 = _z_grid[iz - 1];
271 auto heated_length = _subchannel_mesh.getHeatedLength();
272 auto unheated_length_entry = _subchannel_mesh.getHeatedLengthEntry();
273 if (MooseUtils::absoluteFuzzyGreaterThan(z2, unheated_length_entry) &&
274 MooseUtils::absoluteFuzzyLessThan(z1, unheated_length_entry + heated_length))
275 {
276 // Compute the height of this element.
277 auto dz = z2 - z1;
278 Real factor;
279 auto subch_type = _subchannel_mesh.getSubchannelType(i_ch);
280 switch (subch_type)
281 {
283 factor = 1.0 / 6.0;
284 break;
286 factor = 1.0 / 4.0;
287 break;
289 factor = 1.0 / 6.0;
290 break;
291 default:
292 return 0.0; // handle invalid subch_type if needed
293 }
294 double heat_rate_in = 0.0;
295 double heat_rate_out = 0.0;
296 for (auto i_pin : _subchannel_mesh.getChannelPins(i_ch))
297 {
298 auto * node_in = _subchannel_mesh.getPinNode(i_pin, iz - 1);
299 auto * node_out = _subchannel_mesh.getPinNode(i_pin, iz);
300 heat_rate_out += factor * (*_q_prime_soln)(node_out);
301 heat_rate_in += factor * (*_q_prime_soln)(node_in);
302 }
303 return (heat_rate_in + heat_rate_out) * dz / 2.0;
304 }
305 else
306 return 0.0;
307}
const bool _pin_mesh_exist
Flag that informs if there is a pin mesh or not.
virtual const Real & getHeatedLength() const
Return heated length.
virtual const Real & getHeatedLengthEntry() const
Return unheated length at entry.
virtual Node * getPinNode(unsigned int i_pin, unsigned int iz) const =0
Get the pin mesh node for a given pin index and elevation index.

Referenced by computeh().

◆ computeBulkReynoldsNumber()

void SubChannel1PhaseProblem::computeBulkReynoldsNumber ( )
protectedinherited

Computes the assembly bulk Reynolds number from inlet flow conditions.

Definition at line 486 of file SubChannel1PhaseProblem.C.

487{
488 if (processor_id() == 0)
489 {
490 Real viscosity_in = 0.0;
491 Real volumetric_flow_in = 0.0;
492 Real mass_flow_in = 0.0;
493 for (const auto i_ch : make_range(_n_channels))
494 {
495 auto * node_in = _subchannel_mesh.getChannelNode(i_ch, 0);
496 const Real mdot_in = (*_mdot_soln)(node_in);
497 const Real rho_in = (*_rho_soln)(node_in);
498 viscosity_in += mdot_in * (*_mu_soln)(node_in);
499 volumetric_flow_in += mdot_in / rho_in;
500 mass_flow_in += mdot_in;
501 }
503 const Real flow_area = _subchannel_mesh.getAssemblyFlowArea();
504 const Real inlet_mu = viscosity_in / mass_flow_in;
505 _bulk_Re = mass_flow_in * bulk_Dh / (inlet_mu * flow_area);
506 _bulk_V = volumetric_flow_in / flow_area;
507 }
508 // Only rank 0 owns the subchannel DOFs (SingleRankPartitioner), so share the result
511
512 if (MooseUtils::absoluteFuzzyEqual(_bulk_Re, 0.0))
513 mooseError("The computed bulk Reynolds number is zero.");
514
515 if (MooseUtils::absoluteFuzzyEqual(_bulk_V, 0.0))
516 mooseError("The computed bulk velocity is zero.");
517
519}
virtual void computeBulkMixingParameters() const
Precomputes the mixing coefficients that depend only on the bulk flow.
const SCMMixingClosureBase * _mixing_closure
Turbulent Mixing closure object.
Real _bulk_Re
Assembly bulk Reynolds number.
Real _bulk_V
Assembly bulk velocity.
Real getAssemblyFlowArea() const
Return undeformed bundle inlet flow area.
Real getAssemblyHydraulicDiameter() const
Return undeformed bundle-average hydraulic diameter.
void broadcast(T &data, const unsigned int root_id=0, const bool identical_sizes=false) const
const Parallel::Communicator & _communicator
processor_id_type processor_id() const
IntRange< T > make_range(T beg, T end)

Referenced by SubChannel1PhaseProblem::externalSolve().

◆ computeDP()

void SubChannel1PhaseProblem::computeDP ( int  iblock)
protectedinherited

Computes Pressure Drop per channel for block iblock.

Upwind local form loss

Upwind local form loss

Advective derivative term. The momentum flux mdot^2 / (S rho) is linearized as mdot_lagged * mdot, which keeps it positive for either flow direction

Cross derivative term

Friction term

Upwind local form loss

Gravity force

Assembling system

Definition at line 932 of file SubChannel1PhaseProblem.C.

933{
934 const unsigned int last_node = (iblock + 1) * _block_size;
935 const unsigned int first_node = iblock * _block_size + 1;
936 if (!_implicit_bool)
937 {
938 for (unsigned int iz = first_node; iz < last_node + 1; iz++)
939 {
940 const auto & k_grid = _subchannel_mesh.getKGrid();
941 auto dz = _z_grid[iz] - _z_grid[iz - 1];
942 for (unsigned int i_ch = 0; i_ch < _n_channels; i_ch++)
943 {
944 auto * node_in = _subchannel_mesh.getChannelNode(i_ch, iz - 1);
945 auto * node_out = _subchannel_mesh.getChannelNode(i_ch, iz);
946 auto rho_in = (*_rho_soln)(node_in);
947 auto rho_out = (*_rho_soln)(node_out);
948 auto mu_in = (*_mu_soln)(node_in);
949 auto S = (*_S_flow_soln)(node_in);
950 auto w_perim = (*_w_perim_soln)(node_in);
951 auto time_term = _TR * ((*_mdot_soln)(node_out)-_mdot_soln->old(node_out)) * dz / _dt -
952 dz * 2.0 * (*_mdot_soln)(node_out) * (rho_out - _rho_soln->old(node_out)) /
953 rho_in / _dt;
954 auto mass_term1 =
955 Utility::pow<2>((*_mdot_soln)(node_out)) * (1.0 / S / rho_out - 1.0 / S / rho_in);
956 auto mass_term2 = -2.0 * (*_mdot_soln)(node_out) * (*_SumWij_soln)(node_out) / S / rho_in;
957 auto crossflow_term = 0.0;
958 auto turbulent_term = 0.0;
959 unsigned int counter = 0;
960 for (auto i_gap : _subchannel_mesh.getChannelGaps(i_ch))
961 {
962 auto chans = _subchannel_mesh.getGapChannels(i_gap);
963 unsigned int ii_ch = chans.first;
964 unsigned int jj_ch = chans.second;
965 auto * node_in_i = _subchannel_mesh.getChannelNode(ii_ch, iz - 1);
966 auto * node_in_j = _subchannel_mesh.getChannelNode(jj_ch, iz - 1);
967 auto * node_out_i = _subchannel_mesh.getChannelNode(ii_ch, iz);
968 auto * node_out_j = _subchannel_mesh.getChannelNode(jj_ch, iz);
969 auto rho_i = (*_rho_soln)(node_in_i);
970 auto rho_j = (*_rho_soln)(node_in_j);
971 auto Si = (*_S_flow_soln)(node_in_i);
972 auto Sj = (*_S_flow_soln)(node_in_j);
973 Real u_star = 0.0;
974 // figure out donor axial velocity
975 if (_Wij(i_gap, iz) > 0.0)
976 u_star = (*_mdot_soln)(node_out_i) / Si / rho_i;
977 else
978 u_star = (*_mdot_soln)(node_out_j) / Sj / rho_j;
979
980 crossflow_term +=
981 _subchannel_mesh.getCrossflowSign(i_ch, counter) * _Wij(i_gap, iz) * u_star;
982
983 turbulent_term += _WijPrime(i_gap, iz) * (2 * (*_mdot_soln)(node_out) / rho_in / S -
984 (*_mdot_soln)(node_out_j) / Sj / rho_j -
985 (*_mdot_soln)(node_out_i) / Si / rho_i);
986 counter++;
987 }
988 turbulent_term *= _CT;
990 auto ki = 0.0;
991 if ((*_mdot_soln)(node_out) >= 0)
992 ki = k_grid[i_ch][iz - 1];
993 else
994 ki = k_grid[i_ch][iz];
995 // Cell Peclet number of the exponential scheme, from the friction of the cell evaluated at
996 // the arithmetic midpoint, as in the implicit branch
997 PetscScalar Pe = 0.5;
998 if (_interpolation_scheme == 3)
999 {
1000 const auto S_mid = computeInterpolatedValue((*_S_flow_soln)(node_out), S, 0.5);
1001 const auto w_perim_mid =
1002 computeInterpolatedValue((*_w_perim_soln)(node_out), w_perim, 0.5);
1003 const auto mdot_mid =
1004 computeInterpolatedValue((*_mdot_soln)(node_out), (*_mdot_soln)(node_in), 0.5);
1005 const auto mu_mid = computeInterpolatedValue((*_mu_soln)(node_out), mu_in, 0.5);
1006 const auto Dh_mid = 4.0 * S_mid / w_perim_mid;
1007 _friction_args = FrictionStruct(
1008 i_ch, std::abs(mdot_mid) / S_mid * Dh_mid / mu_mid, S_mid, w_perim_mid);
1010 Pe = 1.0 / ((ff_mid * dz / Dh_mid + ki) * 0.5) * mdot_mid / std::abs(mdot_mid);
1011 }
1012 // The friction factor and the friction force are cell-center quantities
1013 const auto S_c = computeInterpolatedValue((*_S_flow_soln)(node_out), S, Pe);
1014 const auto w_perim_c = computeInterpolatedValue((*_w_perim_soln)(node_out), w_perim, Pe);
1015 const auto mu_c = computeInterpolatedValue((*_mu_soln)(node_out), mu_in, Pe);
1016 const auto rho_c = computeInterpolatedValue(rho_out, rho_in, Pe);
1017 const auto mdot_c =
1018 computeInterpolatedValue((*_mdot_soln)(node_out), (*_mdot_soln)(node_in), Pe);
1019 const auto Dh_c = 4.0 * S_c / w_perim_c;
1020 auto Re = std::abs(mdot_c) / S_c * Dh_c / mu_c;
1021 _friction_args = FrictionStruct(i_ch, Re, S_c, w_perim_c);
1023 if (_ff_soln)
1024 _ff_soln->set(node_out, ff);
1025 auto friction_term =
1026 (ff * dz / Dh_c + ki) * 0.5 * mdot_c * std::abs(mdot_c) / (S_c * rho_c);
1027 auto gravity_term = _dir_grav * _g_grav * (*_rho_soln)(node_out)*dz * S;
1028 auto DP = (1 / S) * (time_term + mass_term1 + mass_term2 + crossflow_term + turbulent_term +
1029 friction_term + gravity_term); // Pa
1030 _DP(i_ch, iz) = DP;
1031 if (_DP_soln)
1032 _DP_soln->set(node_out, DP);
1033 }
1034 }
1035 }
1036 else
1037 {
1038 LibmeshPetscCall(MatZeroEntries(_amc_time_derivative_mat));
1039 LibmeshPetscCall(MatZeroEntries(_amc_advective_derivative_mat));
1040 LibmeshPetscCall(MatZeroEntries(_amc_cross_derivative_mat));
1041 LibmeshPetscCall(MatZeroEntries(_amc_friction_force_mat));
1042 LibmeshPetscCall(VecZeroEntries(_amc_time_derivative_rhs));
1043 LibmeshPetscCall(VecZeroEntries(_amc_advective_derivative_rhs));
1044 LibmeshPetscCall(VecZeroEntries(_amc_cross_derivative_rhs));
1045 LibmeshPetscCall(VecZeroEntries(_amc_friction_force_rhs));
1046 LibmeshPetscCall(VecZeroEntries(_amc_gravity_rhs));
1047 LibmeshPetscCall(MatZeroEntries(_amc_sys_mdot_mat));
1048 LibmeshPetscCall(VecZeroEntries(_amc_sys_mdot_rhs));
1049 for (unsigned int iz = first_node; iz < last_node + 1; iz++)
1050 {
1051 const auto & k_grid = _subchannel_mesh.getKGrid();
1052 auto dz = _z_grid[iz] - _z_grid[iz - 1];
1053 auto iz_ind = iz - first_node;
1054 for (unsigned int i_ch = 0; i_ch < _n_channels; i_ch++)
1055 {
1056 // inlet and outlet nodes
1057 auto * node_in = _subchannel_mesh.getChannelNode(i_ch, iz - 1);
1058 auto * node_out = _subchannel_mesh.getChannelNode(i_ch, iz);
1059
1060 // interpolation weight coefficient
1061 PetscScalar Pe = 0.5;
1062 if (_interpolation_scheme == 3)
1063 {
1064 // Compute the Peclet number
1065 auto S_in = (*_S_flow_soln)(node_in);
1066 auto S_out = (*_S_flow_soln)(node_out);
1067 auto S_interp = computeInterpolatedValue(S_out, S_in, 0.5);
1068 auto w_perim_in = (*_w_perim_soln)(node_in);
1069 auto w_perim_out = (*_w_perim_soln)(node_out);
1070 auto w_perim_interp = this->computeInterpolatedValue(w_perim_out, w_perim_in, 0.5);
1071 auto mdot_loc =
1072 this->computeInterpolatedValue((*_mdot_soln)(node_out), (*_mdot_soln)(node_in), 0.5);
1073 auto mu_in = (*_mu_soln)(node_in);
1074 auto mu_out = (*_mu_soln)(node_out);
1075 auto mu_interp = this->computeInterpolatedValue(mu_out, mu_in, 0.5);
1076 auto Dh_c = 4.0 * S_interp / w_perim_interp;
1077 // Compute friction factor
1078 auto Re = ((std::abs(mdot_loc) / S_interp) * Dh_c / mu_interp);
1079 _friction_args = FrictionStruct(i_ch, Re, S_interp, w_perim_interp);
1081 if (_ff_soln)
1082 _ff_soln->set(node_out, ff);
1084 auto ki = 0.0;
1085 if ((*_mdot_soln)(node_out) >= 0)
1086 ki = k_grid[i_ch][iz - 1];
1087 else
1088 ki = k_grid[i_ch][iz];
1089 Pe = 1.0 / ((ff * dz / Dh_c + ki) * 0.5) * mdot_loc / std::abs(mdot_loc);
1090 }
1091 auto alpha = computeInterpolationCoefficients(Pe);
1092
1093 // inlet, outlet, and interpolated density
1094 auto rho_in = (*_rho_soln)(node_in);
1095 auto rho_out = (*_rho_soln)(node_out);
1096 auto rho_interp = computeInterpolatedValue(rho_out, rho_in, Pe);
1097
1098 // inlet, outlet, and interpolated viscosity
1099 auto mu_in = (*_mu_soln)(node_in);
1100 auto mu_out = (*_mu_soln)(node_out);
1101 auto mu_interp = computeInterpolatedValue(mu_out, mu_in, Pe);
1102
1103 // inlet, outlet, and interpolated axial surface area
1104 auto S_in = (*_S_flow_soln)(node_in);
1105 auto S_out = (*_S_flow_soln)(node_out);
1106 auto S_interp = computeInterpolatedValue(S_out, S_in, Pe);
1107
1108 // inlet, outlet, and interpolated wetted perimeter
1109 auto w_perim_in = (*_w_perim_soln)(node_in);
1110 auto w_perim_out = (*_w_perim_soln)(node_out);
1111 auto w_perim_interp = computeInterpolatedValue(w_perim_out, w_perim_in, Pe);
1112
1113 // cell-center hydraulic diameter
1114 auto Dh_c = 4.0 * S_interp / w_perim_interp;
1115
1116 // Keep temporal storage independent of the spatial interpolation scheme. Applying the
1117 // upwind coefficient to this term puts the storage on the upstream node and leaves the
1118 // first axial row without transient inertia in the upwind limit.
1119 PetscInt row_tt = i_ch + _n_channels * iz_ind;
1120 PetscInt col_tt = i_ch + _n_channels * iz_ind;
1121 PetscScalar value_tt = _TR * dz / _dt;
1122 LibmeshPetscCall(MatSetValues(
1123 _amc_time_derivative_mat, 1, &row_tt, 1, &col_tt, &value_tt, INSERT_VALUES));
1124
1125 PetscScalar value_vec_tt = _TR * _mdot_soln->old(node_out) * dz / _dt;
1126 PetscInt row_vec_tt = i_ch + _n_channels * iz_ind;
1127 LibmeshPetscCall(
1128 VecSetValues(_amc_time_derivative_rhs, 1, &row_vec_tt, &value_vec_tt, ADD_VALUES));
1129
1132 if (iz == first_node)
1133 {
1134 PetscScalar value_vec_at = Utility::pow<2>((*_mdot_soln)(node_in)) / (S_in * rho_in);
1135 PetscInt row_vec_at = i_ch + _n_channels * iz_ind;
1136 LibmeshPetscCall(VecSetValues(
1137 _amc_advective_derivative_rhs, 1, &row_vec_at, &value_vec_at, ADD_VALUES));
1138 }
1139 else
1140 {
1141 PetscInt row_at = i_ch + _n_channels * iz_ind;
1142 PetscInt col_at = i_ch + _n_channels * (iz_ind - 1);
1143 PetscScalar value_at = -1.0 * (*_mdot_soln)(node_in) / (S_in * rho_in);
1144 LibmeshPetscCall(MatSetValues(
1145 _amc_advective_derivative_mat, 1, &row_at, 1, &col_at, &value_at, INSERT_VALUES));
1146 }
1147
1148 // Adding diagonal elements
1149 PetscInt row_at = i_ch + _n_channels * iz_ind;
1150 PetscInt col_at = i_ch + _n_channels * iz_ind;
1151 PetscScalar value_at = (*_mdot_soln)(node_out) / (S_out * rho_out);
1152 LibmeshPetscCall(MatSetValues(
1153 _amc_advective_derivative_mat, 1, &row_at, 1, &col_at, &value_at, INSERT_VALUES));
1154
1156 unsigned int counter = 0;
1157 unsigned int cross_index = iz; // iz-1;
1158 for (auto i_gap : _subchannel_mesh.getChannelGaps(i_ch))
1159 {
1160 auto chans = _subchannel_mesh.getGapChannels(i_gap);
1161 unsigned int ii_ch = chans.first;
1162 unsigned int jj_ch = chans.second;
1163 auto * node_in_i = _subchannel_mesh.getChannelNode(ii_ch, iz - 1);
1164 auto * node_in_j = _subchannel_mesh.getChannelNode(jj_ch, iz - 1);
1165 auto * node_out_i = _subchannel_mesh.getChannelNode(ii_ch, iz);
1166 auto * node_out_j = _subchannel_mesh.getChannelNode(jj_ch, iz);
1167 auto rho_i =
1168 computeInterpolatedValue((*_rho_soln)(node_out_i), (*_rho_soln)(node_in_i), Pe);
1169 auto rho_j =
1170 computeInterpolatedValue((*_rho_soln)(node_out_j), (*_rho_soln)(node_in_j), Pe);
1171 auto S_i =
1172 computeInterpolatedValue((*_S_flow_soln)(node_out_i), (*_S_flow_soln)(node_in_i), Pe);
1173 auto S_j =
1174 computeInterpolatedValue((*_S_flow_soln)(node_out_j), (*_S_flow_soln)(node_in_j), Pe);
1175 auto u_star = 0.0;
1176 // figure out donor axial velocity
1177 if (_Wij(i_gap, cross_index) > 0.0)
1178 {
1179 if (iz == first_node)
1180 {
1181 u_star = (*_mdot_soln)(node_in_i) / S_i / rho_i;
1182 PetscScalar value_vec_ct = -1.0 * alpha *
1183 _subchannel_mesh.getCrossflowSign(i_ch, counter) *
1184 _Wij(i_gap, cross_index) * u_star;
1185 PetscInt row_vec_ct = i_ch + _n_channels * iz_ind;
1186 LibmeshPetscCall(VecSetValues(
1187 _amc_cross_derivative_rhs, 1, &row_vec_ct, &value_vec_ct, ADD_VALUES));
1188 }
1189 else
1190 {
1191 PetscScalar value_ct = alpha * _subchannel_mesh.getCrossflowSign(i_ch, counter) *
1192 _Wij(i_gap, cross_index) / S_i / rho_i;
1193 PetscInt row_ct = i_ch + _n_channels * iz_ind;
1194 PetscInt col_ct = ii_ch + _n_channels * (iz_ind - 1);
1195 LibmeshPetscCall(MatSetValues(
1196 _amc_cross_derivative_mat, 1, &row_ct, 1, &col_ct, &value_ct, ADD_VALUES));
1197 }
1198 PetscScalar value_ct = (1.0 - alpha) *
1199 _subchannel_mesh.getCrossflowSign(i_ch, counter) *
1200 _Wij(i_gap, cross_index) / S_i / rho_i;
1201 PetscInt row_ct = i_ch + _n_channels * iz_ind;
1202 PetscInt col_ct = ii_ch + _n_channels * iz_ind;
1203 LibmeshPetscCall(MatSetValues(
1204 _amc_cross_derivative_mat, 1, &row_ct, 1, &col_ct, &value_ct, ADD_VALUES));
1205 }
1206 else if (_Wij(i_gap, cross_index) < 0.0) // _Wij=0 operations not necessary
1207 {
1208 if (iz == first_node)
1209 {
1210 u_star = (*_mdot_soln)(node_in_j) / S_j / rho_j;
1211 PetscScalar value_vec_ct = -1.0 * alpha *
1212 _subchannel_mesh.getCrossflowSign(i_ch, counter) *
1213 _Wij(i_gap, cross_index) * u_star;
1214 PetscInt row_vec_ct = i_ch + _n_channels * iz_ind;
1215 LibmeshPetscCall(VecSetValues(
1216 _amc_cross_derivative_rhs, 1, &row_vec_ct, &value_vec_ct, ADD_VALUES));
1217 }
1218 else
1219 {
1220 PetscScalar value_ct = alpha * _subchannel_mesh.getCrossflowSign(i_ch, counter) *
1221 _Wij(i_gap, cross_index) / S_j / rho_j;
1222 PetscInt row_ct = i_ch + _n_channels * iz_ind;
1223 PetscInt col_ct = jj_ch + _n_channels * (iz_ind - 1);
1224 LibmeshPetscCall(MatSetValues(
1225 _amc_cross_derivative_mat, 1, &row_ct, 1, &col_ct, &value_ct, ADD_VALUES));
1226 }
1227 PetscScalar value_ct = (1.0 - alpha) *
1228 _subchannel_mesh.getCrossflowSign(i_ch, counter) *
1229 _Wij(i_gap, cross_index) / S_j / rho_j;
1230 PetscInt row_ct = i_ch + _n_channels * iz_ind;
1231 PetscInt col_ct = jj_ch + _n_channels * iz_ind;
1232 LibmeshPetscCall(MatSetValues(
1233 _amc_cross_derivative_mat, 1, &row_ct, 1, &col_ct, &value_ct, ADD_VALUES));
1234 }
1235
1236 if (iz == first_node)
1237 {
1238 PetscScalar value_vec_ct = -2.0 * alpha * (*_mdot_soln)(node_in)*_CT *
1239 _WijPrime(i_gap, cross_index) / (rho_interp * S_interp);
1240 value_vec_ct += alpha * (*_mdot_soln)(node_in_j)*_CT * _WijPrime(i_gap, cross_index) /
1241 (rho_j * S_j);
1242 value_vec_ct += alpha * (*_mdot_soln)(node_in_i)*_CT * _WijPrime(i_gap, cross_index) /
1243 (rho_i * S_i);
1244 PetscInt row_vec_ct = i_ch + _n_channels * iz_ind;
1245 LibmeshPetscCall(
1246 VecSetValues(_amc_cross_derivative_rhs, 1, &row_vec_ct, &value_vec_ct, ADD_VALUES));
1247 }
1248 else
1249 {
1250 PetscScalar value_center_ct =
1251 2.0 * alpha * _CT * _WijPrime(i_gap, cross_index) / (rho_interp * S_interp);
1252 PetscInt row_ct = i_ch + _n_channels * iz_ind;
1253 PetscInt col_ct = i_ch + _n_channels * (iz_ind - 1);
1254 LibmeshPetscCall(MatSetValues(
1255 _amc_cross_derivative_mat, 1, &row_ct, 1, &col_ct, &value_center_ct, ADD_VALUES));
1256
1257 PetscScalar value_left_ct =
1258 -1.0 * alpha * _CT * _WijPrime(i_gap, cross_index) / (rho_j * S_j);
1259 row_ct = i_ch + _n_channels * iz_ind;
1260 col_ct = jj_ch + _n_channels * (iz_ind - 1);
1261 LibmeshPetscCall(MatSetValues(
1262 _amc_cross_derivative_mat, 1, &row_ct, 1, &col_ct, &value_left_ct, ADD_VALUES));
1263
1264 PetscScalar value_right_ct =
1265 -1.0 * alpha * _CT * _WijPrime(i_gap, cross_index) / (rho_i * S_i);
1266 row_ct = i_ch + _n_channels * iz_ind;
1267 col_ct = ii_ch + _n_channels * (iz_ind - 1);
1268 LibmeshPetscCall(MatSetValues(
1269 _amc_cross_derivative_mat, 1, &row_ct, 1, &col_ct, &value_right_ct, ADD_VALUES));
1270 }
1271
1272 PetscScalar value_center_ct =
1273 2.0 * (1.0 - alpha) * _CT * _WijPrime(i_gap, cross_index) / (rho_interp * S_interp);
1274 PetscInt row_ct = i_ch + _n_channels * iz_ind;
1275 PetscInt col_ct = i_ch + _n_channels * iz_ind;
1276 LibmeshPetscCall(MatSetValues(
1277 _amc_cross_derivative_mat, 1, &row_ct, 1, &col_ct, &value_center_ct, ADD_VALUES));
1278
1279 PetscScalar value_left_ct =
1280 -1.0 * (1.0 - alpha) * _CT * _WijPrime(i_gap, cross_index) / (rho_j * S_j);
1281 row_ct = i_ch + _n_channels * iz_ind;
1282 col_ct = jj_ch + _n_channels * iz_ind;
1283 LibmeshPetscCall(MatSetValues(
1284 _amc_cross_derivative_mat, 1, &row_ct, 1, &col_ct, &value_left_ct, ADD_VALUES));
1285
1286 PetscScalar value_right_ct =
1287 -1.0 * (1.0 - alpha) * _CT * _WijPrime(i_gap, cross_index) / (rho_i * S_i);
1288 row_ct = i_ch + _n_channels * iz_ind;
1289 col_ct = ii_ch + _n_channels * iz_ind;
1290 LibmeshPetscCall(MatSetValues(
1291 _amc_cross_derivative_mat, 1, &row_ct, 1, &col_ct, &value_right_ct, ADD_VALUES));
1292 counter++;
1293 }
1294
1296 PetscScalar mdot_interp =
1297 computeInterpolatedValue((*_mdot_soln)(node_out), (*_mdot_soln)(node_in), Pe);
1298 auto Re = ((std::abs(mdot_interp) / S_interp) * Dh_c / mu_interp);
1299 _friction_args = FrictionStruct(i_ch, Re, S_interp, w_perim_interp);
1301 if (_ff_soln)
1302 _ff_soln->set(node_out, ff);
1304 auto ki = 0.0;
1305 if ((*_mdot_soln)(node_out) >= 0)
1306 ki = k_grid[i_ch][iz - 1];
1307 else
1308 ki = k_grid[i_ch][iz];
1309 auto coef = (ff * dz / Dh_c + ki) * 0.5 * std::abs(mdot_interp) / (S_interp * rho_interp);
1310 if (iz == first_node)
1311 {
1312 PetscScalar value_vec = -1.0 * alpha * coef * (*_mdot_soln)(node_in);
1313 PetscInt row_vec = i_ch + _n_channels * iz_ind;
1314 LibmeshPetscCall(
1315 VecSetValues(_amc_friction_force_rhs, 1, &row_vec, &value_vec, ADD_VALUES));
1316 }
1317 else
1318 {
1319 PetscInt row = i_ch + _n_channels * iz_ind;
1320 PetscInt col = i_ch + _n_channels * (iz_ind - 1);
1321 PetscScalar value = alpha * coef;
1322 LibmeshPetscCall(
1323 MatSetValues(_amc_friction_force_mat, 1, &row, 1, &col, &value, INSERT_VALUES));
1324 }
1325
1326 // Adding diagonal elements
1327 PetscInt row = i_ch + _n_channels * iz_ind;
1328 PetscInt col = i_ch + _n_channels * iz_ind;
1329 PetscScalar value = (1.0 - alpha) * coef;
1330 LibmeshPetscCall(
1331 MatSetValues(_amc_friction_force_mat, 1, &row, 1, &col, &value, INSERT_VALUES));
1332
1334 PetscScalar value_vec = _dir_grav * -1.0 * _g_grav * rho_interp * dz * S_interp;
1335 PetscInt row_vec = i_ch + _n_channels * iz_ind;
1336 LibmeshPetscCall(VecSetValues(_amc_gravity_rhs, 1, &row_vec, &value_vec, ADD_VALUES));
1337 }
1338 }
1340 LibmeshPetscCall(MatZeroEntries(_amc_sys_mdot_mat));
1341 LibmeshPetscCall(VecZeroEntries(_amc_sys_mdot_rhs));
1342 LibmeshPetscCall(MatAssemblyBegin(_amc_time_derivative_mat, MAT_FINAL_ASSEMBLY));
1343 LibmeshPetscCall(MatAssemblyEnd(_amc_time_derivative_mat, MAT_FINAL_ASSEMBLY));
1344 LibmeshPetscCall(MatAssemblyBegin(_amc_advective_derivative_mat, MAT_FINAL_ASSEMBLY));
1345 LibmeshPetscCall(MatAssemblyEnd(_amc_advective_derivative_mat, MAT_FINAL_ASSEMBLY));
1346 LibmeshPetscCall(MatAssemblyBegin(_amc_cross_derivative_mat, MAT_FINAL_ASSEMBLY));
1347 LibmeshPetscCall(MatAssemblyEnd(_amc_cross_derivative_mat, MAT_FINAL_ASSEMBLY));
1348 LibmeshPetscCall(MatAssemblyBegin(_amc_friction_force_mat, MAT_FINAL_ASSEMBLY));
1349 LibmeshPetscCall(MatAssemblyEnd(_amc_friction_force_mat, MAT_FINAL_ASSEMBLY));
1350 LibmeshPetscCall(MatAssemblyBegin(_amc_sys_mdot_mat, MAT_FINAL_ASSEMBLY));
1351 LibmeshPetscCall(MatAssemblyEnd(_amc_sys_mdot_mat, MAT_FINAL_ASSEMBLY));
1352 // Matrix
1353 LibmeshPetscCall(addTermMatrices(_amc_sys_mdot_mat,
1359 // RHS
1360 LibmeshPetscCall(VecAXPY(_amc_sys_mdot_rhs, 1.0, _amc_time_derivative_rhs));
1361 LibmeshPetscCall(VecAXPY(_amc_sys_mdot_rhs, 1.0, _amc_advective_derivative_rhs));
1362 LibmeshPetscCall(VecAXPY(_amc_sys_mdot_rhs, 1.0, _amc_cross_derivative_rhs));
1363 LibmeshPetscCall(VecAXPY(_amc_sys_mdot_rhs, 1.0, _amc_friction_force_rhs));
1364 LibmeshPetscCall(VecAXPY(_amc_sys_mdot_rhs, 1.0, _amc_gravity_rhs));
1365 if (_segregated_bool)
1366 {
1367 // Assembly the matrix system
1368 LibmeshPetscCall(populateVectorFromHandle<SolutionHandle>(
1369 _prod, *_mdot_soln, first_node, last_node, _n_channels));
1370 Vec ls;
1371 LibmeshPetscCall(VecDuplicate(_amc_sys_mdot_rhs, &ls));
1372 LibmeshPetscCall(MatMult(_amc_sys_mdot_mat, _prod, ls));
1373 LibmeshPetscCall(VecAXPY(ls, -1.0, _amc_sys_mdot_rhs));
1374 PetscScalar * xx;
1375 LibmeshPetscCall(VecGetArray(ls, &xx));
1376 for (unsigned int iz = first_node; iz < last_node + 1; iz++)
1377 {
1378 auto iz_ind = iz - first_node;
1379 for (unsigned int i_ch = 0; i_ch < _n_channels; i_ch++)
1380 {
1381 // Setting nodes
1382 auto * node_in = _subchannel_mesh.getChannelNode(i_ch, iz - 1);
1383 auto * node_out = _subchannel_mesh.getChannelNode(i_ch, iz);
1384
1385 // inlet, outlet, and interpolated axial surface area
1386 auto S_in = (*_S_flow_soln)(node_in);
1387 auto S_out = (*_S_flow_soln)(node_out);
1388 auto S_interp = computeInterpolatedValue(S_out, S_in, 0.5);
1389
1390 // Setting solutions
1391 if (S_interp != 0)
1392 {
1393 auto DP = (1 / S_interp) * xx[iz_ind * _n_channels + i_ch];
1394 _DP(i_ch, iz) = DP;
1395 if (_DP_soln)
1396 _DP_soln->set(node_out, DP);
1397 }
1398 else
1399 {
1400 auto DP = 0.0;
1401 _DP(i_ch, iz) = DP;
1402 if (_DP_soln)
1403 _DP_soln->set(node_out, DP);
1404 }
1405 }
1406 }
1407 LibmeshPetscCall(VecRestoreArray(ls, &xx));
1408 LibmeshPetscCall(VecDestroy(&ls));
1409 }
1410 }
1411}
const double Re
virtual Real computeFrictionFactor(const FrictionStruct &friction_info) const =0
Computes the friction factor for the local conditions.
libMesh::DenseMatrix< Real > _DP
const bool _segregated_bool
Segregated solve.
PetscScalar computeInterpolatedValue(PetscScalar topValue, PetscScalar botValue, PetscScalar Peclet=0.0)
std::unique_ptr< SolutionHandle > _w_perim_soln
const SCMFrictionClosureBase * _friction_closure
Friction closure object.
Mat _amc_sys_mdot_mat
Axial momentum system matrix.
libMesh::DenseMatrix< Real > _WijPrime
std::unique_ptr< SolutionHandle > _DP_soln
const MooseEnum _interpolation_scheme
The interpolation method used in constructing the systems.
std::unique_ptr< SolutionHandle > _rho_soln
struct SubChannel1PhaseProblem::FrictionStruct _friction_args
bool _amc_sys_mdot_pattern_set
Whether the nonzero patterns of the assembled system matrices have been established.
std::unique_ptr< SolutionHandle > _S_flow_soln
Mat _amc_time_derivative_mat
Axial momentum conservation - time derivative.
libMesh::DenseMatrix< Real > & _Wij
std::unique_ptr< SolutionHandle > _mu_soln
Real _TR
Flag that activates or deactivates the transient parts of the equations we solve by multiplication.
Mat _amc_friction_force_mat
Axial momentum conservation - friction force.
Real _CT
Turbulent modeling parameter used in axial momentum equation.
std::unique_ptr< SolutionHandle > _SumWij_soln
const bool _implicit_bool
Flag to define the usage of a implicit or explicit solution.
Mat _amc_cross_derivative_mat
Axial momentum conservation - cross flux derivative.
std::unique_ptr< SolutionHandle > _mdot_soln
Solutions handles and link to TH tables properties.
PetscScalar computeInterpolationCoefficients(PetscScalar Peclet=0.0) const
Functions that computes the interpolation scheme given the Peclet number.
Vec _amc_gravity_rhs
Axial momentum conservation - buoyancy force No implicit matrix.
Mat _amc_advective_derivative_mat
Axial momentum conservation - advective (Eulerian) derivative.
PetscErrorCode addTermMatrices(Mat system, const std::vector< Mat > &terms, bool &pattern_set)
Add the term matrices to a system matrix that was zeroed beforehand.
std::unique_ptr< SolutionHandle > _ff_soln
virtual const std::pair< unsigned int, unsigned int > & getGapChannels(unsigned int i_gap) const =0
Return a pair of subchannel indices for a given gap index.
virtual const Real & getCrossflowSign(unsigned int i_chan, unsigned int i_local) const =0
Return a sign for the crossflow given a subchannel index and local neighbor index.
virtual const std::vector< std::vector< Real > > & getKGrid() const
Get axial cell location and value of loss coefficient.
Real value(unsigned n, unsigned alpha, unsigned beta, Real x)
LIBMESH_DEVICE_INLINE auto row(const TensorLike &T_in, const unsigned int i) -> std::enable_if_t< is_tensor_like_v< TensorLike >, std::conditional_t< std::is_void< ResultVector >::value, libMesh::TypeVector< typename TensorLike::value_type >, ResultVector > >

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

◆ computeGravityDir()

Real SubChannel1PhaseProblem::computeGravityDir ( const MooseEnum &  dir) const
inlineprotectedinherited

inline function that is used to define the gravity direction

Definition at line 208 of file SubChannel1PhaseProblem.h.

209 {
210 switch (dir)
211 {
212 case 0: // counter_flow
213 return 1.0;
214 case 1: // co_flow
215 return -1.0;
216 case 2: // none
217 return 0.0;
218 default:
219 mooseError(name(), ": Invalid gravity direction: expected counter_flow, co_flow, or none");
220 }
221 }

◆ computeh()

void TriSubChannel1PhaseProblem::computeh ( int  iblock)
overrideprotectedvirtual

Computes Enthalpy per channel for block iblock.

Implements SubChannel1PhaseProblem.

Definition at line 326 of file TriSubChannel1PhaseProblem.C.

327{
328 unsigned int last_node = (iblock + 1) * _block_size;
329 unsigned int first_node = iblock * _block_size + 1;
330 const Real & wire_lead_length = _tri_sch_mesh.getWireLeadLength();
331 const Real & wire_diameter = _tri_sch_mesh.getWireDiameter();
332 const Real & pitch = _subchannel_mesh.getPitch();
333 const Real & pin_diameter = _subchannel_mesh.getPinDiameter();
334
335 if (iblock == 0)
336 {
337 for (unsigned int i_ch = 0; i_ch < _n_channels; i_ch++)
338 {
339 auto * node = _subchannel_mesh.getChannelNode(i_ch, 0);
340 auto h_out = _fp->h_from_p_T((*_P_soln)(node) + _P_out, (*_T_soln)(node));
341 if (h_out < 0)
342 {
344 name(), " : Calculation of negative Enthalpy h_out = : ", h_out, " Axial Level= : ", 0);
345 }
346 _h_soln->set(node, h_out);
347 }
348 }
349
350 if (!_implicit_bool)
351 {
352 for (unsigned int iz = first_node; iz < last_node + 1; iz++)
353 {
354 auto z_grid = _subchannel_mesh.getZGrid();
355 auto dz = z_grid[iz] - z_grid[iz - 1];
356 // Calculation of average mass flux of all periphery subchannels
357 Real edge_flux_ave = 0.0;
358 Real mdot_sum = 0.0;
359 Real si_sum = 0.0;
360 for (unsigned int i_ch = 0; i_ch < _n_channels; i_ch++)
361 {
362 auto subch_type = _subchannel_mesh.getSubchannelType(i_ch);
363 if (subch_type == EChannelType::EDGE || subch_type == EChannelType::CORNER)
364 {
365 auto * node_in = _subchannel_mesh.getChannelNode(i_ch, iz - 1);
366 auto Si = (*_S_flow_soln)(node_in);
367 auto mdot_in = (*_mdot_soln)(node_in);
368 mdot_sum = mdot_sum + mdot_in;
369 si_sum = si_sum + Si;
370 }
371 }
372 edge_flux_ave = mdot_sum / si_sum;
373
374 for (unsigned int i_ch = 0; i_ch < _n_channels; i_ch++)
375 {
376 auto * node_in = _subchannel_mesh.getChannelNode(i_ch, iz - 1);
377 auto * node_out = _subchannel_mesh.getChannelNode(i_ch, iz);
378 auto mdot_in = (*_mdot_soln)(node_in);
379 auto h_in = (*_h_soln)(node_in); // J/kg
380 auto volume = dz * (*_S_flow_soln)(node_in);
381 auto mdot_out = (*_mdot_soln)(node_out);
382 auto h_out = 0.0;
383 Real sumWijh = 0.0;
384 Real sumWijPrimeDhij = 0.0;
385 Real sweep_enthalpy = 0.0;
386 Real e_cond = 0.0;
387
388 // Calculate added enthalpy from heatflux (Pin, Duct)
389 Real added_enthalpy = computeAddedHeatPin(i_ch, iz);
390 added_enthalpy += computeAddedHeatDuct(i_ch, iz);
391
392 // Calculate net sum of enthalpy into/out-of channel i from channels j around i
393 // (Turbulent diffusion, Diversion Crossflow, Sweep flow Enthalpy, Radial heat conduction)
394 unsigned int counter = 0;
395 for (auto i_gap : _subchannel_mesh.getChannelGaps(i_ch))
396 {
397 auto chans = _subchannel_mesh.getGapChannels(i_gap);
398 auto gap = _subchannel_mesh.getGapWidth(iz, i_gap);
399 auto Sij = dz * gap;
400 unsigned int ii_ch = chans.first; // the first subchannel next to gap i_gap
401 unsigned int jj_ch = chans.second; // the second subchannel next to gap i_gap
402 auto * node_in_i = _subchannel_mesh.getChannelNode(ii_ch, iz - 1);
403 auto * node_in_j = _subchannel_mesh.getChannelNode(jj_ch, iz - 1);
404 auto subch_type_i = _subchannel_mesh.getSubchannelType(ii_ch);
405 auto subch_type_j = _subchannel_mesh.getSubchannelType(jj_ch);
406 // Define donor enthalpy
407 auto h_star = 0.0;
408 if (_Wij(i_gap, iz) > 0.0)
409 h_star = (*_h_soln)(node_in_i);
410 else if (_Wij(i_gap, iz) < 0.0)
411 h_star = (*_h_soln)(node_in_j);
412 // Diversion crossflow
413 // take care of the sign by applying the map, use donor cell
414 sumWijh += _subchannel_mesh.getCrossflowSign(i_ch, counter) * _Wij(i_gap, iz) * h_star;
415 counter++;
416 // SWEEP FLOW is calculated if i_gap is located in the periphery
417 // and we have a wire-wrap (if i_gap is in the periphery then i_ch is in the periphery)
418 // There are two gaps per periphery subchannel that this is true.
419 if ((subch_type_i == EChannelType::CORNER || subch_type_i == EChannelType::EDGE) &&
420 (subch_type_j == EChannelType::CORNER || subch_type_j == EChannelType::EDGE) &&
421 (wire_lead_length != 0) && (wire_diameter != 0))
422 {
423 // donor subchannel and node of sweep flow. The donor subchannel is the subchannel next
424 // to i_ch that sweep flow, flows from and into i_ch
425 auto sweep_donor = _tri_sch_mesh.getSweepFlowChans(i_ch).first;
426 auto * node_sweep_donor = _subchannel_mesh.getChannelNode(sweep_donor, iz - 1);
427 // if one of the neighbor subchannels of the periphery gap is the donor subchannel
428 //(the other would be the i_ch) sweep enthalpy flows into i_ch
429 if ((ii_ch == sweep_donor) || (jj_ch == sweep_donor))
430 {
431 sweep_enthalpy += computeSweepFlowMixingParameter(i_gap, iz) * edge_flux_ave * Sij *
432 (*_h_soln)(node_sweep_donor);
433 }
434 // else sweep enthalpy flows out of i_ch
435 else
436 {
437 sweep_enthalpy -= computeSweepFlowMixingParameter(i_gap, iz) * edge_flux_ave * Sij *
438 (*_h_soln)(node_in);
439 }
440 }
441 // Inner gap
442 // Turbulent Diffusion
443 else
444 {
445 sumWijPrimeDhij +=
446 _WijPrime(i_gap, iz) * (2 * h_in - (*_h_soln)(node_in_j) - (*_h_soln)(node_in_i));
447 }
448
449 // compute the radial heat conduction through the gaps
450 Real dist_ij = pitch;
451
452 if (subch_type_i == EChannelType::EDGE && subch_type_j == EChannelType::EDGE)
453 {
454 dist_ij = pitch;
455 }
456 else if ((subch_type_i == EChannelType::CORNER && subch_type_j == EChannelType::EDGE) ||
457 (subch_type_i == EChannelType::EDGE && subch_type_j == EChannelType::CORNER))
458 {
459 dist_ij = pitch;
460 }
461 else
462 {
463 dist_ij = pitch / std::sqrt(3);
464 }
465
466 auto thcon_i = _fp->k_from_p_T((*_P_soln)(node_in_i) + _P_out, (*_T_soln)(node_in_i));
467 auto thcon_j = _fp->k_from_p_T((*_P_soln)(node_in_j) + _P_out, (*_T_soln)(node_in_j));
468 auto shape_factor =
469 0.66 * (pitch / pin_diameter) *
470 std::pow((_subchannel_mesh.getGapWidth(iz, i_gap) / pin_diameter), -0.3);
471 if (ii_ch == i_ch)
472 {
473 e_cond += 0.5 * (thcon_i + thcon_j) * Sij * shape_factor *
474 ((*_T_soln)(node_in_j) - (*_T_soln)(node_in_i)) / dist_ij;
475 }
476 else
477 {
478 e_cond += -0.5 * (thcon_i + thcon_j) * Sij * shape_factor *
479 ((*_T_soln)(node_in_j) - (*_T_soln)(node_in_i)) / dist_ij;
480 }
481 }
482
483 // compute the axial heat conduction between current and lower axial node
484 auto * node_in_i = _subchannel_mesh.getChannelNode(i_ch, iz);
485 auto * node_in_j = _subchannel_mesh.getChannelNode(i_ch, iz - 1);
486 auto thcon_i = _fp->k_from_p_T((*_P_soln)(node_in_i) + _P_out, (*_T_soln)(node_in_i));
487 auto thcon_j = _fp->k_from_p_T((*_P_soln)(node_in_j) + _P_out, (*_T_soln)(node_in_j));
488 auto Si = (*_S_flow_soln)(node_in_i);
489 auto dist_ij = z_grid[iz] - z_grid[iz - 1];
490
491 e_cond += 0.5 * (thcon_i + thcon_j) * Si * ((*_T_soln)(node_in_j) - (*_T_soln)(node_in_i)) /
492 dist_ij;
493
494 unsigned int nz = _subchannel_mesh.getNumOfAxialCells();
495 // compute the axial heat conduction between current and upper axial node
496 if (iz < nz)
497 {
498 auto * node_in_i = _subchannel_mesh.getChannelNode(i_ch, iz);
499 auto * node_in_j = _subchannel_mesh.getChannelNode(i_ch, iz + 1);
500 auto thcon_i = _fp->k_from_p_T((*_P_soln)(node_in_i) + _P_out, (*_T_soln)(node_in_i));
501 auto thcon_j = _fp->k_from_p_T((*_P_soln)(node_in_j) + _P_out, (*_T_soln)(node_in_j));
502 auto Si = (*_S_flow_soln)(node_in_i);
503 auto dist_ij = z_grid[iz + 1] - z_grid[iz];
504 e_cond += 0.5 * (thcon_i + thcon_j) * Si *
505 ((*_T_soln)(node_in_j) - (*_T_soln)(node_in_i)) / dist_ij;
506 }
507
508 // end of radial heat conduction calc.
509 h_out =
510 (mdot_in * h_in - sumWijh - sumWijPrimeDhij + added_enthalpy + e_cond + sweep_enthalpy +
511 _TR * _rho_soln->old(node_out) * _h_soln->old(node_out) * volume / _dt) /
512 (mdot_out + _TR * (*_rho_soln)(node_out)*volume / _dt);
513 if (h_out < 0)
514 {
516 " : Calculation of negative Enthalpy h_out = : ",
517 h_out,
518 " Axial Level= : ",
519 iz);
520 }
521 _h_soln->set(node_out, h_out); // J/kg
522 }
523 }
524 }
525 else
526 {
527 LibmeshPetscCall(MatZeroEntries(_hc_time_derivative_mat));
528 LibmeshPetscCall(MatZeroEntries(_hc_advective_derivative_mat));
529 LibmeshPetscCall(MatZeroEntries(_hc_cross_derivative_mat));
530 LibmeshPetscCall(MatZeroEntries(_hc_axial_heat_conduction_mat));
531 LibmeshPetscCall(MatZeroEntries(_hc_radial_heat_conduction_mat));
532 LibmeshPetscCall(MatZeroEntries(_hc_sweep_enthalpy_mat));
533
534 LibmeshPetscCall(VecZeroEntries(_hc_time_derivative_rhs));
535 LibmeshPetscCall(VecZeroEntries(_hc_advective_derivative_rhs));
536 LibmeshPetscCall(VecZeroEntries(_hc_cross_derivative_rhs));
537 LibmeshPetscCall(VecZeroEntries(_hc_added_heat_rhs));
538 LibmeshPetscCall(VecZeroEntries(_hc_axial_heat_conduction_rhs));
539 LibmeshPetscCall(VecZeroEntries(_hc_radial_heat_conduction_rhs));
540 LibmeshPetscCall(VecZeroEntries(_hc_sweep_enthalpy_rhs));
541
542 // Thermal conductivity and specific heat are needed at every node many times during the
543 // assembly; evaluate each node once. Pressure and temperature do not change during assembly.
544 // The caches are keyed by node id, so they hold only the subchannel nodes of the block whatever
545 // the numbering of the mesh nodes.
546 std::unordered_map<dof_id_type, Real> k_cache;
547 std::unordered_map<dof_id_type, Real> cp_cache;
548 auto thermalConductivity = [&](const Node * node)
549 {
550 const auto [it, inserted] = k_cache.try_emplace(node->id());
551 if (inserted)
552 it->second = _fp->k_from_p_T((*_P_soln)(node) + _P_out, (*_T_soln)(node));
553 return it->second;
554 };
555 auto specificHeat = [&](const Node * node)
556 {
557 const auto [it, inserted] = cp_cache.try_emplace(node->id());
558 if (inserted)
559 it->second = _fp->cp_from_p_T((*_P_soln)(node) + _P_out, (*_T_soln)(node));
560 return it->second;
561 };
562
563 LibmeshPetscCall(MatZeroEntries(_hc_sys_h_mat));
564 LibmeshPetscCall(VecZeroEntries(_hc_sys_h_rhs));
565
566 for (unsigned int iz = first_node; iz < last_node + 1; iz++)
567 {
568 auto dz = _z_grid[iz] - _z_grid[iz - 1];
569 auto pitch = _subchannel_mesh.getPitch();
570 auto pin_diameter = _subchannel_mesh.getPinDiameter();
571 auto iz_ind = iz - first_node;
572
573 // Calculation of average mass flux of all periphery subchannels, used by the sweep flow
574 Real mdot_sum = 0.0;
575 Real si_sum = 0.0;
576 for (unsigned int i_ch = 0; i_ch < _n_channels; i_ch++)
577 {
578 const auto subch_type = _subchannel_mesh.getSubchannelType(i_ch);
579 if (subch_type == EChannelType::EDGE || subch_type == EChannelType::CORNER)
580 {
581 const auto * node_in = _subchannel_mesh.getChannelNode(i_ch, iz - 1);
582 mdot_sum += (*_mdot_soln)(node_in);
583 si_sum += (*_S_flow_soln)(node_in);
584 }
585 }
586 const Real edge_flux_ave = mdot_sum / si_sum;
587
588 for (unsigned int i_ch = 0; i_ch < _n_channels; i_ch++)
589 {
590 auto * node_in = _subchannel_mesh.getChannelNode(i_ch, iz - 1);
591 auto * node_out = _subchannel_mesh.getChannelNode(i_ch, iz);
592 auto S_in = (*_S_flow_soln)(node_in);
593 auto S_out = (*_S_flow_soln)(node_out);
594 auto S_interp = computeInterpolatedValue(S_out, S_in, 0.5);
595 auto volume = dz * S_interp;
596
597 PetscScalar Pe = 0.5;
598 if (_interpolation_scheme == 3)
599 {
600 // Compute the cell Peclet number
601 auto w_perim_in = (*_w_perim_soln)(node_in);
602 auto w_perim_out = (*_w_perim_soln)(node_out);
603 auto w_perim_interp = this->computeInterpolatedValue(w_perim_out, w_perim_in, 0.5);
604 auto K_in = thermalConductivity(node_in);
605 auto K_out = thermalConductivity(node_out);
606 auto K = this->computeInterpolatedValue(K_out, K_in, 0.5);
607 auto cp_in = specificHeat(node_in);
608 auto cp_out = specificHeat(node_out);
609 auto cp = this->computeInterpolatedValue(cp_out, cp_in, 0.5);
610 auto mdot_loc =
611 this->computeInterpolatedValue((*_mdot_soln)(node_out), (*_mdot_soln)(node_in), 0.5);
612 // hydraulic diameter in the i direction
613 auto Dh_i = 4.0 * S_interp / w_perim_interp;
614 Pe = mdot_loc * Dh_i * cp / (K * S_interp) * (mdot_loc / std::abs(mdot_loc));
615 }
616 auto alpha = computeInterpolationCoefficients(Pe);
617
618 // Keep temporal storage independent of the spatial interpolation scheme. Applying the
619 // upwind coefficient to this term puts the storage on the upstream node and makes the
620 // small-timestep matrix singular in the upwind limit.
621 PetscInt row_tt = i_ch + _n_channels * iz_ind;
622 PetscInt col_tt = i_ch + _n_channels * iz_ind;
623 PetscScalar value_tt = _TR * (*_rho_soln)(node_out)*volume / _dt;
624 LibmeshPetscCall(MatSetValues(
625 _hc_time_derivative_mat, 1, &row_tt, 1, &col_tt, &value_tt, INSERT_VALUES));
626
627 PetscScalar value_vec_tt =
628 _TR * _rho_soln->old(node_out) * _h_soln->old(node_out) * volume / _dt;
629 PetscInt row_vec_tt = i_ch + _n_channels * iz_ind;
630 LibmeshPetscCall(
631 VecSetValues(_hc_time_derivative_rhs, 1, &row_vec_tt, &value_vec_tt, ADD_VALUES));
632
633 // Advective derivative term. mdot and h are face values, so the axial enthalpy flux
634 // through a face is mdot * h at that face and needs no interpolation
635 if (iz == first_node)
636 {
637 PetscInt row_at = i_ch + _n_channels * iz_ind;
638 PetscScalar value_at = (*_mdot_soln)(node_in) * (*_h_soln)(node_in);
639 LibmeshPetscCall(
640 VecSetValues(_hc_advective_derivative_rhs, 1, &row_at, &value_at, ADD_VALUES));
641 }
642 else
643 {
644 PetscInt row_at = i_ch + _n_channels * iz_ind;
645 PetscInt col_at = i_ch + _n_channels * (iz_ind - 1);
646 PetscScalar value_at = -1.0 * (*_mdot_soln)(node_in);
647 LibmeshPetscCall(MatSetValues(
648 _hc_advective_derivative_mat, 1, &row_at, 1, &col_at, &value_at, ADD_VALUES));
649 }
650
651 PetscInt row_at = i_ch + _n_channels * iz_ind;
652 PetscInt col_at = i_ch + _n_channels * iz_ind;
653 PetscScalar value_at = (*_mdot_soln)(node_out);
654 LibmeshPetscCall(MatSetValues(
655 _hc_advective_derivative_mat, 1, &row_at, 1, &col_at, &value_at, ADD_VALUES));
656
657 // Axial heat conduction
658 auto * node_center = _subchannel_mesh.getChannelNode(i_ch, iz);
659 auto K_center = thermalConductivity(node_center);
660 auto cp_center = specificHeat(node_center);
661 auto diff_center = K_center / (cp_center + 1e-15);
662
663 if (iz == first_node)
664 {
665 auto * node_top = _subchannel_mesh.getChannelNode(i_ch, iz + 1);
666 auto * node_bottom = _subchannel_mesh.getChannelNode(i_ch, iz - 1);
667 auto K_bottom = thermalConductivity(node_bottom);
668 auto K_top = thermalConductivity(node_top);
669 auto cp_bottom = specificHeat(node_bottom);
670 auto cp_top = specificHeat(node_top);
671 auto diff_bottom = K_bottom / (cp_bottom + 1e-15);
672 auto diff_top = K_top / (cp_top + 1e-15);
673
674 auto dz_up = _z_grid[iz + 1] - _z_grid[iz];
675 auto dz_down = _z_grid[iz] - _z_grid[iz - 1];
676 auto S_up =
677 computeInterpolatedValue((*_S_flow_soln)(node_top), (*_S_flow_soln)(node_center));
678 auto S_down =
679 computeInterpolatedValue((*_S_flow_soln)(node_center), (*_S_flow_soln)(node_bottom));
680 auto diff_up = computeInterpolatedValue(diff_top, diff_center);
681 auto diff_down = computeInterpolatedValue(diff_center, diff_bottom);
682
683 // Diagonal value
684 PetscInt row_at = i_ch + _n_channels * iz_ind;
685 PetscInt col_at = i_ch + _n_channels * iz_ind;
686 PetscScalar value_at = diff_up * S_up / dz_up + diff_down * S_down / dz_down;
687 LibmeshPetscCall(MatSetValues(
688 _hc_axial_heat_conduction_mat, 1, &row_at, 1, &col_at, &value_at, INSERT_VALUES));
689
690 // Bottom value
691 value_at = 1.0 * diff_down * S_down / dz_down * (*_h_soln)(node_bottom);
692 LibmeshPetscCall(
693 VecSetValues(_hc_axial_heat_conduction_rhs, 1, &row_at, &value_at, ADD_VALUES));
694
695 // Top value
696 col_at = i_ch + _n_channels * (iz_ind + 1);
697 value_at = -diff_up * S_up / dz_up;
698 LibmeshPetscCall(MatSetValues(
699 _hc_axial_heat_conduction_mat, 1, &row_at, 1, &col_at, &value_at, INSERT_VALUES));
700 }
701 else if (iz == last_node)
702 {
703 auto * node_bottom = _subchannel_mesh.getChannelNode(i_ch, iz - 1);
704 auto K_bottom = thermalConductivity(node_bottom);
705 auto cp_bottom = specificHeat(node_bottom);
706 auto diff_bottom = K_bottom / (cp_bottom + 1e-15);
707
708 auto dz_down = _z_grid[iz] - _z_grid[iz - 1];
709 auto S_down = 0.5 * ((*_S_flow_soln)(node_center) + (*_S_flow_soln)(node_bottom));
710 auto diff_down = 0.5 * (diff_center + diff_bottom);
711
712 // Diagonal value
713 PetscInt row_at = i_ch + _n_channels * iz_ind;
714 PetscInt col_at = i_ch + _n_channels * iz_ind;
715 PetscScalar value_at = diff_down * S_down / dz_down;
716 LibmeshPetscCall(MatSetValues(
717 _hc_axial_heat_conduction_mat, 1, &row_at, 1, &col_at, &value_at, INSERT_VALUES));
718
719 // Bottom value
720 col_at = i_ch + _n_channels * (iz_ind - 1);
721 value_at = -diff_down * S_down / dz_down;
722 LibmeshPetscCall(MatSetValues(
723 _hc_axial_heat_conduction_mat, 1, &row_at, 1, &col_at, &value_at, INSERT_VALUES));
724
725 // No conduction term for the outlet face: the two entries above are equal and opposite,
726 // so the row conducts only with the cell below and the outlet is modeled as adiabatic
727 // (zero enthalpy gradient). This neglects conduction into an outlet plenum, which is not
728 // part of the domain, and it is why the conduction of the block loses heat only through
729 // the inlet, where the enthalpy is prescribed (see
730 // SCMInletConductionHeatRatePostprocessor). The outflow enthalpy the flow itself carries
731 // is already in the advective term, whose diagonal holds mdot of this face for every cell
732 // including this one.
733 }
734 else
735 {
736 auto * node_top = _subchannel_mesh.getChannelNode(i_ch, iz + 1);
737 auto * node_bottom = _subchannel_mesh.getChannelNode(i_ch, iz - 1);
738 auto K_bottom = thermalConductivity(node_bottom);
739 auto K_top = thermalConductivity(node_top);
740 auto cp_bottom = specificHeat(node_bottom);
741 auto cp_top = specificHeat(node_top);
742 auto diff_bottom = K_bottom / (cp_bottom + 1e-15);
743 auto diff_top = K_top / (cp_top + 1e-15);
744
745 auto dz_up = _z_grid[iz + 1] - _z_grid[iz];
746 auto dz_down = _z_grid[iz] - _z_grid[iz - 1];
747 auto S_up =
748 computeInterpolatedValue((*_S_flow_soln)(node_top), (*_S_flow_soln)(node_center));
749 auto S_down =
750 computeInterpolatedValue((*_S_flow_soln)(node_center), (*_S_flow_soln)(node_bottom));
751 auto diff_up = computeInterpolatedValue(diff_top, diff_center);
752 auto diff_down = computeInterpolatedValue(diff_center, diff_bottom);
753
754 // Diagonal value
755 PetscInt row_at = i_ch + _n_channels * iz_ind;
756 PetscInt col_at = i_ch + _n_channels * iz_ind;
757 PetscScalar value_at = diff_up * S_up / dz_up + diff_down * S_down / dz_down;
758 LibmeshPetscCall(MatSetValues(
759 _hc_axial_heat_conduction_mat, 1, &row_at, 1, &col_at, &value_at, INSERT_VALUES));
760
761 // Bottom value
762 col_at = i_ch + _n_channels * (iz_ind - 1);
763 value_at = -diff_down * S_down / dz_down;
764 LibmeshPetscCall(MatSetValues(
765 _hc_axial_heat_conduction_mat, 1, &row_at, 1, &col_at, &value_at, INSERT_VALUES));
766
767 // Top value
768 col_at = i_ch + _n_channels * (iz_ind + 1);
769 value_at = -diff_up * S_up / dz_up;
770 LibmeshPetscCall(MatSetValues(
771 _hc_axial_heat_conduction_mat, 1, &row_at, 1, &col_at, &value_at, INSERT_VALUES));
772 }
773
774 // Radial Terms
775 unsigned int counter = 0;
776 unsigned int cross_index = iz;
777 // Real radial_heat_conduction(0.0);
778 for (auto i_gap : _subchannel_mesh.getChannelGaps(i_ch))
779 {
780 auto chans = _subchannel_mesh.getGapChannels(i_gap);
781 unsigned int ii_ch = chans.first;
782 unsigned int jj_ch = chans.second;
783 auto * node_in_i = _subchannel_mesh.getChannelNode(ii_ch, iz - 1);
784 auto * node_in_j = _subchannel_mesh.getChannelNode(jj_ch, iz - 1);
785 PetscScalar h_star;
786 // figure out donor axial velocity
787 if (_Wij(i_gap, cross_index) > 0.0)
788 {
789 if (iz == first_node)
790 {
791 h_star = (*_h_soln)(node_in_i);
792 PetscScalar value_vec_ct = -1.0 * alpha *
793 _subchannel_mesh.getCrossflowSign(i_ch, counter) *
794 _Wij(i_gap, cross_index) * h_star;
795 PetscInt row_vec_ct = i_ch + _n_channels * iz_ind;
796 LibmeshPetscCall(VecSetValues(
797 _hc_cross_derivative_rhs, 1, &row_vec_ct, &value_vec_ct, ADD_VALUES));
798 }
799 else
800 {
801 PetscScalar value_ct = alpha * _subchannel_mesh.getCrossflowSign(i_ch, counter) *
802 _Wij(i_gap, cross_index);
803 PetscInt row_ct = i_ch + _n_channels * iz_ind;
804 PetscInt col_ct = ii_ch + _n_channels * (iz_ind - 1);
805 LibmeshPetscCall(MatSetValues(
806 _hc_cross_derivative_mat, 1, &row_ct, 1, &col_ct, &value_ct, ADD_VALUES));
807 }
808 PetscScalar value_ct = (1.0 - alpha) *
809 _subchannel_mesh.getCrossflowSign(i_ch, counter) *
810 _Wij(i_gap, cross_index);
811 PetscInt row_ct = i_ch + _n_channels * iz_ind;
812 PetscInt col_ct = ii_ch + _n_channels * iz_ind;
813 LibmeshPetscCall(MatSetValues(
814 _hc_cross_derivative_mat, 1, &row_ct, 1, &col_ct, &value_ct, ADD_VALUES));
815 }
816 else if (_Wij(i_gap, cross_index) < 0.0) // _Wij=0 operations not necessary
817 {
818 if (iz == first_node)
819 {
820 h_star = (*_h_soln)(node_in_j);
821 PetscScalar value_vec_ct = -1.0 * alpha *
822 _subchannel_mesh.getCrossflowSign(i_ch, counter) *
823 _Wij(i_gap, cross_index) * h_star;
824 PetscInt row_vec_ct = i_ch + _n_channels * iz_ind;
825 LibmeshPetscCall(VecSetValues(
826 _hc_cross_derivative_rhs, 1, &row_vec_ct, &value_vec_ct, ADD_VALUES));
827 }
828 else
829 {
830 PetscScalar value_ct = alpha * _subchannel_mesh.getCrossflowSign(i_ch, counter) *
831 _Wij(i_gap, cross_index);
832 PetscInt row_ct = i_ch + _n_channels * iz_ind;
833 PetscInt col_ct = jj_ch + _n_channels * (iz_ind - 1);
834 LibmeshPetscCall(MatSetValues(
835 _hc_cross_derivative_mat, 1, &row_ct, 1, &col_ct, &value_ct, ADD_VALUES));
836 }
837 PetscScalar value_ct = (1.0 - alpha) *
838 _subchannel_mesh.getCrossflowSign(i_ch, counter) *
839 _Wij(i_gap, cross_index);
840 PetscInt row_ct = i_ch + _n_channels * iz_ind;
841 PetscInt col_ct = jj_ch + _n_channels * iz_ind;
842 LibmeshPetscCall(MatSetValues(
843 _hc_cross_derivative_mat, 1, &row_ct, 1, &col_ct, &value_ct, ADD_VALUES));
844 }
845
846 // Turbulent cross flows
847 if (iz == first_node)
848 {
849 PetscScalar value_vec_ct =
850 -2.0 * alpha * (*_h_soln)(node_in)*_WijPrime(i_gap, cross_index);
851 value_vec_ct += alpha * (*_h_soln)(node_in_j)*_WijPrime(i_gap, cross_index);
852 value_vec_ct += alpha * (*_h_soln)(node_in_i)*_WijPrime(i_gap, cross_index);
853 PetscInt row_vec_ct = i_ch + _n_channels * iz_ind;
854 LibmeshPetscCall(
855 VecSetValues(_hc_cross_derivative_rhs, 1, &row_vec_ct, &value_vec_ct, ADD_VALUES));
856 }
857 else
858 {
859 PetscScalar value_center_ct = 2.0 * alpha * _WijPrime(i_gap, cross_index);
860 PetscInt row_ct = i_ch + _n_channels * iz_ind;
861 PetscInt col_ct = i_ch + _n_channels * (iz_ind - 1);
862 LibmeshPetscCall(MatSetValues(
863 _hc_cross_derivative_mat, 1, &row_ct, 1, &col_ct, &value_center_ct, ADD_VALUES));
864
865 PetscScalar value_left_ct = -1.0 * alpha * _WijPrime(i_gap, cross_index);
866 row_ct = i_ch + _n_channels * iz_ind;
867 col_ct = jj_ch + _n_channels * (iz_ind - 1);
868 LibmeshPetscCall(MatSetValues(
869 _hc_cross_derivative_mat, 1, &row_ct, 1, &col_ct, &value_left_ct, ADD_VALUES));
870
871 PetscScalar value_right_ct = -1.0 * alpha * _WijPrime(i_gap, cross_index);
872 row_ct = i_ch + _n_channels * iz_ind;
873 col_ct = ii_ch + _n_channels * (iz_ind - 1);
874 LibmeshPetscCall(MatSetValues(
875 _hc_cross_derivative_mat, 1, &row_ct, 1, &col_ct, &value_right_ct, ADD_VALUES));
876 }
877 PetscScalar value_center_ct = 2.0 * (1.0 - alpha) * _WijPrime(i_gap, cross_index);
878 PetscInt row_ct = i_ch + _n_channels * iz_ind;
879 PetscInt col_ct = i_ch + _n_channels * iz_ind;
880 LibmeshPetscCall(MatSetValues(
881 _hc_cross_derivative_mat, 1, &row_ct, 1, &col_ct, &value_center_ct, ADD_VALUES));
882
883 PetscScalar value_left_ct = -1.0 * (1.0 - alpha) * _WijPrime(i_gap, cross_index);
884 row_ct = i_ch + _n_channels * iz_ind;
885 col_ct = jj_ch + _n_channels * iz_ind;
886 LibmeshPetscCall(MatSetValues(
887 _hc_cross_derivative_mat, 1, &row_ct, 1, &col_ct, &value_left_ct, ADD_VALUES));
888
889 PetscScalar value_right_ct = -1.0 * (1.0 - alpha) * _WijPrime(i_gap, cross_index);
890 row_ct = i_ch + _n_channels * iz_ind;
891 col_ct = ii_ch + _n_channels * iz_ind;
892 LibmeshPetscCall(MatSetValues(
893 _hc_cross_derivative_mat, 1, &row_ct, 1, &col_ct, &value_right_ct, ADD_VALUES));
894
895 // Radial heat conduction
896 auto subch_type_i = _subchannel_mesh.getSubchannelType(ii_ch);
897 auto subch_type_j = _subchannel_mesh.getSubchannelType(jj_ch);
898 Real dist_ij = pitch;
899
900 if (subch_type_i == EChannelType::EDGE && subch_type_j == EChannelType::EDGE)
901 {
902 dist_ij = pitch;
903 }
904 else if ((subch_type_i == EChannelType::CORNER && subch_type_j == EChannelType::EDGE) ||
905 (subch_type_i == EChannelType::EDGE && subch_type_j == EChannelType::CORNER))
906 {
907 dist_ij = pitch;
908 }
909 else
910 {
911 dist_ij = pitch / std::sqrt(3);
912 }
913
914 auto Sij = dz * _subchannel_mesh.getGapWidth(iz, i_gap);
915 auto K_i = thermalConductivity(node_in_i);
916 auto K_j = thermalConductivity(node_in_j);
917 auto cp_i = specificHeat(node_in_i);
918 auto cp_j = specificHeat(node_in_j);
919 auto A_i = K_i / cp_i;
920 auto A_j = K_j / cp_j;
921 auto harm_A = 2.0 * A_i * A_j / (A_i + A_j);
922 auto shape_factor =
923 0.66 * (pitch / pin_diameter) *
924 std::pow((_subchannel_mesh.getGapWidth(iz, i_gap) / pin_diameter), -0.3);
925 // auto base_value = 0.5 * (A_i + A_j) * Sij * shape_factor / dist_ij;
926 auto base_value = harm_A * shape_factor * Sij / dist_ij;
927 auto neg_base_value = -1.0 * base_value;
928
929 // Each gap is visited once from each of its two channels, so only the row of the
930 // current channel is written here
931 const auto other_ch = (i_ch == ii_ch) ? jj_ch : ii_ch;
932 row_ct = i_ch + _n_channels * iz_ind;
933 col_ct = i_ch + _n_channels * iz_ind;
934 LibmeshPetscCall(MatSetValues(
935 _hc_radial_heat_conduction_mat, 1, &row_ct, 1, &col_ct, &base_value, ADD_VALUES));
936
937 col_ct = other_ch + _n_channels * iz_ind;
938 LibmeshPetscCall(MatSetValues(
939 _hc_radial_heat_conduction_mat, 1, &row_ct, 1, &col_ct, &neg_base_value, ADD_VALUES));
940 counter++;
941 }
942
943 // Compute the sweep flow enthalpy change
944 auto subch_type = _subchannel_mesh.getSubchannelType(i_ch);
945 PetscScalar sweep_enthalpy = 0.0;
946 if ((subch_type == EChannelType::EDGE || subch_type == EChannelType::CORNER) &&
947 (wire_diameter != 0.0) && (wire_lead_length != 0.0))
948 {
949 auto beta_in = std::numeric_limits<double>::quiet_NaN();
950 auto beta_out = std::numeric_limits<double>::quiet_NaN();
951 // donor sweep channel for i_ch
952 auto sweep_donor = _tri_sch_mesh.getSweepFlowChans(i_ch).first;
953 auto * node_sweep_donor = _subchannel_mesh.getChannelNode(sweep_donor, iz - 1);
954 // Calculation of turbulent mixing parameter
955 for (auto i_gap : _subchannel_mesh.getChannelGaps(i_ch))
956 {
957 auto chans = _subchannel_mesh.getGapChannels(i_gap);
958 unsigned int ii_ch = chans.first;
959 unsigned int jj_ch = chans.second;
960 auto subch_type_i = _subchannel_mesh.getSubchannelType(ii_ch);
961 auto subch_type_j = _subchannel_mesh.getSubchannelType(jj_ch);
962 if ((subch_type_i == EChannelType::CORNER || subch_type_i == EChannelType::EDGE) &&
963 (subch_type_j == EChannelType::CORNER || subch_type_j == EChannelType::EDGE))
964 {
965 if ((ii_ch == sweep_donor) || (jj_ch == sweep_donor))
966 {
967 beta_in = computeSweepFlowMixingParameter(i_gap, iz);
968 }
969 else
970 {
971 beta_out = computeSweepFlowMixingParameter(i_gap, iz);
972 }
973 }
974 }
975 // Abort execution if required values are unset
976 mooseAssert(!std::isnan(beta_in),
977 "beta_in was not set. Check gap logic for i_ch = " + std::to_string(i_ch) +
978 ", iz = " + std::to_string(iz));
979 mooseAssert(!std::isnan(beta_out),
980 "beta_out was not set. Check gap logic for i_ch = " + std::to_string(i_ch) +
981 ", iz = " + std::to_string(iz));
982
983 auto gap = _tri_sch_mesh.getDuctToPinGap();
984 auto Sij = dz * gap;
985 auto wsweep_in = edge_flux_ave * beta_in * Sij;
986 auto wsweep_out = edge_flux_ave * beta_out * Sij;
987 auto sweep_hin = (*_h_soln)(node_sweep_donor);
988 auto sweep_hout = (*_h_soln)(node_in);
989 sweep_enthalpy = (wsweep_in * sweep_hin - wsweep_out * sweep_hout);
990
991 // Sweep flow acts over the cell, so the enthalpies are interpolated to the cell center
992 PetscInt row_sh = i_ch + _n_channels * iz_ind;
993 if (iz == first_node)
994 {
995 PetscScalar value_hs = alpha * sweep_enthalpy;
996 LibmeshPetscCall(
997 VecSetValues(_hc_sweep_enthalpy_rhs, 1, &row_sh, &value_hs, ADD_VALUES));
998 }
999 else
1000 {
1001 PetscInt col_sh = i_ch + _n_channels * (iz_ind - 1);
1002 PetscScalar value_sh = alpha * wsweep_out;
1003 LibmeshPetscCall(MatSetValues(
1004 _hc_sweep_enthalpy_mat, 1, &row_sh, 1, &col_sh, &value_sh, ADD_VALUES));
1005 col_sh = sweep_donor + _n_channels * (iz_ind - 1);
1006 value_sh = -alpha * wsweep_in;
1007 LibmeshPetscCall(MatSetValues(
1008 _hc_sweep_enthalpy_mat, 1, &row_sh, 1, &col_sh, &value_sh, ADD_VALUES));
1009 }
1010 PetscInt col_sh = i_ch + _n_channels * iz_ind;
1011 PetscScalar value_sh = (1.0 - alpha) * wsweep_out;
1012 LibmeshPetscCall(
1013 MatSetValues(_hc_sweep_enthalpy_mat, 1, &row_sh, 1, &col_sh, &value_sh, ADD_VALUES));
1014 col_sh = sweep_donor + _n_channels * iz_ind;
1015 value_sh = -(1.0 - alpha) * wsweep_in;
1016 LibmeshPetscCall(
1017 MatSetValues(_hc_sweep_enthalpy_mat, 1, &row_sh, 1, &col_sh, &value_sh, ADD_VALUES));
1018 }
1019
1020 // Add heat enthalpy from pin and/or duct
1021 PetscScalar added_enthalpy = computeAddedHeatPin(i_ch, iz);
1022 added_enthalpy += computeAddedHeatDuct(i_ch, iz);
1023 PetscInt row_vec_ht = i_ch + _n_channels * iz_ind;
1024 LibmeshPetscCall(
1025 VecSetValues(_hc_added_heat_rhs, 1, &row_vec_ht, &added_enthalpy, ADD_VALUES));
1026 }
1027 }
1028 // Assembling system
1029 LibmeshPetscCall(MatAssemblyBegin(_hc_time_derivative_mat, MAT_FINAL_ASSEMBLY));
1030 LibmeshPetscCall(MatAssemblyEnd(_hc_time_derivative_mat, MAT_FINAL_ASSEMBLY));
1031 LibmeshPetscCall(MatAssemblyBegin(_hc_advective_derivative_mat, MAT_FINAL_ASSEMBLY));
1032 LibmeshPetscCall(MatAssemblyEnd(_hc_advective_derivative_mat, MAT_FINAL_ASSEMBLY));
1033 LibmeshPetscCall(MatAssemblyBegin(_hc_cross_derivative_mat, MAT_FINAL_ASSEMBLY));
1034 LibmeshPetscCall(MatAssemblyEnd(_hc_cross_derivative_mat, MAT_FINAL_ASSEMBLY));
1035 LibmeshPetscCall(MatAssemblyBegin(_hc_axial_heat_conduction_mat, MAT_FINAL_ASSEMBLY));
1036 LibmeshPetscCall(MatAssemblyEnd(_hc_axial_heat_conduction_mat, MAT_FINAL_ASSEMBLY));
1037 LibmeshPetscCall(MatAssemblyBegin(_hc_radial_heat_conduction_mat, MAT_FINAL_ASSEMBLY));
1038 LibmeshPetscCall(MatAssemblyEnd(_hc_radial_heat_conduction_mat, MAT_FINAL_ASSEMBLY));
1039 LibmeshPetscCall(MatAssemblyBegin(_hc_sweep_enthalpy_mat, MAT_FINAL_ASSEMBLY));
1040 LibmeshPetscCall(MatAssemblyEnd(_hc_sweep_enthalpy_mat, MAT_FINAL_ASSEMBLY));
1041 LibmeshPetscCall(MatAssemblyBegin(_hc_sys_h_mat, MAT_FINAL_ASSEMBLY));
1042 LibmeshPetscCall(MatAssemblyEnd(_hc_sys_h_mat, MAT_FINAL_ASSEMBLY));
1043 // Add all matrices together
1044 LibmeshPetscCall(addTermMatrices(_hc_sys_h_mat,
1053 _console << "Block: " << iblock << " - Enthalpy conservation matrix assembled" << std::endl;
1054 // RHS
1055 LibmeshPetscCall(VecAXPY(_hc_sys_h_rhs, 1.0, _hc_time_derivative_rhs));
1056 LibmeshPetscCall(VecAXPY(_hc_sys_h_rhs, 1.0, _hc_advective_derivative_rhs));
1057 LibmeshPetscCall(VecAXPY(_hc_sys_h_rhs, 1.0, _hc_cross_derivative_rhs));
1058 LibmeshPetscCall(VecAXPY(_hc_sys_h_rhs, 1.0, _hc_added_heat_rhs));
1059 LibmeshPetscCall(VecAXPY(_hc_sys_h_rhs, 1.0, _hc_axial_heat_conduction_rhs));
1060 LibmeshPetscCall(VecAXPY(_hc_sys_h_rhs, 1.0, _hc_radial_heat_conduction_rhs));
1061 LibmeshPetscCall(VecAXPY(_hc_sys_h_rhs, 1.0, _hc_sweep_enthalpy_rhs));
1062
1063 // Use system to solve for and populate enthalpy
1064 LibmeshPetscCall(this->solveAndPopulateEnthalpy(
1065 _hc_sys_h_mat, _hc_sys_h_rhs, first_node, last_node, "h_sys_"));
1066 }
1067}
Real computeSweepFlowMixingParameter(unsigned int i_gap, unsigned int iz) const
Computes and validates the sweep-flow mixing parameter.
Mat _hc_time_derivative_mat
Enthalpy Enthalpy conservation - time derivative.
PetscErrorCode solveAndPopulateEnthalpy(Mat A, Vec rhs, unsigned int first_node, unsigned int last_node, const char *ksp_prefix)
Solve a linear system (A * x = rhs) with a simple PCJACOBI KSP and populate the enthalpy solution int...
const SinglePhaseFluidProperties * _fp
Non-owning pointer to fluid properties user object.
const PostprocessorValue & _P_out
Outlet pressure postprocessor value.
std::unique_ptr< SolutionHandle > _h_soln
std::unique_ptr< SolutionHandle > _T_soln
Vec _hc_added_heat_rhs
Enthalpy conservation - source and sink.
Mat _hc_advective_derivative_mat
Enthalpy conservation - advective (Eulerian) derivative;.
virtual Real computeAddedHeatDuct(unsigned int i_ch, unsigned int iz) const
Non-pure: implemented in the base (or override in a child if needed)
Mat _hc_cross_derivative_mat
Enthalpy conservation - cross flux derivative.
virtual const std::vector< Real > & getZGrid() const
Get axial location of layers.
virtual Real getGapWidth(unsigned int axial_index, unsigned int gap_index) const =0
Return gap width for a given gap index.
virtual const Real & getPitch() const
Return the undeformed pitch between 2 subchannels.
virtual unsigned int getNumOfAxialCells() const
Return the number of axial cells.
virtual const Real & getPinDiameter() const
Return undeformed Pin diameter.
virtual Real computeAddedHeatPin(unsigned int i_ch, unsigned int iz) const override
Pure virtual: daughters provide different implementations.
const Real & getWireDiameter() const
Return wire diameter.
const Real & getDuctToPinGap() const
Return the the gap thickness between the duct and peripheral fuel pins.
const Real & getWireLeadLength() const
Return the wire lead length.
const std::pair< unsigned int, unsigned int > & getSweepFlowChans(unsigned int i_chan) const
Real volume(const MeshBase &mesh, unsigned int dim=libMesh::invalid_uint)

◆ computeInterpolatedValue()

PetscScalar SubChannel1PhaseProblem::computeInterpolatedValue ( PetscScalar  topValue,
PetscScalar  botValue,
PetscScalar  Peclet = 0.0 
)
protectedinherited

Definition at line 681 of file SubChannel1PhaseProblem.C.

684{
685 PetscScalar alpha = computeInterpolationCoefficients(Peclet);
686 return alpha * botValue + (1.0 - alpha) * topValue;
687}

Referenced by SubChannel1PhaseProblem::computeDP(), QuadSubChannel1PhaseProblem::computeh(), computeh(), SubChannel1PhaseProblem::computeP(), and SubChannel1PhaseProblem::computeWijResidual().

◆ computeInterpolationCoefficients()

PetscScalar SubChannel1PhaseProblem::computeInterpolationCoefficients ( PetscScalar  Peclet = 0.0) const
protectedinherited

Functions that computes the interpolation scheme given the Peclet number.

Definition at line 650 of file SubChannel1PhaseProblem.C.

651{
652 switch (_interpolation_scheme)
653 {
654 case 0: // upwind interpolation
655 return 1.0;
656 case 1: // downwind interpolation
657 return 0.0;
658 case 2: // central_difference interpolation
659 return 0.5;
660 case 3: // exponential interpolation (Peclet limited)
661 {
662 // Weight of the bottom value, alpha = 1 - 1 / Pe + 1 / (exp(Pe) - 1), from the exponential
663 // profile of the steady 1D advection-diffusion equation. It is evaluated with exp(-|Pe|)
664 // so that it stays finite for large |Pe|; the original form overflows to NaN once exp(Pe)
665 // exceeds the double range. For |Pe| below 1e-6 the series limit 0.5 + Pe / 12 is used
666 const auto Pe = Peclet;
667 if (std::abs(Pe) < 1e-6)
668 return 0.5 + Pe / 12.0;
669 const auto e = std::exp(-std::abs(Pe));
670 const auto alpha_pos = 1.0 - 1.0 / std::abs(Pe) + e / (1.0 - e);
671 return Pe > 0 ? alpha_pos : 1.0 - alpha_pos;
672 }
673 default:
675 ": Interpolation scheme should be a string: upwind, downwind, central_difference, "
676 "exponential");
677 }
678}
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:151

Referenced by SubChannel1PhaseProblem::computeDP(), QuadSubChannel1PhaseProblem::computeh(), computeh(), SubChannel1PhaseProblem::computeInterpolatedValue(), SubChannel1PhaseProblem::computeWijResidual(), and SubChannel1PhaseProblem::interpolateFaceValue().

◆ computeMdot()

void SubChannel1PhaseProblem::computeMdot ( int  iblock)
protectedinherited

Computes mass flow per channel for block iblock.

Definition at line 789 of file SubChannel1PhaseProblem.C.

790{
791 const unsigned int last_node = (iblock + 1) * _block_size;
792 const unsigned int first_node = iblock * _block_size + 1;
793 if (!_implicit_bool)
794 {
795 for (unsigned int iz = first_node; iz < last_node + 1; iz++)
796 {
797 auto dz = _z_grid[iz] - _z_grid[iz - 1];
798 for (unsigned int i_ch = 0; i_ch < _n_channels; i_ch++)
799 {
800 auto * node_in = _subchannel_mesh.getChannelNode(i_ch, iz - 1);
801 auto * node_out = _subchannel_mesh.getChannelNode(i_ch, iz);
802 auto volume = dz * (*_S_flow_soln)(node_in);
803 auto time_term = _TR * ((*_rho_soln)(node_out)-_rho_soln->old(node_out)) * volume / _dt;
804 // Wij positive out of i into j;
805 auto mdot_out = (*_mdot_soln)(node_in) - (*_SumWij_soln)(node_out)-time_term;
806 if (mdot_out < 0)
807 {
808 _console << "Wij = : " << _Wij << "\n";
810 " : Calculation of negative mass flow mdot_out = : ",
811 mdot_out,
812 " Axial Level= : ",
813 iz,
814 " - Implicit solves are required for recirculating flow.");
815 }
816 _mdot_soln->set(node_out, mdot_out); // kg/sec
817 }
818 }
819 }
820 else
821 {
822 for (unsigned int iz = first_node; iz < last_node + 1; iz++)
823 {
824 auto dz = _z_grid[iz] - _z_grid[iz - 1];
825 auto iz_ind = iz - first_node;
826 for (unsigned int i_ch = 0; i_ch < _n_channels; i_ch++)
827 {
828 auto * node_in = _subchannel_mesh.getChannelNode(i_ch, iz - 1);
829 auto * node_out = _subchannel_mesh.getChannelNode(i_ch, iz);
830 auto volume = dz * (*_S_flow_soln)(node_in);
831
832 // Adding time derivative to the RHS
833 auto time_term = _TR * ((*_rho_soln)(node_out)-_rho_soln->old(node_out)) * volume / _dt;
834 PetscInt row_vec = i_ch + _n_channels * iz_ind;
835 PetscScalar value_vec = -1.0 * time_term;
836 LibmeshPetscCall(
837 VecSetValues(_mc_axial_convection_rhs, 1, &row_vec, &value_vec, INSERT_VALUES));
838
839 // Linearize transient density with respect to pressure at constant enthalpy. The
840 // temperature response at constant h is required even for a rho(T)-only liquid model:
841 //
842 // (d rho / d p)_h = (d rho / d p)_T
843 // - (d rho / d T)_p (d h / d p)_T / (d h / d T)_p.
844 //
845 // Without this Jacobian contribution, pressure-density coupling remains in the outer
846 // fixed-point iteration and scales as O(1 / dt). As the time step decreases, the iteration
847 // can become increasingly slow or noncontractive and may require stronger relaxation.
848 if (_TR && _compute_density && _compute_power && iz < last_node)
849 {
850 Real rho, drho_dp_T, drho_dT;
851 _fp->rho_from_p_T(
852 (*_P_soln)(node_out) + _P_out, (*_T_soln)(node_out), rho, drho_dp_T, drho_dT);
853 Real h, dh_dp_T, dh_dT;
854 _fp->h_from_p_T((*_P_soln)(node_out) + _P_out, (*_T_soln)(node_out), h, dh_dp_T, dh_dT);
855 const Real drho_dp_h = drho_dp_T - drho_dT * dh_dp_T / dh_dT;
856 const PetscScalar pressure_coefficient = volume / _dt * drho_dp_h;
857 const PetscInt pressure_col = i_ch + _n_channels * (iz_ind + 1);
858 LibmeshPetscCall(MatSetValues(_mc_density_pressure_mat,
859 1,
860 &row_vec,
861 1,
862 &pressure_col,
863 &pressure_coefficient,
864 INSERT_VALUES));
865 const PetscScalar linearization_rhs = pressure_coefficient * (*_P_soln)(node_out);
866 LibmeshPetscCall(
867 VecSetValues(_mc_axial_convection_rhs, 1, &row_vec, &linearization_rhs, ADD_VALUES));
868 }
869
870 // Imposing bottom boundary condition or adding of diagonal elements
871 if (iz == first_node)
872 {
873 PetscScalar value_vec = (*_mdot_soln)(node_in);
874 PetscInt row_vec = i_ch + _n_channels * iz_ind;
875 LibmeshPetscCall(
876 VecSetValues(_mc_axial_convection_rhs, 1, &row_vec, &value_vec, ADD_VALUES));
877 }
878 else
879 {
880 PetscInt row = i_ch + _n_channels * iz_ind;
881 PetscInt col = i_ch + _n_channels * (iz_ind - 1);
882 PetscScalar value = -1.0;
883 LibmeshPetscCall(
884 MatSetValues(_mc_axial_convection_mat, 1, &row, 1, &col, &value, INSERT_VALUES));
885 }
886
887 // Adding diagonal elements
888 PetscInt row = i_ch + _n_channels * iz_ind;
889 PetscInt col = i_ch + _n_channels * iz_ind;
890 PetscScalar value = 1.0;
891 LibmeshPetscCall(
892 MatSetValues(_mc_axial_convection_mat, 1, &row, 1, &col, &value, INSERT_VALUES));
893
894 // Adding cross flows RHS
896 {
897 PetscScalar value_vec_2 = -1.0 * (*_SumWij_soln)(node_out);
898 PetscInt row_vec_2 = i_ch + _n_channels * iz_ind;
899 LibmeshPetscCall(
900 VecSetValues(_mc_axial_convection_rhs, 1, &row_vec_2, &value_vec_2, ADD_VALUES));
901 }
902 }
903 }
904 LibmeshPetscCall(MatAssemblyBegin(_mc_axial_convection_mat, MAT_FINAL_ASSEMBLY));
905 LibmeshPetscCall(MatAssemblyEnd(_mc_axial_convection_mat, MAT_FINAL_ASSEMBLY));
906 LibmeshPetscCall(MatAssemblyBegin(_mc_density_pressure_mat, MAT_FINAL_ASSEMBLY));
907 LibmeshPetscCall(MatAssemblyEnd(_mc_density_pressure_mat, MAT_FINAL_ASSEMBLY));
908
910 {
911 KSP ksploc;
912 PC pc;
913 Vec sol;
914 LibmeshPetscCall(VecDuplicate(_mc_axial_convection_rhs, &sol));
915 LibmeshPetscCall(KSPCreate(PETSC_COMM_SELF, &ksploc));
916 LibmeshPetscCall(KSPSetOperators(ksploc, _mc_axial_convection_mat, _mc_axial_convection_mat));
917 LibmeshPetscCall(KSPGetPC(ksploc, &pc));
918 LibmeshPetscCall(PCSetType(pc, PCJACOBI));
919 LibmeshPetscCall(KSPSetTolerances(ksploc, _rtol, _atol, _dtol, _maxit));
920 LibmeshPetscCall(KSPSetFromOptions(ksploc));
921 LibmeshPetscCall(KSPSolve(ksploc, _mc_axial_convection_rhs, sol));
922 LibmeshPetscCall(populateSolutionChan<SolutionHandle>(
923 sol, *_mdot_soln, first_node, last_node, _n_channels));
924 LibmeshPetscCall(VecZeroEntries(_mc_axial_convection_rhs));
925 LibmeshPetscCall(KSPDestroy(&ksploc));
926 LibmeshPetscCall(VecDestroy(&sol));
927 }
928 }
929}
const double rho
const PetscReal & _dtol
The divergence tolerance for the ksp linear solver.
const bool _compute_power
Flag that informs if we need to solve the Enthalpy/Temperature equations or not.
const PetscInt _maxit
The maximum number of iterations to use for the ksp linear solver.
Mat _mc_density_pressure_mat
Mass conservation - pressure derivative of transient density.
const bool _compute_density
Flag that activates or deactivates the calculation of density.
const PetscReal & _rtol
The relative convergence tolerance, (relative decrease) for the ksp linear solver.
Mat _mc_axial_convection_mat
Mass conservation - axial convection.
const PetscReal & _atol
The absolute convergence tolerance for the ksp linear solver.

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

◆ computeMixingParameter()

Real SubChannel1PhaseProblem::computeMixingParameter ( unsigned int  i_gap,
unsigned int  iz 
) const
protectedinherited

Computes and validates the turbulent mixing parameter.

Definition at line 2005 of file SubChannel1PhaseProblem.C.

2006{
2007 auto beta = _mixing_closure->computeMixingParameter(i_gap, iz);
2008 if (!std::isfinite(beta) || beta < 0.0)
2009 mooseError(name(),
2010 ": Mixing closure returned invalid beta = ",
2011 beta,
2012 " for gap ",
2013 i_gap,
2014 " at axial index ",
2015 iz,
2016 ". Beta must be finite and non-negative.");
2017
2018 return beta;
2019}
virtual Real computeMixingParameter(const unsigned int i_gap, const unsigned int iz) const =0
Computes the turbulent mixing coefficient for the local conditions around gap(i_gap) and axial level(...

Referenced by SubChannel1PhaseProblem::computeWijPrime().

◆ computeMu()

void SubChannel1PhaseProblem::computeMu ( int  iblock)
protectedinherited

Computes Viscosity per channel for block iblock.

Definition at line 1584 of file SubChannel1PhaseProblem.C.

1585{
1586 const unsigned int last_node = (iblock + 1) * _block_size;
1587 const unsigned int first_node = iblock * _block_size + 1;
1588 if (iblock == 0)
1589 {
1590 for (unsigned int i_ch = 0; i_ch < _n_channels; i_ch++)
1591 {
1592 auto * node = _subchannel_mesh.getChannelNode(i_ch, 0);
1593 _mu_soln->set(node, _fp->mu_from_p_T((*_P_soln)(node) + _P_out, (*_T_soln)(node)));
1594 }
1595 }
1596 for (unsigned int iz = first_node; iz < last_node + 1; iz++)
1597 {
1598 for (unsigned int i_ch = 0; i_ch < _n_channels; i_ch++)
1599 {
1600 auto * node = _subchannel_mesh.getChannelNode(i_ch, iz);
1601 _mu_soln->set(node, _fp->mu_from_p_T((*_P_soln)(node) + _P_out, (*_T_soln)(node)));
1602 }
1603 }
1604}

Referenced by SubChannel1PhaseProblem::externalSolve().

◆ computeP()

void SubChannel1PhaseProblem::computeP ( int  iblock)
protectedinherited

Computes Pressure per channel for block iblock.

Definition at line 1414 of file SubChannel1PhaseProblem.C.

1415{
1416 const unsigned int last_node = (iblock + 1) * _block_size;
1417 const unsigned int first_node = iblock * _block_size + 1;
1418 if (!_implicit_bool)
1419 {
1420 for (unsigned int iz = last_node; iz > first_node - 1; iz--)
1421 {
1422 // Calculate pressure in the inlet of the cell assuming known outlet
1423 for (unsigned int i_ch = 0; i_ch < _n_channels; i_ch++)
1424 {
1425 auto * node_out = _subchannel_mesh.getChannelNode(i_ch, iz);
1426 auto * node_in = _subchannel_mesh.getChannelNode(i_ch, iz - 1);
1427 // update Pressure solution
1428 _P_soln->set(node_in, (*_P_soln)(node_out) + _DP(i_ch, iz));
1429 }
1430 }
1431 }
1432 else
1433 {
1434 LibmeshPetscCall(VecZeroEntries(_amc_pressure_force_rhs));
1435 for (unsigned int iz = last_node; iz > first_node - 1; iz--)
1436 {
1437 auto iz_ind = iz - first_node;
1438 // Calculate pressure in the inlet of the cell assuming known outlet
1439 for (unsigned int i_ch = 0; i_ch < _n_channels; i_ch++)
1440 {
1441 auto * node_out = _subchannel_mesh.getChannelNode(i_ch, iz);
1442 auto * node_in = _subchannel_mesh.getChannelNode(i_ch, iz - 1);
1443
1444 // inlet, outlet, and interpolated axial surface area
1445 auto S_in = (*_S_flow_soln)(node_in);
1446 auto S_out = (*_S_flow_soln)(node_out);
1447 auto S_interp = computeInterpolatedValue(S_out, S_in, 0.5);
1448
1449 // Creating matrix of coefficients
1450 PetscInt row = i_ch + _n_channels * iz_ind;
1451 PetscInt col = i_ch + _n_channels * iz_ind;
1452 PetscScalar value = -1.0 * S_interp;
1453 LibmeshPetscCall(
1454 MatSetValues(_amc_pressure_force_mat, 1, &row, 1, &col, &value, INSERT_VALUES));
1455
1456 // Row iz_ind is the pressure force on cell iz, S_c * (P(iz) - P(iz - 1)), and its unknown
1457 // is the inlet pressure P(iz - 1). The outlet pressure of the top cell of the block is
1458 // known (the outlet boundary condition or the block above), so it goes to the right-hand
1459 // side. For the other cells, P(iz) is the unknown of the next row.
1460 if (iz == last_node)
1461 {
1462 PetscScalar value = -1.0 * (*_P_soln)(node_out)*S_interp;
1463 PetscInt row = i_ch + _n_channels * iz_ind;
1464 LibmeshPetscCall(VecSetValues(_amc_pressure_force_rhs, 1, &row, &value, ADD_VALUES));
1465 }
1466 else
1467 {
1468 PetscInt row = i_ch + _n_channels * iz_ind;
1469 PetscInt col = i_ch + _n_channels * (iz_ind + 1);
1470 PetscScalar value = 1.0 * S_interp;
1471 LibmeshPetscCall(
1472 MatSetValues(_amc_pressure_force_mat, 1, &row, 1, &col, &value, INSERT_VALUES));
1473 }
1474
1475 // The segregated solver takes the cell pressure drop DP from the axial momentum solve
1476 // (computeDP), so each row reduces to P(iz - 1) = P(iz) + DP(iz). The monolithic solver
1477 // omits this term because the same matrix is the pressure force in its axial momentum
1478 // equation, which determines P directly.
1479 if (_segregated_bool)
1480 {
1481 auto dp_out = _DP(i_ch, iz);
1482 PetscScalar value_v = -1.0 * dp_out * S_interp;
1483 PetscInt row_v = i_ch + _n_channels * iz_ind;
1484 LibmeshPetscCall(VecSetValues(_amc_pressure_force_rhs, 1, &row_v, &value_v, ADD_VALUES));
1485 }
1486 }
1487 }
1488 // Solving pressure problem
1489 LibmeshPetscCall(MatAssemblyBegin(_amc_pressure_force_mat, MAT_FINAL_ASSEMBLY));
1490 LibmeshPetscCall(MatAssemblyEnd(_amc_pressure_force_mat, MAT_FINAL_ASSEMBLY));
1491 if (_segregated_bool)
1492 {
1493 KSP ksploc;
1494 PC pc;
1495 Vec sol;
1496 LibmeshPetscCall(VecDuplicate(_amc_pressure_force_rhs, &sol));
1497 LibmeshPetscCall(KSPCreate(PETSC_COMM_SELF, &ksploc));
1498 LibmeshPetscCall(KSPSetOperators(ksploc, _amc_pressure_force_mat, _amc_pressure_force_mat));
1499 LibmeshPetscCall(KSPGetPC(ksploc, &pc));
1500 LibmeshPetscCall(PCSetType(pc, PCJACOBI));
1501 LibmeshPetscCall(KSPSetTolerances(ksploc, _rtol, _atol, _dtol, _maxit));
1502 LibmeshPetscCall(KSPSetFromOptions(ksploc));
1503 LibmeshPetscCall(KSPSolve(ksploc, _amc_pressure_force_rhs, sol));
1504 PetscScalar * xx;
1505 LibmeshPetscCall(VecGetArray(sol, &xx));
1506 // update Pressure solution
1507 for (unsigned int iz = last_node; iz > first_node - 1; iz--)
1508 {
1509 auto iz_ind = iz - first_node;
1510 for (unsigned int i_ch = 0; i_ch < _n_channels; i_ch++)
1511 {
1512 auto * node_in = _subchannel_mesh.getChannelNode(i_ch, iz - 1);
1513 PetscScalar value = xx[iz_ind * _n_channels + i_ch];
1514 _P_soln->set(node_in, value);
1515 }
1516 }
1517 LibmeshPetscCall(VecRestoreArray(sol, &xx));
1518 LibmeshPetscCall(VecZeroEntries(_amc_pressure_force_rhs));
1519 LibmeshPetscCall(KSPDestroy(&ksploc));
1520 LibmeshPetscCall(VecDestroy(&sol));
1521 }
1522 }
1523}
Mat _amc_pressure_force_mat
Axial momentum conservation - pressure force.

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

◆ computeRho()

void SubChannel1PhaseProblem::computeRho ( int  iblock)
protectedinherited

Computes Density per channel for block iblock.

Definition at line 1561 of file SubChannel1PhaseProblem.C.

1562{
1563 const unsigned int last_node = (iblock + 1) * _block_size;
1564 const unsigned int first_node = iblock * _block_size + 1;
1565 if (iblock == 0)
1566 {
1567 for (unsigned int i_ch = 0; i_ch < _n_channels; i_ch++)
1568 {
1569 auto * node = _subchannel_mesh.getChannelNode(i_ch, 0);
1570 _rho_soln->set(node, _fp->rho_from_p_T((*_P_soln)(node) + _P_out, (*_T_soln)(node)));
1571 }
1572 }
1573 for (unsigned int iz = first_node; iz < last_node + 1; iz++)
1574 {
1575 for (unsigned int i_ch = 0; i_ch < _n_channels; i_ch++)
1576 {
1577 auto * node = _subchannel_mesh.getChannelNode(i_ch, iz);
1578 _rho_soln->set(node, _fp->rho_from_p_T((*_P_soln)(node) + _P_out, (*_T_soln)(node)));
1579 }
1580 }
1581}

Referenced by SubChannel1PhaseProblem::externalSolve().

◆ computeSumWij()

void SubChannel1PhaseProblem::computeSumWij ( int  iblock)
protectedinherited

Computes net diversion crossflow per channel for block iblock.

Definition at line 723 of file SubChannel1PhaseProblem.C.

724{
725 const unsigned int last_node = (iblock + 1) * _block_size;
726 const unsigned int first_node = iblock * _block_size + 1;
727 // Add to solution vector if explicit
728 if (!_implicit_bool)
729 {
730 for (unsigned int iz = first_node; iz < last_node + 1; iz++)
731 {
732 for (unsigned int i_ch = 0; i_ch < _n_channels; i_ch++)
733 {
734 auto * node_out = _subchannel_mesh.getChannelNode(i_ch, iz);
735 Real sumWij = 0.0;
736 // Calculate sum of crossflow into channel i from channels j around i
737 unsigned int counter = 0;
738 for (auto i_gap : _subchannel_mesh.getChannelGaps(i_ch))
739 {
740 sumWij += _subchannel_mesh.getCrossflowSign(i_ch, counter) * _Wij(i_gap, iz);
741 counter++;
742 }
743 // The net crossflow coming out of cell i [kg/sec]
744 _SumWij_soln->set(node_out, sumWij);
745 }
746 }
747 }
748 // Add to matrix if implicit
749 else
750 {
751 LibmeshPetscCall(MatZeroEntries(_mc_density_pressure_mat));
752 for (unsigned int iz = first_node; iz < last_node + 1; iz++)
753 {
754 unsigned int iz_ind = iz - first_node;
755 for (unsigned int i_ch = 0; i_ch < _n_channels; i_ch++)
756 {
757 // Calculate sum of crossflow into channel i from channels j around i
758 unsigned int counter = 0;
759 for (auto i_gap : _subchannel_mesh.getChannelGaps(i_ch))
760 {
761 PetscInt row = i_ch + _n_channels * iz_ind;
762 PetscInt col = i_gap + _n_gaps * iz_ind;
763 PetscScalar value = _subchannel_mesh.getCrossflowSign(i_ch, counter);
764 LibmeshPetscCall(MatSetValues(_mc_sumWij_mat, 1, &row, 1, &col, &value, INSERT_VALUES));
765 counter++;
766 }
767 }
768 }
769 LibmeshPetscCall(MatAssemblyBegin(_mc_sumWij_mat, MAT_FINAL_ASSEMBLY));
770 LibmeshPetscCall(MatAssemblyEnd(_mc_sumWij_mat, MAT_FINAL_ASSEMBLY));
772 {
773 Vec loc_prod;
774 Vec loc_Wij;
775 LibmeshPetscCall(VecDuplicate(_amc_sys_mdot_rhs, &loc_prod));
776 LibmeshPetscCall(VecDuplicate(_Wij_vec, &loc_Wij));
778 loc_Wij, _Wij, first_node, last_node, _n_gaps));
779 LibmeshPetscCall(MatMult(_mc_sumWij_mat, loc_Wij, loc_prod));
780 LibmeshPetscCall(populateSolutionChan<SolutionHandle>(
781 loc_prod, *_SumWij_soln, first_node, last_node, _n_channels));
782 LibmeshPetscCall(VecDestroy(&loc_prod));
783 LibmeshPetscCall(VecDestroy(&loc_Wij));
784 }
785 }
786}
Mat _mc_sumWij_mat
Matrices and vectors to be used in implicit assembly Mass conservation Mass conservation - sum of cro...
PetscErrorCode populateVectorFromDense(Vec &x, const T &solution, const unsigned int first_axial_level, const unsigned int last_axial_level, const unsigned int cross_dimension)

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

◆ computeSweepFlowMixingParameter()

Real SubChannel1PhaseProblem::computeSweepFlowMixingParameter ( unsigned int  i_gap,
unsigned int  iz 
) const
protectedinherited

Computes and validates the sweep-flow mixing parameter.

Definition at line 2022 of file SubChannel1PhaseProblem.C.

2023{
2024 auto beta = _mixing_closure->computeSweepFlowMixingParameter(i_gap, iz);
2025 if (!std::isfinite(beta) || beta < 0.0)
2026 mooseError(name(),
2027 ": Mixing closure returned invalid sweep-flow coefficient = ",
2028 beta,
2029 " for gap ",
2030 i_gap,
2031 " at axial index ",
2032 iz,
2033 ". sweep-flow coefficient must be finite and non-negative.");
2034
2035 return beta;
2036}
virtual Real computeSweepFlowMixingParameter(const unsigned int i_gap, const unsigned int iz) const
Computes the wire-wrap sweep-flow coefficient for peripheral gaps.

Referenced by computeh().

◆ computeT()

Real SubChannel1PhaseProblem::computeT ( int  iblock)
protectedinherited

Computes and relaxes Temperature per channel for block iblock.

Returns
The normalized norm of (T - T_prev).

Definition at line 1526 of file SubChannel1PhaseProblem.C.

1527{
1528 const unsigned int last_node = (iblock + 1) * _block_size;
1529 const unsigned int first_node = iblock * _block_size + 1;
1530 std::vector<Real> residual;
1531 residual.reserve(_block_size * _n_channels);
1532 Real residual_norm_sq = 0.0;
1533 Real temperature_norm_sq = 0.0;
1534 for (unsigned int iz = first_node; iz < last_node + 1; iz++)
1535 {
1536 for (unsigned int i_ch = 0; i_ch < _n_channels; i_ch++)
1537 {
1538 auto * node = _subchannel_mesh.getChannelNode(i_ch, iz);
1539 const Real T = (*_T_soln)(node);
1540 const Real T_from_ph = _fp->T_from_p_h((*_P_soln)(node) + _P_out, (*_h_soln)(node));
1541 residual.push_back(T_from_ph - T);
1542 residual_norm_sq += Utility::pow<2>(residual.back());
1543 temperature_norm_sq += Utility::pow<2>(T);
1544 }
1545 }
1546
1547 // Set the temperature solution with relaxation if needed
1548 std::size_t i = 0;
1549 for (unsigned int iz = first_node; iz < last_node + 1; iz++)
1550 for (unsigned int i_ch = 0; i_ch < _n_channels; i_ch++)
1551 {
1552 auto * node = _subchannel_mesh.getChannelNode(i_ch, iz);
1553 _T_soln->set(node, (*_T_soln)(node) + _T_relaxation * residual[i]);
1554 ++i;
1555 }
1556
1557 return std::sqrt(residual_norm_sq) / (std::sqrt(temperature_norm_sq) + 1e-14);
1558}
const double T
const Real & _T_relaxation
Relaxation factor for temperature updates in the inner thermal-hydraulic iteration.

Referenced by SubChannel1PhaseProblem::externalSolve().

◆ computeWijFromSolve()

void SubChannel1PhaseProblem::computeWijFromSolve ( int  iblock)
protectedinherited

Computes diversion crossflow per gap for block iblock.

Definition at line 690 of file SubChannel1PhaseProblem.C.

691{
692 const unsigned int last_node = (iblock + 1) * _block_size;
693 const unsigned int first_node = iblock * _block_size + 1;
694 // Initial guess, port crossflow of block (iblock) into a vector that will act as my initial guess
695 libMesh::DenseVector<Real> solution_seed(_n_gaps * _block_size, 0.0);
696 for (unsigned int iz = first_node; iz < last_node + 1; iz++)
697 {
698 for (unsigned int i_gap = 0; i_gap < _n_gaps; i_gap++)
699 {
700 int i = _n_gaps * (iz - first_node) + i_gap; // column wise transfer
701 solution_seed(i) = _Wij(i_gap, iz);
702 }
703 }
704
705 // Solving the combined lateral momentum equation for Wij using a PETSc solver and update vector
706 // root
708 LibmeshPetscCall(petscSnesSolver(iblock, solution_seed, root));
709
710 // Assign the solution to the cross-flow matrix
711 int i = 0;
712 for (unsigned int iz = first_node; iz < last_node + 1; iz++)
713 {
714 for (unsigned int i_gap = 0; i_gap < _n_gaps; i_gap++)
715 {
716 _Wij(i_gap, iz) = root(i);
717 i++;
718 }
719 }
720}
PetscErrorCode petscSnesSolver(int iblock, const libMesh::DenseVector< Real > &solution, libMesh::DenseVector< Real > &root)
Computes solution of nonlinear equation using snes and provided a residual in a formFunction.
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's method.

Referenced by SubChannel1PhaseProblem::externalSolve().

◆ computeWijPrime()

void SubChannel1PhaseProblem::computeWijPrime ( int  iblock)
protectedinherited

Computes turbulent crossflow per gap for block iblock.

Update turbulent crossflow

Definition at line 1904 of file SubChannel1PhaseProblem.C.

1905{
1906 const unsigned int last_node = (iblock + 1) * _block_size;
1907 const unsigned int first_node = iblock * _block_size + 1;
1908 _mixing_closure->computeBlockMixingParameters(first_node, last_node);
1909 for (unsigned int iz = first_node; iz < last_node + 1; iz++)
1910 {
1911 auto dz = _z_grid[iz] - _z_grid[iz - 1];
1912 for (unsigned int i_gap = 0; i_gap < _n_gaps; i_gap++)
1913 {
1914 auto chans = _subchannel_mesh.getGapChannels(i_gap);
1915 unsigned int i_ch = chans.first;
1916 unsigned int j_ch = chans.second;
1917 auto * node_in_i = _subchannel_mesh.getChannelNode(i_ch, iz - 1);
1918 auto * node_out_i = _subchannel_mesh.getChannelNode(i_ch, iz);
1919 auto * node_in_j = _subchannel_mesh.getChannelNode(j_ch, iz - 1);
1920 auto * node_out_j = _subchannel_mesh.getChannelNode(j_ch, iz);
1921 auto Si_in = (*_S_flow_soln)(node_in_i);
1922 auto Sj_in = (*_S_flow_soln)(node_in_j);
1923 auto Si_out = (*_S_flow_soln)(node_out_i);
1924 auto Sj_out = (*_S_flow_soln)(node_out_j);
1925 auto gap = _subchannel_mesh.getGapWidth(iz, i_gap);
1926 auto Sij = dz * gap;
1927 // Mass flux of the gap: total mass flow rate of the two subchannels over their total flow
1928 // area, averaged over the inlet and outlet of the cell. This is the area-weighted mean of rho
1929 // V of the two subchannels; Eq. (30) of Pacio et al. (2022) uses the arithmetic mean rho (V_i
1930 // + V_j) / 2, which differs when the two subchannels have different flow areas
1931 auto avg_massflux =
1932 0.5 * (((*_mdot_soln)(node_in_i) + (*_mdot_soln)(node_in_j)) / (Si_in + Sj_in) +
1933 ((*_mdot_soln)(node_out_i) + (*_mdot_soln)(node_out_j)) / (Si_out + Sj_out));
1934 auto beta = computeMixingParameter(i_gap, iz);
1935
1936 if (!_implicit_bool)
1937 {
1938 _WijPrime(i_gap, iz) = beta * avg_massflux * Sij;
1939 }
1940 else
1941 {
1942 auto iz_ind = iz - first_node;
1943 PetscScalar base_value = beta * 0.5 * Sij;
1944
1945 // Bottom values
1946 if (iz == first_node)
1947 {
1948 PetscScalar value_tl = -1.0 * base_value / (Si_in + Sj_in) *
1949 ((*_mdot_soln)(node_in_i) + (*_mdot_soln)(node_in_j));
1950 PetscInt row = i_gap + _n_gaps * iz_ind;
1951 LibmeshPetscCall(
1952 VecSetValues(_amc_turbulent_cross_flows_rhs, 1, &row, &value_tl, INSERT_VALUES));
1953 }
1954 else
1955 {
1956 PetscScalar value_tl = base_value / (Si_in + Sj_in);
1957 PetscInt row = i_gap + _n_gaps * iz_ind;
1958
1959 PetscInt col_ich = i_ch + _n_channels * (iz_ind - 1);
1960 LibmeshPetscCall(MatSetValues(
1961 _amc_turbulent_cross_flows_mat, 1, &row, 1, &col_ich, &value_tl, INSERT_VALUES));
1962
1963 PetscInt col_jch = j_ch + _n_channels * (iz_ind - 1);
1964 LibmeshPetscCall(MatSetValues(
1965 _amc_turbulent_cross_flows_mat, 1, &row, 1, &col_jch, &value_tl, INSERT_VALUES));
1966 }
1967
1968 // Top values
1969 PetscScalar value_bl = base_value / (Si_out + Sj_out);
1970 PetscInt row = i_gap + _n_gaps * iz_ind;
1971
1972 PetscInt col_ich = i_ch + _n_channels * iz_ind;
1973 LibmeshPetscCall(MatSetValues(
1974 _amc_turbulent_cross_flows_mat, 1, &row, 1, &col_ich, &value_bl, INSERT_VALUES));
1975
1976 PetscInt col_jch = j_ch + _n_channels * iz_ind;
1977 LibmeshPetscCall(MatSetValues(
1978 _amc_turbulent_cross_flows_mat, 1, &row, 1, &col_jch, &value_bl, INSERT_VALUES));
1979 }
1980 }
1981 }
1982
1983 if (_implicit_bool)
1984 {
1985 LibmeshPetscCall(MatAssemblyBegin(_amc_turbulent_cross_flows_mat, MAT_FINAL_ASSEMBLY));
1986 LibmeshPetscCall(MatAssemblyEnd(_amc_turbulent_cross_flows_mat, MAT_FINAL_ASSEMBLY));
1987
1989 Vec loc_prod;
1990 Vec loc_Wij;
1991 LibmeshPetscCall(VecDuplicate(_amc_sys_mdot_rhs, &loc_prod));
1992 LibmeshPetscCall(VecDuplicate(_Wij_vec, &loc_Wij));
1993 LibmeshPetscCall(populateVectorFromHandle<SolutionHandle>(
1994 loc_prod, *_mdot_soln, first_node, last_node, _n_channels));
1995 LibmeshPetscCall(MatMult(_amc_turbulent_cross_flows_mat, loc_prod, loc_Wij));
1996 LibmeshPetscCall(VecAXPY(loc_Wij, -1.0, _amc_turbulent_cross_flows_rhs));
1998 loc_Wij, _WijPrime, first_node, last_node, _n_gaps));
1999 LibmeshPetscCall(VecDestroy(&loc_prod));
2000 LibmeshPetscCall(VecDestroy(&loc_Wij));
2001 }
2002}
virtual void computeBlockMixingParameters(const unsigned int, const unsigned int) const
Precomputes the mixing coefficients that depend on the flow solution of the axial levels first_node t...
Mat _amc_turbulent_cross_flows_mat
Axial momentum Axial momentum conservation - compute turbulent cross fluxes.
PetscErrorCode populateDenseFromVector(const Vec &x, T &solution, const unsigned int first_axial_level, const unsigned int last_axial_level, const unsigned int cross_dimension)
Real computeMixingParameter(unsigned int i_gap, unsigned int iz) const
Computes and validates the turbulent mixing parameter.

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

◆ computeWijResidual()

void SubChannel1PhaseProblem::computeWijResidual ( int  iblock)
protectedinherited

Computes Residual Matrix based on the lateral momentum conservation equation for block iblock.

Assembling system

Definition at line 1607 of file SubChannel1PhaseProblem.C.

1608{
1609 const unsigned int last_node = (iblock + 1) * _block_size;
1610 const unsigned int first_node = iblock * _block_size + 1;
1611 // Cross flow residual
1612 if (!_implicit_bool)
1613 {
1614 const Real & pitch = _subchannel_mesh.getPitch();
1615 for (unsigned int iz = first_node; iz < last_node + 1; iz++)
1616 {
1617 auto dz = _z_grid[iz] - _z_grid[iz - 1];
1618 for (unsigned int i_gap = 0; i_gap < _n_gaps; i_gap++)
1619 {
1620 auto chans = _subchannel_mesh.getGapChannels(i_gap);
1621 unsigned int i_ch = chans.first;
1622 unsigned int j_ch = chans.second;
1623 auto * node_in_i = _subchannel_mesh.getChannelNode(i_ch, iz - 1);
1624 auto * node_out_i = _subchannel_mesh.getChannelNode(i_ch, iz);
1625 auto * node_in_j = _subchannel_mesh.getChannelNode(j_ch, iz - 1);
1626 auto * node_out_j = _subchannel_mesh.getChannelNode(j_ch, iz);
1627 auto rho_i = (*_rho_soln)(node_in_i);
1628 auto rho_j = (*_rho_soln)(node_in_j);
1629 auto Si = (*_S_flow_soln)(node_in_i);
1630 auto Sj = (*_S_flow_soln)(node_in_j);
1631 auto Sij = dz * _subchannel_mesh.getGapWidth(iz, i_gap);
1632 auto Lij = pitch;
1633 // total local form loss in the ij direction
1634 auto friction_term = _kij * _Wij(i_gap, iz) * std::abs(_Wij(i_gap, iz));
1635 auto DPij = (*_P_soln)(node_in_i) - (*_P_soln)(node_in_j);
1636 // Figure out donor cell density
1637 auto rho_star = 0.0;
1638 if (_Wij(i_gap, iz) > 0.0)
1639 rho_star = rho_i;
1640 else if (_Wij(i_gap, iz) < 0.0)
1641 rho_star = rho_j;
1642 else
1643 rho_star = (rho_i + rho_j) / 2.0;
1644 auto mass_term_out =
1645 (*_mdot_soln)(node_out_i) / (*_S_flow_soln)(node_out_i) / (*_rho_soln)(node_out_i) +
1646 (*_mdot_soln)(node_out_j) / (*_S_flow_soln)(node_out_j) / (*_rho_soln)(node_out_j);
1647 auto mass_term_in =
1648 (*_mdot_soln)(node_in_i) / Si / rho_i + (*_mdot_soln)(node_in_j) / Sj / rho_j;
1649 auto term_out = Sij * rho_star * (Lij / dz) * mass_term_out * _Wij(i_gap, iz);
1650 auto term_in = Sij * rho_star * (Lij / dz) * mass_term_in * _Wij(i_gap, iz - 1);
1651 auto inertia_term = term_out - term_in;
1652 auto pressure_term = 2 * Utility::pow<2>(Sij) * DPij * rho_star;
1653 auto time_term =
1654 _TR * 2.0 * (_Wij(i_gap, iz) - _Wij_old(i_gap, iz)) * Lij * Sij * rho_star / _dt;
1655
1656 _Wij_residual_matrix(i_gap, iz - 1 - iblock * _block_size) =
1657 time_term + friction_term + inertia_term - pressure_term;
1658 }
1659 }
1660 }
1661 else
1662 {
1663 // Initializing to zero the elements of the lateral momentum assembly
1664 LibmeshPetscCall(MatZeroEntries(_cmc_time_derivative_mat));
1665 LibmeshPetscCall(MatZeroEntries(_cmc_advective_derivative_mat));
1666 LibmeshPetscCall(MatZeroEntries(_cmc_friction_force_mat));
1667 LibmeshPetscCall(MatZeroEntries(_cmc_pressure_force_mat));
1668 LibmeshPetscCall(VecZeroEntries(_cmc_time_derivative_rhs));
1669 LibmeshPetscCall(VecZeroEntries(_cmc_advective_derivative_rhs));
1670 LibmeshPetscCall(VecZeroEntries(_cmc_friction_force_rhs));
1671 LibmeshPetscCall(VecZeroEntries(_cmc_pressure_force_rhs));
1672 LibmeshPetscCall(MatZeroEntries(_cmc_sys_Wij_mat));
1673 LibmeshPetscCall(VecZeroEntries(_cmc_sys_Wij_rhs));
1674 const Real & pitch = _subchannel_mesh.getPitch();
1675 for (unsigned int iz = first_node; iz < last_node + 1; iz++)
1676 {
1677 auto dz = _z_grid[iz] - _z_grid[iz - 1];
1678 auto iz_ind = iz - first_node;
1679 for (unsigned int i_gap = 0; i_gap < _n_gaps; i_gap++)
1680 {
1681 auto chans = _subchannel_mesh.getGapChannels(i_gap);
1682 unsigned int i_ch = chans.first;
1683 unsigned int j_ch = chans.second;
1684 auto * node_in_i = _subchannel_mesh.getChannelNode(i_ch, iz - 1);
1685 auto * node_out_i = _subchannel_mesh.getChannelNode(i_ch, iz);
1686 auto * node_in_j = _subchannel_mesh.getChannelNode(j_ch, iz - 1);
1687 auto * node_out_j = _subchannel_mesh.getChannelNode(j_ch, iz);
1688
1689 // inlet, outlet, and interpolated densities
1690 auto rho_i_in = (*_rho_soln)(node_in_i);
1691 auto rho_i_out = (*_rho_soln)(node_out_i);
1692 auto rho_i_interp = computeInterpolatedValue(rho_i_out, rho_i_in, 0.5);
1693 auto rho_j_in = (*_rho_soln)(node_in_j);
1694 auto rho_j_out = (*_rho_soln)(node_out_j);
1695 auto rho_j_interp = computeInterpolatedValue(rho_j_out, rho_j_in, 0.5);
1696
1697 // inlet, outlet, and interpolated areas
1698 auto S_i_in = (*_S_flow_soln)(node_in_i);
1699 auto S_i_out = (*_S_flow_soln)(node_out_i);
1700 auto S_j_in = (*_S_flow_soln)(node_in_j);
1701 auto S_j_out = (*_S_flow_soln)(node_out_j);
1702
1703 // Cross-sectional gap area
1704 auto Sij = dz * _subchannel_mesh.getGapWidth(iz, i_gap);
1705 auto Lij = pitch;
1706
1707 // Figure out donor cell density
1708 auto rho_star = 0.0;
1709 if (_Wij(i_gap, iz) > 0.0)
1710 rho_star = rho_i_interp;
1711 else if (_Wij(i_gap, iz) < 0.0)
1712 rho_star = rho_j_interp;
1713 else
1714 rho_star = (rho_i_interp + rho_j_interp) / 2.0;
1715
1716 // Assembling time derivative
1717 PetscScalar time_factor = _TR * Lij * Sij * rho_star / _dt;
1718 PetscInt row_td = i_gap + _n_gaps * iz_ind;
1719 PetscInt col_td = i_gap + _n_gaps * iz_ind;
1720 PetscScalar value_td = time_factor;
1721 PetscScalar value_td_rhs = time_factor * _Wij_old(i_gap, iz);
1722 // A closed gap, where the pins touch and the mesh sets the gap width to zero, carries no
1723 // crossflow. Every coefficient of its row scales with Sij or with |Wij|, so the row is
1724 // otherwise empty and the monolithic system singular. The identity row Wij = 0 enforces the
1725 // physical answer; the remaining terms add nothing to it because they are zero.
1726 if (Sij == 0.0)
1727 {
1728 value_td = 1.0;
1729 value_td_rhs = 0.0;
1730 }
1731 LibmeshPetscCall(MatSetValues(
1732 _cmc_time_derivative_mat, 1, &row_td, 1, &col_td, &value_td, INSERT_VALUES));
1733 LibmeshPetscCall(
1734 VecSetValues(_cmc_time_derivative_rhs, 1, &row_td, &value_td_rhs, INSERT_VALUES));
1735 const PetscScalar inertia = Lij * Sij * rho_star;
1736 LibmeshPetscCall(
1737 VecSetValues(_cmc_pseudo_time_inertia, 1, &row_td, &inertia, INSERT_VALUES));
1738
1739 // Assembling inertial term
1740 PetscScalar Pe = 0.5;
1741 auto alpha = computeInterpolationCoefficients(Pe);
1742 auto mass_term_out = (*_mdot_soln)(node_out_i) / S_i_out / rho_i_out +
1743 (*_mdot_soln)(node_out_j) / S_j_out / rho_j_out;
1744 auto mass_term_in = (*_mdot_soln)(node_in_i) / S_i_in / rho_i_in +
1745 (*_mdot_soln)(node_in_j) / S_j_in / rho_j_in;
1746 auto term_out = Sij * rho_star * (Lij / dz) * mass_term_out / 2.0;
1747 auto term_in = Sij * rho_star * (Lij / dz) * mass_term_in / 2.0;
1748 if (iz == first_node)
1749 {
1750 PetscInt row_ad = i_gap + _n_gaps * iz_ind;
1751 PetscScalar value_ad = term_in * alpha * _Wij(i_gap, iz - 1);
1752 LibmeshPetscCall(
1753 VecSetValues(_cmc_advective_derivative_rhs, 1, &row_ad, &value_ad, ADD_VALUES));
1754
1755 PetscInt col_ad = i_gap + _n_gaps * iz_ind;
1756 value_ad = -1.0 * term_in * (1.0 - alpha) + term_out * alpha;
1757 LibmeshPetscCall(MatSetValues(
1758 _cmc_advective_derivative_mat, 1, &row_ad, 1, &col_ad, &value_ad, INSERT_VALUES));
1759
1760 col_ad = i_gap + _n_gaps * (iz_ind + 1);
1761 value_ad = term_out * (1.0 - alpha);
1762 LibmeshPetscCall(MatSetValues(
1763 _cmc_advective_derivative_mat, 1, &row_ad, 1, &col_ad, &value_ad, INSERT_VALUES));
1764 }
1765 else if (iz == last_node)
1766 {
1767 PetscInt row_ad = i_gap + _n_gaps * iz_ind;
1768 PetscInt col_ad = i_gap + _n_gaps * (iz_ind - 1);
1769 PetscScalar value_ad = -1.0 * term_in * alpha;
1770 LibmeshPetscCall(MatSetValues(
1771 _cmc_advective_derivative_mat, 1, &row_ad, 1, &col_ad, &value_ad, INSERT_VALUES));
1772
1773 col_ad = i_gap + _n_gaps * iz_ind;
1774 value_ad = -1.0 * term_in * (1.0 - alpha) + term_out * alpha;
1775 LibmeshPetscCall(MatSetValues(
1776 _cmc_advective_derivative_mat, 1, &row_ad, 1, &col_ad, &value_ad, INSERT_VALUES));
1777
1778 value_ad = -1.0 * term_out * (1.0 - alpha) * _Wij(i_gap, iz);
1779 LibmeshPetscCall(
1780 VecSetValues(_cmc_advective_derivative_rhs, 1, &row_ad, &value_ad, ADD_VALUES));
1781 }
1782 else
1783 {
1784 PetscInt row_ad = i_gap + _n_gaps * iz_ind;
1785 PetscInt col_ad = i_gap + _n_gaps * (iz_ind - 1);
1786 PetscScalar value_ad = -1.0 * term_in * alpha;
1787 LibmeshPetscCall(MatSetValues(
1788 _cmc_advective_derivative_mat, 1, &row_ad, 1, &col_ad, &value_ad, INSERT_VALUES));
1789
1790 col_ad = i_gap + _n_gaps * iz_ind;
1791 value_ad = -1.0 * term_in * (1.0 - alpha) + term_out * alpha;
1792 LibmeshPetscCall(MatSetValues(
1793 _cmc_advective_derivative_mat, 1, &row_ad, 1, &col_ad, &value_ad, INSERT_VALUES));
1794
1795 col_ad = i_gap + _n_gaps * (iz_ind + 1);
1796 value_ad = term_out * (1.0 - alpha);
1797 LibmeshPetscCall(MatSetValues(
1798 _cmc_advective_derivative_mat, 1, &row_ad, 1, &col_ad, &value_ad, INSERT_VALUES));
1799 }
1800 // Assembling friction force
1801 PetscInt row_ff = i_gap + _n_gaps * iz_ind;
1802 PetscInt col_ff = i_gap + _n_gaps * iz_ind;
1803 PetscScalar value_ff = _kij * std::abs(_Wij(i_gap, iz)) / 2.0;
1804 LibmeshPetscCall(MatSetValues(
1805 _cmc_friction_force_mat, 1, &row_ff, 1, &col_ff, &value_ff, INSERT_VALUES));
1806
1807 // Assembling pressure force
1809
1810 PetscScalar pressure_factor = Utility::pow<2>(Sij) * rho_star;
1811 PetscInt row_pf = i_gap + _n_gaps * iz_ind;
1812 PetscInt col_pf = i_ch + _n_channels * iz_ind;
1813 PetscScalar value_pf = -1.0 * alpha * pressure_factor;
1814 LibmeshPetscCall(
1815 MatSetValues(_cmc_pressure_force_mat, 1, &row_pf, 1, &col_pf, &value_pf, ADD_VALUES));
1816 col_pf = j_ch + _n_channels * iz_ind;
1817 value_pf = alpha * pressure_factor;
1818 LibmeshPetscCall(
1819 MatSetValues(_cmc_pressure_force_mat, 1, &row_pf, 1, &col_pf, &value_pf, ADD_VALUES));
1820
1821 if (iz == last_node)
1822 {
1823 PetscInt row_pf = i_gap + _n_gaps * iz_ind;
1824 PetscScalar value_pf = (1.0 - alpha) * pressure_factor * (*_P_soln)(node_out_i);
1825 LibmeshPetscCall(
1826 VecSetValues(_cmc_pressure_force_rhs, 1, &row_pf, &value_pf, ADD_VALUES));
1827 value_pf = -1.0 * (1.0 - alpha) * pressure_factor * (*_P_soln)(node_out_j);
1828 LibmeshPetscCall(
1829 VecSetValues(_cmc_pressure_force_rhs, 1, &row_pf, &value_pf, ADD_VALUES));
1830 }
1831 else
1832 {
1833 row_pf = i_gap + _n_gaps * iz_ind;
1834 col_pf = i_ch + _n_channels * (iz_ind + 1);
1835 value_pf = -1.0 * (1.0 - alpha) * pressure_factor;
1836 LibmeshPetscCall(
1837 MatSetValues(_cmc_pressure_force_mat, 1, &row_pf, 1, &col_pf, &value_pf, ADD_VALUES));
1838 col_pf = j_ch + _n_channels * (iz_ind + 1);
1839 value_pf = (1.0 - alpha) * pressure_factor;
1840 LibmeshPetscCall(
1841 MatSetValues(_cmc_pressure_force_mat, 1, &row_pf, 1, &col_pf, &value_pf, ADD_VALUES));
1842 }
1843 }
1844 }
1846 LibmeshPetscCall(MatZeroEntries(_cmc_sys_Wij_mat));
1847 LibmeshPetscCall(VecZeroEntries(_cmc_sys_Wij_rhs));
1848 LibmeshPetscCall(MatAssemblyBegin(_cmc_time_derivative_mat, MAT_FINAL_ASSEMBLY));
1849 LibmeshPetscCall(MatAssemblyEnd(_cmc_time_derivative_mat, MAT_FINAL_ASSEMBLY));
1850 LibmeshPetscCall(MatAssemblyBegin(_cmc_advective_derivative_mat, MAT_FINAL_ASSEMBLY));
1851 LibmeshPetscCall(MatAssemblyEnd(_cmc_advective_derivative_mat, MAT_FINAL_ASSEMBLY));
1852 LibmeshPetscCall(MatAssemblyBegin(_cmc_friction_force_mat, MAT_FINAL_ASSEMBLY));
1853 LibmeshPetscCall(MatAssemblyEnd(_cmc_friction_force_mat, MAT_FINAL_ASSEMBLY));
1854 LibmeshPetscCall(MatAssemblyBegin(_cmc_pressure_force_mat, MAT_FINAL_ASSEMBLY));
1855 LibmeshPetscCall(MatAssemblyEnd(_cmc_pressure_force_mat, MAT_FINAL_ASSEMBLY));
1856 LibmeshPetscCall(MatAssemblyBegin(_cmc_sys_Wij_mat, MAT_FINAL_ASSEMBLY));
1857 LibmeshPetscCall(MatAssemblyEnd(_cmc_sys_Wij_mat, MAT_FINAL_ASSEMBLY));
1858 LibmeshPetscCall(VecAssemblyBegin(_cmc_pseudo_time_inertia));
1859 LibmeshPetscCall(VecAssemblyEnd(_cmc_pseudo_time_inertia));
1860 // Matrix
1861 LibmeshPetscCall(addTermMatrices(
1865 // RHS
1866 LibmeshPetscCall(VecAXPY(_cmc_sys_Wij_rhs, 1.0, _cmc_time_derivative_rhs));
1867 LibmeshPetscCall(VecAXPY(_cmc_sys_Wij_rhs, 1.0, _cmc_advective_derivative_rhs));
1868 LibmeshPetscCall(VecAXPY(_cmc_sys_Wij_rhs, 1.0, _cmc_friction_force_rhs));
1869
1870 if (_segregated_bool)
1871 {
1872 // Assembly the matrix system
1873 Vec sol_holder_P;
1874 LibmeshPetscCall(createPetscVector(sol_holder_P, _block_size * _n_gaps));
1875 Vec sol_holder_W;
1876 LibmeshPetscCall(createPetscVector(sol_holder_W, _block_size * _n_gaps));
1877 LibmeshPetscCall(populateVectorFromHandle<SolutionHandle>(
1878 _prodp, *_P_soln, first_node - 1, last_node - 1, _n_channels));
1880 _Wij_vec, _Wij, first_node, last_node, _n_gaps));
1881 LibmeshPetscCall(MatMult(_cmc_sys_Wij_mat, _Wij_vec, sol_holder_W));
1882 LibmeshPetscCall(VecAXPY(sol_holder_W, -1.0, _cmc_sys_Wij_rhs));
1883 LibmeshPetscCall(MatMult(_cmc_pressure_force_mat, _prodp, sol_holder_P));
1884 LibmeshPetscCall(VecAXPY(sol_holder_P, -1.0, _cmc_pressure_force_rhs));
1885 LibmeshPetscCall(VecAXPY(sol_holder_W, 1.0, sol_holder_P));
1886 PetscScalar * xx;
1887 LibmeshPetscCall(VecGetArray(sol_holder_W, &xx));
1888 for (unsigned int iz = first_node; iz < last_node + 1; iz++)
1889 {
1890 auto iz_ind = iz - first_node;
1891 for (unsigned int i_gap = 0; i_gap < _n_gaps; i_gap++)
1892 {
1893 _Wij_residual_matrix(i_gap, iz - 1 - iblock * _block_size) = xx[iz_ind * _n_gaps + i_gap];
1894 }
1895 }
1896 LibmeshPetscCall(VecRestoreArray(sol_holder_W, &xx));
1897 LibmeshPetscCall(VecDestroy(&sol_holder_P));
1898 LibmeshPetscCall(VecDestroy(&sol_holder_W));
1899 }
1900 }
1901}
Mat _cmc_friction_force_mat
Cross momentum conservation - friction force.
Mat _cmc_time_derivative_mat
Cross momentum Cross momentum conservation - time derivative.
Mat _cmc_sys_Wij_mat
Lateral momentum system matrix.
Mat _cmc_pressure_force_mat
Cross momentum conservation - pressure force.
libMesh::DenseMatrix< Real > _Wij_residual_matrix
Mat _cmc_advective_derivative_mat
Cross momentum conservation - advective (Eulerian) derivative.
Vec _cmc_pseudo_time_inertia
Crossflow inertia L_ij S_ij rho* of each gap of the block, the coefficient of the pseudo-time derivat...
libMesh::DenseMatrix< Real > & _Wij_old

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

◆ createPetscMatrix()

PetscErrorCode SubChannel1PhaseProblem::createPetscMatrix ( Mat &  M,
PetscInt  n,
PetscInt  m 
)
inlineprotectedinherited

Definition at line 384 of file SubChannel1PhaseProblem.h.

385 {
387 LibmeshPetscCall(MatCreate(PETSC_COMM_SELF, &M));
388 LibmeshPetscCall(MatSetSizes(M, PETSC_DECIDE, PETSC_DECIDE, n, m));
389 LibmeshPetscCall(MatSetFromOptions(M));
390 LibmeshPetscCall(MatSetUp(M));
391 PetscFunctionReturn(LIBMESH_PETSC_SUCCESS);
392 }
const double M

Referenced by SubChannel1PhaseProblem::SubChannel1PhaseProblem(), and TriSubChannel1PhaseProblem().

◆ createPetscVector()

PetscErrorCode SubChannel1PhaseProblem::createPetscVector ( Vec &  v,
PetscInt  n 
)
inlineprotectedinherited

Petsc Functions.

Definition at line 373 of file SubChannel1PhaseProblem.h.

374 {
376 LibmeshPetscCall(VecCreate(PETSC_COMM_SELF, &v));
377 LibmeshPetscCall(PetscObjectSetName((PetscObject)v, "Solution"));
378 LibmeshPetscCall(VecSetSizes(v, PETSC_DECIDE, n));
379 LibmeshPetscCall(VecSetFromOptions(v));
380 LibmeshPetscCall(VecZeroEntries(v));
381 PetscFunctionReturn(LIBMESH_PETSC_SUCCESS);
382 }
const double v

Referenced by SubChannel1PhaseProblem::addCrossflowDamping(), SubChannel1PhaseProblem::computeWijResidual(), SubChannel1PhaseProblem::implicitPetscSolve(), SubChannel1PhaseProblem::SubChannel1PhaseProblem(), and TriSubChannel1PhaseProblem().

◆ detectDeformation()

void SubChannel1PhaseProblem::detectDeformation ( )
protectedinherited

Detects whether pin diameter or duct displacement fields require geometry recalculation.

Definition at line 522 of file SubChannel1PhaseProblem.C.

523{
525 const auto pin_diameter = _subchannel_mesh.getPinDiameter();
526
527 if (_pin_mesh_exist)
528 {
529 for (unsigned int iz = 0; iz < _n_cells + 1; iz++)
530 for (unsigned int i_pin = 0; i_pin < _n_pins; i_pin++)
531 {
532 auto * node = _subchannel_mesh.getPinNode(i_pin, iz);
533 const Real Dpin = (*_Dpin_soln)(node);
534 if (std::abs(Dpin) <= tol)
535 mooseError("Dpin is zero at node ",
536 node->id(),
537 ". You must initialize Dpin to a non-zero value.");
538 if (std::abs(Dpin - pin_diameter) > tol)
539 _deformation = true;
540 }
541 }
542
543 for (unsigned int iz = 0; iz < _n_cells + 1 && !_deformation; iz++)
544 for (unsigned int i_ch = 0; i_ch < _n_channels && !_deformation; i_ch++)
545 {
546 auto * node = _subchannel_mesh.getChannelNode(i_ch, iz);
547 auto subch_type = _subchannel_mesh.getSubchannelType(i_ch);
548
549 if ((subch_type == EChannelType::CORNER || subch_type == EChannelType::EDGE) &&
550 std::abs((*_displacement_soln)(node)) > tol)
551 _deformation = true;
552 }
553}
const double tol
std::unique_ptr< SolutionHandle > _displacement_soln
bool _deformation
Flag that activates the effect of deformation (pin/duct) based on the auxvalues for displacement,...
static constexpr Real TOLERANCE

Referenced by QuadSubChannel1PhaseProblem::initializeSolution(), and initializeSolution().

◆ externalSolve()

void SubChannel1PhaseProblem::externalSolve ( )
overridevirtualinherited

Assigning temperatures to duct

Implements ExternalProblem.

Definition at line 2785 of file SubChannel1PhaseProblem.C.

2786{
2787 _console << "Executing subchannel solver\n";
2788 _dt = (isTransient() ? dt() : _one);
2789 _TR = isTransient();
2790
2791 // The subchannel solver hardcodes a first-order backward (implicit) Euler time discretization, so
2792 // any other time integrator a user selects is silently ignored. Warn once if one is requested.
2794 {
2796 if (isTransient())
2797 if (auto * transient = dynamic_cast<TransientBase *>(_app.getExecutioner()))
2798 for (const auto * ti : transient->getTimeIntegrators())
2799 if (!dynamic_cast<const ImplicitEuler *>(ti))
2800 mooseWarning("The subchannel solver always uses implicit (backward) Euler time "
2801 "integration; the requested '",
2802 ti->type(),
2803 "' time integrator is ignored.");
2804 }
2805
2810 // Small helper functions to reduce repetition
2811 // Verbose print helper (no-op unless _verbose_subchannel is true)
2812 auto V = [&](const std::string & s)
2813 {
2815 _console << s << std::endl;
2816 };
2817 auto saveValues = [&](const SolutionHandle & solution,
2818 const unsigned int first_node,
2819 const unsigned int last_node)
2820 {
2821 std::vector<Real> values;
2822 values.reserve((last_node - first_node + 1) * _n_channels);
2823 for (unsigned int iz = first_node; iz <= last_node; ++iz)
2824 for (unsigned int i_ch = 0; i_ch < _n_channels; ++i_ch)
2825 values.push_back(solution(_subchannel_mesh.getChannelNode(i_ch, iz)));
2826 return values;
2827 };
2828 auto relativeChange = [&](const SolutionHandle & solution,
2829 const std::vector<Real> & old_values,
2830 const unsigned int first_node,
2831 const unsigned int last_node,
2832 const Real reference_offset)
2833 {
2834 Real difference_norm_sq = 0.0;
2835 Real reference_norm_sq = 0.0;
2836 std::size_t i = 0;
2837 for (unsigned int iz = first_node; iz <= last_node; ++iz)
2838 for (unsigned int i_ch = 0; i_ch < _n_channels; ++i_ch)
2839 {
2840 const Real value = solution(_subchannel_mesh.getChannelNode(i_ch, iz));
2841 difference_norm_sq += Utility::pow<2>(value - old_values[i]);
2842 reference_norm_sq += Utility::pow<2>(old_values[i] + reference_offset);
2843 ++i;
2844 }
2845 return std::sqrt(difference_norm_sq) / (std::sqrt(reference_norm_sq) + 1e-14);
2846 };
2847 V("Solution initialized");
2848 Real P_error = 1.0;
2849 unsigned int P_it = 0;
2850 unsigned int P_it_max;
2851 bool temperature_converged = true;
2852
2853 if (_segregated_bool)
2854 P_it_max = 20 * _n_blocks;
2855 else
2856 P_it_max = 100;
2857
2858 if ((_n_blocks == 1) && (_segregated_bool))
2859 P_it_max = 5;
2860
2861 if (_P_maxit > 0)
2862 P_it_max = _P_maxit;
2863
2864 while ((P_error > _P_tol && P_it < P_it_max))
2865 {
2866 P_it += 1;
2867 temperature_converged = true;
2869 _console << "Solving Outer Iteration : " << P_it << std::endl;
2870 const auto P_old = saveValues(*_P_soln, 0, _n_cells);
2871 for (unsigned int iblock = 0; iblock < _n_blocks; iblock++)
2872 {
2873 int last_level = (iblock + 1) * _block_size;
2874 int first_level = iblock * _block_size + 1;
2875 Real T_block_error = 1.0;
2876 auto T_it = 0;
2877 _console << "Solving Block: " << iblock << " From first level: " << first_level
2878 << " to last level: " << last_level << std::endl;
2879
2880 while (T_block_error > _T_tol && T_it < _T_maxit)
2881 {
2882 if (processor_id() == 0)
2883 {
2884 if (_segregated_bool)
2885 computeWijFromSolve(iblock);
2886 else
2887 {
2888 LibmeshPetscCall(implicitPetscSolve(iblock));
2889 computeWijPrime(iblock);
2890 V("Done with main solve.");
2891 }
2892 }
2893
2894 // A value of one preserves the original ordering by refreshing the flow solution before
2895 // every thermal update. Larger values opt into lagging flow during thermal subcycles.
2896 for (const auto enthalpy_subcycle : make_range(_enthalpy_subcycles))
2897 {
2898 if (T_block_error <= _T_tol || T_it >= _T_maxit)
2899 break;
2900
2901 V("Enthalpy subcycle: " + std::to_string(enthalpy_subcycle + 1));
2902 T_it += 1;
2903 const auto T_old = saveValues(*_T_soln, first_level, last_level);
2904 // We are only computing quantities on rank 0
2905 if (processor_id() > 0)
2906 {
2907 // Rank zero supplies the error through the maximum reduction below.
2908 T_block_error = 0.0;
2909 goto aux_close;
2910 }
2911
2912 if (_compute_power)
2913 {
2914 computeh(iblock);
2915 T_block_error = computeT(iblock);
2916 V("Done with thermal solve.");
2917 }
2918
2919 V("Start updating thermophysical properties.");
2920 if (_compute_density)
2921 computeRho(iblock);
2923 computeMu(iblock);
2924 V("Done updating thermophysical properties.");
2925
2926 // We must do a global assembly to make sure data is parallel consistent before we do
2927 // things like compute L2 norms
2928 aux_close:
2929 _aux->solution().close();
2930
2931 if (!_compute_power)
2932 T_block_error =
2933 relativeChange(*_T_soln, T_old, first_level, last_level, /*reference_offset=*/0.0);
2934 _console << "T_block_error: " << T_block_error << std::endl;
2935
2936 // All processes must have the same iteration count
2937 comm().max(T_block_error);
2938 }
2939 }
2940 const bool block_converged = T_block_error <= _T_tol;
2941 temperature_converged &= block_converged;
2942 if (!block_converged)
2943 {
2944 _console << "Reached maximum number of temperature iterations for block: " << iblock
2945 << std::endl;
2946 }
2947 }
2948 P_error = _segregated_bool ? relativeChange(*_P_soln, P_old, 0, _n_cells, _P_out)
2950 comm().max(P_error);
2951 _console << "P_error :" << P_error << std::endl;
2952 V("Iteration: " + std::to_string(P_it));
2953 V("Maximum iterations: " + std::to_string(P_it_max));
2954 }
2955 // Cache only the final iteration status. Earlier outer iterations may fail their thermal
2956 // tolerance and subsequently recover.
2957 const bool pressure_converged = P_error <= _P_tol;
2958 if (!pressure_converged)
2959 {
2960 _console << "Reached maximum number of axial pressure iterations" << std::endl;
2961 }
2962 _converged = pressure_converged && temperature_converged;
2963 // update old crossflow matrix
2964 _Wij_old = _Wij;
2965 _console << "Finished executing subchannel solver\n";
2966
2967 // set SumWij at the inlet equal to the one on the first axial level (for visualization purposes)
2968 for (unsigned int i_ch = 0; i_ch < _n_channels; i_ch++)
2969 {
2970 auto * node_in = _subchannel_mesh.getChannelNode(i_ch, 0);
2971 auto * node_out = _subchannel_mesh.getChannelNode(i_ch, 1);
2972 _SumWij_soln->set(node_in, (*_SumWij_soln)(node_out)); // kg/sec
2973 }
2974
2975 if (_pin_mesh_exist)
2976 {
2977 // Assign average HTC to subchannels. This is exact if all pins have the same diameter
2978 for (unsigned int iz = 0; iz < _n_cells + 1; ++iz)
2979 {
2980 for (unsigned int i_ch = 0; i_ch < _n_channels; i_ch++)
2981 {
2982 const auto * node = _subchannel_mesh.getChannelNode(i_ch, iz);
2983 auto mu = (*_mu_soln)(node);
2984 auto S = (*_S_flow_soln)(node);
2985 auto w_perim = (*_w_perim_soln)(node);
2986 auto Dh_i = 4.0 * S / w_perim;
2987 auto Re = ((std::abs((*_mdot_soln)(node)) / S) * Dh_i / mu);
2988 auto k = _fp->k_from_p_T((*_P_soln)(node) + _P_out, (*_T_soln)(node));
2989 auto cp = _fp->cp_from_p_T((*_P_soln)(node) + _P_out, (*_T_soln)(node));
2990 auto Pr = (*_mu_soln)(node)*cp / k;
2991 // Create Friction structure
2992 _friction_args = FrictionStruct(i_ch, Re, S, w_perim);
2993
2994 Real sumhw = 0.0;
2995 for (auto i_pin : _subchannel_mesh.getChannelPins(i_ch))
2996 {
2997 // Create nusselt number structure
2998 _nusselt_args = NusseltStruct(Re, Pr, i_pin, iz, i_ch);
2999
3000 // Compute HTC
3002 }
3003
3004 // Set HTC
3005 _HTC_soln->set(node, sumhw / _subchannel_mesh.getChannelPins(i_ch).size());
3006 }
3007 }
3008 _HTC_soln->close();
3009
3010 _console << "Commencing calculation of Pin surface temperature \n";
3011 for (unsigned int i_pin = 0; i_pin < _n_pins; i_pin++)
3012 {
3013 for (unsigned int iz = 0; iz < _n_cells + 1; ++iz)
3014 {
3015 const auto * pin_node = _subchannel_mesh.getPinNode(i_pin, iz);
3016 Real sumTemp = 0.0;
3017 // Calculate sum of pin surface temperatures that the channels around the pin see
3018 for (auto i_ch : _subchannel_mesh.getPinChannels(i_pin))
3019 {
3020 const auto * node = _subchannel_mesh.getChannelNode(i_ch, iz);
3021 auto mu = (*_mu_soln)(node);
3022 auto S = (*_S_flow_soln)(node);
3023 auto w_perim = (*_w_perim_soln)(node);
3024 auto Dh_i = 4.0 * S / w_perim;
3025 auto Re = ((std::abs((*_mdot_soln)(node)) / S) * Dh_i / mu);
3026 auto k = _fp->k_from_p_T((*_P_soln)(node) + _P_out, (*_T_soln)(node));
3027 auto cp = _fp->cp_from_p_T((*_P_soln)(node) + _P_out, (*_T_soln)(node));
3028 auto Pr = (*_mu_soln)(node)*cp / k;
3029 // Create Friction structure
3030 _friction_args = FrictionStruct(i_ch, Re, S, w_perim);
3031 // Create nusselt number structure
3032 _nusselt_args = NusseltStruct(Re, Pr, i_pin, iz, i_ch);
3033 // Compute HTC
3035 // Compute surface temperature contribution from subchannel side
3036 sumTemp +=
3037 (*_q_prime_soln)(pin_node) / ((*_Dpin_soln)(pin_node)*M_PI * hw) + (*_T_soln)(node);
3038 }
3039 if (_subchannel_mesh.getPinChannels(i_pin).size() > 0)
3040 _Tpin_soln->set(pin_node, sumTemp / _subchannel_mesh.getPinChannels(i_pin).size());
3041 else
3042 mooseError("Pin was not found for pin index: " + std::to_string(i_pin));
3043 }
3044 }
3045 }
3046
3048 if (_duct_mesh_exist && processor_id() == 0)
3049 {
3050 _console << "Commencing calculation of duct surface temperature " << std::endl;
3051 auto duct_nodes = _subchannel_mesh.getDuctNodes();
3052 for (Node * dn : duct_nodes)
3053 {
3054 auto * node_chan = _subchannel_mesh.getChannelNodeFromDuct(dn);
3055 auto mu = (*_mu_soln)(node_chan);
3056 auto S = (*_S_flow_soln)(node_chan);
3057 auto w_perim = (*_w_perim_soln)(node_chan);
3058 auto Dh_i = 4.0 * S / w_perim;
3059 auto Re = ((std::abs((*_mdot_soln)(node_chan)) / S) * Dh_i / mu);
3060 auto k = _fp->k_from_p_T((*_P_soln)(node_chan) + _P_out, (*_T_soln)(node_chan));
3061 auto cp = _fp->cp_from_p_T((*_P_soln)(node_chan) + _P_out, (*_T_soln)(node_chan));
3062 auto Pr = (*_mu_soln)(node_chan)*cp / k;
3063
3064 // Create nusselt number structure (consistent with pin case)
3065 const libMesh::Point & node_point = *_subchannel_mesh.getChannelNodeFromDuct(dn);
3066 const unsigned int iz = _subchannel_mesh.getZIndex(node_point);
3067 const unsigned int i_ch = _subchannel_mesh.channelIndex(node_point);
3068
3069 // Create nusselt number structure
3070 _nusselt_args = NusseltStruct(Re, Pr, std::numeric_limits<unsigned int>::max(), iz, i_ch);
3071
3072 // Create Friction structure
3073 _friction_args = FrictionStruct(i_ch, Re, S, w_perim);
3074
3075 // Compute HTC
3077
3078 // Compute Channel Temperature
3079 auto T_chan = (*_duct_heat_flux_soln)(dn) / hw + (*_T_soln)(node_chan);
3080 _Tduct_soln->set(dn, T_chan);
3081 }
3082 }
3083 _aux->solution().close();
3084 _aux->update();
3085
3086 // Called before the rank-0 early return since it broadcasts to all ranks
3088
3089 if (processor_id() != 0)
3090 return;
3091 Real power_in = 0.0;
3092 Real power_out = 0.0;
3093 Real mass_flow_in = 0.0;
3094 Real mass_flow_out = 0.0;
3095 for (unsigned int i_ch = 0; i_ch < _n_channels; i_ch++)
3096 {
3097 auto * node_in = _subchannel_mesh.getChannelNode(i_ch, 0);
3098 auto * node_out = _subchannel_mesh.getChannelNode(i_ch, _n_cells);
3099 const Real mdot_in = (*_mdot_soln)(node_in);
3100 power_in += mdot_in * (*_h_soln)(node_in);
3101 power_out += (*_mdot_soln)(node_out) * (*_h_soln)(node_out);
3102 mass_flow_in += mdot_in;
3103 mass_flow_out += (*_mdot_soln)(node_out);
3104 }
3105 auto h_bulk_out = power_out / mass_flow_out;
3106 auto T_bulk_out = _fp->T_from_p_h(_P_out, h_bulk_out);
3107
3110 {
3111 _console << " ======================================= " << std::endl;
3112 _console << " ======== Subchannel Print Outs ======== " << std::endl;
3113 _console << " ======================================= " << std::endl;
3114 _console << "Total flow area :" << _subchannel_mesh.getAssemblyFlowArea() << " m^2"
3115 << std::endl;
3116 _console << "Assembly hydraulic diameter :" << bulk_Dh << " m" << std::endl;
3117 _console << "Assembly Re number :" << _bulk_Re << " [-]" << std::endl;
3118 _console << "Bulk coolant temperature at outlet :" << T_bulk_out << " K" << std::endl;
3119 _console << "Power added to coolant is : " << power_out - power_in << " Watt" << std::endl;
3120 _console << "Mass flow rate in is : " << mass_flow_in << " kg/sec" << std::endl;
3121 _console << "Mass balance is : " << mass_flow_out - mass_flow_in << " kg/sec" << std::endl;
3122 _console << "User defined outlet pressure is : " << _P_out << " Pa" << std::endl;
3123 _console << " ======================================= " << std::endl;
3124 }
3125
3126 if (MooseUtils::absoluteFuzzyLessEqual((power_out - power_in), -1.0))
3128 "Energy conservation equation might not be solved correctly, Power added to coolant: " +
3129 std::to_string(power_out - power_in) + " Watt ");
3130}
const double mu
std::array< Real, 2 > values
std::shared_ptr< AuxiliarySystem > _aux
virtual Real & dt() const
virtual void transient(bool trans)
virtual bool isTransient() const override
Executioner * getExecutioner() const
const std::string & type() const
void mooseWarning(Args &&... args) const
MooseApp & _app
Real computeHTC(const FrictionStruct &friction_info, const NusseltStruct &nusselt_info, const Real conduction_k) const
Computes the convective heat transfer coefficient for the local conditions.
Provide a simple RAII interface for linear lagrange solution variables.
const SCMHTCClosureBase * _pin_HTC_closure
HTC closure objects.
const SCMHTCClosureBase * _duct_HTC_closure
virtual void initializeSolution()=0
Function to initialize the solution & geometry fields.
void computeRho(int iblock)
Computes Density per channel for block iblock.
const Real & _T_tol
Convergence tolerance for the temperature loop in internal solve.
std::unique_ptr< SolutionHandle > _Dpin_soln
unsigned int _n_blocks
number of axial blocks
std::unique_ptr< SolutionHandle > _Tduct_soln
virtual void computeh(int iblock)=0
Computes Enthalpy per channel for block iblock.
bool _time_integrator_checked
Whether the time integrator has been checked for consistency with the implementation.
const Real & _P_tol
Convergence tolerance for the pressure loop in external solve.
Real _pressure_fixed_point_error
Maximum pressure fixed-point update before solution relaxation over the blocks.
const bool _compute_viscosity
Flag that activates or deactivates the calculation of viscosity.
PetscErrorCode implicitPetscSolve(int iblock)
Computes implicit solve using PetSc.
bool _converged
Variable that informs whether we exited external solve with a converged solution or not.
const int & _T_maxit
Maximum iterations for the inner temperature loop.
std::unique_ptr< SolutionHandle > _Tpin_soln
const int & _P_maxit
Maximum number of pressure iterations; zero selects the solver's existing automatic limit.
void computeWijFromSolve(int iblock)
Computes diversion crossflow per gap for block iblock.
const unsigned int & _enthalpy_subcycles
Number of enthalpy, temperature, and property updates performed per flow solve.
void computeMu(int iblock)
Computes Viscosity per channel for block iblock.
struct SubChannel1PhaseProblem::NusseltStruct _nusselt_args
void computeBulkReynoldsNumber()
Computes the assembly bulk Reynolds number from inlet flow conditions.
Real computeT(int iblock)
Computes and relaxes Temperature per channel for block iblock.
void computeWijPrime(int iblock)
Computes turbulent crossflow per gap for block iblock.
std::unique_ptr< SolutionHandle > _HTC_soln
virtual const std::vector< unsigned int > & getChannelPins(unsigned int i_chan) const =0
Return a vector of pin indices for a given channel index.
virtual unsigned int channelIndex(const Point &point) const =0
Node * getChannelNodeFromDuct(Node *duct_node) const
Function that gets the channel node from the duct node.
const std::vector< Node * > & getDuctNodes() const
Function that returns the vector with the duct nodes.
virtual unsigned int getZIndex(const Point &point) const
Get axial index of point.
virtual const std::vector< unsigned int > & getPinChannels(unsigned int i_pin) const =0
Return a vector of channel indices for a given Pin index.
void max(const T &r, T &o, Request &req) const
const Parallel::Communicator & comm() const
if(subdm)

◆ getAddedHeatDuct()

Real SubChannel1PhaseProblem::getAddedHeatDuct ( unsigned int  i_ch,
unsigned int  iz 
) const
inlineinherited

Return the added heat coming from the duct.

Definition at line 93 of file SubChannel1PhaseProblem.h.

94 {
95 return computeAddedHeatDuct(i_ch, iz);
96 }

Referenced by SCMDuctHeatRatePostprocessor::execute().

◆ getAddedHeatPin()

Real SubChannel1PhaseProblem::getAddedHeatPin ( unsigned int  i_ch,
unsigned int  iz 
) const
inlineinherited

Return the added heat coming from the fuel pins.

Definition at line 87 of file SubChannel1PhaseProblem.h.

88 {
89 return computeAddedHeatPin(i_ch, iz);
90 }
virtual Real computeAddedHeatPin(unsigned int i_ch, unsigned int iz) const =0
Pure virtual: daughters provide different implementations.

Referenced by SCMPinPowerPostprocessor::execute().

◆ getBulkReynoldsNumber()

Real SubChannel1PhaseProblem::getBulkReynoldsNumber ( ) const
inlineinherited

◆ getBulkVelocity()

Real SubChannel1PhaseProblem::getBulkVelocity ( ) const
inlineinherited

Definition at line 53 of file SubChannel1PhaseProblem.h.

53{ return _bulk_V; }

Referenced by SCMMixingChenTodreas::computeBlockMixingParameters().

◆ getDuctHTCClosure()

const SCMHTCClosureBase * SubChannel1PhaseProblem::getDuctHTCClosure ( ) const
inlineinherited

◆ getFrictionClosure()

const SCMFrictionClosureBase * SubChannel1PhaseProblem::getFrictionClosure ( ) const
inlineinherited

◆ getOutletPressure()

const PostprocessorValue & SubChannel1PhaseProblem::getOutletPressure ( ) const
inlineinherited

Get outlet pressure.

Definition at line 102 of file SubChannel1PhaseProblem.h.

102{ return _P_out; }

Referenced by SCMMixingKimAndChung::computeLatticeMixingParameter().

◆ getPinHTCClosure()

const SCMHTCClosureBase * SubChannel1PhaseProblem::getPinHTCClosure ( ) const
inlineinherited

Definition at line 50 of file SubChannel1PhaseProblem.h.

50{ return _pin_HTC_closure; } // optional

◆ getSinglePhaseFluidProperties()

const SinglePhaseFluidProperties * SubChannel1PhaseProblem::getSinglePhaseFluidProperties ( ) const
inlineinherited

Get fluid properties object.

Definition at line 108 of file SubChannel1PhaseProblem.h.

108{ return _fp; }

Referenced by SCMMixingKimAndChung::computeLatticeMixingParameter().

◆ getSubChannelPeripheralDuctWidth()

Real TriSubChannel1PhaseProblem::getSubChannelPeripheralDuctWidth ( unsigned int  i_ch) const
overrideprotectedvirtual

Function that computes the width of the duct cell that the peripheral subchannel i_ch sees.

Implements SubChannel1PhaseProblem.

Definition at line 310 of file TriSubChannel1PhaseProblem.C.

311{
312 auto subch_type = _subchannel_mesh.getSubchannelType(i_ch);
313 if (subch_type == EChannelType::EDGE || subch_type == EChannelType::CORNER)
314 {
315 auto width = _subchannel_mesh.getPitch();
316 if (subch_type == EChannelType::CORNER)
317 width = 2.0 / std::sqrt(3.0) *
319 return width;
320 }
321 else
322 mooseError("Channel is not a perimetric subchannel ");
323}

◆ implicitPetscSolve()

PetscErrorCode SubChannel1PhaseProblem::implicitPetscSolve ( int  iblock)
protectedinherited

Computes implicit solve using PetSc.

Definition at line 2326 of file SubChannel1PhaseProblem.C.

2327{
2329 // ---------- helper functions -----------------------------
2330 auto V = [&](const std::string & s)
2331 {
2333 _console << s << std::endl;
2334 };
2335
2336 auto DupMatAssembled = [&](Mat src, Mat * dst)
2337 {
2338 if (src)
2339 {
2340 LibmeshPetscCall(MatDuplicate(src, MAT_COPY_VALUES, dst));
2341 LibmeshPetscCall(MatAssemblyBegin(*dst, MAT_FINAL_ASSEMBLY));
2342 LibmeshPetscCall(MatAssemblyEnd(*dst, MAT_FINAL_ASSEMBLY));
2343 }
2344 else
2345 *dst = NULL;
2346 };
2347
2348 auto DupVecCopy = [&](Vec src, Vec * dst)
2349 {
2350 LibmeshPetscCall(VecDuplicate(src, dst));
2351 LibmeshPetscCall(VecCopy(src, *dst));
2352 };
2353
2354 const PetscInt Q = 3; // [mass conservation, axial momentum, cross momentum]
2355
2356 // small indexer
2357 auto Idx = [&](PetscInt r, PetscInt c) { return Q * r + c; };
2358
2359 // arrays that MUST be declared before lambdas use them
2360 std::vector<Mat> mat_array(Q * Q, NULL);
2361 std::vector<Vec> vec_array(Q, NULL);
2362
2363 // generic assembler for one governing equation row in the nested matrix
2364 auto AssembleEquation = [&](PetscInt f,
2365 Mat A0,
2366 Mat A1,
2367 Mat A2, // three blocks in row f (can be nullptr)
2368 Vec rhs, // base RHS for equation f
2369 Vec rhs_add, // optional extra RHS to add (can be nullptr)
2370 const char * label) // e.g. "Mass", "Lin mom", "Cross mom"
2371 {
2372 DupMatAssembled(A0, &mat_array[Idx(f, 0)]);
2373 DupMatAssembled(A1, &mat_array[Idx(f, 1)]);
2374 DupMatAssembled(A2, &mat_array[Idx(f, 2)]);
2375 DupVecCopy(rhs, &vec_array[f]);
2376 if (rhs_add)
2377 LibmeshPetscCall(VecAXPY(vec_array[f], 1.0, rhs_add));
2378 V(std::string(label) + " system assembled");
2379 };
2380
2381 // -----------------------------------------------------------------------------
2382 // Helper lambda that applies per-equation under-relaxation by modifying BOTH the
2383 // matrix block and the RHS for that equation.
2384 //
2385 // Specifically, with A_ff for the equation and D = diag(A_ff):
2386 // 1) Matrix diagonal scaling: D <- D / alpha, then A_ff's diagonal is replaced
2387 // with D. For alpha < 1 this increases diagonal dominance (more damping).
2388 // 2) RHS blending with the previous solution x_old:
2389 // rhs_f <- rhs_f + (1 - alpha) * (D / alpha) * x_old
2390 // where x_old is provided by the caller via `populate(work)`.
2391 //
2392 // Net effect: the solved x satisfies
2393 // A_ff x = rhs_f_original + ((1 - alpha)/alpha) * D * (x_old - x),
2394 // which damps updates toward x_old without changing the converged solution.
2395 // This equation relaxation is independent of the optional post-solve solution relaxation.
2396 // -----------------------------------------------------------------------------
2397 auto relaxEquation =
2398 [&](Mat diagonal_block, Vec rhs, Vec work, const Real relaxation, auto && populate)
2399 {
2400 if (relaxation == 1.0)
2401 return;
2402
2403 Vec diagonal = nullptr;
2404 LibmeshPetscCall(VecDuplicate(rhs, &diagonal));
2405
2406 // 1) diagonal_block: diag <- diag / relaxation
2407 LibmeshPetscCall(MatGetDiagonal(diagonal_block, diagonal));
2408 LibmeshPetscCall(VecScale(diagonal, 1.0 / relaxation));
2409 LibmeshPetscCall(MatDiagonalSet(diagonal_block, diagonal, INSERT_VALUES));
2410
2411 // 2) work <- x_old (caller-provided populator)
2412 LibmeshPetscCall(populate(work));
2413
2414 // 3) rhs += (1 - relaxation) * (diag .* work)
2415 LibmeshPetscCall(VecScale(diagonal, 1.0 - relaxation));
2416 LibmeshPetscCall(VecPointwiseMult(work, work, diagonal));
2417 LibmeshPetscCall(VecAXPY(rhs, 1.0, work));
2418
2419 LibmeshPetscCall(VecDestroy(&diagonal));
2420 };
2421
2422 // indices
2423 const unsigned int first_node = iblock * _block_size + 1;
2424 const unsigned int last_node = (iblock + 1) * _block_size;
2425
2426 // ---------- assemble per-block operators -----------------
2427 computeSumWij(iblock);
2428 computeMdot(iblock);
2429 computeWijPrime(iblock);
2430 computeDP(iblock);
2431 computeP(iblock);
2432 computeWijResidual(iblock);
2433
2434 V("Starting nested system.");
2435
2436 // Populate nested matrix with the individual physics
2437 // equation 0: Mass conservation
2438 AssembleEquation(/*f=*/0,
2441 /*A2=*/_mc_sumWij_mat,
2443 /*rhs_add=*/nullptr,
2444 /*label=*/"Mass");
2445
2446 // equation 1: Axial momentum conservation
2447 AssembleEquation(/*f=*/1,
2448 /*A0=*/_amc_sys_mdot_mat,
2450 /*A2=*/nullptr,
2452 /*rhs_add=*/_amc_sys_mdot_rhs,
2453 /*label=*/"Lin mom");
2454
2455 // equation 2: Cross momentum conservation
2456 AssembleEquation(/*f=*/2,
2457 /*A0=*/nullptr,
2459 /*A2=*/_cmc_sys_Wij_mat,
2460 /*rhs=*/_cmc_sys_Wij_rhs,
2461 /*rhs_add=*/_cmc_pressure_force_rhs,
2462 /*label=*/"Cross mom");
2463
2464 // ===================== Crossflow damping ====================
2465 PetscScalar inv_dtau = 0.0;
2466 Vec Wij_iter;
2467 LibmeshPetscCall(createPetscVector(Wij_iter, _block_size * _n_gaps));
2469 Wij_iter, _Wij, first_node, last_node, _n_gaps));
2471 LibmeshPetscCall(addCrossflowDamping(
2472 mat_array[Idx(2, 2)], mat_array[Idx(2, 1)], vec_array[2], Wij_iter, iblock, inv_dtau));
2473
2474 V("Relax mdot: " + std::to_string(_mass_flow_equation_relaxation));
2475 V("Relax P: " + std::to_string(_pressure_equation_relaxation));
2476 V("Relax Wij: " + std::to_string(_crossflow_equation_relaxation));
2477
2478 relaxEquation(mat_array[Idx(0, 0)],
2479 vec_array[0],
2480 _prod,
2482 [&](Vec work)
2483 {
2484 return populateVectorFromHandle<SolutionHandle>(
2485 work, *_mdot_soln, first_node, last_node, _n_channels);
2486 });
2487 V("mdot relaxed");
2488
2489 relaxEquation(mat_array[Idx(1, 1)],
2490 vec_array[1],
2491 _prodp,
2493 [&](Vec work)
2494 {
2495 // The pressure block represents the node below each axial momentum cell because
2496 // the outlet pressure is prescribed.
2497 return populateVectorFromHandle<SolutionHandle>(
2498 work, *_P_soln, first_node - 1, last_node - 1, _n_channels);
2499 });
2500 V("P relaxed");
2501
2502 relaxEquation(mat_array[Idx(2, 2)],
2503 vec_array[2],
2504 _Wij_vec,
2506 [&](Vec work)
2507 {
2508 return populateVectorFromDense<libMesh::DenseMatrix<Real>>(
2509 work, _Wij, first_node, last_node, _n_gaps);
2510 });
2511 V("Wij relaxed");
2512 V("Linear solver relaxed");
2513
2514 // ======================== Create and configure KSP =========================
2515 // One set of index sets shared by the matrix rows and columns, the field split, and the blocks of
2516 // the solution and right-hand side. PETSc locates matrix blocks by comparing index sets, which is
2517 // a pointer comparison when the objects are shared and otherwise expands and sorts them on every
2518 // matrix-vector product and preconditioner application. General index sets return their
2519 // indices without expanding them.
2520 std::vector<IS> field_is(Q);
2521 PetscInt n_total = 0;
2522 for (const auto f : make_range(Q))
2523 {
2524 PetscInt n;
2525 LibmeshPetscCall(VecGetSize(vec_array[f], &n));
2526 LibmeshPetscCall(ISCreateStride(PETSC_COMM_SELF, n, n_total, 1, &field_is[f]));
2527 LibmeshPetscCall(ISToGeneral(field_is[f]));
2528 n_total += n;
2529 }
2530 Mat A_nest;
2531 LibmeshPetscCall(MatCreateNest(
2532 PETSC_COMM_SELF, Q, field_is.data(), Q, field_is.data(), mat_array.data(), &A_nest));
2533 V("Nested system created");
2534
2535 KSP ksp;
2536 PC pc;
2537 LibmeshPetscCall(KSPCreate(PETSC_COMM_SELF, &ksp));
2538 LibmeshPetscCall(KSPSetOptionsPrefix(ksp, "scm_monolithic_"));
2539 LibmeshPetscCall(KSPSetType(ksp, KSPFGMRES));
2540 LibmeshPetscCall(KSPGMRESSetRestart(ksp, _monolithic_gmres_restart));
2541 LibmeshPetscCall(KSPSetOperators(ksp, A_nest, A_nest));
2542 LibmeshPetscCall(KSPGetPC(ksp, &pc));
2543 LibmeshPetscCall(KSPSetTolerances(ksp, _rtol, _atol, _dtol, _maxit));
2544 if (_monolithic_preconditioner == "lu")
2545 {
2546 // An exact factorization of the monolithic matrix; MUMPS factors the nested matrix directly.
2547 // FGMRES is kept so the solve can start from the current iterate, and converges in one
2548 // iteration.
2549 LibmeshPetscCall(PCSetType(pc, PCLU));
2550 LibmeshPetscCall(PCFactorSetMatSolverType(pc, MATSOLVERMUMPS));
2551 }
2552 else
2553 {
2554 // A multiplicative field split with one split per field
2555 LibmeshPetscCall(PCSetType(pc, PCFIELDSPLIT));
2556 for (const auto f : make_range(Q))
2557 LibmeshPetscCall(PCFieldSplitSetIS(pc, NULL, field_is[f]));
2558 }
2559 LibmeshPetscCall(KSPSetFromOptions(ksp));
2560 if (_monolithic_preconditioner == "fieldsplit_lu")
2561 {
2562 // Each split is factored exactly; the default of each split is ILU(0)
2563 LibmeshPetscCall(KSPSetUp(ksp));
2564 PetscInt n_splits;
2565 KSP * sub_ksp;
2566 LibmeshPetscCall(PCFieldSplitGetSubKSP(pc, &n_splits, &sub_ksp));
2567 for (const auto f : make_range(n_splits))
2568 {
2569 PC sub_pc;
2570 LibmeshPetscCall(KSPGetPC(sub_ksp[f], &sub_pc));
2571 LibmeshPetscCall(PCSetType(sub_pc, PCLU));
2572 }
2573 LibmeshPetscCall(PetscFree(sub_ksp));
2574 }
2575 V("Linear solver assembled");
2576
2577 // ============================== Solve =====================================
2578 // The Krylov solver works on contiguous vectors; nested vectors make every vector operation and
2579 // field-split scatter pack and unpack the blocks.
2580 Vec b_vec, x_vec;
2581 LibmeshPetscCall(createPetscVector(b_vec, n_total));
2582 LibmeshPetscCall(VecDuplicate(b_vec, &x_vec));
2583 for (const auto f : make_range(Q))
2584 LibmeshPetscCall(VecISCopy(b_vec, field_is[f], SCATTER_FORWARD, vec_array[f]));
2585 // Start from the current iterate. As the crossflow damping vanishes near convergence, this keeps
2586 // the monolithic linear solve short. rtol is applied to the residual of the initial iterate
2587 // rather than to the right-hand side.
2588 LibmeshPetscCall(KSPSetInitialGuessNonzero(ksp, PETSC_TRUE));
2589 LibmeshPetscCall(KSPConvergedDefaultSetUIRNorm(ksp));
2590 PetscReal rtol, atol, dtol;
2591 PetscInt maxit;
2592 LibmeshPetscCall(KSPGetTolerances(ksp, &rtol, &atol, &dtol, &maxit));
2593
2594 // As the pseudo-time step grows, the monolithic system can become too poorly conditioned for the
2595 // field-split preconditioner. A solve that has not converged within a limited number of
2596 // iterations is then repeated with a smaller step. Halving the step per retry with eight retries
2597 // spans the range between the residual-scaled step and the initial step. A per-attempt cap of
2598 // 1000 iterations lets slowly converging solves finish; lower caps abandon them and shrink the
2599 // step far more than necessary. The crossflow equation relaxation has scaled the damping of the
2600 // first attempt by 1/crossflow_equation_relaxation but does not scale the retry increments, so
2601 // with relaxation a retry raises the damping by less than a halving of the step would. The
2602 // reduction applies in the next monolithic solve of the block before the relaxation and takes
2603 // full effect.
2604 const PetscInt retry_maxit = _monolithic_retry_maxit;
2605 // The reduction is kept for the remaining monolithic solves of the block in this SCM solve so
2606 // that a failure is not repeated every iteration. Capping it at the reduction one fully retried
2607 // solve provides keeps the damping bounded by a multiple of the residual ratio, so it still
2608 // vanishes at convergence. Every attempt starts from the current outer iterate
2609 auto setInitialGuess = [&]()
2610 {
2611 std::vector<Vec> x_sub(Q);
2612 for (const auto f : make_range(Q))
2613 LibmeshPetscCall(VecGetSubVector(x_vec, field_is[f], &x_sub[f]));
2614 LibmeshPetscCall(populateVectorFromHandle<SolutionHandle>(
2615 x_sub[0], *_mdot_soln, first_node, last_node, _n_channels));
2616 LibmeshPetscCall(populateVectorFromHandle<SolutionHandle>(
2617 x_sub[1], *_P_soln, first_node - 1, last_node - 1, _n_channels));
2618 LibmeshPetscCall(VecCopy(Wij_iter, x_sub[2]));
2619 for (const auto f : make_range(Q))
2620 LibmeshPetscCall(VecRestoreSubVector(x_vec, field_is[f], &x_sub[f]));
2621 };
2622 KSPConvergedReason reason;
2623 // Without the damping there is no pseudo-time step to reduce, so the solve is attempted once
2624 const unsigned int max_retries = _crossflow_pseudo_time_damping ? _max_crossflow_retries : 0;
2625 for (const auto attempt : make_range(max_retries + 1))
2626 {
2627 const bool last_attempt = attempt == max_retries;
2628 LibmeshPetscCall(KSPSetTolerances(
2629 ksp, rtol, atol, dtol, last_attempt ? maxit : std::min(maxit, retry_maxit)));
2630 setInitialGuess();
2631 LibmeshPetscCall(KSPSolve(ksp, b_vec, x_vec));
2632 LibmeshPetscCall(KSPGetConvergedReason(ksp, &reason));
2633 if (reason >= 0 || last_attempt)
2634 break;
2635
2636 // Halve the pseudo-time step and re-solve, the step rejection of pseudo-transient continuation;
2637 // the right-hand-side compensation keeps the fixed point. The minimum increment of the inverse
2638 // step guarantees progress when the residual-scaled damping is close to zero.
2639 const PetscScalar delta_inv_dtau = std::max(inv_dtau, 0.05 / _crossflow_pseudo_time_step);
2640 inv_dtau += delta_inv_dtau;
2641 auto & reduction = _crossflow_pseudo_time_step_reduction[iblock];
2642 reduction = std::min(_max_crossflow_pseudo_time_step_reduction, 2.0 * reduction);
2643 V("Monolithic linear solve did not converge; retrying with nominal crossflow pseudo-time step "
2644 "(before crossflow equation relaxation): " +
2645 std::to_string(1.0 / inv_dtau));
2646
2647 Vec b_w;
2648 LibmeshPetscCall(VecGetSubVector(b_vec, field_is[2], &b_w));
2649 LibmeshPetscCall(shiftCrossflowDamping(mat_array[Idx(2, 2)], b_w, Wij_iter, delta_inv_dtau));
2650 LibmeshPetscCall(VecRestoreSubVector(b_vec, field_is[2], &b_w));
2651 // The shift changes the cross-momentum block in place. The field split uses that block itself
2652 // as its sub-operator, so the increased object state of the block makes the next solve
2653 // rebuild the split preconditioner; resetting the operators also marks the monolithic solver
2654 // for a new setup.
2655 LibmeshPetscCall(KSPSetOperators(ksp, A_nest, A_nest));
2656 }
2657 LibmeshPetscCall(VecDestroy(&Wij_iter));
2658 if (reason < 0)
2659 {
2660 PetscInt iterations;
2661 PetscReal residual_norm;
2662 LibmeshPetscCall(KSPGetIterationNumber(ksp, &iterations));
2663 LibmeshPetscCall(KSPGetResidualNorm(ksp, &residual_norm));
2664 mooseError(name(),
2665 ": monolithic linear solve failed: ",
2666 KSPConvergedReasons[reason],
2667 " (",
2668 static_cast<int>(reason),
2669 ") after ",
2670 iterations,
2671 " iterations; residual norm = ",
2672 residual_norm,
2673 ".");
2674 }
2675
2676 // destroy solver containers first
2677 LibmeshPetscCall(VecDestroy(&b_vec));
2678 LibmeshPetscCall(MatDestroy(&A_nest));
2679 LibmeshPetscCall(KSPDestroy(&ksp));
2680 for (PetscInt i = 0; i < Q * Q; i++)
2681 LibmeshPetscCall(MatDestroy(&mat_array[i]));
2682 for (PetscInt i = 0; i < Q; i++)
2683 LibmeshPetscCall(VecDestroy(&vec_array[i]));
2684 V("Solver elements destroyed");
2685
2686 // ====================== Extract & scatter the solution =====================
2687 Vec sol_mdot, sol_p, sol_Wij;
2688 V("Vectors to hold solution created");
2689 LibmeshPetscCall(VecDuplicate(_mc_axial_convection_rhs, &sol_mdot));
2690 LibmeshPetscCall(VecISCopy(x_vec, field_is[0], SCATTER_REVERSE, sol_mdot));
2691 LibmeshPetscCall(VecDuplicate(_amc_sys_mdot_rhs, &sol_p));
2692 LibmeshPetscCall(VecISCopy(x_vec, field_is[1], SCATTER_REVERSE, sol_p));
2693 LibmeshPetscCall(VecDuplicate(_cmc_sys_Wij_rhs, &sol_Wij));
2694 LibmeshPetscCall(VecISCopy(x_vec, field_is[2], SCATTER_REVERSE, sol_Wij));
2695 V("Solution from monolithic solver copied to solution vectors");
2696
2697 // Apply independent post-solve relaxation to the fixed-point solution update.
2698 auto relaxSolution = [&](Vec solution, Vec old_solution, const Real relaxation)
2699 {
2700 LibmeshPetscCall(VecScale(solution, relaxation));
2701 LibmeshPetscCall(VecAXPY(solution, 1.0 - relaxation, old_solution));
2702 };
2703 LibmeshPetscCall(populateVectorFromHandle<SolutionHandle>(
2704 _prod, *_mdot_soln, first_node, last_node, _n_channels));
2705 LibmeshPetscCall(populateVectorFromHandle<SolutionHandle>(
2706 _prodp, *_P_soln, first_node - 1, last_node - 1, _n_channels));
2707
2708 // Measure the pressure update before post-solve relaxation so changing that relaxation does
2709 // not change the meaning of the outer pressure tolerance.
2710 Vec pressure_residual;
2711 LibmeshPetscCall(VecDuplicate(sol_p, &pressure_residual));
2712 LibmeshPetscCall(VecCopy(sol_p, pressure_residual));
2713 LibmeshPetscCall(VecAXPY(pressure_residual, -1.0, _prodp));
2714
2715 const PetscScalar * residual_array;
2716 const PetscScalar * old_pressure_array;
2717 PetscInt pressure_size;
2718 LibmeshPetscCall(VecGetSize(pressure_residual, &pressure_size));
2719 LibmeshPetscCall(VecGetArrayRead(pressure_residual, &residual_array));
2720 LibmeshPetscCall(VecGetArrayRead(_prodp, &old_pressure_array));
2721 Real residual_norm_sq = 0.0;
2722 Real pressure_norm_sq = 0.0;
2723 for (PetscInt i = 0; i < pressure_size; ++i)
2724 {
2725 residual_norm_sq += Utility::pow<2>(residual_array[i]);
2726 pressure_norm_sq += Utility::pow<2>(old_pressure_array[i] + _P_out);
2727 }
2728 LibmeshPetscCall(VecRestoreArrayRead(pressure_residual, &residual_array));
2729 LibmeshPetscCall(VecRestoreArrayRead(_prodp, &old_pressure_array));
2730 LibmeshPetscCall(VecDestroy(&pressure_residual));
2733 std::sqrt(residual_norm_sq) / (std::sqrt(pressure_norm_sq) + 1e-14));
2734
2735 relaxSolution(sol_mdot, _prod, _mass_flow_relaxation);
2736 relaxSolution(sol_p, _prodp, _pressure_relaxation);
2738 _Wij_vec, _Wij, first_node, last_node, _n_gaps));
2739 relaxSolution(sol_Wij, _Wij_vec, _crossflow_relaxation);
2740
2741 // mass flow
2742 LibmeshPetscCall(populateSolutionChan<SolutionHandle>(
2743 sol_mdot, *_mdot_soln, first_node, last_node, _n_channels));
2744
2745 // pressure
2746 {
2747 PetscScalar * sol_p_array;
2748 LibmeshPetscCall(VecGetArray(sol_p, &sol_p_array));
2749 for (unsigned int iz = last_node; iz > first_node - 1; iz--)
2750 {
2751 const auto iz_ind = iz - first_node;
2752 for (unsigned int i_ch = 0; i_ch < _n_channels; i_ch++)
2753 {
2754 auto * node_in = _subchannel_mesh.getChannelNode(i_ch, iz - 1);
2755 PetscScalar value = sol_p_array[iz_ind * _n_channels + i_ch];
2756 _P_soln->set(node_in, value);
2757 }
2758 }
2759 LibmeshPetscCall(VecRestoreArray(sol_p, &sol_p_array));
2760 }
2761
2762 // crossflow dense + sumWij
2764 sol_Wij, _Wij, first_node, last_node, _n_gaps));
2765
2766 LibmeshPetscCall(MatMult(_mc_sumWij_mat, sol_Wij, _prod));
2767 LibmeshPetscCall(populateSolutionChan<SolutionHandle>(
2768 _prod, *_SumWij_soln, first_node, last_node, _n_channels));
2769
2770 V("Solutions assigned to MOOSE variables.");
2771
2772 // cleanup solution objects
2773 LibmeshPetscCall(VecDestroy(&x_vec));
2774 for (auto & is : field_is)
2775 LibmeshPetscCall(ISDestroy(&is));
2776 LibmeshPetscCall(VecDestroy(&sol_mdot));
2777 LibmeshPetscCall(VecDestroy(&sol_p));
2778 LibmeshPetscCall(VecDestroy(&sol_Wij));
2779 V("Solutions destroyed.");
2780
2781 PetscFunctionReturn(LIBMESH_PETSC_SUCCESS);
2782}
Real f(Real x)
Test function for Brents method.
void computeP(int iblock)
Computes Pressure per channel for block iblock.
const Real & _mass_flow_equation_relaxation
Equation relaxation factor for mass flow rate in the monolithic solve.
const Real & _pressure_equation_relaxation
Equation relaxation factor for pressure in the monolithic solve.
const PetscInt _monolithic_retry_maxit
Largest number of FGMRES iterations of a monolithic solve before it is retried with more damping.
static constexpr Real _max_crossflow_pseudo_time_step_reduction
Cap on the pseudo-time step reduction: the reduction one fully retried monolithic solve provides.
PetscErrorCode addCrossflowDamping(Mat M_ww, Mat M_wp, Vec b_w, Vec Wij_iter, int iblock, PetscScalar &inv_dtau)
Add the pseudo-time damping added_K_ij (Wij - Wij_iter) to the cross-momentum equation of the monolit...
static constexpr unsigned int _max_crossflow_retries
Number of monolithic linear-solve retries, each halving the crossflow pseudo-time step.
void computeDP(int iblock)
Computes Pressure Drop per channel for block iblock.
void computeWijResidual(int iblock)
Computes Residual Matrix based on the lateral momentum conservation equation for block iblock.
void computeSumWij(int iblock)
Computes net diversion crossflow per channel for block iblock.
const Real & _crossflow_relaxation
Relaxation factor for crossflow updates in the monolithic solve.
const bool _crossflow_pseudo_time_damping
Whether the crossflow of the monolithic solve is damped with a pseudo-time derivative.
void computeMdot(int iblock)
Computes mass flow per channel for block iblock.
const Real & _mass_flow_relaxation
Relaxation factor for mass flow rate updates in the monolithic solve.
const Real & _crossflow_equation_relaxation
Equation relaxation factor for crossflow in the monolithic solve.
const MooseEnum _monolithic_preconditioner
Preconditioner of the monolithic flow system.
const Real & _pressure_relaxation
Relaxation factor for pressure updates in the monolithic solve.
const PetscInt _monolithic_gmres_restart
Restart length of the FGMRES solver of the monolithic flow system.
auto min(const L &left, const R &right)
PetscErrorCode PetscInt const PetscInt IS * is

Referenced by SubChannel1PhaseProblem::externalSolve().

◆ initializeSolution()

void TriSubChannel1PhaseProblem::initializeSolution ( )
overrideprotectedvirtual

Function to initialize the solution & geometry fields.

Implements SubChannel1PhaseProblem.

Definition at line 70 of file TriSubChannel1PhaseProblem.C.

71{
73
74 if (_deformation)
75 {
76 // update surface area, wetted perimeter based on: Dpin, displacement
77 Real standard_area, wire_area, additional_area, wetted_perimeter, displaced_area;
78 auto flat_to_flat = _tri_sch_mesh.getFlatToFlat();
79 auto n_rings = _tri_sch_mesh.getNumOfRings();
80 auto pitch = _subchannel_mesh.getPitch();
81 auto pin_diameter = _subchannel_mesh.getPinDiameter();
82 auto wire_diameter = _tri_sch_mesh.getWireDiameter();
83 auto wire_lead_length = _tri_sch_mesh.getWireLeadLength();
84 auto gap = _tri_sch_mesh.getDuctToPinGap();
85 auto z_blockage = _subchannel_mesh.getZBlockage();
86 auto index_blockage = _subchannel_mesh.getIndexBlockage();
87 auto reduction_blockage = _subchannel_mesh.getReductionBlockage();
88 auto theta =
89 std::acos(wire_lead_length /
90 std::sqrt(Utility::pow<2>(wire_lead_length) +
91 Utility::pow<2>(libMesh::pi * (pin_diameter + wire_diameter))));
92 for (unsigned int iz = 0; iz < _n_cells + 1; iz++)
93 {
94 for (unsigned int i_ch = 0; i_ch < _n_channels; i_ch++)
95 {
96 auto subch_type = _subchannel_mesh.getSubchannelType(i_ch);
97 auto * node = _subchannel_mesh.getChannelNode(i_ch, iz);
98 auto Z = _z_grid[iz];
99 Real rod_area = 0.0;
100 Real rod_perimeter = 0.0;
101 for (auto i_pin : _subchannel_mesh.getChannelPins(i_ch))
102 {
103 auto * pin_node = _subchannel_mesh.getPinNode(i_pin, iz);
104 if (subch_type == EChannelType::CENTER || subch_type == EChannelType::CORNER)
105 {
106 rod_area +=
107 (1.0 / 6.0) * 0.25 * M_PI * (*_Dpin_soln)(pin_node) * (*_Dpin_soln)(pin_node);
108 rod_perimeter += (1.0 / 6.0) * M_PI * (*_Dpin_soln)(pin_node);
109 }
110 else
111 {
112 rod_area +=
113 (1.0 / 4.0) * 0.25 * M_PI * (*_Dpin_soln)(pin_node) * (*_Dpin_soln)(pin_node);
114 rod_perimeter += (1.0 / 4.0) * M_PI * (*_Dpin_soln)(pin_node);
115 }
116 }
117
118 if (subch_type == EChannelType::CENTER)
119 {
120 standard_area = Utility::pow<2>(pitch) * std::sqrt(3.0) / 4.0;
121 additional_area = 0.0;
122 displaced_area = 0.0;
123 wire_area = libMesh::pi * Utility::pow<2>(wire_diameter) / 8.0 / std::cos(theta);
124 wetted_perimeter = rod_perimeter + 0.5 * libMesh::pi * wire_diameter / std::cos(theta);
125 }
126 else if (subch_type == EChannelType::EDGE)
127 {
128 standard_area = pitch * (pin_diameter / 2.0 + gap);
129 additional_area = 0.0;
130 displaced_area = (*_displacement_soln)(node)*pitch;
131 wire_area = libMesh::pi * Utility::pow<2>(wire_diameter) / 8.0 / std::cos(theta);
132 wetted_perimeter =
133 rod_perimeter + 0.5 * libMesh::pi * wire_diameter / std::cos(theta) + pitch;
134 }
135 else
136 {
137 standard_area = 1.0 / std::sqrt(3.0) * Utility::pow<2>(pin_diameter / 2.0 + gap);
138 additional_area = 0.0;
139 displaced_area = 1.0 / std::sqrt(3.0) *
140 (pin_diameter + 2.0 * gap + (*_displacement_soln)(node)) *
141 (*_displacement_soln)(node);
142 wire_area = libMesh::pi / 24.0 * Utility::pow<2>(wire_diameter) / std::cos(theta);
143 wetted_perimeter =
144 rod_perimeter + libMesh::pi * wire_diameter / std::cos(theta) / 6.0 +
145 2.0 / std::sqrt(3.0) * (pin_diameter / 2.0 + gap + (*_displacement_soln)(node));
146 }
147
148 // Calculate subchannel area
149 auto subchannel_area =
150 standard_area + additional_area + displaced_area - rod_area - wire_area;
151
152 // Correct subchannel area and wetted perimeter in case of overlapping pins
153 auto overlapping_pin_area = 0.0;
154 auto overlapping_wetted_perimeter = 0.0;
155 for (auto i_gap : _subchannel_mesh.getChannelGaps(i_ch))
156 {
157 auto gap_pins = _subchannel_mesh.getGapPins(i_gap);
158 auto pin_1 = gap_pins.first;
159 auto pin_2 = gap_pins.second;
160 auto * pin_node_1 = _subchannel_mesh.getPinNode(pin_1, iz);
161 auto * pin_node_2 = _subchannel_mesh.getPinNode(pin_2, iz);
162 auto Diameter1 = (*_Dpin_soln)(pin_node_1);
163 auto Radius1 = Diameter1 / 2.0;
164 auto Diameter2 = (*_Dpin_soln)(pin_node_2);
165 auto Radius2 = Diameter2 / 2.0;
166 auto pitch = _subchannel_mesh.getPitch();
167
168 if (pitch < (Radius1 + Radius2)) // overlapping pins
169 {
170 mooseWarning(" The gap of index : '", i_gap, " at axial cell ", iz, " ' is blocked.");
171 auto cos1 =
172 (pitch * pitch + Radius1 * Radius1 - Radius2 * Radius2) / (2 * pitch * Radius1);
173 auto cos2 =
174 (pitch * pitch + Radius2 * Radius2 - Radius1 * Radius1) / (2 * pitch * Radius2);
175 auto angle1 = 2.0 * acos(cos1);
176 auto angle2 = 2.0 * acos(cos2);
177 // half of the intersecting arc-length
178 overlapping_wetted_perimeter += 0.5 * angle1 * Radius1 + 0.5 * angle2 * Radius2;
179 // Half of the overlapping area
180 overlapping_pin_area +=
181 0.5 * Radius1 * Radius1 * acos(cos1) + 0.5 * Radius2 * Radius2 * acos(cos2) -
182 0.25 * sqrt((-pitch + Radius1 + Radius2) * (pitch + Radius1 - Radius2) *
183 (pitch - Radius1 + Radius2) * (pitch + Radius1 + Radius2));
184 }
185 }
186 subchannel_area += overlapping_pin_area; // correct surface area
187 wetted_perimeter += -overlapping_wetted_perimeter; // correct wetted perimeter
188
189 // Apply area reduction on subchannels affected by blockage
190 auto index = 0;
191 for (const auto & i_blockage : index_blockage)
192 {
193 if (i_ch == i_blockage && (Z >= z_blockage.front() && Z <= z_blockage.back()))
194 {
195 subchannel_area *= reduction_blockage[index];
196 }
197 index++;
198 }
199 _S_flow_soln->set(node, subchannel_area);
200 _w_perim_soln->set(node, wetted_perimeter);
201 }
202 }
203 // update map of gap between pins (gij) based on: Dpin, displacement
204 for (unsigned int iz = 0; iz < _n_cells + 1; iz++)
205 {
206 for (unsigned int i_gap = 0; i_gap < _n_gaps; i_gap++)
207 {
208 auto gap_pins = _subchannel_mesh.getGapPins(i_gap);
209 auto pin_1 = gap_pins.first;
210 auto pin_2 = gap_pins.second;
211 auto * pin_node_1 = _subchannel_mesh.getPinNode(pin_1, iz);
212 auto * pin_node_2 = _subchannel_mesh.getPinNode(pin_2, iz);
213
214 if (pin_1 == pin_2) // Corner or edge gap
215 {
216 auto displacement = 0.0;
217 auto counter = 0.0;
218 for (auto i_ch : _subchannel_mesh.getPinChannels(pin_1))
219 {
220 auto subch_type = _subchannel_mesh.getSubchannelType(i_ch);
221 auto * node = _subchannel_mesh.getChannelNode(i_ch, iz);
222 if (subch_type == EChannelType::EDGE || subch_type == EChannelType::CORNER)
223 {
224 displacement += (*_displacement_soln)(node);
225 counter += 1.0;
226 }
227 }
228 displacement = displacement / counter;
230 i_gap,
231 0.5 * (flat_to_flat - (n_rings - 1) * pitch * std::sqrt(3.0) -
232 (*_Dpin_soln)(pin_node_1)) +
233 displacement);
234 }
235 else // center gap
236 {
238 iz, i_gap, pitch - (*_Dpin_soln)(pin_node_1) / 2.0 - (*_Dpin_soln)(pin_node_2) / 2.0);
239 }
240 // if pins come in contact, the gap is zero
241 if (_tri_sch_mesh.getGapWidth(iz, i_gap) <= 0.0)
242 _tri_sch_mesh.setGapWidth(iz, i_gap, 0.0);
243 }
244 }
245 }
246
247 for (unsigned int iz = 1; iz < _n_cells + 1; iz++)
248 {
249 for (unsigned int i_ch = 0; i_ch < _n_channels; i_ch++)
250 {
251 auto * node_out = _subchannel_mesh.getChannelNode(i_ch, iz);
252 auto * node_in = _subchannel_mesh.getChannelNode(i_ch, iz - 1);
253 _mdot_soln->set(node_out, (*_mdot_soln)(node_in));
254 }
255 }
256
257 // We must do a global assembly to make sure data is parallel consistent before we do things
258 // like compute L2 norms
259 _aux->solution().close();
260}
void detectDeformation()
Detects whether pin diameter or duct displacement fields require geometry recalculation.
virtual const std::vector< Real > & getZBlockage() const
Get axial location of blockage (in,out) [m].
virtual const std::vector< Real > & getReductionBlockage() const
Get area reduction of blocked subchannels.
virtual const std::pair< unsigned int, unsigned int > & getGapPins(unsigned int i_gap) const =0
Return a pair of pin indices for a given gap index.
virtual const std::vector< unsigned int > & getIndexBlockage() const
Get index of blocked subchannels.
const Real & getFlatToFlat() const
Return flat to flat [m].
void setGapWidth(unsigned int axial_index, unsigned int gap_index, Real gap_width)
Set the gap width for a given axial cell and gap index.
Real getGapWidth(unsigned int axial_index, unsigned int gap_index) const override
Return gap width for a given gap index.
const unsigned int & getNumOfRings() const
Return the number of fuel-pin rings, counting the center pin as the first ring.
CTSub CT_OPERATOR_BINARY CTMul CTCompareLess CTCompareGreater CTCompareEqual _arg template * sqrt(_arg)) *_arg.template D< dtag >()) CT_SIMPLE_UNARY_FUNCTION(tanh
const Real pi

◆ initialSetup()

void SubChannel1PhaseProblem::initialSetup ( )
overridevirtualinherited

Set value for turbulent momentum modeling parameter CT

Reimplemented from ExternalProblem.

Definition at line 431 of file SubChannel1PhaseProblem.C.

432{
433 // Create variables for output and storage. This comes before the base class setup, which runs
434 // the user objects executed on initial, such as SCMPinPowerPostprocessor, that read them.
435 _mdot_soln = std::make_unique<SolutionHandle>(getVariable(0, SubChannelApp::MASS_FLOW_RATE));
436 _SumWij_soln = std::make_unique<SolutionHandle>(getVariable(0, SubChannelApp::SUM_CROSSFLOW));
437 _P_soln = std::make_unique<SolutionHandle>(getVariable(0, SubChannelApp::PRESSURE));
438 if (getParam<bool>("full_output"))
439 {
440 _DP_soln = std::make_unique<SolutionHandle>(getVariable(0, SubChannelApp::PRESSURE_DROP));
441 _ff_soln = std::make_unique<SolutionHandle>(getVariable(0, SubChannelApp::FRICTION_FACTOR));
442 }
443 _h_soln = std::make_unique<SolutionHandle>(getVariable(0, SubChannelApp::ENTHALPY));
444 _T_soln = std::make_unique<SolutionHandle>(getVariable(0, SubChannelApp::TEMPERATURE));
445 if (_pin_mesh_exist)
446 {
447 _Tpin_soln = std::make_unique<SolutionHandle>(getVariable(0, SubChannelApp::PIN_TEMPERATURE));
448 _Dpin_soln = std::make_unique<SolutionHandle>(getVariable(0, SubChannelApp::PIN_DIAMETER));
449 _HTC_soln =
450 std::make_unique<SolutionHandle>(getVariable(0, SubChannelApp::HEAT_TRANSFER_COEFFICIENT));
451 }
452 _rho_soln = std::make_unique<SolutionHandle>(getVariable(0, SubChannelApp::DENSITY));
453 _mu_soln = std::make_unique<SolutionHandle>(getVariable(0, SubChannelApp::VISCOSITY));
454 _S_flow_soln = std::make_unique<SolutionHandle>(getVariable(0, SubChannelApp::SURFACE_AREA));
455 _w_perim_soln = std::make_unique<SolutionHandle>(getVariable(0, SubChannelApp::WETTED_PERIMETER));
456 _q_prime_soln = std::make_unique<SolutionHandle>(getVariable(0, SubChannelApp::LINEAR_HEAT_RATE));
458 std::make_unique<SolutionHandle>(getVariable(0, SubChannelApp::DISPLACEMENT));
460 {
462 std::make_unique<SolutionHandle>(getVariable(0, SubChannelApp::DUCT_HEAT_FLUX));
463 _Tduct_soln = std::make_unique<SolutionHandle>(getVariable(0, SubChannelApp::DUCT_TEMPERATURE));
464 }
465
467
468 _fp = &getUserObject<SinglePhaseFluidProperties>(getParam<UserObjectName>("fp"));
470 &getUserObject<SCMFrictionClosureBase>(getParam<UserObjectName>("friction_closure"));
472 &getUserObject<SCMMixingClosureBase>(getParam<UserObjectName>("mixing_closure"));
473
476
477 if (_pin_mesh_exist)
479 &getUserObject<SCMHTCClosureBase>(getParam<UserObjectName>("pin_HTC_closure"));
482 &getUserObject<SCMHTCClosureBase>(getParam<UserObjectName>("duct_HTC_closure"));
483}
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
void initialSetup() override
virtual Real getCT() const
Return the Turbulent modeling parameter.
std::unique_ptr< SolutionHandle > _duct_heat_flux_soln
std::unique_ptr< SolutionHandle > _q_prime_soln
static const std::string ENTHALPY
static const std::string DISPLACEMENT
static const std::string PRESSURE_DROP
static const std::string WETTED_PERIMETER
static const std::string PRESSURE
static const std::string DUCT_TEMPERATURE
static const std::string FRICTION_FACTOR
static const std::string MASS_FLOW_RATE
static const std::string SURFACE_AREA
static const std::string VISCOSITY
static const std::string DENSITY
static const std::string PIN_DIAMETER
static const std::string HEAT_TRANSFER_COEFFICIENT
static const std::string LINEAR_HEAT_RATE
static const std::string DUCT_HEAT_FLUX
static const std::string SUM_CROSSFLOW
static const std::string PIN_TEMPERATURE
static const std::string TEMPERATURE

◆ interpolateFaceValue()

PetscScalar SubChannel1PhaseProblem::interpolateFaceValue ( PetscScalar  topValue,
PetscScalar  botValue 
) const
inlineinherited

Interpolate a face value from its top and bottom nodes with the configured scheme.

Definition at line 114 of file SubChannel1PhaseProblem.h.

115 {
116 const PetscScalar alpha = computeInterpolationCoefficients();
117 return alpha * botValue + (1.0 - alpha) * topValue;
118 }

◆ isImplicit()

bool SubChannel1PhaseProblem::isImplicit ( ) const
inlineinherited

Whether the flow and enthalpy equations are solved implicitly.

Definition at line 111 of file SubChannel1PhaseProblem.h.

111{ return _implicit_bool; }

◆ petscSnesSolver()

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

Computes solution of nonlinear equation using snes and provided a residual in a formFunction.

Definition at line 2081 of file SubChannel1PhaseProblem.C.

2084{
2085 SNES snes;
2086 KSP ksp;
2087 PC pc;
2088 Vec x, r;
2089 PetscScalar * xx;
2090
2092 LibmeshPetscCall(SNESCreate(PETSC_COMM_SELF, &snes));
2093 LibmeshPetscCall(VecCreate(PETSC_COMM_SELF, &x));
2094 LibmeshPetscCall(VecSetSizes(x, PETSC_DECIDE, _block_size * _n_gaps));
2095 LibmeshPetscCall(VecSetFromOptions(x));
2096 LibmeshPetscCall(VecDuplicate(x, &r));
2097
2098#if PETSC_VERSION_LESS_THAN(3, 13, 0)
2099 LibmeshPetscCall(PetscOptionsSetValue(PETSC_NULL, "-snes_mf", PETSC_NULL));
2100#else
2101 LibmeshPetscCall(SNESSetUseMatrixFree(snes, PETSC_FALSE, PETSC_TRUE));
2102#endif
2103 Ctx ctx;
2104 ctx.iblock = iblock;
2105 ctx.schp = this;
2106 LibmeshPetscCall(SNESSetFunction(snes, r, formFunction, &ctx));
2107 LibmeshPetscCall(SNESGetKSP(snes, &ksp));
2108 LibmeshPetscCall(KSPGetPC(ksp, &pc));
2109 LibmeshPetscCall(PCSetType(pc, PCNONE));
2110 LibmeshPetscCall(KSPSetTolerances(ksp, _rtol, _atol, _dtol, _maxit));
2111 LibmeshPetscCall(SNESSetFromOptions(snes));
2112 LibmeshPetscCall(VecGetArray(x, &xx));
2113 for (unsigned int i = 0; i < _block_size * _n_gaps; i++)
2114 {
2115 xx[i] = solution(i);
2116 }
2117 LibmeshPetscCall(VecRestoreArray(x, &xx));
2118
2119 LibmeshPetscCall(SNESSolve(snes, NULL, x));
2120 // A diverged solve leaves x at its initial guess, which is then used as the crossflow of this
2121 // iteration. Report it rather than stopping, since the unpreconditioned linear solve can break
2122 // down near convergence
2123 SNESConvergedReason reason;
2124 LibmeshPetscCall(SNESGetConvergedReason(snes, &reason));
2125 if (reason < 0)
2126 {
2127 PetscInt iterations;
2128 PetscReal residual_norm;
2129 LibmeshPetscCall(SNESGetIterationNumber(snes, &iterations));
2130 LibmeshPetscCall(SNESGetFunctionNorm(snes, &residual_norm));
2131 mooseWarning("Crossflow nonlinear solve did not converge: ",
2132 SNESConvergedReasons[reason],
2133 " (",
2134 static_cast<int>(reason),
2135 ") after ",
2136 iterations,
2137 " iterations; residual norm = ",
2138 residual_norm,
2139 ". The crossflow of this iteration is not updated.");
2140 }
2141 LibmeshPetscCall(VecGetArray(x, &xx));
2142 for (unsigned int i = 0; i < _block_size * _n_gaps; i++)
2143 root(i) = xx[i];
2144
2145 LibmeshPetscCall(VecRestoreArray(x, &xx));
2146 LibmeshPetscCall(VecDestroy(&x));
2147 LibmeshPetscCall(VecDestroy(&r));
2148 LibmeshPetscCall(SNESDestroy(&snes));
2149 PetscFunctionReturn(LIBMESH_PETSC_SUCCESS);
2150}
const std::vector< double > x
friend PetscErrorCode formFunction(SNES snes, Vec x, Vec f, void *ctx)
This is the residual Vector function in a form compatible with the SNES PETC solvers.
void * ctx

Referenced by SubChannel1PhaseProblem::computeWijFromSolve().

◆ populateDenseFromVector()

template<class T >
PetscErrorCode SubChannel1PhaseProblem::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 517 of file SubChannel1PhaseProblem.h.

522{
523 PetscScalar * xx;
524
526 LibmeshPetscCall(VecGetArray(x, &xx));
527 for (unsigned int iz = first_axial_level; iz < last_axial_level + 1; iz++)
528 {
529 unsigned int iz_ind = iz - first_axial_level;
530 for (unsigned int i_l = 0; i_l < cross_dimension; i_l++)
531 {
532 loc_solution(i_l, iz) = xx[iz_ind * cross_dimension + i_l];
533 }
534 }
535 LibmeshPetscCall(VecRestoreArray(x, &xx));
536
537 PetscFunctionReturn(LIBMESH_PETSC_SUCCESS);
538}

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

◆ populateSolutionChan()

template<class T >
PetscErrorCode SubChannel1PhaseProblem::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 591 of file SubChannel1PhaseProblem.h.

596{
597 PetscScalar * xx;
599 LibmeshPetscCall(VecGetArray(x, &xx));
600 Node * loc_node;
601 for (unsigned int iz = first_axial_level; iz < last_axial_level + 1; iz++)
602 {
603 unsigned int iz_ind = iz - first_axial_level;
604 for (unsigned int i_l = 0; i_l < cross_dimension; i_l++)
605 {
606 loc_node = _subchannel_mesh.getChannelNode(i_l, iz);
607 loc_solution.set(loc_node, xx[iz_ind * cross_dimension + i_l]);
608 }
609 }
610 // Every VecGetArray needs a matching VecRestoreArray, which advances the object state of x so
611 // that cached values such as norms are recomputed, and for device vector types marks the host
612 // array as the current copy
613 LibmeshPetscCall(VecRestoreArray(x, &xx));
614 PetscFunctionReturn(LIBMESH_PETSC_SUCCESS);
615}

◆ populateVectorFromDense()

template<class T >
PetscErrorCode SubChannel1PhaseProblem::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 568 of file SubChannel1PhaseProblem.h.

573{
574 PetscScalar * xx;
576 LibmeshPetscCall(VecGetArray(x, &xx));
577 for (unsigned int iz = first_axial_level; iz < last_axial_level + 1; iz++)
578 {
579 unsigned int iz_ind = iz - first_axial_level;
580 for (unsigned int i_l = 0; i_l < cross_dimension; i_l++)
581 {
582 xx[iz_ind * cross_dimension + i_l] = loc_solution(i_l, iz);
583 }
584 }
585 LibmeshPetscCall(VecRestoreArray(x, &xx));
586 PetscFunctionReturn(LIBMESH_PETSC_SUCCESS);
587}

Referenced by SubChannel1PhaseProblem::computeSumWij(), SubChannel1PhaseProblem::computeWijResidual(), and SubChannel1PhaseProblem::implicitPetscSolve().

◆ populateVectorFromHandle()

template<class T >
PetscErrorCode SubChannel1PhaseProblem::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 542 of file SubChannel1PhaseProblem.h.

547{
548 PetscScalar * xx;
549
551 LibmeshPetscCall(VecGetArray(x, &xx));
552 for (unsigned int iz = first_axial_level; iz < last_axial_level + 1; iz++)
553 {
554 unsigned int iz_ind = iz - first_axial_level;
555 for (unsigned int i_l = 0; i_l < cross_dimension; i_l++)
556 {
557 auto * loc_node = _subchannel_mesh.getChannelNode(i_l, iz);
558 xx[iz_ind * cross_dimension + i_l] = loc_solution(loc_node);
559 }
560 }
561 LibmeshPetscCall(VecRestoreArray(x, &xx));
562
563 PetscFunctionReturn(LIBMESH_PETSC_SUCCESS);
564}

◆ residualFunction()

libMesh::DenseVector< Real > SubChannel1PhaseProblem::residualFunction ( int  iblock,
libMesh::DenseVector< Real >  solution 
)
protectedinherited

Computes Residual Vector based on the lateral momentum conservation equation for block iblock & updates flow variables based on current crossflow solution.

Definition at line 2039 of file SubChannel1PhaseProblem.C.

2040{
2041 const unsigned int last_node = (iblock + 1) * _block_size;
2042 const unsigned int first_node = iblock * _block_size + 1;
2043 libMesh::DenseVector<Real> Wij_residual_vector(_n_gaps * _block_size, 0.0);
2044 // Assign the solution to the cross-flow matrix
2045 int i = 0;
2046 for (unsigned int iz = first_node; iz < last_node + 1; iz++)
2047 {
2048 for (unsigned int i_gap = 0; i_gap < _n_gaps; i_gap++)
2049 {
2050 _Wij(i_gap, iz) = solution(i);
2051 i++;
2052 }
2053 }
2054
2055 // Calculating sum of crossflows
2056 computeSumWij(iblock);
2057 // Solving axial flux
2058 computeMdot(iblock);
2059 // Calculation of turbulent Crossflow
2060 computeWijPrime(iblock);
2061 // Solving for Pressure Drop
2062 computeDP(iblock);
2063 // Solving for pressure
2064 computeP(iblock);
2065 // Populating lateral crossflow residual matrix
2066 computeWijResidual(iblock);
2067
2068 // Turn the residual matrix into a residual vector
2069 for (unsigned int iz = 0; iz < _block_size; iz++)
2070 {
2071 for (unsigned int i_gap = 0; i_gap < _n_gaps; i_gap++)
2072 {
2073 int i = _n_gaps * iz + i_gap; // column wise transfer
2074 Wij_residual_vector(i) = _Wij_residual_matrix(i_gap, iz);
2075 }
2076 }
2077 return Wij_residual_vector;
2078}

◆ shiftCrossflowDamping()

PetscErrorCode SubChannel1PhaseProblem::shiftCrossflowDamping ( Mat  M_ww,
Vec  b_w,
Vec  Wij_iter,
PetscScalar  inv_dtau 
)
protectedinherited

Add the damping of the inverse pseudo-time step inv_dtau to the cross-momentum equation: inv_dtau L_ij S_ij rho* on the diagonal of M_ww and inv_dtau L_ij S_ij rho* Wij_iter on b_w.

Definition at line 2256 of file SubChannel1PhaseProblem.C.

2260{
2262 // damping = added_K_ij = L_ij S_ij rho* / dtau, the crossflow inertia of each gap of the block
2263 // over the pseudo-time step
2264 Vec damping;
2265 LibmeshPetscCall(VecDuplicate(_cmc_pseudo_time_inertia, &damping));
2266 LibmeshPetscCall(VecCopy(_cmc_pseudo_time_inertia, damping));
2267 LibmeshPetscCall(VecScale(damping, inv_dtau));
2268 // M_ww diagonal += added_K_ij, which damps the crossflow the monolithic solve computes
2269 LibmeshPetscCall(MatDiagonalSet(M_ww, damping, ADD_VALUES));
2270 // b_w += added_K_ij Wij_iter, the compensation that makes the term vanish at Wij = Wij_iter. The
2271 // damping vector is no longer needed, so it holds the right-hand-side contribution.
2272 LibmeshPetscCall(VecPointwiseMult(damping, damping, Wij_iter));
2273 LibmeshPetscCall(VecAXPY(b_w, 1.0, damping));
2274 LibmeshPetscCall(VecDestroy(&damping));
2275 PetscFunctionReturn(LIBMESH_PETSC_SUCCESS);
2276}

Referenced by SubChannel1PhaseProblem::addCrossflowDamping(), and SubChannel1PhaseProblem::implicitPetscSolve().

◆ solveAndPopulateEnthalpy()

PetscErrorCode SubChannel1PhaseProblem::solveAndPopulateEnthalpy ( Mat  A,
Vec  rhs,
unsigned int  first_node,
unsigned int  last_node,
const char *  ksp_prefix 
)
protectedinherited

Solve a linear system (A * x = rhs) with a simple PCJACOBI KSP and populate the enthalpy solution into _h_soln for nodes [first_node, last_node].

Uses member tolerances (_rtol, _atol, _dtol, _maxit), mesh (_subchannel_mesh), channel count (_n_channels), and error/solution handles (mooseError, _h_soln).

Parameters
APETSc matrix (operators)
rhsPETSc vector (right-hand side)
first_nodeinclusive start axial node index
last_nodeinclusive end axial node index
ksp_prefixoptions prefix for KSP (e.g. "h_sys_"), may be nullptr

Definition at line 2153 of file SubChannel1PhaseProblem.C.

2155{
2157
2158 // Create solution vector with rhs layout
2159 Vec x = nullptr;
2160 LibmeshPetscCall(VecDuplicate(rhs, &x));
2161
2162 // KSP setup
2163 KSP ksp = nullptr;
2164 PC pc = nullptr;
2165 LibmeshPetscCall(KSPCreate(PETSC_COMM_SELF, &ksp));
2166 LibmeshPetscCall(KSPSetOperators(ksp, A, A));
2167 LibmeshPetscCall(KSPGetPC(ksp, &pc));
2168 LibmeshPetscCall(PCSetType(pc, PCJACOBI));
2169 LibmeshPetscCall(KSPSetTolerances(ksp, _rtol, _atol, _dtol, _maxit));
2170 if (ksp_prefix && *ksp_prefix)
2171 LibmeshPetscCall(KSPSetOptionsPrefix(ksp, ksp_prefix));
2172 LibmeshPetscCall(KSPSetFromOptions(ksp));
2173 // Allocate all GMRES Krylov vectors in one block. PETSc batches the dot products of Krylov
2174 // vectors that are adjacent in memory, so with separately allocated vectors the summation order,
2175 // and hence the result, depends on where the heap places them and can vary between runs.
2176 LibmeshPetscCall(KSPGMRESSetPreAllocateVectors(ksp));
2177
2178 // Solve
2179 LibmeshPetscCall(KSPSolve(ksp, rhs, x));
2180 KSPConvergedReason reason;
2181 LibmeshPetscCall(KSPGetConvergedReason(ksp, &reason));
2182 if (reason < 0)
2183 {
2184 PetscInt iterations;
2185 PetscReal residual_norm;
2186 LibmeshPetscCall(KSPGetIterationNumber(ksp, &iterations));
2187 LibmeshPetscCall(KSPGetResidualNorm(ksp, &residual_norm));
2188 mooseError(name(),
2189 ": enthalpy linear solve failed: ",
2190 KSPConvergedReasons[reason],
2191 " (",
2192 static_cast<int>(reason),
2193 ") after ",
2194 iterations,
2195 " iterations; residual norm = ",
2196 residual_norm,
2197 ".");
2198 }
2199
2200 // Scatter to _h_soln with sanity checks
2201 PetscScalar * xx = nullptr;
2202 LibmeshPetscCall(VecGetArray(x, &xx));
2203 for (unsigned int iz = first_node; iz <= last_node; ++iz)
2204 {
2205 const unsigned int iz_ind = iz - first_node;
2206 for (unsigned int i_ch = 0; i_ch < _n_channels; ++i_ch)
2207 {
2208 auto * node_out = _subchannel_mesh.getChannelNode(i_ch, iz);
2209 const PetscScalar h_out = xx[iz_ind * _n_channels + i_ch];
2210 if (h_out < 0.0)
2211 mooseError(
2212 name(), " : Calculation of negative Enthalpy h_out = ", h_out, " Axial Level = ", iz);
2213 _h_soln->set(node_out, h_out);
2214 }
2215 }
2216 LibmeshPetscCall(VecRestoreArray(x, &xx));
2217
2218 // Cleanup
2219 LibmeshPetscCall(KSPDestroy(&ksp));
2220 LibmeshPetscCall(VecDestroy(&x));
2221
2222 PetscFunctionReturn(LIBMESH_PETSC_SUCCESS);
2223}

Referenced by QuadSubChannel1PhaseProblem::computeh(), and computeh().

◆ solverSystemConverged()

bool SubChannel1PhaseProblem::solverSystemConverged ( const unsigned int  )
overridevirtualinherited

Reimplemented from ExternalProblem.

Definition at line 644 of file SubChannel1PhaseProblem.C.

645{
646 return _converged;
647}

◆ syncSolutions()

void SubChannel1PhaseProblem::syncSolutions ( Direction  direction)
overridevirtualinherited

Implements ExternalProblem.

Definition at line 3133 of file SubChannel1PhaseProblem.C.

3134{
3135}

◆ validParams()

InputParameters TriSubChannel1PhaseProblem::validParams ( )
static

Definition at line 24 of file TriSubChannel1PhaseProblem.C.

25{
27 params.addClassDescription("Solver class for subchannels in a triangular lattice assembly and "
28 "bare/wire-wrapped fuel pins");
29 return params;
30}
void addClassDescription(const std::string &doc_string)
static InputParameters validParams()

Member Data Documentation

◆ _amc_advective_derivative_mat

Mat SubChannel1PhaseProblem::_amc_advective_derivative_mat
protectedinherited

Axial momentum conservation - advective (Eulerian) derivative.

Definition at line 440 of file SubChannel1PhaseProblem.h.

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

◆ _amc_advective_derivative_rhs

Vec SubChannel1PhaseProblem::_amc_advective_derivative_rhs
protectedinherited

◆ _amc_cross_derivative_mat

Mat SubChannel1PhaseProblem::_amc_cross_derivative_mat
protectedinherited

Axial momentum conservation - cross flux derivative.

Definition at line 443 of file SubChannel1PhaseProblem.h.

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

◆ _amc_cross_derivative_rhs

Vec SubChannel1PhaseProblem::_amc_cross_derivative_rhs
protectedinherited

◆ _amc_friction_force_mat

Mat SubChannel1PhaseProblem::_amc_friction_force_mat
protectedinherited

Axial momentum conservation - friction force.

Definition at line 446 of file SubChannel1PhaseProblem.h.

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

◆ _amc_friction_force_rhs

Vec SubChannel1PhaseProblem::_amc_friction_force_rhs
protectedinherited

◆ _amc_gravity_rhs

Vec SubChannel1PhaseProblem::_amc_gravity_rhs
protectedinherited

Axial momentum conservation - buoyancy force No implicit matrix.

Definition at line 450 of file SubChannel1PhaseProblem.h.

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

◆ _amc_pressure_force_mat

Mat SubChannel1PhaseProblem::_amc_pressure_force_mat
protectedinherited

◆ _amc_pressure_force_rhs

Vec SubChannel1PhaseProblem::_amc_pressure_force_rhs
protectedinherited

◆ _amc_sys_mdot_mat

Mat SubChannel1PhaseProblem::_amc_sys_mdot_mat
protectedinherited

◆ _amc_sys_mdot_pattern_set

bool SubChannel1PhaseProblem::_amc_sys_mdot_pattern_set = false
protectedinherited

Whether the nonzero patterns of the assembled system matrices have been established.

Definition at line 495 of file SubChannel1PhaseProblem.h.

Referenced by SubChannel1PhaseProblem::computeDP().

◆ _amc_sys_mdot_rhs

Vec SubChannel1PhaseProblem::_amc_sys_mdot_rhs
protectedinherited

◆ _amc_time_derivative_mat

Mat SubChannel1PhaseProblem::_amc_time_derivative_mat
protectedinherited

Axial momentum conservation - time derivative.

Definition at line 437 of file SubChannel1PhaseProblem.h.

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

◆ _amc_time_derivative_rhs

Vec SubChannel1PhaseProblem::_amc_time_derivative_rhs
protectedinherited

◆ _amc_turbulent_cross_flows_mat

Mat SubChannel1PhaseProblem::_amc_turbulent_cross_flows_mat
protectedinherited

Axial momentum Axial momentum conservation - compute turbulent cross fluxes.

Definition at line 434 of file SubChannel1PhaseProblem.h.

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

◆ _amc_turbulent_cross_flows_rhs

Vec SubChannel1PhaseProblem::_amc_turbulent_cross_flows_rhs
protectedinherited

◆ _atol

const PetscReal& SubChannel1PhaseProblem::_atol
protectedinherited

◆ _block_size

unsigned int SubChannel1PhaseProblem::_block_size
protectedinherited

◆ _bulk_Re

Real SubChannel1PhaseProblem::_bulk_Re
protectedinherited

◆ _bulk_V

Real SubChannel1PhaseProblem::_bulk_V
protectedinherited

◆ _cmc_advective_derivative_mat

Mat SubChannel1PhaseProblem::_cmc_advective_derivative_mat
protectedinherited

Cross momentum conservation - advective (Eulerian) derivative.

Definition at line 463 of file SubChannel1PhaseProblem.h.

Referenced by SubChannel1PhaseProblem::cleanUp(), SubChannel1PhaseProblem::computeWijResidual(), and SubChannel1PhaseProblem::SubChannel1PhaseProblem().

◆ _cmc_advective_derivative_rhs

Vec SubChannel1PhaseProblem::_cmc_advective_derivative_rhs
protectedinherited

◆ _cmc_friction_force_mat

Mat SubChannel1PhaseProblem::_cmc_friction_force_mat
protectedinherited

◆ _cmc_friction_force_rhs

Vec SubChannel1PhaseProblem::_cmc_friction_force_rhs
protectedinherited

◆ _cmc_pressure_force_mat

Mat SubChannel1PhaseProblem::_cmc_pressure_force_mat
protectedinherited

◆ _cmc_pressure_force_rhs

Vec SubChannel1PhaseProblem::_cmc_pressure_force_rhs
protectedinherited

◆ _cmc_pseudo_time_inertia

Vec SubChannel1PhaseProblem::_cmc_pseudo_time_inertia
protectedinherited

Crossflow inertia L_ij S_ij rho* of each gap of the block, the coefficient of the pseudo-time derivative of the crossflow damping.

Definition at line 467 of file SubChannel1PhaseProblem.h.

Referenced by SubChannel1PhaseProblem::cleanUp(), SubChannel1PhaseProblem::computeWijResidual(), SubChannel1PhaseProblem::shiftCrossflowDamping(), and SubChannel1PhaseProblem::SubChannel1PhaseProblem().

◆ _cmc_sys_Wij_mat

Mat SubChannel1PhaseProblem::_cmc_sys_Wij_mat
protectedinherited

◆ _cmc_sys_Wij_pattern_set

bool SubChannel1PhaseProblem::_cmc_sys_Wij_pattern_set = false
protectedinherited

◆ _cmc_sys_Wij_rhs

Vec SubChannel1PhaseProblem::_cmc_sys_Wij_rhs
protectedinherited

◆ _cmc_time_derivative_mat

Mat SubChannel1PhaseProblem::_cmc_time_derivative_mat
protectedinherited

Cross momentum Cross momentum conservation - time derivative.

Definition at line 460 of file SubChannel1PhaseProblem.h.

Referenced by SubChannel1PhaseProblem::cleanUp(), SubChannel1PhaseProblem::computeWijResidual(), and SubChannel1PhaseProblem::SubChannel1PhaseProblem().

◆ _cmc_time_derivative_rhs

Vec SubChannel1PhaseProblem::_cmc_time_derivative_rhs
protectedinherited

◆ _compute_density

const bool SubChannel1PhaseProblem::_compute_density
protectedinherited

Flag that activates or deactivates the calculation of density.

Definition at line 268 of file SubChannel1PhaseProblem.h.

Referenced by SubChannel1PhaseProblem::computeMdot(), and SubChannel1PhaseProblem::externalSolve().

◆ _compute_power

const bool SubChannel1PhaseProblem::_compute_power
protectedinherited

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

Definition at line 272 of file SubChannel1PhaseProblem.h.

Referenced by SubChannel1PhaseProblem::computeMdot(), and SubChannel1PhaseProblem::externalSolve().

◆ _compute_viscosity

const bool SubChannel1PhaseProblem::_compute_viscosity
protectedinherited

Flag that activates or deactivates the calculation of viscosity.

Definition at line 270 of file SubChannel1PhaseProblem.h.

Referenced by SubChannel1PhaseProblem::externalSolve().

◆ _converged

bool SubChannel1PhaseProblem::_converged
protectedinherited

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

Definition at line 278 of file SubChannel1PhaseProblem.h.

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

◆ _crossflow_equation_relaxation

const Real& SubChannel1PhaseProblem::_crossflow_equation_relaxation
protectedinherited

Equation relaxation factor for crossflow in the monolithic solve.

Definition at line 306 of file SubChannel1PhaseProblem.h.

Referenced by SubChannel1PhaseProblem::implicitPetscSolve().

◆ _crossflow_pseudo_time_damping

const bool SubChannel1PhaseProblem::_crossflow_pseudo_time_damping
protectedinherited

Whether the crossflow of the monolithic solve is damped with a pseudo-time derivative.

Definition at line 328 of file SubChannel1PhaseProblem.h.

Referenced by SubChannel1PhaseProblem::implicitPetscSolve(), and SubChannel1PhaseProblem::SubChannel1PhaseProblem().

◆ _crossflow_pseudo_time_step

const Real& SubChannel1PhaseProblem::_crossflow_pseudo_time_step
protectedinherited

Initial pseudo-time step of the crossflow damping.

Definition at line 326 of file SubChannel1PhaseProblem.h.

Referenced by SubChannel1PhaseProblem::addCrossflowDamping(), and SubChannel1PhaseProblem::implicitPetscSolve().

◆ _crossflow_pseudo_time_step_reduction

std::vector<Real> SubChannel1PhaseProblem::_crossflow_pseudo_time_step_reduction
protectedinherited

Per-block factor, raised after monolithic linear-solve failures, that divides the crossflow pseudo-time step and so delays its growth.

Definition at line 505 of file SubChannel1PhaseProblem.h.

Referenced by SubChannel1PhaseProblem::addCrossflowDamping(), SubChannel1PhaseProblem::externalSolve(), and SubChannel1PhaseProblem::implicitPetscSolve().

◆ _crossflow_relaxation

const Real& SubChannel1PhaseProblem::_crossflow_relaxation
protectedinherited

Relaxation factor for crossflow updates in the monolithic solve.

Definition at line 312 of file SubChannel1PhaseProblem.h.

Referenced by SubChannel1PhaseProblem::implicitPetscSolve().

◆ _crossflow_residual_ref

std::vector<Real> SubChannel1PhaseProblem::_crossflow_residual_ref
protectedinherited

Per-block largest cross-momentum residual norm of the solve, which scales the crossflow damping in the monolithic solve.

Definition at line 502 of file SubChannel1PhaseProblem.h.

Referenced by SubChannel1PhaseProblem::addCrossflowDamping(), and SubChannel1PhaseProblem::externalSolve().

◆ _CT

Real SubChannel1PhaseProblem::_CT
protectedinherited

Turbulent modeling parameter used in axial momentum equation.

Definition at line 288 of file SubChannel1PhaseProblem.h.

Referenced by SubChannel1PhaseProblem::computeDP(), and SubChannel1PhaseProblem::initialSetup().

◆ _deformation

bool SubChannel1PhaseProblem::_deformation = false
protectedinherited

Flag that activates the effect of deformation (pin/duct) based on the auxvalues for displacement, Dpin.

Definition at line 343 of file SubChannel1PhaseProblem.h.

Referenced by SubChannel1PhaseProblem::detectDeformation(), QuadSubChannel1PhaseProblem::initializeSolution(), and initializeSolution().

◆ _dir_grav

const Real SubChannel1PhaseProblem::_dir_grav
protectedinherited

Definition at line 335 of file SubChannel1PhaseProblem.h.

Referenced by SubChannel1PhaseProblem::computeDP().

◆ _displacement_soln

std::unique_ptr<SolutionHandle> SubChannel1PhaseProblem::_displacement_soln
protectedinherited

◆ _DP

libMesh::DenseMatrix<Real> SubChannel1PhaseProblem::_DP
protectedinherited

◆ _DP_soln

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

◆ _Dpin_soln

std::unique_ptr<SolutionHandle> SubChannel1PhaseProblem::_Dpin_soln
protectedinherited

◆ _dt

Real SubChannel1PhaseProblem::_dt
protectedinherited

◆ _dtol

const PetscReal& SubChannel1PhaseProblem::_dtol
protectedinherited

◆ _duct_heat_flux_soln

std::unique_ptr<SolutionHandle> SubChannel1PhaseProblem::_duct_heat_flux_soln
protectedinherited

Definition at line 366 of file SubChannel1PhaseProblem.h.

Referenced by SubChannel1PhaseProblem::initialSetup().

◆ _duct_HTC_closure

const SCMHTCClosureBase* SubChannel1PhaseProblem::_duct_HTC_closure
protectedinherited

◆ _duct_mesh_exist

const bool SubChannel1PhaseProblem::_duct_mesh_exist
protectedinherited

◆ _enthalpy_subcycles

const unsigned int& SubChannel1PhaseProblem::_enthalpy_subcycles
protectedinherited

Number of enthalpy, temperature, and property updates performed per flow solve.

Definition at line 300 of file SubChannel1PhaseProblem.h.

Referenced by SubChannel1PhaseProblem::externalSolve().

◆ _ff_soln

std::unique_ptr<SolutionHandle> SubChannel1PhaseProblem::_ff_soln
protectedinherited

◆ _fp

const SinglePhaseFluidProperties* SubChannel1PhaseProblem::_fp
inherited

◆ _friction_args

struct SubChannel1PhaseProblem::FrictionStruct SubChannel1PhaseProblem::_friction_args
inherited

◆ _friction_closure

const SCMFrictionClosureBase* SubChannel1PhaseProblem::_friction_closure
protectedinherited

◆ _g_grav

const Real SubChannel1PhaseProblem::_g_grav
protectedinherited

Definition at line 255 of file SubChannel1PhaseProblem.h.

Referenced by SubChannel1PhaseProblem::computeDP().

◆ _gravity_direction

const MooseEnum SubChannel1PhaseProblem::_gravity_direction
protectedinherited

The direction of gravity.

Definition at line 334 of file SubChannel1PhaseProblem.h.

◆ _h_soln

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

◆ _hc_added_heat_rhs

Vec SubChannel1PhaseProblem::_hc_added_heat_rhs
protectedinherited

◆ _hc_advective_derivative_mat

Mat SubChannel1PhaseProblem::_hc_advective_derivative_mat
protectedinherited

Enthalpy conservation - advective (Eulerian) derivative;.

Definition at line 483 of file SubChannel1PhaseProblem.h.

Referenced by SubChannel1PhaseProblem::cleanUp(), QuadSubChannel1PhaseProblem::computeh(), computeh(), and SubChannel1PhaseProblem::SubChannel1PhaseProblem().

◆ _hc_advective_derivative_rhs

Vec SubChannel1PhaseProblem::_hc_advective_derivative_rhs
protectedinherited

◆ _hc_axial_heat_conduction_mat

Mat TriSubChannel1PhaseProblem::_hc_axial_heat_conduction_mat
protected

Definition at line 34 of file TriSubChannel1PhaseProblem.h.

Referenced by cleanUp(), computeh(), and TriSubChannel1PhaseProblem().

◆ _hc_axial_heat_conduction_rhs

Vec TriSubChannel1PhaseProblem::_hc_axial_heat_conduction_rhs
protected

Definition at line 35 of file TriSubChannel1PhaseProblem.h.

Referenced by cleanUp(), computeh(), and TriSubChannel1PhaseProblem().

◆ _hc_cross_derivative_mat

Mat SubChannel1PhaseProblem::_hc_cross_derivative_mat
protectedinherited

◆ _hc_cross_derivative_rhs

Vec SubChannel1PhaseProblem::_hc_cross_derivative_rhs
protectedinherited

◆ _hc_radial_heat_conduction_mat

Mat TriSubChannel1PhaseProblem::_hc_radial_heat_conduction_mat
protected

Definition at line 36 of file TriSubChannel1PhaseProblem.h.

Referenced by cleanUp(), computeh(), and TriSubChannel1PhaseProblem().

◆ _hc_radial_heat_conduction_rhs

Vec TriSubChannel1PhaseProblem::_hc_radial_heat_conduction_rhs
protected

Definition at line 37 of file TriSubChannel1PhaseProblem.h.

Referenced by cleanUp(), computeh(), and TriSubChannel1PhaseProblem().

◆ _hc_sweep_enthalpy_mat

Mat TriSubChannel1PhaseProblem::_hc_sweep_enthalpy_mat
protected

Definition at line 38 of file TriSubChannel1PhaseProblem.h.

Referenced by cleanUp(), computeh(), and TriSubChannel1PhaseProblem().

◆ _hc_sweep_enthalpy_rhs

Vec TriSubChannel1PhaseProblem::_hc_sweep_enthalpy_rhs
protected

Definition at line 39 of file TriSubChannel1PhaseProblem.h.

Referenced by cleanUp(), computeh(), and TriSubChannel1PhaseProblem().

◆ _hc_sys_h_mat

Mat SubChannel1PhaseProblem::_hc_sys_h_mat
protectedinherited

◆ _hc_sys_h_pattern_set

bool SubChannel1PhaseProblem::_hc_sys_h_pattern_set = false
protectedinherited

Definition at line 497 of file SubChannel1PhaseProblem.h.

Referenced by QuadSubChannel1PhaseProblem::computeh(), and computeh().

◆ _hc_sys_h_rhs

Vec SubChannel1PhaseProblem::_hc_sys_h_rhs
protectedinherited

◆ _hc_time_derivative_mat

Mat SubChannel1PhaseProblem::_hc_time_derivative_mat
protectedinherited

◆ _hc_time_derivative_rhs

Vec SubChannel1PhaseProblem::_hc_time_derivative_rhs
protectedinherited

◆ _HTC_soln

std::unique_ptr<SolutionHandle> SubChannel1PhaseProblem::_HTC_soln
protectedinherited

◆ _implicit_bool

const bool SubChannel1PhaseProblem::_implicit_bool
protectedinherited

◆ _interpolation_scheme

const MooseEnum SubChannel1PhaseProblem::_interpolation_scheme
protectedinherited

The interpolation method used in constructing the systems.

Definition at line 332 of file SubChannel1PhaseProblem.h.

Referenced by SubChannel1PhaseProblem::computeDP(), QuadSubChannel1PhaseProblem::computeh(), computeh(), and SubChannel1PhaseProblem::computeInterpolationCoefficients().

◆ _kij

const Real& SubChannel1PhaseProblem::_kij
protectedinherited

◆ _mass_flow_equation_relaxation

const Real& SubChannel1PhaseProblem::_mass_flow_equation_relaxation
protectedinherited

Equation relaxation factor for mass flow rate in the monolithic solve.

Definition at line 302 of file SubChannel1PhaseProblem.h.

Referenced by SubChannel1PhaseProblem::implicitPetscSolve().

◆ _mass_flow_relaxation

const Real& SubChannel1PhaseProblem::_mass_flow_relaxation
protectedinherited

Relaxation factor for mass flow rate updates in the monolithic solve.

Definition at line 308 of file SubChannel1PhaseProblem.h.

Referenced by SubChannel1PhaseProblem::implicitPetscSolve().

◆ _max_crossflow_pseudo_time_step_reduction

constexpr Real SubChannel1PhaseProblem::_max_crossflow_pseudo_time_step_reduction = 1 << _max_crossflow_retries
staticconstexprprotectedinherited

Cap on the pseudo-time step reduction: the reduction one fully retried monolithic solve provides.

Definition at line 509 of file SubChannel1PhaseProblem.h.

Referenced by SubChannel1PhaseProblem::implicitPetscSolve().

◆ _max_crossflow_retries

constexpr unsigned int SubChannel1PhaseProblem::_max_crossflow_retries = 8
staticconstexprprotectedinherited

Number of monolithic linear-solve retries, each halving the crossflow pseudo-time step.

Definition at line 507 of file SubChannel1PhaseProblem.h.

Referenced by SubChannel1PhaseProblem::implicitPetscSolve().

◆ _maxit

const PetscInt SubChannel1PhaseProblem::_maxit
protectedinherited

◆ _mc_axial_convection_mat

Mat SubChannel1PhaseProblem::_mc_axial_convection_mat
protectedinherited

◆ _mc_axial_convection_rhs

Vec SubChannel1PhaseProblem::_mc_axial_convection_rhs
protectedinherited

◆ _mc_density_pressure_mat

Mat SubChannel1PhaseProblem::_mc_density_pressure_mat
protectedinherited

◆ _mc_sumWij_mat

Mat SubChannel1PhaseProblem::_mc_sumWij_mat
protectedinherited

Matrices and vectors to be used in implicit assembly Mass conservation Mass conservation - sum of cross fluxes.

Definition at line 422 of file SubChannel1PhaseProblem.h.

Referenced by SubChannel1PhaseProblem::cleanUp(), SubChannel1PhaseProblem::computeSumWij(), SubChannel1PhaseProblem::implicitPetscSolve(), and SubChannel1PhaseProblem::SubChannel1PhaseProblem().

◆ _mdot_soln

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

◆ _mixing_closure

const SCMMixingClosureBase* SubChannel1PhaseProblem::_mixing_closure
protectedinherited

◆ _monolithic_gmres_restart

const PetscInt SubChannel1PhaseProblem::_monolithic_gmres_restart
protectedinherited

Restart length of the FGMRES solver of the monolithic flow system.

Definition at line 322 of file SubChannel1PhaseProblem.h.

Referenced by SubChannel1PhaseProblem::implicitPetscSolve().

◆ _monolithic_preconditioner

const MooseEnum SubChannel1PhaseProblem::_monolithic_preconditioner
protectedinherited

Preconditioner of the monolithic flow system.

Definition at line 330 of file SubChannel1PhaseProblem.h.

Referenced by SubChannel1PhaseProblem::implicitPetscSolve().

◆ _monolithic_retry_maxit

const PetscInt SubChannel1PhaseProblem::_monolithic_retry_maxit
protectedinherited

Largest number of FGMRES iterations of a monolithic solve before it is retried with more damping.

Definition at line 324 of file SubChannel1PhaseProblem.h.

Referenced by SubChannel1PhaseProblem::implicitPetscSolve().

◆ _mu_soln

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

◆ _n_blocks

unsigned int SubChannel1PhaseProblem::_n_blocks
protectedinherited

◆ _n_cells

unsigned int SubChannel1PhaseProblem::_n_cells
protectedinherited

◆ _n_channels

unsigned int SubChannel1PhaseProblem::_n_channels
protectedinherited

◆ _n_gaps

unsigned int SubChannel1PhaseProblem::_n_gaps
protectedinherited

◆ _n_pins

unsigned int SubChannel1PhaseProblem::_n_pins
protectedinherited

◆ _nusselt_args

struct SubChannel1PhaseProblem::NusseltStruct SubChannel1PhaseProblem::_nusselt_args
inherited

◆ _one

Real SubChannel1PhaseProblem::_one
protectedinherited

Definition at line 264 of file SubChannel1PhaseProblem.h.

Referenced by SubChannel1PhaseProblem::externalSolve().

◆ _P_maxit

const int& SubChannel1PhaseProblem::_P_maxit
protectedinherited

Maximum number of pressure iterations; zero selects the solver's existing automatic limit.

Definition at line 292 of file SubChannel1PhaseProblem.h.

Referenced by SubChannel1PhaseProblem::externalSolve().

◆ _P_out

const PostprocessorValue& SubChannel1PhaseProblem::_P_out
inherited

◆ _P_soln

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

◆ _P_tol

const Real& SubChannel1PhaseProblem::_P_tol
protectedinherited

Convergence tolerance for the pressure loop in external solve.

Definition at line 290 of file SubChannel1PhaseProblem.h.

Referenced by SubChannel1PhaseProblem::externalSolve().

◆ _pin_HTC_closure

const SCMHTCClosureBase* SubChannel1PhaseProblem::_pin_HTC_closure
protectedinherited

◆ _pin_mesh_exist

const bool SubChannel1PhaseProblem::_pin_mesh_exist
protectedinherited

◆ _pressure_equation_relaxation

const Real& SubChannel1PhaseProblem::_pressure_equation_relaxation
protectedinherited

Equation relaxation factor for pressure in the monolithic solve.

Definition at line 304 of file SubChannel1PhaseProblem.h.

Referenced by SubChannel1PhaseProblem::implicitPetscSolve().

◆ _pressure_fixed_point_error

Real SubChannel1PhaseProblem::_pressure_fixed_point_error = 1.0
protectedinherited

Maximum pressure fixed-point update before solution relaxation over the blocks.

Definition at line 499 of file SubChannel1PhaseProblem.h.

Referenced by SubChannel1PhaseProblem::externalSolve(), and SubChannel1PhaseProblem::implicitPetscSolve().

◆ _pressure_relaxation

const Real& SubChannel1PhaseProblem::_pressure_relaxation
protectedinherited

Relaxation factor for pressure updates in the monolithic solve.

Definition at line 310 of file SubChannel1PhaseProblem.h.

Referenced by SubChannel1PhaseProblem::implicitPetscSolve().

◆ _prod

Vec SubChannel1PhaseProblem::_prod
protectedinherited

◆ _prodp

Vec SubChannel1PhaseProblem::_prodp
protectedinherited

◆ _q_prime_soln

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

Definition at line 365 of file SubChannel1PhaseProblem.h.

Referenced by SubChannel1PhaseProblem::initialSetup().

◆ _rho_soln

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

◆ _rtol

const PetscReal& SubChannel1PhaseProblem::_rtol
protectedinherited

◆ _S_flow_soln

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

◆ _segregated_bool

const bool SubChannel1PhaseProblem::_segregated_bool
protectedinherited

◆ _subchannel_mesh

SubChannelMesh& SubChannel1PhaseProblem::_subchannel_mesh
protectedinherited

◆ _SumWij_soln

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

◆ _T_maxit

const int& SubChannel1PhaseProblem::_T_maxit
protectedinherited

Maximum iterations for the inner temperature loop.

Definition at line 296 of file SubChannel1PhaseProblem.h.

Referenced by SubChannel1PhaseProblem::externalSolve().

◆ _T_relaxation

const Real& SubChannel1PhaseProblem::_T_relaxation
protectedinherited

Relaxation factor for temperature updates in the inner thermal-hydraulic iteration.

Definition at line 298 of file SubChannel1PhaseProblem.h.

Referenced by SubChannel1PhaseProblem::computeT().

◆ _T_soln

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

◆ _T_tol

const Real& SubChannel1PhaseProblem::_T_tol
protectedinherited

Convergence tolerance for the temperature loop in internal solve.

Definition at line 294 of file SubChannel1PhaseProblem.h.

Referenced by SubChannel1PhaseProblem::externalSolve().

◆ _Tduct_soln

std::unique_ptr<SolutionHandle> SubChannel1PhaseProblem::_Tduct_soln
protectedinherited

◆ _time_integrator_checked

bool SubChannel1PhaseProblem::_time_integrator_checked = false
protectedinherited

Whether the time integrator has been checked for consistency with the implementation.

Definition at line 284 of file SubChannel1PhaseProblem.h.

Referenced by SubChannel1PhaseProblem::externalSolve().

◆ _Tpin_soln

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

◆ _TR

Real SubChannel1PhaseProblem::_TR
protectedinherited

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

Definition at line 266 of file SubChannel1PhaseProblem.h.

Referenced by SubChannel1PhaseProblem::computeDP(), QuadSubChannel1PhaseProblem::computeh(), computeh(), SubChannel1PhaseProblem::computeMdot(), SubChannel1PhaseProblem::computeWijResidual(), and SubChannel1PhaseProblem::externalSolve().

◆ _tri_sch_mesh

TriSubChannelMesh& TriSubChannel1PhaseProblem::_tri_sch_mesh
protected

◆ _verbose_subchannel

const bool SubChannel1PhaseProblem::_verbose_subchannel
protectedinherited

◆ _w_perim_soln

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

◆ _Wij

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

◆ _Wij_old

libMesh::DenseMatrix<Real>& SubChannel1PhaseProblem::_Wij_old
protectedinherited

◆ _Wij_residual_matrix

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

◆ _Wij_vec

Vec SubChannel1PhaseProblem::_Wij_vec
protectedinherited

◆ _WijPrime

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

◆ _z_grid

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

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