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
TriSubChannel1PhaseProblem Class Referenceabstract

Triangular subchannel solver. More...

#include <TriSubChannel1PhaseProblem.h>

Inheritance diagram for TriSubChannel1PhaseProblem:
[legend]

Public Types

enum  Direction
 
enum  CoverageCheckMode
 
typedef DataFileName DataFileParameterType
 

Public Member Functions

 TriSubChannel1PhaseProblem (const InputParameters &params)
 
virtual ~TriSubChannel1PhaseProblem ()
 
virtual void externalSolve () override
 
virtual void syncSolutions (Direction direction) override
 
virtual bool solverSystemConverged (const unsigned int) override
 
virtual void initialSetup () override
 
const SCMHTCClosureBase * getDuctHTCClosure () const
 
const SCMHTCClosureBase * getPinHTCClosure () const
 
const SCMFrictionClosureBase * getFrictionClosure () const
 
Real getBulkReynoldsNumber () const
 
Real 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)
 
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
 
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 hasScalingVector (const unsigned int nl_sys_num)
 
void clearAllDofIndices ()
 
const Moose::Functor< T > & getFunctor (const std::string &name, const THREAD_ID tid, const std::string &requestor_name, bool requestor_is_ad)
 
bool hasFunctor (const std::string &name, const THREAD_ID tid) const
 
bool hasFunctorWithType (const std::string &name, const THREAD_ID tid) const
 
void addFunctor (const std::string &name, const Moose::FunctorBase< T > &functor, const THREAD_ID tid)
 
const Moose::FunctorBase< T > & addPiecewiseByBlockLambdaFunctor (const std::string &name, PolymorphicLambda my_lammy, const std::set< ExecFlagType > &clearance_schedule, const MooseMesh &mesh, const std::set< SubdomainID > &block_ids, const THREAD_ID tid)
 
void setFunctorOutput (bool set_output)
 
void setChainControlDataOutput (bool set_output)
 
void registerUnfilledFunctorRequest (T *functor_interface, const std::string &functor_name, const THREAD_ID tid)
 
void reinitFVFace (const THREAD_ID tid, const FaceInfo &fi)
 
void preparePRefinement ()
 
bool doingPRefinement () const
 
MooseVariableFEBase & getVariableHelper (const THREAD_ID tid, const std::string &var_name, Moose::VarKindType expected_var_type, Moose::VarFieldType expected_var_field_type, const std::vector< T > &systems, const SystemBase &aux) const
 
void _setCLIOption ()
 
virtual void terminateSolve ()
 
virtual bool isSolveTerminationRequested () const
 
const ConsoleStream & console () const
 
virtual bool enabled () const
 
std::shared_ptr< MooseObject > getSharedPtr ()
 
std::shared_ptr< const MooseObject > getSharedPtr () const
 
bool isKokkosObject () const
 
MooseApp & getMooseApp () const
 
const std::string & type () const
 
const std::string & name () const
 
std::string typeAndName () const
 
MooseObjectParameterName uniqueParameterName (const std::string &parameter_name) const
 
MooseObjectName uniqueName () const
 
const InputParameters & parameters () const
 
const hit::Node * getHitNode () const
 
bool hasBase () const
 
const std::string & getBase () const
 
const T & getParam (const std::string &name) const
 
std::vector< std::pair< T1, T2 > > getParam (const std::string &param1, const std::string &param2) const
 
const T * queryParam (const std::string &name) const
 
const T & getRenamedParam (const std::string &old_name, const std::string &new_name) const
 
T getCheckedPointerParam (const std::string &name, const std::string &error_string="") const
 
bool isParamValid (const std::string &name) const
 
bool isParamSetByUser (const std::string &name) const
 
void connectControllableParams (const std::string &parameter, const std::string &object_type, const std::string &object_name, const std::string &object_parameter) const
 
void paramError (const std::string &param, Args... args) const
 
void paramWarning (const std::string &param, Args... args) const
 
void paramWarning (const std::string &param, Args... args) const
 
void paramInfo (const std::string &param, Args... args) const
 
std::string messagePrefix (const bool hit_prefix=true) const
 
std::string errorPrefix (const std::string &) const
 
void mooseError (Args &&... args) const
 
void mooseDocumentedError (const std::string &repo_name, const unsigned int issue_num, Args &&... args) const
 
void mooseErrorNonPrefixed (Args &&... args) const
 
void mooseWarning (Args &&... args) const
 
void mooseWarning (Args &&... args) const
 
void mooseWarningNonPrefixed (Args &&... args) const
 
void mooseWarningNonPrefixed (Args &&... args) const
 
void mooseDeprecated (Args &&... args) const
 
void mooseDeprecated (Args &&... args) const
 
void mooseDeprecatedNoTrace (Args &&... args) const
 
void mooseInfo (Args &&... args) const
 
void callMooseError (std::string msg, const bool with_prefix, const hit::Node *node=nullptr, const bool show_trace=true) const
 
std::string getDataFileName (const std::string &param) const
 
std::string getDataFileNameByName (const std::string &relative_path) const
 
std::string getDataFilePath (const std::string &relative_path) const
 
PerfGraph & perfGraph ()
 
const libMesh::ConstElemRange & getEvaluableElementRange ()
 
const libMesh::ConstElemRange & getEvaluableElementRange ()
 
const libMesh::ConstElemRange & getNonlinearEvaluableElementRange ()
 
const libMesh::ConstElemRange & getNonlinearEvaluableElementRange ()
 
const libMesh::ConstElemRange & getCurrentAlgebraicElementRange ()
 
const libMesh::ConstElemRange & getCurrentAlgebraicElementRange ()
 
const libMesh::ConstNodeRange & getCurrentAlgebraicNodeRange ()
 
const libMesh::ConstNodeRange & getCurrentAlgebraicNodeRange ()
 
const ConstBndNodeRange & getCurrentAlgebraicBndNodeRange ()
 
const ConstBndNodeRange & getCurrentAlgebraicBndNodeRange ()
 
void setCurrentAlgebraicElementRange (libMesh::ConstElemRange *range)
 
void setCurrentAlgebraicElementRange (libMesh::ConstElemRange *range)
 
void setCurrentAlgebraicNodeRange (libMesh::ConstNodeRange *range)
 
void setCurrentAlgebraicNodeRange (libMesh::ConstNodeRange *range)
 
void setCurrentAlgebraicBndNodeRange (ConstBndNodeRange *range)
 
void setCurrentAlgebraicBndNodeRange (ConstBndNodeRange *range)
 
void allowOutput (bool state)
 
void allowOutput (bool state)
 
void allowOutput (bool state)
 
void allowOutput (bool state)
 
Moose::Kokkos::Array< Moose::Kokkos::System > & getKokkosSystems ()
 
const Moose::Kokkos::Array< Moose::Kokkos::System > & getKokkosSystems () const
 
Moose::Kokkos::Array< Moose::Kokkos::System > & getKokkosSystems ()
 
const Moose::Kokkos::Array< Moose::Kokkos::System > & getKokkosSystems () const
 
Moose::Kokkos::Array< Moose::Kokkos::FESystem > & getKokkosFESystems ()
 
const Moose::Kokkos::Array< Moose::Kokkos::FESystem > & getKokkosFESystems () const
 
Moose::Kokkos::Array< Moose::Kokkos::FESystem > & getKokkosFESystems ()
 
const Moose::Kokkos::Array< Moose::Kokkos::FESystem > & getKokkosFESystems () const
 
Moose::Kokkos::System & getKokkosSystem (const unsigned int sys_num)
 
const Moose::Kokkos::System & getKokkosSystem (const unsigned int sys_num) const
 
Moose::Kokkos::System & getKokkosSystem (const unsigned int sys_num)
 
const Moose::Kokkos::System & getKokkosSystem (const unsigned int sys_num) const
 
Moose::Kokkos::FESystem & getKokkosFESystem (const unsigned int sys_num)
 
const Moose::Kokkos::FESystem & getKokkosFESystem (const unsigned int sys_num) const
 
Moose::Kokkos::FESystem & getKokkosFESystem (const unsigned int sys_num)
 
const Moose::Kokkos::FESystem & getKokkosFESystem (const unsigned int sys_num) const
 
bool hasMultiApps () const
 
bool hasMultiApps (ExecFlagType type) const
 
bool hasMultiApps () const
 
bool hasMultiApps (ExecFlagType type) const
 
bool hasMultiApp (const std::string &name) const
 
bool hasMultiApp (const std::string &name) const
 
const AutomaticMortarGeneration & getMortarInterface (const std::pair< BoundaryID, BoundaryID > &primary_secondary_boundary_pair, const std::pair< SubdomainID, SubdomainID > &primary_secondary_subdomain_pair, bool on_displaced) const
 
AutomaticMortarGeneration & getMortarInterface (const std::pair< BoundaryID, BoundaryID > &primary_secondary_boundary_pair, const std::pair< SubdomainID, SubdomainID > &primary_secondary_subdomain_pair, bool on_displaced)
 
const AutomaticMortarGeneration & getMortarInterface (const std::pair< BoundaryID, BoundaryID > &primary_secondary_boundary_pair, const std::pair< SubdomainID, SubdomainID > &primary_secondary_subdomain_pair, bool on_displaced) const
 
AutomaticMortarGeneration & getMortarInterface (const std::pair< BoundaryID, BoundaryID > &primary_secondary_boundary_pair, const std::pair< SubdomainID, SubdomainID > &primary_secondary_subdomain_pair, bool on_displaced)
 
const MaterialPropertyStorage & getMaterialPropertyStorage ()
 
const MaterialPropertyStorage & getMaterialPropertyStorage ()
 
const MaterialPropertyStorage & getBndMaterialPropertyStorage ()
 
const MaterialPropertyStorage & getBndMaterialPropertyStorage ()
 
const MaterialPropertyStorage & getNeighborMaterialPropertyStorage ()
 
const MaterialPropertyStorage & getNeighborMaterialPropertyStorage ()
 
Moose::Kokkos::MaterialPropertyStorage & getKokkosMaterialPropertyStorage ()
 
Moose::Kokkos::MaterialPropertyStorage & getKokkosMaterialPropertyStorage ()
 
Moose::Kokkos::MaterialPropertyStorage & getKokkosBndMaterialPropertyStorage ()
 
Moose::Kokkos::MaterialPropertyStorage & getKokkosBndMaterialPropertyStorage ()
 
Moose::Kokkos::MaterialPropertyStorage & getKokkosNeighborMaterialPropertyStorage ()
 
Moose::Kokkos::MaterialPropertyStorage & getKokkosNeighborMaterialPropertyStorage ()
 
const MooseObjectWarehouse< Indicator > & getIndicatorWarehouse ()
 
const MooseObjectWarehouse< Indicator > & getIndicatorWarehouse ()
 
const MooseObjectWarehouse< InternalSideIndicatorBase > & getInternalSideIndicatorWarehouse ()
 
const MooseObjectWarehouse< InternalSideIndicatorBase > & getInternalSideIndicatorWarehouse ()
 
const MooseObjectWarehouse< Marker > & getMarkerWarehouse ()
 
const MooseObjectWarehouse< Marker > & getMarkerWarehouse ()
 
bool needBoundaryMaterialOnSide (BoundaryID bnd_id, const THREAD_ID tid)
 
bool needBoundaryMaterialOnSide (BoundaryID bnd_id, const THREAD_ID tid)
 
bool needInterfaceMaterialOnSide (BoundaryID bnd_id, const THREAD_ID tid)
 
bool needInterfaceMaterialOnSide (BoundaryID bnd_id, const THREAD_ID tid)
 
bool needInternalNeighborSideMaterial (SubdomainID subdomain_id, const THREAD_ID tid)
 
bool needInternalNeighborSideMaterial (SubdomainID subdomain_id, const THREAD_ID tid)
 
const ExecFlagType & getCurrentExecuteOnFlag () const
 
const ExecFlagType & getCurrentExecuteOnFlag () const
 
void setCurrentExecuteOnFlag (const ExecFlagType &)
 
void setCurrentExecuteOnFlag (const ExecFlagType &)
 
const Parallel::Communicator & comm () const
 
processor_id_type n_processors () const
 
processor_id_type processor_id () const
 
bool isDefaultPostprocessorValue (const std::string &param_name, const unsigned int index=0) const
 
bool hasPostprocessorByName (const PostprocessorName &name) const
 
std::size_t coupledPostprocessors (const std::string &param_name) const
 
const PostprocessorName & getPostprocessorName (const std::string &param_name, const unsigned int index=0) const
 
const PostprocessorValue & getPostprocessorValue (const std::string &param_name, const unsigned int index=0) const
 
const PostprocessorValue & getPostprocessorValue (const std::string &param_name, const unsigned int index=0) const
 
const PostprocessorValue & getPostprocessorValueOld (const std::string &param_name, const unsigned int index=0) const
 
const PostprocessorValue & getPostprocessorValueOld (const std::string &param_name, const unsigned int index=0) const
 
const PostprocessorValue & getPostprocessorValueOlder (const std::string &param_name, const unsigned int index=0) const
 
const PostprocessorValue & getPostprocessorValueOlder (const std::string &param_name, const unsigned int index=0) const
 
const PostprocessorValue & getPostprocessorValueOldByName (const PostprocessorName &name) const
 
const PostprocessorValue & getPostprocessorValueOldByName (const PostprocessorName &name) const
 
const PostprocessorValue & getPostprocessorValueOlderByName (const PostprocessorName &name) const
 
const PostprocessorValue & getPostprocessorValueOlderByName (const PostprocessorName &name) const
 

Static Public Member Functions

static InputParameters validParams ()
 
static void callMooseError (MooseApp *const app, const InputParameters &params, std::string msg, const bool with_prefix, const hit::Node *node, const bool show_trace=true)
 
static void selectVectorTagsFromSystem (const SystemBase &system, const std::vector< VectorTag > &input_vector_tags, std::set< TagID > &selected_tags)
 
static void selectMatrixTagsFromSystem (const SystemBase &system, const std::map< TagName, TagID > &input_matrix_tags, std::set< TagID > &selected_tags)
 
static void objectSetupHelper (const std::vector< T * > &objects, const ExecFlagType &exec_flag)
 
static void objectSetupHelper (const std::vector< T * > &objects, const ExecFlagType &exec_flag)
 
static void objectExecuteHelper (const std::vector< T * > &objects)
 
static void objectExecuteHelper (const std::vector< T * > &objects)
 

Public Attributes

struct SubChannel1PhaseProblem::FrictionStruct _friction_args
 
struct SubChannel1PhaseProblem::NusseltStruct _nusselt_args
 
const PostprocessorValue & _P_out
 Outlet pressure postprocessor value.
 
const SinglePhaseFluidProperties * _fp
 Non-owning pointer to fluid properties user object.
 
std::map< std::string, std::vector< dof_id_type > > _var_dof_map
 
 usingCombinedWarningSolutionWarnings
 
const ConsoleStream _console
 
std::vector< Real > _real_zero
 
std::vector< VariableValue > _scalar_zero
 
std::vector< VariableValue > _zero
 
std::vector< VariablePhiValue > _phi_zero
 
std::vector< MooseArray< ADReal > > _ad_zero
 
std::vector< VariableGradient > _grad_zero
 
std::vector< MooseArray< ADRealVectorValue > > _ad_grad_zero
 
std::vector< VariablePhiGradient > _grad_phi_zero
 
std::vector< VariableSecond > _second_zero
 
std::vector< MooseArray< ADRealTensorValue > > _ad_second_zero
 
std::vector< VariablePhiSecond > _second_phi_zero
 
std::vector< Point > _point_zero
 
std::vector< VectorVariableValue > _vector_zero
 
std::vector< VectorVariableCurl > _vector_curl_zero
 

Static Public Attributes

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

Protected Member Functions

virtual void initializeSolution () override
 Function to initialize the solution & geometry fields.
 
virtual Real computeAddedHeatPin (unsigned int i_ch, unsigned int iz) const override
 Pure virtual: daughters provide different implementations.
 
virtual Real getSubChannelPeripheralDuctWidth (unsigned int i_ch) const override
 Function that computes the width of the duct cell that the peripheral subchannel i_ch sees.
 
virtual void computeh (int iblock) override
 Computes Enthalpy per channel for block iblock.
 
PetscErrorCode cleanUp ()
 
virtual Real computeAddedHeatDuct (unsigned int i_ch, unsigned int iz) const
 Non-pure: implemented in the base (or override in a child if needed)
 
void computeWijFromSolve (int iblock)
 Computes diversion crossflow per gap for block iblock.
 
void computeSumWij (int iblock)
 Computes net diversion crossflow per channel for block iblock.
 
void computeMdot (int iblock)
 Computes mass flow per channel for block iblock.
 
void computeWijPrime (int iblock)
 Computes turbulent crossflow per gap for block iblock.
 
Real computeMixingParameter (unsigned int i_gap, unsigned int iz) const
 Computes and validates the turbulent mixing parameter.
 
Real computeSweepFlowMixingParameter (unsigned int i_gap, unsigned int iz) const
 Computes and validates the sweep-flow mixing parameter.
 
void computeDP (int iblock)
 Computes Pressure Drop per channel for block iblock.
 
void computeP (int iblock)
 Computes Pressure per channel for block iblock.
 
Real computeT (int iblock)
 Computes and relaxes Temperature per channel for block iblock.
 
void computeRho (int iblock)
 Computes Density per channel for block iblock.
 
void computeMu (int iblock)
 Computes Viscosity per channel for block iblock.
 
void computeWijResidual (int iblock)
 Computes Residual Matrix based on the lateral momentum conservation equation for block iblock.
 
libMesh::DenseVector< Real > residualFunction (int iblock, libMesh::DenseVector< Real > solution)
 Computes Residual Vector based on the lateral momentum conservation equation for block iblock & updates flow variables based on current crossflow solution.
 
PetscErrorCode petscSnesSolver (int iblock, const libMesh::DenseVector< Real > &solution, libMesh::DenseVector< Real > &root)
 Computes solution of nonlinear equation using snes and provided a residual in a formFunction.
 
PetscErrorCode implicitPetscSolve (int iblock)
 Computes implicit solve using PetSc.
 
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 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 checkDependMaterialsHelper (const std::map< SubdomainID, std::vector< std::shared_ptr< MaterialBase > > > &materials_map)
 
void checkCoordinateSystems ()
 
void reinitBecauseOfGhostingOrNewGeomObjects (bool mortar_changed=false)
 
void addObjectParamsHelper (InputParameters &params, const std::string &object_name, const std::string &var_param_name="variable")
 
bool verifyVectorTags () const
 
void flagInvalidSolutionInternal (const InvalidSolutionID invalid_solution_id) const
 
InvalidSolutionID registerInvalidSolutionInternal (const std::string &message, const bool warning) const
 
PerfID registerTimedSection (const std::string &section_name, const unsigned int level) const
 
PerfID registerTimedSection (const std::string &section_name, const unsigned int level, const std::string &live_message, const bool print_dots=true) const
 
std::string timedSectionName (const std::string &section_name) const
 
T & declareRestartableData (const std::string &data_name, Args &&... args)
 
ManagedValue< T > declareManagedRestartableDataWithContext (const std::string &data_name, void *context, Args &&... args)
 
const T & getRestartableData (const std::string &data_name) const
 
T & declareRestartableDataWithContext (const std::string &data_name, void *context, Args &&... args)
 
T & declareRecoverableData (const std::string &data_name, Args &&... args)
 
T & declareRestartableDataWithObjectName (const std::string &data_name, const std::string &object_name, Args &&... args)
 
T & declareRestartableDataWithObjectNameWithContext (const std::string &data_name, const std::string &object_name, void *context, Args &&... args)
 
std::string restartableName (const std::string &data_name) const
 
virtual void addPostprocessorDependencyHelper (const PostprocessorName &) const
 

Protected Attributes

TriSubChannelMesh & _tri_sch_mesh
 
Mat _hc_axial_heat_conduction_mat
 
Vec _hc_axial_heat_conduction_rhs
 
Mat _hc_radial_heat_conduction_mat
 
Vec _hc_radial_heat_conduction_rhs
 
Mat _hc_sweep_enthalpy_mat
 
Vec _hc_sweep_enthalpy_rhs
 
SubChannelMesh & _subchannel_mesh
 
unsigned int _n_blocks
 number of axial blocks
 
libMesh::DenseMatrix< Real > _DP
 
libMesh::DenseMatrix< Real > & _Wij
 
libMesh::DenseMatrix< Real > & _Wij_old
 
libMesh::DenseMatrix< Real > _WijPrime
 
libMesh::DenseMatrix< Real > _Wij_residual_matrix
 
const Real _g_grav
 
const Real & _kij
 
unsigned int _n_cells
 
unsigned int _n_gaps
 
unsigned int _n_pins
 
unsigned int _n_channels
 
unsigned int _block_size
 
std::vector< Real > _z_grid
 axial location of nodes
 
Real _one
 
Real _TR
 Flag that activates or deactivates the transient parts of the equations we solve by multiplication.
 
const bool _compute_density
 Flag that activates or deactivates the calculation of density.
 
const bool _compute_viscosity
 Flag that activates or deactivates the calculation of viscosity.
 
const bool _compute_power
 Flag that informs if we need to solve the Enthalpy/Temperature equations or not.
 
const bool _pin_mesh_exist
 Flag that informs if there is a pin mesh or not.
 
const bool _duct_mesh_exist
 Flag that informs if there is a duct mesh or not.
 
bool _converged
 Variable that informs whether we exited external solve with a converged solution or not.
 
Real _bulk_Re
 Assembly bulk Reynolds number.
 
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

Triangular subchannel solver.

Definition at line 19 of file TriSubChannel1PhaseProblem.h.

Constructor & Destructor Documentation

◆ TriSubChannel1PhaseProblem()

TriSubChannel1PhaseProblem::TriSubChannel1PhaseProblem ( const InputParameters &  params)

Definition at line 31 of file TriSubChannel1PhaseProblem.C.

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

◆ ~TriSubChannel1PhaseProblem()

TriSubChannel1PhaseProblem::~TriSubChannel1PhaseProblem ( )
virtual

Definition at line 47 of file TriSubChannel1PhaseProblem.C.

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

Member Function Documentation

◆ cleanUp()

PetscErrorCode TriSubChannel1PhaseProblem::cleanUp ( )
protected

Definition at line 55 of file TriSubChannel1PhaseProblem.C.

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

Referenced by ~TriSubChannel1PhaseProblem().

◆ computeAddedHeatDuct()

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

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

Definition at line 2225 of file SubChannel1PhaseProblem.C.

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

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

◆ computeAddedHeatPin()

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

Pure virtual: daughters provide different implementations.

Implements SubChannel1PhaseProblem.

Definition at line 262 of file TriSubChannel1PhaseProblem.C.

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

Referenced by computeh().

◆ computeBulkReynoldsNumber()

void SubChannel1PhaseProblem::computeBulkReynoldsNumber ( )
protectedinherited

Computes the assembly bulk Reynolds number from inlet flow conditions.

Definition at line 418 of file SubChannel1PhaseProblem.C.

419{
420 if (processor_id() != 0)
421 return;
422
423 Real viscosity_in = 0.0;
424 Real mass_flow_in = 0.0;
425 for (const auto i_ch : make_range(_n_channels))
426 {
427 auto * node_in = _subchannel_mesh.getChannelNode(i_ch, 0);
428 const Real mdot_in = (*_mdot_soln)(node_in);
429 viscosity_in += mdot_in * (*_mu_soln)(node_in);
430 mass_flow_in += mdot_in;
431 }
432
434 const Real inlet_mu = viscosity_in / mass_flow_in;
435 _bulk_Re = mass_flow_in * bulk_Dh / (inlet_mu * _subchannel_mesh.getAssemblyFlowArea());
436}
Real _bulk_Re
Assembly bulk Reynolds number.
Real getAssemblyFlowArea() const
Return undeformed bundle inlet flow area.
Real getAssemblyHydraulicDiameter() const
Return undeformed bundle-average hydraulic diameter.
processor_id_type processor_id() const
IntRange< T > make_range(T beg, T end)

Referenced by SubChannel1PhaseProblem::externalSolve().

◆ computeDP()

void SubChannel1PhaseProblem::computeDP ( int  iblock)
protectedinherited

Computes Pressure Drop per channel for block iblock.

Upwind local form loss

Upwind local form loss

Advective derivative term

Cross derivative term

Friction term

Upwind local form loss

Gravity force

Assembling system

Definition at line 814 of file SubChannel1PhaseProblem.C.

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

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

◆ computeh()

void TriSubChannel1PhaseProblem::computeh ( int  iblock)
overrideprotectedvirtual

Computes Enthalpy per channel for block iblock.

TODO: Current axial derivative is zero - check if outflow conditions may make a difference

Implements SubChannel1PhaseProblem.

Definition at line 325 of file TriSubChannel1PhaseProblem.C.

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

◆ computeInterpolatedValue()

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

Definition at line 563 of file SubChannel1PhaseProblem.C.

566{
567 PetscScalar alpha = computeInterpolationCoefficients(Peclet);
568 return alpha * botValue + (1.0 - alpha) * topValue;
569}

Referenced by SubChannel1PhaseProblem::computeDP(), QuadSubChannel1PhaseProblem::computeh(), 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 543 of file SubChannel1PhaseProblem.C.

544{
545 switch (_interpolation_scheme)
546 {
547 case 0: // upwind interpolation
548 return 1.0;
549 case 1: // downwind interpolation
550 return 0.0;
551 case 2: // central_difference interpolation
552 return 0.5;
553 case 3: // exponential interpolation (Peclet limited)
554 return ((Peclet - 1.0) * std::exp(Peclet) + 1) / (Peclet * (std::exp(Peclet) - 1.) + 1e-10);
555 default:
557 ": Interpolation scheme should be a string: upwind, downwind, central_difference, "
558 "exponential");
559 }
560}
auto Peclet(const T1 &volume_fraction, const T2 &cp, const T3 &rho, const T4 &vel, const T5 &D_h, const T6 &k)
Compute Peclet number.
Definition Numerics.h:151

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

◆ computeMdot()

void SubChannel1PhaseProblem::computeMdot ( int  iblock)
protectedinherited

Computes mass flow per channel for block iblock.

Definition at line 671 of file SubChannel1PhaseProblem.C.

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

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

◆ computeMixingParameter()

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

Computes and validates the turbulent mixing parameter.

Definition at line 2029 of file SubChannel1PhaseProblem.C.

2030{
2031 auto beta = _mixing_closure->computeMixingParameter(i_gap, iz);
2032 if (!std::isfinite(beta) || beta < 0.0)
2033 mooseError(name(),
2034 ": Mixing closure returned invalid beta = ",
2035 beta,
2036 " for gap ",
2037 i_gap,
2038 " at axial index ",
2039 iz,
2040 ". Beta must be finite and non-negative.");
2041
2042 return beta;
2043}
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(...
const SCMMixingClosureBase * _mixing_closure
Turbulent Mixing closure object.

Referenced by SubChannel1PhaseProblem::computeWijPrime().

◆ computeMu()

void SubChannel1PhaseProblem::computeMu ( int  iblock)
protectedinherited

Computes Viscosity per channel for block iblock.

Definition at line 1591 of file SubChannel1PhaseProblem.C.

1592{
1593 const unsigned int last_node = (iblock + 1) * _block_size;
1594 const unsigned int first_node = iblock * _block_size + 1;
1595 if (iblock == 0)
1596 {
1597 for (unsigned int i_ch = 0; i_ch < _n_channels; i_ch++)
1598 {
1599 auto * node = _subchannel_mesh.getChannelNode(i_ch, 0);
1600 _mu_soln->set(node, _fp->mu_from_p_T((*_P_soln)(node) + _P_out, (*_T_soln)(node)));
1601 }
1602 }
1603 for (unsigned int iz = first_node; iz < last_node + 1; iz++)
1604 {
1605 for (unsigned int i_ch = 0; i_ch < _n_channels; i_ch++)
1606 {
1607 auto * node = _subchannel_mesh.getChannelNode(i_ch, iz);
1608 _mu_soln->set(node, _fp->mu_from_p_T((*_P_soln)(node) + _P_out, (*_T_soln)(node)));
1609 }
1610 }
1611}
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 1300 of file SubChannel1PhaseProblem.C.

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

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

◆ computeRho()

void SubChannel1PhaseProblem::computeRho ( int  iblock)
protectedinherited

Computes Density per channel for block iblock.

Definition at line 1568 of file SubChannel1PhaseProblem.C.

1569{
1570 const unsigned int last_node = (iblock + 1) * _block_size;
1571 const unsigned int first_node = iblock * _block_size + 1;
1572 if (iblock == 0)
1573 {
1574 for (unsigned int i_ch = 0; i_ch < _n_channels; i_ch++)
1575 {
1576 auto * node = _subchannel_mesh.getChannelNode(i_ch, 0);
1577 _rho_soln->set(node, _fp->rho_from_p_T((*_P_soln)(node) + _P_out, (*_T_soln)(node)));
1578 }
1579 }
1580 for (unsigned int iz = first_node; iz < last_node + 1; iz++)
1581 {
1582 for (unsigned int i_ch = 0; i_ch < _n_channels; i_ch++)
1583 {
1584 auto * node = _subchannel_mesh.getChannelNode(i_ch, iz);
1585 _rho_soln->set(node, _fp->rho_from_p_T((*_P_soln)(node) + _P_out, (*_T_soln)(node)));
1586 }
1587 }
1588}

Referenced by SubChannel1PhaseProblem::externalSolve().

◆ computeSumWij()

void SubChannel1PhaseProblem::computeSumWij ( int  iblock)
protectedinherited

Computes net diversion crossflow per channel for block iblock.

Definition at line 605 of file SubChannel1PhaseProblem.C.

606{
607 const unsigned int last_node = (iblock + 1) * _block_size;
608 const unsigned int first_node = iblock * _block_size + 1;
609 // Add to solution vector if explicit
610 if (!_implicit_bool)
611 {
612 for (unsigned int iz = first_node; iz < last_node + 1; iz++)
613 {
614 for (unsigned int i_ch = 0; i_ch < _n_channels; i_ch++)
615 {
616 auto * node_out = _subchannel_mesh.getChannelNode(i_ch, iz);
617 Real sumWij = 0.0;
618 // Calculate sum of crossflow into channel i from channels j around i
619 unsigned int counter = 0;
620 for (auto i_gap : _subchannel_mesh.getChannelGaps(i_ch))
621 {
622 sumWij += _subchannel_mesh.getCrossflowSign(i_ch, counter) * _Wij(i_gap, iz);
623 counter++;
624 }
625 // The net crossflow coming out of cell i [kg/sec]
626 _SumWij_soln->set(node_out, sumWij);
627 }
628 }
629 }
630 // Add to matrix if implicit
631 else
632 {
633 LibmeshPetscCall(MatZeroEntries(_mc_density_pressure_mat));
634 for (unsigned int iz = first_node; iz < last_node + 1; iz++)
635 {
636 unsigned int iz_ind = iz - first_node;
637 for (unsigned int i_ch = 0; i_ch < _n_channels; i_ch++)
638 {
639 // Calculate sum of crossflow into channel i from channels j around i
640 unsigned int counter = 0;
641 for (auto i_gap : _subchannel_mesh.getChannelGaps(i_ch))
642 {
643 PetscInt row = i_ch + _n_channels * iz_ind;
644 PetscInt col = i_gap + _n_gaps * iz_ind;
645 PetscScalar value = _subchannel_mesh.getCrossflowSign(i_ch, counter);
646 LibmeshPetscCall(MatSetValues(_mc_sumWij_mat, 1, &row, 1, &col, &value, INSERT_VALUES));
647 counter++;
648 }
649 }
650 }
651 LibmeshPetscCall(MatAssemblyBegin(_mc_sumWij_mat, MAT_FINAL_ASSEMBLY));
652 LibmeshPetscCall(MatAssemblyEnd(_mc_sumWij_mat, MAT_FINAL_ASSEMBLY));
654 {
655 Vec loc_prod;
656 Vec loc_Wij;
657 LibmeshPetscCall(VecDuplicate(_amc_sys_mdot_rhs, &loc_prod));
658 LibmeshPetscCall(VecDuplicate(_Wij_vec, &loc_Wij));
660 loc_Wij, _Wij, first_node, last_node, _n_gaps));
661 LibmeshPetscCall(MatMult(_mc_sumWij_mat, loc_Wij, loc_prod));
662 LibmeshPetscCall(populateSolutionChan<SolutionHandle>(
663 loc_prod, *_SumWij_soln, first_node, last_node, _n_channels));
664 LibmeshPetscCall(VecDestroy(&loc_prod));
665 LibmeshPetscCall(VecDestroy(&loc_Wij));
666 }
667 }
668}
Mat _mc_sumWij_mat
Matrices and vectors to be used in implicit assembly Mass conservation Mass conservation - sum of cro...
PetscErrorCode populateVectorFromDense(Vec &x, const T &solution, const unsigned int first_axial_level, const unsigned int last_axial_level, const unsigned int cross_dimension)

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

◆ computeSweepFlowMixingParameter()

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

Computes and validates the sweep-flow mixing parameter.

Definition at line 2046 of file SubChannel1PhaseProblem.C.

2047{
2048 auto beta = _mixing_closure->computeSweepFlowMixingParameter(i_gap, iz);
2049 if (!std::isfinite(beta) || beta < 0.0)
2050 mooseError(name(),
2051 ": Mixing closure returned invalid sweep-flow coefficient = ",
2052 beta,
2053 " for gap ",
2054 i_gap,
2055 " at axial index ",
2056 iz,
2057 ". sweep-flow coefficient must be finite and non-negative.");
2058
2059 return beta;
2060}
virtual Real computeSweepFlowMixingParameter(const unsigned int i_gap, const unsigned int iz) const
Computes the wire-wrap sweep-flow coefficient for peripheral gaps.

Referenced by computeh().

◆ computeT()

Real SubChannel1PhaseProblem::computeT ( int  iblock)
protectedinherited

Computes and relaxes Temperature per channel for block iblock.

Returns
The normalized norm of (T - T_prev).

Definition at line 1533 of file SubChannel1PhaseProblem.C.

1534{
1535 const unsigned int last_node = (iblock + 1) * _block_size;
1536 const unsigned int first_node = iblock * _block_size + 1;
1537 std::vector<Real> residual;
1538 residual.reserve(_block_size * _n_channels);
1539 Real residual_norm_sq = 0.0;
1540 Real temperature_norm_sq = 0.0;
1541 for (unsigned int iz = first_node; iz < last_node + 1; iz++)
1542 {
1543 for (unsigned int i_ch = 0; i_ch < _n_channels; i_ch++)
1544 {
1545 auto * node = _subchannel_mesh.getChannelNode(i_ch, iz);
1546 const Real T = (*_T_soln)(node);
1547 const Real T_from_ph = _fp->T_from_p_h((*_P_soln)(node) + _P_out, (*_h_soln)(node));
1548 residual.push_back(T_from_ph - T);
1549 residual_norm_sq += Utility::pow<2>(residual.back());
1550 temperature_norm_sq += Utility::pow<2>(T);
1551 }
1552 }
1553
1554 // Set the temperature solution with relaxation if needed
1555 std::size_t i = 0;
1556 for (unsigned int iz = first_node; iz < last_node + 1; iz++)
1557 for (unsigned int i_ch = 0; i_ch < _n_channels; i_ch++)
1558 {
1559 auto * node = _subchannel_mesh.getChannelNode(i_ch, iz);
1560 _T_soln->set(node, (*_T_soln)(node) + _T_relaxation * residual[i]);
1561 ++i;
1562 }
1563
1564 return std::sqrt(residual_norm_sq) / (std::sqrt(temperature_norm_sq) + 1e-14);
1565}
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 572 of file SubChannel1PhaseProblem.C.

573{
574 const unsigned int last_node = (iblock + 1) * _block_size;
575 const unsigned int first_node = iblock * _block_size + 1;
576 // Initial guess, port crossflow of block (iblock) into a vector that will act as my initial guess
577 libMesh::DenseVector<Real> solution_seed(_n_gaps * _block_size, 0.0);
578 for (unsigned int iz = first_node; iz < last_node + 1; iz++)
579 {
580 for (unsigned int i_gap = 0; i_gap < _n_gaps; i_gap++)
581 {
582 int i = _n_gaps * (iz - first_node) + i_gap; // column wise transfer
583 solution_seed(i) = _Wij(i_gap, iz);
584 }
585 }
586
587 // Solving the combined lateral momentum equation for Wij using a PETSc solver and update vector
588 // root
590 LibmeshPetscCall(petscSnesSolver(iblock, solution_seed, root));
591
592 // Assign the solution to the cross-flow matrix
593 int i = 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 _Wij(i_gap, iz) = root(i);
599 i++;
600 }
601 }
602}
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 1933 of file SubChannel1PhaseProblem.C.

1934{
1935 const unsigned int last_node = (iblock + 1) * _block_size;
1936 const unsigned int first_node = iblock * _block_size + 1;
1937 for (unsigned int iz = first_node; iz < last_node + 1; iz++)
1938 {
1939 auto dz = _z_grid[iz] - _z_grid[iz - 1];
1940 for (unsigned int i_gap = 0; i_gap < _n_gaps; i_gap++)
1941 {
1942 auto chans = _subchannel_mesh.getGapChannels(i_gap);
1943 unsigned int i_ch = chans.first;
1944 unsigned int j_ch = chans.second;
1945 auto * node_in_i = _subchannel_mesh.getChannelNode(i_ch, iz - 1);
1946 auto * node_out_i = _subchannel_mesh.getChannelNode(i_ch, iz);
1947 auto * node_in_j = _subchannel_mesh.getChannelNode(j_ch, iz - 1);
1948 auto * node_out_j = _subchannel_mesh.getChannelNode(j_ch, iz);
1949 auto Si_in = (*_S_flow_soln)(node_in_i);
1950 auto Sj_in = (*_S_flow_soln)(node_in_j);
1951 auto Si_out = (*_S_flow_soln)(node_out_i);
1952 auto Sj_out = (*_S_flow_soln)(node_out_j);
1953 auto gap = _subchannel_mesh.getGapWidth(iz, i_gap);
1954 auto Sij = dz * gap;
1955 auto avg_massflux =
1956 0.5 * (((*_mdot_soln)(node_in_i) + (*_mdot_soln)(node_in_j)) / (Si_in + Sj_in) +
1957 ((*_mdot_soln)(node_out_i) + (*_mdot_soln)(node_out_j)) / (Si_out + Sj_out));
1958 auto beta = computeMixingParameter(i_gap, iz);
1959
1960 if (!_implicit_bool)
1961 {
1962 _WijPrime(i_gap, iz) = beta * avg_massflux * Sij;
1963 }
1964 else
1965 {
1966 auto iz_ind = iz - first_node;
1967 PetscScalar base_value = beta * 0.5 * Sij;
1968
1969 // Bottom values
1970 if (iz == first_node)
1971 {
1972 PetscScalar value_tl = -1.0 * base_value / (Si_in + Sj_in) *
1973 ((*_mdot_soln)(node_in_i) + (*_mdot_soln)(node_in_j));
1974 PetscInt row = i_gap + _n_gaps * iz_ind;
1975 LibmeshPetscCall(
1976 VecSetValues(_amc_turbulent_cross_flows_rhs, 1, &row, &value_tl, INSERT_VALUES));
1977 }
1978 else
1979 {
1980 PetscScalar value_tl = base_value / (Si_in + Sj_in);
1981 PetscInt row = i_gap + _n_gaps * iz_ind;
1982
1983 PetscInt col_ich = i_ch + _n_channels * (iz_ind - 1);
1984 LibmeshPetscCall(MatSetValues(
1985 _amc_turbulent_cross_flows_mat, 1, &row, 1, &col_ich, &value_tl, INSERT_VALUES));
1986
1987 PetscInt col_jch = j_ch + _n_channels * (iz_ind - 1);
1988 LibmeshPetscCall(MatSetValues(
1989 _amc_turbulent_cross_flows_mat, 1, &row, 1, &col_jch, &value_tl, INSERT_VALUES));
1990 }
1991
1992 // Top values
1993 PetscScalar value_bl = base_value / (Si_out + Sj_out);
1994 PetscInt row = i_gap + _n_gaps * iz_ind;
1995
1996 PetscInt col_ich = i_ch + _n_channels * iz_ind;
1997 LibmeshPetscCall(MatSetValues(
1998 _amc_turbulent_cross_flows_mat, 1, &row, 1, &col_ich, &value_bl, INSERT_VALUES));
1999
2000 PetscInt col_jch = j_ch + _n_channels * iz_ind;
2001 LibmeshPetscCall(MatSetValues(
2002 _amc_turbulent_cross_flows_mat, 1, &row, 1, &col_jch, &value_bl, INSERT_VALUES));
2003 }
2004 }
2005 }
2006
2007 if (_implicit_bool)
2008 {
2009 LibmeshPetscCall(MatAssemblyBegin(_amc_turbulent_cross_flows_mat, MAT_FINAL_ASSEMBLY));
2010 LibmeshPetscCall(MatAssemblyEnd(_amc_turbulent_cross_flows_mat, MAT_FINAL_ASSEMBLY));
2011
2013 Vec loc_prod;
2014 Vec loc_Wij;
2015 LibmeshPetscCall(VecDuplicate(_amc_sys_mdot_rhs, &loc_prod));
2016 LibmeshPetscCall(VecDuplicate(_Wij_vec, &loc_Wij));
2017 LibmeshPetscCall(populateVectorFromHandle<SolutionHandle>(
2018 loc_prod, *_mdot_soln, first_node, last_node, _n_channels));
2019 LibmeshPetscCall(MatMult(_amc_turbulent_cross_flows_mat, loc_prod, loc_Wij));
2020 LibmeshPetscCall(VecAXPY(loc_Wij, -1.0, _amc_turbulent_cross_flows_rhs));
2022 loc_Wij, _WijPrime, first_node, last_node, _n_gaps));
2023 LibmeshPetscCall(VecDestroy(&loc_prod));
2024 LibmeshPetscCall(VecDestroy(&loc_Wij));
2025 }
2026}
Mat _amc_turbulent_cross_flows_mat
Axial momentum Axial momentum conservation - compute turbulent cross fluxes.
PetscErrorCode populateDenseFromVector(const Vec &x, T &solution, const unsigned int first_axial_level, const unsigned int last_axial_level, const unsigned int cross_dimension)
Real computeMixingParameter(unsigned int i_gap, unsigned int iz) const
Computes and validates the turbulent mixing parameter.

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

◆ computeWijResidual()

void SubChannel1PhaseProblem::computeWijResidual ( int  iblock)
protectedinherited

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

Assembling system

Definition at line 1614 of file SubChannel1PhaseProblem.C.

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

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

◆ createPetscMatrix()

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

Definition at line 324 of file SubChannel1PhaseProblem.h.

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

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

◆ createPetscVector()

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

Petsc Functions.

Definition at line 313 of file SubChannel1PhaseProblem.h.

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

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

◆ detectDeformation()

void SubChannel1PhaseProblem::detectDeformation ( )
protectedinherited

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

Definition at line 439 of file SubChannel1PhaseProblem.C.

440{
442 const auto pin_diameter = _subchannel_mesh.getPinDiameter();
443
444 if (_pin_mesh_exist)
445 {
446 for (unsigned int iz = 0; iz < _n_cells + 1; iz++)
447 for (unsigned int i_pin = 0; i_pin < _n_pins; i_pin++)
448 {
449 auto * node = _subchannel_mesh.getPinNode(i_pin, iz);
450 const Real Dpin = (*_Dpin_soln)(node);
451 if (std::abs(Dpin) <= tol)
452 mooseError("Dpin is zero at node ",
453 node->id(),
454 ". You must initialize Dpin to a non-zero value.");
455 if (std::abs(Dpin - pin_diameter) > tol)
456 _deformation = true;
457 }
458 }
459
460 for (unsigned int iz = 0; iz < _n_cells + 1 && !_deformation; iz++)
461 for (unsigned int i_ch = 0; i_ch < _n_channels && !_deformation; i_ch++)
462 {
463 auto * node = _subchannel_mesh.getChannelNode(i_ch, iz);
464 auto subch_type = _subchannel_mesh.getSubchannelType(i_ch);
465
466 if ((subch_type == EChannelType::CORNER || subch_type == EChannelType::EDGE) &&
467 std::abs((*_displacement_soln)(node)) > tol)
468 _deformation = true;
469 }
470}
const double tol
std::unique_ptr< SolutionHandle > _displacement_soln
bool _deformation
Flag that activates the effect of deformation (pin/duct) based on the auxvalues for displacement,...
static constexpr Real TOLERANCE

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

◆ externalSolve()

void SubChannel1PhaseProblem::externalSolve ( )
overridevirtualinherited

Assigning temperatures to duct

Implements ExternalProblem.

Definition at line 2737 of file SubChannel1PhaseProblem.C.

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

88 {
89 return computeAddedHeatDuct(i_ch, iz);
90 }

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

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

◆ getBulkReynoldsNumber()

Real SubChannel1PhaseProblem::getBulkReynoldsNumber ( ) const
inlineinherited

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

96{ 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 102 of file SubChannel1PhaseProblem.h.

102{ return _fp; }

Referenced by SCMMixingKimAndChung::computeLatticeMixingParameter().

◆ getSubChannelPeripheralDuctWidth()

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

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

Implements SubChannel1PhaseProblem.

Definition at line 309 of file TriSubChannel1PhaseProblem.C.

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

◆ implicitPetscSolve()

PetscErrorCode SubChannel1PhaseProblem::implicitPetscSolve ( int  iblock)
protectedinherited

Computes implicit solve using PetSc.

Definition at line 2255 of file SubChannel1PhaseProblem.C.

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

Function to initialize the solution & geometry fields.

Implements SubChannel1PhaseProblem.

Definition at line 69 of file TriSubChannel1PhaseProblem.C.

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

◆ initialSetup()

void SubChannel1PhaseProblem::initialSetup ( )
overridevirtualinherited

Set value for turbulent momentum modeling parameter CT

Reimplemented from ExternalProblem.

Definition at line 367 of file SubChannel1PhaseProblem.C.

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

2108{
2109 SNES snes;
2110 KSP ksp;
2111 PC pc;
2112 Vec x, r;
2113 PetscScalar * xx;
2114
2116 LibmeshPetscCall(SNESCreate(PETSC_COMM_SELF, &snes));
2117 LibmeshPetscCall(VecCreate(PETSC_COMM_SELF, &x));
2118 LibmeshPetscCall(VecSetSizes(x, PETSC_DECIDE, _block_size * _n_gaps));
2119 LibmeshPetscCall(VecSetFromOptions(x));
2120 LibmeshPetscCall(VecDuplicate(x, &r));
2121
2122#if PETSC_VERSION_LESS_THAN(3, 13, 0)
2123 LibmeshPetscCall(PetscOptionsSetValue(PETSC_NULL, "-snes_mf", PETSC_NULL));
2124#else
2125 LibmeshPetscCall(SNESSetUseMatrixFree(snes, PETSC_FALSE, PETSC_TRUE));
2126#endif
2127 Ctx ctx;
2128 ctx.iblock = iblock;
2129 ctx.schp = this;
2130 LibmeshPetscCall(SNESSetFunction(snes, r, formFunction, &ctx));
2131 LibmeshPetscCall(SNESGetKSP(snes, &ksp));
2132 LibmeshPetscCall(KSPGetPC(ksp, &pc));
2133 LibmeshPetscCall(PCSetType(pc, PCNONE));
2134 LibmeshPetscCall(KSPSetTolerances(ksp, _rtol, _atol, _dtol, _maxit));
2135 LibmeshPetscCall(SNESSetFromOptions(snes));
2136 LibmeshPetscCall(VecGetArray(x, &xx));
2137 for (unsigned int i = 0; i < _block_size * _n_gaps; i++)
2138 {
2139 xx[i] = solution(i);
2140 }
2141 LibmeshPetscCall(VecRestoreArray(x, &xx));
2142
2143 LibmeshPetscCall(SNESSolve(snes, NULL, x));
2144 LibmeshPetscCall(VecGetArray(x, &xx));
2145 for (unsigned int i = 0; i < _block_size * _n_gaps; i++)
2146 root(i) = xx[i];
2147
2148 LibmeshPetscCall(VecRestoreArray(x, &xx));
2149 LibmeshPetscCall(VecDestroy(&x));
2150 LibmeshPetscCall(VecDestroy(&r));
2151 LibmeshPetscCall(SNESDestroy(&snes));
2152 PetscFunctionReturn(LIBMESH_PETSC_SUCCESS);
2153}
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 446 of file SubChannel1PhaseProblem.h.

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

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

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

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

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

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

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

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

2064{
2065 const unsigned int last_node = (iblock + 1) * _block_size;
2066 const unsigned int first_node = iblock * _block_size + 1;
2067 libMesh::DenseVector<Real> Wij_residual_vector(_n_gaps * _block_size, 0.0);
2068 // Assign the solution to the cross-flow matrix
2069 int i = 0;
2070 for (unsigned int iz = first_node; iz < last_node + 1; iz++)
2071 {
2072 for (unsigned int i_gap = 0; i_gap < _n_gaps; i_gap++)
2073 {
2074 _Wij(i_gap, iz) = solution(i);
2075 i++;
2076 }
2077 }
2078
2079 // Calculating sum of crossflows
2080 computeSumWij(iblock);
2081 // Solving axial flux
2082 computeMdot(iblock);
2083 // Calculation of turbulent Crossflow
2084 computeWijPrime(iblock);
2085 // Solving for Pressure Drop
2086 computeDP(iblock);
2087 // Solving for pressure
2088 computeP(iblock);
2089 // Populating lateral crossflow residual matrix
2090 computeWijResidual(iblock);
2091
2092 // Turn the residual matrix into a residual vector
2093 for (unsigned int iz = 0; iz < _block_size; iz++)
2094 {
2095 for (unsigned int i_gap = 0; i_gap < _n_gaps; i_gap++)
2096 {
2097 int i = _n_gaps * iz + i_gap; // column wise transfer
2098 Wij_residual_vector(i) = _Wij_residual_matrix(i_gap, iz);
2099 }
2100 }
2101 return Wij_residual_vector;
2102}

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

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

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

◆ solverSystemConverged()

bool SubChannel1PhaseProblem::solverSystemConverged ( const unsigned int  )
overridevirtualinherited

Reimplemented from ExternalProblem.

Definition at line 537 of file SubChannel1PhaseProblem.C.

538{
539 return _converged;
540}

◆ syncSolutions()

void SubChannel1PhaseProblem::syncSolutions ( Direction  direction)
overridevirtualinherited

Implements ExternalProblem.

Definition at line 3081 of file SubChannel1PhaseProblem.C.

3082{
3083}

◆ validParams()

InputParameters TriSubChannel1PhaseProblem::validParams ( )
static

Definition at line 23 of file TriSubChannel1PhaseProblem.C.

24{
26 params.addClassDescription("Solver class for subchannels in a triangular lattice assembly and "
27 "bare/wire-wrapped fuel pins");
28 return params;
29}
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 432 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 380 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 383 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 386 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 390 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 377 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 374 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

◆ _cmc_advective_derivative_mat

Mat SubChannel1PhaseProblem::_cmc_advective_derivative_mat
protectedinherited

Cross momentum conservation - advective (Eulerian) derivative.

Definition at line 403 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 400 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 218 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 222 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 220 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 228 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 254 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 260 of file SubChannel1PhaseProblem.h.

Referenced by SubChannel1PhaseProblem::implicitPetscSolve().

◆ _CT

Real SubChannel1PhaseProblem::_CT
protectedinherited

Turbulent modeling parameter used in axial momentum equation.

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

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

◆ _dir_grav

const Real SubChannel1PhaseProblem::_dir_grav
protectedinherited

Definition at line 273 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 306 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 248 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 205 of file SubChannel1PhaseProblem.h.

Referenced by SubChannel1PhaseProblem::computeDP().

◆ _gravity_direction

const MooseEnum SubChannel1PhaseProblem::_gravity_direction
protectedinherited

The direction of gravity.

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

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

◆ _hc_advective_derivative_rhs

Vec SubChannel1PhaseProblem::_hc_advective_derivative_rhs
protectedinherited

◆ _hc_axial_heat_conduction_mat

Mat TriSubChannel1PhaseProblem::_hc_axial_heat_conduction_mat
protected

Definition at line 34 of file TriSubChannel1PhaseProblem.h.

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

◆ _hc_axial_heat_conduction_rhs

Vec TriSubChannel1PhaseProblem::_hc_axial_heat_conduction_rhs
protected

Definition at line 35 of file TriSubChannel1PhaseProblem.h.

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

◆ _hc_cross_derivative_mat

Mat SubChannel1PhaseProblem::_hc_cross_derivative_mat
protectedinherited

◆ _hc_cross_derivative_rhs

Vec SubChannel1PhaseProblem::_hc_cross_derivative_rhs
protectedinherited

◆ _hc_radial_heat_conduction_mat

Mat TriSubChannel1PhaseProblem::_hc_radial_heat_conduction_mat
protected

Definition at line 36 of file TriSubChannel1PhaseProblem.h.

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

◆ _hc_radial_heat_conduction_rhs

Vec TriSubChannel1PhaseProblem::_hc_radial_heat_conduction_rhs
protected

Definition at line 37 of file TriSubChannel1PhaseProblem.h.

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

◆ _hc_sweep_enthalpy_mat

Mat TriSubChannel1PhaseProblem::_hc_sweep_enthalpy_mat
protected

Definition at line 38 of file TriSubChannel1PhaseProblem.h.

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

◆ _hc_sweep_enthalpy_rhs

Vec TriSubChannel1PhaseProblem::_hc_sweep_enthalpy_rhs
protected

Definition at line 39 of file TriSubChannel1PhaseProblem.h.

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

◆ _hc_sys_h_mat

Mat SubChannel1PhaseProblem::_hc_sys_h_mat
protectedinherited

◆ _hc_sys_h_rhs

Vec SubChannel1PhaseProblem::_hc_sys_h_rhs
protectedinherited

◆ _hc_time_derivative_mat

Mat SubChannel1PhaseProblem::_hc_time_derivative_mat
protectedinherited

◆ _hc_time_derivative_rhs

Vec SubChannel1PhaseProblem::_hc_time_derivative_rhs
protectedinherited

◆ _HTC_soln

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

◆ _implicit_bool

const bool SubChannel1PhaseProblem::_implicit_bool
protectedinherited

◆ _interpolation_scheme

const MooseEnum SubChannel1PhaseProblem::_interpolation_scheme
protectedinherited

The interpolation method used in constructing the systems.

Definition at line 270 of file SubChannel1PhaseProblem.h.

Referenced by SubChannel1PhaseProblem::computeDP(), 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 250 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 256 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 362 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 214 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 240 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 238 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 252 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 438 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 258 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 305 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 277 of file SubChannel1PhaseProblem.h.

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

◆ _subchannel_mesh

SubChannelMesh& SubChannel1PhaseProblem::_subchannel_mesh
protectedinherited

◆ _SumWij_soln

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

◆ _T_maxit

const int& SubChannel1PhaseProblem::_T_maxit
protectedinherited

Maximum iterations for the inner temperature loop.

Definition at line 244 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 246 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 242 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 232 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 216 of file SubChannel1PhaseProblem.h.

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

◆ _tri_sch_mesh

TriSubChannelMesh& TriSubChannel1PhaseProblem::_tri_sch_mesh
protected

◆ _verbose_subchannel

const bool SubChannel1PhaseProblem::_verbose_subchannel
protectedinherited

◆ _w_perim_soln

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

◆ _Wij

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

◆ _Wij_old

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

◆ _Wij_residual_matrix

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

◆ _Wij_vec

Vec SubChannel1PhaseProblem::_Wij_vec
protectedinherited

◆ _WijPrime

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

◆ _z_grid

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

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