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 | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
QuadSubChannel1PhaseProblem Class Referenceabstract

Quadrilateral subchannel solver. More...

#include <QuadSubChannel1PhaseProblem.h>

Inheritance diagram for QuadSubChannel1PhaseProblem:
[legend]

Public Types

enum  Direction
 
enum  CoverageCheckMode
 
typedef DataFileName DataFileParameterType
 

Public Member Functions

 QuadSubChannel1PhaseProblem (const InputParameters &params)
 
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.
 
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)
 
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
 
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.
 
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.
 
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)
 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 cleanUp ()
 
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 checkDisplacementOrders ()
 
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

QuadSubChannelMesh & _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 coupled implicit solve.
 
const Real & _pressure_equation_relaxation
 Equation relaxation factor for pressure in the coupled implicit solve.
 
const Real & _crossflow_equation_relaxation
 Equation relaxation factor for crossflow in the coupled implicit solve.
 
const Real & _mass_flow_relaxation
 Relaxation factor for mass flow rate updates in the coupled implicit solve.
 
const Real & _pressure_relaxation
 Relaxation factor for pressure updates in the coupled implicit solve.
 
const Real & _crossflow_relaxation
 Relaxation factor for crossflow updates in the coupled implicit 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 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 _staggered_pressure_bool
 Flag to define the usage of staggered or collocated pressure.
 
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
 
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
 
PetscScalar _added_K = 0.0
 Added resistances for monolithic convergence.
 
PetscScalar _added_K_old = 1000.0
 
PetscScalar _max_sumWij
 
PetscScalar _max_sumWij_new
 
PetscScalar _correction_factor = 1.0
 
Real _pressure_fixed_point_error = 1.0
 Maximum pressure fixed-point update before solution relaxation over the blocks.
 
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 _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 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
 

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 handleException (const std::string &calling_method)
 
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
 
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

Quadrilateral subchannel solver.

Definition at line 18 of file QuadSubChannel1PhaseProblem.h.

Constructor & Destructor Documentation

◆ QuadSubChannel1PhaseProblem()

QuadSubChannel1PhaseProblem::QuadSubChannel1PhaseProblem ( const InputParameters &  params)

Definition at line 26 of file QuadSubChannel1PhaseProblem.C.

27 : SubChannel1PhaseProblem(params), _subchannel_mesh(SCM::getMesh<QuadSubChannelMesh>(_mesh))
28{
29}
MooseMesh & _mesh
Base class for the 1-phase steady-state/transient subchannel solver.

Member Function Documentation

◆ cleanUp()

PetscErrorCode SubChannel1PhaseProblem::cleanUp ( )
protectedinherited

Definition at line 496 of file SubChannel1PhaseProblem.C.

497{
499 // We need to clean up the petsc matrices/vectors
500 // Mass conservation components
501 LibmeshPetscCall(MatDestroy(&_mc_sumWij_mat));
502 LibmeshPetscCall(VecDestroy(&_Wij_vec));
503 LibmeshPetscCall(VecDestroy(&_prod));
504 LibmeshPetscCall(VecDestroy(&_prodp));
505 LibmeshPetscCall(MatDestroy(&_mc_axial_convection_mat));
506 LibmeshPetscCall(VecDestroy(&_mc_axial_convection_rhs));
507 LibmeshPetscCall(MatDestroy(&_mc_density_pressure_mat));
508
509 // Axial momentum conservation components
510 LibmeshPetscCall(MatDestroy(&_amc_turbulent_cross_flows_mat));
511 LibmeshPetscCall(VecDestroy(&_amc_turbulent_cross_flows_rhs));
512 LibmeshPetscCall(MatDestroy(&_amc_time_derivative_mat));
513 LibmeshPetscCall(VecDestroy(&_amc_time_derivative_rhs));
514 LibmeshPetscCall(MatDestroy(&_amc_advective_derivative_mat));
515 LibmeshPetscCall(VecDestroy(&_amc_advective_derivative_rhs));
516 LibmeshPetscCall(MatDestroy(&_amc_cross_derivative_mat));
517 LibmeshPetscCall(VecDestroy(&_amc_cross_derivative_rhs));
518 LibmeshPetscCall(MatDestroy(&_amc_friction_force_mat));
519 LibmeshPetscCall(VecDestroy(&_amc_friction_force_rhs));
520 LibmeshPetscCall(VecDestroy(&_amc_gravity_rhs));
521 LibmeshPetscCall(MatDestroy(&_amc_pressure_force_mat));
522 LibmeshPetscCall(VecDestroy(&_amc_pressure_force_rhs));
523 LibmeshPetscCall(MatDestroy(&_amc_sys_mdot_mat));
524 LibmeshPetscCall(VecDestroy(&_amc_sys_mdot_rhs));
525
526 // Lateral momentum conservation components
527 LibmeshPetscCall(MatDestroy(&_cmc_time_derivative_mat));
528 LibmeshPetscCall(VecDestroy(&_cmc_time_derivative_rhs));
529 LibmeshPetscCall(MatDestroy(&_cmc_advective_derivative_mat));
530 LibmeshPetscCall(VecDestroy(&_cmc_advective_derivative_rhs));
531 LibmeshPetscCall(MatDestroy(&_cmc_friction_force_mat));
532 LibmeshPetscCall(VecDestroy(&_cmc_friction_force_rhs));
533 LibmeshPetscCall(MatDestroy(&_cmc_pressure_force_mat));
534 LibmeshPetscCall(VecDestroy(&_cmc_pressure_force_rhs));
535 LibmeshPetscCall(MatDestroy(&_cmc_sys_Wij_mat));
536 LibmeshPetscCall(VecDestroy(&_cmc_sys_Wij_rhs));
537
538 // Energy conservation components
539 LibmeshPetscCall(MatDestroy(&_hc_time_derivative_mat));
540 LibmeshPetscCall(VecDestroy(&_hc_time_derivative_rhs));
541 LibmeshPetscCall(MatDestroy(&_hc_advective_derivative_mat));
542 LibmeshPetscCall(VecDestroy(&_hc_advective_derivative_rhs));
543 LibmeshPetscCall(MatDestroy(&_hc_cross_derivative_mat));
544 LibmeshPetscCall(VecDestroy(&_hc_cross_derivative_rhs));
545 LibmeshPetscCall(VecDestroy(&_hc_added_heat_rhs));
546 LibmeshPetscCall(MatDestroy(&_hc_sys_h_mat));
547 LibmeshPetscCall(VecDestroy(&_hc_sys_h_rhs));
548
549 PetscFunctionReturn(LIBMESH_PETSC_SUCCESS);
550}
PetscFunctionBegin
Mat _cmc_friction_force_mat
Cross momentum conservation - friction force.
Mat _hc_time_derivative_mat
Enthalpy Enthalpy conservation - time derivative.
Mat _cmc_time_derivative_mat
Cross momentum Cross momentum conservation - time derivative.
Mat _amc_turbulent_cross_flows_mat
Axial momentum Axial momentum conservation - compute turbulent cross fluxes.
Mat _amc_sys_mdot_mat
Axial momentum system matrix.
Mat _cmc_sys_Wij_mat
Lateral momentum system matrix.
Mat _mc_sumWij_mat
Matrices and vectors to be used in implicit assembly Mass conservation Mass conservation - sum of cro...
Mat _cmc_pressure_force_mat
Cross momentum conservation - pressure force.
Mat _amc_time_derivative_mat
Axial momentum conservation - time derivative.
Mat _cmc_advective_derivative_mat
Cross momentum conservation - advective (Eulerian) derivative.
Vec _hc_added_heat_rhs
Enthalpy conservation - source and sink.
Mat _amc_friction_force_mat
Axial momentum conservation - friction force.
Mat _mc_density_pressure_mat
Mass conservation - pressure derivative of transient density.
Mat _hc_advective_derivative_mat
Enthalpy conservation - advective (Eulerian) derivative;.
Mat _amc_pressure_force_mat
Axial momentum conservation - pressure force.
Mat _amc_cross_derivative_mat
Axial momentum conservation - cross flux derivative.
Vec _amc_gravity_rhs
Axial momentum conservation - buoyancy force No implicit matrix.
Mat _mc_axial_convection_mat
Mass conservation - axial convection.
Mat _amc_advective_derivative_mat
Axial momentum conservation - advective (Eulerian) derivative.
Mat _hc_cross_derivative_mat
Enthalpy conservation - cross flux derivative.
PetscFunctionReturn(LIBMESH_PETSC_SUCCESS)

Referenced by SubChannel1PhaseProblem::~SubChannel1PhaseProblem().

◆ 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 2246 of file SubChannel1PhaseProblem.C.

2247{
2248 mooseAssert(iz > 0, "Trapezoidal rule requires starting at index 1 at least");
2249 if (_duct_mesh_exist)
2250 {
2251 auto subch_type = _subchannel_mesh.getSubchannelType(i_ch);
2252 if (subch_type == EChannelType::EDGE || subch_type == EChannelType::CORNER)
2253 {
2254 auto dz = _z_grid[iz] - _z_grid[iz - 1];
2255 auto * node_in_chan = _subchannel_mesh.getChannelNode(i_ch, iz - 1);
2256 auto * node_out_chan = _subchannel_mesh.getChannelNode(i_ch, iz);
2257 auto * node_in_duct = _subchannel_mesh.getDuctNodeFromChannel(node_in_chan);
2258 auto * node_out_duct = _subchannel_mesh.getDuctNodeFromChannel(node_out_chan);
2259 auto heat_rate_in = (*_duct_heat_flux_soln)(node_in_duct);
2260 auto heat_rate_out = (*_duct_heat_flux_soln)(node_out_duct);
2261 auto width = getSubChannelPeripheralDuctWidth(i_ch);
2262 return 0.5 * (heat_rate_in + heat_rate_out) * dz * width;
2263 }
2264 else
2265 {
2266 return 0.0;
2267 }
2268 }
2269 else
2270 {
2271 return 0.0;
2272 }
2273}
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 TriSubChannel1PhaseProblem::computeh(), and SubChannel1PhaseProblem::getAddedHeatDuct().

◆ computeAddedHeatPin()

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

Pure virtual: daughters provide different implementations.

Implements SubChannel1PhaseProblem.

Definition at line 197 of file QuadSubChannel1PhaseProblem.C.

198{
199 if (!_pin_mesh_exist)
200 return 0.0;
201
202 // Compute axial location of nodes.
203 auto z2 = _z_grid[iz];
204 auto z1 = _z_grid[iz - 1];
205 auto heated_length = _subchannel_mesh.getHeatedLength();
206 auto unheated_length_entry = _subchannel_mesh.getHeatedLengthEntry();
207 if (MooseUtils::absoluteFuzzyGreaterThan(z2, unheated_length_entry) &&
208 MooseUtils::absoluteFuzzyLessThan(z1, unheated_length_entry + heated_length))
209 {
210 // Compute the height of this element.
211 auto dz = z2 - z1;
212 auto heat_rate_in = 0.0;
213 auto heat_rate_out = 0.0;
214 for (auto i_pin : _subchannel_mesh.getChannelPins(i_ch))
215 {
216 auto * node_in = _subchannel_mesh.getPinNode(i_pin, iz - 1);
217 auto * node_out = _subchannel_mesh.getPinNode(i_pin, iz);
218 heat_rate_out += 0.25 * (*_q_prime_soln)(node_out);
219 heat_rate_in += 0.25 * (*_q_prime_soln)(node_in);
220 }
221 return (heat_rate_in + heat_rate_out) * dz / 2.0;
222 }
223 else
224 return 0.0;
225}
Node * getPinNode(unsigned int i_pin, unsigned int iz) const override
Get the pin mesh node for a given pin index and elevation index.
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.

Referenced by computeh().

◆ computeBulkReynoldsNumber()

void SubChannel1PhaseProblem::computeBulkReynoldsNumber ( )
protectedinherited

Computes the assembly bulk Reynolds number from inlet flow conditions.

Definition at line 419 of file SubChannel1PhaseProblem.C.

420{
421 if (processor_id() == 0)
422 {
423 Real viscosity_in = 0.0;
424 Real volumetric_flow_in = 0.0;
425 Real mass_flow_in = 0.0;
426 for (const auto i_ch : make_range(_n_channels))
427 {
428 auto * node_in = _subchannel_mesh.getChannelNode(i_ch, 0);
429 const Real mdot_in = (*_mdot_soln)(node_in);
430 const Real rho_in = (*_rho_soln)(node_in);
431 viscosity_in += mdot_in * (*_mu_soln)(node_in);
432 volumetric_flow_in += mdot_in / rho_in;
433 mass_flow_in += mdot_in;
434 }
436 const Real flow_area = _subchannel_mesh.getAssemblyFlowArea();
437 const Real inlet_mu = viscosity_in / mass_flow_in;
438 _bulk_Re = mass_flow_in * bulk_Dh / (inlet_mu * flow_area);
439 _bulk_V = volumetric_flow_in / flow_area;
440 }
441 // Only rank 0 owns the subchannel DOFs (SingleRankPartitioner), so share the result
444
445 if (MooseUtils::absoluteFuzzyEqual(_bulk_Re, 0.0))
446 mooseError("The computed bulk Reynolds number is zero.");
447
448 if (MooseUtils::absoluteFuzzyEqual(_bulk_V, 0.0))
449 mooseError("The computed bulk velocity is zero.");
450
452}
void mooseError(Args &&... args) const
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
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
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

Cross derivative term

Friction term

Upwind local form loss

Gravity force

Assembling system

Definition at line 830 of file SubChannel1PhaseProblem.C.

831{
832 const unsigned int last_node = (iblock + 1) * _block_size;
833 const unsigned int first_node = iblock * _block_size + 1;
834 if (!_implicit_bool)
835 {
836 for (unsigned int iz = first_node; iz < last_node + 1; iz++)
837 {
838 auto k_grid = _subchannel_mesh.getKGrid();
839 auto dz = _z_grid[iz] - _z_grid[iz - 1];
840 for (unsigned int i_ch = 0; i_ch < _n_channels; i_ch++)
841 {
842 auto * node_in = _subchannel_mesh.getChannelNode(i_ch, iz - 1);
843 auto * node_out = _subchannel_mesh.getChannelNode(i_ch, iz);
844 auto rho_in = (*_rho_soln)(node_in);
845 auto rho_out = (*_rho_soln)(node_out);
846 auto mu_in = (*_mu_soln)(node_in);
847 auto S = (*_S_flow_soln)(node_in);
848 auto w_perim = (*_w_perim_soln)(node_in);
849 // hydraulic diameter in the i direction
850 auto Dh_i = 4.0 * S / w_perim;
851 auto time_term = _TR * ((*_mdot_soln)(node_out)-_mdot_soln->old(node_out)) * dz / _dt -
852 dz * 2.0 * (*_mdot_soln)(node_out) * (rho_out - _rho_soln->old(node_out)) /
853 rho_in / _dt;
854 auto mass_term1 =
855 Utility::pow<2>((*_mdot_soln)(node_out)) * (1.0 / S / rho_out - 1.0 / S / rho_in);
856 auto mass_term2 = -2.0 * (*_mdot_soln)(node_out) * (*_SumWij_soln)(node_out) / S / rho_in;
857 auto crossflow_term = 0.0;
858 auto turbulent_term = 0.0;
859 unsigned int counter = 0;
860 for (auto i_gap : _subchannel_mesh.getChannelGaps(i_ch))
861 {
862 auto chans = _subchannel_mesh.getGapChannels(i_gap);
863 unsigned int ii_ch = chans.first;
864 unsigned int jj_ch = chans.second;
865 auto * node_in_i = _subchannel_mesh.getChannelNode(ii_ch, iz - 1);
866 auto * node_in_j = _subchannel_mesh.getChannelNode(jj_ch, iz - 1);
867 auto * node_out_i = _subchannel_mesh.getChannelNode(ii_ch, iz);
868 auto * node_out_j = _subchannel_mesh.getChannelNode(jj_ch, iz);
869 auto rho_i = (*_rho_soln)(node_in_i);
870 auto rho_j = (*_rho_soln)(node_in_j);
871 auto Si = (*_S_flow_soln)(node_in_i);
872 auto Sj = (*_S_flow_soln)(node_in_j);
873 Real u_star = 0.0;
874 // figure out donor axial velocity
875 if (_Wij(i_gap, iz) > 0.0)
876 u_star = (*_mdot_soln)(node_out_i) / Si / rho_i;
877 else
878 u_star = (*_mdot_soln)(node_out_j) / Sj / rho_j;
879
880 crossflow_term +=
881 _subchannel_mesh.getCrossflowSign(i_ch, counter) * _Wij(i_gap, iz) * u_star;
882
883 turbulent_term += _WijPrime(i_gap, iz) * (2 * (*_mdot_soln)(node_out) / rho_in / S -
884 (*_mdot_soln)(node_out_j) / Sj / rho_j -
885 (*_mdot_soln)(node_out_i) / Si / rho_i);
886 counter++;
887 }
888 turbulent_term *= _CT;
889 auto Re = (((*_mdot_soln)(node_in) / S) * Dh_i / mu_in);
890 _friction_args = FrictionStruct(i_ch, Re, S, w_perim);
892 if (_ff_soln)
893 _ff_soln->set(node_out, ff);
895 auto ki = 0.0;
896 if ((*_mdot_soln)(node_out) >= 0)
897 ki = k_grid[i_ch][iz - 1];
898 else
899 ki = k_grid[i_ch][iz];
900 auto friction_term = (ff * dz / Dh_i + ki) * 0.5 *
901 (*_mdot_soln)(node_out)*std::abs((*_mdot_soln)(node_out)) /
902 (S * (*_rho_soln)(node_out));
903 auto gravity_term = _dir_grav * _g_grav * (*_rho_soln)(node_out)*dz * S;
904 auto DP = (1 / S) * (time_term + mass_term1 + mass_term2 + crossflow_term + turbulent_term +
905 friction_term + gravity_term); // Pa
906 _DP(i_ch, iz) = DP;
907 if (_DP_soln)
908 _DP_soln->set(node_out, DP);
909 }
910 }
911 }
912 else
913 {
914 LibmeshPetscCall(MatZeroEntries(_amc_time_derivative_mat));
915 LibmeshPetscCall(MatZeroEntries(_amc_advective_derivative_mat));
916 LibmeshPetscCall(MatZeroEntries(_amc_cross_derivative_mat));
917 LibmeshPetscCall(MatZeroEntries(_amc_friction_force_mat));
918 LibmeshPetscCall(VecZeroEntries(_amc_time_derivative_rhs));
919 LibmeshPetscCall(VecZeroEntries(_amc_advective_derivative_rhs));
920 LibmeshPetscCall(VecZeroEntries(_amc_cross_derivative_rhs));
921 LibmeshPetscCall(VecZeroEntries(_amc_friction_force_rhs));
922 LibmeshPetscCall(VecZeroEntries(_amc_gravity_rhs));
923 LibmeshPetscCall(MatZeroEntries(_amc_sys_mdot_mat));
924 LibmeshPetscCall(VecZeroEntries(_amc_sys_mdot_rhs));
925 for (unsigned int iz = first_node; iz < last_node + 1; iz++)
926 {
927 auto k_grid = _subchannel_mesh.getKGrid();
928 auto dz = _z_grid[iz] - _z_grid[iz - 1];
929 auto iz_ind = iz - first_node;
930 for (unsigned int i_ch = 0; i_ch < _n_channels; i_ch++)
931 {
932 // inlet and outlet nodes
933 auto * node_in = _subchannel_mesh.getChannelNode(i_ch, iz - 1);
934 auto * node_out = _subchannel_mesh.getChannelNode(i_ch, iz);
935
936 // interpolation weight coefficient
937 PetscScalar Pe = 0.5;
938 if (_interpolation_scheme == 3)
939 {
940 // Compute the Peclet number
941 auto S_in = (*_S_flow_soln)(node_in);
942 auto S_out = (*_S_flow_soln)(node_out);
943 auto S_interp = computeInterpolatedValue(S_out, S_in, 0.5);
944 auto w_perim_in = (*_w_perim_soln)(node_in);
945 auto w_perim_out = (*_w_perim_soln)(node_out);
946 auto w_perim_interp = this->computeInterpolatedValue(w_perim_out, w_perim_in, 0.5);
947 auto mdot_loc =
948 this->computeInterpolatedValue((*_mdot_soln)(node_out), (*_mdot_soln)(node_in), 0.5);
949 auto mu_in = (*_mu_soln)(node_in);
950 auto mu_out = (*_mu_soln)(node_out);
951 auto mu_interp = this->computeInterpolatedValue(mu_out, mu_in, 0.5);
952 auto Dh_i = 4.0 * S_interp / w_perim_interp;
953 // Compute friction factor
954 auto Re = ((mdot_loc / S_interp) * Dh_i / mu_interp);
955 _friction_args = FrictionStruct(i_ch, Re, S_interp, w_perim_interp);
957 if (_ff_soln)
958 _ff_soln->set(node_out, ff);
960 auto ki = 0.0;
961 if ((*_mdot_soln)(node_out) >= 0)
962 ki = k_grid[i_ch][iz - 1];
963 else
964 ki = k_grid[i_ch][iz];
965 Pe = 1.0 / ((ff * dz / Dh_i + ki) * 0.5) * mdot_loc / std::abs(mdot_loc);
966 }
967 auto alpha = computeInterpolationCoefficients(Pe);
968
969 // inlet, outlet, and interpolated density
970 auto rho_in = (*_rho_soln)(node_in);
971 auto rho_out = (*_rho_soln)(node_out);
972 auto rho_interp = computeInterpolatedValue(rho_out, rho_in, Pe);
973
974 // inlet, outlet, and interpolated viscosity
975 auto mu_in = (*_mu_soln)(node_in);
976 auto mu_out = (*_mu_soln)(node_out);
977 auto mu_interp = computeInterpolatedValue(mu_out, mu_in, Pe);
978
979 // inlet, outlet, and interpolated axial surface area
980 auto S_in = (*_S_flow_soln)(node_in);
981 auto S_out = (*_S_flow_soln)(node_out);
982 auto S_interp = computeInterpolatedValue(S_out, S_in, Pe);
983
984 // inlet, outlet, and interpolated wetted perimeter
985 auto w_perim_in = (*_w_perim_soln)(node_in);
986 auto w_perim_out = (*_w_perim_soln)(node_out);
987 auto w_perim_interp = computeInterpolatedValue(w_perim_out, w_perim_in, Pe);
988
989 // hydraulic diameter in the i direction
990 auto Dh_i = 4.0 * S_interp / w_perim_interp;
991
992 // Keep temporal storage independent of the spatial interpolation scheme. Applying the
993 // upwind coefficient to this term puts the storage on the upstream node and leaves the
994 // first axial row without transient inertia in the upwind limit.
995 PetscInt row_tt = i_ch + _n_channels * iz_ind;
996 PetscInt col_tt = i_ch + _n_channels * iz_ind;
997 PetscScalar value_tt = _TR * dz / _dt;
998 LibmeshPetscCall(MatSetValues(
999 _amc_time_derivative_mat, 1, &row_tt, 1, &col_tt, &value_tt, INSERT_VALUES));
1000
1001 PetscScalar value_vec_tt = _TR * _mdot_soln->old(node_out) * dz / _dt;
1002 PetscInt row_vec_tt = i_ch + _n_channels * iz_ind;
1003 LibmeshPetscCall(
1004 VecSetValues(_amc_time_derivative_rhs, 1, &row_vec_tt, &value_vec_tt, ADD_VALUES));
1005
1007 if (iz == first_node)
1008 {
1009 PetscScalar value_vec_at = Utility::pow<2>((*_mdot_soln)(node_in)) / (S_in * rho_in);
1010 PetscInt row_vec_at = i_ch + _n_channels * iz_ind;
1011 LibmeshPetscCall(VecSetValues(
1012 _amc_advective_derivative_rhs, 1, &row_vec_at, &value_vec_at, ADD_VALUES));
1013 }
1014 else
1015 {
1016 PetscInt row_at = i_ch + _n_channels * iz_ind;
1017 PetscInt col_at = i_ch + _n_channels * (iz_ind - 1);
1018 PetscScalar value_at = -1.0 * std::abs((*_mdot_soln)(node_in)) / (S_in * rho_in);
1019 LibmeshPetscCall(MatSetValues(
1020 _amc_advective_derivative_mat, 1, &row_at, 1, &col_at, &value_at, INSERT_VALUES));
1021 }
1022
1023 // Adding diagonal elements
1024 PetscInt row_at = i_ch + _n_channels * iz_ind;
1025 PetscInt col_at = i_ch + _n_channels * iz_ind;
1026 PetscScalar value_at = std::abs((*_mdot_soln)(node_out)) / (S_out * rho_out);
1027 LibmeshPetscCall(MatSetValues(
1028 _amc_advective_derivative_mat, 1, &row_at, 1, &col_at, &value_at, INSERT_VALUES));
1029
1031 unsigned int counter = 0;
1032 unsigned int cross_index = iz; // iz-1;
1033 for (auto i_gap : _subchannel_mesh.getChannelGaps(i_ch))
1034 {
1035 auto chans = _subchannel_mesh.getGapChannels(i_gap);
1036 unsigned int ii_ch = chans.first;
1037 unsigned int jj_ch = chans.second;
1038 auto * node_in_i = _subchannel_mesh.getChannelNode(ii_ch, iz - 1);
1039 auto * node_in_j = _subchannel_mesh.getChannelNode(jj_ch, iz - 1);
1040 auto * node_out_i = _subchannel_mesh.getChannelNode(ii_ch, iz);
1041 auto * node_out_j = _subchannel_mesh.getChannelNode(jj_ch, iz);
1042 auto rho_i =
1043 computeInterpolatedValue((*_rho_soln)(node_out_i), (*_rho_soln)(node_in_i), Pe);
1044 auto rho_j =
1045 computeInterpolatedValue((*_rho_soln)(node_out_j), (*_rho_soln)(node_in_j), Pe);
1046 auto S_i =
1047 computeInterpolatedValue((*_S_flow_soln)(node_out_i), (*_S_flow_soln)(node_in_i), Pe);
1048 auto S_j =
1049 computeInterpolatedValue((*_S_flow_soln)(node_out_j), (*_S_flow_soln)(node_in_j), Pe);
1050 auto u_star = 0.0;
1051 // figure out donor axial velocity
1052 if (_Wij(i_gap, cross_index) > 0.0)
1053 {
1054 if (iz == first_node)
1055 {
1056 u_star = (*_mdot_soln)(node_in_i) / S_i / rho_i;
1057 PetscScalar value_vec_ct = -1.0 * alpha *
1058 _subchannel_mesh.getCrossflowSign(i_ch, counter) *
1059 _Wij(i_gap, cross_index) * u_star;
1060 PetscInt row_vec_ct = i_ch + _n_channels * iz_ind;
1061 LibmeshPetscCall(VecSetValues(
1062 _amc_cross_derivative_rhs, 1, &row_vec_ct, &value_vec_ct, ADD_VALUES));
1063 }
1064 else
1065 {
1066 PetscScalar value_ct = alpha * _subchannel_mesh.getCrossflowSign(i_ch, counter) *
1067 _Wij(i_gap, cross_index) / S_i / rho_i;
1068 PetscInt row_ct = i_ch + _n_channels * iz_ind;
1069 PetscInt col_ct = ii_ch + _n_channels * (iz_ind - 1);
1070 LibmeshPetscCall(MatSetValues(
1071 _amc_cross_derivative_mat, 1, &row_ct, 1, &col_ct, &value_ct, ADD_VALUES));
1072 }
1073 PetscScalar value_ct = (1.0 - alpha) *
1074 _subchannel_mesh.getCrossflowSign(i_ch, counter) *
1075 _Wij(i_gap, cross_index) / S_i / rho_i;
1076 PetscInt row_ct = i_ch + _n_channels * iz_ind;
1077 PetscInt col_ct = ii_ch + _n_channels * iz_ind;
1078 LibmeshPetscCall(MatSetValues(
1079 _amc_cross_derivative_mat, 1, &row_ct, 1, &col_ct, &value_ct, ADD_VALUES));
1080 }
1081 else if (_Wij(i_gap, cross_index) < 0.0) // _Wij=0 operations not necessary
1082 {
1083 if (iz == first_node)
1084 {
1085 u_star = (*_mdot_soln)(node_in_j) / S_j / rho_j;
1086 PetscScalar value_vec_ct = -1.0 * alpha *
1087 _subchannel_mesh.getCrossflowSign(i_ch, counter) *
1088 _Wij(i_gap, cross_index) * u_star;
1089 PetscInt row_vec_ct = i_ch + _n_channels * iz_ind;
1090 LibmeshPetscCall(VecSetValues(
1091 _amc_cross_derivative_rhs, 1, &row_vec_ct, &value_vec_ct, ADD_VALUES));
1092 }
1093 else
1094 {
1095 PetscScalar value_ct = alpha * _subchannel_mesh.getCrossflowSign(i_ch, counter) *
1096 _Wij(i_gap, cross_index) / S_j / rho_j;
1097 PetscInt row_ct = i_ch + _n_channels * iz_ind;
1098 PetscInt col_ct = jj_ch + _n_channels * (iz_ind - 1);
1099 LibmeshPetscCall(MatSetValues(
1100 _amc_cross_derivative_mat, 1, &row_ct, 1, &col_ct, &value_ct, ADD_VALUES));
1101 }
1102 PetscScalar value_ct = (1.0 - alpha) *
1103 _subchannel_mesh.getCrossflowSign(i_ch, counter) *
1104 _Wij(i_gap, cross_index) / S_j / rho_j;
1105 PetscInt row_ct = i_ch + _n_channels * iz_ind;
1106 PetscInt col_ct = jj_ch + _n_channels * iz_ind;
1107 LibmeshPetscCall(MatSetValues(
1108 _amc_cross_derivative_mat, 1, &row_ct, 1, &col_ct, &value_ct, ADD_VALUES));
1109 }
1110
1111 if (iz == first_node)
1112 {
1113 PetscScalar value_vec_ct = -2.0 * alpha * (*_mdot_soln)(node_in)*_CT *
1114 _WijPrime(i_gap, cross_index) / (rho_interp * S_interp);
1115 value_vec_ct += alpha * (*_mdot_soln)(node_in_j)*_CT * _WijPrime(i_gap, cross_index) /
1116 (rho_j * S_j);
1117 value_vec_ct += alpha * (*_mdot_soln)(node_in_i)*_CT * _WijPrime(i_gap, cross_index) /
1118 (rho_i * S_i);
1119 PetscInt row_vec_ct = i_ch + _n_channels * iz_ind;
1120 LibmeshPetscCall(
1121 VecSetValues(_amc_cross_derivative_rhs, 1, &row_vec_ct, &value_vec_ct, ADD_VALUES));
1122 }
1123 else
1124 {
1125 PetscScalar value_center_ct =
1126 2.0 * alpha * _CT * _WijPrime(i_gap, cross_index) / (rho_interp * S_interp);
1127 PetscInt row_ct = i_ch + _n_channels * iz_ind;
1128 PetscInt col_ct = i_ch + _n_channels * (iz_ind - 1);
1129 LibmeshPetscCall(MatSetValues(
1130 _amc_cross_derivative_mat, 1, &row_ct, 1, &col_ct, &value_center_ct, ADD_VALUES));
1131
1132 PetscScalar value_left_ct =
1133 -1.0 * alpha * _CT * _WijPrime(i_gap, cross_index) / (rho_j * S_j);
1134 row_ct = i_ch + _n_channels * iz_ind;
1135 col_ct = jj_ch + _n_channels * (iz_ind - 1);
1136 LibmeshPetscCall(MatSetValues(
1137 _amc_cross_derivative_mat, 1, &row_ct, 1, &col_ct, &value_left_ct, ADD_VALUES));
1138
1139 PetscScalar value_right_ct =
1140 -1.0 * alpha * _CT * _WijPrime(i_gap, cross_index) / (rho_i * S_i);
1141 row_ct = i_ch + _n_channels * iz_ind;
1142 col_ct = ii_ch + _n_channels * (iz_ind - 1);
1143 LibmeshPetscCall(MatSetValues(
1144 _amc_cross_derivative_mat, 1, &row_ct, 1, &col_ct, &value_right_ct, ADD_VALUES));
1145 }
1146
1147 PetscScalar value_center_ct =
1148 2.0 * (1.0 - alpha) * _CT * _WijPrime(i_gap, cross_index) / (rho_interp * S_interp);
1149 PetscInt row_ct = i_ch + _n_channels * iz_ind;
1150 PetscInt col_ct = i_ch + _n_channels * iz_ind;
1151 LibmeshPetscCall(MatSetValues(
1152 _amc_cross_derivative_mat, 1, &row_ct, 1, &col_ct, &value_center_ct, ADD_VALUES));
1153
1154 PetscScalar value_left_ct =
1155 -1.0 * (1.0 - alpha) * _CT * _WijPrime(i_gap, cross_index) / (rho_j * S_j);
1156 row_ct = i_ch + _n_channels * iz_ind;
1157 col_ct = jj_ch + _n_channels * iz_ind;
1158 LibmeshPetscCall(MatSetValues(
1159 _amc_cross_derivative_mat, 1, &row_ct, 1, &col_ct, &value_left_ct, ADD_VALUES));
1160
1161 PetscScalar value_right_ct =
1162 -1.0 * (1.0 - alpha) * _CT * _WijPrime(i_gap, cross_index) / (rho_i * S_i);
1163 row_ct = i_ch + _n_channels * iz_ind;
1164 col_ct = ii_ch + _n_channels * iz_ind;
1165 LibmeshPetscCall(MatSetValues(
1166 _amc_cross_derivative_mat, 1, &row_ct, 1, &col_ct, &value_right_ct, ADD_VALUES));
1167 counter++;
1168 }
1169
1171 PetscScalar mdot_interp =
1172 computeInterpolatedValue((*_mdot_soln)(node_out), (*_mdot_soln)(node_in), Pe);
1173 auto Re = ((mdot_interp / S_interp) * Dh_i / mu_interp);
1174 _friction_args = FrictionStruct(i_ch, Re, S_interp, w_perim_interp);
1176 if (_ff_soln)
1177 _ff_soln->set(node_out, ff);
1179 auto ki = 0.0;
1180 if ((*_mdot_soln)(node_out) >= 0)
1181 ki = k_grid[i_ch][iz - 1];
1182 else
1183 ki = k_grid[i_ch][iz];
1184 auto coef = (ff * dz / Dh_i + ki) * 0.5 * std::abs((*_mdot_soln)(node_out)) /
1185 (S_interp * rho_interp);
1186 if (iz == first_node)
1187 {
1188 PetscScalar value_vec = -1.0 * alpha * coef * (*_mdot_soln)(node_in);
1189 PetscInt row_vec = i_ch + _n_channels * iz_ind;
1190 LibmeshPetscCall(
1191 VecSetValues(_amc_friction_force_rhs, 1, &row_vec, &value_vec, ADD_VALUES));
1192 }
1193 else
1194 {
1195 PetscInt row = i_ch + _n_channels * iz_ind;
1196 PetscInt col = i_ch + _n_channels * (iz_ind - 1);
1197 PetscScalar value = alpha * coef;
1198 LibmeshPetscCall(
1199 MatSetValues(_amc_friction_force_mat, 1, &row, 1, &col, &value, INSERT_VALUES));
1200 }
1201
1202 // Adding diagonal elements
1203 PetscInt row = i_ch + _n_channels * iz_ind;
1204 PetscInt col = i_ch + _n_channels * iz_ind;
1205 PetscScalar value = (1.0 - alpha) * coef;
1206 LibmeshPetscCall(
1207 MatSetValues(_amc_friction_force_mat, 1, &row, 1, &col, &value, INSERT_VALUES));
1208
1210 PetscScalar value_vec = _dir_grav * -1.0 * _g_grav * rho_interp * dz * S_interp;
1211 PetscInt row_vec = i_ch + _n_channels * iz_ind;
1212 LibmeshPetscCall(VecSetValues(_amc_gravity_rhs, 1, &row_vec, &value_vec, ADD_VALUES));
1213 }
1214 }
1216 LibmeshPetscCall(MatZeroEntries(_amc_sys_mdot_mat));
1217 LibmeshPetscCall(VecZeroEntries(_amc_sys_mdot_rhs));
1218 LibmeshPetscCall(MatAssemblyBegin(_amc_time_derivative_mat, MAT_FINAL_ASSEMBLY));
1219 LibmeshPetscCall(MatAssemblyEnd(_amc_time_derivative_mat, MAT_FINAL_ASSEMBLY));
1220 LibmeshPetscCall(MatAssemblyBegin(_amc_advective_derivative_mat, MAT_FINAL_ASSEMBLY));
1221 LibmeshPetscCall(MatAssemblyEnd(_amc_advective_derivative_mat, MAT_FINAL_ASSEMBLY));
1222 LibmeshPetscCall(MatAssemblyBegin(_amc_cross_derivative_mat, MAT_FINAL_ASSEMBLY));
1223 LibmeshPetscCall(MatAssemblyEnd(_amc_cross_derivative_mat, MAT_FINAL_ASSEMBLY));
1224 LibmeshPetscCall(MatAssemblyBegin(_amc_friction_force_mat, MAT_FINAL_ASSEMBLY));
1225 LibmeshPetscCall(MatAssemblyEnd(_amc_friction_force_mat, MAT_FINAL_ASSEMBLY));
1226 LibmeshPetscCall(MatAssemblyBegin(_amc_sys_mdot_mat, MAT_FINAL_ASSEMBLY));
1227 LibmeshPetscCall(MatAssemblyEnd(_amc_sys_mdot_mat, MAT_FINAL_ASSEMBLY));
1228 // Matrix
1229#if !PETSC_VERSION_LESS_THAN(3, 15, 0)
1230 LibmeshPetscCall(
1231 MatAXPY(_amc_sys_mdot_mat, 1.0, _amc_time_derivative_mat, UNKNOWN_NONZERO_PATTERN));
1232 LibmeshPetscCall(MatAssemblyBegin(_amc_sys_mdot_mat, MAT_FINAL_ASSEMBLY));
1233 LibmeshPetscCall(MatAssemblyEnd(_amc_sys_mdot_mat, MAT_FINAL_ASSEMBLY));
1234 LibmeshPetscCall(
1235 MatAXPY(_amc_sys_mdot_mat, 1.0, _amc_advective_derivative_mat, UNKNOWN_NONZERO_PATTERN));
1236 LibmeshPetscCall(MatAssemblyBegin(_amc_sys_mdot_mat, MAT_FINAL_ASSEMBLY));
1237 LibmeshPetscCall(MatAssemblyEnd(_amc_sys_mdot_mat, MAT_FINAL_ASSEMBLY));
1238 LibmeshPetscCall(
1239 MatAXPY(_amc_sys_mdot_mat, 1.0, _amc_cross_derivative_mat, UNKNOWN_NONZERO_PATTERN));
1240 LibmeshPetscCall(MatAssemblyBegin(_amc_sys_mdot_mat, MAT_FINAL_ASSEMBLY));
1241 LibmeshPetscCall(MatAssemblyEnd(_amc_sys_mdot_mat, MAT_FINAL_ASSEMBLY));
1242 LibmeshPetscCall(
1243 MatAXPY(_amc_sys_mdot_mat, 1.0, _amc_friction_force_mat, UNKNOWN_NONZERO_PATTERN));
1244#else
1245 LibmeshPetscCall(
1246 MatAXPY(_amc_sys_mdot_mat, 1.0, _amc_time_derivative_mat, DIFFERENT_NONZERO_PATTERN));
1247 LibmeshPetscCall(MatAssemblyBegin(_amc_sys_mdot_mat, MAT_FINAL_ASSEMBLY));
1248 LibmeshPetscCall(MatAssemblyEnd(_amc_sys_mdot_mat, MAT_FINAL_ASSEMBLY));
1249 LibmeshPetscCall(
1250 MatAXPY(_amc_sys_mdot_mat, 1.0, _amc_advective_derivative_mat, DIFFERENT_NONZERO_PATTERN));
1251 LibmeshPetscCall(MatAssemblyBegin(_amc_sys_mdot_mat, MAT_FINAL_ASSEMBLY));
1252 LibmeshPetscCall(MatAssemblyEnd(_amc_sys_mdot_mat, MAT_FINAL_ASSEMBLY));
1253 LibmeshPetscCall(
1254 MatAXPY(_amc_sys_mdot_mat, 1.0, _amc_cross_derivative_mat, DIFFERENT_NONZERO_PATTERN));
1255 LibmeshPetscCall(MatAssemblyBegin(_amc_sys_mdot_mat, MAT_FINAL_ASSEMBLY));
1256 LibmeshPetscCall(MatAssemblyEnd(_amc_sys_mdot_mat, MAT_FINAL_ASSEMBLY));
1257 LibmeshPetscCall(
1258 MatAXPY(_amc_sys_mdot_mat, 1.0, _amc_friction_force_mat, DIFFERENT_NONZERO_PATTERN));
1259#endif
1260 LibmeshPetscCall(MatAssemblyBegin(_amc_sys_mdot_mat, MAT_FINAL_ASSEMBLY));
1261 LibmeshPetscCall(MatAssemblyEnd(_amc_sys_mdot_mat, MAT_FINAL_ASSEMBLY));
1262 // RHS
1263 LibmeshPetscCall(VecAXPY(_amc_sys_mdot_rhs, 1.0, _amc_time_derivative_rhs));
1264 LibmeshPetscCall(VecAXPY(_amc_sys_mdot_rhs, 1.0, _amc_advective_derivative_rhs));
1265 LibmeshPetscCall(VecAXPY(_amc_sys_mdot_rhs, 1.0, _amc_cross_derivative_rhs));
1266 LibmeshPetscCall(VecAXPY(_amc_sys_mdot_rhs, 1.0, _amc_friction_force_rhs));
1267 LibmeshPetscCall(VecAXPY(_amc_sys_mdot_rhs, 1.0, _amc_gravity_rhs));
1268 if (_segregated_bool)
1269 {
1270 // Assembly the matrix system
1271 LibmeshPetscCall(populateVectorFromHandle<SolutionHandle>(
1272 _prod, *_mdot_soln, first_node, last_node, _n_channels));
1273 Vec ls;
1274 LibmeshPetscCall(VecDuplicate(_amc_sys_mdot_rhs, &ls));
1275 LibmeshPetscCall(MatMult(_amc_sys_mdot_mat, _prod, ls));
1276 LibmeshPetscCall(VecAXPY(ls, -1.0, _amc_sys_mdot_rhs));
1277 PetscScalar * xx;
1278 LibmeshPetscCall(VecGetArray(ls, &xx));
1279 for (unsigned int iz = first_node; iz < last_node + 1; iz++)
1280 {
1281 auto iz_ind = iz - first_node;
1282 for (unsigned int i_ch = 0; i_ch < _n_channels; i_ch++)
1283 {
1284 // Setting nodes
1285 auto * node_in = _subchannel_mesh.getChannelNode(i_ch, iz - 1);
1286 auto * node_out = _subchannel_mesh.getChannelNode(i_ch, iz);
1287
1288 // inlet, outlet, and interpolated axial surface area
1289 auto S_in = (*_S_flow_soln)(node_in);
1290 auto S_out = (*_S_flow_soln)(node_out);
1291 auto S_interp = computeInterpolatedValue(S_out, S_in, 0.5);
1292
1293 // Setting solutions
1294 if (S_interp != 0)
1295 {
1296 auto DP = (1 / S_interp) * xx[iz_ind * _n_channels + i_ch];
1297 _DP(i_ch, iz) = DP;
1298 if (_DP_soln)
1299 _DP_soln->set(node_out, DP);
1300 }
1301 else
1302 {
1303 auto DP = 0.0;
1304 _DP(i_ch, iz) = DP;
1305 if (_DP_soln)
1306 _DP_soln->set(node_out, DP);
1307 }
1308 }
1309 }
1310 LibmeshPetscCall(VecDestroy(&ls));
1311 }
1312 }
1313}
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)
const SCMFrictionClosureBase * _friction_closure
Friction closure object.
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
std::unique_ptr< SolutionHandle > _S_flow_soln
libMesh::DenseMatrix< Real > & _Wij
Real _TR
Flag that activates or deactivates the transient parts of the equations we solve by multiplication.
PetscScalar computeInterpolationCoefficients(PetscScalar Peclet=0.0)
Functions that computes the interpolation scheme given the Peclet number.
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.
std::unique_ptr< SolutionHandle > _mdot_soln
Solutions handles and link to TH tables properties.
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)

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 166 of file SubChannel1PhaseProblem.h.

167 {
168 switch (dir)
169 {
170 case 0: // counter_flow
171 return 1.0;
172 case 1: // co_flow
173 return -1.0;
174 case 2: // none
175 return 0.0;
176 default:
177 mooseError(name(), ": Invalid gravity direction: expected counter_flow, co_flow, or none");
178 }
179 }
const std::string & name() const

◆ computeh()

void QuadSubChannel1PhaseProblem::computeh ( int  iblock)
overrideprotectedvirtual

Computes Enthalpy per channel for block iblock.

Advective derivative term

Cross derivative term

Added heat enthalpy

Assembling system

Implements SubChannel1PhaseProblem.

Definition at line 243 of file QuadSubChannel1PhaseProblem.C.

244{
245 unsigned int last_node = (iblock + 1) * _block_size;
246 unsigned int first_node = iblock * _block_size + 1;
247 if (iblock == 0)
248 {
249 for (unsigned int i_ch = 0; i_ch < _n_channels; i_ch++)
250 {
251 auto * node = _subchannel_mesh.getChannelNode(i_ch, 0);
252 auto h_out = _fp->h_from_p_T((*_P_soln)(node) + _P_out, (*_T_soln)(node));
253 if (h_out < 0)
254 {
256 name(), " : Calculation of negative Enthalpy h_out = : ", h_out, " Axial Level= : ", 0);
257 }
258 _h_soln->set(node, h_out);
259 }
260 }
261
262 if (!_implicit_bool)
263 {
264 for (unsigned int iz = first_node; iz < last_node + 1; iz++)
265 {
266 auto dz = _z_grid[iz] - _z_grid[iz - 1];
267 for (unsigned int i_ch = 0; i_ch < _n_channels; i_ch++)
268 {
269 auto * node_in = _subchannel_mesh.getChannelNode(i_ch, iz - 1);
270 auto * node_out = _subchannel_mesh.getChannelNode(i_ch, iz);
271 auto mdot_in = (*_mdot_soln)(node_in);
272 auto h_in = (*_h_soln)(node_in); // J/kg
273 auto volume = dz * (*_S_flow_soln)(node_in);
274 auto mdot_out = (*_mdot_soln)(node_out);
275 auto h_out = 0.0;
276 Real sumWijh = 0.0;
277 Real sumWijPrimeDhij = 0.0;
278 Real added_enthalpy = computeAddedHeatPin(i_ch, iz);
279 // Calculate sum of crossflow into channel i from channels j around i
280 unsigned int counter = 0;
281 for (auto i_gap : _subchannel_mesh.getChannelGaps(i_ch))
282 {
283 auto chans = _subchannel_mesh.getGapChannels(i_gap);
284 unsigned int ii_ch = chans.first;
285 // i is always the smallest and first index in the mapping
286 unsigned int jj_ch = chans.second;
287 auto * node_in_i = _subchannel_mesh.getChannelNode(ii_ch, iz - 1);
288 auto * node_in_j = _subchannel_mesh.getChannelNode(jj_ch, iz - 1);
289 // Define donor enthalpy
290 Real h_star = 0.0;
291 if (_Wij(i_gap, iz) > 0.0)
292 h_star = (*_h_soln)(node_in_i);
293 else if (_Wij(i_gap, iz) < 0.0)
294 h_star = (*_h_soln)(node_in_j);
295 // take care of the sign by applying the map, use donor cell
296 sumWijh += _subchannel_mesh.getCrossflowSign(i_ch, counter) * _Wij(i_gap, iz) * h_star;
297 sumWijPrimeDhij += _WijPrime(i_gap, iz) * (2 * (*_h_soln)(node_in) -
298 (*_h_soln)(node_in_j) - (*_h_soln)(node_in_i));
299 counter++;
300 }
301 h_out = (mdot_in * h_in - sumWijh - sumWijPrimeDhij + added_enthalpy +
302 _TR * _rho_soln->old(node_out) * _h_soln->old(node_out) * volume / _dt) /
303 (mdot_out + _TR * (*_rho_soln)(node_out)*volume / _dt);
304 if (h_out < 0)
305 {
307 " : Calculation of negative Enthalpy h_out = : ",
308 h_out,
309 " Axial Level= : ",
310 iz);
311 }
312 _h_soln->set(node_out, h_out); // J/kg
313 }
314 }
315 }
316 else
317 {
318 LibmeshPetscCall(MatZeroEntries(_hc_time_derivative_mat));
319 LibmeshPetscCall(MatZeroEntries(_hc_advective_derivative_mat));
320 LibmeshPetscCall(MatZeroEntries(_hc_cross_derivative_mat));
321 LibmeshPetscCall(VecZeroEntries(_hc_time_derivative_rhs));
322 LibmeshPetscCall(VecZeroEntries(_hc_advective_derivative_rhs));
323 LibmeshPetscCall(VecZeroEntries(_hc_cross_derivative_rhs));
324 LibmeshPetscCall(VecZeroEntries(_hc_added_heat_rhs));
325 LibmeshPetscCall(MatZeroEntries(_hc_sys_h_mat));
326 LibmeshPetscCall(VecZeroEntries(_hc_sys_h_rhs));
327 for (unsigned int iz = first_node; iz < last_node + 1; iz++)
328 {
329 auto dz = _z_grid[iz] - _z_grid[iz - 1];
330 auto iz_ind = iz - first_node;
331 for (unsigned int i_ch = 0; i_ch < _n_channels; i_ch++)
332 {
333 auto * node_in = _subchannel_mesh.getChannelNode(i_ch, iz - 1);
334 auto * node_out = _subchannel_mesh.getChannelNode(i_ch, iz);
335 auto S_in = (*_S_flow_soln)(node_in);
336 auto S_out = (*_S_flow_soln)(node_out);
337 auto S_interp = computeInterpolatedValue(S_out, S_in, 0.5);
338 auto volume = dz * S_interp;
339
340 // interpolation weight coefficient
341 auto alpha = computeInterpolationCoefficients(0.5);
342
343 // Keep temporal storage independent of the spatial interpolation scheme. Applying the
344 // upwind coefficient to this term puts the storage on the upstream node and makes the
345 // small-timestep matrix singular in the upwind limit.
346 PetscInt row_tt = i_ch + _n_channels * iz_ind;
347 PetscInt col_tt = i_ch + _n_channels * iz_ind;
348 PetscScalar value_tt = _TR * (*_rho_soln)(node_out)*volume / _dt;
349 LibmeshPetscCall(MatSetValues(
350 _hc_time_derivative_mat, 1, &row_tt, 1, &col_tt, &value_tt, INSERT_VALUES));
351
352 PetscScalar value_vec_tt =
353 _TR * _rho_soln->old(node_out) * _h_soln->old(node_out) * volume / _dt;
354 PetscInt row_vec_tt = i_ch + _n_channels * iz_ind;
355 LibmeshPetscCall(
356 VecSetValues(_hc_time_derivative_rhs, 1, &row_vec_tt, &value_vec_tt, ADD_VALUES));
357
359 if (iz == first_node)
360 {
361 PetscScalar value_vec_at = (*_mdot_soln)(node_in) * (*_h_soln)(node_in);
362 PetscInt row_vec_at = i_ch + _n_channels * iz_ind;
363 LibmeshPetscCall(VecSetValues(
364 _hc_advective_derivative_rhs, 1, &row_vec_at, &value_vec_at, ADD_VALUES));
365 }
366 else
367 {
368 PetscInt row_at = i_ch + _n_channels * iz_ind;
369 PetscInt col_at = i_ch + _n_channels * (iz_ind - 1);
370 PetscScalar value_at = -1.0 * (*_mdot_soln)(node_in);
371 LibmeshPetscCall(MatSetValues(
372 _hc_advective_derivative_mat, 1, &row_at, 1, &col_at, &value_at, INSERT_VALUES));
373 }
374
375 // Adding diagonal elements
376 PetscInt row_at = i_ch + _n_channels * iz_ind;
377 PetscInt col_at = i_ch + _n_channels * iz_ind;
378 PetscScalar value_at = (*_mdot_soln)(node_out);
379 LibmeshPetscCall(MatSetValues(
380 _hc_advective_derivative_mat, 1, &row_at, 1, &col_at, &value_at, INSERT_VALUES));
381
383 unsigned int counter = 0;
384 unsigned int cross_index = iz; // iz-1;
385 for (auto i_gap : _subchannel_mesh.getChannelGaps(i_ch))
386 {
387 auto chans = _subchannel_mesh.getGapChannels(i_gap);
388 unsigned int ii_ch = chans.first;
389 unsigned int jj_ch = chans.second;
390 auto * node_in_i = _subchannel_mesh.getChannelNode(ii_ch, iz - 1);
391 auto * node_in_j = _subchannel_mesh.getChannelNode(jj_ch, iz - 1);
392 PetscScalar h_star;
393 // figure out donor axial velocity
394 if (_Wij(i_gap, cross_index) > 0.0)
395 {
396 if (iz == first_node)
397 {
398 h_star = (*_h_soln)(node_in_i);
399 PetscScalar value_vec_ct = -1.0 * alpha *
400 _subchannel_mesh.getCrossflowSign(i_ch, counter) *
401 _Wij(i_gap, cross_index) * h_star;
402 PetscInt row_vec_ct = i_ch + _n_channels * iz_ind;
403 LibmeshPetscCall(VecSetValues(
404 _hc_cross_derivative_rhs, 1, &row_vec_ct, &value_vec_ct, ADD_VALUES));
405 }
406 else
407 {
408 PetscScalar value_ct = alpha * _subchannel_mesh.getCrossflowSign(i_ch, counter) *
409 _Wij(i_gap, cross_index);
410 PetscInt row_ct = i_ch + _n_channels * iz_ind;
411 PetscInt col_ct = ii_ch + _n_channels * (iz_ind - 1);
412 LibmeshPetscCall(MatSetValues(
413 _hc_cross_derivative_mat, 1, &row_ct, 1, &col_ct, &value_ct, ADD_VALUES));
414 }
415 PetscScalar value_ct = (1.0 - alpha) *
416 _subchannel_mesh.getCrossflowSign(i_ch, counter) *
417 _Wij(i_gap, cross_index);
418 PetscInt row_ct = i_ch + _n_channels * iz_ind;
419 PetscInt col_ct = ii_ch + _n_channels * iz_ind;
420 LibmeshPetscCall(MatSetValues(
421 _hc_cross_derivative_mat, 1, &row_ct, 1, &col_ct, &value_ct, ADD_VALUES));
422 }
423 else if (_Wij(i_gap, cross_index) < 0.0) // _Wij=0 operations not necessary
424 {
425 if (iz == first_node)
426 {
427 h_star = (*_h_soln)(node_in_j);
428 PetscScalar value_vec_ct = -1.0 * alpha *
429 _subchannel_mesh.getCrossflowSign(i_ch, counter) *
430 _Wij(i_gap, cross_index) * h_star;
431 PetscInt row_vec_ct = i_ch + _n_channels * iz_ind;
432 LibmeshPetscCall(VecSetValues(
433 _hc_cross_derivative_rhs, 1, &row_vec_ct, &value_vec_ct, ADD_VALUES));
434 }
435 else
436 {
437 PetscScalar value_ct = alpha * _subchannel_mesh.getCrossflowSign(i_ch, counter) *
438 _Wij(i_gap, cross_index);
439 PetscInt row_ct = i_ch + _n_channels * iz_ind;
440 PetscInt col_ct = jj_ch + _n_channels * (iz_ind - 1);
441 LibmeshPetscCall(MatSetValues(
442 _hc_cross_derivative_mat, 1, &row_ct, 1, &col_ct, &value_ct, ADD_VALUES));
443 }
444 PetscScalar value_ct = (1.0 - alpha) *
445 _subchannel_mesh.getCrossflowSign(i_ch, counter) *
446 _Wij(i_gap, cross_index);
447 PetscInt row_ct = i_ch + _n_channels * iz_ind;
448 PetscInt col_ct = jj_ch + _n_channels * iz_ind;
449 LibmeshPetscCall(MatSetValues(
450 _hc_cross_derivative_mat, 1, &row_ct, 1, &col_ct, &value_ct, ADD_VALUES));
451 }
452
453 // Turbulent cross flows
454 if (iz == first_node)
455 {
456 PetscScalar value_vec_ct =
457 -2.0 * alpha * (*_h_soln)(node_in)*_WijPrime(i_gap, cross_index);
458 value_vec_ct += alpha * (*_h_soln)(node_in_j)*_WijPrime(i_gap, cross_index);
459 value_vec_ct += alpha * (*_h_soln)(node_in_i)*_WijPrime(i_gap, cross_index);
460 PetscInt row_vec_ct = i_ch + _n_channels * iz_ind;
461 LibmeshPetscCall(
462 VecSetValues(_hc_cross_derivative_rhs, 1, &row_vec_ct, &value_vec_ct, ADD_VALUES));
463 }
464 else
465 {
466 PetscScalar value_center_ct = 2.0 * alpha * _WijPrime(i_gap, cross_index);
467 PetscInt row_ct = i_ch + _n_channels * iz_ind;
468 PetscInt col_ct = i_ch + _n_channels * (iz_ind - 1);
469 LibmeshPetscCall(MatSetValues(
470 _hc_cross_derivative_mat, 1, &row_ct, 1, &col_ct, &value_center_ct, ADD_VALUES));
471
472 PetscScalar value_left_ct = -1.0 * alpha * _WijPrime(i_gap, cross_index);
473 row_ct = i_ch + _n_channels * iz_ind;
474 col_ct = jj_ch + _n_channels * (iz_ind - 1);
475 LibmeshPetscCall(MatSetValues(
476 _hc_cross_derivative_mat, 1, &row_ct, 1, &col_ct, &value_left_ct, ADD_VALUES));
477
478 PetscScalar value_right_ct = -1.0 * alpha * _WijPrime(i_gap, cross_index);
479 row_ct = i_ch + _n_channels * iz_ind;
480 col_ct = ii_ch + _n_channels * (iz_ind - 1);
481 LibmeshPetscCall(MatSetValues(
482 _hc_cross_derivative_mat, 1, &row_ct, 1, &col_ct, &value_right_ct, ADD_VALUES));
483 }
484 PetscScalar value_center_ct = 2.0 * (1.0 - alpha) * _WijPrime(i_gap, cross_index);
485 PetscInt row_ct = i_ch + _n_channels * iz_ind;
486 PetscInt col_ct = i_ch + _n_channels * iz_ind;
487 LibmeshPetscCall(MatSetValues(
488 _hc_cross_derivative_mat, 1, &row_ct, 1, &col_ct, &value_center_ct, ADD_VALUES));
489
490 PetscScalar value_left_ct = -1.0 * (1.0 - alpha) * _WijPrime(i_gap, cross_index);
491 row_ct = i_ch + _n_channels * iz_ind;
492 col_ct = jj_ch + _n_channels * iz_ind;
493 LibmeshPetscCall(MatSetValues(
494 _hc_cross_derivative_mat, 1, &row_ct, 1, &col_ct, &value_left_ct, ADD_VALUES));
495
496 PetscScalar value_right_ct = -1.0 * (1.0 - alpha) * _WijPrime(i_gap, cross_index);
497 row_ct = i_ch + _n_channels * iz_ind;
498 col_ct = ii_ch + _n_channels * iz_ind;
499 LibmeshPetscCall(MatSetValues(
500 _hc_cross_derivative_mat, 1, &row_ct, 1, &col_ct, &value_right_ct, ADD_VALUES));
501 counter++;
502 }
503
505 PetscScalar added_enthalpy = computeAddedHeatPin(i_ch, iz);
506 PetscInt row_vec_ht = i_ch + _n_channels * iz_ind;
507 LibmeshPetscCall(
508 VecSetValues(_hc_added_heat_rhs, 1, &row_vec_ht, &added_enthalpy, ADD_VALUES));
509 }
510 }
512 LibmeshPetscCall(MatAssemblyBegin(_hc_time_derivative_mat, MAT_FINAL_ASSEMBLY));
513 LibmeshPetscCall(MatAssemblyEnd(_hc_time_derivative_mat, MAT_FINAL_ASSEMBLY));
514 LibmeshPetscCall(MatAssemblyBegin(_hc_advective_derivative_mat, MAT_FINAL_ASSEMBLY));
515 LibmeshPetscCall(MatAssemblyEnd(_hc_advective_derivative_mat, MAT_FINAL_ASSEMBLY));
516 LibmeshPetscCall(MatAssemblyBegin(_hc_cross_derivative_mat, MAT_FINAL_ASSEMBLY));
517 LibmeshPetscCall(MatAssemblyEnd(_hc_cross_derivative_mat, MAT_FINAL_ASSEMBLY));
518 LibmeshPetscCall(MatAssemblyBegin(_hc_sys_h_mat, MAT_FINAL_ASSEMBLY));
519 LibmeshPetscCall(MatAssemblyEnd(_hc_sys_h_mat, MAT_FINAL_ASSEMBLY));
520 // Matrix
521#if !PETSC_VERSION_LESS_THAN(3, 15, 0)
522 LibmeshPetscCall(MatAXPY(_hc_sys_h_mat, 1.0, _hc_time_derivative_mat, UNKNOWN_NONZERO_PATTERN));
523 LibmeshPetscCall(MatAssemblyBegin(_hc_sys_h_mat, MAT_FINAL_ASSEMBLY));
524 LibmeshPetscCall(MatAssemblyEnd(_hc_sys_h_mat, MAT_FINAL_ASSEMBLY));
525 LibmeshPetscCall(
526 MatAXPY(_hc_sys_h_mat, 1.0, _hc_advective_derivative_mat, UNKNOWN_NONZERO_PATTERN));
527 LibmeshPetscCall(MatAssemblyBegin(_hc_sys_h_mat, MAT_FINAL_ASSEMBLY));
528 LibmeshPetscCall(MatAssemblyEnd(_hc_sys_h_mat, MAT_FINAL_ASSEMBLY));
529 LibmeshPetscCall(
530 MatAXPY(_hc_sys_h_mat, 1.0, _hc_cross_derivative_mat, UNKNOWN_NONZERO_PATTERN));
531#else
532 LibmeshPetscCall(
533 MatAXPY(_hc_sys_h_mat, 1.0, _hc_time_derivative_mat, DIFFERENT_NONZERO_PATTERN));
534 LibmeshPetscCall(MatAssemblyBegin(_hc_sys_h_mat, MAT_FINAL_ASSEMBLY));
535 LibmeshPetscCall(MatAssemblyEnd(_hc_sys_h_mat, MAT_FINAL_ASSEMBLY));
536 LibmeshPetscCall(
537 MatAXPY(_hc_sys_h_mat, 1.0, _hc_advective_derivative_mat, DIFFERENT_NONZERO_PATTERN));
538 LibmeshPetscCall(MatAssemblyBegin(_hc_sys_h_mat, MAT_FINAL_ASSEMBLY));
539 LibmeshPetscCall(MatAssemblyEnd(_hc_sys_h_mat, MAT_FINAL_ASSEMBLY));
540 LibmeshPetscCall(
541 MatAXPY(_hc_sys_h_mat, 1.0, _hc_cross_derivative_mat, DIFFERENT_NONZERO_PATTERN));
542#endif
543 LibmeshPetscCall(MatAssemblyBegin(_hc_sys_h_mat, MAT_FINAL_ASSEMBLY));
544 LibmeshPetscCall(MatAssemblyEnd(_hc_sys_h_mat, MAT_FINAL_ASSEMBLY));
546 _console << "Block: " << iblock << " - Enthalpy conservation matrix assembled" << std::endl;
547 // RHS
548 LibmeshPetscCall(VecAXPY(_hc_sys_h_rhs, 1.0, _hc_time_derivative_rhs));
549 LibmeshPetscCall(VecAXPY(_hc_sys_h_rhs, 1.0, _hc_advective_derivative_rhs));
550 LibmeshPetscCall(VecAXPY(_hc_sys_h_rhs, 1.0, _hc_cross_derivative_rhs));
551 LibmeshPetscCall(VecAXPY(_hc_sys_h_rhs, 1.0, _hc_added_heat_rhs));
552
553 // Use system to solve for and populate enthalpy
554 LibmeshPetscCall(this->solveAndPopulateEnthalpy(
555 _hc_sys_h_mat, _hc_sys_h_rhs, first_node, last_node, "h_sys_"));
556 }
557}
const ConsoleStream _console
virtual Real computeAddedHeatPin(unsigned int i_ch, unsigned int iz) const override
Pure virtual: daughters provide different implementations.
const Real & getCrossflowSign(unsigned int i_chan, unsigned int i_local) const override
Return a sign for the crossflow given a subchannel index and local neighbor index.
Node * getChannelNode(unsigned int i_chan, unsigned int iz) const override
Get the subchannel mesh node for a given channel index and elevation index.
const std::pair< unsigned int, unsigned int > & getGapChannels(unsigned int i_gap) const override
Return a pair of subchannel indices for a given gap index.
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 > _P_soln
std::unique_ptr< SolutionHandle > _h_soln
std::unique_ptr< SolutionHandle > _T_soln
const bool _verbose_subchannel
Boolean to printout information related to subchannel solve.
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 579 of file SubChannel1PhaseProblem.C.

582{
583 PetscScalar alpha = computeInterpolationCoefficients(Peclet);
584 return alpha * botValue + (1.0 - alpha) * topValue;
585}

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

◆ computeInterpolationCoefficients()

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

Functions that computes the interpolation scheme given the Peclet number.

Definition at line 559 of file SubChannel1PhaseProblem.C.

560{
561 switch (_interpolation_scheme)
562 {
563 case 0: // upwind interpolation
564 return 1.0;
565 case 1: // downwind interpolation
566 return 0.0;
567 case 2: // central_difference interpolation
568 return 0.5;
569 case 3: // exponential interpolation (Peclet limited)
570 return ((Peclet - 1.0) * std::exp(Peclet) + 1) / (Peclet * (std::exp(Peclet) - 1.) + 1e-10);
571 default:
573 ": Interpolation scheme should be a string: upwind, downwind, central_difference, "
574 "exponential");
575 }
576}
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(), computeh(), TriSubChannel1PhaseProblem::computeh(), SubChannel1PhaseProblem::computeInterpolatedValue(), SubChannel1PhaseProblem::computeP(), and SubChannel1PhaseProblem::computeWijResidual().

◆ computeMdot()

void SubChannel1PhaseProblem::computeMdot ( int  iblock)
protectedinherited

Computes mass flow per channel for block iblock.

Definition at line 687 of file SubChannel1PhaseProblem.C.

688{
689 const unsigned int last_node = (iblock + 1) * _block_size;
690 const unsigned int first_node = iblock * _block_size + 1;
691 if (!_implicit_bool)
692 {
693 for (unsigned int iz = first_node; iz < last_node + 1; iz++)
694 {
695 auto dz = _z_grid[iz] - _z_grid[iz - 1];
696 for (unsigned int i_ch = 0; i_ch < _n_channels; i_ch++)
697 {
698 auto * node_in = _subchannel_mesh.getChannelNode(i_ch, iz - 1);
699 auto * node_out = _subchannel_mesh.getChannelNode(i_ch, iz);
700 auto volume = dz * (*_S_flow_soln)(node_in);
701 auto time_term = _TR * ((*_rho_soln)(node_out)-_rho_soln->old(node_out)) * volume / _dt;
702 // Wij positive out of i into j;
703 auto mdot_out = (*_mdot_soln)(node_in) - (*_SumWij_soln)(node_out)-time_term;
704 if (mdot_out < 0)
705 {
706 _console << "Wij = : " << _Wij << "\n";
708 " : Calculation of negative mass flow mdot_out = : ",
709 mdot_out,
710 " Axial Level= : ",
711 iz,
712 " - Implicit solves are required for recirculating flow.");
713 }
714 _mdot_soln->set(node_out, mdot_out); // kg/sec
715 }
716 }
717 }
718 else
719 {
720 for (unsigned int iz = first_node; iz < last_node + 1; iz++)
721 {
722 auto dz = _z_grid[iz] - _z_grid[iz - 1];
723 auto iz_ind = iz - first_node;
724 for (unsigned int i_ch = 0; i_ch < _n_channels; i_ch++)
725 {
726 auto * node_in = _subchannel_mesh.getChannelNode(i_ch, iz - 1);
727 auto * node_out = _subchannel_mesh.getChannelNode(i_ch, iz);
728 auto volume = dz * (*_S_flow_soln)(node_in);
729
730 // Adding time derivative to the RHS
731 auto time_term = _TR * ((*_rho_soln)(node_out)-_rho_soln->old(node_out)) * volume / _dt;
732 PetscInt row_vec = i_ch + _n_channels * iz_ind;
733 PetscScalar value_vec = -1.0 * time_term;
734 LibmeshPetscCall(
735 VecSetValues(_mc_axial_convection_rhs, 1, &row_vec, &value_vec, INSERT_VALUES));
736
737 // Linearize transient density with respect to pressure at constant enthalpy. The
738 // temperature response at constant h is required even for a rho(T)-only liquid model:
739 //
740 // (d rho / d p)_h = (d rho / d p)_T
741 // - (d rho / d T)_p (d h / d p)_T / (d h / d T)_p.
742 //
743 // Without this Jacobian contribution, pressure-density coupling remains in the outer
744 // fixed-point iteration and scales as O(1 / dt). As the time step decreases, the iteration
745 // can become increasingly slow or noncontractive and may require stronger relaxation.
746 if (_TR && _compute_density && _compute_power && iz < last_node)
747 {
748 Real rho, drho_dp_T, drho_dT;
749 _fp->rho_from_p_T(
750 (*_P_soln)(node_out) + _P_out, (*_T_soln)(node_out), rho, drho_dp_T, drho_dT);
751 Real h, dh_dp_T, dh_dT;
752 _fp->h_from_p_T((*_P_soln)(node_out) + _P_out, (*_T_soln)(node_out), h, dh_dp_T, dh_dT);
753 const Real drho_dp_h = drho_dp_T - drho_dT * dh_dp_T / dh_dT;
754 const PetscScalar pressure_coefficient = volume / _dt * drho_dp_h;
755 const PetscInt pressure_col = i_ch + _n_channels * (iz_ind + 1);
756 LibmeshPetscCall(MatSetValues(_mc_density_pressure_mat,
757 1,
758 &row_vec,
759 1,
760 &pressure_col,
761 &pressure_coefficient,
762 INSERT_VALUES));
763 const PetscScalar linearization_rhs = pressure_coefficient * (*_P_soln)(node_out);
764 LibmeshPetscCall(
765 VecSetValues(_mc_axial_convection_rhs, 1, &row_vec, &linearization_rhs, ADD_VALUES));
766 }
767
768 // Imposing bottom boundary condition or adding of diagonal elements
769 if (iz == first_node)
770 {
771 PetscScalar value_vec = (*_mdot_soln)(node_in);
772 PetscInt row_vec = i_ch + _n_channels * iz_ind;
773 LibmeshPetscCall(
774 VecSetValues(_mc_axial_convection_rhs, 1, &row_vec, &value_vec, ADD_VALUES));
775 }
776 else
777 {
778 PetscInt row = i_ch + _n_channels * iz_ind;
779 PetscInt col = i_ch + _n_channels * (iz_ind - 1);
780 PetscScalar value = -1.0;
781 LibmeshPetscCall(
782 MatSetValues(_mc_axial_convection_mat, 1, &row, 1, &col, &value, INSERT_VALUES));
783 }
784
785 // Adding diagonal elements
786 PetscInt row = i_ch + _n_channels * iz_ind;
787 PetscInt col = i_ch + _n_channels * iz_ind;
788 PetscScalar value = 1.0;
789 LibmeshPetscCall(
790 MatSetValues(_mc_axial_convection_mat, 1, &row, 1, &col, &value, INSERT_VALUES));
791
792 // Adding cross flows RHS
794 {
795 PetscScalar value_vec_2 = -1.0 * (*_SumWij_soln)(node_out);
796 PetscInt row_vec_2 = i_ch + _n_channels * iz_ind;
797 LibmeshPetscCall(
798 VecSetValues(_mc_axial_convection_rhs, 1, &row_vec_2, &value_vec_2, ADD_VALUES));
799 }
800 }
801 }
802 LibmeshPetscCall(MatAssemblyBegin(_mc_axial_convection_mat, MAT_FINAL_ASSEMBLY));
803 LibmeshPetscCall(MatAssemblyEnd(_mc_axial_convection_mat, MAT_FINAL_ASSEMBLY));
804 LibmeshPetscCall(MatAssemblyBegin(_mc_density_pressure_mat, MAT_FINAL_ASSEMBLY));
805 LibmeshPetscCall(MatAssemblyEnd(_mc_density_pressure_mat, MAT_FINAL_ASSEMBLY));
806
808 {
809 KSP ksploc;
810 PC pc;
811 Vec sol;
812 LibmeshPetscCall(VecDuplicate(_mc_axial_convection_rhs, &sol));
813 LibmeshPetscCall(KSPCreate(PETSC_COMM_SELF, &ksploc));
814 LibmeshPetscCall(KSPSetOperators(ksploc, _mc_axial_convection_mat, _mc_axial_convection_mat));
815 LibmeshPetscCall(KSPGetPC(ksploc, &pc));
816 LibmeshPetscCall(PCSetType(pc, PCJACOBI));
817 LibmeshPetscCall(KSPSetTolerances(ksploc, _rtol, _atol, _dtol, _maxit));
818 LibmeshPetscCall(KSPSetFromOptions(ksploc));
819 LibmeshPetscCall(KSPSolve(ksploc, _mc_axial_convection_rhs, sol));
820 LibmeshPetscCall(populateSolutionChan<SolutionHandle>(
821 sol, *_mdot_soln, first_node, last_node, _n_channels));
822 LibmeshPetscCall(VecZeroEntries(_mc_axial_convection_rhs));
823 LibmeshPetscCall(KSPDestroy(&ksploc));
824 LibmeshPetscCall(VecDestroy(&sol));
825 }
826 }
827}
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.
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.
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 2050 of file SubChannel1PhaseProblem.C.

2051{
2052 auto beta = _mixing_closure->computeMixingParameter(i_gap, iz);
2053 if (!std::isfinite(beta) || beta < 0.0)
2054 mooseError(name(),
2055 ": Mixing closure returned invalid beta = ",
2056 beta,
2057 " for gap ",
2058 i_gap,
2059 " at axial index ",
2060 iz,
2061 ". Beta must be finite and non-negative.");
2062
2063 return beta;
2064}
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 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 if (iblock == 0)
1612 {
1613 for (unsigned int i_ch = 0; i_ch < _n_channels; i_ch++)
1614 {
1615 auto * node = _subchannel_mesh.getChannelNode(i_ch, 0);
1616 _mu_soln->set(node, _fp->mu_from_p_T((*_P_soln)(node) + _P_out, (*_T_soln)(node)));
1617 }
1618 }
1619 for (unsigned int iz = first_node; iz < last_node + 1; iz++)
1620 {
1621 for (unsigned int i_ch = 0; i_ch < _n_channels; i_ch++)
1622 {
1623 auto * node = _subchannel_mesh.getChannelNode(i_ch, iz);
1624 _mu_soln->set(node, _fp->mu_from_p_T((*_P_soln)(node) + _P_out, (*_T_soln)(node)));
1625 }
1626 }
1627}
std::unique_ptr< SolutionHandle > _mu_soln

Referenced by SubChannel1PhaseProblem::externalSolve().

◆ computeP()

void SubChannel1PhaseProblem::computeP ( int  iblock)
protectedinherited

Computes Pressure per channel for block iblock.

Definition at line 1316 of file SubChannel1PhaseProblem.C.

1317{
1318 const unsigned int last_node = (iblock + 1) * _block_size;
1319 const unsigned int first_node = iblock * _block_size + 1;
1320 if (!_implicit_bool)
1321 {
1323 {
1324 for (unsigned int iz = last_node; iz > first_node - 1; iz--)
1325 {
1326 // Calculate pressure in the inlet of the cell assuming known outlet
1327 for (unsigned int i_ch = 0; i_ch < _n_channels; i_ch++)
1328 {
1329 auto * node_out = _subchannel_mesh.getChannelNode(i_ch, iz);
1330 auto * node_in = _subchannel_mesh.getChannelNode(i_ch, iz - 1);
1331 // update Pressure solution
1332 _P_soln->set(node_in, (*_P_soln)(node_out) + _DP(i_ch, iz));
1333 }
1334 }
1335 }
1336 else
1337 {
1338 for (unsigned int iz = last_node; iz > first_node - 1; iz--)
1339 {
1340 // Calculate pressure in the inlet of the cell assuming known outlet
1341 for (unsigned int i_ch = 0; i_ch < _n_channels; i_ch++)
1342 {
1343 auto * node_out = _subchannel_mesh.getChannelNode(i_ch, iz);
1344 auto * node_in = _subchannel_mesh.getChannelNode(i_ch, iz - 1);
1345 // update Pressure solution
1346 // Note: assuming uniform axial discretization in the curren code
1347 // We will need to update this later if we allow non-uniform refinements in the axial
1348 // direction
1349 PetscScalar Pe = 0.5;
1350 auto alpha = computeInterpolationCoefficients(Pe);
1351 if (iz == last_node)
1352 {
1353 _P_soln->set(node_in, (*_P_soln)(node_out) + _DP(i_ch, iz) / 2.0);
1354 }
1355 else
1356 {
1357 _P_soln->set(node_in,
1358 (*_P_soln)(node_out) + (1.0 - alpha) * _DP(i_ch, iz) +
1359 alpha * _DP(i_ch, iz - 1));
1360 }
1361 }
1362 }
1363 }
1364 }
1365 else
1366 {
1368 {
1369 LibmeshPetscCall(VecZeroEntries(_amc_pressure_force_rhs));
1370 for (unsigned int iz = last_node; iz > first_node - 1; iz--)
1371 {
1372 auto iz_ind = iz - first_node;
1373 // Calculate pressure in the inlet of the cell assuming known outlet
1374 for (unsigned int i_ch = 0; i_ch < _n_channels; i_ch++)
1375 {
1376 auto * node_out = _subchannel_mesh.getChannelNode(i_ch, iz);
1377 auto * node_in = _subchannel_mesh.getChannelNode(i_ch, iz - 1);
1378
1379 // inlet, outlet, and interpolated axial surface area
1380 auto S_in = (*_S_flow_soln)(node_in);
1381 auto S_out = (*_S_flow_soln)(node_out);
1382 auto S_interp = computeInterpolatedValue(S_out, S_in, 0.5);
1383
1384 // Creating matrix of coefficients
1385 PetscInt row = i_ch + _n_channels * iz_ind;
1386 PetscInt col = i_ch + _n_channels * iz_ind;
1387 PetscScalar value = -1.0 * S_interp;
1388 LibmeshPetscCall(
1389 MatSetValues(_amc_pressure_force_mat, 1, &row, 1, &col, &value, INSERT_VALUES));
1390
1391 if (iz == last_node)
1392 {
1393 PetscScalar value = -1.0 * (*_P_soln)(node_out)*S_interp;
1394 PetscInt row = i_ch + _n_channels * iz_ind;
1395 LibmeshPetscCall(VecSetValues(_amc_pressure_force_rhs, 1, &row, &value, ADD_VALUES));
1396 }
1397 else
1398 {
1399 PetscInt row = i_ch + _n_channels * iz_ind;
1400 PetscInt col = i_ch + _n_channels * (iz_ind + 1);
1401 PetscScalar value = 1.0 * S_interp;
1402 LibmeshPetscCall(
1403 MatSetValues(_amc_pressure_force_mat, 1, &row, 1, &col, &value, INSERT_VALUES));
1404 }
1405
1406 if (_segregated_bool)
1407 {
1408 auto dp_out = _DP(i_ch, iz);
1409 PetscScalar value_v = -1.0 * dp_out * S_interp;
1410 PetscInt row_v = i_ch + _n_channels * iz_ind;
1411 LibmeshPetscCall(
1412 VecSetValues(_amc_pressure_force_rhs, 1, &row_v, &value_v, ADD_VALUES));
1413 }
1414 }
1415 }
1416 // Solving pressure problem
1417 LibmeshPetscCall(MatAssemblyBegin(_amc_pressure_force_mat, MAT_FINAL_ASSEMBLY));
1418 LibmeshPetscCall(MatAssemblyEnd(_amc_pressure_force_mat, MAT_FINAL_ASSEMBLY));
1419 if (_segregated_bool)
1420 {
1421 KSP ksploc;
1422 PC pc;
1423 Vec sol;
1424 LibmeshPetscCall(VecDuplicate(_amc_pressure_force_rhs, &sol));
1425 LibmeshPetscCall(KSPCreate(PETSC_COMM_SELF, &ksploc));
1426 LibmeshPetscCall(KSPSetOperators(ksploc, _amc_pressure_force_mat, _amc_pressure_force_mat));
1427 LibmeshPetscCall(KSPGetPC(ksploc, &pc));
1428 LibmeshPetscCall(PCSetType(pc, PCJACOBI));
1429 LibmeshPetscCall(KSPSetTolerances(ksploc, _rtol, _atol, _dtol, _maxit));
1430 LibmeshPetscCall(KSPSetFromOptions(ksploc));
1431 LibmeshPetscCall(KSPSolve(ksploc, _amc_pressure_force_rhs, sol));
1432 PetscScalar * xx;
1433 LibmeshPetscCall(VecGetArray(sol, &xx));
1434 // update Pressure solution
1435 for (unsigned int iz = last_node; iz > first_node - 1; iz--)
1436 {
1437 auto iz_ind = iz - first_node;
1438 for (unsigned int i_ch = 0; i_ch < _n_channels; i_ch++)
1439 {
1440 auto * node_in = _subchannel_mesh.getChannelNode(i_ch, iz - 1);
1441 PetscScalar value = xx[iz_ind * _n_channels + i_ch];
1442 _P_soln->set(node_in, value);
1443 }
1444 }
1445 LibmeshPetscCall(VecZeroEntries(_amc_pressure_force_rhs));
1446 LibmeshPetscCall(KSPDestroy(&ksploc));
1447 LibmeshPetscCall(VecDestroy(&sol));
1448 }
1449 }
1450 else
1451 {
1452 LibmeshPetscCall(VecZeroEntries(_amc_pressure_force_rhs));
1453 for (unsigned int iz = last_node; iz > first_node - 1; iz--)
1454 {
1455 auto iz_ind = iz - first_node;
1456 // Calculate pressure in the inlet of the cell assuming known outlet
1457 for (unsigned int i_ch = 0; i_ch < _n_channels; i_ch++)
1458 {
1459 auto * node_out = _subchannel_mesh.getChannelNode(i_ch, iz);
1460 auto * node_in = _subchannel_mesh.getChannelNode(i_ch, iz - 1);
1461
1462 // inlet, outlet, and interpolated axial surface area
1463 auto S_in = (*_S_flow_soln)(node_in);
1464 auto S_out = (*_S_flow_soln)(node_out);
1465 auto S_interp = computeInterpolatedValue(S_out, S_in, 0.5);
1466
1467 // Creating matrix of coefficients
1468 PetscInt row = i_ch + _n_channels * iz_ind;
1469 PetscInt col = i_ch + _n_channels * iz_ind;
1470 PetscScalar value = -1.0 * S_interp;
1471 LibmeshPetscCall(
1472 MatSetValues(_amc_pressure_force_mat, 1, &row, 1, &col, &value, INSERT_VALUES));
1473
1474 if (iz == last_node)
1475 {
1476 PetscScalar value = -1.0 * (*_P_soln)(node_out)*S_interp;
1477 PetscInt row = i_ch + _n_channels * iz_ind;
1478 LibmeshPetscCall(VecSetValues(_amc_pressure_force_rhs, 1, &row, &value, ADD_VALUES));
1479
1480 auto dp_out = _DP(i_ch, iz);
1481 PetscScalar value_v = -1.0 * dp_out / 2.0 * S_interp;
1482 PetscInt row_v = i_ch + _n_channels * iz_ind;
1483 LibmeshPetscCall(
1484 VecSetValues(_amc_pressure_force_rhs, 1, &row_v, &value_v, ADD_VALUES));
1485 }
1486 else
1487 {
1488 PetscInt row = i_ch + _n_channels * iz_ind;
1489 PetscInt col = i_ch + _n_channels * (iz_ind + 1);
1490 PetscScalar value = 1.0 * S_interp;
1491 LibmeshPetscCall(
1492 MatSetValues(_amc_pressure_force_mat, 1, &row, 1, &col, &value, INSERT_VALUES));
1493
1494 if (_segregated_bool)
1495 {
1496 auto dp_in = _DP(i_ch, iz - 1);
1497 auto dp_out = _DP(i_ch, iz);
1498 auto dp_interp = computeInterpolatedValue(dp_out, dp_in, 0.5);
1499 PetscScalar value_v = -1.0 * dp_interp * S_interp;
1500 PetscInt row_v = i_ch + _n_channels * iz_ind;
1501 LibmeshPetscCall(
1502 VecSetValues(_amc_pressure_force_rhs, 1, &row_v, &value_v, ADD_VALUES));
1503 }
1504 }
1505 }
1506 }
1507 // Solving pressure problem
1508 LibmeshPetscCall(MatAssemblyBegin(_amc_pressure_force_mat, MAT_FINAL_ASSEMBLY));
1509 LibmeshPetscCall(MatAssemblyEnd(_amc_pressure_force_mat, MAT_FINAL_ASSEMBLY));
1511 _console << "Block: " << iblock << " - Axial momentum pressure force matrix assembled"
1512 << std::endl;
1513
1514 if (_segregated_bool)
1515 {
1516 KSP ksploc;
1517 PC pc;
1518 Vec sol;
1519 LibmeshPetscCall(VecDuplicate(_amc_pressure_force_rhs, &sol));
1520 LibmeshPetscCall(KSPCreate(PETSC_COMM_SELF, &ksploc));
1521 LibmeshPetscCall(KSPSetOperators(ksploc, _amc_pressure_force_mat, _amc_pressure_force_mat));
1522 LibmeshPetscCall(KSPGetPC(ksploc, &pc));
1523 LibmeshPetscCall(PCSetType(pc, PCJACOBI));
1524 LibmeshPetscCall(KSPSetTolerances(ksploc, _rtol, _atol, _dtol, _maxit));
1525 LibmeshPetscCall(KSPSetFromOptions(ksploc));
1526 LibmeshPetscCall(KSPSolve(ksploc, _amc_pressure_force_rhs, sol));
1527 PetscScalar * xx;
1528 LibmeshPetscCall(VecGetArray(sol, &xx));
1529 // update Pressure solution
1530 for (unsigned int iz = last_node; iz > first_node - 1; iz--)
1531 {
1532 auto iz_ind = iz - first_node;
1533 for (unsigned int i_ch = 0; i_ch < _n_channels; i_ch++)
1534 {
1535 auto * node_in = _subchannel_mesh.getChannelNode(i_ch, iz - 1);
1536 PetscScalar value = xx[iz_ind * _n_channels + i_ch];
1537 _P_soln->set(node_in, value);
1538 }
1539 }
1540 LibmeshPetscCall(VecZeroEntries(_amc_pressure_force_rhs));
1541 LibmeshPetscCall(KSPDestroy(&ksploc));
1542 LibmeshPetscCall(VecDestroy(&sol));
1543 }
1544 }
1545 }
1546}
const bool _staggered_pressure_bool
Flag to define the usage of staggered or collocated pressure.

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

◆ computeRho()

void SubChannel1PhaseProblem::computeRho ( int  iblock)
protectedinherited

Computes Density 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 _rho_soln->set(node, _fp->rho_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 _rho_soln->set(node, _fp->rho_from_p_T((*_P_soln)(node) + _P_out, (*_T_soln)(node)));
1602 }
1603 }
1604}

Referenced by SubChannel1PhaseProblem::externalSolve().

◆ computeSumWij()

void SubChannel1PhaseProblem::computeSumWij ( int  iblock)
protectedinherited

Computes net diversion crossflow per channel for block iblock.

Definition at line 621 of file SubChannel1PhaseProblem.C.

622{
623 const unsigned int last_node = (iblock + 1) * _block_size;
624 const unsigned int first_node = iblock * _block_size + 1;
625 // Add to solution vector if explicit
626 if (!_implicit_bool)
627 {
628 for (unsigned int iz = first_node; iz < last_node + 1; iz++)
629 {
630 for (unsigned int i_ch = 0; i_ch < _n_channels; i_ch++)
631 {
632 auto * node_out = _subchannel_mesh.getChannelNode(i_ch, iz);
633 Real sumWij = 0.0;
634 // Calculate sum of crossflow into channel i from channels j around i
635 unsigned int counter = 0;
636 for (auto i_gap : _subchannel_mesh.getChannelGaps(i_ch))
637 {
638 sumWij += _subchannel_mesh.getCrossflowSign(i_ch, counter) * _Wij(i_gap, iz);
639 counter++;
640 }
641 // The net crossflow coming out of cell i [kg/sec]
642 _SumWij_soln->set(node_out, sumWij);
643 }
644 }
645 }
646 // Add to matrix if implicit
647 else
648 {
649 LibmeshPetscCall(MatZeroEntries(_mc_density_pressure_mat));
650 for (unsigned int iz = first_node; iz < last_node + 1; iz++)
651 {
652 unsigned int iz_ind = iz - first_node;
653 for (unsigned int i_ch = 0; i_ch < _n_channels; i_ch++)
654 {
655 // Calculate sum of crossflow into channel i from channels j around i
656 unsigned int counter = 0;
657 for (auto i_gap : _subchannel_mesh.getChannelGaps(i_ch))
658 {
659 PetscInt row = i_ch + _n_channels * iz_ind;
660 PetscInt col = i_gap + _n_gaps * iz_ind;
661 PetscScalar value = _subchannel_mesh.getCrossflowSign(i_ch, counter);
662 LibmeshPetscCall(MatSetValues(_mc_sumWij_mat, 1, &row, 1, &col, &value, INSERT_VALUES));
663 counter++;
664 }
665 }
666 }
667 LibmeshPetscCall(MatAssemblyBegin(_mc_sumWij_mat, MAT_FINAL_ASSEMBLY));
668 LibmeshPetscCall(MatAssemblyEnd(_mc_sumWij_mat, MAT_FINAL_ASSEMBLY));
670 {
671 Vec loc_prod;
672 Vec loc_Wij;
673 LibmeshPetscCall(VecDuplicate(_amc_sys_mdot_rhs, &loc_prod));
674 LibmeshPetscCall(VecDuplicate(_Wij_vec, &loc_Wij));
676 loc_Wij, _Wij, first_node, last_node, _n_gaps));
677 LibmeshPetscCall(MatMult(_mc_sumWij_mat, loc_Wij, loc_prod));
678 LibmeshPetscCall(populateSolutionChan<SolutionHandle>(
679 loc_prod, *_SumWij_soln, first_node, last_node, _n_channels));
680 LibmeshPetscCall(VecDestroy(&loc_prod));
681 LibmeshPetscCall(VecDestroy(&loc_Wij));
682 }
683 }
684}
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 2067 of file SubChannel1PhaseProblem.C.

2068{
2069 auto beta = _mixing_closure->computeSweepFlowMixingParameter(i_gap, iz);
2070 if (!std::isfinite(beta) || beta < 0.0)
2071 mooseError(name(),
2072 ": Mixing closure returned invalid sweep-flow coefficient = ",
2073 beta,
2074 " for gap ",
2075 i_gap,
2076 " at axial index ",
2077 iz,
2078 ". sweep-flow coefficient must be finite and non-negative.");
2079
2080 return beta;
2081}
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 TriSubChannel1PhaseProblem::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 1549 of file SubChannel1PhaseProblem.C.

1550{
1551 const unsigned int last_node = (iblock + 1) * _block_size;
1552 const unsigned int first_node = iblock * _block_size + 1;
1553 std::vector<Real> residual;
1554 residual.reserve(_block_size * _n_channels);
1555 Real residual_norm_sq = 0.0;
1556 Real temperature_norm_sq = 0.0;
1557 for (unsigned int iz = first_node; iz < last_node + 1; iz++)
1558 {
1559 for (unsigned int i_ch = 0; i_ch < _n_channels; i_ch++)
1560 {
1561 auto * node = _subchannel_mesh.getChannelNode(i_ch, iz);
1562 const Real T = (*_T_soln)(node);
1563 const Real T_from_ph = _fp->T_from_p_h((*_P_soln)(node) + _P_out, (*_h_soln)(node));
1564 residual.push_back(T_from_ph - T);
1565 residual_norm_sq += Utility::pow<2>(residual.back());
1566 temperature_norm_sq += Utility::pow<2>(T);
1567 }
1568 }
1569
1570 // Set the temperature solution with relaxation if needed
1571 std::size_t i = 0;
1572 for (unsigned int iz = first_node; iz < last_node + 1; iz++)
1573 for (unsigned int i_ch = 0; i_ch < _n_channels; i_ch++)
1574 {
1575 auto * node = _subchannel_mesh.getChannelNode(i_ch, iz);
1576 _T_soln->set(node, (*_T_soln)(node) + _T_relaxation * residual[i]);
1577 ++i;
1578 }
1579
1580 return std::sqrt(residual_norm_sq) / (std::sqrt(temperature_norm_sq) + 1e-14);
1581}
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 588 of file SubChannel1PhaseProblem.C.

589{
590 const unsigned int last_node = (iblock + 1) * _block_size;
591 const unsigned int first_node = iblock * _block_size + 1;
592 // Initial guess, port crossflow of block (iblock) into a vector that will act as my initial guess
593 libMesh::DenseVector<Real> solution_seed(_n_gaps * _block_size, 0.0);
594 for (unsigned int iz = first_node; iz < last_node + 1; iz++)
595 {
596 for (unsigned int i_gap = 0; i_gap < _n_gaps; i_gap++)
597 {
598 int i = _n_gaps * (iz - first_node) + i_gap; // column wise transfer
599 solution_seed(i) = _Wij(i_gap, iz);
600 }
601 }
602
603 // Solving the combined lateral momentum equation for Wij using a PETSc solver and update vector
604 // root
606 LibmeshPetscCall(petscSnesSolver(iblock, solution_seed, root));
607
608 // Assign the solution to the cross-flow matrix
609 int i = 0;
610 for (unsigned int iz = first_node; iz < last_node + 1; iz++)
611 {
612 for (unsigned int i_gap = 0; i_gap < _n_gaps; i_gap++)
613 {
614 _Wij(i_gap, iz) = root(i);
615 i++;
616 }
617 }
618}
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 1949 of file SubChannel1PhaseProblem.C.

1950{
1951 const unsigned int last_node = (iblock + 1) * _block_size;
1952 const unsigned int first_node = iblock * _block_size + 1;
1953 _mixing_closure->computeBlockMixingParameters(first_node, last_node);
1954 for (unsigned int iz = first_node; iz < last_node + 1; iz++)
1955 {
1956 auto dz = _z_grid[iz] - _z_grid[iz - 1];
1957 for (unsigned int i_gap = 0; i_gap < _n_gaps; i_gap++)
1958 {
1959 auto chans = _subchannel_mesh.getGapChannels(i_gap);
1960 unsigned int i_ch = chans.first;
1961 unsigned int j_ch = chans.second;
1962 auto * node_in_i = _subchannel_mesh.getChannelNode(i_ch, iz - 1);
1963 auto * node_out_i = _subchannel_mesh.getChannelNode(i_ch, iz);
1964 auto * node_in_j = _subchannel_mesh.getChannelNode(j_ch, iz - 1);
1965 auto * node_out_j = _subchannel_mesh.getChannelNode(j_ch, iz);
1966 auto Si_in = (*_S_flow_soln)(node_in_i);
1967 auto Sj_in = (*_S_flow_soln)(node_in_j);
1968 auto Si_out = (*_S_flow_soln)(node_out_i);
1969 auto Sj_out = (*_S_flow_soln)(node_out_j);
1970 auto gap = _subchannel_mesh.getGapWidth(iz, i_gap);
1971 auto Sij = dz * gap;
1972 // Mass flux of the gap: total mass flow rate of the two subchannels over their total flow
1973 // area, averaged over the inlet and outlet of the cell. This is the area-weighted mean of rho
1974 // V of the two subchannels; Eq. (30) of Pacio et al. (2022) uses the arithmetic mean rho (V_i
1975 // + V_j) / 2, which differs when the two subchannels have different flow areas
1976 auto avg_massflux =
1977 0.5 * (((*_mdot_soln)(node_in_i) + (*_mdot_soln)(node_in_j)) / (Si_in + Sj_in) +
1978 ((*_mdot_soln)(node_out_i) + (*_mdot_soln)(node_out_j)) / (Si_out + Sj_out));
1979 auto beta = computeMixingParameter(i_gap, iz);
1980
1981 if (!_implicit_bool)
1982 {
1983 _WijPrime(i_gap, iz) = beta * avg_massflux * Sij;
1984 }
1985 else
1986 {
1987 auto iz_ind = iz - first_node;
1988 PetscScalar base_value = beta * 0.5 * Sij;
1989
1990 // Bottom values
1991 if (iz == first_node)
1992 {
1993 PetscScalar value_tl = -1.0 * base_value / (Si_in + Sj_in) *
1994 ((*_mdot_soln)(node_in_i) + (*_mdot_soln)(node_in_j));
1995 PetscInt row = i_gap + _n_gaps * iz_ind;
1996 LibmeshPetscCall(
1997 VecSetValues(_amc_turbulent_cross_flows_rhs, 1, &row, &value_tl, INSERT_VALUES));
1998 }
1999 else
2000 {
2001 PetscScalar value_tl = base_value / (Si_in + Sj_in);
2002 PetscInt row = i_gap + _n_gaps * iz_ind;
2003
2004 PetscInt col_ich = i_ch + _n_channels * (iz_ind - 1);
2005 LibmeshPetscCall(MatSetValues(
2006 _amc_turbulent_cross_flows_mat, 1, &row, 1, &col_ich, &value_tl, INSERT_VALUES));
2007
2008 PetscInt col_jch = j_ch + _n_channels * (iz_ind - 1);
2009 LibmeshPetscCall(MatSetValues(
2010 _amc_turbulent_cross_flows_mat, 1, &row, 1, &col_jch, &value_tl, INSERT_VALUES));
2011 }
2012
2013 // Top values
2014 PetscScalar value_bl = base_value / (Si_out + Sj_out);
2015 PetscInt row = i_gap + _n_gaps * iz_ind;
2016
2017 PetscInt col_ich = i_ch + _n_channels * iz_ind;
2018 LibmeshPetscCall(MatSetValues(
2019 _amc_turbulent_cross_flows_mat, 1, &row, 1, &col_ich, &value_bl, INSERT_VALUES));
2020
2021 PetscInt col_jch = j_ch + _n_channels * iz_ind;
2022 LibmeshPetscCall(MatSetValues(
2023 _amc_turbulent_cross_flows_mat, 1, &row, 1, &col_jch, &value_bl, INSERT_VALUES));
2024 }
2025 }
2026 }
2027
2028 if (_implicit_bool)
2029 {
2030 LibmeshPetscCall(MatAssemblyBegin(_amc_turbulent_cross_flows_mat, MAT_FINAL_ASSEMBLY));
2031 LibmeshPetscCall(MatAssemblyEnd(_amc_turbulent_cross_flows_mat, MAT_FINAL_ASSEMBLY));
2032
2034 Vec loc_prod;
2035 Vec loc_Wij;
2036 LibmeshPetscCall(VecDuplicate(_amc_sys_mdot_rhs, &loc_prod));
2037 LibmeshPetscCall(VecDuplicate(_Wij_vec, &loc_Wij));
2038 LibmeshPetscCall(populateVectorFromHandle<SolutionHandle>(
2039 loc_prod, *_mdot_soln, first_node, last_node, _n_channels));
2040 LibmeshPetscCall(MatMult(_amc_turbulent_cross_flows_mat, loc_prod, loc_Wij));
2041 LibmeshPetscCall(VecAXPY(loc_Wij, -1.0, _amc_turbulent_cross_flows_rhs));
2043 loc_Wij, _WijPrime, first_node, last_node, _n_gaps));
2044 LibmeshPetscCall(VecDestroy(&loc_prod));
2045 LibmeshPetscCall(VecDestroy(&loc_Wij));
2046 }
2047}
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...
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.
virtual Real getGapWidth(unsigned int axial_index, unsigned int gap_index) const =0
Return gap width for a given gap index.

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 1630 of file SubChannel1PhaseProblem.C.

1631{
1632 const unsigned int last_node = (iblock + 1) * _block_size;
1633 const unsigned int first_node = iblock * _block_size + 1;
1634 // Cross flow residual
1635 if (!_implicit_bool)
1636 {
1637 const Real & pitch = _subchannel_mesh.getPitch();
1638 for (unsigned int iz = first_node; iz < last_node + 1; iz++)
1639 {
1640 auto dz = _z_grid[iz] - _z_grid[iz - 1];
1641 for (unsigned int i_gap = 0; i_gap < _n_gaps; i_gap++)
1642 {
1643 auto chans = _subchannel_mesh.getGapChannels(i_gap);
1644 unsigned int i_ch = chans.first;
1645 unsigned int j_ch = chans.second;
1646 auto * node_in_i = _subchannel_mesh.getChannelNode(i_ch, iz - 1);
1647 auto * node_out_i = _subchannel_mesh.getChannelNode(i_ch, iz);
1648 auto * node_in_j = _subchannel_mesh.getChannelNode(j_ch, iz - 1);
1649 auto * node_out_j = _subchannel_mesh.getChannelNode(j_ch, iz);
1650 auto rho_i = (*_rho_soln)(node_in_i);
1651 auto rho_j = (*_rho_soln)(node_in_j);
1652 auto Si = (*_S_flow_soln)(node_in_i);
1653 auto Sj = (*_S_flow_soln)(node_in_j);
1654 auto Sij = dz * _subchannel_mesh.getGapWidth(iz, i_gap);
1655 auto Lij = pitch;
1656 // total local form loss in the ij direction
1657 auto friction_term = _kij * _Wij(i_gap, iz) * std::abs(_Wij(i_gap, iz));
1658 auto DPij = (*_P_soln)(node_in_i) - (*_P_soln)(node_in_j);
1659 // Figure out donor cell density
1660 auto rho_star = 0.0;
1661 if (_Wij(i_gap, iz) > 0.0)
1662 rho_star = rho_i;
1663 else if (_Wij(i_gap, iz) < 0.0)
1664 rho_star = rho_j;
1665 else
1666 rho_star = (rho_i + rho_j) / 2.0;
1667 auto mass_term_out =
1668 (*_mdot_soln)(node_out_i) / (*_S_flow_soln)(node_out_i) / (*_rho_soln)(node_out_i) +
1669 (*_mdot_soln)(node_out_j) / (*_S_flow_soln)(node_out_j) / (*_rho_soln)(node_out_j);
1670 auto mass_term_in =
1671 (*_mdot_soln)(node_in_i) / Si / rho_i + (*_mdot_soln)(node_in_j) / Sj / rho_j;
1672 auto term_out = Sij * rho_star * (Lij / dz) * mass_term_out * _Wij(i_gap, iz);
1673 auto term_in = Sij * rho_star * (Lij / dz) * mass_term_in * _Wij(i_gap, iz - 1);
1674 auto inertia_term = term_out - term_in;
1675 auto pressure_term = 2 * Utility::pow<2>(Sij) * DPij * rho_star;
1676 auto time_term =
1677 _TR * 2.0 * (_Wij(i_gap, iz) - _Wij_old(i_gap, iz)) * Lij * Sij * rho_star / _dt;
1678
1679 _Wij_residual_matrix(i_gap, iz - 1 - iblock * _block_size) =
1680 time_term + friction_term + inertia_term - pressure_term;
1681 }
1682 }
1683 }
1684 else
1685 {
1686 // Initializing to zero the elements of the lateral momentum assembly
1687 LibmeshPetscCall(MatZeroEntries(_cmc_time_derivative_mat));
1688 LibmeshPetscCall(MatZeroEntries(_cmc_advective_derivative_mat));
1689 LibmeshPetscCall(MatZeroEntries(_cmc_friction_force_mat));
1690 LibmeshPetscCall(MatZeroEntries(_cmc_pressure_force_mat));
1691 LibmeshPetscCall(VecZeroEntries(_cmc_time_derivative_rhs));
1692 LibmeshPetscCall(VecZeroEntries(_cmc_advective_derivative_rhs));
1693 LibmeshPetscCall(VecZeroEntries(_cmc_friction_force_rhs));
1694 LibmeshPetscCall(VecZeroEntries(_cmc_pressure_force_rhs));
1695 LibmeshPetscCall(MatZeroEntries(_cmc_sys_Wij_mat));
1696 LibmeshPetscCall(VecZeroEntries(_cmc_sys_Wij_rhs));
1697 const Real & pitch = _subchannel_mesh.getPitch();
1698 for (unsigned int iz = first_node; iz < last_node + 1; iz++)
1699 {
1700 auto dz = _z_grid[iz] - _z_grid[iz - 1];
1701 auto iz_ind = iz - first_node;
1702 for (unsigned int i_gap = 0; i_gap < _n_gaps; i_gap++)
1703 {
1704 auto chans = _subchannel_mesh.getGapChannels(i_gap);
1705 unsigned int i_ch = chans.first;
1706 unsigned int j_ch = chans.second;
1707 auto * node_in_i = _subchannel_mesh.getChannelNode(i_ch, iz - 1);
1708 auto * node_out_i = _subchannel_mesh.getChannelNode(i_ch, iz);
1709 auto * node_in_j = _subchannel_mesh.getChannelNode(j_ch, iz - 1);
1710 auto * node_out_j = _subchannel_mesh.getChannelNode(j_ch, iz);
1711
1712 // inlet, outlet, and interpolated densities
1713 auto rho_i_in = (*_rho_soln)(node_in_i);
1714 auto rho_i_out = (*_rho_soln)(node_out_i);
1715 auto rho_i_interp = computeInterpolatedValue(rho_i_out, rho_i_in, 0.5);
1716 auto rho_j_in = (*_rho_soln)(node_in_j);
1717 auto rho_j_out = (*_rho_soln)(node_out_j);
1718 auto rho_j_interp = computeInterpolatedValue(rho_j_out, rho_j_in, 0.5);
1719
1720 // inlet, outlet, and interpolated areas
1721 auto S_i_in = (*_S_flow_soln)(node_in_i);
1722 auto S_i_out = (*_S_flow_soln)(node_out_i);
1723 auto S_j_in = (*_S_flow_soln)(node_in_j);
1724 auto S_j_out = (*_S_flow_soln)(node_out_j);
1725
1726 // Cross-sectional gap area
1727 auto Sij = dz * _subchannel_mesh.getGapWidth(iz, i_gap);
1728 auto Lij = pitch;
1729
1730 // Figure out donor cell density
1731 auto rho_star = 0.0;
1732 if (_Wij(i_gap, iz) > 0.0)
1733 rho_star = rho_i_interp;
1734 else if (_Wij(i_gap, iz) < 0.0)
1735 rho_star = rho_j_interp;
1736 else
1737 rho_star = (rho_i_interp + rho_j_interp) / 2.0;
1738
1739 // Assembling time derivative
1740 PetscScalar time_factor = _TR * Lij * Sij * rho_star / _dt;
1741 PetscInt row_td = i_gap + _n_gaps * iz_ind;
1742 PetscInt col_td = i_gap + _n_gaps * iz_ind;
1743 PetscScalar value_td = time_factor;
1744 LibmeshPetscCall(MatSetValues(
1745 _cmc_time_derivative_mat, 1, &row_td, 1, &col_td, &value_td, INSERT_VALUES));
1746 PetscScalar value_td_rhs = time_factor * _Wij_old(i_gap, iz);
1747 LibmeshPetscCall(
1748 VecSetValues(_cmc_time_derivative_rhs, 1, &row_td, &value_td_rhs, INSERT_VALUES));
1749
1750 // Assembling inertial term
1751 PetscScalar Pe = 0.5;
1752 auto alpha = computeInterpolationCoefficients(Pe);
1753 auto mass_term_out = (*_mdot_soln)(node_out_i) / S_i_out / rho_i_out +
1754 (*_mdot_soln)(node_out_j) / S_j_out / rho_j_out;
1755 auto mass_term_in = (*_mdot_soln)(node_in_i) / S_i_in / rho_i_in +
1756 (*_mdot_soln)(node_in_j) / S_j_in / rho_j_in;
1757 auto term_out = Sij * rho_star * (Lij / dz) * mass_term_out / 2.0;
1758 auto term_in = Sij * rho_star * (Lij / dz) * mass_term_in / 2.0;
1759 if (iz == first_node)
1760 {
1761 PetscInt row_ad = i_gap + _n_gaps * iz_ind;
1762 PetscScalar value_ad = term_in * alpha * _Wij(i_gap, iz - 1);
1763 LibmeshPetscCall(
1764 VecSetValues(_cmc_advective_derivative_rhs, 1, &row_ad, &value_ad, ADD_VALUES));
1765
1766 PetscInt col_ad = i_gap + _n_gaps * iz_ind;
1767 value_ad = -1.0 * term_in * (1.0 - alpha) + term_out * alpha;
1768 LibmeshPetscCall(MatSetValues(
1769 _cmc_advective_derivative_mat, 1, &row_ad, 1, &col_ad, &value_ad, INSERT_VALUES));
1770
1771 col_ad = i_gap + _n_gaps * (iz_ind + 1);
1772 value_ad = term_out * (1.0 - alpha);
1773 LibmeshPetscCall(MatSetValues(
1774 _cmc_advective_derivative_mat, 1, &row_ad, 1, &col_ad, &value_ad, INSERT_VALUES));
1775 }
1776 else if (iz == last_node)
1777 {
1778 PetscInt row_ad = i_gap + _n_gaps * iz_ind;
1779 PetscInt col_ad = i_gap + _n_gaps * (iz_ind - 1);
1780 PetscScalar value_ad = -1.0 * term_in * alpha;
1781 LibmeshPetscCall(MatSetValues(
1782 _cmc_advective_derivative_mat, 1, &row_ad, 1, &col_ad, &value_ad, INSERT_VALUES));
1783
1784 col_ad = i_gap + _n_gaps * iz_ind;
1785 value_ad = -1.0 * term_in * (1.0 - alpha) + term_out * alpha;
1786 LibmeshPetscCall(MatSetValues(
1787 _cmc_advective_derivative_mat, 1, &row_ad, 1, &col_ad, &value_ad, INSERT_VALUES));
1788
1789 value_ad = -1.0 * term_out * (1.0 - alpha) * _Wij(i_gap, iz);
1790 LibmeshPetscCall(
1791 VecSetValues(_cmc_advective_derivative_rhs, 1, &row_ad, &value_ad, ADD_VALUES));
1792 }
1793 else
1794 {
1795 PetscInt row_ad = i_gap + _n_gaps * iz_ind;
1796 PetscInt col_ad = i_gap + _n_gaps * (iz_ind - 1);
1797 PetscScalar value_ad = -1.0 * term_in * alpha;
1798 LibmeshPetscCall(MatSetValues(
1799 _cmc_advective_derivative_mat, 1, &row_ad, 1, &col_ad, &value_ad, INSERT_VALUES));
1800
1801 col_ad = i_gap + _n_gaps * iz_ind;
1802 value_ad = -1.0 * term_in * (1.0 - alpha) + term_out * alpha;
1803 LibmeshPetscCall(MatSetValues(
1804 _cmc_advective_derivative_mat, 1, &row_ad, 1, &col_ad, &value_ad, INSERT_VALUES));
1805
1806 col_ad = i_gap + _n_gaps * (iz_ind + 1);
1807 value_ad = term_out * (1.0 - alpha);
1808 LibmeshPetscCall(MatSetValues(
1809 _cmc_advective_derivative_mat, 1, &row_ad, 1, &col_ad, &value_ad, INSERT_VALUES));
1810 }
1811 // Assembling friction force
1812 PetscInt row_ff = i_gap + _n_gaps * iz_ind;
1813 PetscInt col_ff = i_gap + _n_gaps * iz_ind;
1814 PetscScalar value_ff = _kij * std::abs(_Wij(i_gap, iz)) / 2.0;
1815 LibmeshPetscCall(MatSetValues(
1816 _cmc_friction_force_mat, 1, &row_ff, 1, &col_ff, &value_ff, INSERT_VALUES));
1817
1818 // Assembling pressure force
1820
1822 {
1823 PetscScalar pressure_factor = Utility::pow<2>(Sij) * rho_star;
1824 PetscInt row_pf = i_gap + _n_gaps * iz_ind;
1825 PetscInt col_pf = i_ch + _n_channels * iz_ind;
1826 PetscScalar value_pf = -1.0 * alpha * pressure_factor;
1827 LibmeshPetscCall(
1828 MatSetValues(_cmc_pressure_force_mat, 1, &row_pf, 1, &col_pf, &value_pf, ADD_VALUES));
1829 col_pf = j_ch + _n_channels * iz_ind;
1830 value_pf = alpha * pressure_factor;
1831 LibmeshPetscCall(
1832 MatSetValues(_cmc_pressure_force_mat, 1, &row_pf, 1, &col_pf, &value_pf, ADD_VALUES));
1833
1834 if (iz == last_node)
1835 {
1836 PetscInt row_pf = i_gap + _n_gaps * iz_ind;
1837 PetscScalar value_pf = (1.0 - alpha) * pressure_factor * (*_P_soln)(node_out_i);
1838 LibmeshPetscCall(
1839 VecSetValues(_cmc_pressure_force_rhs, 1, &row_pf, &value_pf, ADD_VALUES));
1840 value_pf = -1.0 * (1.0 - alpha) * pressure_factor * (*_P_soln)(node_out_j);
1841 LibmeshPetscCall(
1842 VecSetValues(_cmc_pressure_force_rhs, 1, &row_pf, &value_pf, ADD_VALUES));
1843 }
1844 else
1845 {
1846 row_pf = i_gap + _n_gaps * iz_ind;
1847 col_pf = i_ch + _n_channels * (iz_ind + 1);
1848 value_pf = -1.0 * (1.0 - alpha) * pressure_factor;
1849 LibmeshPetscCall(MatSetValues(
1850 _cmc_pressure_force_mat, 1, &row_pf, 1, &col_pf, &value_pf, ADD_VALUES));
1851 col_pf = j_ch + _n_channels * (iz_ind + 1);
1852 value_pf = (1.0 - alpha) * pressure_factor;
1853 LibmeshPetscCall(MatSetValues(
1854 _cmc_pressure_force_mat, 1, &row_pf, 1, &col_pf, &value_pf, ADD_VALUES));
1855 }
1856 }
1857 else
1858 {
1859 PetscScalar pressure_factor = Utility::pow<2>(Sij) * rho_star;
1860 PetscInt row_pf = i_gap + _n_gaps * iz_ind;
1861 PetscInt col_pf = i_ch + _n_channels * iz_ind;
1862 PetscScalar value_pf = -1.0 * pressure_factor;
1863 LibmeshPetscCall(
1864 MatSetValues(_cmc_pressure_force_mat, 1, &row_pf, 1, &col_pf, &value_pf, ADD_VALUES));
1865 col_pf = j_ch + _n_channels * iz_ind;
1866 value_pf = pressure_factor;
1867 LibmeshPetscCall(
1868 MatSetValues(_cmc_pressure_force_mat, 1, &row_pf, 1, &col_pf, &value_pf, ADD_VALUES));
1869 }
1870 }
1871 }
1873 LibmeshPetscCall(MatZeroEntries(_cmc_sys_Wij_mat));
1874 LibmeshPetscCall(VecZeroEntries(_cmc_sys_Wij_rhs));
1875 LibmeshPetscCall(MatAssemblyBegin(_cmc_time_derivative_mat, MAT_FINAL_ASSEMBLY));
1876 LibmeshPetscCall(MatAssemblyEnd(_cmc_time_derivative_mat, MAT_FINAL_ASSEMBLY));
1877 LibmeshPetscCall(MatAssemblyBegin(_cmc_advective_derivative_mat, MAT_FINAL_ASSEMBLY));
1878 LibmeshPetscCall(MatAssemblyEnd(_cmc_advective_derivative_mat, MAT_FINAL_ASSEMBLY));
1879 LibmeshPetscCall(MatAssemblyBegin(_cmc_friction_force_mat, MAT_FINAL_ASSEMBLY));
1880 LibmeshPetscCall(MatAssemblyEnd(_cmc_friction_force_mat, MAT_FINAL_ASSEMBLY));
1881 LibmeshPetscCall(MatAssemblyBegin(_cmc_pressure_force_mat, MAT_FINAL_ASSEMBLY));
1882 LibmeshPetscCall(MatAssemblyEnd(_cmc_pressure_force_mat, MAT_FINAL_ASSEMBLY));
1883 LibmeshPetscCall(MatAssemblyBegin(_cmc_sys_Wij_mat, MAT_FINAL_ASSEMBLY));
1884 LibmeshPetscCall(MatAssemblyEnd(_cmc_sys_Wij_mat, MAT_FINAL_ASSEMBLY));
1885 // Matrix
1886#if !PETSC_VERSION_LESS_THAN(3, 15, 0)
1887 LibmeshPetscCall(
1888 MatAXPY(_cmc_sys_Wij_mat, 1.0, _cmc_time_derivative_mat, UNKNOWN_NONZERO_PATTERN));
1889 LibmeshPetscCall(MatAssemblyBegin(_cmc_sys_Wij_mat, MAT_FINAL_ASSEMBLY));
1890 LibmeshPetscCall(MatAssemblyEnd(_cmc_sys_Wij_mat, MAT_FINAL_ASSEMBLY));
1891 LibmeshPetscCall(
1892 MatAXPY(_cmc_sys_Wij_mat, 1.0, _cmc_advective_derivative_mat, UNKNOWN_NONZERO_PATTERN));
1893 LibmeshPetscCall(MatAssemblyBegin(_cmc_sys_Wij_mat, MAT_FINAL_ASSEMBLY));
1894 LibmeshPetscCall(MatAssemblyEnd(_cmc_sys_Wij_mat, MAT_FINAL_ASSEMBLY));
1895 LibmeshPetscCall(
1896 MatAXPY(_cmc_sys_Wij_mat, 1.0, _cmc_friction_force_mat, UNKNOWN_NONZERO_PATTERN));
1897#else
1898 LibmeshPetscCall(
1899 MatAXPY(_cmc_sys_Wij_mat, 1.0, _cmc_time_derivative_mat, DIFFERENT_NONZERO_PATTERN));
1900 LibmeshPetscCall(MatAssemblyBegin(_cmc_sys_Wij_mat, MAT_FINAL_ASSEMBLY));
1901 LibmeshPetscCall(MatAssemblyEnd(_cmc_sys_Wij_mat, MAT_FINAL_ASSEMBLY));
1902 LibmeshPetscCall(
1903 MatAXPY(_cmc_sys_Wij_mat, 1.0, _cmc_advective_derivative_mat, DIFFERENT_NONZERO_PATTERN));
1904 LibmeshPetscCall(MatAssemblyBegin(_cmc_sys_Wij_mat, MAT_FINAL_ASSEMBLY));
1905 LibmeshPetscCall(MatAssemblyEnd(_cmc_sys_Wij_mat, MAT_FINAL_ASSEMBLY));
1906 LibmeshPetscCall(
1907 MatAXPY(_cmc_sys_Wij_mat, 1.0, _cmc_friction_force_mat, DIFFERENT_NONZERO_PATTERN));
1908#endif
1909 LibmeshPetscCall(MatAssemblyBegin(_cmc_sys_Wij_mat, MAT_FINAL_ASSEMBLY));
1910 LibmeshPetscCall(MatAssemblyEnd(_cmc_sys_Wij_mat, MAT_FINAL_ASSEMBLY));
1911 // RHS
1912 LibmeshPetscCall(VecAXPY(_cmc_sys_Wij_rhs, 1.0, _cmc_time_derivative_rhs));
1913 LibmeshPetscCall(VecAXPY(_cmc_sys_Wij_rhs, 1.0, _cmc_advective_derivative_rhs));
1914 LibmeshPetscCall(VecAXPY(_cmc_sys_Wij_rhs, 1.0, _cmc_friction_force_rhs));
1915
1916 if (_segregated_bool)
1917 {
1918 // Assembly the matrix system
1919 Vec sol_holder_P;
1920 LibmeshPetscCall(createPetscVector(sol_holder_P, _block_size * _n_gaps));
1921 Vec sol_holder_W;
1922 LibmeshPetscCall(createPetscVector(sol_holder_W, _block_size * _n_gaps));
1923 LibmeshPetscCall(populateVectorFromHandle<SolutionHandle>(
1924 _prodp, *_P_soln, first_node - 1, last_node - 1, _n_channels));
1926 _Wij_vec, _Wij, first_node, last_node, _n_gaps));
1927 LibmeshPetscCall(MatMult(_cmc_sys_Wij_mat, _Wij_vec, sol_holder_W));
1928 LibmeshPetscCall(VecAXPY(sol_holder_W, -1.0, _cmc_sys_Wij_rhs));
1929 LibmeshPetscCall(MatMult(_cmc_pressure_force_mat, _prodp, sol_holder_P));
1930 LibmeshPetscCall(VecAXPY(sol_holder_P, -1.0, _cmc_pressure_force_rhs));
1931 LibmeshPetscCall(VecAXPY(sol_holder_W, 1.0, sol_holder_P));
1932 PetscScalar * xx;
1933 LibmeshPetscCall(VecGetArray(sol_holder_W, &xx));
1934 for (unsigned int iz = first_node; iz < last_node + 1; iz++)
1935 {
1936 auto iz_ind = iz - first_node;
1937 for (unsigned int i_gap = 0; i_gap < _n_gaps; i_gap++)
1938 {
1939 _Wij_residual_matrix(i_gap, iz - 1 - iblock * _block_size) = xx[iz_ind * _n_gaps + i_gap];
1940 }
1941 }
1942 LibmeshPetscCall(VecDestroy(&sol_holder_P));
1943 LibmeshPetscCall(VecDestroy(&sol_holder_W));
1944 }
1945 }
1946}
PetscErrorCode createPetscVector(Vec &v, PetscInt n)
Petsc Functions.
libMesh::DenseMatrix< Real > _Wij_residual_matrix
libMesh::DenseMatrix< Real > & _Wij_old
virtual const Real & getPitch() const
Return the undeformed pitch between 2 subchannels.

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

◆ createPetscMatrix()

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

Definition at line 327 of file SubChannel1PhaseProblem.h.

328 {
330 LibmeshPetscCall(MatCreate(PETSC_COMM_SELF, &M));
331 LibmeshPetscCall(MatSetSizes(M, PETSC_DECIDE, PETSC_DECIDE, n, m));
332 LibmeshPetscCall(MatSetFromOptions(M));
333 LibmeshPetscCall(MatSetUp(M));
334 PetscFunctionReturn(LIBMESH_PETSC_SUCCESS);
335 }
const double M

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

◆ createPetscVector()

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

Petsc Functions.

Definition at line 316 of file SubChannel1PhaseProblem.h.

317 {
319 LibmeshPetscCall(VecCreate(PETSC_COMM_SELF, &v));
320 LibmeshPetscCall(PetscObjectSetName((PetscObject)v, "Solution"));
321 LibmeshPetscCall(VecSetSizes(v, PETSC_DECIDE, n));
322 LibmeshPetscCall(VecSetFromOptions(v));
323 LibmeshPetscCall(VecZeroEntries(v));
324 PetscFunctionReturn(LIBMESH_PETSC_SUCCESS);
325 }
const double v

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

◆ detectDeformation()

void SubChannel1PhaseProblem::detectDeformation ( )
protectedinherited

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

Definition at line 455 of file SubChannel1PhaseProblem.C.

456{
458 const auto pin_diameter = _subchannel_mesh.getPinDiameter();
459
460 if (_pin_mesh_exist)
461 {
462 for (unsigned int iz = 0; iz < _n_cells + 1; iz++)
463 for (unsigned int i_pin = 0; i_pin < _n_pins; i_pin++)
464 {
465 auto * node = _subchannel_mesh.getPinNode(i_pin, iz);
466 const Real Dpin = (*_Dpin_soln)(node);
467 if (std::abs(Dpin) <= tol)
468 mooseError("Dpin is zero at node ",
469 node->id(),
470 ". You must initialize Dpin to a non-zero value.");
471 if (std::abs(Dpin - pin_diameter) > tol)
472 _deformation = true;
473 }
474 }
475
476 for (unsigned int iz = 0; iz < _n_cells + 1 && !_deformation; iz++)
477 for (unsigned int i_ch = 0; i_ch < _n_channels && !_deformation; i_ch++)
478 {
479 auto * node = _subchannel_mesh.getChannelNode(i_ch, iz);
480 auto subch_type = _subchannel_mesh.getSubchannelType(i_ch);
481
482 if ((subch_type == EChannelType::CORNER || subch_type == EChannelType::EDGE) &&
483 std::abs((*_displacement_soln)(node)) > tol)
484 _deformation = true;
485 }
486}
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,...
virtual const Real & getPinDiameter() const
Return undeformed Pin diameter.
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.
static constexpr Real TOLERANCE

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

◆ externalSolve()

void SubChannel1PhaseProblem::externalSolve ( )
overridevirtualinherited

Assigning temperatures to duct

Implements ExternalProblem.

Definition at line 2758 of file SubChannel1PhaseProblem.C.

2759{
2760 _console << "Executing subchannel solver\n";
2761 _dt = (isTransient() ? dt() : _one);
2762 _TR = isTransient();
2763
2764 // The subchannel solver hardcodes a first-order backward (implicit) Euler time discretization, so
2765 // any other time integrator a user selects is silently ignored. Warn once if one is requested.
2767 {
2769 if (isTransient())
2770 if (auto * transient = dynamic_cast<TransientBase *>(_app.getExecutioner()))
2771 for (const auto * ti : transient->getTimeIntegrators())
2772 if (!dynamic_cast<const ImplicitEuler *>(ti))
2773 mooseWarning("The subchannel solver always uses implicit (backward) Euler time "
2774 "integration; the requested '",
2775 ti->type(),
2776 "' time integrator is ignored.");
2777 }
2778
2781 // Small helper functions to reduce repetition
2782 // Verbose print helper (no-op unless _verbose_subchannel is true)
2783 auto V = [&](const std::string & s)
2784 {
2786 _console << s << std::endl;
2787 };
2788 auto saveValues = [&](const SolutionHandle & solution,
2789 const unsigned int first_node,
2790 const unsigned int last_node)
2791 {
2792 std::vector<Real> values;
2793 values.reserve((last_node - first_node + 1) * _n_channels);
2794 for (unsigned int iz = first_node; iz <= last_node; ++iz)
2795 for (unsigned int i_ch = 0; i_ch < _n_channels; ++i_ch)
2796 values.push_back(solution(_subchannel_mesh.getChannelNode(i_ch, iz)));
2797 return values;
2798 };
2799 auto relativeChange = [&](const SolutionHandle & solution,
2800 const std::vector<Real> & old_values,
2801 const unsigned int first_node,
2802 const unsigned int last_node,
2803 const Real reference_offset)
2804 {
2805 Real difference_norm_sq = 0.0;
2806 Real reference_norm_sq = 0.0;
2807 std::size_t i = 0;
2808 for (unsigned int iz = first_node; iz <= last_node; ++iz)
2809 for (unsigned int i_ch = 0; i_ch < _n_channels; ++i_ch)
2810 {
2811 const Real value = solution(_subchannel_mesh.getChannelNode(i_ch, iz));
2812 difference_norm_sq += Utility::pow<2>(value - old_values[i]);
2813 reference_norm_sq += Utility::pow<2>(old_values[i] + reference_offset);
2814 ++i;
2815 }
2816 return std::sqrt(difference_norm_sq) / (std::sqrt(reference_norm_sq) + 1e-14);
2817 };
2818 V("Solution initialized");
2819 Real P_error = 1.0;
2820 unsigned int P_it = 0;
2821 unsigned int P_it_max;
2822 bool temperature_converged = true;
2823
2824 if (_segregated_bool)
2825 P_it_max = 20 * _n_blocks;
2826 else
2827 P_it_max = 100;
2828
2829 if ((_n_blocks == 1) && (_segregated_bool))
2830 P_it_max = 5;
2831
2832 if (_P_maxit > 0)
2833 P_it_max = _P_maxit;
2834
2835 while ((P_error > _P_tol && P_it < P_it_max))
2836 {
2837 P_it += 1;
2838 temperature_converged = true;
2840 _console << "Solving Outer Iteration : " << P_it << std::endl;
2841 const auto P_old = saveValues(*_P_soln, 0, _n_cells);
2842 for (unsigned int iblock = 0; iblock < _n_blocks; iblock++)
2843 {
2844 int last_level = (iblock + 1) * _block_size;
2845 int first_level = iblock * _block_size + 1;
2846 Real T_block_error = 1.0;
2847 auto T_it = 0;
2848 _console << "Solving Block: " << iblock << " From first level: " << first_level
2849 << " to last level: " << last_level << std::endl;
2850
2851 while (T_block_error > _T_tol && T_it < _T_maxit)
2852 {
2853 if (processor_id() == 0)
2854 {
2855 if (_segregated_bool)
2856 computeWijFromSolve(iblock);
2857 else
2858 {
2859 LibmeshPetscCall(implicitPetscSolve(iblock));
2860 computeWijPrime(iblock);
2861 V("Done with main solve.");
2862 }
2863 }
2864
2865 // A value of one preserves the original ordering by refreshing the flow solution before
2866 // every thermal update. Larger values opt into lagging flow during thermal subcycles.
2867 for (const auto enthalpy_subcycle : make_range(_enthalpy_subcycles))
2868 {
2869 if (T_block_error <= _T_tol || T_it >= _T_maxit)
2870 break;
2871
2872 V("Enthalpy subcycle: " + std::to_string(enthalpy_subcycle + 1));
2873 T_it += 1;
2874 const auto T_old = saveValues(*_T_soln, first_level, last_level);
2875 // We are only computing quantities on rank 0
2876 if (processor_id() > 0)
2877 {
2878 // Rank zero supplies the error through the maximum reduction below.
2879 T_block_error = 0.0;
2880 goto aux_close;
2881 }
2882
2883 if (_compute_power)
2884 {
2885 computeh(iblock);
2886 T_block_error = computeT(iblock);
2887 V("Done with thermal solve.");
2888 }
2889
2890 V("Start updating thermophysical properties.");
2891 if (_compute_density)
2892 computeRho(iblock);
2894 computeMu(iblock);
2895 V("Done updating thermophysical properties.");
2896
2897 // We must do a global assembly to make sure data is parallel consistent before we do
2898 // things like compute L2 norms
2899 aux_close:
2900 _aux->solution().close();
2901
2902 if (!_compute_power)
2903 T_block_error =
2904 relativeChange(*_T_soln, T_old, first_level, last_level, /*reference_offset=*/0.0);
2905 _console << "T_block_error: " << T_block_error << std::endl;
2906
2907 // All processes must have the same iteration count
2908 comm().max(T_block_error);
2909 }
2910 }
2911 const bool block_converged = T_block_error <= _T_tol;
2912 temperature_converged &= block_converged;
2913 if (!block_converged)
2914 {
2915 _console << "Reached maximum number of temperature iterations for block: " << iblock
2916 << std::endl;
2917 }
2918 }
2919 P_error = _segregated_bool ? relativeChange(*_P_soln, P_old, 0, _n_cells, _P_out)
2921 comm().max(P_error);
2922 _console << "P_error :" << P_error << std::endl;
2923 V("Iteration: " + std::to_string(P_it));
2924 V("Maximum iterations: " + std::to_string(P_it_max));
2925 }
2926 // Cache only the final iteration status. Earlier outer iterations may fail their thermal
2927 // tolerance and subsequently recover.
2928 const bool pressure_converged = P_error <= _P_tol;
2929 if (!pressure_converged)
2930 {
2931 _console << "Reached maximum number of axial pressure iterations" << std::endl;
2932 }
2933 _converged = pressure_converged && temperature_converged;
2934 // update old crossflow matrix
2935 _Wij_old = _Wij;
2936 _console << "Finished executing subchannel solver\n";
2937
2938 // set SumWij at the inlet equal to the one on the first axial level (for visualization purposes)
2939 for (unsigned int i_ch = 0; i_ch < _n_channels; i_ch++)
2940 {
2941 auto * node_in = _subchannel_mesh.getChannelNode(i_ch, 0);
2942 auto * node_out = _subchannel_mesh.getChannelNode(i_ch, 1);
2943 _SumWij_soln->set(node_in, (*_SumWij_soln)(node_out)); // kg/sec
2944 }
2945
2946 if (_pin_mesh_exist)
2947 {
2948 // Assign average HTC to subchannels. This is exact if all pins have the same diameter
2949 for (unsigned int iz = 0; iz < _n_cells + 1; ++iz)
2950 {
2951 for (unsigned int i_ch = 0; i_ch < _n_channels; i_ch++)
2952 {
2953 const auto * node = _subchannel_mesh.getChannelNode(i_ch, iz);
2954 auto mu = (*_mu_soln)(node);
2955 auto S = (*_S_flow_soln)(node);
2956 auto w_perim = (*_w_perim_soln)(node);
2957 auto Dh_i = 4.0 * S / w_perim;
2958 auto Re = (((*_mdot_soln)(node) / S) * Dh_i / mu);
2959 auto k = _fp->k_from_p_T((*_P_soln)(node) + _P_out, (*_T_soln)(node));
2960 auto cp = _fp->cp_from_p_T((*_P_soln)(node) + _P_out, (*_T_soln)(node));
2961 auto Pr = (*_mu_soln)(node)*cp / k;
2962 // Create Friction structure
2963 _friction_args = FrictionStruct(i_ch, Re, S, w_perim);
2964
2965 Real sumhw = 0.0;
2966 for (auto i_pin : _subchannel_mesh.getChannelPins(i_ch))
2967 {
2968 // Create nusselt number structure
2969 _nusselt_args = NusseltStruct(Re, Pr, i_pin, iz, i_ch);
2970
2971 // Compute HTC
2973 }
2974
2975 // Set HTC
2976 _HTC_soln->set(node, sumhw / _subchannel_mesh.getChannelPins(i_ch).size());
2977 }
2978 }
2979 _HTC_soln->close();
2980
2981 _console << "Commencing calculation of Pin surface temperature \n";
2982 for (unsigned int i_pin = 0; i_pin < _n_pins; i_pin++)
2983 {
2984 for (unsigned int iz = 0; iz < _n_cells + 1; ++iz)
2985 {
2986 const auto * pin_node = _subchannel_mesh.getPinNode(i_pin, iz);
2987 Real sumTemp = 0.0;
2988 // Calculate sum of pin surface temperatures that the channels around the pin see
2989 for (auto i_ch : _subchannel_mesh.getPinChannels(i_pin))
2990 {
2991 const auto * node = _subchannel_mesh.getChannelNode(i_ch, iz);
2992 auto mu = (*_mu_soln)(node);
2993 auto S = (*_S_flow_soln)(node);
2994 auto w_perim = (*_w_perim_soln)(node);
2995 auto Dh_i = 4.0 * S / w_perim;
2996 auto Re = (((*_mdot_soln)(node) / S) * Dh_i / mu);
2997 auto k = _fp->k_from_p_T((*_P_soln)(node) + _P_out, (*_T_soln)(node));
2998 auto cp = _fp->cp_from_p_T((*_P_soln)(node) + _P_out, (*_T_soln)(node));
2999 auto Pr = (*_mu_soln)(node)*cp / k;
3000 // Create Friction structure
3001 _friction_args = FrictionStruct(i_ch, Re, S, w_perim);
3002 // Create nusselt number structure
3003 _nusselt_args = NusseltStruct(Re, Pr, i_pin, iz, i_ch);
3004 // Compute HTC
3006 // Compute surface temperature contribution from subchannel side
3007 sumTemp +=
3008 (*_q_prime_soln)(pin_node) / ((*_Dpin_soln)(pin_node)*M_PI * hw) + (*_T_soln)(node);
3009 }
3010 if (_subchannel_mesh.getPinChannels(i_pin).size() > 0)
3011 _Tpin_soln->set(pin_node, sumTemp / _subchannel_mesh.getPinChannels(i_pin).size());
3012 else
3013 mooseError("Pin was not found for pin index: " + std::to_string(i_pin));
3014 }
3015 }
3016 }
3017
3019 if (_duct_mesh_exist && processor_id() == 0)
3020 {
3021 _console << "Commencing calculation of duct surface temperature " << std::endl;
3022 auto duct_nodes = _subchannel_mesh.getDuctNodes();
3023 for (Node * dn : duct_nodes)
3024 {
3025 auto * node_chan = _subchannel_mesh.getChannelNodeFromDuct(dn);
3026 auto mu = (*_mu_soln)(node_chan);
3027 auto S = (*_S_flow_soln)(node_chan);
3028 auto w_perim = (*_w_perim_soln)(node_chan);
3029 auto Dh_i = 4.0 * S / w_perim;
3030 auto Re = (((*_mdot_soln)(node_chan) / S) * Dh_i / mu);
3031 auto k = _fp->k_from_p_T((*_P_soln)(node_chan) + _P_out, (*_T_soln)(node_chan));
3032 auto cp = _fp->cp_from_p_T((*_P_soln)(node_chan) + _P_out, (*_T_soln)(node_chan));
3033 auto Pr = (*_mu_soln)(node_chan)*cp / k;
3034
3035 // Create nusselt number structure (consistent with pin case)
3036 const libMesh::Point & node_point = *_subchannel_mesh.getChannelNodeFromDuct(dn);
3037 const unsigned int iz = _subchannel_mesh.getZIndex(node_point);
3038 const unsigned int i_ch = _subchannel_mesh.channelIndex(node_point);
3039
3040 // Create nusselt number structure
3041 _nusselt_args = NusseltStruct(Re, Pr, std::numeric_limits<unsigned int>::max(), iz, i_ch);
3042
3043 // Create Friction structure
3044 _friction_args = FrictionStruct(i_ch, Re, S, w_perim);
3045
3046 // Compute HTC
3048
3049 // Compute Channel Temperature
3050 auto T_chan = (*_duct_heat_flux_soln)(dn) / hw + (*_T_soln)(node_chan);
3051 _Tduct_soln->set(dn, T_chan);
3052 }
3053 }
3054 _aux->solution().close();
3055 _aux->update();
3056
3057 // Called before the rank-0 early return since it broadcasts to all ranks
3059
3060 if (processor_id() != 0)
3061 return;
3062 Real power_in = 0.0;
3063 Real power_out = 0.0;
3064 Real mass_flow_in = 0.0;
3065 Real mass_flow_out = 0.0;
3066 for (unsigned int i_ch = 0; i_ch < _n_channels; i_ch++)
3067 {
3068 auto * node_in = _subchannel_mesh.getChannelNode(i_ch, 0);
3069 auto * node_out = _subchannel_mesh.getChannelNode(i_ch, _n_cells);
3070 const Real mdot_in = (*_mdot_soln)(node_in);
3071 power_in += mdot_in * (*_h_soln)(node_in);
3072 power_out += (*_mdot_soln)(node_out) * (*_h_soln)(node_out);
3073 mass_flow_in += mdot_in;
3074 mass_flow_out += (*_mdot_soln)(node_out);
3075 }
3076 auto h_bulk_out = power_out / mass_flow_out;
3077 auto T_bulk_out = _fp->T_from_p_h(_P_out, h_bulk_out);
3078
3081 {
3082 _console << " ======================================= " << std::endl;
3083 _console << " ======== Subchannel Print Outs ======== " << std::endl;
3084 _console << " ======================================= " << std::endl;
3085 _console << "Total flow area :" << _subchannel_mesh.getAssemblyFlowArea() << " m^2"
3086 << std::endl;
3087 _console << "Assembly hydraulic diameter :" << bulk_Dh << " m" << std::endl;
3088 _console << "Assembly Re number :" << _bulk_Re << " [-]" << std::endl;
3089 _console << "Bulk coolant temperature at outlet :" << T_bulk_out << " K" << std::endl;
3090 _console << "Power added to coolant is : " << power_out - power_in << " Watt" << std::endl;
3091 _console << "Mass flow rate in is : " << mass_flow_in << " kg/sec" << std::endl;
3092 _console << "Mass balance is : " << mass_flow_out - mass_flow_in << " kg/sec" << std::endl;
3093 _console << "User defined outlet pressure is : " << _P_out << " Pa" << std::endl;
3094 _console << " ======================================= " << std::endl;
3095 }
3096
3097 if (MooseUtils::absoluteFuzzyLessEqual((power_out - power_in), -1.0))
3099 "Energy conservation equation might not be solved correctly, Power added to coolant: " +
3100 std::to_string(power_out - power_in) + " Watt ");
3101}
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 88 of file SubChannel1PhaseProblem.h.

89 {
90 return computeAddedHeatDuct(i_ch, iz);
91 }
virtual Real computeAddedHeatDuct(unsigned int i_ch, unsigned int iz) const
Non-pure: implemented in the base (or override in a child if needed)

◆ 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 82 of file SubChannel1PhaseProblem.h.

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

◆ getBulkReynoldsNumber()

Real SubChannel1PhaseProblem::getBulkReynoldsNumber ( ) const
inlineinherited

◆ getBulkVelocity()

Real SubChannel1PhaseProblem::getBulkVelocity ( ) const
inlineinherited

Definition at line 48 of file SubChannel1PhaseProblem.h.

48{ 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 97 of file SubChannel1PhaseProblem.h.

97{ return _P_out; }

Referenced by SCMMixingKimAndChung::computeLatticeMixingParameter().

◆ getPinHTCClosure()

const SCMHTCClosureBase * SubChannel1PhaseProblem::getPinHTCClosure ( ) const
inlineinherited

Definition at line 45 of file SubChannel1PhaseProblem.h.

45{ return _pin_HTC_closure; } // optional

◆ getSinglePhaseFluidProperties()

const SinglePhaseFluidProperties * SubChannel1PhaseProblem::getSinglePhaseFluidProperties ( ) const
inlineinherited

Get fluid properties object.

Definition at line 103 of file SubChannel1PhaseProblem.h.

103{ return _fp; }

Referenced by SCMMixingKimAndChung::computeLatticeMixingParameter().

◆ getSubChannelPeripheralDuctWidth()

Real QuadSubChannel1PhaseProblem::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 228 of file QuadSubChannel1PhaseProblem.C.

229{
230 auto subch_type = _subchannel_mesh.getSubchannelType(i_ch);
231 if (subch_type == EChannelType::EDGE || subch_type == EChannelType::CORNER)
232 {
233 auto width = _subchannel_mesh.getPitch();
234 if (subch_type == EChannelType::CORNER)
235 width += 2.0 * _subchannel_mesh.getSideGap();
236 return width;
237 }
238 else
239 mooseError("Channel is not a perimetric subchannel ");
240}
const Real & getPitch() const override
Return the undeformed pitch between 2 subchannels.
EChannelType getSubchannelType(unsigned int index) const override
Return the type of the subchannel for given subchannel index.
const Real & getSideGap() const
Returns the side gap, not to be confused with the gap between pins, this refers to the gap next to th...

◆ implicitPetscSolve()

PetscErrorCode SubChannel1PhaseProblem::implicitPetscSolve ( int  iblock)
protectedinherited

Computes implicit solve using PetSc.

Definition at line 2276 of file SubChannel1PhaseProblem.C.

2277{
2279 // ---------- helper functions -----------------------------
2280 auto V = [&](const std::string & s)
2281 {
2283 _console << s << std::endl;
2284 };
2285
2286 auto DupMatAssembled = [&](Mat src, Mat * dst)
2287 {
2288 if (src)
2289 {
2290 LibmeshPetscCall(MatDuplicate(src, MAT_COPY_VALUES, dst));
2291 LibmeshPetscCall(MatAssemblyBegin(*dst, MAT_FINAL_ASSEMBLY));
2292 LibmeshPetscCall(MatAssemblyEnd(*dst, MAT_FINAL_ASSEMBLY));
2293 }
2294 else
2295 *dst = NULL;
2296 };
2297
2298 auto DupVecCopy = [&](Vec src, Vec * dst)
2299 {
2300 LibmeshPetscCall(VecDuplicate(src, dst));
2301 LibmeshPetscCall(VecCopy(src, *dst));
2302 };
2303
2304 const PetscInt Q = 3; // [mass conservation, axial momentum, cross momentum]
2305
2306 // small indexer
2307 auto Idx = [&](PetscInt r, PetscInt c) { return Q * r + c; };
2308
2309 // arrays that MUST be declared before lambdas use them
2310 std::vector<Mat> mat_array(Q * Q, NULL);
2311 std::vector<Vec> vec_array(Q, NULL);
2312
2313 // generic assembler for one governing equation row in the nested matrix
2314 auto AssembleEquation = [&](PetscInt f,
2315 Mat A0,
2316 Mat A1,
2317 Mat A2, // three blocks in row f (can be nullptr)
2318 Vec rhs, // base RHS for equation f
2319 Vec rhs_add, // optional extra RHS to add (can be nullptr)
2320 const char * label) // e.g. "Mass", "Lin mom", "Cross mom"
2321 {
2322 DupMatAssembled(A0, &mat_array[Idx(f, 0)]);
2323 DupMatAssembled(A1, &mat_array[Idx(f, 1)]);
2324 DupMatAssembled(A2, &mat_array[Idx(f, 2)]);
2325 DupVecCopy(rhs, &vec_array[f]);
2326 if (rhs_add)
2327 LibmeshPetscCall(VecAXPY(vec_array[f], 1.0, rhs_add));
2328 V(std::string(label) + " system assembled");
2329 };
2330
2331 // -----------------------------------------------------------------------------
2332 // Helper lambda that applies per-equation under-relaxation by modifying BOTH the
2333 // matrix block and the RHS for that equation.
2334 //
2335 // Specifically, with A_ff for the equation and D = diag(A_ff):
2336 // 1) Matrix diagonal scaling: D <- D / alpha, then A_ff's diagonal is replaced
2337 // with D. For alpha < 1 this increases diagonal dominance (more damping).
2338 // 2) RHS blending with the previous solution x_old:
2339 // rhs_f <- rhs_f + (1 - alpha) * (D / alpha) * x_old
2340 // where x_old is provided by the caller via `populate(work)`.
2341 //
2342 // Net effect: the solved x satisfies
2343 // A_ff x = rhs_f_original + ((1 - alpha)/alpha) * D * (x_old - x),
2344 // which damps updates toward x_old without changing the converged solution.
2345 // This equation relaxation is independent of the optional post-solve solution relaxation.
2346 // -----------------------------------------------------------------------------
2347 auto relaxEquation =
2348 [&](Mat diagonal_block, Vec rhs, Vec work, const Real relaxation, auto && populate)
2349 {
2350 if (relaxation == 1.0)
2351 return;
2352
2353 Vec diagonal = nullptr;
2354 LibmeshPetscCall(VecDuplicate(rhs, &diagonal));
2355
2356 // 1) diagonal_block: diag <- diag / relaxation
2357 LibmeshPetscCall(MatGetDiagonal(diagonal_block, diagonal));
2358 LibmeshPetscCall(VecScale(diagonal, 1.0 / relaxation));
2359 LibmeshPetscCall(MatDiagonalSet(diagonal_block, diagonal, INSERT_VALUES));
2360
2361 // 2) work <- x_old (caller-provided populator)
2362 LibmeshPetscCall(populate(work));
2363
2364 // 3) rhs += (1 - relaxation) * (diag .* work)
2365 LibmeshPetscCall(VecScale(diagonal, 1.0 - relaxation));
2366 LibmeshPetscCall(VecPointwiseMult(work, work, diagonal));
2367 LibmeshPetscCall(VecAXPY(rhs, 1.0, work));
2368
2369 LibmeshPetscCall(VecDestroy(&diagonal));
2370 };
2371
2372 // indices
2373 const unsigned int first_node = iblock * _block_size + 1;
2374 const unsigned int last_node = (iblock + 1) * _block_size;
2375
2376 // ---------- assemble per-block operators -----------------
2377 computeSumWij(iblock);
2378 computeMdot(iblock);
2379 computeWijPrime(iblock);
2380 computeDP(iblock);
2381 computeP(iblock);
2382 computeWijResidual(iblock);
2383
2384 V("Starting nested system.");
2385
2386 // Populate nested matrix with the individual physics
2387 // equation 0: Mass conservation
2388 AssembleEquation(/*f=*/0,
2391 /*A2=*/_mc_sumWij_mat,
2393 /*rhs_add=*/nullptr,
2394 /*label=*/"Mass");
2395
2396 // equation 1: Axial momentum conservation
2397 AssembleEquation(/*f=*/1,
2398 /*A0=*/_amc_sys_mdot_mat,
2400 /*A2=*/nullptr,
2402 /*rhs_add=*/_amc_sys_mdot_rhs,
2403 /*label=*/"Lin mom");
2404
2405 // equation 2: Cross momentum conservation
2406 AssembleEquation(/*f=*/2,
2407 /*A0=*/nullptr,
2409 /*A2=*/_cmc_sys_Wij_mat,
2410 /*rhs=*/_cmc_sys_Wij_rhs,
2411 /*rhs_add=*/_cmc_pressure_force_rhs,
2412 /*label=*/"Cross mom");
2413
2414 // ========================== Relaxation ====================
2415 if (true)
2416 {
2417 LibmeshPetscCall(populateVectorFromHandle<SolutionHandle>(
2418 _prod, *_mdot_soln, first_node, last_node, _n_channels));
2419
2420 Vec mdot_estimate;
2421 LibmeshPetscCall(createPetscVector(mdot_estimate, _block_size * _n_channels));
2422 Vec pmat_diag;
2423 LibmeshPetscCall(createPetscVector(pmat_diag, _block_size * _n_channels));
2424 Vec p_estimate;
2425 LibmeshPetscCall(createPetscVector(p_estimate, _block_size * _n_channels));
2426 Vec unity_vec;
2427 LibmeshPetscCall(createPetscVector(unity_vec, _block_size * _n_channels));
2428 LibmeshPetscCall(VecSet(unity_vec, 1.0));
2429 Vec sol_holder_P;
2430 LibmeshPetscCall(createPetscVector(sol_holder_P, _block_size * _n_gaps));
2431 Vec unity_vec_Wij;
2432 LibmeshPetscCall(createPetscVector(unity_vec_Wij, _block_size * _n_gaps));
2433 LibmeshPetscCall(VecSet(unity_vec_Wij, 1.0));
2434 Vec _Wij_loc_vec;
2435 LibmeshPetscCall(createPetscVector(_Wij_loc_vec, _block_size * _n_gaps));
2436 Vec _Wij_old_loc_vec;
2437 LibmeshPetscCall(createPetscVector(_Wij_old_loc_vec, _block_size * _n_gaps));
2438
2439 // ---- scale estimates ----
2440 // mdot_estimate = A(1,0) * mdot
2441 LibmeshPetscCall(MatMult(mat_array[Q /* (1,0) */], _prod, mdot_estimate));
2442
2443 // p_estimate = mdot_est / (diag(A(1,1)) + eps)
2444 LibmeshPetscCall(MatGetDiagonal(mat_array[Q + 1], pmat_diag));
2445 LibmeshPetscCall(VecAXPY(pmat_diag, 1e-10, unity_vec));
2446 LibmeshPetscCall(VecPointwiseDivide(p_estimate, mdot_estimate, pmat_diag));
2447
2448 // sol_holder_P = A(2,1) * p_estimate - rhs_cmc_pressure
2449 LibmeshPetscCall(MatMult(mat_array[2 * Q + 1], p_estimate, sol_holder_P));
2450 LibmeshPetscCall(VecAXPY(sol_holder_P, -1.0, _cmc_pressure_force_rhs));
2451
2452 // sumWij_loc from sol_holder_P (accumulate)
2453 Vec sumWij_loc;
2454 LibmeshPetscCall(createPetscVector(sumWij_loc, _block_size * _n_channels));
2455 for (unsigned int iz = first_node; iz <= last_node; ++iz)
2456 {
2457 const auto iz_ind = iz - first_node;
2458 for (unsigned int i_ch = 0; i_ch < _n_channels; ++i_ch)
2459 {
2460 PetscScalar sumWij = 0.0;
2461 unsigned int counter = 0;
2462 for (auto i_gap : _subchannel_mesh.getChannelGaps(i_ch))
2463 {
2464 PetscInt row_vec = i_gap + _n_gaps * iz_ind;
2465 PetscScalar loc_Wij_value;
2466 LibmeshPetscCall(VecGetValues(sol_holder_P, 1, &row_vec, &loc_Wij_value));
2467 sumWij += _subchannel_mesh.getCrossflowSign(i_ch, counter) * loc_Wij_value;
2468 counter++;
2469 }
2470 PetscInt row_vec = i_ch + _n_channels * iz_ind;
2471 LibmeshPetscCall(VecSetValues(sumWij_loc, 1, &row_vec, &sumWij, INSERT_VALUES));
2472 }
2473 }
2474 LibmeshPetscCall(VecAssemblyBegin(sumWij_loc));
2475 LibmeshPetscCall(VecAssemblyEnd(sumWij_loc));
2476
2477 // ---- robust scale measurements ----
2478 PetscScalar min_mdot, sum_mdot, avg_mdot;
2479 PetscInt n;
2480 LibmeshPetscCall(VecAbs(_prod));
2481 LibmeshPetscCall(VecMin(_prod, NULL, &min_mdot));
2482 LibmeshPetscCall(VecSum(_prod, &sum_mdot)); // Sum all entries
2483 LibmeshPetscCall(VecGetSize(_prod, &n)); // Number of entries
2484 avg_mdot = sum_mdot / static_cast<PetscScalar>(n);
2485
2486 V("Average estimated mdot: " + std::to_string(avg_mdot));
2487 V("Minimum estimated mdot: " + std::to_string(min_mdot));
2488
2489 LibmeshPetscCall(VecAbs(sumWij_loc));
2490 LibmeshPetscCall(VecMax(sumWij_loc, NULL, &_max_sumWij));
2491 _max_sumWij = std::max(1e-10, _max_sumWij);
2492 V("Maximum estimated Wij: " + std::to_string(_max_sumWij));
2493
2495 _Wij_loc_vec, _Wij, first_node, last_node, _n_gaps));
2496 LibmeshPetscCall(VecAbs(_Wij_loc_vec));
2498 _Wij_old_loc_vec, _Wij_old, first_node, last_node, _n_gaps));
2499 LibmeshPetscCall(VecAbs(_Wij_old_loc_vec));
2500 LibmeshPetscCall(VecAXPY(_Wij_loc_vec, -1.0, _Wij_old_loc_vec));
2501
2502 PetscScalar relax_factor;
2503 LibmeshPetscCall(VecAbs(_Wij_loc_vec));
2504#if !PETSC_VERSION_LESS_THAN(3, 16, 0)
2505 LibmeshPetscCall(VecMean(_Wij_loc_vec, &relax_factor));
2506#else
2507 VecSum(_Wij_loc_vec, &relax_factor);
2508 relax_factor /= _block_size * _n_gaps;
2509#endif
2510 relax_factor = relax_factor / _max_sumWij + 0.5;
2511 V("Relax base value: " + std::to_string(relax_factor));
2512
2513 // ---- crossflow resistance inflation ----
2514 const PetscScalar resistance_relaxation = 0.9;
2515 _added_K = _max_sumWij / min_mdot;
2516 V("New cross resistance: " + std::to_string(_added_K));
2517 _added_K = (_added_K * resistance_relaxation + (1.0 - resistance_relaxation) * _added_K_old) *
2518 relax_factor;
2519 V("Relaxed cross resistance: " + std::to_string(_added_K));
2520
2521 // Snap-up lower-bounding
2522 if (_added_K < 10 && _added_K >= 1.0)
2523 _added_K = 1.0;
2524 if (_added_K < 1.0 && _added_K >= 0.1)
2525 _added_K = 0.5;
2526 if (_added_K < 0.1 && _added_K >= 0.01)
2527 _added_K = 1. / 3.;
2528 if (_added_K < 1e-2 && _added_K >= 1e-3)
2529 _added_K = 0.1;
2530 V("Actual added cross resistance: " + std::to_string(_added_K));
2531 LibmeshPetscCall(VecScale(unity_vec_Wij, _added_K));
2533
2534 LibmeshPetscCall(MatDiagonalSet(mat_array[2 * Q + 2], unity_vec_Wij, ADD_VALUES));
2535
2536 // ---- cleanup temp vectors used above ----
2537 LibmeshPetscCall(VecDestroy(&mdot_estimate));
2538 LibmeshPetscCall(VecDestroy(&pmat_diag));
2539 LibmeshPetscCall(VecDestroy(&unity_vec));
2540 LibmeshPetscCall(VecDestroy(&p_estimate));
2541 LibmeshPetscCall(VecDestroy(&sol_holder_P));
2542 LibmeshPetscCall(VecDestroy(&unity_vec_Wij));
2543 LibmeshPetscCall(VecDestroy(&sumWij_loc));
2544 LibmeshPetscCall(VecDestroy(&_Wij_loc_vec));
2545 LibmeshPetscCall(VecDestroy(&_Wij_old_loc_vec));
2546 }
2547
2548 V("Relax mdot: " + std::to_string(_mass_flow_equation_relaxation));
2549 V("Relax P: " + std::to_string(_pressure_equation_relaxation));
2550 V("Relax Wij: " + std::to_string(_crossflow_equation_relaxation));
2551
2552 relaxEquation(mat_array[Idx(0, 0)],
2553 vec_array[0],
2554 _prod,
2556 [&](Vec work)
2557 {
2558 return populateVectorFromHandle<SolutionHandle>(
2559 work, *_mdot_soln, first_node, last_node, _n_channels);
2560 });
2561 V("mdot relaxed");
2562
2563 relaxEquation(mat_array[Idx(1, 1)],
2564 vec_array[1],
2565 _prodp,
2567 [&](Vec work)
2568 {
2569 // The pressure block represents the node below each axial momentum cell because
2570 // the outlet pressure is prescribed.
2571 return populateVectorFromHandle<SolutionHandle>(
2572 work, *_P_soln, first_node - 1, last_node - 1, _n_channels);
2573 });
2574 V("P relaxed");
2575
2576 relaxEquation(mat_array[Idx(2, 2)],
2577 vec_array[2],
2578 _Wij_vec,
2580 [&](Vec work)
2581 {
2582 return populateVectorFromDense<libMesh::DenseMatrix<Real>>(
2583 work, _Wij, first_node, last_node, _n_gaps);
2584 });
2585 V("Wij relaxed");
2586 V("Linear solver relaxed");
2587
2588 // ======================== Create and configure KSP =========================
2589 Mat A_nest;
2590 Vec b_nest;
2591 Vec x_nest;
2592 LibmeshPetscCall(MatCreateNest(PETSC_COMM_SELF, Q, NULL, Q, NULL, mat_array.data(), &A_nest));
2593 LibmeshPetscCall(VecCreateNest(PETSC_COMM_SELF, Q, NULL, vec_array.data(), &b_nest));
2594 V("Nested system created");
2595
2596 KSP ksp;
2597 PC pc;
2598 LibmeshPetscCall(KSPCreate(PETSC_COMM_SELF, &ksp));
2599 LibmeshPetscCall(KSPSetOptionsPrefix(ksp, "scm_coupled_"));
2600 LibmeshPetscCall(KSPSetType(ksp, KSPFGMRES));
2601 LibmeshPetscCall(KSPSetOperators(ksp, A_nest, A_nest));
2602 LibmeshPetscCall(KSPGetPC(ksp, &pc));
2603 LibmeshPetscCall(PCSetType(pc, PCFIELDSPLIT));
2604 LibmeshPetscCall(KSPSetTolerances(ksp, _rtol, _atol, _dtol, _maxit));
2605
2606 // split equations
2607 std::vector<IS> rows(Q);
2608 LibmeshPetscCall(MatNestGetISs(A_nest, rows.data(), NULL));
2609 for (PetscInt j = 0; j < Q; ++j)
2610 {
2611 IS part;
2612 LibmeshPetscCall(ISDuplicate(rows[j], &part));
2613 LibmeshPetscCall(PCFieldSplitSetIS(pc, NULL, part));
2614 LibmeshPetscCall(ISDestroy(&part));
2615 }
2616 LibmeshPetscCall(KSPSetFromOptions(ksp));
2617 V("Linear solver assembled");
2618
2619 // ============================== Solve =====================================
2620 LibmeshPetscCall(VecDuplicate(b_nest, &x_nest));
2621 LibmeshPetscCall(VecSet(x_nest, 0.0));
2622 LibmeshPetscCall(KSPSolve(ksp, b_nest, x_nest));
2623 KSPConvergedReason reason;
2624 LibmeshPetscCall(KSPGetConvergedReason(ksp, &reason));
2625 if (reason < 0)
2626 {
2627 PetscInt iterations;
2628 PetscReal residual_norm;
2629 LibmeshPetscCall(KSPGetIterationNumber(ksp, &iterations));
2630 LibmeshPetscCall(KSPGetResidualNorm(ksp, &residual_norm));
2631 mooseError(name(),
2632 ": coupled mass/momentum linear solve failed: ",
2633 KSPConvergedReasons[reason],
2634 " (",
2635 static_cast<int>(reason),
2636 ") after ",
2637 iterations,
2638 " iterations; residual norm = ",
2639 residual_norm,
2640 ".");
2641 }
2642
2643 // destroy solver containers first
2644 LibmeshPetscCall(VecDestroy(&b_nest));
2645 LibmeshPetscCall(MatDestroy(&A_nest));
2646 LibmeshPetscCall(KSPDestroy(&ksp));
2647 for (PetscInt i = 0; i < Q * Q; i++)
2648 LibmeshPetscCall(MatDestroy(&mat_array[i]));
2649 for (PetscInt i = 0; i < Q; i++)
2650 LibmeshPetscCall(VecDestroy(&vec_array[i]));
2651 V("Solver elements destroyed");
2652
2653 // ====================== Extract & scatter the solution =====================
2654 Vec sol_mdot, sol_p, sol_Wij;
2655 V("Vectors to hold solution created");
2656 PetscInt num_vecs;
2657 Vec * loc_vecs;
2658 LibmeshPetscCall(VecNestGetSubVecs(x_nest, &num_vecs, &loc_vecs));
2659 LibmeshPetscCall(VecDuplicate(_mc_axial_convection_rhs, &sol_mdot));
2660 LibmeshPetscCall(VecCopy(loc_vecs[0], sol_mdot));
2661 LibmeshPetscCall(VecDuplicate(_amc_sys_mdot_rhs, &sol_p));
2662 LibmeshPetscCall(VecCopy(loc_vecs[1], sol_p));
2663 LibmeshPetscCall(VecDuplicate(_cmc_sys_Wij_rhs, &sol_Wij));
2664 LibmeshPetscCall(VecCopy(loc_vecs[2], sol_Wij));
2665 V("Solution from coupled solver copied to solution vectors");
2666
2667 // Apply independent post-solve relaxation to the fixed-point solution update.
2668 auto relaxSolution = [&](Vec solution, Vec old_solution, const Real relaxation)
2669 {
2670 LibmeshPetscCall(VecScale(solution, relaxation));
2671 LibmeshPetscCall(VecAXPY(solution, 1.0 - relaxation, old_solution));
2672 };
2673 LibmeshPetscCall(populateVectorFromHandle<SolutionHandle>(
2674 _prod, *_mdot_soln, first_node, last_node, _n_channels));
2675 LibmeshPetscCall(populateVectorFromHandle<SolutionHandle>(
2676 _prodp, *_P_soln, first_node - 1, last_node - 1, _n_channels));
2677
2678 // Measure the pressure update before post-solve relaxation so changing that relaxation does
2679 // not change the meaning of the outer pressure tolerance.
2680 Vec pressure_residual;
2681 LibmeshPetscCall(VecDuplicate(sol_p, &pressure_residual));
2682 LibmeshPetscCall(VecCopy(sol_p, pressure_residual));
2683 LibmeshPetscCall(VecAXPY(pressure_residual, -1.0, _prodp));
2684
2685 const PetscScalar * residual_array;
2686 const PetscScalar * old_pressure_array;
2687 PetscInt pressure_size;
2688 LibmeshPetscCall(VecGetSize(pressure_residual, &pressure_size));
2689 LibmeshPetscCall(VecGetArrayRead(pressure_residual, &residual_array));
2690 LibmeshPetscCall(VecGetArrayRead(_prodp, &old_pressure_array));
2691 Real residual_norm_sq = 0.0;
2692 Real pressure_norm_sq = 0.0;
2693 for (PetscInt i = 0; i < pressure_size; ++i)
2694 {
2695 residual_norm_sq += Utility::pow<2>(residual_array[i]);
2696 pressure_norm_sq += Utility::pow<2>(old_pressure_array[i] + _P_out);
2697 }
2698 LibmeshPetscCall(VecRestoreArrayRead(pressure_residual, &residual_array));
2699 LibmeshPetscCall(VecRestoreArrayRead(_prodp, &old_pressure_array));
2700 LibmeshPetscCall(VecDestroy(&pressure_residual));
2703 std::sqrt(residual_norm_sq) / (std::sqrt(pressure_norm_sq) + 1e-14));
2704
2705 relaxSolution(sol_mdot, _prod, _mass_flow_relaxation);
2706 relaxSolution(sol_p, _prodp, _pressure_relaxation);
2708 _Wij_vec, _Wij, first_node, last_node, _n_gaps));
2709 relaxSolution(sol_Wij, _Wij_vec, _crossflow_relaxation);
2710
2711 // mass flow
2712 LibmeshPetscCall(populateSolutionChan<SolutionHandle>(
2713 sol_mdot, *_mdot_soln, first_node, last_node, _n_channels));
2714
2715 // pressure
2716 {
2717 PetscScalar * sol_p_array;
2718 LibmeshPetscCall(VecGetArray(sol_p, &sol_p_array));
2719 for (unsigned int iz = last_node; iz > first_node - 1; iz--)
2720 {
2721 const auto iz_ind = iz - first_node;
2722 for (unsigned int i_ch = 0; i_ch < _n_channels; i_ch++)
2723 {
2724 auto * node_in = _subchannel_mesh.getChannelNode(i_ch, iz - 1);
2725 PetscScalar value = sol_p_array[iz_ind * _n_channels + i_ch];
2726 _P_soln->set(node_in, value);
2727 }
2728 }
2729 LibmeshPetscCall(VecRestoreArray(sol_p, &sol_p_array));
2730 }
2731
2732 // crossflow dense + sumWij + correction factor
2734 sol_Wij, _Wij, first_node, last_node, _n_gaps));
2735
2736 LibmeshPetscCall(MatMult(_mc_sumWij_mat, sol_Wij, _prod));
2737 LibmeshPetscCall(populateSolutionChan<SolutionHandle>(
2738 _prod, *_SumWij_soln, first_node, last_node, _n_channels));
2739
2740 LibmeshPetscCall(VecAbs(_prod));
2741 LibmeshPetscCall(VecMax(_prod, NULL, &_max_sumWij_new));
2742 V("Maximum estimated Wij new: " + std::to_string(_max_sumWij_new));
2744 V("Correction factor: " + std::to_string(_correction_factor));
2745 V("Solutions assigned to MOOSE variables.");
2746
2747 // cleanup solution objects
2748 LibmeshPetscCall(VecDestroy(&x_nest));
2749 LibmeshPetscCall(VecDestroy(&sol_mdot));
2750 LibmeshPetscCall(VecDestroy(&sol_p));
2751 LibmeshPetscCall(VecDestroy(&sol_Wij));
2752 V("Solutions destroyed.");
2753
2754 PetscFunctionReturn(LIBMESH_PETSC_SUCCESS);
2755}
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 coupled implicit solve.
const Real & _pressure_equation_relaxation
Equation relaxation factor for pressure in the coupled implicit solve.
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 coupled implicit solve.
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 coupled implicit solve.
const Real & _crossflow_equation_relaxation
Equation relaxation factor for crossflow in the coupled implicit solve.
PetscScalar _added_K
Added resistances for monolithic convergence.
const Real & _pressure_relaxation
Relaxation factor for pressure updates in the coupled implicit solve.

Referenced by SubChannel1PhaseProblem::externalSolve().

◆ initializeSolution()

void QuadSubChannel1PhaseProblem::initializeSolution ( )
overrideprotectedvirtual

Function to initialize the solution & geometry fields.

update surface area, wetted perimeter based on: Dpin, displacement

Calculate subchannel area

Correct subchannel area and wetted perimeter in case of overlapping pins

Apply area reduction on subchannels affected by blockage

update map of gap between pins (gij) based on: Dpin, displacement

Implements SubChannel1PhaseProblem.

Definition at line 32 of file QuadSubChannel1PhaseProblem.C.

33{
35
37 if (_deformation)
38 {
39 _console << " =========== DEFORMATION RECALCULATION ACTIVATED ============== " << std::endl;
40 Real standard_area, additional_area, wetted_perimeter, displaced_area;
41 auto pitch = _subchannel_mesh.getPitch();
42 auto side_gap = _subchannel_mesh.getSideGap();
43 auto z_blockage = _subchannel_mesh.getZBlockage();
44 auto index_blockage = _subchannel_mesh.getIndexBlockage();
45 auto reduction_blockage = _subchannel_mesh.getReductionBlockage();
46 for (unsigned int iz = 0; iz < _n_cells + 1; iz++)
47 {
48 for (unsigned int i_ch = 0; i_ch < _n_channels; i_ch++)
49 {
50 auto * node = _subchannel_mesh.getChannelNode(i_ch, iz);
51 auto subch_type = _subchannel_mesh.getSubchannelType(i_ch);
52 auto Z = _z_grid[iz];
53 Real rod_area = 0.0;
54 Real rod_perimeter = 0.0;
55 for (auto i_pin : _subchannel_mesh.getChannelPins(i_ch))
56 {
57 auto * pin_node = _subchannel_mesh.getPinNode(i_pin, iz);
58 rod_area += 0.25 * 0.25 * M_PI * (*_Dpin_soln)(pin_node) * (*_Dpin_soln)(pin_node);
59 rod_perimeter += 0.25 * M_PI * (*_Dpin_soln)(pin_node);
60 }
61
62 if (subch_type == EChannelType::CORNER)
63 {
64 standard_area = 0.25 * pitch * pitch;
65 displaced_area = (2 * side_gap + pitch) * (*_displacement_soln)(node) / sqrt(2) +
66 (*_displacement_soln)(node) * (*_displacement_soln)(node) / 2;
67 additional_area = pitch * side_gap + side_gap * side_gap;
68 wetted_perimeter =
69 rod_perimeter + pitch + 2 * side_gap + 2 * (*_displacement_soln)(node) / sqrt(2);
70 }
71 else if (subch_type == EChannelType::EDGE)
72 {
73 standard_area = 0.5 * pitch * pitch;
74 additional_area = pitch * side_gap;
75 displaced_area = pitch * (*_displacement_soln)(node);
76 wetted_perimeter = rod_perimeter + pitch;
77 }
78 else
79 {
80 standard_area = pitch * pitch;
81 displaced_area = 0.0;
82 additional_area = 0.0;
83 wetted_perimeter = rod_perimeter;
84 }
85
87 auto subchannel_area = displaced_area + standard_area + additional_area - rod_area;
88
90 auto overlapping_pin_area = 0.0;
91 auto overlapping_wetted_perimeter = 0.0;
92 for (auto i_gap : _subchannel_mesh.getChannelGaps(i_ch))
93 {
94 auto gap_pins = _subchannel_mesh.getGapPins(i_gap);
95 auto pin_1 = gap_pins.first;
96 auto pin_2 = gap_pins.second;
97 auto * pin_node_1 = _subchannel_mesh.getPinNode(pin_1, iz);
98 auto * pin_node_2 = _subchannel_mesh.getPinNode(pin_2, iz);
99 auto Diameter1 = (*_Dpin_soln)(pin_node_1);
100 auto Radius1 = Diameter1 / 2.0;
101 auto Diameter2 = (*_Dpin_soln)(pin_node_2);
102 auto Radius2 = Diameter2 / 2.0;
103 auto pitch = _subchannel_mesh.getPitch();
104
105 if (pitch < (Radius1 + Radius2)) // overlapping pins
106 {
107 mooseWarning(" The gap of index : '", i_gap, " at axial cell ", iz, " ' is blocked.");
108 auto cos1 =
109 (pitch * pitch + Radius1 * Radius1 - Radius2 * Radius2) / (2 * pitch * Radius1);
110 auto cos2 =
111 (pitch * pitch + Radius2 * Radius2 - Radius1 * Radius1) / (2 * pitch * Radius2);
112 auto angle1 = 2.0 * acos(cos1);
113 auto angle2 = 2.0 * acos(cos2);
114 // half of the intersecting arc-length
115 overlapping_wetted_perimeter += 0.5 * angle1 * Radius1 + 0.5 * angle2 * Radius2;
116 // Half of the overlapping area
117 overlapping_pin_area +=
118 0.5 * Radius1 * Radius1 * acos(cos1) + 0.5 * Radius2 * Radius2 * acos(cos2) -
119 0.25 * sqrt((-pitch + Radius1 + Radius2) * (pitch + Radius1 - Radius2) *
120 (pitch - Radius1 + Radius2) * (pitch + Radius1 + Radius2));
121 }
122 }
123 subchannel_area += overlapping_pin_area; // correct surface area
124 wetted_perimeter += -overlapping_wetted_perimeter; // correct wetted perimeter
125
127 auto index = 0;
128 for (const auto & i_blockage : index_blockage)
129 {
130 if (i_ch == i_blockage && (Z >= z_blockage.front() && Z <= z_blockage.back()))
131 {
132 subchannel_area *= reduction_blockage[index];
133 }
134 index++;
135 }
136
137 _S_flow_soln->set(node, subchannel_area);
138 _w_perim_soln->set(node, wetted_perimeter);
139 }
140 }
142 for (unsigned int iz = 0; iz < _n_cells + 1; iz++)
143 {
144 for (unsigned int i_gap = 0; i_gap < _n_gaps; i_gap++)
145 {
146 auto gap_pins = _subchannel_mesh.getGapPins(i_gap);
147 auto pin_1 = gap_pins.first;
148 auto pin_2 = gap_pins.second;
149 auto * pin_node_1 = _subchannel_mesh.getPinNode(pin_1, iz);
150 auto * pin_node_2 = _subchannel_mesh.getPinNode(pin_2, iz);
151 if (pin_1 == pin_2) // Corner or edge gap
152 {
153 auto displacement = 0.0;
154 auto counter = 0.0;
155 for (auto i_ch : _subchannel_mesh.getPinChannels(pin_1))
156 {
157 auto subch_type = _subchannel_mesh.getSubchannelType(i_ch);
158 auto * node = _subchannel_mesh.getChannelNode(i_ch, iz);
159 if (subch_type == EChannelType::EDGE || subch_type == EChannelType::CORNER)
160 {
161 displacement += (*_displacement_soln)(node);
162 counter += 1.0;
163 }
164 }
165 displacement = displacement / counter;
167 iz, i_gap, (pitch - (*_Dpin_soln)(pin_node_1)) / 2.0 + side_gap + displacement);
168 }
169 else // center gap
170 {
172 iz, i_gap, pitch - (*_Dpin_soln)(pin_node_1) / 2.0 - (*_Dpin_soln)(pin_node_2) / 2.0);
173 }
174 // if pins come in contact, the gap is zero
175 if (_subchannel_mesh.getGapWidth(iz, i_gap) <= 0.0)
176 _subchannel_mesh.setGapWidth(iz, i_gap, 0.0);
177 }
178 }
179 }
180
181 for (unsigned int iz = 1; iz < _n_cells + 1; iz++)
182 {
183 for (unsigned int i_ch = 0; i_ch < _n_channels; i_ch++)
184 {
185 auto * node_out = _subchannel_mesh.getChannelNode(i_ch, iz);
186 auto * node_in = _subchannel_mesh.getChannelNode(i_ch, iz - 1);
187 _mdot_soln->set(node_out, (*_mdot_soln)(node_in));
188 }
189 }
190
191 // We must do a global assembly to make sure data is parallel consistent before we do things
192 // like compute L2 norms
193 _aux->solution().close();
194}
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 std::pair< unsigned int, unsigned int > & getGapPins(unsigned int i_gap) const override
Return a pair of pin indices for a given gap index.
std::unique_ptr< SolutionHandle > _w_perim_soln
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::vector< unsigned int > & getIndexBlockage() const
Get index of blocked subchannels.
CTSub CT_OPERATOR_BINARY CTMul CTCompareLess CTCompareGreater CTCompareEqual _arg template * sqrt(_arg)) *_arg.template D< dtag >()) CT_SIMPLE_UNARY_FUNCTION(tanh

◆ initialSetup()

void SubChannel1PhaseProblem::initialSetup ( )
overridevirtualinherited

Set value for turbulent momentum modeling parameter CT

Reimplemented from ExternalProblem.

Definition at line 368 of file SubChannel1PhaseProblem.C.

369{
371
372 _fp = &getUserObject<SinglePhaseFluidProperties>(getParam<UserObjectName>("fp"));
374 &getUserObject<SCMFrictionClosureBase>(getParam<UserObjectName>("friction_closure"));
376 &getUserObject<SCMMixingClosureBase>(getParam<UserObjectName>("mixing_closure"));
377
380
381 // Create variables for output and storage
382 _mdot_soln = std::make_unique<SolutionHandle>(getVariable(0, SubChannelApp::MASS_FLOW_RATE));
383 _SumWij_soln = std::make_unique<SolutionHandle>(getVariable(0, SubChannelApp::SUM_CROSSFLOW));
384 _P_soln = std::make_unique<SolutionHandle>(getVariable(0, SubChannelApp::PRESSURE));
385 if (getParam<bool>("full_output"))
386 {
387 _DP_soln = std::make_unique<SolutionHandle>(getVariable(0, SubChannelApp::PRESSURE_DROP));
388 _ff_soln = std::make_unique<SolutionHandle>(getVariable(0, SubChannelApp::FRICTION_FACTOR));
389 }
390 _h_soln = std::make_unique<SolutionHandle>(getVariable(0, SubChannelApp::ENTHALPY));
391 _T_soln = std::make_unique<SolutionHandle>(getVariable(0, SubChannelApp::TEMPERATURE));
392 if (_pin_mesh_exist)
393 {
394 _Tpin_soln = std::make_unique<SolutionHandle>(getVariable(0, SubChannelApp::PIN_TEMPERATURE));
395 _Dpin_soln = std::make_unique<SolutionHandle>(getVariable(0, SubChannelApp::PIN_DIAMETER));
396 _HTC_soln =
397 std::make_unique<SolutionHandle>(getVariable(0, SubChannelApp::HEAT_TRANSFER_COEFFICIENT));
399 &getUserObject<SCMHTCClosureBase>(getParam<UserObjectName>("pin_HTC_closure"));
400 }
401 _rho_soln = std::make_unique<SolutionHandle>(getVariable(0, SubChannelApp::DENSITY));
402 _mu_soln = std::make_unique<SolutionHandle>(getVariable(0, SubChannelApp::VISCOSITY));
403 _S_flow_soln = std::make_unique<SolutionHandle>(getVariable(0, SubChannelApp::SURFACE_AREA));
404 _w_perim_soln = std::make_unique<SolutionHandle>(getVariable(0, SubChannelApp::WETTED_PERIMETER));
405 _q_prime_soln = std::make_unique<SolutionHandle>(getVariable(0, SubChannelApp::LINEAR_HEAT_RATE));
407 std::make_unique<SolutionHandle>(getVariable(0, SubChannelApp::DISPLACEMENT));
409 {
411 std::make_unique<SolutionHandle>(getVariable(0, SubChannelApp::DUCT_HEAT_FLUX));
412 _Tduct_soln = std::make_unique<SolutionHandle>(getVariable(0, SubChannelApp::DUCT_TEMPERATURE));
414 &getUserObject<SCMHTCClosureBase>(getParam<UserObjectName>("duct_HTC_closure"));
415 }
416}
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

◆ 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 2126 of file SubChannel1PhaseProblem.C.

2129{
2130 SNES snes;
2131 KSP ksp;
2132 PC pc;
2133 Vec x, r;
2134 PetscScalar * xx;
2135
2137 LibmeshPetscCall(SNESCreate(PETSC_COMM_SELF, &snes));
2138 LibmeshPetscCall(VecCreate(PETSC_COMM_SELF, &x));
2139 LibmeshPetscCall(VecSetSizes(x, PETSC_DECIDE, _block_size * _n_gaps));
2140 LibmeshPetscCall(VecSetFromOptions(x));
2141 LibmeshPetscCall(VecDuplicate(x, &r));
2142
2143#if PETSC_VERSION_LESS_THAN(3, 13, 0)
2144 LibmeshPetscCall(PetscOptionsSetValue(PETSC_NULL, "-snes_mf", PETSC_NULL));
2145#else
2146 LibmeshPetscCall(SNESSetUseMatrixFree(snes, PETSC_FALSE, PETSC_TRUE));
2147#endif
2148 Ctx ctx;
2149 ctx.iblock = iblock;
2150 ctx.schp = this;
2151 LibmeshPetscCall(SNESSetFunction(snes, r, formFunction, &ctx));
2152 LibmeshPetscCall(SNESGetKSP(snes, &ksp));
2153 LibmeshPetscCall(KSPGetPC(ksp, &pc));
2154 LibmeshPetscCall(PCSetType(pc, PCNONE));
2155 LibmeshPetscCall(KSPSetTolerances(ksp, _rtol, _atol, _dtol, _maxit));
2156 LibmeshPetscCall(SNESSetFromOptions(snes));
2157 LibmeshPetscCall(VecGetArray(x, &xx));
2158 for (unsigned int i = 0; i < _block_size * _n_gaps; i++)
2159 {
2160 xx[i] = solution(i);
2161 }
2162 LibmeshPetscCall(VecRestoreArray(x, &xx));
2163
2164 LibmeshPetscCall(SNESSolve(snes, NULL, x));
2165 LibmeshPetscCall(VecGetArray(x, &xx));
2166 for (unsigned int i = 0; i < _block_size * _n_gaps; i++)
2167 root(i) = xx[i];
2168
2169 LibmeshPetscCall(VecRestoreArray(x, &xx));
2170 LibmeshPetscCall(VecDestroy(&x));
2171 LibmeshPetscCall(VecDestroy(&r));
2172 LibmeshPetscCall(SNESDestroy(&snes));
2173 PetscFunctionReturn(LIBMESH_PETSC_SUCCESS);
2174}
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 449 of file SubChannel1PhaseProblem.h.

454{
455 PetscScalar * xx;
456
458 LibmeshPetscCall(VecGetArray(x, &xx));
459 for (unsigned int iz = first_axial_level; iz < last_axial_level + 1; iz++)
460 {
461 unsigned int iz_ind = iz - first_axial_level;
462 for (unsigned int i_l = 0; i_l < cross_dimension; i_l++)
463 {
464 loc_solution(i_l, iz) = xx[iz_ind * cross_dimension + i_l];
465 }
466 }
467 LibmeshPetscCall(VecRestoreArray(x, &xx));
468
469 PetscFunctionReturn(LIBMESH_PETSC_SUCCESS);
470}

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 523 of file SubChannel1PhaseProblem.h.

528{
529 PetscScalar * xx;
531 LibmeshPetscCall(VecGetArray(x, &xx));
532 Node * loc_node;
533 for (unsigned int iz = first_axial_level; iz < last_axial_level + 1; iz++)
534 {
535 unsigned int iz_ind = iz - first_axial_level;
536 for (unsigned int i_l = 0; i_l < cross_dimension; i_l++)
537 {
538 loc_node = _subchannel_mesh.getChannelNode(i_l, iz);
539 loc_solution.set(loc_node, xx[iz_ind * cross_dimension + i_l]);
540 }
541 }
542 PetscFunctionReturn(LIBMESH_PETSC_SUCCESS);
543}

◆ 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 500 of file SubChannel1PhaseProblem.h.

505{
506 PetscScalar * xx;
508 LibmeshPetscCall(VecGetArray(x, &xx));
509 for (unsigned int iz = first_axial_level; iz < last_axial_level + 1; iz++)
510 {
511 unsigned int iz_ind = iz - first_axial_level;
512 for (unsigned int i_l = 0; i_l < cross_dimension; i_l++)
513 {
514 xx[iz_ind * cross_dimension + i_l] = loc_solution(i_l, iz);
515 }
516 }
517 LibmeshPetscCall(VecRestoreArray(x, &xx));
518 PetscFunctionReturn(LIBMESH_PETSC_SUCCESS);
519}

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 474 of file SubChannel1PhaseProblem.h.

479{
480 PetscScalar * xx;
481
483 LibmeshPetscCall(VecGetArray(x, &xx));
484 for (unsigned int iz = first_axial_level; iz < last_axial_level + 1; iz++)
485 {
486 unsigned int iz_ind = iz - first_axial_level;
487 for (unsigned int i_l = 0; i_l < cross_dimension; i_l++)
488 {
489 auto * loc_node = _subchannel_mesh.getChannelNode(i_l, iz);
490 xx[iz_ind * cross_dimension + i_l] = loc_solution(loc_node);
491 }
492 }
493 LibmeshPetscCall(VecRestoreArray(x, &xx));
494
495 PetscFunctionReturn(LIBMESH_PETSC_SUCCESS);
496}

◆ 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 2084 of file SubChannel1PhaseProblem.C.

2085{
2086 const unsigned int last_node = (iblock + 1) * _block_size;
2087 const unsigned int first_node = iblock * _block_size + 1;
2088 libMesh::DenseVector<Real> Wij_residual_vector(_n_gaps * _block_size, 0.0);
2089 // Assign the solution to the cross-flow matrix
2090 int i = 0;
2091 for (unsigned int iz = first_node; iz < last_node + 1; iz++)
2092 {
2093 for (unsigned int i_gap = 0; i_gap < _n_gaps; i_gap++)
2094 {
2095 _Wij(i_gap, iz) = solution(i);
2096 i++;
2097 }
2098 }
2099
2100 // Calculating sum of crossflows
2101 computeSumWij(iblock);
2102 // Solving axial flux
2103 computeMdot(iblock);
2104 // Calculation of turbulent Crossflow
2105 computeWijPrime(iblock);
2106 // Solving for Pressure Drop
2107 computeDP(iblock);
2108 // Solving for pressure
2109 computeP(iblock);
2110 // Populating lateral crossflow residual matrix
2111 computeWijResidual(iblock);
2112
2113 // Turn the residual matrix into a residual vector
2114 for (unsigned int iz = 0; iz < _block_size; iz++)
2115 {
2116 for (unsigned int i_gap = 0; i_gap < _n_gaps; i_gap++)
2117 {
2118 int i = _n_gaps * iz + i_gap; // column wise transfer
2119 Wij_residual_vector(i) = _Wij_residual_matrix(i_gap, iz);
2120 }
2121 }
2122 return Wij_residual_vector;
2123}

◆ 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 2177 of file SubChannel1PhaseProblem.C.

2179{
2181
2182 // Create solution vector with rhs layout
2183 Vec x = nullptr;
2184 LibmeshPetscCall(VecDuplicate(rhs, &x));
2185
2186 // KSP setup
2187 KSP ksp = nullptr;
2188 PC pc = nullptr;
2189 LibmeshPetscCall(KSPCreate(PETSC_COMM_SELF, &ksp));
2190 LibmeshPetscCall(KSPSetOperators(ksp, A, A));
2191 LibmeshPetscCall(KSPGetPC(ksp, &pc));
2192 LibmeshPetscCall(PCSetType(pc, PCJACOBI));
2193 LibmeshPetscCall(KSPSetTolerances(ksp, _rtol, _atol, _dtol, _maxit));
2194 if (ksp_prefix && *ksp_prefix)
2195 LibmeshPetscCall(KSPSetOptionsPrefix(ksp, ksp_prefix));
2196 LibmeshPetscCall(KSPSetFromOptions(ksp));
2197
2198 // Solve
2199 LibmeshPetscCall(KSPSolve(ksp, rhs, x));
2200 KSPConvergedReason reason;
2201 LibmeshPetscCall(KSPGetConvergedReason(ksp, &reason));
2202 if (reason < 0)
2203 {
2204 PetscInt iterations;
2205 PetscReal residual_norm;
2206 LibmeshPetscCall(KSPGetIterationNumber(ksp, &iterations));
2207 LibmeshPetscCall(KSPGetResidualNorm(ksp, &residual_norm));
2208 mooseError(name(),
2209 ": enthalpy linear solve failed: ",
2210 KSPConvergedReasons[reason],
2211 " (",
2212 static_cast<int>(reason),
2213 ") after ",
2214 iterations,
2215 " iterations; residual norm = ",
2216 residual_norm,
2217 ".");
2218 }
2219
2220 // Scatter to _h_soln with sanity checks
2221 PetscScalar * xx = nullptr;
2222 LibmeshPetscCall(VecGetArray(x, &xx));
2223 for (unsigned int iz = first_node; iz <= last_node; ++iz)
2224 {
2225 const unsigned int iz_ind = iz - first_node;
2226 for (unsigned int i_ch = 0; i_ch < _n_channels; ++i_ch)
2227 {
2228 auto * node_out = _subchannel_mesh.getChannelNode(i_ch, iz);
2229 const PetscScalar h_out = xx[iz_ind * _n_channels + i_ch];
2230 if (h_out < 0.0)
2231 mooseError(
2232 name(), " : Calculation of negative Enthalpy h_out = ", h_out, " Axial Level = ", iz);
2233 _h_soln->set(node_out, h_out);
2234 }
2235 }
2236 LibmeshPetscCall(VecRestoreArray(x, &xx));
2237
2238 // Cleanup
2239 LibmeshPetscCall(KSPDestroy(&ksp));
2240 LibmeshPetscCall(VecDestroy(&x));
2241
2242 PetscFunctionReturn(LIBMESH_PETSC_SUCCESS);
2243}

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

◆ solverSystemConverged()

bool SubChannel1PhaseProblem::solverSystemConverged ( const unsigned int  )
overridevirtualinherited

Reimplemented from ExternalProblem.

Definition at line 553 of file SubChannel1PhaseProblem.C.

554{
555 return _converged;
556}

◆ syncSolutions()

void SubChannel1PhaseProblem::syncSolutions ( Direction  direction)
overridevirtualinherited

Implements ExternalProblem.

Definition at line 3104 of file SubChannel1PhaseProblem.C.

3105{
3106}

◆ validParams()

InputParameters QuadSubChannel1PhaseProblem::validParams ( )
static

Definition at line 18 of file QuadSubChannel1PhaseProblem.C.

19{
22 "Solver class for subchannels in a square lattice assembly and bare fuel pins");
23 return params;
24}
void addClassDescription(const std::string &doc_string)
static InputParameters validParams()

Member Data Documentation

◆ _added_K

PetscScalar SubChannel1PhaseProblem::_added_K = 0.0
protectedinherited

Added resistances for monolithic convergence.

Definition at line 435 of file SubChannel1PhaseProblem.h.

Referenced by SubChannel1PhaseProblem::implicitPetscSolve().

◆ _added_K_old

PetscScalar SubChannel1PhaseProblem::_added_K_old = 1000.0
protectedinherited

◆ _amc_advective_derivative_mat

Mat SubChannel1PhaseProblem::_amc_advective_derivative_mat
protectedinherited

Axial momentum conservation - advective (Eulerian) derivative.

Definition at line 383 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 386 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 389 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 393 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_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 380 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 377 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 406 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_sys_Wij_mat

Mat SubChannel1PhaseProblem::_cmc_sys_Wij_mat
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 403 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 219 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 223 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 221 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 229 of file SubChannel1PhaseProblem.h.

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

◆ _correction_factor

PetscScalar SubChannel1PhaseProblem::_correction_factor = 1.0
protectedinherited

◆ _crossflow_equation_relaxation

const Real& SubChannel1PhaseProblem::_crossflow_equation_relaxation
protectedinherited

Equation relaxation factor for crossflow in the coupled implicit solve.

Definition at line 257 of file SubChannel1PhaseProblem.h.

Referenced by SubChannel1PhaseProblem::implicitPetscSolve().

◆ _crossflow_relaxation

const Real& SubChannel1PhaseProblem::_crossflow_relaxation
protectedinherited

Relaxation factor for crossflow updates in the coupled implicit solve.

Definition at line 263 of file SubChannel1PhaseProblem.h.

Referenced by SubChannel1PhaseProblem::implicitPetscSolve().

◆ _CT

Real SubChannel1PhaseProblem::_CT
protectedinherited

Turbulent modeling parameter used in axial momentum equation.

Definition at line 239 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 286 of file SubChannel1PhaseProblem.h.

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

◆ _dir_grav

const Real SubChannel1PhaseProblem::_dir_grav
protectedinherited

Definition at line 276 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 309 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 251 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 206 of file SubChannel1PhaseProblem.h.

Referenced by SubChannel1PhaseProblem::computeDP().

◆ _gravity_direction

const MooseEnum SubChannel1PhaseProblem::_gravity_direction
protectedinherited

The direction of gravity.

Definition at line 275 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 423 of file SubChannel1PhaseProblem.h.

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

◆ _hc_advective_derivative_rhs

Vec SubChannel1PhaseProblem::_hc_advective_derivative_rhs
protectedinherited

◆ _hc_cross_derivative_mat

Mat SubChannel1PhaseProblem::_hc_cross_derivative_mat
protectedinherited

◆ _hc_cross_derivative_rhs

Vec SubChannel1PhaseProblem::_hc_cross_derivative_rhs
protectedinherited

◆ _hc_sys_h_mat

Mat SubChannel1PhaseProblem::_hc_sys_h_mat
protectedinherited

◆ _hc_sys_h_rhs

Vec SubChannel1PhaseProblem::_hc_sys_h_rhs
protectedinherited

◆ _hc_time_derivative_mat

Mat SubChannel1PhaseProblem::_hc_time_derivative_mat
protectedinherited

Enthalpy Enthalpy conservation - time derivative.

Definition at line 420 of file SubChannel1PhaseProblem.h.

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

◆ _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 273 of file SubChannel1PhaseProblem.h.

Referenced by SubChannel1PhaseProblem::computeDP(), TriSubChannel1PhaseProblem::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 coupled implicit solve.

Definition at line 253 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 coupled implicit solve.

Definition at line 259 of file SubChannel1PhaseProblem.h.

Referenced by SubChannel1PhaseProblem::implicitPetscSolve().

◆ _max_sumWij

PetscScalar SubChannel1PhaseProblem::_max_sumWij
protectedinherited

◆ _max_sumWij_new

PetscScalar SubChannel1PhaseProblem::_max_sumWij_new
protectedinherited

◆ _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 365 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

◆ _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 215 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 243 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 241 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 coupled implicit solve.

Definition at line 255 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 441 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 coupled implicit solve.

Definition at line 261 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 308 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

◆ _staggered_pressure_bool

const bool SubChannel1PhaseProblem::_staggered_pressure_bool
protectedinherited

Flag to define the usage of staggered or collocated pressure.

Definition at line 280 of file SubChannel1PhaseProblem.h.

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

◆ _subchannel_mesh

QuadSubChannelMesh& QuadSubChannel1PhaseProblem::_subchannel_mesh
protected

◆ _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 247 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 249 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 245 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 235 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 217 of file SubChannel1PhaseProblem.h.

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

◆ _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: