https://mooseframework.inl.gov
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | Protected Attributes | List of all members
QuadSubChannel1PhaseProblem Class Referenceabstract

Quadrilateral subchannel solver. More...

#include <QuadSubChannel1PhaseProblem.h>

Inheritance diagram for QuadSubChannel1PhaseProblem:
[legend]

Public Types

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

Public Member Functions

 QuadSubChannel1PhaseProblem (const InputParameters &params)
 
virtual void externalSolve () override
 
virtual void syncSolutions (Direction direction) override
 
virtual bool solverSystemConverged (const unsigned int) override
 
virtual void initialSetup () override
 
const SCMHTCClosureBasegetDuctHTCClosure () const
 
const SCMHTCClosureBasegetPinHTCClosure () const
 
const SCMFrictionClosureBasegetFrictionClosure () const
 
Real getAddedHeatPin (unsigned int i_ch, unsigned int iz) const
 Return the added heat coming from the fuel pins. More...
 
Real getAddedHeatDuct (unsigned int i_ch, unsigned int iz) const
 Return the added heat coming from the duct. More...
 
const PostprocessorValuegetOutletPressure () const
 Get outlet pressure. More...
 
const SinglePhaseFluidPropertiesgetSinglePhaseFluidProperties () const
 Get fluid properties object. More...
 
virtual void solve (unsigned int nl_sys_num=0) override final
 
virtual void addExternalVariables ()
 
bool initialized () const
 
virtual libMesh::EquationSystemses () override
 
virtual MooseMeshmesh () override
 
virtual const MooseMeshmesh () const override
 
const MooseMeshmesh (bool use_displaced) const override
 
MooseMeshmesh (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::CouplingMatrixcouplingMatrix (const unsigned int nl_sys_num) const override
 
void setNonlocalCouplingMatrix ()
 
bool areCoupled (const unsigned int ivar, const unsigned int jvar, const unsigned int nl_sys_num) const
 
bool hasUOAuxStateCheck () const
 
bool checkingUOAuxState () const
 
virtual bool checkResidualForNans () const override
 
void setCheckResidualForNans (bool check_residual_for_nans)
 
void trustUserCouplingMatrix ()
 
std::vector< std::pair< MooseVariableFEBase *, MooseVariableFEBase *> > & couplingEntries (const THREAD_ID tid, const unsigned int nl_sys_num)
 
std::vector< std::pair< MooseVariableFEBase *, MooseVariableFEBase *> > & nonlocalCouplingEntries (const THREAD_ID tid, const unsigned int nl_sys_num)
 
virtual bool hasVariable (const std::string &var_name) const override
 
bool hasSolverVariable (const std::string &var_name) const
 
virtual const MooseVariableFieldBasegetVariable (const THREAD_ID tid, const std::string &var_name, Moose::VarKindType expected_var_type=Moose::VarKindType::VAR_ANY, Moose::VarFieldType expected_var_field_type=Moose::VarFieldType::VAR_FIELD_ANY) const override
 
virtual const MooseVariableFieldBasegetVariable (const THREAD_ID tid, const std::string &var_name, Moose::VarKindType expected_var_type=Moose::VarKindType::VAR_ANY, Moose::VarFieldType expected_var_field_type=Moose::VarFieldType::VAR_FIELD_ANY) const =0
 
virtual MooseVariableFieldBasegetVariable (const THREAD_ID tid, const std::string &var_name, Moose::VarKindType expected_var_type=Moose::VarKindType::VAR_ANY, Moose::VarFieldType expected_var_field_type=Moose::VarFieldType::VAR_FIELD_ANY)
 
virtual MooseVariableFieldBasegetVariable (const THREAD_ID tid, const std::string &var_name, Moose::VarKindType expected_var_type=Moose::VarKindType::VAR_ANY, Moose::VarFieldType expected_var_field_type=Moose::VarFieldType::VAR_FIELD_ANY)
 
MooseVariableFieldBasegetActualFieldVariable (const THREAD_ID tid, const std::string &var_name) override
 
virtual MooseVariablegetStandardVariable (const THREAD_ID tid, const std::string &var_name) override
 
virtual VectorMooseVariablegetVectorVariable (const THREAD_ID tid, const std::string &var_name) override
 
virtual ArrayMooseVariablegetArrayVariable (const THREAD_ID tid, const std::string &var_name) override
 
virtual bool hasScalarVariable (const std::string &var_name) const override
 
virtual MooseVariableScalargetScalarVariable (const THREAD_ID tid, const std::string &var_name) override
 
virtual libMesh::SystemgetSystem (const std::string &var_name) override
 
const RestartableEquationSystemsgetRestartableEquationSystems () 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 Assemblyassembly (const THREAD_ID tid, const unsigned int sys_num) override
 
virtual const Assemblyassembly (const THREAD_ID tid, const unsigned int sys_num) const override
 
Moose::Kokkos::AssemblykokkosAssembly ()
 
const Moose::Kokkos::AssemblykokkosAssembly () 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 addGhostedElem (dof_id_type elem_id) override
 
virtual void addGhostedBoundary (BoundaryID boundary_id) override
 
virtual void ghostGhostedBoundaries () override
 
virtual void sizeZeroes (unsigned int size, const THREAD_ID tid)
 
virtual bool reinitDirac (const Elem *elem, const THREAD_ID tid) override
 
virtual void reinitElem (const Elem *elem, const THREAD_ID tid) override
 
virtual void reinitElemPhys (const Elem *elem, const std::vector< Point > &phys_points_in_elem, const THREAD_ID tid) override
 
void reinitElemFace (const Elem *elem, unsigned int side, BoundaryID, const THREAD_ID tid)
 
virtual void reinitElemFace (const Elem *elem, unsigned int side, const THREAD_ID tid) override
 
virtual void reinitLowerDElem (const Elem *lower_d_elem, const THREAD_ID tid, const std::vector< Point > *const pts=nullptr, const std::vector< Real > *const weights=nullptr) override
 
virtual void reinitNode (const Node *node, const THREAD_ID tid) override
 
virtual void reinitNodeFace (const Node *node, BoundaryID bnd_id, const THREAD_ID tid) override
 
virtual void reinitNodes (const std::vector< dof_id_type > &nodes, const THREAD_ID tid) override
 
virtual void reinitNodesNeighbor (const std::vector< dof_id_type > &nodes, const THREAD_ID tid) override
 
virtual void reinitNeighbor (const Elem *elem, unsigned int side, const THREAD_ID tid) override
 
virtual void reinitNeighborPhys (const Elem *neighbor, unsigned int neighbor_side, const std::vector< Point > &physical_points, const THREAD_ID tid) override
 
virtual void reinitNeighborPhys (const Elem *neighbor, const std::vector< Point > &physical_points, const THREAD_ID tid) override
 
virtual void reinitElemNeighborAndLowerD (const Elem *elem, unsigned int side, const THREAD_ID tid) override
 
virtual void reinitScalars (const THREAD_ID tid, bool reinit_for_derivative_reordering=false) override
 
virtual void reinitOffDiagScalars (const THREAD_ID tid) override
 
virtual void getDiracElements (std::set< const Elem * > &elems) override
 
virtual void clearDiracInfo () override
 
virtual void subdomainSetup (SubdomainID subdomain, const THREAD_ID tid)
 
virtual void neighborSubdomainSetup (SubdomainID subdomain, const THREAD_ID tid)
 
virtual void newAssemblyArray (std::vector< std::shared_ptr< SolverSystem >> &solver_systems)
 
virtual void initNullSpaceVectors (const InputParameters &parameters, std::vector< std::shared_ptr< NonlinearSystemBase >> &nl)
 
virtual void init () override
 
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 Realtime () const
 
virtual RealtimeOld () const
 
virtual inttimeStep () const
 
virtual Realdt () const
 
virtual RealdtOld () const
 
Real getTimeFromStateArg (const Moose::StateArg &state) const
 
virtual void transient (bool trans)
 
virtual bool isTransient () const override
 
virtual void addTimeIntegrator (const std::string &type, const std::string &name, InputParameters &parameters)
 
virtual void addPredictor (const std::string &type, const std::string &name, InputParameters &parameters)
 
virtual void copySolutionsBackwards ()
 
void skipNextForwardSolutionCopyToOld ()
 
virtual void advanceState ()
 
virtual void restoreSolutions ()
 
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::PetscOptionsgetPetscOptions ()
 
void logAdd (const std::string &system, const std::string &name, const std::string &type, const InputParameters &params) const
 
virtual void addFunction (const std::string &type, const std::string &name, InputParameters &parameters)
 
virtual bool hasFunction (const std::string &name, const THREAD_ID tid=0)
 
virtual FunctiongetFunction (const std::string &name, const THREAD_ID tid=0)
 
virtual void 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)
 
TgetKokkosFunction (const std::string &name)
 
virtual void addMeshDivision (const std::string &type, const std::string &name, InputParameters &params)
 
MeshDivisiongetMeshDivision (const std::string &name, const THREAD_ID tid=0) const
 
virtual void addConvergence (const std::string &type, const std::string &name, InputParameters &parameters)
 
virtual ConvergencegetConvergence (const std::string &name, const THREAD_ID tid=0) const
 
virtual const std::vector< std::shared_ptr< Convergence > > & getConvergenceObjects (const THREAD_ID tid=0) const
 
virtual bool hasConvergence (const std::string &name, const THREAD_ID tid=0) const
 
bool needToAddDefaultNonlinearConvergence () const
 
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 ()
 
LineSearchgetLineSearch () override
 
virtual void addDistribution (const std::string &type, const std::string &name, InputParameters &parameters)
 
virtual bool hasDistribution (const std::string &name) const
 
virtual DistributiongetDistribution (const std::string &name)
 
virtual void addSampler (const std::string &type, const std::string &name, InputParameters &parameters)
 
virtual SamplergetSampler (const std::string &name, const THREAD_ID tid=0)
 
NonlinearSystemBasegetNonlinearSystemBase (const unsigned int sys_num)
 
const NonlinearSystemBasegetNonlinearSystemBase (const unsigned int sys_num) const
 
void setCurrentNonlinearSystem (const unsigned int nl_sys_num)
 
NonlinearSystemBasecurrentNonlinearSystem ()
 
const NonlinearSystemBasecurrentNonlinearSystem () const
 
virtual const SystemBasesystemBaseNonlinear (const unsigned int sys_num) const override
 
virtual SystemBasesystemBaseNonlinear (const unsigned int sys_num) override
 
virtual const SystemBasesystemBaseSolver (const unsigned int sys_num) const override
 
virtual SystemBasesystemBaseSolver (const unsigned int sys_num) override
 
virtual const SystemBasesystemBaseAuxiliary () const override
 
virtual SystemBasesystemBaseAuxiliary () override
 
virtual NonlinearSystemgetNonlinearSystem (const unsigned int sys_num)
 
virtual const SystemBasegetSystemBase (const unsigned int sys_num) const
 
virtual SystemBasegetSystemBase (const unsigned int sys_num)
 
SystemBasegetSystemBase (const std::string &sys_name)
 
LinearSystemgetLinearSystem (unsigned int sys_num)
 
const LinearSystemgetLinearSystem (unsigned int sys_num) const
 
SolverSystemgetSolverSystem (unsigned int sys_num)
 
const SolverSystemgetSolverSystem (unsigned int sys_num) const
 
void setCurrentLinearSystem (unsigned int sys_num)
 
LinearSystemcurrentLinearSystem ()
 
const LinearSystemcurrentLinearSystem () const
 
virtual const SystemBasesystemBaseLinear (unsigned int sys_num) const override
 
virtual SystemBasesystemBaseLinear (unsigned int sys_num) override
 
virtual void addVariable (const std::string &var_type, const std::string &var_name, InputParameters &params)
 
virtual void addKernel (const std::string &kernel_name, const std::string &name, InputParameters &parameters)
 
virtual void addHDGKernel (const std::string &kernel_name, const std::string &name, InputParameters &parameters)
 
virtual void addNodalKernel (const std::string &kernel_name, const std::string &name, InputParameters &parameters)
 
virtual void addScalarKernel (const std::string &kernel_name, const std::string &name, InputParameters &parameters)
 
virtual void addBoundaryCondition (const std::string &bc_name, const std::string &name, InputParameters &parameters)
 
virtual void 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 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)
 
AuxiliarySystemgetAuxiliarySystem ()
 
virtual void addDiracKernel (const std::string &kernel_name, const std::string &name, InputParameters &parameters)
 
virtual void addDGKernel (const std::string &kernel_name, const std::string &name, InputParameters &parameters)
 
virtual void addFVKernel (const std::string &kernel_name, const std::string &name, InputParameters &parameters)
 
virtual void addLinearFVKernel (const std::string &kernel_name, const std::string &name, InputParameters &parameters)
 
virtual void addFVBC (const std::string &fv_bc_name, const std::string &name, InputParameters &parameters)
 
virtual void addLinearFVBC (const std::string &fv_bc_name, const std::string &name, InputParameters &parameters)
 
virtual void addFVInterfaceKernel (const std::string &fv_ik_name, const std::string &name, InputParameters &parameters)
 
virtual void addInterfaceKernel (const std::string &kernel_name, const std::string &name, InputParameters &parameters)
 
virtual void addInitialCondition (const std::string &ic_name, const std::string &name, InputParameters &parameters)
 
virtual void addFVInitialCondition (const std::string &ic_name, const std::string &name, InputParameters &parameters)
 
void projectSolution ()
 
unsigned short getCurrentICState ()
 
void projectInitialConditionOnCustomRange (libMesh::ConstElemRange &elem_range, ConstBndNodeRange &bnd_node_range, 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 ReporterDatagetReporterData () const
 
ReporterDatagetReporterData (ReporterData::WriteKey)
 
virtual std::vector< std::shared_ptr< UserObject > > addUserObject (const std::string &user_object_name, const std::string &name, InputParameters &parameters)
 
TgetUserObject (const std::string &name, unsigned int tid=0) const
 
const UserObjectgetUserObjectBase (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 TgetKokkosUserObject (const std::string &name) const
 
bool hasKokkosUserObject (const std::string &name) const
 
void checkUserObjectNameCollision (const std::string &name, const std::string &type) const
 
const PositionsgetPositionsObject (const std::string &name) const
 
virtual void addFVInterpolationMethod (const std::string &method_type, const std::string &name, InputParameters &parameters)
 
const FVInterpolationMethodgetFVInterpolationMethod (const InterpolationMethodName &name, const THREAD_ID tid=0) const
 
const FVFaceInterpolationMethodgetFVFaceInterpolationMethod (const InterpolationMethodName &name, const THREAD_ID tid=0) const
 
const FVAdvectedInterpolationMethodgetFVAdvectedInterpolationMethod (const InterpolationMethodName &name, const THREAD_ID tid=0) const
 
bool hasFVInterpolationMethod (const InterpolationMethodName &name) const
 
bool hasPostprocessorValueByName (const PostprocessorName &name) const
 
const PostprocessorgetPostprocessorObjectByName (const PostprocessorName &object_name, const THREAD_ID tid=0) const
 
const PostprocessorValuegetPostprocessorValueByName (const PostprocessorName &name, std::size_t t_index=0) const
 
virtual const PostprocessorValuegetPostprocessorValueByName (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 VectorPostprocessorValuegetVectorPostprocessorValueByName (const std::string &object_name, const std::string &vector_name, std::size_t t_index=0) const
 
void setVectorPostprocessorValueByName (const std::string &object_name, const std::string &vector_name, const VectorPostprocessorValue &value, std::size_t t_index=0)
 
const VectorPostprocessorgetVectorPostprocessorObjectByName (const std::string &object_name, const THREAD_ID tid=0) const
 
virtual void addDamper (const std::string &damper_name, const std::string &name, InputParameters &parameters)
 
void setupDampers ()
 
bool hasDampers ()
 
virtual void addIndicator (const std::string &indicator_name, const std::string &name, InputParameters &parameters)
 
virtual void addMarker (const std::string &marker_name, const std::string &name, InputParameters &parameters)
 
virtual void addMultiApp (const std::string &multi_app_name, const std::string &name, InputParameters &parameters)
 
std::shared_ptr< MultiAppgetMultiApp (const std::string &multi_app_name) const
 
std::vector< std::shared_ptr< Transfer > > getTransfers (ExecFlagType type, Transfer::DIRECTION direction) const
 
std::vector< std::shared_ptr< Transfer > > getTransfers (Transfer::DIRECTION direction) const
 
const ExecuteMooseObjectWarehouse< Transfer > & getMultiAppTransferWarehouse (Transfer::DIRECTION direction) const
 
void execMultiAppTransfers (ExecFlagType type, Transfer::DIRECTION direction)
 
bool execMultiApps (ExecFlagType type, bool auto_advance=true)
 
void finalizeMultiApps ()
 
void incrementMultiAppTStep (ExecFlagType type)
 
void advanceMultiApps (ExecFlagType type)
 
void finishMultiAppStep (ExecFlagType type, bool recurse_through_multiapp_levels=false)
 
void backupMultiApps (ExecFlagType type)
 
void restoreMultiApps (ExecFlagType type, bool force=false)
 
Real computeMultiAppsDT (ExecFlagType type)
 
virtual void addTransfer (const std::string &transfer_name, const std::string &name, InputParameters &parameters)
 
void execTransfers (ExecFlagType type)
 
Real computeResidualL2Norm (NonlinearSystemBase &sys)
 
Real computeResidualL2Norm (LinearSystem &sys)
 
virtual Real computeResidualL2Norm ()
 
virtual void computeResidualSys (libMesh::NonlinearImplicitSystem &sys, const NumericVector< libMesh::Number > &soln, NumericVector< libMesh::Number > &residual)
 
void computeResidual (libMesh::NonlinearImplicitSystem &sys, const NumericVector< libMesh::Number > &soln, NumericVector< libMesh::Number > &residual)
 
virtual void computeResidual (const NumericVector< libMesh::Number > &soln, NumericVector< libMesh::Number > &residual, const unsigned int nl_sys_num)
 
void computeResidualAndJacobian (const NumericVector< libMesh::Number > &soln, NumericVector< libMesh::Number > &residual, libMesh::SparseMatrix< libMesh::Number > &jacobian)
 
virtual void computeResidualTag (const NumericVector< libMesh::Number > &soln, NumericVector< libMesh::Number > &residual, TagID tag)
 
virtual void computeResidualType (const NumericVector< libMesh::Number > &soln, NumericVector< libMesh::Number > &residual, TagID tag)
 
virtual void computeResidualInternal (const NumericVector< libMesh::Number > &soln, NumericVector< libMesh::Number > &residual, const std::set< TagID > &tags)
 
virtual void computeResidualTags (const std::set< TagID > &tags)
 
virtual void computeJacobianSys (libMesh::NonlinearImplicitSystem &sys, const NumericVector< libMesh::Number > &soln, libMesh::SparseMatrix< libMesh::Number > &jacobian)
 
virtual void computeJacobian (const NumericVector< libMesh::Number > &soln, libMesh::SparseMatrix< libMesh::Number > &jacobian, const unsigned int nl_sys_num)
 
virtual void computeJacobianTag (const NumericVector< libMesh::Number > &soln, libMesh::SparseMatrix< libMesh::Number > &jacobian, TagID tag)
 
virtual void computeJacobianInternal (const NumericVector< libMesh::Number > &soln, libMesh::SparseMatrix< libMesh::Number > &jacobian, const std::set< TagID > &tags)
 
virtual void computeJacobianTags (const std::set< TagID > &tags)
 
virtual void computeJacobianBlocks (std::vector< JacobianBlock * > &blocks, const unsigned int nl_sys_num)
 
virtual void computeJacobianBlock (libMesh::SparseMatrix< libMesh::Number > &jacobian, libMesh::System &precond_system, unsigned int ivar, unsigned int jvar)
 
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 DisplacedProblemgetDisplacedProblem () const
 
virtual std::shared_ptr< DisplacedProblemgetDisplacedProblem ()
 
virtual void updateGeomSearch (GeometricSearchData::GeometricSearchType type=GeometricSearchData::ALL) override
 
virtual void updateMortarMesh ()
 
void createMortarInterface (const std::pair< BoundaryID, BoundaryID > &primary_secondary_boundary_pair, const std::pair< SubdomainID, SubdomainID > &primary_secondary_subdomain_pair, bool on_displaced, bool periodic, const bool debug, const bool correct_edge_dropping, const Real minimum_projection_angle)
 
const std::unordered_map< std::pair< BoundaryID, BoundaryID >, std::unique_ptr< AutomaticMortarGeneration > > & getMortarInterfaces (bool on_displaced) const
 
virtual void possiblyRebuildGeomSearchPatches ()
 
virtual GeometricSearchDatageomSearchData () override
 
void setRestartFile (const std::string &file_name)
 
const MaterialPropertyRegistrygetMaterialPropertyRegistry () const
 
const InitialConditionWarehousegetInitialConditionWarehouse () const
 
const FVInitialConditionWarehousegetFVInitialConditionWarehouse () const
 
SolverParamssolverParams (unsigned int solver_sys_num=0)
 
const SolverParamssolverParams (unsigned int solver_sys_num=0) const
 
Adaptivityadaptivity ()
 
virtual void initialAdaptMesh ()
 
virtual bool adaptMesh ()
 
unsigned int getNumCyclesCompleted ()
 
bool hasInitialAdaptivity () const
 
bool hasInitialAdaptivity () const
 
void initXFEM (std::shared_ptr< XFEMInterface > xfem)
 
std::shared_ptr< XFEMInterfacegetXFEM ()
 
bool haveXFEM ()
 
virtual bool updateMeshXFEM ()
 
virtual void meshChanged (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 MaterialWarehousegetMaterialWarehouse () const
 
const MaterialWarehousegetRegularMaterialsWarehouse () const
 
const MaterialWarehousegetDiscreteMaterialWarehouse () const
 
const MaterialWarehousegetInterfaceMaterialsWarehouse () const
 
const MaterialWarehousegetKokkosMaterialsWarehouse () const
 
std::shared_ptr< MaterialBasegetMaterial (std::string name, Moose::MaterialDataType type, const THREAD_ID tid=0, bool no_warn=false)
 
MaterialDatagetMaterialData (Moose::MaterialDataType type, const THREAD_ID tid=0, const MooseObject *object=nullptr) const
 
MaterialDatagetKokkosMaterialData (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 ExecutorgetExecutor (const std::string &name)
 
virtual void computeUserObjects (const ExecFlagType &type, const Moose::AuxGroup &group)
 
virtual void computeUserObjectByName (const ExecFlagType &type, const Moose::AuxGroup &group, const std::string &name)
 
void needsPreviousNewtonIteration (bool state)
 
bool needsPreviousNewtonIteration () const
 
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
 
ExecuteMooseObjectWarehouse< Control > & getControlWarehouse ()
 
void executeControls (const ExecFlagType &exec_type)
 
void executeSamplers (const ExecFlagType &exec_type)
 
virtual void updateActiveObjects ()
 
void reportMooseObjectDependency (MooseObject *a, MooseObject *b)
 
ExecuteMooseObjectWarehouse< MultiApp > & getMultiAppWarehouse ()
 
bool hasJacobian () const
 
bool constJacobian () const
 
void addOutput (const std::string &, const std::string &, InputParameters &)
 
TheWarehousetheWarehouse () const
 
void setSNESMFReuseBase (bool reuse, bool set_by_user)
 
bool useSNESMFReuseBase ()
 
void skipExceptionCheck (bool skip_exception_check)
 
bool isSNESMFReuseBaseSetbyUser ()
 
bool & petscOptionsInserted ()
 
PetscOptions & petscOptionsDatabase ()
 
virtual void setUDotRequested (const bool u_dot_requested)
 
virtual void setUDotDotRequested (const bool u_dotdot_requested)
 
virtual void setUDotOldRequested (const bool u_dot_old_requested)
 
virtual void setUDotDotOldRequested (const bool u_dotdot_old_requested)
 
virtual bool uDotRequested ()
 
virtual bool uDotDotRequested ()
 
virtual bool uDotOldRequested ()
 
virtual bool uDotDotOldRequested ()
 
void haveADObjects (bool have_ad_objects) override
 
virtual void haveADObjects (bool have_ad_objects)
 
bool haveADObjects () const
 
bool haveADObjects () const
 
bool shouldSolve () const
 
const MortarInterfaceWarehousemortarData () const
 
MortarInterfaceWarehousemortarData ()
 
virtual bool hasNeighborCoupling () const
 
virtual bool hasMortarCoupling () const
 
void computingNonlinearResid (bool computing_nonlinear_residual) final
 
bool computingNonlinearResid () const
 
virtual void computingNonlinearResid (const bool computing_nonlinear_residual)
 
bool computingNonlinearResid () const
 
void setCurrentlyComputingResidual (bool currently_computing_residual) final
 
void numGridSteps (unsigned int num_grid_steps)
 
void uniformRefine ()
 
void automaticScaling (bool automatic_scaling) override
 
virtual void automaticScaling (bool automatic_scaling)
 
bool automaticScaling () const
 
bool automaticScaling () const
 
virtual void reinitElemFaceRef (const Elem *elem, unsigned int side, Real tolerance, const std::vector< Point > *const pts, const std::vector< Real > *const weights=nullptr, const THREAD_ID tid=0) override
 
virtual void reinitNeighborFaceRef (const Elem *neighbor_elem, unsigned int neighbor_side, Real tolerance, const std::vector< Point > *const pts, const std::vector< Real > *const weights=nullptr, const THREAD_ID tid=0) override
 
bool fvBCsIntegrityCheck () const
 
void fvBCsIntegrityCheck (bool fv_bcs_integrity_check)
 
void getFVMatsAndDependencies (SubdomainID block_id, std::vector< std::shared_ptr< MaterialBase >> &face_materials, std::vector< std::shared_ptr< MaterialBase >> &neighbor_materials, std::set< MooseVariableFieldBase * > &variables, const THREAD_ID tid)
 
void resizeMaterialData (Moose::MaterialDataType data_type, unsigned int nqp, const THREAD_ID tid)
 
bool haveDisplaced () const override final
 
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
 
MooseAppCoordTransformcoordTransform ()
 
virtual std::size_t numNonlinearSystems () const override
 
virtual std::size_t numLinearSystems () const override
 
virtual std::size_t numSolverSystems () const override
 
bool isSolverSystemNonlinear (const unsigned int sys_num)
 
virtual unsigned int currentNlSysNum () const override
 
virtual unsigned int currentLinearSysNum () const override
 
virtual unsigned int nlSysNum (const NonlinearSystemName &nl_sys_name) const override
 
unsigned int linearSysNum (const LinearSystemName &linear_sys_name) const override
 
unsigned int solverSysNum (const SolverSystemName &solver_sys_name) const override
 
unsigned int systemNumForVariable (const VariableName &variable_name) const
 
bool getFailNextNonlinearConvergenceCheck () const
 
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::CouplingMatrixnonlocalCouplingMatrix (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
 
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 VectorTaggetVectorTag (const TagID tag_id) const
 
std::vector< VectorTaggetVectorTags (const std::set< TagID > &tag_ids) const
 
virtual const std::vector< VectorTag > & getVectorTags (const Moose::VectorTagType type=Moose::VECTOR_TAG_ANY) const
 
virtual TagID getVectorTagID (const TagName &tag_name) const
 
virtual TagName vectorTagName (const TagID tag) const
 
virtual bool vectorTagExists (const TagID tag_id) const
 
virtual bool vectorTagExists (const TagName &tag_name) const
 
virtual unsigned int numVectorTags (const Moose::VectorTagType type=Moose::VECTOR_TAG_ANY) const
 
virtual Moose::VectorTagType vectorTagType (const TagID tag_id) const
 
virtual TagID addMatrixTag (TagName tag_name)
 
virtual TagID getMatrixTagID (const TagName &tag_name) const
 
virtual TagName matrixTagName (TagID tag)
 
virtual bool matrixTagExists (const TagName &tag_name) const
 
virtual bool matrixTagExists (TagID tag_id) const
 
virtual unsigned int numMatrixTags () const
 
virtual std::map< TagName, TagID > & getMatrixTags ()
 
virtual bool hasLinearVariable (const std::string &var_name) const
 
virtual bool hasAuxiliaryVariable (const std::string &var_name) const
 
virtual const std::set< MooseVariableFieldBase *> & getActiveElementalMooseVariables (const THREAD_ID tid) const
 
virtual bool hasActiveElementalMooseVariables (const THREAD_ID tid) const
 
Moose::CoordinateSystemType getCoordSystem (SubdomainID sid) const
 
unsigned int getAxisymmetricRadialCoord () const
 
virtual DiracKernelInfodiracKernelInfo ()
 
void reinitNeighborLowerDElem (const Elem *elem, const THREAD_ID tid=0)
 
void reinitMortarElem (const Elem *elem, const THREAD_ID tid=0)
 
virtual void storeSubdomainMatPropName (SubdomainID block_id, const std::string &name)
 
virtual void storeBoundaryMatPropName (BoundaryID boundary_id, const std::string &name)
 
virtual void storeSubdomainZeroMatProp (SubdomainID block_id, const MaterialPropertyName &name)
 
virtual void storeBoundaryZeroMatProp (BoundaryID boundary_id, const MaterialPropertyName &name)
 
virtual void storeSubdomainDelayedCheckMatProp (const std::string &requestor, SubdomainID block_id, const std::string &name)
 
virtual void storeBoundaryDelayedCheckMatProp (const std::string &requestor, BoundaryID boundary_id, const std::string &name)
 
virtual void checkBlockMatProps ()
 
virtual void checkBoundaryMatProps ()
 
virtual void markMatPropRequested (const std::string &)
 
virtual bool isMatPropRequested (const std::string &prop_name) const
 
void addConsumedPropertyName (const MooseObjectName &obj_name, const std::string &prop_name)
 
const std::map< MooseObjectName, std::set< std::string > > & getConsumedPropertyMap () const
 
virtual std::set< SubdomainIDgetMaterialPropertyBlocks (const std::string &prop_name)
 
virtual std::vector< SubdomainName > getMaterialPropertyBlockNames (const std::string &prop_name)
 
virtual bool hasBlockMaterialProperty (SubdomainID block_id, const std::string &prop_name)
 
virtual std::set< BoundaryIDgetMaterialPropertyBoundaryIDs (const std::string &prop_name)
 
virtual std::vector< BoundaryName > getMaterialPropertyBoundaryNames (const std::string &prop_name)
 
virtual bool hasBoundaryMaterialProperty (BoundaryID boundary_id, const std::string &prop_name)
 
virtual std::set< dof_id_type > & ghostedElems ()
 
const 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
 
bool havePRefinement () const
 
MooseVariableFEBasegetVariableHelper (const THREAD_ID tid, const std::string &var_name, Moose::VarKindType expected_var_type, Moose::VarFieldType expected_var_field_type, const std::vector< T > &systems, const SystemBase &aux) const
 
void _setCLIOption ()
 
virtual void terminateSolve ()
 
virtual bool isSolveTerminationRequested () const
 
const ConsoleStreamconsole () const
 
virtual bool enabled () const
 
std::shared_ptr< MooseObjectgetSharedPtr ()
 
std::shared_ptr< const MooseObjectgetSharedPtr () const
 
bool isKokkosObject () const
 
MooseAppgetMooseApp () 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 InputParametersparameters () const
 
const hit::Node * getHitNode () const
 
bool hasBase () const
 
const std::string & getBase () const
 
const TgetParam (const std::string &name) const
 
std::vector< std::pair< T1, T2 > > getParam (const std::string &param1, const std::string &param2) const
 
const TqueryParam (const std::string &name) const
 
const TgetRenamedParam (const std::string &old_name, const std::string &new_name) const
 
T getCheckedPointerParam (const std::string &name, const std::string &error_string="") const
 
bool haveParameter (const std::string &name) 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
 
PerfGraphperfGraph ()
 
const libMesh::ConstElemRangegetEvaluableElementRange ()
 
const libMesh::ConstElemRangegetEvaluableElementRange ()
 
const libMesh::ConstElemRangegetNonlinearEvaluableElementRange ()
 
const libMesh::ConstElemRangegetNonlinearEvaluableElementRange ()
 
const libMesh::ConstElemRangegetCurrentAlgebraicElementRange ()
 
const libMesh::ConstElemRangegetCurrentAlgebraicElementRange ()
 
const libMesh::ConstNodeRangegetCurrentAlgebraicNodeRange ()
 
const libMesh::ConstNodeRangegetCurrentAlgebraicNodeRange ()
 
const ConstBndNodeRangegetCurrentAlgebraicBndNodeRange ()
 
const ConstBndNodeRangegetCurrentAlgebraicBndNodeRange ()
 
void setCurrentAlgebraicElementRange (libMesh::ConstElemRange *range)
 
void setCurrentAlgebraicElementRange (libMesh::ConstElemRange *range)
 
void setCurrentAlgebraicNodeRange (libMesh::ConstNodeRange *range)
 
void setCurrentAlgebraicNodeRange (libMesh::ConstNodeRange *range)
 
void setCurrentAlgebraicBndNodeRange (ConstBndNodeRange *range)
 
void setCurrentAlgebraicBndNodeRange (ConstBndNodeRange *range)
 
void allowOutput (bool state)
 
void allowOutput (bool state)
 
void allowOutput (bool state)
 
void allowOutput (bool state)
 
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::SystemgetKokkosSystem (const unsigned int sys_num)
 
const Moose::Kokkos::SystemgetKokkosSystem (const unsigned int sys_num) const
 
Moose::Kokkos::SystemgetKokkosSystem (const unsigned int sys_num)
 
const Moose::Kokkos::SystemgetKokkosSystem (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 AutomaticMortarGenerationgetMortarInterface (const std::pair< BoundaryID, BoundaryID > &primary_secondary_boundary_pair, const std::pair< SubdomainID, SubdomainID > &primary_secondary_subdomain_pair, bool on_displaced) const
 
AutomaticMortarGenerationgetMortarInterface (const std::pair< BoundaryID, BoundaryID > &primary_secondary_boundary_pair, const std::pair< SubdomainID, SubdomainID > &primary_secondary_subdomain_pair, bool on_displaced)
 
const AutomaticMortarGenerationgetMortarInterface (const std::pair< BoundaryID, BoundaryID > &primary_secondary_boundary_pair, const std::pair< SubdomainID, SubdomainID > &primary_secondary_subdomain_pair, bool on_displaced) const
 
AutomaticMortarGenerationgetMortarInterface (const std::pair< BoundaryID, BoundaryID > &primary_secondary_boundary_pair, const std::pair< SubdomainID, SubdomainID > &primary_secondary_subdomain_pair, bool on_displaced)
 
const MaterialPropertyStoragegetMaterialPropertyStorage ()
 
const MaterialPropertyStoragegetMaterialPropertyStorage ()
 
const MaterialPropertyStoragegetBndMaterialPropertyStorage ()
 
const MaterialPropertyStoragegetBndMaterialPropertyStorage ()
 
const MaterialPropertyStoragegetNeighborMaterialPropertyStorage ()
 
const MaterialPropertyStoragegetNeighborMaterialPropertyStorage ()
 
Moose::Kokkos::MaterialPropertyStoragegetKokkosMaterialPropertyStorage ()
 
Moose::Kokkos::MaterialPropertyStoragegetKokkosMaterialPropertyStorage ()
 
Moose::Kokkos::MaterialPropertyStoragegetKokkosBndMaterialPropertyStorage ()
 
Moose::Kokkos::MaterialPropertyStoragegetKokkosBndMaterialPropertyStorage ()
 
Moose::Kokkos::MaterialPropertyStoragegetKokkosNeighborMaterialPropertyStorage ()
 
Moose::Kokkos::MaterialPropertyStoragegetKokkosNeighborMaterialPropertyStorage ()
 
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 ExecFlagTypegetCurrentExecuteOnFlag () const
 
const ExecFlagTypegetCurrentExecuteOnFlag () const
 
void setCurrentExecuteOnFlag (const ExecFlagType &)
 
void setCurrentExecuteOnFlag (const ExecFlagType &)
 
const Parallel::Communicator & comm () const
 
processor_id_type n_processors () const
 
processor_id_type processor_id () const
 
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 PostprocessorValuegetPostprocessorValue (const std::string &param_name, const unsigned int index=0) const
 
const PostprocessorValuegetPostprocessorValue (const std::string &param_name, const unsigned int index=0) const
 
const PostprocessorValuegetPostprocessorValueOld (const std::string &param_name, const unsigned int index=0) const
 
const PostprocessorValuegetPostprocessorValueOld (const std::string &param_name, const unsigned int index=0) const
 
const PostprocessorValuegetPostprocessorValueOlder (const std::string &param_name, const unsigned int index=0) const
 
const PostprocessorValuegetPostprocessorValueOlder (const std::string &param_name, const unsigned int index=0) const
 
const PostprocessorValuegetPostprocessorValueOldByName (const PostprocessorName &name) const
 
const PostprocessorValuegetPostprocessorValueOldByName (const PostprocessorName &name) const
 
const PostprocessorValuegetPostprocessorValueOlderByName (const PostprocessorName &name) const
 
const PostprocessorValuegetPostprocessorValueOlderByName (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. More...
 
const SinglePhaseFluidProperties_fp
 Non-owning pointer to fluid properties user object. More...
 
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. More...
 
virtual Real computeAddedHeatPin (unsigned int i_ch, unsigned int iz) const override
 Pure virtual: daughters provide different implementations. More...
 
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. More...
 
virtual void computeh (int iblock) override
 Computes Enthalpy per channel for block iblock. More...
 
virtual Real computeAddedHeatDuct (unsigned int i_ch, unsigned int iz) const
 Non-pure: implemented in the base (or override in a child if needed) More...
 
void computeWijFromSolve (int iblock)
 Computes diversion crossflow per gap for block iblock. More...
 
void computeSumWij (int iblock)
 Computes net diversion crossflow per channel for block iblock. More...
 
void computeMdot (int iblock)
 Computes mass flow per channel for block iblock. More...
 
void computeWijPrime (int iblock)
 Computes turbulent crossflow per gap for block iblock. More...
 
Real computeMixingParameter (unsigned int i_gap, unsigned int iz) const
 Computes and validates the turbulent mixing parameter. More...
 
Real computeSweepFlowMixingParameter (unsigned int i_gap, unsigned int iz) const
 Computes and validates the sweep-flow mixing parameter. More...
 
void computeDP (int iblock)
 Computes Pressure Drop per channel for block iblock. More...
 
void computeP (int iblock)
 Computes Pressure per channel for block iblock. More...
 
void computeT (int iblock)
 Computes Temperature per channel for block iblock. More...
 
void computeRho (int iblock)
 Computes Density per channel for block iblock. More...
 
void computeMu (int iblock)
 Computes Viscosity per channel for block iblock. More...
 
void computeWijResidual (int iblock)
 Computes Residual Matrix based on the lateral momentum conservation equation for block iblock. More...
 
libMesh::DenseVector< RealresidualFunction (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. More...
 
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. More...
 
PetscErrorCode implicitPetscSolve (int iblock)
 Computes implicit solve using PetSc. More...
 
void detectDeformation ()
 Detects whether pin diameter or duct displacement fields require geometry recalculation. More...
 
PetscScalar computeInterpolationCoefficients (PetscScalar Peclet=0.0)
 Functions that computes the interpolation scheme given the Peclet number. More...
 
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 More...
 
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]. More...
 
PetscErrorCode cleanUp ()
 
PetscErrorCode createPetscVector (Vec &v, PetscInt n)
 Petsc Functions. More...
 
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 ()
 
MooseVariableFieldBasegetVariableHelper (const THREAD_ID tid, const std::string &var_name, Moose::VarKindType expected_var_type, Moose::VarFieldType expected_var_field_type, const std::vector< T > &nls, const SystemBase &aux) const
 
void createTagVectors ()
 
void createTagSolutions ()
 
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 markFamilyPRefinement (const InputParameters &params)
 
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
 
TdeclareRestartableData (const std::string &data_name, Args &&... args)
 
ManagedValue< TdeclareManagedRestartableDataWithContext (const std::string &data_name, void *context, Args &&... args)
 
const TgetRestartableData (const std::string &data_name) const
 
TdeclareRestartableDataWithContext (const std::string &data_name, void *context, Args &&... args)
 
TdeclareRecoverableData (const std::string &data_name, Args &&... args)
 
TdeclareRestartableDataWithObjectName (const std::string &data_name, const std::string &object_name, Args &&... args)
 
TdeclareRestartableDataWithObjectNameWithContext (const std::string &data_name, const std::string &object_name, void *context, Args &&... args)
 
std::string restartableName (const std::string &data_name) const
 
virtual void addPostprocessorDependencyHelper (const PostprocessorName &) const
 

Protected Attributes

QuadSubChannelMesh_subchannel_mesh
 
unsigned int _n_blocks
 number of axial blocks More...
 
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 More...
 
Real _one
 
Real _TR
 Flag that activates or deactivates the transient parts of the equations we solve by multiplication. More...
 
const bool _compute_density
 Flag that activates or deactivates the calculation of density. More...
 
const bool _compute_viscosity
 Flag that activates or deactivates the calculation of viscosity. More...
 
const bool _compute_power
 Flag that informs if we need to solve the Enthalpy/Temperature equations or not. More...
 
const bool _pin_mesh_exist
 Flag that informs if there is a pin mesh or not. More...
 
const bool _duct_mesh_exist
 Flag that informs if there is a duct mesh or not. More...
 
bool _converged
 Variable that informs whether we exited external solve with a converged solution or not. More...
 
Real _dt
 Time step. More...
 
Real _CT
 Turbulent modeling parameter used in axial momentum equation. More...
 
const Real_P_tol
 Convergence tolerance for the pressure loop in external solve. More...
 
const Real_T_tol
 Convergence tolerance for the temperature loop in internal solve. More...
 
const int_T_maxit
 Maximum iterations for the inner temperature loop. More...
 
const PetscReal & _rtol
 The relative convergence tolerance, (relative decrease) for the ksp linear solver. More...
 
const PetscReal & _atol
 The absolute convergence tolerance for the ksp linear solver. More...
 
const PetscReal & _dtol
 The divergence tolerance for the ksp linear solver. More...
 
const PetscInt & _maxit
 The maximum number of iterations to use for the ksp linear solver. More...
 
const MooseEnum _interpolation_scheme
 The interpolation method used in constructing the systems. More...
 
const MooseEnum _gravity_direction
 The direction of gravity. More...
 
const Real _dir_grav
 
const bool _implicit_bool
 Flag to define the usage of a implicit or explicit solution. More...
 
const bool _staggered_pressure_bool
 Flag to define the usage of staggered or collocated pressure. More...
 
const bool _segregated_bool
 Segregated solve. More...
 
const bool _verbose_subchannel
 Boolean to printout information related to subchannel solve. More...
 
bool _deformation = false
 Flag that activates the effect of deformation (pin/duct) based on the auxvalues for displacement, Dpin. More...
 
const SCMFrictionClosureBase_friction_closure
 Friction closure object. More...
 
const SCMMixingClosureBase_mixing_closure
 Turbulent Mixing closure object. More...
 
const SCMHTCClosureBase_pin_HTC_closure
 HTC closure objects. More...
 
const SCMHTCClosureBase_duct_HTC_closure
 
std::unique_ptr< SolutionHandle_mdot_soln
 Solutions handles and link to TH tables properties. More...
 
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. More...
 
Vec _Wij_vec
 
Vec _prod
 
Vec _prodp
 
Mat _mc_axial_convection_mat
 Mass conservation - axial convection. More...
 
Vec _mc_axial_convection_rhs
 
Mat _amc_turbulent_cross_flows_mat
 Mass conservation - density time derivative No implicit matrix. More...
 
Vec _amc_turbulent_cross_flows_rhs
 
Mat _amc_time_derivative_mat
 Axial momentum conservation - time derivative. More...
 
Vec _amc_time_derivative_rhs
 
Mat _amc_advective_derivative_mat
 Axial momentum conservation - advective (Eulerian) derivative. More...
 
Vec _amc_advective_derivative_rhs
 
Mat _amc_cross_derivative_mat
 Axial momentum conservation - cross flux derivative. More...
 
Vec _amc_cross_derivative_rhs
 
Mat _amc_friction_force_mat
 Axial momentum conservation - friction force. More...
 
Vec _amc_friction_force_rhs
 
Vec _amc_gravity_rhs
 Axial momentum conservation - buoyancy force No implicit matrix. More...
 
Mat _amc_pressure_force_mat
 Axial momentum conservation - pressure force. More...
 
Vec _amc_pressure_force_rhs
 
Mat _amc_sys_mdot_mat
 Axial momentum system matrix. More...
 
Vec _amc_sys_mdot_rhs
 
Mat _cmc_time_derivative_mat
 Cross momentum Cross momentum conservation - time derivative. More...
 
Vec _cmc_time_derivative_rhs
 
Mat _cmc_advective_derivative_mat
 Cross momentum conservation - advective (Eulerian) derivative. More...
 
Vec _cmc_advective_derivative_rhs
 
Mat _cmc_friction_force_mat
 Cross momentum conservation - friction force. More...
 
Vec _cmc_friction_force_rhs
 
Mat _cmc_pressure_force_mat
 Cross momentum conservation - pressure force. More...
 
Vec _cmc_pressure_force_rhs
 
Mat _cmc_sys_Wij_mat
 Lateral momentum system matrix. More...
 
Vec _cmc_sys_Wij_rhs
 
Mat _hc_time_derivative_mat
 Enthalpy Enthalpy conservation - time derivative. More...
 
Vec _hc_time_derivative_rhs
 
Mat _hc_advective_derivative_mat
 Enthalpy conservation - advective (Eulerian) derivative;. More...
 
Vec _hc_advective_derivative_rhs
 
Mat _hc_cross_derivative_mat
 Enthalpy conservation - cross flux derivative. More...
 
Vec _hc_cross_derivative_rhs
 
Vec _hc_added_heat_rhs
 Enthalpy conservation - source and sink. More...
 
Mat _hc_sys_h_mat
 System matrices. More...
 
Vec _hc_sys_h_rhs
 
PetscScalar _added_K = 0.0
 Added resistances for monolithic convergence. More...
 
PetscScalar _added_K_old = 1000.0
 
PetscScalar _max_sumWij
 
PetscScalar _max_sumWij_new
 
PetscScalar _correction_factor = 1.0
 
MooseMesh_mesh
 
bool _initialized
 
std::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
 
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
 
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
 
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
 
bool _has_nonlocal_coupling
 
bool _calculate_jacobian_in_uo
 
std::vector< std::vector< const MooseVariableFEBase *> > _uo_jacobian_moose_vars
 
std::vector< unsigned char > _has_active_material_properties
 
std::vector< SolverParams_solver_params
 
CoverageCheckMode _kernel_coverage_check
 
std::vector< SubdomainName > _kernel_coverage_blocks
 
const bool _boundary_restricted_node_integrity_check
 
const bool _boundary_restricted_elem_integrity_check
 
CoverageCheckMode _material_coverage_check
 
std::vector< SubdomainName > _material_coverage_blocks
 
bool _fv_bcs_integrity_check
 
const bool _material_dependency_check
 
const bool _uo_aux_state_check
 
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
 

Detailed Description

Quadrilateral subchannel solver.

Definition at line 18 of file QuadSubChannel1PhaseProblem.h.

Constructor & Destructor Documentation

◆ QuadSubChannel1PhaseProblem()

QuadSubChannel1PhaseProblem::QuadSubChannel1PhaseProblem ( const InputParameters params)

Definition at line 26 of file QuadSubChannel1PhaseProblem.C.

27  : SubChannel1PhaseProblem(params), _subchannel_mesh(SCM::getMesh<QuadSubChannelMesh>(_mesh))
28 {
29 }
MooseMesh & _mesh
SubChannel1PhaseProblem(const InputParameters &params)

Member Function Documentation

◆ cleanUp()

PetscErrorCode SubChannel1PhaseProblem::cleanUp ( )
protectedinherited

Definition at line 364 of file SubChannel1PhaseProblem.C.

Referenced by SubChannel1PhaseProblem::~SubChannel1PhaseProblem().

365 {
367  // We need to clean up the petsc matrices/vectors
368  // Mass conservation components
369  LibmeshPetscCall(MatDestroy(&_mc_sumWij_mat));
370  LibmeshPetscCall(VecDestroy(&_Wij_vec));
371  LibmeshPetscCall(VecDestroy(&_prod));
372  LibmeshPetscCall(VecDestroy(&_prodp));
373  LibmeshPetscCall(MatDestroy(&_mc_axial_convection_mat));
374  LibmeshPetscCall(VecDestroy(&_mc_axial_convection_rhs));
375 
376  // Axial momentum conservation components
377  LibmeshPetscCall(MatDestroy(&_amc_turbulent_cross_flows_mat));
378  LibmeshPetscCall(VecDestroy(&_amc_turbulent_cross_flows_rhs));
379  LibmeshPetscCall(MatDestroy(&_amc_time_derivative_mat));
380  LibmeshPetscCall(VecDestroy(&_amc_time_derivative_rhs));
381  LibmeshPetscCall(MatDestroy(&_amc_advective_derivative_mat));
382  LibmeshPetscCall(VecDestroy(&_amc_advective_derivative_rhs));
383  LibmeshPetscCall(MatDestroy(&_amc_cross_derivative_mat));
384  LibmeshPetscCall(VecDestroy(&_amc_cross_derivative_rhs));
385  LibmeshPetscCall(MatDestroy(&_amc_friction_force_mat));
386  LibmeshPetscCall(VecDestroy(&_amc_friction_force_rhs));
387  LibmeshPetscCall(VecDestroy(&_amc_gravity_rhs));
388  LibmeshPetscCall(MatDestroy(&_amc_pressure_force_mat));
389  LibmeshPetscCall(VecDestroy(&_amc_pressure_force_rhs));
390  LibmeshPetscCall(MatDestroy(&_amc_sys_mdot_mat));
391  LibmeshPetscCall(VecDestroy(&_amc_sys_mdot_rhs));
392 
393  // Lateral momentum conservation components
394  LibmeshPetscCall(MatDestroy(&_cmc_time_derivative_mat));
395  LibmeshPetscCall(VecDestroy(&_cmc_time_derivative_rhs));
396  LibmeshPetscCall(MatDestroy(&_cmc_advective_derivative_mat));
397  LibmeshPetscCall(VecDestroy(&_cmc_advective_derivative_rhs));
398  LibmeshPetscCall(MatDestroy(&_cmc_friction_force_mat));
399  LibmeshPetscCall(VecDestroy(&_cmc_friction_force_rhs));
400  LibmeshPetscCall(MatDestroy(&_cmc_pressure_force_mat));
401  LibmeshPetscCall(VecDestroy(&_cmc_pressure_force_rhs));
402  LibmeshPetscCall(MatDestroy(&_cmc_sys_Wij_mat));
403  LibmeshPetscCall(VecDestroy(&_cmc_sys_Wij_rhs));
404 
405  // Energy conservation components
406  LibmeshPetscCall(MatDestroy(&_hc_time_derivative_mat));
407  LibmeshPetscCall(VecDestroy(&_hc_time_derivative_rhs));
408  LibmeshPetscCall(MatDestroy(&_hc_advective_derivative_mat));
409  LibmeshPetscCall(VecDestroy(&_hc_advective_derivative_rhs));
410  LibmeshPetscCall(MatDestroy(&_hc_cross_derivative_mat));
411  LibmeshPetscCall(VecDestroy(&_hc_cross_derivative_rhs));
412  LibmeshPetscCall(VecDestroy(&_hc_added_heat_rhs));
413  LibmeshPetscCall(MatDestroy(&_hc_sys_h_mat));
414  LibmeshPetscCall(VecDestroy(&_hc_sys_h_rhs));
415 
416  PetscFunctionReturn(LIBMESH_PETSC_SUCCESS);
417 }
Mat _amc_sys_mdot_mat
Axial momentum system matrix.
Vec _amc_gravity_rhs
Axial momentum conservation - buoyancy force No implicit matrix.
Mat _cmc_friction_force_mat
Cross momentum conservation - friction force.
Mat _amc_friction_force_mat
Axial momentum conservation - friction force.
PetscFunctionBegin
Mat _cmc_sys_Wij_mat
Lateral momentum system matrix.
Mat _mc_sumWij_mat
Matrices and vectors to be used in implicit assembly Mass conservation Mass conservation - sum of cro...
Mat _amc_turbulent_cross_flows_mat
Mass conservation - density time derivative No implicit matrix.
Mat _amc_advective_derivative_mat
Axial momentum conservation - advective (Eulerian) derivative.
Vec _hc_added_heat_rhs
Enthalpy conservation - source and sink.
Mat _amc_pressure_force_mat
Axial momentum conservation - pressure force.
Mat _hc_cross_derivative_mat
Enthalpy conservation - cross flux derivative.
Mat _mc_axial_convection_mat
Mass conservation - axial convection.
Mat _amc_cross_derivative_mat
Axial momentum conservation - cross flux derivative.
Mat _hc_advective_derivative_mat
Enthalpy conservation - advective (Eulerian) derivative;.
Mat _amc_time_derivative_mat
Axial momentum conservation - time derivative.
Mat _hc_time_derivative_mat
Enthalpy Enthalpy conservation - time derivative.
Mat _cmc_time_derivative_mat
Cross momentum Cross momentum conservation - time derivative.
PetscFunctionReturn(LIBMESH_PETSC_SUCCESS)
Mat _cmc_pressure_force_mat
Cross momentum conservation - pressure force.
Mat _cmc_advective_derivative_mat
Cross momentum conservation - advective (Eulerian) derivative.
Mat _hc_sys_h_mat
System matrices.

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

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

2054 {
2055  mooseAssert(iz > 0, "Trapezoidal rule requires starting at index 1 at least");
2056  if (_duct_mesh_exist)
2057  {
2058  auto subch_type = _subchannel_mesh.getSubchannelType(i_ch);
2059  if (subch_type == EChannelType::EDGE || subch_type == EChannelType::CORNER)
2060  {
2061  auto dz = _z_grid[iz] - _z_grid[iz - 1];
2062  auto * node_in_chan = _subchannel_mesh.getChannelNode(i_ch, iz - 1);
2063  auto * node_out_chan = _subchannel_mesh.getChannelNode(i_ch, iz);
2064  auto * node_in_duct = _subchannel_mesh.getDuctNodeFromChannel(node_in_chan);
2065  auto * node_out_duct = _subchannel_mesh.getDuctNodeFromChannel(node_out_chan);
2066  auto heat_rate_in = (*_duct_heat_flux_soln)(node_in_duct);
2067  auto heat_rate_out = (*_duct_heat_flux_soln)(node_out_duct);
2068  auto width = getSubChannelPeripheralDuctWidth(i_ch);
2069  return 0.5 * (heat_rate_in + heat_rate_out) * dz * width;
2070  }
2071  else
2072  {
2073  return 0.0;
2074  }
2075  }
2076  else
2077  {
2078  return 0.0;
2079  }
2080 }
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.
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
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.
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...

◆ computeAddedHeatPin()

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

Pure virtual: daughters provide different implementations.

Implements SubChannel1PhaseProblem.

Definition at line 197 of file QuadSubChannel1PhaseProblem.C.

Referenced by computeh().

198 {
199  // Compute axial location of nodes.
200  auto z2 = _z_grid[iz];
201  auto z1 = _z_grid[iz - 1];
202  auto heated_length = _subchannel_mesh.getHeatedLength();
203  auto unheated_length_entry = _subchannel_mesh.getHeatedLengthEntry();
204  if (MooseUtils::absoluteFuzzyGreaterThan(z2, unheated_length_entry) &&
205  MooseUtils::absoluteFuzzyLessThan(z1, unheated_length_entry + heated_length))
206  {
207  // Compute the height of this element.
208  auto dz = z2 - z1;
209  if (_pin_mesh_exist)
210  {
211  auto heat_rate_in = 0.0;
212  auto heat_rate_out = 0.0;
213  for (auto i_pin : _subchannel_mesh.getChannelPins(i_ch))
214  {
215  auto * node_in = _subchannel_mesh.getPinNode(i_pin, iz - 1);
216  auto * node_out = _subchannel_mesh.getPinNode(i_pin, iz);
217  heat_rate_out += 0.25 * (*_q_prime_soln)(node_out);
218  heat_rate_in += 0.25 * (*_q_prime_soln)(node_in);
219  }
220  return (heat_rate_in + heat_rate_out) * dz / 2.0;
221  }
222  else
223  {
224  auto * node_in = _subchannel_mesh.getChannelNode(i_ch, iz - 1);
225  auto * node_out = _subchannel_mesh.getChannelNode(i_ch, iz);
226  return ((*_q_prime_soln)(node_out) + (*_q_prime_soln)(node_in)) * dz / 2.0;
227  }
228  }
229  else
230  return 0.0;
231 }
const bool _pin_mesh_exist
Flag that informs if there is a pin mesh or not.
Node * getChannelNode(unsigned int i_chan, unsigned int iz) const override
Get the subchannel mesh node for a given channel index and elevation index.
const std::vector< unsigned int > & getChannelPins(unsigned int i_chan) const override
Return a vector of pin indices for a given channel index.
std::vector< Real > _z_grid
axial location of nodes
virtual const Real & getHeatedLength() const
Return heated length.
std::unique_ptr< SolutionHandle > _q_prime_soln
Node * getPinNode(unsigned int i_pin, unsigned int iz) const override
Get the pin mesh node for a given pin index and elevation index.
virtual const Real & getHeatedLengthEntry() const
Return unheated length at entry.

◆ computeDP()

void SubChannel1PhaseProblem::computeDP ( int  iblock)
protectedinherited

Computes Pressure Drop per channel for block iblock.

Upwind local form loss

Upwind local form loss

Time derivative term

Advective derivative term

Cross derivative term

Friction term

Upwind local form loss

Gravity force

Assembling system

Definition at line 663 of file SubChannel1PhaseProblem.C.

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

664 {
665  const unsigned int last_node = (iblock + 1) * _block_size;
666  const unsigned int first_node = iblock * _block_size + 1;
667  if (!_implicit_bool)
668  {
669  for (unsigned int iz = first_node; iz < last_node + 1; iz++)
670  {
671  auto k_grid = _subchannel_mesh.getKGrid();
672  auto dz = _z_grid[iz] - _z_grid[iz - 1];
673  for (unsigned int i_ch = 0; i_ch < _n_channels; i_ch++)
674  {
675  auto * node_in = _subchannel_mesh.getChannelNode(i_ch, iz - 1);
676  auto * node_out = _subchannel_mesh.getChannelNode(i_ch, iz);
677  auto rho_in = (*_rho_soln)(node_in);
678  auto rho_out = (*_rho_soln)(node_out);
679  auto mu_in = (*_mu_soln)(node_in);
680  auto S = (*_S_flow_soln)(node_in);
681  auto w_perim = (*_w_perim_soln)(node_in);
682  // hydraulic diameter in the i direction
683  auto Dh_i = 4.0 * S / w_perim;
684  auto time_term = _TR * ((*_mdot_soln)(node_out)-_mdot_soln->old(node_out)) * dz / _dt -
685  dz * 2.0 * (*_mdot_soln)(node_out) * (rho_out - _rho_soln->old(node_out)) /
686  rho_in / _dt;
687  auto mass_term1 =
688  Utility::pow<2>((*_mdot_soln)(node_out)) * (1.0 / S / rho_out - 1.0 / S / rho_in);
689  auto mass_term2 = -2.0 * (*_mdot_soln)(node_out) * (*_SumWij_soln)(node_out) / S / rho_in;
690  auto crossflow_term = 0.0;
691  auto turbulent_term = 0.0;
692  unsigned int counter = 0;
693  for (auto i_gap : _subchannel_mesh.getChannelGaps(i_ch))
694  {
695  auto chans = _subchannel_mesh.getGapChannels(i_gap);
696  unsigned int ii_ch = chans.first;
697  unsigned int jj_ch = chans.second;
698  auto * node_in_i = _subchannel_mesh.getChannelNode(ii_ch, iz - 1);
699  auto * node_in_j = _subchannel_mesh.getChannelNode(jj_ch, iz - 1);
700  auto * node_out_i = _subchannel_mesh.getChannelNode(ii_ch, iz);
701  auto * node_out_j = _subchannel_mesh.getChannelNode(jj_ch, iz);
702  auto rho_i = (*_rho_soln)(node_in_i);
703  auto rho_j = (*_rho_soln)(node_in_j);
704  auto Si = (*_S_flow_soln)(node_in_i);
705  auto Sj = (*_S_flow_soln)(node_in_j);
706  Real u_star = 0.0;
707  // figure out donor axial velocity
708  if (_Wij(i_gap, iz) > 0.0)
709  u_star = (*_mdot_soln)(node_out_i) / Si / rho_i;
710  else
711  u_star = (*_mdot_soln)(node_out_j) / Sj / rho_j;
712 
713  crossflow_term +=
714  _subchannel_mesh.getCrossflowSign(i_ch, counter) * _Wij(i_gap, iz) * u_star;
715 
716  turbulent_term += _WijPrime(i_gap, iz) * (2 * (*_mdot_soln)(node_out) / rho_in / S -
717  (*_mdot_soln)(node_out_j) / Sj / rho_j -
718  (*_mdot_soln)(node_out_i) / Si / rho_i);
719  counter++;
720  }
721  turbulent_term *= _CT;
722  auto Re = (((*_mdot_soln)(node_in) / S) * Dh_i / mu_in);
723  _friction_args = FrictionStruct(i_ch, Re, S, w_perim);
725  if (_ff_soln)
726  _ff_soln->set(node_out, ff);
728  auto ki = 0.0;
729  if ((*_mdot_soln)(node_out) >= 0)
730  ki = k_grid[i_ch][iz - 1];
731  else
732  ki = k_grid[i_ch][iz];
733  auto friction_term = (ff * dz / Dh_i + ki) * 0.5 *
734  (*_mdot_soln)(node_out)*std::abs((*_mdot_soln)(node_out)) /
735  (S * (*_rho_soln)(node_out));
736  auto gravity_term = _dir_grav * _g_grav * (*_rho_soln)(node_out)*dz * S;
737  auto DP = (1 / S) * (time_term + mass_term1 + mass_term2 + crossflow_term + turbulent_term +
738  friction_term + gravity_term); // Pa
739  _DP(i_ch, iz) = DP;
740  if (_DP_soln)
741  _DP_soln->set(node_out, DP);
742  }
743  }
744  }
745  else
746  {
747  LibmeshPetscCall(MatZeroEntries(_amc_time_derivative_mat));
748  LibmeshPetscCall(MatZeroEntries(_amc_advective_derivative_mat));
749  LibmeshPetscCall(MatZeroEntries(_amc_cross_derivative_mat));
750  LibmeshPetscCall(MatZeroEntries(_amc_friction_force_mat));
751  LibmeshPetscCall(VecZeroEntries(_amc_time_derivative_rhs));
752  LibmeshPetscCall(VecZeroEntries(_amc_advective_derivative_rhs));
753  LibmeshPetscCall(VecZeroEntries(_amc_cross_derivative_rhs));
754  LibmeshPetscCall(VecZeroEntries(_amc_friction_force_rhs));
755  LibmeshPetscCall(VecZeroEntries(_amc_gravity_rhs));
756  LibmeshPetscCall(MatZeroEntries(_amc_sys_mdot_mat));
757  LibmeshPetscCall(VecZeroEntries(_amc_sys_mdot_rhs));
758  for (unsigned int iz = first_node; iz < last_node + 1; iz++)
759  {
760  auto k_grid = _subchannel_mesh.getKGrid();
761  auto dz = _z_grid[iz] - _z_grid[iz - 1];
762  auto iz_ind = iz - first_node;
763  for (unsigned int i_ch = 0; i_ch < _n_channels; i_ch++)
764  {
765  // inlet and outlet nodes
766  auto * node_in = _subchannel_mesh.getChannelNode(i_ch, iz - 1);
767  auto * node_out = _subchannel_mesh.getChannelNode(i_ch, iz);
768 
769  // interpolation weight coefficient
770  PetscScalar Pe = 0.5;
771  if (_interpolation_scheme == 3)
772  {
773  // Compute the Peclet number
774  auto S_in = (*_S_flow_soln)(node_in);
775  auto S_out = (*_S_flow_soln)(node_out);
776  auto S_interp = computeInterpolatedValue(S_out, S_in, 0.5);
777  auto w_perim_in = (*_w_perim_soln)(node_in);
778  auto w_perim_out = (*_w_perim_soln)(node_out);
779  auto w_perim_interp = this->computeInterpolatedValue(w_perim_out, w_perim_in, 0.5);
780  auto mdot_loc =
781  this->computeInterpolatedValue((*_mdot_soln)(node_out), (*_mdot_soln)(node_in), 0.5);
782  auto mu_in = (*_mu_soln)(node_in);
783  auto mu_out = (*_mu_soln)(node_out);
784  auto mu_interp = this->computeInterpolatedValue(mu_out, mu_in, 0.5);
785  auto Dh_i = 4.0 * S_interp / w_perim_interp;
786  // Compute friction factor
787  auto Re = ((mdot_loc / S_interp) * Dh_i / mu_interp);
788  _friction_args = FrictionStruct(i_ch, Re, S_interp, w_perim_interp);
790  if (_ff_soln)
791  _ff_soln->set(node_out, ff);
793  auto ki = 0.0;
794  if ((*_mdot_soln)(node_out) >= 0)
795  ki = k_grid[i_ch][iz - 1];
796  else
797  ki = k_grid[i_ch][iz];
798  Pe = 1.0 / ((ff * dz / Dh_i + ki) * 0.5) * mdot_loc / std::abs(mdot_loc);
799  }
801 
802  // inlet, outlet, and interpolated density
803  auto rho_in = (*_rho_soln)(node_in);
804  auto rho_out = (*_rho_soln)(node_out);
805  auto rho_interp = computeInterpolatedValue(rho_out, rho_in, Pe);
806 
807  // inlet, outlet, and interpolated viscosity
808  auto mu_in = (*_mu_soln)(node_in);
809  auto mu_out = (*_mu_soln)(node_out);
810  auto mu_interp = computeInterpolatedValue(mu_out, mu_in, Pe);
811 
812  // inlet, outlet, and interpolated axial surface area
813  auto S_in = (*_S_flow_soln)(node_in);
814  auto S_out = (*_S_flow_soln)(node_out);
815  auto S_interp = computeInterpolatedValue(S_out, S_in, Pe);
816 
817  // inlet, outlet, and interpolated wetted perimeter
818  auto w_perim_in = (*_w_perim_soln)(node_in);
819  auto w_perim_out = (*_w_perim_soln)(node_out);
820  auto w_perim_interp = computeInterpolatedValue(w_perim_out, w_perim_in, Pe);
821 
822  // hydraulic diameter in the i direction
823  auto Dh_i = 4.0 * S_interp / w_perim_interp;
824 
826  if (iz == first_node)
827  {
828  PetscScalar value_vec_tt = -1.0 * _TR * alpha * (*_mdot_soln)(node_in)*dz / _dt;
829  PetscInt row_vec_tt = i_ch + _n_channels * iz_ind;
830  LibmeshPetscCall(
831  VecSetValues(_amc_time_derivative_rhs, 1, &row_vec_tt, &value_vec_tt, ADD_VALUES));
832  }
833  else
834  {
835  PetscInt row_tt = i_ch + _n_channels * iz_ind;
836  PetscInt col_tt = i_ch + _n_channels * (iz_ind - 1);
837  PetscScalar value_tt = _TR * alpha * dz / _dt;
838  LibmeshPetscCall(MatSetValues(
839  _amc_time_derivative_mat, 1, &row_tt, 1, &col_tt, &value_tt, INSERT_VALUES));
840  }
841 
842  // Adding diagonal elements
843  PetscInt row_tt = i_ch + _n_channels * iz_ind;
844  PetscInt col_tt = i_ch + _n_channels * iz_ind;
845  PetscScalar value_tt = _TR * (1.0 - alpha) * dz / _dt;
846  LibmeshPetscCall(MatSetValues(
847  _amc_time_derivative_mat, 1, &row_tt, 1, &col_tt, &value_tt, INSERT_VALUES));
848 
849  // Adding RHS elements
850  PetscScalar mdot_old_interp =
851  computeInterpolatedValue(_mdot_soln->old(node_out), _mdot_soln->old(node_in), Pe);
852  PetscScalar value_vec_tt = _TR * mdot_old_interp * dz / _dt;
853  PetscInt row_vec_tt = i_ch + _n_channels * iz_ind;
854  LibmeshPetscCall(
855  VecSetValues(_amc_time_derivative_rhs, 1, &row_vec_tt, &value_vec_tt, ADD_VALUES));
856 
858  if (iz == first_node)
859  {
860  PetscScalar value_vec_at = Utility::pow<2>((*_mdot_soln)(node_in)) / (S_in * rho_in);
861  PetscInt row_vec_at = i_ch + _n_channels * iz_ind;
862  LibmeshPetscCall(VecSetValues(
863  _amc_advective_derivative_rhs, 1, &row_vec_at, &value_vec_at, ADD_VALUES));
864  }
865  else
866  {
867  PetscInt row_at = i_ch + _n_channels * iz_ind;
868  PetscInt col_at = i_ch + _n_channels * (iz_ind - 1);
869  PetscScalar value_at = -1.0 * std::abs((*_mdot_soln)(node_in)) / (S_in * rho_in);
870  LibmeshPetscCall(MatSetValues(
871  _amc_advective_derivative_mat, 1, &row_at, 1, &col_at, &value_at, INSERT_VALUES));
872  }
873 
874  // Adding diagonal elements
875  PetscInt row_at = i_ch + _n_channels * iz_ind;
876  PetscInt col_at = i_ch + _n_channels * iz_ind;
877  PetscScalar value_at = std::abs((*_mdot_soln)(node_out)) / (S_out * rho_out);
878  LibmeshPetscCall(MatSetValues(
879  _amc_advective_derivative_mat, 1, &row_at, 1, &col_at, &value_at, INSERT_VALUES));
880 
882  unsigned int counter = 0;
883  unsigned int cross_index = iz; // iz-1;
884  for (auto i_gap : _subchannel_mesh.getChannelGaps(i_ch))
885  {
886  auto chans = _subchannel_mesh.getGapChannels(i_gap);
887  unsigned int ii_ch = chans.first;
888  unsigned int jj_ch = chans.second;
889  auto * node_in_i = _subchannel_mesh.getChannelNode(ii_ch, iz - 1);
890  auto * node_in_j = _subchannel_mesh.getChannelNode(jj_ch, iz - 1);
891  auto * node_out_i = _subchannel_mesh.getChannelNode(ii_ch, iz);
892  auto * node_out_j = _subchannel_mesh.getChannelNode(jj_ch, iz);
893  auto rho_i =
894  computeInterpolatedValue((*_rho_soln)(node_out_i), (*_rho_soln)(node_in_i), Pe);
895  auto rho_j =
896  computeInterpolatedValue((*_rho_soln)(node_out_j), (*_rho_soln)(node_in_j), Pe);
897  auto S_i =
898  computeInterpolatedValue((*_S_flow_soln)(node_out_i), (*_S_flow_soln)(node_in_i), Pe);
899  auto S_j =
900  computeInterpolatedValue((*_S_flow_soln)(node_out_j), (*_S_flow_soln)(node_in_j), Pe);
901  auto u_star = 0.0;
902  // figure out donor axial velocity
903  if (_Wij(i_gap, cross_index) > 0.0)
904  {
905  if (iz == first_node)
906  {
907  u_star = (*_mdot_soln)(node_in_i) / S_i / rho_i;
908  PetscScalar value_vec_ct = -1.0 * alpha *
909  _subchannel_mesh.getCrossflowSign(i_ch, counter) *
910  _Wij(i_gap, cross_index) * u_star;
911  PetscInt row_vec_ct = i_ch + _n_channels * iz_ind;
912  LibmeshPetscCall(VecSetValues(
913  _amc_cross_derivative_rhs, 1, &row_vec_ct, &value_vec_ct, ADD_VALUES));
914  }
915  else
916  {
917  PetscScalar value_ct = alpha * _subchannel_mesh.getCrossflowSign(i_ch, counter) *
918  _Wij(i_gap, cross_index) / S_i / rho_i;
919  PetscInt row_ct = i_ch + _n_channels * iz_ind;
920  PetscInt col_ct = ii_ch + _n_channels * (iz_ind - 1);
921  LibmeshPetscCall(MatSetValues(
922  _amc_cross_derivative_mat, 1, &row_ct, 1, &col_ct, &value_ct, ADD_VALUES));
923  }
924  PetscScalar value_ct = (1.0 - alpha) *
925  _subchannel_mesh.getCrossflowSign(i_ch, counter) *
926  _Wij(i_gap, cross_index) / S_i / rho_i;
927  PetscInt row_ct = i_ch + _n_channels * iz_ind;
928  PetscInt col_ct = ii_ch + _n_channels * iz_ind;
929  LibmeshPetscCall(MatSetValues(
930  _amc_cross_derivative_mat, 1, &row_ct, 1, &col_ct, &value_ct, ADD_VALUES));
931  }
932  else if (_Wij(i_gap, cross_index) < 0.0) // _Wij=0 operations not necessary
933  {
934  if (iz == first_node)
935  {
936  u_star = (*_mdot_soln)(node_in_j) / S_j / rho_j;
937  PetscScalar value_vec_ct = -1.0 * alpha *
938  _subchannel_mesh.getCrossflowSign(i_ch, counter) *
939  _Wij(i_gap, cross_index) * u_star;
940  PetscInt row_vec_ct = i_ch + _n_channels * iz_ind;
941  LibmeshPetscCall(VecSetValues(
942  _amc_cross_derivative_rhs, 1, &row_vec_ct, &value_vec_ct, ADD_VALUES));
943  }
944  else
945  {
946  PetscScalar value_ct = alpha * _subchannel_mesh.getCrossflowSign(i_ch, counter) *
947  _Wij(i_gap, cross_index) / S_j / rho_j;
948  PetscInt row_ct = i_ch + _n_channels * iz_ind;
949  PetscInt col_ct = jj_ch + _n_channels * (iz_ind - 1);
950  LibmeshPetscCall(MatSetValues(
951  _amc_cross_derivative_mat, 1, &row_ct, 1, &col_ct, &value_ct, ADD_VALUES));
952  }
953  PetscScalar value_ct = (1.0 - alpha) *
954  _subchannel_mesh.getCrossflowSign(i_ch, counter) *
955  _Wij(i_gap, cross_index) / S_j / rho_j;
956  PetscInt row_ct = i_ch + _n_channels * iz_ind;
957  PetscInt col_ct = jj_ch + _n_channels * iz_ind;
958  LibmeshPetscCall(MatSetValues(
959  _amc_cross_derivative_mat, 1, &row_ct, 1, &col_ct, &value_ct, ADD_VALUES));
960  }
961 
962  if (iz == first_node)
963  {
964  PetscScalar value_vec_ct = -2.0 * alpha * (*_mdot_soln)(node_in)*_CT *
965  _WijPrime(i_gap, cross_index) / (rho_interp * S_interp);
966  value_vec_ct += alpha * (*_mdot_soln)(node_in_j)*_CT * _WijPrime(i_gap, cross_index) /
967  (rho_j * S_j);
968  value_vec_ct += alpha * (*_mdot_soln)(node_in_i)*_CT * _WijPrime(i_gap, cross_index) /
969  (rho_i * S_i);
970  PetscInt row_vec_ct = i_ch + _n_channels * iz_ind;
971  LibmeshPetscCall(
972  VecSetValues(_amc_cross_derivative_rhs, 1, &row_vec_ct, &value_vec_ct, ADD_VALUES));
973  }
974  else
975  {
976  PetscScalar value_center_ct =
977  2.0 * alpha * _CT * _WijPrime(i_gap, cross_index) / (rho_interp * S_interp);
978  PetscInt row_ct = i_ch + _n_channels * iz_ind;
979  PetscInt col_ct = i_ch + _n_channels * (iz_ind - 1);
980  LibmeshPetscCall(MatSetValues(
981  _amc_cross_derivative_mat, 1, &row_ct, 1, &col_ct, &value_center_ct, ADD_VALUES));
982 
983  PetscScalar value_left_ct =
984  -1.0 * alpha * _CT * _WijPrime(i_gap, cross_index) / (rho_j * S_j);
985  row_ct = i_ch + _n_channels * iz_ind;
986  col_ct = jj_ch + _n_channels * (iz_ind - 1);
987  LibmeshPetscCall(MatSetValues(
988  _amc_cross_derivative_mat, 1, &row_ct, 1, &col_ct, &value_left_ct, ADD_VALUES));
989 
990  PetscScalar value_right_ct =
991  -1.0 * alpha * _CT * _WijPrime(i_gap, cross_index) / (rho_i * S_i);
992  row_ct = i_ch + _n_channels * iz_ind;
993  col_ct = ii_ch + _n_channels * (iz_ind - 1);
994  LibmeshPetscCall(MatSetValues(
995  _amc_cross_derivative_mat, 1, &row_ct, 1, &col_ct, &value_right_ct, ADD_VALUES));
996  }
997 
998  PetscScalar value_center_ct =
999  2.0 * (1.0 - alpha) * _CT * _WijPrime(i_gap, cross_index) / (rho_interp * S_interp);
1000  PetscInt row_ct = i_ch + _n_channels * iz_ind;
1001  PetscInt col_ct = i_ch + _n_channels * iz_ind;
1002  LibmeshPetscCall(MatSetValues(
1003  _amc_cross_derivative_mat, 1, &row_ct, 1, &col_ct, &value_center_ct, ADD_VALUES));
1004 
1005  PetscScalar value_left_ct =
1006  -1.0 * (1.0 - alpha) * _CT * _WijPrime(i_gap, cross_index) / (rho_j * S_j);
1007  row_ct = i_ch + _n_channels * iz_ind;
1008  col_ct = jj_ch + _n_channels * iz_ind;
1009  LibmeshPetscCall(MatSetValues(
1010  _amc_cross_derivative_mat, 1, &row_ct, 1, &col_ct, &value_left_ct, ADD_VALUES));
1011 
1012  PetscScalar value_right_ct =
1013  -1.0 * (1.0 - alpha) * _CT * _WijPrime(i_gap, cross_index) / (rho_i * S_i);
1014  row_ct = i_ch + _n_channels * iz_ind;
1015  col_ct = ii_ch + _n_channels * iz_ind;
1016  LibmeshPetscCall(MatSetValues(
1017  _amc_cross_derivative_mat, 1, &row_ct, 1, &col_ct, &value_right_ct, ADD_VALUES));
1018  counter++;
1019  }
1020 
1022  PetscScalar mdot_interp =
1023  computeInterpolatedValue((*_mdot_soln)(node_out), (*_mdot_soln)(node_in), Pe);
1024  auto Re = ((mdot_interp / S_interp) * Dh_i / mu_interp);
1025  _friction_args = FrictionStruct(i_ch, Re, S_interp, w_perim_interp);
1027  if (_ff_soln)
1028  _ff_soln->set(node_out, ff);
1030  auto ki = 0.0;
1031  if ((*_mdot_soln)(node_out) >= 0)
1032  ki = k_grid[i_ch][iz - 1];
1033  else
1034  ki = k_grid[i_ch][iz];
1035  auto coef = (ff * dz / Dh_i + ki) * 0.5 * std::abs((*_mdot_soln)(node_out)) /
1036  (S_interp * rho_interp);
1037  if (iz == first_node)
1038  {
1039  PetscScalar value_vec = -1.0 * alpha * coef * (*_mdot_soln)(node_in);
1040  PetscInt row_vec = i_ch + _n_channels * iz_ind;
1041  LibmeshPetscCall(
1042  VecSetValues(_amc_friction_force_rhs, 1, &row_vec, &value_vec, ADD_VALUES));
1043  }
1044  else
1045  {
1046  PetscInt row = i_ch + _n_channels * iz_ind;
1047  PetscInt col = i_ch + _n_channels * (iz_ind - 1);
1048  PetscScalar value = alpha * coef;
1049  LibmeshPetscCall(
1050  MatSetValues(_amc_friction_force_mat, 1, &row, 1, &col, &value, INSERT_VALUES));
1051  }
1052 
1053  // Adding diagonal elements
1054  PetscInt row = i_ch + _n_channels * iz_ind;
1055  PetscInt col = i_ch + _n_channels * iz_ind;
1056  PetscScalar value = (1.0 - alpha) * coef;
1057  LibmeshPetscCall(
1058  MatSetValues(_amc_friction_force_mat, 1, &row, 1, &col, &value, INSERT_VALUES));
1059 
1061  PetscScalar value_vec = _dir_grav * -1.0 * _g_grav * rho_interp * dz * S_interp;
1062  PetscInt row_vec = i_ch + _n_channels * iz_ind;
1063  LibmeshPetscCall(VecSetValues(_amc_gravity_rhs, 1, &row_vec, &value_vec, ADD_VALUES));
1064  }
1065  }
1067  LibmeshPetscCall(MatZeroEntries(_amc_sys_mdot_mat));
1068  LibmeshPetscCall(VecZeroEntries(_amc_sys_mdot_rhs));
1069  LibmeshPetscCall(MatAssemblyBegin(_amc_time_derivative_mat, MAT_FINAL_ASSEMBLY));
1070  LibmeshPetscCall(MatAssemblyEnd(_amc_time_derivative_mat, MAT_FINAL_ASSEMBLY));
1071  LibmeshPetscCall(MatAssemblyBegin(_amc_advective_derivative_mat, MAT_FINAL_ASSEMBLY));
1072  LibmeshPetscCall(MatAssemblyEnd(_amc_advective_derivative_mat, MAT_FINAL_ASSEMBLY));
1073  LibmeshPetscCall(MatAssemblyBegin(_amc_cross_derivative_mat, MAT_FINAL_ASSEMBLY));
1074  LibmeshPetscCall(MatAssemblyEnd(_amc_cross_derivative_mat, MAT_FINAL_ASSEMBLY));
1075  LibmeshPetscCall(MatAssemblyBegin(_amc_friction_force_mat, MAT_FINAL_ASSEMBLY));
1076  LibmeshPetscCall(MatAssemblyEnd(_amc_friction_force_mat, MAT_FINAL_ASSEMBLY));
1077  LibmeshPetscCall(MatAssemblyBegin(_amc_sys_mdot_mat, MAT_FINAL_ASSEMBLY));
1078  LibmeshPetscCall(MatAssemblyEnd(_amc_sys_mdot_mat, MAT_FINAL_ASSEMBLY));
1079  // Matrix
1080 #if !PETSC_VERSION_LESS_THAN(3, 15, 0)
1081  LibmeshPetscCall(
1082  MatAXPY(_amc_sys_mdot_mat, 1.0, _amc_time_derivative_mat, UNKNOWN_NONZERO_PATTERN));
1083  LibmeshPetscCall(MatAssemblyBegin(_amc_sys_mdot_mat, MAT_FINAL_ASSEMBLY));
1084  LibmeshPetscCall(MatAssemblyEnd(_amc_sys_mdot_mat, MAT_FINAL_ASSEMBLY));
1085  LibmeshPetscCall(
1086  MatAXPY(_amc_sys_mdot_mat, 1.0, _amc_advective_derivative_mat, UNKNOWN_NONZERO_PATTERN));
1087  LibmeshPetscCall(MatAssemblyBegin(_amc_sys_mdot_mat, MAT_FINAL_ASSEMBLY));
1088  LibmeshPetscCall(MatAssemblyEnd(_amc_sys_mdot_mat, MAT_FINAL_ASSEMBLY));
1089  LibmeshPetscCall(
1090  MatAXPY(_amc_sys_mdot_mat, 1.0, _amc_cross_derivative_mat, UNKNOWN_NONZERO_PATTERN));
1091  LibmeshPetscCall(MatAssemblyBegin(_amc_sys_mdot_mat, MAT_FINAL_ASSEMBLY));
1092  LibmeshPetscCall(MatAssemblyEnd(_amc_sys_mdot_mat, MAT_FINAL_ASSEMBLY));
1093  LibmeshPetscCall(
1094  MatAXPY(_amc_sys_mdot_mat, 1.0, _amc_friction_force_mat, UNKNOWN_NONZERO_PATTERN));
1095 #else
1096  LibmeshPetscCall(
1097  MatAXPY(_amc_sys_mdot_mat, 1.0, _amc_time_derivative_mat, DIFFERENT_NONZERO_PATTERN));
1098  LibmeshPetscCall(MatAssemblyBegin(_amc_sys_mdot_mat, MAT_FINAL_ASSEMBLY));
1099  LibmeshPetscCall(MatAssemblyEnd(_amc_sys_mdot_mat, MAT_FINAL_ASSEMBLY));
1100  LibmeshPetscCall(
1101  MatAXPY(_amc_sys_mdot_mat, 1.0, _amc_advective_derivative_mat, DIFFERENT_NONZERO_PATTERN));
1102  LibmeshPetscCall(MatAssemblyBegin(_amc_sys_mdot_mat, MAT_FINAL_ASSEMBLY));
1103  LibmeshPetscCall(MatAssemblyEnd(_amc_sys_mdot_mat, MAT_FINAL_ASSEMBLY));
1104  LibmeshPetscCall(
1105  MatAXPY(_amc_sys_mdot_mat, 1.0, _amc_cross_derivative_mat, DIFFERENT_NONZERO_PATTERN));
1106  LibmeshPetscCall(MatAssemblyBegin(_amc_sys_mdot_mat, MAT_FINAL_ASSEMBLY));
1107  LibmeshPetscCall(MatAssemblyEnd(_amc_sys_mdot_mat, MAT_FINAL_ASSEMBLY));
1108  LibmeshPetscCall(
1109  MatAXPY(_amc_sys_mdot_mat, 1.0, _amc_friction_force_mat, DIFFERENT_NONZERO_PATTERN));
1110 #endif
1111  LibmeshPetscCall(MatAssemblyBegin(_amc_sys_mdot_mat, MAT_FINAL_ASSEMBLY));
1112  LibmeshPetscCall(MatAssemblyEnd(_amc_sys_mdot_mat, MAT_FINAL_ASSEMBLY));
1113  // RHS
1114  LibmeshPetscCall(VecAXPY(_amc_sys_mdot_rhs, 1.0, _amc_time_derivative_rhs));
1115  LibmeshPetscCall(VecAXPY(_amc_sys_mdot_rhs, 1.0, _amc_advective_derivative_rhs));
1116  LibmeshPetscCall(VecAXPY(_amc_sys_mdot_rhs, 1.0, _amc_cross_derivative_rhs));
1117  LibmeshPetscCall(VecAXPY(_amc_sys_mdot_rhs, 1.0, _amc_friction_force_rhs));
1118  LibmeshPetscCall(VecAXPY(_amc_sys_mdot_rhs, 1.0, _amc_gravity_rhs));
1119  if (_segregated_bool)
1120  {
1121  // Assembly the matrix system
1122  LibmeshPetscCall(populateVectorFromHandle<SolutionHandle>(
1123  _prod, *_mdot_soln, first_node, last_node, _n_channels));
1124  Vec ls;
1125  LibmeshPetscCall(VecDuplicate(_amc_sys_mdot_rhs, &ls));
1126  LibmeshPetscCall(MatMult(_amc_sys_mdot_mat, _prod, ls));
1127  LibmeshPetscCall(VecAXPY(ls, -1.0, _amc_sys_mdot_rhs));
1128  PetscScalar * xx;
1129  LibmeshPetscCall(VecGetArray(ls, &xx));
1130  for (unsigned int iz = first_node; iz < last_node + 1; iz++)
1131  {
1132  auto iz_ind = iz - first_node;
1133  for (unsigned int i_ch = 0; i_ch < _n_channels; i_ch++)
1134  {
1135  // Setting nodes
1136  auto * node_in = _subchannel_mesh.getChannelNode(i_ch, iz - 1);
1137  auto * node_out = _subchannel_mesh.getChannelNode(i_ch, iz);
1138 
1139  // inlet, outlet, and interpolated axial surface area
1140  auto S_in = (*_S_flow_soln)(node_in);
1141  auto S_out = (*_S_flow_soln)(node_out);
1142  auto S_interp = computeInterpolatedValue(S_out, S_in, 0.5);
1143 
1144  // Setting solutions
1145  if (S_interp != 0)
1146  {
1147  auto DP = (1 / S_interp) * xx[iz_ind * _n_channels + i_ch];
1148  _DP(i_ch, iz) = DP;
1149  if (_DP_soln)
1150  _DP_soln->set(node_out, DP);
1151  }
1152  else
1153  {
1154  auto DP = 0.0;
1155  _DP(i_ch, iz) = DP;
1156  if (_DP_soln)
1157  _DP_soln->set(node_out, DP);
1158  }
1159  }
1160  }
1161  LibmeshPetscCall(VecDestroy(&ls));
1162  }
1163  }
1164 }
Mat _amc_sys_mdot_mat
Axial momentum system matrix.
Vec _amc_gravity_rhs
Axial momentum conservation - buoyancy force No implicit matrix.
Real _TR
Flag that activates or deactivates the transient parts of the equations we solve by multiplication...
libMesh::DenseMatrix< Real > _DP
std::unique_ptr< SolutionHandle > _S_flow_soln
Mat _amc_friction_force_mat
Axial momentum conservation - friction force.
PetscScalar computeInterpolatedValue(PetscScalar topValue, PetscScalar botValue, PetscScalar Peclet=0.0)
const bool _segregated_bool
Segregated solve.
virtual const std::vector< unsigned int > & getChannelGaps(unsigned int i_chan) const =0
Return a vector of gap indices for a given channel index.
std::unique_ptr< SolutionHandle > _rho_soln
Mat _amc_advective_derivative_mat
Axial momentum conservation - advective (Eulerian) derivative.
std::vector< Real > _z_grid
axial location of nodes
virtual Real computeFrictionFactor(const FrictionStruct &friction_info) const =0
Computes the friction factor for the local conditions.
Real value(unsigned n, unsigned alpha, unsigned beta, Real x)
static const std::string S
Definition: NS.h:167
PetscScalar computeInterpolationCoefficients(PetscScalar Peclet=0.0)
Functions that computes the interpolation scheme given the Peclet number.
const double Re
virtual const std::vector< std::vector< Real > > & getKGrid() const
Get axial cell location and value of loss coefficient.
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.
const MooseEnum _interpolation_scheme
The interpolation method used in constructing the systems.
const SCMFrictionClosureBase * _friction_closure
Friction closure object.
std::unique_ptr< SolutionHandle > _mdot_soln
Solutions handles and link to TH tables properties.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
std::unique_ptr< SolutionHandle > _DP_soln
libMesh::DenseMatrix< Real > & _Wij
static const std::string alpha
Definition: NS.h:138
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.
std::unique_ptr< SolutionHandle > _SumWij_soln
Real _CT
Turbulent modeling parameter used in axial momentum equation.
Mat _amc_cross_derivative_mat
Axial momentum conservation - cross flux derivative.
std::unique_ptr< SolutionHandle > _ff_soln
struct SubChannel1PhaseProblem::FrictionStruct _friction_args
const bool _implicit_bool
Flag to define the usage of a implicit or explicit solution.
Mat _amc_time_derivative_mat
Axial momentum conservation - time derivative.
libMesh::DenseMatrix< Real > _WijPrime
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.

◆ computeGravityDir()

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

inline function that is used to define the gravity direction

Definition at line 161 of file SubChannel1PhaseProblem.h.

162  {
163  switch (dir)
164  {
165  case 0: // counter_flow
166  return 1.0;
167  case 1: // co_flow
168  return -1.0;
169  case 2: // none
170  return 0.0;
171  default:
172  mooseError(name(), ": Invalid gravity direction: expected counter_flow, co_flow, or none");
173  }
174  }
const std::string & name() const
void mooseError(Args &&... args) const

◆ computeh()

void QuadSubChannel1PhaseProblem::computeh ( int  iblock)
overrideprotectedvirtual

Computes Enthalpy per channel for block iblock.

Time derivative term

Advective derivative term

Cross derivative term

Added heat enthalpy

Assembling system

Implements SubChannel1PhaseProblem.

Definition at line 249 of file QuadSubChannel1PhaseProblem.C.

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

◆ computeInterpolatedValue()

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

Definition at line 446 of file SubChannel1PhaseProblem.C.

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

449 {
451  return alpha * botValue + (1.0 - alpha) * topValue;
452 }
PetscScalar computeInterpolationCoefficients(PetscScalar Peclet=0.0)
Functions that computes the interpolation scheme given the Peclet number.
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:153
static const std::string alpha
Definition: NS.h:138

◆ computeInterpolationCoefficients()

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

Functions that computes the interpolation scheme given the Peclet number.

Definition at line 426 of file SubChannel1PhaseProblem.C.

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

427 {
428  switch (_interpolation_scheme)
429  {
430  case 0: // upwind interpolation
431  return 1.0;
432  case 1: // downwind interpolation
433  return 0.0;
434  case 2: // central_difference interpolation
435  return 0.5;
436  case 3: // exponential interpolation (Peclet limited)
437  return ((Peclet - 1.0) * std::exp(Peclet) + 1) / (Peclet * (std::exp(Peclet) - 1.) + 1e-10);
438  default:
439  mooseError(name(),
440  ": Interpolation scheme should be a string: upwind, downwind, central_difference, "
441  "exponential");
442  }
443 }
const std::string & name() const
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:153
const MooseEnum _interpolation_scheme
The interpolation method used in constructing the systems.
void mooseError(Args &&... args) const

◆ computeMdot()

void SubChannel1PhaseProblem::computeMdot ( int  iblock)
protectedinherited

Computes mass flow per channel for block iblock.

Definition at line 553 of file SubChannel1PhaseProblem.C.

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

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

◆ computeMixingParameter()

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

Computes and validates the turbulent mixing parameter.

Definition at line 1876 of file SubChannel1PhaseProblem.C.

Referenced by SubChannel1PhaseProblem::computeWijPrime().

1877 {
1878  auto beta = _mixing_closure->computeMixingParameter(i_gap, iz);
1879  if (!std::isfinite(beta) || beta < 0.0)
1880  mooseError(name(),
1881  ": Mixing closure returned invalid beta = ",
1882  beta,
1883  " for gap ",
1884  i_gap,
1885  " at axial index ",
1886  iz,
1887  ". Beta must be finite and non-negative.");
1888 
1889  return beta;
1890 }
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.
const std::string & name() const
void mooseError(Args &&... args) const

◆ computeMu()

void SubChannel1PhaseProblem::computeMu ( int  iblock)
protectedinherited

Computes Viscosity per channel for block iblock.

Definition at line 1438 of file SubChannel1PhaseProblem.C.

Referenced by SubChannel1PhaseProblem::externalSolve().

1439 {
1440  const unsigned int last_node = (iblock + 1) * _block_size;
1441  const unsigned int first_node = iblock * _block_size + 1;
1442  if (iblock == 0)
1443  {
1444  for (unsigned int i_ch = 0; i_ch < _n_channels; i_ch++)
1445  {
1446  auto * node = _subchannel_mesh.getChannelNode(i_ch, 0);
1447  _mu_soln->set(node, _fp->mu_from_p_T((*_P_soln)(node) + _P_out, (*_T_soln)(node)));
1448  }
1449  }
1450  for (unsigned int iz = first_node; iz < last_node + 1; iz++)
1451  {
1452  for (unsigned int i_ch = 0; i_ch < _n_channels; i_ch++)
1453  {
1454  auto * node = _subchannel_mesh.getChannelNode(i_ch, iz);
1455  _mu_soln->set(node, _fp->mu_from_p_T((*_P_soln)(node) + _P_out, (*_T_soln)(node)));
1456  }
1457  }
1458 }
std::unique_ptr< SolutionHandle > _T_soln
const PostprocessorValue & _P_out
Outlet pressure postprocessor value.
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.
std::unique_ptr< SolutionHandle > _P_soln
const SinglePhaseFluidProperties * _fp
Non-owning pointer to fluid properties user object.
std::unique_ptr< SolutionHandle > _mu_soln

◆ computeP()

void SubChannel1PhaseProblem::computeP ( int  iblock)
protectedinherited

Computes Pressure per channel for block iblock.

Definition at line 1167 of file SubChannel1PhaseProblem.C.

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

1168 {
1169  const unsigned int last_node = (iblock + 1) * _block_size;
1170  const unsigned int first_node = iblock * _block_size + 1;
1171  if (!_implicit_bool)
1172  {
1174  {
1175  for (unsigned int iz = last_node; iz > first_node - 1; iz--)
1176  {
1177  // Calculate pressure in the inlet of the cell assuming known outlet
1178  for (unsigned int i_ch = 0; i_ch < _n_channels; i_ch++)
1179  {
1180  auto * node_out = _subchannel_mesh.getChannelNode(i_ch, iz);
1181  auto * node_in = _subchannel_mesh.getChannelNode(i_ch, iz - 1);
1182  // update Pressure solution
1183  _P_soln->set(node_in, (*_P_soln)(node_out) + _DP(i_ch, iz));
1184  }
1185  }
1186  }
1187  else
1188  {
1189  for (unsigned int iz = last_node; iz > first_node - 1; iz--)
1190  {
1191  // Calculate pressure in the inlet of the cell assuming known outlet
1192  for (unsigned int i_ch = 0; i_ch < _n_channels; i_ch++)
1193  {
1194  auto * node_out = _subchannel_mesh.getChannelNode(i_ch, iz);
1195  auto * node_in = _subchannel_mesh.getChannelNode(i_ch, iz - 1);
1196  // update Pressure solution
1197  // Note: assuming uniform axial discretization in the curren code
1198  // We will need to update this later if we allow non-uniform refinements in the axial
1199  // direction
1200  PetscScalar Pe = 0.5;
1202  if (iz == last_node)
1203  {
1204  _P_soln->set(node_in, (*_P_soln)(node_out) + _DP(i_ch, iz) / 2.0);
1205  }
1206  else
1207  {
1208  _P_soln->set(node_in,
1209  (*_P_soln)(node_out) + (1.0 - alpha) * _DP(i_ch, iz) +
1210  alpha * _DP(i_ch, iz - 1));
1211  }
1212  }
1213  }
1214  }
1215  }
1216  else
1217  {
1219  {
1220  LibmeshPetscCall(VecZeroEntries(_amc_pressure_force_rhs));
1221  for (unsigned int iz = last_node; iz > first_node - 1; iz--)
1222  {
1223  auto iz_ind = iz - first_node;
1224  // Calculate pressure in the inlet of the cell assuming known outlet
1225  for (unsigned int i_ch = 0; i_ch < _n_channels; i_ch++)
1226  {
1227  auto * node_out = _subchannel_mesh.getChannelNode(i_ch, iz);
1228  auto * node_in = _subchannel_mesh.getChannelNode(i_ch, iz - 1);
1229 
1230  // inlet, outlet, and interpolated axial surface area
1231  auto S_in = (*_S_flow_soln)(node_in);
1232  auto S_out = (*_S_flow_soln)(node_out);
1233  auto S_interp = computeInterpolatedValue(S_out, S_in, 0.5);
1234 
1235  // Creating matrix of coefficients
1236  PetscInt row = i_ch + _n_channels * iz_ind;
1237  PetscInt col = i_ch + _n_channels * iz_ind;
1238  PetscScalar value = -1.0 * S_interp;
1239  LibmeshPetscCall(
1240  MatSetValues(_amc_pressure_force_mat, 1, &row, 1, &col, &value, INSERT_VALUES));
1241 
1242  if (iz == last_node)
1243  {
1244  PetscScalar value = -1.0 * (*_P_soln)(node_out)*S_interp;
1245  PetscInt row = i_ch + _n_channels * iz_ind;
1246  LibmeshPetscCall(VecSetValues(_amc_pressure_force_rhs, 1, &row, &value, ADD_VALUES));
1247  }
1248  else
1249  {
1250  PetscInt row = i_ch + _n_channels * iz_ind;
1251  PetscInt col = i_ch + _n_channels * (iz_ind + 1);
1252  PetscScalar value = 1.0 * S_interp;
1253  LibmeshPetscCall(
1254  MatSetValues(_amc_pressure_force_mat, 1, &row, 1, &col, &value, INSERT_VALUES));
1255  }
1256 
1257  if (_segregated_bool)
1258  {
1259  auto dp_out = _DP(i_ch, iz);
1260  PetscScalar value_v = -1.0 * dp_out * S_interp;
1261  PetscInt row_v = i_ch + _n_channels * iz_ind;
1262  LibmeshPetscCall(
1263  VecSetValues(_amc_pressure_force_rhs, 1, &row_v, &value_v, ADD_VALUES));
1264  }
1265  }
1266  }
1267  // Solving pressure problem
1268  LibmeshPetscCall(MatAssemblyBegin(_amc_pressure_force_mat, MAT_FINAL_ASSEMBLY));
1269  LibmeshPetscCall(MatAssemblyEnd(_amc_pressure_force_mat, MAT_FINAL_ASSEMBLY));
1270  if (_segregated_bool)
1271  {
1272  KSP ksploc;
1273  PC pc;
1274  Vec sol;
1275  LibmeshPetscCall(VecDuplicate(_amc_pressure_force_rhs, &sol));
1276  LibmeshPetscCall(KSPCreate(PETSC_COMM_SELF, &ksploc));
1277  LibmeshPetscCall(KSPSetOperators(ksploc, _amc_pressure_force_mat, _amc_pressure_force_mat));
1278  LibmeshPetscCall(KSPGetPC(ksploc, &pc));
1279  LibmeshPetscCall(PCSetType(pc, PCJACOBI));
1280  LibmeshPetscCall(KSPSetTolerances(ksploc, _rtol, _atol, _dtol, _maxit));
1281  LibmeshPetscCall(KSPSetFromOptions(ksploc));
1282  LibmeshPetscCall(KSPSolve(ksploc, _amc_pressure_force_rhs, sol));
1283  PetscScalar * xx;
1284  LibmeshPetscCall(VecGetArray(sol, &xx));
1285  // update Pressure solution
1286  for (unsigned int iz = last_node; iz > first_node - 1; iz--)
1287  {
1288  auto iz_ind = iz - first_node;
1289  for (unsigned int i_ch = 0; i_ch < _n_channels; i_ch++)
1290  {
1291  auto * node_in = _subchannel_mesh.getChannelNode(i_ch, iz - 1);
1292  PetscScalar value = xx[iz_ind * _n_channels + i_ch];
1293  _P_soln->set(node_in, value);
1294  }
1295  }
1296  LibmeshPetscCall(VecZeroEntries(_amc_pressure_force_rhs));
1297  LibmeshPetscCall(KSPDestroy(&ksploc));
1298  LibmeshPetscCall(VecDestroy(&sol));
1299  }
1300  }
1301  else
1302  {
1303  LibmeshPetscCall(VecZeroEntries(_amc_pressure_force_rhs));
1304  for (unsigned int iz = last_node; iz > first_node - 1; iz--)
1305  {
1306  auto iz_ind = iz - first_node;
1307  // Calculate pressure in the inlet of the cell assuming known outlet
1308  for (unsigned int i_ch = 0; i_ch < _n_channels; i_ch++)
1309  {
1310  auto * node_out = _subchannel_mesh.getChannelNode(i_ch, iz);
1311  auto * node_in = _subchannel_mesh.getChannelNode(i_ch, iz - 1);
1312 
1313  // inlet, outlet, and interpolated axial surface area
1314  auto S_in = (*_S_flow_soln)(node_in);
1315  auto S_out = (*_S_flow_soln)(node_out);
1316  auto S_interp = computeInterpolatedValue(S_out, S_in, 0.5);
1317 
1318  // Creating matrix of coefficients
1319  PetscInt row = i_ch + _n_channels * iz_ind;
1320  PetscInt col = i_ch + _n_channels * iz_ind;
1321  PetscScalar value = -1.0 * S_interp;
1322  LibmeshPetscCall(
1323  MatSetValues(_amc_pressure_force_mat, 1, &row, 1, &col, &value, INSERT_VALUES));
1324 
1325  if (iz == last_node)
1326  {
1327  PetscScalar value = -1.0 * (*_P_soln)(node_out)*S_interp;
1328  PetscInt row = i_ch + _n_channels * iz_ind;
1329  LibmeshPetscCall(VecSetValues(_amc_pressure_force_rhs, 1, &row, &value, ADD_VALUES));
1330 
1331  auto dp_out = _DP(i_ch, iz);
1332  PetscScalar value_v = -1.0 * dp_out / 2.0 * S_interp;
1333  PetscInt row_v = i_ch + _n_channels * iz_ind;
1334  LibmeshPetscCall(
1335  VecSetValues(_amc_pressure_force_rhs, 1, &row_v, &value_v, ADD_VALUES));
1336  }
1337  else
1338  {
1339  PetscInt row = i_ch + _n_channels * iz_ind;
1340  PetscInt col = i_ch + _n_channels * (iz_ind + 1);
1341  PetscScalar value = 1.0 * S_interp;
1342  LibmeshPetscCall(
1343  MatSetValues(_amc_pressure_force_mat, 1, &row, 1, &col, &value, INSERT_VALUES));
1344 
1345  if (_segregated_bool)
1346  {
1347  auto dp_in = _DP(i_ch, iz - 1);
1348  auto dp_out = _DP(i_ch, iz);
1349  auto dp_interp = computeInterpolatedValue(dp_out, dp_in, 0.5);
1350  PetscScalar value_v = -1.0 * dp_interp * S_interp;
1351  PetscInt row_v = i_ch + _n_channels * iz_ind;
1352  LibmeshPetscCall(
1353  VecSetValues(_amc_pressure_force_rhs, 1, &row_v, &value_v, ADD_VALUES));
1354  }
1355  }
1356  }
1357  }
1358  // Solving pressure problem
1359  LibmeshPetscCall(MatAssemblyBegin(_amc_pressure_force_mat, MAT_FINAL_ASSEMBLY));
1360  LibmeshPetscCall(MatAssemblyEnd(_amc_pressure_force_mat, MAT_FINAL_ASSEMBLY));
1361  if (_verbose_subchannel)
1362  _console << "Block: " << iblock << " - Axial momentum pressure force matrix assembled"
1363  << std::endl;
1364 
1365  if (_segregated_bool)
1366  {
1367  KSP ksploc;
1368  PC pc;
1369  Vec sol;
1370  LibmeshPetscCall(VecDuplicate(_amc_pressure_force_rhs, &sol));
1371  LibmeshPetscCall(KSPCreate(PETSC_COMM_SELF, &ksploc));
1372  LibmeshPetscCall(KSPSetOperators(ksploc, _amc_pressure_force_mat, _amc_pressure_force_mat));
1373  LibmeshPetscCall(KSPGetPC(ksploc, &pc));
1374  LibmeshPetscCall(PCSetType(pc, PCJACOBI));
1375  LibmeshPetscCall(KSPSetTolerances(ksploc, _rtol, _atol, _dtol, _maxit));
1376  LibmeshPetscCall(KSPSetFromOptions(ksploc));
1377  LibmeshPetscCall(KSPSolve(ksploc, _amc_pressure_force_rhs, sol));
1378  PetscScalar * xx;
1379  LibmeshPetscCall(VecGetArray(sol, &xx));
1380  // update Pressure solution
1381  for (unsigned int iz = last_node; iz > first_node - 1; iz--)
1382  {
1383  auto iz_ind = iz - first_node;
1384  for (unsigned int i_ch = 0; i_ch < _n_channels; i_ch++)
1385  {
1386  auto * node_in = _subchannel_mesh.getChannelNode(i_ch, iz - 1);
1387  PetscScalar value = xx[iz_ind * _n_channels + i_ch];
1388  _P_soln->set(node_in, value);
1389  }
1390  }
1391  LibmeshPetscCall(VecZeroEntries(_amc_pressure_force_rhs));
1392  LibmeshPetscCall(KSPDestroy(&ksploc));
1393  LibmeshPetscCall(VecDestroy(&sol));
1394  }
1395  }
1396  }
1397 }
const PetscReal & _dtol
The divergence tolerance for the ksp linear solver.
libMesh::DenseMatrix< Real > _DP
PetscScalar computeInterpolatedValue(PetscScalar topValue, PetscScalar botValue, PetscScalar Peclet=0.0)
const bool _segregated_bool
Segregated solve.
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.
Real value(unsigned n, unsigned alpha, unsigned beta, Real x)
const PetscReal & _atol
The absolute convergence tolerance for the ksp linear solver.
PetscScalar computeInterpolationCoefficients(PetscScalar Peclet=0.0)
Functions that computes the interpolation scheme given the Peclet number.
const PetscInt & _maxit
The maximum number of iterations to use for the ksp linear solver.
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.
const PetscReal & _rtol
The relative convergence tolerance, (relative decrease) for the ksp linear solver.
static const std::string alpha
Definition: NS.h:138
const bool _verbose_subchannel
Boolean to printout information related to subchannel solve.
const bool _implicit_bool
Flag to define the usage of a implicit or explicit solution.
const ConsoleStream _console
std::unique_ptr< SolutionHandle > _P_soln

◆ computeRho()

void SubChannel1PhaseProblem::computeRho ( int  iblock)
protectedinherited

Computes Density per channel for block iblock.

Definition at line 1415 of file SubChannel1PhaseProblem.C.

Referenced by SubChannel1PhaseProblem::externalSolve().

1416 {
1417  const unsigned int last_node = (iblock + 1) * _block_size;
1418  const unsigned int first_node = iblock * _block_size + 1;
1419  if (iblock == 0)
1420  {
1421  for (unsigned int i_ch = 0; i_ch < _n_channels; i_ch++)
1422  {
1423  auto * node = _subchannel_mesh.getChannelNode(i_ch, 0);
1424  _rho_soln->set(node, _fp->rho_from_p_T((*_P_soln)(node) + _P_out, (*_T_soln)(node)));
1425  }
1426  }
1427  for (unsigned int iz = first_node; iz < last_node + 1; iz++)
1428  {
1429  for (unsigned int i_ch = 0; i_ch < _n_channels; i_ch++)
1430  {
1431  auto * node = _subchannel_mesh.getChannelNode(i_ch, iz);
1432  _rho_soln->set(node, _fp->rho_from_p_T((*_P_soln)(node) + _P_out, (*_T_soln)(node)));
1433  }
1434  }
1435 }
std::unique_ptr< SolutionHandle > _T_soln
const PostprocessorValue & _P_out
Outlet pressure postprocessor value.
std::unique_ptr< SolutionHandle > _rho_soln
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.
std::unique_ptr< SolutionHandle > _P_soln
const SinglePhaseFluidProperties * _fp
Non-owning pointer to fluid properties user object.

◆ computeSumWij()

void SubChannel1PhaseProblem::computeSumWij ( int  iblock)
protectedinherited

Computes net diversion crossflow per channel for block iblock.

Definition at line 488 of file SubChannel1PhaseProblem.C.

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

489 {
490  const unsigned int last_node = (iblock + 1) * _block_size;
491  const unsigned int first_node = iblock * _block_size + 1;
492  // Add to solution vector if explicit
493  if (!_implicit_bool)
494  {
495  for (unsigned int iz = first_node; iz < last_node + 1; iz++)
496  {
497  for (unsigned int i_ch = 0; i_ch < _n_channels; i_ch++)
498  {
499  auto * node_out = _subchannel_mesh.getChannelNode(i_ch, iz);
500  Real sumWij = 0.0;
501  // Calculate sum of crossflow into channel i from channels j around i
502  unsigned int counter = 0;
503  for (auto i_gap : _subchannel_mesh.getChannelGaps(i_ch))
504  {
505  sumWij += _subchannel_mesh.getCrossflowSign(i_ch, counter) * _Wij(i_gap, iz);
506  counter++;
507  }
508  // The net crossflow coming out of cell i [kg/sec]
509  _SumWij_soln->set(node_out, sumWij);
510  }
511  }
512  }
513  // Add to matrix if implicit
514  else
515  {
516  for (unsigned int iz = first_node; iz < last_node + 1; iz++)
517  {
518  unsigned int iz_ind = iz - first_node;
519  for (unsigned int i_ch = 0; i_ch < _n_channels; i_ch++)
520  {
521  // Calculate sum of crossflow into channel i from channels j around i
522  unsigned int counter = 0;
523  for (auto i_gap : _subchannel_mesh.getChannelGaps(i_ch))
524  {
525  PetscInt row = i_ch + _n_channels * iz_ind;
526  PetscInt col = i_gap + _n_gaps * iz_ind;
527  PetscScalar value = _subchannel_mesh.getCrossflowSign(i_ch, counter);
528  LibmeshPetscCall(MatSetValues(_mc_sumWij_mat, 1, &row, 1, &col, &value, INSERT_VALUES));
529  counter++;
530  }
531  }
532  }
533  LibmeshPetscCall(MatAssemblyBegin(_mc_sumWij_mat, MAT_FINAL_ASSEMBLY));
534  LibmeshPetscCall(MatAssemblyEnd(_mc_sumWij_mat, MAT_FINAL_ASSEMBLY));
535  if (_segregated_bool)
536  {
537  Vec loc_prod;
538  Vec loc_Wij;
539  LibmeshPetscCall(VecDuplicate(_amc_sys_mdot_rhs, &loc_prod));
540  LibmeshPetscCall(VecDuplicate(_Wij_vec, &loc_Wij));
542  loc_Wij, _Wij, first_node, last_node, _n_gaps));
543  LibmeshPetscCall(MatMult(_mc_sumWij_mat, loc_Wij, loc_prod));
544  LibmeshPetscCall(populateSolutionChan<SolutionHandle>(
545  loc_prod, *_SumWij_soln, first_node, last_node, _n_channels));
546  LibmeshPetscCall(VecDestroy(&loc_prod));
547  LibmeshPetscCall(VecDestroy(&loc_Wij));
548  }
549  }
550 }
const bool _segregated_bool
Segregated solve.
virtual const std::vector< unsigned int > & getChannelGaps(unsigned int i_chan) const =0
Return a vector of gap indices for a given channel index.
Mat _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)
Real value(unsigned n, unsigned alpha, unsigned beta, Real x)
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.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
libMesh::DenseMatrix< Real > & _Wij
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.
std::unique_ptr< SolutionHandle > _SumWij_soln
const bool _implicit_bool
Flag to define the usage of a implicit or explicit solution.

◆ computeSweepFlowMixingParameter()

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

Computes and validates the sweep-flow mixing parameter.

Definition at line 1893 of file SubChannel1PhaseProblem.C.

Referenced by TriSubChannel1PhaseProblem::computeh().

1894 {
1895  auto beta = _mixing_closure->computeSweepFlowMixingParameter(i_gap, iz);
1896  if (!std::isfinite(beta) || beta < 0.0)
1897  mooseError(name(),
1898  ": Mixing closure returned invalid sweep-flow coefficient = ",
1899  beta,
1900  " for gap ",
1901  i_gap,
1902  " at axial index ",
1903  iz,
1904  ". sweep-flow coefficient must be finite and non-negative.");
1905 
1906  return beta;
1907 }
const SCMMixingClosureBase * _mixing_closure
Turbulent Mixing closure object.
const std::string & name() const
virtual Real computeSweepFlowMixingParameter(const unsigned int i_gap, const unsigned int iz) const
Computes the wire-wrap sweep-flow coefficient for peripheral gaps.
void mooseError(Args &&... args) const

◆ computeT()

void SubChannel1PhaseProblem::computeT ( int  iblock)
protectedinherited

Computes Temperature per channel for block iblock.

Definition at line 1400 of file SubChannel1PhaseProblem.C.

Referenced by SubChannel1PhaseProblem::externalSolve().

1401 {
1402  const unsigned int last_node = (iblock + 1) * _block_size;
1403  const unsigned int first_node = iblock * _block_size + 1;
1404  for (unsigned int iz = first_node; iz < last_node + 1; iz++)
1405  {
1406  for (unsigned int i_ch = 0; i_ch < _n_channels; i_ch++)
1407  {
1408  auto * node = _subchannel_mesh.getChannelNode(i_ch, iz);
1409  _T_soln->set(node, _fp->T_from_p_h((*_P_soln)(node) + _P_out, (*_h_soln)(node)));
1410  }
1411  }
1412 }
std::unique_ptr< SolutionHandle > _T_soln
std::unique_ptr< SolutionHandle > _h_soln
const PostprocessorValue & _P_out
Outlet pressure postprocessor value.
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.
std::unique_ptr< SolutionHandle > _P_soln
const SinglePhaseFluidProperties * _fp
Non-owning pointer to fluid properties user object.

◆ computeWijFromSolve()

void SubChannel1PhaseProblem::computeWijFromSolve ( int  iblock)
protectedinherited

Computes diversion crossflow per gap for block iblock.

Definition at line 455 of file SubChannel1PhaseProblem.C.

Referenced by SubChannel1PhaseProblem::externalSolve().

456 {
457  const unsigned int last_node = (iblock + 1) * _block_size;
458  const unsigned int first_node = iblock * _block_size + 1;
459  // Initial guess, port crossflow of block (iblock) into a vector that will act as my initial guess
460  libMesh::DenseVector<Real> solution_seed(_n_gaps * _block_size, 0.0);
461  for (unsigned int iz = first_node; iz < last_node + 1; iz++)
462  {
463  for (unsigned int i_gap = 0; i_gap < _n_gaps; i_gap++)
464  {
465  int i = _n_gaps * (iz - first_node) + i_gap; // column wise transfer
466  solution_seed(i) = _Wij(i_gap, iz);
467  }
468  }
469 
470  // Solving the combined lateral momentum equation for Wij using a PETSc solver and update vector
471  // root
473  LibmeshPetscCall(petscSnesSolver(iblock, solution_seed, root));
474 
475  // Assign the solution to the cross-flow matrix
476  int i = 0;
477  for (unsigned int iz = first_node; iz < last_node + 1; iz++)
478  {
479  for (unsigned int i_gap = 0; i_gap < _n_gaps; i_gap++)
480  {
481  _Wij(i_gap, iz) = root(i);
482  i++;
483  }
484  }
485 }
Real root(std::function< Real(Real)> const &f, Real x1, Real x2, Real tol=1.0e-12)
Finds the root of a function using Brent&#39;s method.
Definition: BrentsMethod.C:66
libMesh::DenseMatrix< Real > & _Wij
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.

◆ computeWijPrime()

void SubChannel1PhaseProblem::computeWijPrime ( int  iblock)
protectedinherited

Computes turbulent crossflow per gap for block iblock.

Update turbulent crossflow

Definition at line 1780 of file SubChannel1PhaseProblem.C.

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

1781 {
1782  const unsigned int last_node = (iblock + 1) * _block_size;
1783  const unsigned int first_node = iblock * _block_size + 1;
1784  for (unsigned int iz = first_node; iz < last_node + 1; iz++)
1785  {
1786  auto dz = _z_grid[iz] - _z_grid[iz - 1];
1787  for (unsigned int i_gap = 0; i_gap < _n_gaps; i_gap++)
1788  {
1789  auto chans = _subchannel_mesh.getGapChannels(i_gap);
1790  unsigned int i_ch = chans.first;
1791  unsigned int j_ch = chans.second;
1792  auto * node_in_i = _subchannel_mesh.getChannelNode(i_ch, iz - 1);
1793  auto * node_out_i = _subchannel_mesh.getChannelNode(i_ch, iz);
1794  auto * node_in_j = _subchannel_mesh.getChannelNode(j_ch, iz - 1);
1795  auto * node_out_j = _subchannel_mesh.getChannelNode(j_ch, iz);
1796  auto Si_in = (*_S_flow_soln)(node_in_i);
1797  auto Sj_in = (*_S_flow_soln)(node_in_j);
1798  auto Si_out = (*_S_flow_soln)(node_out_i);
1799  auto Sj_out = (*_S_flow_soln)(node_out_j);
1800  auto gap = _subchannel_mesh.getGapWidth(iz, i_gap);
1801  auto Sij = dz * gap;
1802  auto avg_massflux =
1803  0.5 * (((*_mdot_soln)(node_in_i) + (*_mdot_soln)(node_in_j)) / (Si_in + Sj_in) +
1804  ((*_mdot_soln)(node_out_i) + (*_mdot_soln)(node_out_j)) / (Si_out + Sj_out));
1805  auto beta = computeMixingParameter(i_gap, iz);
1806 
1807  if (!_implicit_bool)
1808  {
1809  _WijPrime(i_gap, iz) = beta * avg_massflux * Sij;
1810  }
1811  else
1812  {
1813  auto iz_ind = iz - first_node;
1814  PetscScalar base_value = beta * 0.5 * Sij;
1815 
1816  // Bottom values
1817  if (iz == first_node)
1818  {
1819  PetscScalar value_tl = -1.0 * base_value / (Si_in + Sj_in) *
1820  ((*_mdot_soln)(node_in_i) + (*_mdot_soln)(node_in_j));
1821  PetscInt row = i_gap + _n_gaps * iz_ind;
1822  LibmeshPetscCall(
1823  VecSetValues(_amc_turbulent_cross_flows_rhs, 1, &row, &value_tl, INSERT_VALUES));
1824  }
1825  else
1826  {
1827  PetscScalar value_tl = base_value / (Si_in + Sj_in);
1828  PetscInt row = i_gap + _n_gaps * iz_ind;
1829 
1830  PetscInt col_ich = i_ch + _n_channels * (iz_ind - 1);
1831  LibmeshPetscCall(MatSetValues(
1832  _amc_turbulent_cross_flows_mat, 1, &row, 1, &col_ich, &value_tl, INSERT_VALUES));
1833 
1834  PetscInt col_jch = j_ch + _n_channels * (iz_ind - 1);
1835  LibmeshPetscCall(MatSetValues(
1836  _amc_turbulent_cross_flows_mat, 1, &row, 1, &col_jch, &value_tl, INSERT_VALUES));
1837  }
1838 
1839  // Top values
1840  PetscScalar value_bl = base_value / (Si_out + Sj_out);
1841  PetscInt row = i_gap + _n_gaps * iz_ind;
1842 
1843  PetscInt col_ich = i_ch + _n_channels * iz_ind;
1844  LibmeshPetscCall(MatSetValues(
1845  _amc_turbulent_cross_flows_mat, 1, &row, 1, &col_ich, &value_bl, INSERT_VALUES));
1846 
1847  PetscInt col_jch = j_ch + _n_channels * iz_ind;
1848  LibmeshPetscCall(MatSetValues(
1849  _amc_turbulent_cross_flows_mat, 1, &row, 1, &col_jch, &value_bl, INSERT_VALUES));
1850  }
1851  }
1852  }
1853 
1854  if (_implicit_bool)
1855  {
1856  LibmeshPetscCall(MatAssemblyBegin(_amc_turbulent_cross_flows_mat, MAT_FINAL_ASSEMBLY));
1857  LibmeshPetscCall(MatAssemblyEnd(_amc_turbulent_cross_flows_mat, MAT_FINAL_ASSEMBLY));
1858 
1860  Vec loc_prod;
1861  Vec loc_Wij;
1862  LibmeshPetscCall(VecDuplicate(_amc_sys_mdot_rhs, &loc_prod));
1863  LibmeshPetscCall(VecDuplicate(_Wij_vec, &loc_Wij));
1864  LibmeshPetscCall(populateVectorFromHandle<SolutionHandle>(
1865  loc_prod, *_mdot_soln, first_node, last_node, _n_channels));
1866  LibmeshPetscCall(MatMult(_amc_turbulent_cross_flows_mat, loc_prod, loc_Wij));
1867  LibmeshPetscCall(VecAXPY(loc_Wij, -1.0, _amc_turbulent_cross_flows_rhs));
1869  loc_Wij, _WijPrime, first_node, last_node, _n_gaps));
1870  LibmeshPetscCall(VecDestroy(&loc_prod));
1871  LibmeshPetscCall(VecDestroy(&loc_Wij));
1872  }
1873 }
Real computeMixingParameter(unsigned int i_gap, unsigned int iz) const
Computes and validates the turbulent mixing parameter.
Mat _amc_turbulent_cross_flows_mat
Mass conservation - density time derivative No implicit matrix.
std::vector< Real > _z_grid
axial location of nodes
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.
std::unique_ptr< SolutionHandle > _mdot_soln
Solutions handles and link to TH tables properties.
PetscErrorCode populateDenseFromVector(const Vec &x, T &solution, const unsigned int first_axial_level, const unsigned int last_axial_level, const unsigned int cross_dimension)
virtual Real getGapWidth(unsigned int axial_index, unsigned int gap_index) const =0
Return gap width for a given gap index.
const bool _implicit_bool
Flag to define the usage of a implicit or explicit solution.
libMesh::DenseMatrix< Real > _WijPrime
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.

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

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

1462 {
1463  const unsigned int last_node = (iblock + 1) * _block_size;
1464  const unsigned int first_node = iblock * _block_size + 1;
1465  // Cross flow residual
1466  if (!_implicit_bool)
1467  {
1468  const Real & pitch = _subchannel_mesh.getPitch();
1469  for (unsigned int iz = first_node; iz < last_node + 1; iz++)
1470  {
1471  auto dz = _z_grid[iz] - _z_grid[iz - 1];
1472  for (unsigned int i_gap = 0; i_gap < _n_gaps; i_gap++)
1473  {
1474  auto chans = _subchannel_mesh.getGapChannels(i_gap);
1475  unsigned int i_ch = chans.first;
1476  unsigned int j_ch = chans.second;
1477  auto * node_in_i = _subchannel_mesh.getChannelNode(i_ch, iz - 1);
1478  auto * node_out_i = _subchannel_mesh.getChannelNode(i_ch, iz);
1479  auto * node_in_j = _subchannel_mesh.getChannelNode(j_ch, iz - 1);
1480  auto * node_out_j = _subchannel_mesh.getChannelNode(j_ch, iz);
1481  auto rho_i = (*_rho_soln)(node_in_i);
1482  auto rho_j = (*_rho_soln)(node_in_j);
1483  auto Si = (*_S_flow_soln)(node_in_i);
1484  auto Sj = (*_S_flow_soln)(node_in_j);
1485  auto Sij = dz * _subchannel_mesh.getGapWidth(iz, i_gap);
1486  auto Lij = pitch;
1487  // total local form loss in the ij direction
1488  auto friction_term = _kij * _Wij(i_gap, iz) * std::abs(_Wij(i_gap, iz));
1489  auto DPij = (*_P_soln)(node_in_i) - (*_P_soln)(node_in_j);
1490  // Figure out donor cell density
1491  auto rho_star = 0.0;
1492  if (_Wij(i_gap, iz) > 0.0)
1493  rho_star = rho_i;
1494  else if (_Wij(i_gap, iz) < 0.0)
1495  rho_star = rho_j;
1496  else
1497  rho_star = (rho_i + rho_j) / 2.0;
1498  auto mass_term_out =
1499  (*_mdot_soln)(node_out_i) / (*_S_flow_soln)(node_out_i) / (*_rho_soln)(node_out_i) +
1500  (*_mdot_soln)(node_out_j) / (*_S_flow_soln)(node_out_j) / (*_rho_soln)(node_out_j);
1501  auto mass_term_in =
1502  (*_mdot_soln)(node_in_i) / Si / rho_i + (*_mdot_soln)(node_in_j) / Sj / rho_j;
1503  auto term_out = Sij * rho_star * (Lij / dz) * mass_term_out * _Wij(i_gap, iz);
1504  auto term_in = Sij * rho_star * (Lij / dz) * mass_term_in * _Wij(i_gap, iz - 1);
1505  auto inertia_term = term_out - term_in;
1506  auto pressure_term = 2 * Utility::pow<2>(Sij) * DPij * rho_star;
1507  auto time_term =
1508  _TR * 2.0 * (_Wij(i_gap, iz) - _Wij_old(i_gap, iz)) * Lij * Sij * rho_star / _dt;
1509 
1510  _Wij_residual_matrix(i_gap, iz - 1 - iblock * _block_size) =
1511  time_term + friction_term + inertia_term - pressure_term;
1512  }
1513  }
1514  }
1515  else
1516  {
1517  // Initializing to zero the elements of the lateral momentum assembly
1518  LibmeshPetscCall(MatZeroEntries(_cmc_time_derivative_mat));
1519  LibmeshPetscCall(MatZeroEntries(_cmc_advective_derivative_mat));
1520  LibmeshPetscCall(MatZeroEntries(_cmc_friction_force_mat));
1521  LibmeshPetscCall(MatZeroEntries(_cmc_pressure_force_mat));
1522  LibmeshPetscCall(VecZeroEntries(_cmc_time_derivative_rhs));
1523  LibmeshPetscCall(VecZeroEntries(_cmc_advective_derivative_rhs));
1524  LibmeshPetscCall(VecZeroEntries(_cmc_friction_force_rhs));
1525  LibmeshPetscCall(VecZeroEntries(_cmc_pressure_force_rhs));
1526  LibmeshPetscCall(MatZeroEntries(_cmc_sys_Wij_mat));
1527  LibmeshPetscCall(VecZeroEntries(_cmc_sys_Wij_rhs));
1528  const Real & pitch = _subchannel_mesh.getPitch();
1529  for (unsigned int iz = first_node; iz < last_node + 1; iz++)
1530  {
1531  auto dz = _z_grid[iz] - _z_grid[iz - 1];
1532  auto iz_ind = iz - first_node;
1533  for (unsigned int i_gap = 0; i_gap < _n_gaps; i_gap++)
1534  {
1535  auto chans = _subchannel_mesh.getGapChannels(i_gap);
1536  unsigned int i_ch = chans.first;
1537  unsigned int j_ch = chans.second;
1538  auto * node_in_i = _subchannel_mesh.getChannelNode(i_ch, iz - 1);
1539  auto * node_out_i = _subchannel_mesh.getChannelNode(i_ch, iz);
1540  auto * node_in_j = _subchannel_mesh.getChannelNode(j_ch, iz - 1);
1541  auto * node_out_j = _subchannel_mesh.getChannelNode(j_ch, iz);
1542 
1543  // inlet, outlet, and interpolated densities
1544  auto rho_i_in = (*_rho_soln)(node_in_i);
1545  auto rho_i_out = (*_rho_soln)(node_out_i);
1546  auto rho_i_interp = computeInterpolatedValue(rho_i_out, rho_i_in, 0.5);
1547  auto rho_j_in = (*_rho_soln)(node_in_j);
1548  auto rho_j_out = (*_rho_soln)(node_out_j);
1549  auto rho_j_interp = computeInterpolatedValue(rho_j_out, rho_j_in, 0.5);
1550 
1551  // inlet, outlet, and interpolated areas
1552  auto S_i_in = (*_S_flow_soln)(node_in_i);
1553  auto S_i_out = (*_S_flow_soln)(node_out_i);
1554  auto S_j_in = (*_S_flow_soln)(node_in_j);
1555  auto S_j_out = (*_S_flow_soln)(node_out_j);
1556 
1557  // Cross-sectional gap area
1558  auto Sij = dz * _subchannel_mesh.getGapWidth(iz, i_gap);
1559  auto Lij = pitch;
1560 
1561  // Figure out donor cell density
1562  auto rho_star = 0.0;
1563  if (_Wij(i_gap, iz) > 0.0)
1564  rho_star = rho_i_interp;
1565  else if (_Wij(i_gap, iz) < 0.0)
1566  rho_star = rho_j_interp;
1567  else
1568  rho_star = (rho_i_interp + rho_j_interp) / 2.0;
1569 
1570  // Assembling time derivative
1571  PetscScalar time_factor = _TR * Lij * Sij * rho_star / _dt;
1572  PetscInt row_td = i_gap + _n_gaps * iz_ind;
1573  PetscInt col_td = i_gap + _n_gaps * iz_ind;
1574  PetscScalar value_td = time_factor;
1575  LibmeshPetscCall(MatSetValues(
1576  _cmc_time_derivative_mat, 1, &row_td, 1, &col_td, &value_td, INSERT_VALUES));
1577  PetscScalar value_td_rhs = time_factor * _Wij_old(i_gap, iz);
1578  LibmeshPetscCall(
1579  VecSetValues(_cmc_time_derivative_rhs, 1, &row_td, &value_td_rhs, INSERT_VALUES));
1580 
1581  // Assembling inertial term
1582  PetscScalar Pe = 0.5;
1584  auto mass_term_out = (*_mdot_soln)(node_out_i) / S_i_out / rho_i_out +
1585  (*_mdot_soln)(node_out_j) / S_j_out / rho_j_out;
1586  auto mass_term_in = (*_mdot_soln)(node_in_i) / S_i_in / rho_i_in +
1587  (*_mdot_soln)(node_in_j) / S_j_in / rho_j_in;
1588  auto term_out = Sij * rho_star * (Lij / dz) * mass_term_out / 2.0;
1589  auto term_in = Sij * rho_star * (Lij / dz) * mass_term_in / 2.0;
1590  if (iz == first_node)
1591  {
1592  PetscInt row_ad = i_gap + _n_gaps * iz_ind;
1593  PetscScalar value_ad = term_in * alpha * _Wij(i_gap, iz - 1);
1594  LibmeshPetscCall(
1595  VecSetValues(_cmc_advective_derivative_rhs, 1, &row_ad, &value_ad, ADD_VALUES));
1596 
1597  PetscInt col_ad = i_gap + _n_gaps * iz_ind;
1598  value_ad = -1.0 * term_in * (1.0 - alpha) + term_out * alpha;
1599  LibmeshPetscCall(MatSetValues(
1600  _cmc_advective_derivative_mat, 1, &row_ad, 1, &col_ad, &value_ad, INSERT_VALUES));
1601 
1602  col_ad = i_gap + _n_gaps * (iz_ind + 1);
1603  value_ad = term_out * (1.0 - alpha);
1604  LibmeshPetscCall(MatSetValues(
1605  _cmc_advective_derivative_mat, 1, &row_ad, 1, &col_ad, &value_ad, INSERT_VALUES));
1606  }
1607  else if (iz == last_node)
1608  {
1609  PetscInt row_ad = i_gap + _n_gaps * iz_ind;
1610  PetscInt col_ad = i_gap + _n_gaps * (iz_ind - 1);
1611  PetscScalar value_ad = -1.0 * term_in * alpha;
1612  LibmeshPetscCall(MatSetValues(
1613  _cmc_advective_derivative_mat, 1, &row_ad, 1, &col_ad, &value_ad, INSERT_VALUES));
1614 
1615  col_ad = i_gap + _n_gaps * iz_ind;
1616  value_ad = -1.0 * term_in * (1.0 - alpha) + term_out * alpha;
1617  LibmeshPetscCall(MatSetValues(
1618  _cmc_advective_derivative_mat, 1, &row_ad, 1, &col_ad, &value_ad, INSERT_VALUES));
1619 
1620  value_ad = -1.0 * term_out * (1.0 - alpha) * _Wij(i_gap, iz);
1621  LibmeshPetscCall(
1622  VecSetValues(_cmc_advective_derivative_rhs, 1, &row_ad, &value_ad, ADD_VALUES));
1623  }
1624  else
1625  {
1626  PetscInt row_ad = i_gap + _n_gaps * iz_ind;
1627  PetscInt col_ad = i_gap + _n_gaps * (iz_ind - 1);
1628  PetscScalar value_ad = -1.0 * term_in * alpha;
1629  LibmeshPetscCall(MatSetValues(
1630  _cmc_advective_derivative_mat, 1, &row_ad, 1, &col_ad, &value_ad, INSERT_VALUES));
1631 
1632  col_ad = i_gap + _n_gaps * iz_ind;
1633  value_ad = -1.0 * term_in * (1.0 - alpha) + term_out * alpha;
1634  LibmeshPetscCall(MatSetValues(
1635  _cmc_advective_derivative_mat, 1, &row_ad, 1, &col_ad, &value_ad, INSERT_VALUES));
1636 
1637  col_ad = i_gap + _n_gaps * (iz_ind + 1);
1638  value_ad = term_out * (1.0 - alpha);
1639  LibmeshPetscCall(MatSetValues(
1640  _cmc_advective_derivative_mat, 1, &row_ad, 1, &col_ad, &value_ad, INSERT_VALUES));
1641  }
1642  // Assembling friction force
1643  PetscInt row_ff = i_gap + _n_gaps * iz_ind;
1644  PetscInt col_ff = i_gap + _n_gaps * iz_ind;
1645  PetscScalar value_ff = _kij * std::abs(_Wij(i_gap, iz)) / 2.0;
1646  LibmeshPetscCall(MatSetValues(
1647  _cmc_friction_force_mat, 1, &row_ff, 1, &col_ff, &value_ff, INSERT_VALUES));
1648 
1649  // Assembling pressure force
1651 
1653  {
1654  PetscScalar pressure_factor = Utility::pow<2>(Sij) * rho_star;
1655  PetscInt row_pf = i_gap + _n_gaps * iz_ind;
1656  PetscInt col_pf = i_ch + _n_channels * iz_ind;
1657  PetscScalar value_pf = -1.0 * alpha * pressure_factor;
1658  LibmeshPetscCall(
1659  MatSetValues(_cmc_pressure_force_mat, 1, &row_pf, 1, &col_pf, &value_pf, ADD_VALUES));
1660  col_pf = j_ch + _n_channels * iz_ind;
1661  value_pf = alpha * pressure_factor;
1662  LibmeshPetscCall(
1663  MatSetValues(_cmc_pressure_force_mat, 1, &row_pf, 1, &col_pf, &value_pf, ADD_VALUES));
1664 
1665  if (iz == last_node)
1666  {
1667  PetscInt row_pf = i_gap + _n_gaps * iz_ind;
1668  PetscScalar value_pf = (1.0 - alpha) * pressure_factor * (*_P_soln)(node_out_i);
1669  LibmeshPetscCall(
1670  VecSetValues(_cmc_pressure_force_rhs, 1, &row_pf, &value_pf, ADD_VALUES));
1671  value_pf = -1.0 * (1.0 - alpha) * pressure_factor * (*_P_soln)(node_out_j);
1672  LibmeshPetscCall(
1673  VecSetValues(_cmc_pressure_force_rhs, 1, &row_pf, &value_pf, ADD_VALUES));
1674  }
1675  else
1676  {
1677  row_pf = i_gap + _n_gaps * iz_ind;
1678  col_pf = i_ch + _n_channels * (iz_ind + 1);
1679  value_pf = -1.0 * (1.0 - alpha) * pressure_factor;
1680  LibmeshPetscCall(MatSetValues(
1681  _cmc_pressure_force_mat, 1, &row_pf, 1, &col_pf, &value_pf, ADD_VALUES));
1682  col_pf = j_ch + _n_channels * (iz_ind + 1);
1683  value_pf = (1.0 - alpha) * pressure_factor;
1684  LibmeshPetscCall(MatSetValues(
1685  _cmc_pressure_force_mat, 1, &row_pf, 1, &col_pf, &value_pf, ADD_VALUES));
1686  }
1687  }
1688  else
1689  {
1690  PetscScalar pressure_factor = Utility::pow<2>(Sij) * rho_star;
1691  PetscInt row_pf = i_gap + _n_gaps * iz_ind;
1692  PetscInt col_pf = i_ch + _n_channels * iz_ind;
1693  PetscScalar value_pf = -1.0 * pressure_factor;
1694  LibmeshPetscCall(
1695  MatSetValues(_cmc_pressure_force_mat, 1, &row_pf, 1, &col_pf, &value_pf, ADD_VALUES));
1696  col_pf = j_ch + _n_channels * iz_ind;
1697  value_pf = pressure_factor;
1698  LibmeshPetscCall(
1699  MatSetValues(_cmc_pressure_force_mat, 1, &row_pf, 1, &col_pf, &value_pf, ADD_VALUES));
1700  }
1701  }
1702  }
1704  LibmeshPetscCall(MatZeroEntries(_cmc_sys_Wij_mat));
1705  LibmeshPetscCall(VecZeroEntries(_cmc_sys_Wij_rhs));
1706  LibmeshPetscCall(MatAssemblyBegin(_cmc_time_derivative_mat, MAT_FINAL_ASSEMBLY));
1707  LibmeshPetscCall(MatAssemblyEnd(_cmc_time_derivative_mat, MAT_FINAL_ASSEMBLY));
1708  LibmeshPetscCall(MatAssemblyBegin(_cmc_advective_derivative_mat, MAT_FINAL_ASSEMBLY));
1709  LibmeshPetscCall(MatAssemblyEnd(_cmc_advective_derivative_mat, MAT_FINAL_ASSEMBLY));
1710  LibmeshPetscCall(MatAssemblyBegin(_cmc_friction_force_mat, MAT_FINAL_ASSEMBLY));
1711  LibmeshPetscCall(MatAssemblyEnd(_cmc_friction_force_mat, MAT_FINAL_ASSEMBLY));
1712  LibmeshPetscCall(MatAssemblyBegin(_cmc_pressure_force_mat, MAT_FINAL_ASSEMBLY));
1713  LibmeshPetscCall(MatAssemblyEnd(_cmc_pressure_force_mat, MAT_FINAL_ASSEMBLY));
1714  LibmeshPetscCall(MatAssemblyBegin(_cmc_sys_Wij_mat, MAT_FINAL_ASSEMBLY));
1715  LibmeshPetscCall(MatAssemblyEnd(_cmc_sys_Wij_mat, MAT_FINAL_ASSEMBLY));
1716  // Matrix
1717 #if !PETSC_VERSION_LESS_THAN(3, 15, 0)
1718  LibmeshPetscCall(
1719  MatAXPY(_cmc_sys_Wij_mat, 1.0, _cmc_time_derivative_mat, UNKNOWN_NONZERO_PATTERN));
1720  LibmeshPetscCall(MatAssemblyBegin(_cmc_sys_Wij_mat, MAT_FINAL_ASSEMBLY));
1721  LibmeshPetscCall(MatAssemblyEnd(_cmc_sys_Wij_mat, MAT_FINAL_ASSEMBLY));
1722  LibmeshPetscCall(
1723  MatAXPY(_cmc_sys_Wij_mat, 1.0, _cmc_advective_derivative_mat, UNKNOWN_NONZERO_PATTERN));
1724  LibmeshPetscCall(MatAssemblyBegin(_cmc_sys_Wij_mat, MAT_FINAL_ASSEMBLY));
1725  LibmeshPetscCall(MatAssemblyEnd(_cmc_sys_Wij_mat, MAT_FINAL_ASSEMBLY));
1726  LibmeshPetscCall(
1727  MatAXPY(_cmc_sys_Wij_mat, 1.0, _cmc_friction_force_mat, UNKNOWN_NONZERO_PATTERN));
1728 #else
1729  LibmeshPetscCall(
1730  MatAXPY(_cmc_sys_Wij_mat, 1.0, _cmc_time_derivative_mat, DIFFERENT_NONZERO_PATTERN));
1731  LibmeshPetscCall(MatAssemblyBegin(_cmc_sys_Wij_mat, MAT_FINAL_ASSEMBLY));
1732  LibmeshPetscCall(MatAssemblyEnd(_cmc_sys_Wij_mat, MAT_FINAL_ASSEMBLY));
1733  LibmeshPetscCall(
1734  MatAXPY(_cmc_sys_Wij_mat, 1.0, _cmc_advective_derivative_mat, DIFFERENT_NONZERO_PATTERN));
1735  LibmeshPetscCall(MatAssemblyBegin(_cmc_sys_Wij_mat, MAT_FINAL_ASSEMBLY));
1736  LibmeshPetscCall(MatAssemblyEnd(_cmc_sys_Wij_mat, MAT_FINAL_ASSEMBLY));
1737  LibmeshPetscCall(
1738  MatAXPY(_cmc_sys_Wij_mat, 1.0, _cmc_friction_force_mat, DIFFERENT_NONZERO_PATTERN));
1739 #endif
1740  LibmeshPetscCall(MatAssemblyBegin(_cmc_sys_Wij_mat, MAT_FINAL_ASSEMBLY));
1741  LibmeshPetscCall(MatAssemblyEnd(_cmc_sys_Wij_mat, MAT_FINAL_ASSEMBLY));
1742  // RHS
1743  LibmeshPetscCall(VecAXPY(_cmc_sys_Wij_rhs, 1.0, _cmc_time_derivative_rhs));
1744  LibmeshPetscCall(VecAXPY(_cmc_sys_Wij_rhs, 1.0, _cmc_advective_derivative_rhs));
1745  LibmeshPetscCall(VecAXPY(_cmc_sys_Wij_rhs, 1.0, _cmc_friction_force_rhs));
1746 
1747  if (_segregated_bool)
1748  {
1749  // Assembly the matrix system
1750  Vec sol_holder_P;
1751  LibmeshPetscCall(createPetscVector(sol_holder_P, _block_size * _n_gaps));
1752  Vec sol_holder_W;
1753  LibmeshPetscCall(createPetscVector(sol_holder_W, _block_size * _n_gaps));
1754  LibmeshPetscCall(populateVectorFromHandle<SolutionHandle>(
1755  _prodp, *_P_soln, first_node - 1, last_node - 1, _n_channels));
1757  _Wij_vec, _Wij, first_node, last_node, _n_gaps));
1758  LibmeshPetscCall(MatMult(_cmc_sys_Wij_mat, _Wij_vec, sol_holder_W));
1759  LibmeshPetscCall(VecAXPY(sol_holder_W, -1.0, _cmc_sys_Wij_rhs));
1760  LibmeshPetscCall(MatMult(_cmc_pressure_force_mat, _prodp, sol_holder_P));
1761  LibmeshPetscCall(VecAXPY(sol_holder_P, -1.0, _cmc_pressure_force_rhs));
1762  LibmeshPetscCall(VecAXPY(sol_holder_W, 1.0, sol_holder_P));
1763  PetscScalar * xx;
1764  LibmeshPetscCall(VecGetArray(sol_holder_W, &xx));
1765  for (unsigned int iz = first_node; iz < last_node + 1; iz++)
1766  {
1767  auto iz_ind = iz - first_node;
1768  for (unsigned int i_gap = 0; i_gap < _n_gaps; i_gap++)
1769  {
1770  _Wij_residual_matrix(i_gap, iz - 1 - iblock * _block_size) = xx[iz_ind * _n_gaps + i_gap];
1771  }
1772  }
1773  LibmeshPetscCall(VecDestroy(&sol_holder_P));
1774  LibmeshPetscCall(VecDestroy(&sol_holder_W));
1775  }
1776  }
1777 }
Mat _cmc_friction_force_mat
Cross momentum conservation - friction force.
Real _TR
Flag that activates or deactivates the transient parts of the equations we solve by multiplication...
libMesh::DenseMatrix< Real > _Wij_old
virtual const Real & getPitch() const
Return the undeformed pitch between 2 subchannels.
std::unique_ptr< SolutionHandle > _S_flow_soln
PetscErrorCode createPetscVector(Vec &v, PetscInt n)
Petsc Functions.
PetscScalar computeInterpolatedValue(PetscScalar topValue, PetscScalar botValue, PetscScalar Peclet=0.0)
const bool _segregated_bool
Segregated solve.
Mat _cmc_sys_Wij_mat
Lateral momentum system matrix.
const bool _staggered_pressure_bool
Flag to define the usage of staggered or collocated pressure.
PetscErrorCode populateVectorFromDense(Vec &x, const T &solution, const unsigned int first_axial_level, const unsigned int last_axial_level, const unsigned int cross_dimension)
std::unique_ptr< SolutionHandle > _rho_soln
std::vector< Real > _z_grid
axial location of nodes
static const std::string pitch
PetscScalar computeInterpolationCoefficients(PetscScalar Peclet=0.0)
Functions that computes the interpolation scheme given the Peclet number.
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.
libMesh::DenseMatrix< Real > _Wij_residual_matrix
std::unique_ptr< SolutionHandle > _mdot_soln
Solutions handles and link to TH tables properties.
virtual Real getGapWidth(unsigned int axial_index, unsigned int gap_index) const =0
Return gap width for a given gap index.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
libMesh::DenseMatrix< Real > & _Wij
static const std::string alpha
Definition: NS.h:138
const bool _implicit_bool
Flag to define the usage of a implicit or explicit solution.
Mat _cmc_time_derivative_mat
Cross momentum Cross momentum conservation - time derivative.
Mat _cmc_pressure_force_mat
Cross momentum conservation - pressure force.
std::unique_ptr< SolutionHandle > _P_soln
Mat _cmc_advective_derivative_mat
Cross momentum conservation - advective (Eulerian) derivative.
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.

◆ createPetscMatrix()

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

Definition at line 298 of file SubChannel1PhaseProblem.h.

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

299  {
301  LibmeshPetscCall(MatCreate(PETSC_COMM_SELF, &M));
302  LibmeshPetscCall(MatSetSizes(M, PETSC_DECIDE, PETSC_DECIDE, n, m));
303  LibmeshPetscCall(MatSetFromOptions(M));
304  LibmeshPetscCall(MatSetUp(M));
305  PetscFunctionReturn(LIBMESH_PETSC_SUCCESS);
306  }
const double M
PetscFunctionBegin
PetscFunctionReturn(LIBMESH_PETSC_SUCCESS)

◆ createPetscVector()

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

Petsc Functions.

Definition at line 287 of file SubChannel1PhaseProblem.h.

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

288  {
290  LibmeshPetscCall(VecCreate(PETSC_COMM_SELF, &v));
291  LibmeshPetscCall(PetscObjectSetName((PetscObject)v, "Solution"));
292  LibmeshPetscCall(VecSetSizes(v, PETSC_DECIDE, n));
293  LibmeshPetscCall(VecSetFromOptions(v));
294  LibmeshPetscCall(VecZeroEntries(v));
295  PetscFunctionReturn(LIBMESH_PETSC_SUCCESS);
296  }
PetscFunctionBegin
const double v
PetscFunctionReturn(LIBMESH_PETSC_SUCCESS)

◆ detectDeformation()

void SubChannel1PhaseProblem::detectDeformation ( )
protectedinherited

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

Definition at line 323 of file SubChannel1PhaseProblem.C.

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

324 {
325  const Real tol = libMesh::TOLERANCE;
326  const auto pin_diameter = _subchannel_mesh.getPinDiameter();
327 
328  if (_pin_mesh_exist)
329  {
330  for (unsigned int iz = 0; iz < _n_cells + 1; iz++)
331  for (unsigned int i_pin = 0; i_pin < _n_pins; i_pin++)
332  {
333  auto * node = _subchannel_mesh.getPinNode(i_pin, iz);
334  const Real Dpin = (*_Dpin_soln)(node);
335  if (std::abs(Dpin) <= tol)
336  mooseError("Dpin is zero at node ",
337  node->id(),
338  ". You must initialize Dpin to a non-zero value.");
339  if (std::abs(Dpin - pin_diameter) > tol)
340  _deformation = true;
341  }
342  }
343 
344  for (unsigned int iz = 0; iz < _n_cells + 1 && !_deformation; iz++)
345  for (unsigned int i_ch = 0; i_ch < _n_channels && !_deformation; i_ch++)
346  {
347  auto * node = _subchannel_mesh.getChannelNode(i_ch, iz);
348  auto subch_type = _subchannel_mesh.getSubchannelType(i_ch);
349 
350  if ((subch_type == EChannelType::CORNER || subch_type == EChannelType::EDGE) &&
351  std::abs((*_displacement_soln)(node)) > tol)
352  _deformation = true;
353  }
354 }
const bool _pin_mesh_exist
Flag that informs if there is a pin mesh or not.
virtual const Real & getPinDiameter() const
Return undeformed Pin diameter.
static constexpr Real TOLERANCE
const double tol
virtual EChannelType getSubchannelType(unsigned int index) const =0
Return the type of the subchannel for given subchannel index.
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.
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.
bool _deformation
Flag that activates the effect of deformation (pin/duct) based on the auxvalues for displacement...
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
std::unique_ptr< SolutionHandle > _displacement_soln
void mooseError(Args &&... args) const

◆ externalSolve()

void SubChannel1PhaseProblem::externalSolve ( )
overridevirtualinherited

Assigning temperatures to duct

Implements ExternalProblem.

Definition at line 2501 of file SubChannel1PhaseProblem.C.

2502 {
2503  _console << "Executing subchannel solver\n";
2504  _dt = (isTransient() ? dt() : _one);
2505  _TR = isTransient();
2507  // Small helper functions to reduce repetition
2508  // Verbose print helper (no-op unless _verbose_subchannel is true)
2509  auto V = [&](const std::string & s)
2510  {
2511  if (_verbose_subchannel)
2512  _console << s << std::endl;
2513  };
2514  V("Solution initialized");
2515  Real P_error = 1.0;
2516  unsigned int P_it = 0;
2517  unsigned int P_it_max;
2518 
2519  if (_segregated_bool)
2520  P_it_max = 20 * _n_blocks;
2521  else
2522  P_it_max = 100;
2523 
2524  if ((_n_blocks == 1) && (_segregated_bool))
2525  P_it_max = 5;
2526 
2527  while ((P_error > _P_tol && P_it < P_it_max))
2528  {
2529  P_it += 1;
2530  if (P_it == P_it_max && _n_blocks != 1)
2531  {
2532  _console << "Reached maximum number of axial pressure iterations" << std::endl;
2533  _converged = false;
2534  }
2535  _console << "Solving Outer Iteration : " << P_it << std::endl;
2536  auto P_L2norm_old_axial = _P_soln->L2norm();
2537  for (unsigned int iblock = 0; iblock < _n_blocks; iblock++)
2538  {
2539  int last_level = (iblock + 1) * _block_size;
2540  int first_level = iblock * _block_size + 1;
2541  Real T_block_error = 1.0;
2542  auto T_it = 0;
2543  _console << "Solving Block: " << iblock << " From first level: " << first_level
2544  << " to last level: " << last_level << std::endl;
2545  while (T_block_error > _T_tol && T_it < _T_maxit)
2546  {
2547  T_it += 1;
2548  if (T_it == _T_maxit)
2549  {
2550  _console << "Reached maximum number of temperature iterations for block: " << iblock
2551  << std::endl;
2552  _converged = false;
2553  }
2554  auto T_L2norm_old_block = _T_soln->L2norm();
2555  // We are only computing quantities on rank 0
2556  if (processor_id() > 0)
2557  goto aux_close;
2558 
2559  if (_segregated_bool)
2560  {
2561  computeWijFromSolve(iblock);
2562  if (_compute_power)
2563  {
2564  computeh(iblock);
2565  computeT(iblock);
2566  }
2567  }
2568  else
2569  {
2570  LibmeshPetscCall(implicitPetscSolve(iblock));
2571  computeWijPrime(iblock);
2572  V("Done with main solve.");
2573  if (_compute_power)
2574  {
2575  computeh(iblock);
2576  computeT(iblock);
2577  }
2578  V("Done with thermal solve.");
2579  }
2580 
2581  V("Start updating thermophysical properties.");
2582  if (_compute_density)
2583  computeRho(iblock);
2584  if (_compute_viscosity)
2585  computeMu(iblock);
2586  V("Done updating thermophysical properties.");
2587 
2588  // We must do a global assembly to make sure data is parallel consistent before we do things
2589  // like compute L2 norms
2590  aux_close:
2591  _aux->solution().close();
2592 
2593  auto T_L2norm_new = _T_soln->L2norm();
2594  T_block_error =
2595  std::abs((T_L2norm_new - T_L2norm_old_block) / (T_L2norm_old_block + 1E-14));
2596  _console << "T_block_error: " << T_block_error << std::endl;
2597 
2598  // All processes must have the same iteration count
2599  comm().max(T_block_error);
2600  }
2601  }
2602  auto P_L2norm_new_axial = _P_soln->L2norm();
2603  P_error =
2604  std::abs((P_L2norm_new_axial - P_L2norm_old_axial) / (P_L2norm_old_axial + _P_out + 1E-14));
2605  _console << "P_error :" << P_error << std::endl;
2606  V("Iteration: " + std::to_string(P_it));
2607  V("Maximum iterations: " + std::to_string(P_it_max));
2608  }
2609  // update old crossflow matrix
2610  _Wij_old = _Wij;
2611  _console << "Finished executing subchannel solver\n";
2612 
2613  // set SumWij at the inlet equal to the one on the first axial level (for visualization purposes)
2614  for (unsigned int i_ch = 0; i_ch < _n_channels; i_ch++)
2615  {
2616  auto * node_in = _subchannel_mesh.getChannelNode(i_ch, 0);
2617  auto * node_out = _subchannel_mesh.getChannelNode(i_ch, 1);
2618  _SumWij_soln->set(node_in, (*_SumWij_soln)(node_out)); // kg/sec
2619  }
2620 
2621  if (_pin_mesh_exist)
2622  {
2623  // Assign average HTC to subchannels. This is exact if all pins have the same diameter
2624  for (unsigned int iz = 0; iz < _n_cells + 1; ++iz)
2625  {
2626  for (unsigned int i_ch = 0; i_ch < _n_channels; i_ch++)
2627  {
2628  const auto * node = _subchannel_mesh.getChannelNode(i_ch, iz);
2629  auto mu = (*_mu_soln)(node);
2630  auto S = (*_S_flow_soln)(node);
2631  auto w_perim = (*_w_perim_soln)(node);
2632  auto Dh_i = 4.0 * S / w_perim;
2633  auto Re = (((*_mdot_soln)(node) / S) * Dh_i / mu);
2634  auto k = _fp->k_from_p_T((*_P_soln)(node) + _P_out, (*_T_soln)(node));
2635  auto cp = _fp->cp_from_p_T((*_P_soln)(node) + _P_out, (*_T_soln)(node));
2636  auto Pr = (*_mu_soln)(node)*cp / k;
2637  // Create Friction structure
2638  _friction_args = FrictionStruct(i_ch, Re, S, w_perim);
2639 
2640  Real sumhw = 0.0;
2641  for (auto i_pin : _subchannel_mesh.getChannelPins(i_ch))
2642  {
2643  // Create nusselt number structure
2644  _nusselt_args = NusseltStruct(Re, Pr, i_pin, iz, i_ch);
2645 
2646  // Compute HTC
2648  }
2649 
2650  // Set HTC
2651  _HTC_soln->set(node, sumhw / _subchannel_mesh.getChannelPins(i_ch).size());
2652  }
2653  }
2654  _HTC_soln->close();
2655 
2656  _console << "Commencing calculation of Pin surface temperature \n";
2657  for (unsigned int i_pin = 0; i_pin < _n_pins; i_pin++)
2658  {
2659  for (unsigned int iz = 0; iz < _n_cells + 1; ++iz)
2660  {
2661  const auto * pin_node = _subchannel_mesh.getPinNode(i_pin, iz);
2662  Real sumTemp = 0.0;
2663  // Calculate sum of pin surface temperatures that the channels around the pin see
2664  for (auto i_ch : _subchannel_mesh.getPinChannels(i_pin))
2665  {
2666  const auto * node = _subchannel_mesh.getChannelNode(i_ch, iz);
2667  auto mu = (*_mu_soln)(node);
2668  auto S = (*_S_flow_soln)(node);
2669  auto w_perim = (*_w_perim_soln)(node);
2670  auto Dh_i = 4.0 * S / w_perim;
2671  auto Re = (((*_mdot_soln)(node) / S) * Dh_i / mu);
2672  auto k = _fp->k_from_p_T((*_P_soln)(node) + _P_out, (*_T_soln)(node));
2673  auto cp = _fp->cp_from_p_T((*_P_soln)(node) + _P_out, (*_T_soln)(node));
2674  auto Pr = (*_mu_soln)(node)*cp / k;
2675  // Create Friction structure
2676  _friction_args = FrictionStruct(i_ch, Re, S, w_perim);
2677  // Create nusselt number structure
2678  _nusselt_args = NusseltStruct(Re, Pr, i_pin, iz, i_ch);
2679  // Compute HTC
2681  // Compute surface temperature contribution from subchannel side
2682  sumTemp +=
2683  (*_q_prime_soln)(pin_node) / ((*_Dpin_soln)(pin_node)*M_PI * hw) + (*_T_soln)(node);
2684  }
2685  if (_subchannel_mesh.getPinChannels(i_pin).size() > 0)
2686  _Tpin_soln->set(pin_node, sumTemp / _subchannel_mesh.getPinChannels(i_pin).size());
2687  else
2688  mooseError("Pin was not found for pin index: " + std::to_string(i_pin));
2689  }
2690  }
2691  }
2692 
2694  if (_duct_mesh_exist && processor_id() == 0)
2695  {
2696  _console << "Commencing calculation of duct surface temperature " << std::endl;
2697  auto duct_nodes = _subchannel_mesh.getDuctNodes();
2698  for (Node * dn : duct_nodes)
2699  {
2700  auto * node_chan = _subchannel_mesh.getChannelNodeFromDuct(dn);
2701  auto mu = (*_mu_soln)(node_chan);
2702  auto S = (*_S_flow_soln)(node_chan);
2703  auto w_perim = (*_w_perim_soln)(node_chan);
2704  auto Dh_i = 4.0 * S / w_perim;
2705  auto Re = (((*_mdot_soln)(node_chan) / S) * Dh_i / mu);
2706  auto k = _fp->k_from_p_T((*_P_soln)(node_chan) + _P_out, (*_T_soln)(node_chan));
2707  auto cp = _fp->cp_from_p_T((*_P_soln)(node_chan) + _P_out, (*_T_soln)(node_chan));
2708  auto Pr = (*_mu_soln)(node_chan)*cp / k;
2709 
2710  // Create nusselt number structure (consistent with pin case)
2711  const libMesh::Point & node_point = *_subchannel_mesh.getChannelNodeFromDuct(dn);
2712  const unsigned int iz = _subchannel_mesh.getZIndex(node_point);
2713  const unsigned int i_ch = _subchannel_mesh.channelIndex(node_point);
2714 
2715  // Create nusselt number structure
2716  _nusselt_args = NusseltStruct(Re, Pr, std::numeric_limits<unsigned int>::max(), iz, i_ch);
2717 
2718  // Create Friction structure
2719  _friction_args = FrictionStruct(i_ch, Re, S, w_perim);
2720 
2721  // Compute HTC
2723 
2724  // Compute Channel Temperature
2725  auto T_chan = (*_duct_heat_flux_soln)(dn) / hw + (*_T_soln)(node_chan);
2726  _Tduct_soln->set(dn, T_chan);
2727  }
2728  }
2729  _aux->solution().close();
2730  _aux->update();
2731 
2732  if (processor_id() != 0)
2733  return;
2734  Real power_in = 0.0;
2735  Real power_out = 0.0;
2736  Real viscosity_in = 0.0;
2737  Real mass_flow_in = 0.0;
2738  Real mass_flow_out = 0.0;
2739  for (unsigned int i_ch = 0; i_ch < _n_channels; i_ch++)
2740  {
2741  auto * node_in = _subchannel_mesh.getChannelNode(i_ch, 0);
2742  auto * node_out = _subchannel_mesh.getChannelNode(i_ch, _n_cells);
2743  const Real mdot_in = (*_mdot_soln)(node_in);
2744  power_in += mdot_in * (*_h_soln)(node_in);
2745  power_out += (*_mdot_soln)(node_out) * (*_h_soln)(node_out);
2746  viscosity_in += mdot_in * (*_mu_soln)(node_in);
2747  mass_flow_in += mdot_in;
2748  mass_flow_out += (*_mdot_soln)(node_out);
2749  }
2750  auto h_bulk_out = power_out / mass_flow_out;
2751  auto T_bulk_out = _fp->T_from_p_h(_P_out, h_bulk_out);
2752 
2754  Real inlet_mu = viscosity_in / mass_flow_in;
2755  Real bulk_Re = mass_flow_in * bulk_Dh / (inlet_mu * _subchannel_mesh.getAssemblyFlowArea());
2756  if (_verbose_subchannel)
2757  {
2758  _console << " ======================================= " << std::endl;
2759  _console << " ======== Subchannel Print Outs ======== " << std::endl;
2760  _console << " ======================================= " << std::endl;
2761  _console << "Total flow area :" << _subchannel_mesh.getAssemblyFlowArea() << " m^2"
2762  << std::endl;
2763  _console << "Assembly hydraulic diameter :" << bulk_Dh << " m" << std::endl;
2764  _console << "Assembly Re number :" << bulk_Re << " [-]" << std::endl;
2765  _console << "Bulk coolant temperature at outlet :" << T_bulk_out << " K" << std::endl;
2766  _console << "Power added to coolant is : " << power_out - power_in << " Watt" << std::endl;
2767  _console << "Mass flow rate in is : " << mass_flow_in << " kg/sec" << std::endl;
2768  _console << "Mass balance is : " << mass_flow_out - mass_flow_in << " kg/sec" << std::endl;
2769  _console << "User defined outlet pressure is : " << _P_out << " Pa" << std::endl;
2770  _console << " ======================================= " << std::endl;
2771  }
2772 
2773  if (MooseUtils::absoluteFuzzyLessEqual((power_out - power_in), -1.0))
2774  mooseWarning(
2775  "Energy conservation equation might not be solved correctly, Power added to coolant: " +
2776  std::to_string(power_out - power_in) + " Watt ");
2777 }
const bool _pin_mesh_exist
Flag that informs if there is a pin mesh or not.
void computeRho(int iblock)
Computes Density per channel for block iblock.
std::unique_ptr< SolutionHandle > _Tduct_soln
unsigned int _n_blocks
number of axial blocks
const bool _compute_power
Flag that informs if we need to solve the Enthalpy/Temperature equations or not.
std::unique_ptr< SolutionHandle > _T_soln
std::unique_ptr< SolutionHandle > _h_soln
virtual const std::vector< unsigned int > & getPinChannels(unsigned int i_pin) const =0
Return a vector of channel indices for a given Pin index.
Real _TR
Flag that activates or deactivates the transient parts of the equations we solve by multiplication...
libMesh::DenseMatrix< Real > _Wij_old
const PostprocessorValue & _P_out
Outlet pressure postprocessor value.
void computeT(int iblock)
Computes Temperature per channel for block iblock.
virtual const std::vector< unsigned int > & getChannelPins(unsigned int i_chan) const =0
Return a vector of pin indices for a given channel index.
const SCMHTCClosureBase * _pin_HTC_closure
HTC closure objects.
const bool _compute_density
Flag that activates or deactivates the calculation of density.
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.
const Parallel::Communicator & comm() const
const bool _duct_mesh_exist
Flag that informs if there is a duct mesh or not.
const Real & _T_tol
Convergence tolerance for the temperature loop in internal solve.
void computeMu(int iblock)
Computes Viscosity per channel for block iblock.
Real getAssemblyHydraulicDiameter() const
Return undeformed bundle-average hydraulic diameter.
const bool _segregated_bool
Segregated solve.
bool _converged
Variable that informs whether we exited external solve with a converged solution or not...
virtual void initializeSolution()=0
Function to initialize the solution & geometry fields.
const SCMHTCClosureBase * _duct_HTC_closure
virtual void computeh(int iblock)=0
Computes Enthalpy per channel for block iblock.
static const std::string cp
Definition: NS.h:125
std::unique_ptr< SolutionHandle > _HTC_soln
const int & _T_maxit
Maximum iterations for the inner temperature loop.
const std::vector< Node * > & getDuctNodes() const
Function that returns the vector with the duct nodes.
static const std::string S
Definition: NS.h:167
Node * getChannelNodeFromDuct(Node *duct_node) const
Function that gets the channel node from the duct node.
std::shared_ptr< AuxiliarySystem > _aux
const double Re
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.
std::unique_ptr< SolutionHandle > _Dpin_soln
Real getAssemblyFlowArea() const
Return undeformed bundle inlet flow area.
virtual unsigned int channelIndex(const Point &point) const =0
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const bool _compute_viscosity
Flag that activates or deactivates the calculation of viscosity.
libMesh::DenseMatrix< Real > & _Wij
void max(const T &r, T &o, Request &req) const
void computeWijPrime(int iblock)
Computes turbulent crossflow per gap for block iblock.
std::unique_ptr< SolutionHandle > _SumWij_soln
void mooseWarning(Args &&... args) const
const bool _verbose_subchannel
Boolean to printout information related to subchannel solve.
void mooseError(Args &&... args) const
const Real & _P_tol
Convergence tolerance for the pressure loop in external solve.
struct SubChannel1PhaseProblem::FrictionStruct _friction_args
void computeWijFromSolve(int iblock)
Computes diversion crossflow per gap for block iblock.
const ConsoleStream _console
virtual bool isTransient() const override
PetscErrorCode implicitPetscSolve(int iblock)
Computes implicit solve using PetSc.
processor_id_type processor_id() const
const double mu
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.
virtual Real & dt() const
std::unique_ptr< SolutionHandle > _P_soln
virtual unsigned int getZIndex(const Point &point) const
Get axial index of point.
static const std::string k
Definition: NS.h:134
struct SubChannel1PhaseProblem::NusseltStruct _nusselt_args
const SinglePhaseFluidProperties * _fp
Non-owning pointer to fluid properties user object.
std::unique_ptr< SolutionHandle > _Tpin_soln

◆ getAddedHeatDuct()

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

Return the added heat coming from the duct.

Definition at line 86 of file SubChannel1PhaseProblem.h.

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

◆ getAddedHeatPin()

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

Return the added heat coming from the fuel pins.

Definition at line 80 of file SubChannel1PhaseProblem.h.

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

◆ getDuctHTCClosure()

const SCMHTCClosureBase* SubChannel1PhaseProblem::getDuctHTCClosure ( ) const
inlineinherited

◆ getFrictionClosure()

const SCMFrictionClosureBase* SubChannel1PhaseProblem::getFrictionClosure ( ) const
inlineinherited

Definition at line 46 of file SubChannel1PhaseProblem.h.

Referenced by SCMMixingKimAndChung::computeLatticeMixingParameter(), and SCMHTCGnielinski::computeNusseltNumber().

46 { return _friction_closure; }
const SCMFrictionClosureBase * _friction_closure
Friction closure object.

◆ getOutletPressure()

const PostprocessorValue& SubChannel1PhaseProblem::getOutletPressure ( ) const
inlineinherited

Get outlet pressure.

Definition at line 95 of file SubChannel1PhaseProblem.h.

Referenced by SCMMixingKimAndChung::computeLatticeMixingParameter().

95 { return _P_out; }
const PostprocessorValue & _P_out
Outlet pressure postprocessor value.

◆ getPinHTCClosure()

const SCMHTCClosureBase* SubChannel1PhaseProblem::getPinHTCClosure ( ) const
inlineinherited

Definition at line 45 of file SubChannel1PhaseProblem.h.

45 { return _pin_HTC_closure; } // optional
const SCMHTCClosureBase * _pin_HTC_closure
HTC closure objects.

◆ getSinglePhaseFluidProperties()

const SinglePhaseFluidProperties* SubChannel1PhaseProblem::getSinglePhaseFluidProperties ( ) const
inlineinherited

Get fluid properties object.

Definition at line 101 of file SubChannel1PhaseProblem.h.

Referenced by SCMMixingKimAndChung::computeLatticeMixingParameter().

101 { return _fp; }
const SinglePhaseFluidProperties * _fp
Non-owning pointer to fluid properties user object.

◆ getSubChannelPeripheralDuctWidth()

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

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

Implements SubChannel1PhaseProblem.

Definition at line 234 of file QuadSubChannel1PhaseProblem.C.

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

◆ implicitPetscSolve()

PetscErrorCode SubChannel1PhaseProblem::implicitPetscSolve ( int  iblock)
protectedinherited

Computes implicit solve using PetSc.

Definition at line 2083 of file SubChannel1PhaseProblem.C.

Referenced by SubChannel1PhaseProblem::externalSolve().

2084 {
2086  // ---------- helper functions -----------------------------
2087  auto V = [&](const std::string & s)
2088  {
2089  if (_verbose_subchannel)
2090  _console << s << std::endl;
2091  };
2092 
2093  auto DupMatAssembled = [&](Mat src, Mat * dst)
2094  {
2095  if (src)
2096  {
2097  LibmeshPetscCall(MatDuplicate(src, MAT_COPY_VALUES, dst));
2098  LibmeshPetscCall(MatAssemblyBegin(*dst, MAT_FINAL_ASSEMBLY));
2099  LibmeshPetscCall(MatAssemblyEnd(*dst, MAT_FINAL_ASSEMBLY));
2100  }
2101  else
2102  *dst = NULL;
2103  };
2104 
2105  auto DupVecCopy = [&](Vec src, Vec * dst)
2106  {
2107  LibmeshPetscCall(VecDuplicate(src, dst));
2108  LibmeshPetscCall(VecCopy(src, *dst));
2109  };
2110 
2111  const PetscInt Q = 3; // [mass conservation, axial momentum, cross momentum]
2112 
2113  // small indexer
2114  auto Idx = [&](PetscInt r, PetscInt c) { return Q * r + c; };
2115 
2116  // arrays that MUST be declared before lambdas use them
2117  std::vector<Mat> mat_array(Q * Q, NULL);
2118  std::vector<Vec> vec_array(Q, NULL);
2119 
2120  // generic assembler for one governing equation row in the nested matrix
2121  auto AssembleEquation = [&](PetscInt f,
2122  Mat A0,
2123  Mat A1,
2124  Mat A2, // three blocks in row f (can be nullptr)
2125  Vec rhs, // base RHS for equation f
2126  Vec rhs_add, // optional extra RHS to add (can be nullptr)
2127  const char * label) // e.g. "Mass", "Lin mom", "Cross mom"
2128  {
2129  DupMatAssembled(A0, &mat_array[Idx(f, 0)]);
2130  DupMatAssembled(A1, &mat_array[Idx(f, 1)]);
2131  DupMatAssembled(A2, &mat_array[Idx(f, 2)]);
2132  DupVecCopy(rhs, &vec_array[f]);
2133  if (rhs_add)
2134  LibmeshPetscCall(VecAXPY(vec_array[f], 1.0, rhs_add));
2135  V(std::string(label) + " system assembled");
2136  };
2137 
2138  // -----------------------------------------------------------------------------
2139  // Helper lambda that applies per-equation under-relaxation by modifying BOTH the
2140  // matrix block and the RHS for that equation.
2141  //
2142  // Specifically, with A_ff for the equation and D = diag(A_ff):
2143  // 1) Matrix diagonal scaling: D <- D / alpha, then A_ff's diagonal is replaced
2144  // with D. For alpha < 1 this increases diagonal dominance (more damping).
2145  // 2) RHS blending with the previous solution x_old:
2146  // rhs_f <- rhs_f + (1 - alpha) * (D / alpha) * x_old
2147  // where x_old is provided by the caller via `populate(work)`.
2148  //
2149  // Net effect: the solved x satisfies
2150  // A_ff x = rhs_f_original + ((1 - alpha)/alpha) * D * (x_old - x),
2151  // which damps updates toward x_old without changing the converged solution.
2152  // -----------------------------------------------------------------------------
2153  auto RelaxEquation =
2154  [&](Mat A_ff, Vec rhs_f, Vec like_vec, Vec work, PetscScalar alpha, auto && populate)
2155  {
2156  Vec d = nullptr;
2157  LibmeshPetscCall(VecDuplicate(like_vec, &d));
2158 
2159  // 1) A_ff: diag <- diag / alpha
2160  LibmeshPetscCall(MatGetDiagonal(A_ff, d));
2161  LibmeshPetscCall(VecScale(d, 1.0 / alpha));
2162  LibmeshPetscCall(MatDiagonalSet(A_ff, d, INSERT_VALUES));
2163 
2164  // 2) work <- x_old (caller-provided populator)
2165  LibmeshPetscCall(populate(work));
2166 
2167  // 3) rhs_f += (1 - alpha) * (diag .* work)
2168  LibmeshPetscCall(VecScale(d, (1.0 - alpha)));
2169  LibmeshPetscCall(VecPointwiseMult(work, work, d));
2170  LibmeshPetscCall(VecAXPY(rhs_f, 1.0, work));
2171 
2172  LibmeshPetscCall(VecDestroy(&d));
2173  };
2174 
2175  // indices
2176  const unsigned int first_node = iblock * _block_size + 1;
2177  const unsigned int last_node = (iblock + 1) * _block_size;
2178 
2179  // ---------- assemble per-block operators -----------------
2180  computeSumWij(iblock);
2181  computeMdot(iblock);
2182  computeWijPrime(iblock);
2183  computeDP(iblock);
2184  computeP(iblock);
2185  computeWijResidual(iblock);
2186 
2187  V("Starting nested system.");
2188 
2189  // Populate nested matrix with the individual physics
2190  // equation 0: Mass conservation
2191  AssembleEquation(/*f=*/0,
2192  /*A0=*/_mc_axial_convection_mat,
2193  /*A1=*/nullptr,
2194  /*A2=*/_mc_sumWij_mat,
2195  /*rhs=*/_mc_axial_convection_rhs,
2196  /*rhs_add=*/nullptr,
2197  /*label=*/"Mass");
2198 
2199  // equation 1: Axial momentum conservation
2200  AssembleEquation(/*f=*/1,
2201  /*A0=*/_amc_sys_mdot_mat,
2202  /*A1=*/_amc_pressure_force_mat,
2203  /*A2=*/nullptr,
2204  /*rhs=*/_amc_pressure_force_rhs,
2205  /*rhs_add=*/_amc_sys_mdot_rhs,
2206  /*label=*/"Lin mom");
2207 
2208  // equation 2: Cross momentum conservation
2209  AssembleEquation(/*f=*/2,
2210  /*A0=*/nullptr,
2211  /*A1=*/_cmc_pressure_force_mat,
2212  /*A2=*/_cmc_sys_Wij_mat,
2213  /*rhs=*/_cmc_sys_Wij_rhs,
2214  /*rhs_add=*/_cmc_pressure_force_rhs,
2215  /*label=*/"Cross mom");
2216 
2217  // ========================== Relaxation ====================
2218  if (true)
2219  {
2220  LibmeshPetscCall(populateVectorFromHandle<SolutionHandle>(
2221  _prod, *_mdot_soln, first_node, last_node, _n_channels));
2222 
2223  Vec mdot_estimate;
2224  LibmeshPetscCall(createPetscVector(mdot_estimate, _block_size * _n_channels));
2225  Vec pmat_diag;
2226  LibmeshPetscCall(createPetscVector(pmat_diag, _block_size * _n_channels));
2227  Vec p_estimate;
2228  LibmeshPetscCall(createPetscVector(p_estimate, _block_size * _n_channels));
2229  Vec unity_vec;
2230  LibmeshPetscCall(createPetscVector(unity_vec, _block_size * _n_channels));
2231  LibmeshPetscCall(VecSet(unity_vec, 1.0));
2232  Vec sol_holder_P;
2233  LibmeshPetscCall(createPetscVector(sol_holder_P, _block_size * _n_gaps));
2234  Vec unity_vec_Wij;
2235  LibmeshPetscCall(createPetscVector(unity_vec_Wij, _block_size * _n_gaps));
2236  LibmeshPetscCall(VecSet(unity_vec_Wij, 1.0));
2237  Vec _Wij_loc_vec;
2238  LibmeshPetscCall(createPetscVector(_Wij_loc_vec, _block_size * _n_gaps));
2239  Vec _Wij_old_loc_vec;
2240  LibmeshPetscCall(createPetscVector(_Wij_old_loc_vec, _block_size * _n_gaps));
2241 
2242  // ---- scale estimates ----
2243  // mdot_estimate = A(1,0) * mdot
2244  LibmeshPetscCall(MatMult(mat_array[Q /* (1,0) */], _prod, mdot_estimate));
2245 
2246  // p_estimate = mdot_est / (diag(A(1,1)) + eps)
2247  LibmeshPetscCall(MatGetDiagonal(mat_array[Q + 1], pmat_diag));
2248  LibmeshPetscCall(VecAXPY(pmat_diag, 1e-10, unity_vec));
2249  LibmeshPetscCall(VecPointwiseDivide(p_estimate, mdot_estimate, pmat_diag));
2250 
2251  // sol_holder_P = A(2,1) * p_estimate - rhs_cmc_pressure
2252  LibmeshPetscCall(MatMult(mat_array[2 * Q + 1], p_estimate, sol_holder_P));
2253  LibmeshPetscCall(VecAXPY(sol_holder_P, -1.0, _cmc_pressure_force_rhs));
2254 
2255  // sumWij_loc from sol_holder_P (accumulate)
2256  Vec sumWij_loc;
2257  LibmeshPetscCall(createPetscVector(sumWij_loc, _block_size * _n_channels));
2258  for (unsigned int iz = first_node; iz <= last_node; ++iz)
2259  {
2260  const auto iz_ind = iz - first_node;
2261  for (unsigned int i_ch = 0; i_ch < _n_channels; ++i_ch)
2262  {
2263  PetscScalar sumWij = 0.0;
2264  unsigned int counter = 0;
2265  for (auto i_gap : _subchannel_mesh.getChannelGaps(i_ch))
2266  {
2267  auto chans = _subchannel_mesh.getGapChannels(i_gap);
2268  unsigned int i_ch_loc = chans.first;
2269  PetscInt row_vec = i_ch_loc + _n_channels * iz_ind;
2270  PetscScalar loc_Wij_value;
2271  LibmeshPetscCall(VecGetValues(sol_holder_P, 1, &row_vec, &loc_Wij_value));
2272  sumWij += _subchannel_mesh.getCrossflowSign(i_ch, counter) * loc_Wij_value;
2273  counter++;
2274  }
2275  PetscInt row_vec = i_ch + _n_channels * iz_ind;
2276  LibmeshPetscCall(VecSetValues(sumWij_loc, 1, &row_vec, &sumWij, INSERT_VALUES));
2277  }
2278  }
2279  LibmeshPetscCall(VecAssemblyBegin(sumWij_loc));
2280  LibmeshPetscCall(VecAssemblyEnd(sumWij_loc));
2281 
2282  // ---- robust scale measurements ----
2283  PetscScalar min_mdot;
2284  LibmeshPetscCall(VecAbs(_prod));
2285  LibmeshPetscCall(VecMin(_prod, NULL, &min_mdot));
2286  V("Minimum estimated mdot: " + std::to_string(min_mdot));
2287 
2288  LibmeshPetscCall(VecAbs(sumWij_loc));
2289  LibmeshPetscCall(VecMax(sumWij_loc, NULL, &_max_sumWij));
2290  _max_sumWij = std::max(1e-10, _max_sumWij);
2291  V("Maximum estimated Wij: " + std::to_string(_max_sumWij));
2292 
2294  _Wij_loc_vec, _Wij, first_node, last_node, _n_gaps));
2295  LibmeshPetscCall(VecAbs(_Wij_loc_vec));
2297  _Wij_old_loc_vec, _Wij_old, first_node, last_node, _n_gaps));
2298  LibmeshPetscCall(VecAbs(_Wij_old_loc_vec));
2299  LibmeshPetscCall(VecAXPY(_Wij_loc_vec, -1.0, _Wij_old_loc_vec));
2300 
2301  PetscScalar relax_factor;
2302  LibmeshPetscCall(VecAbs(_Wij_loc_vec));
2303 #if !PETSC_VERSION_LESS_THAN(3, 16, 0)
2304  LibmeshPetscCall(VecMean(_Wij_loc_vec, &relax_factor));
2305 #else
2306  VecSum(_Wij_loc_vec, &relax_factor);
2307  relax_factor /= _block_size * _n_gaps;
2308 #endif
2309  relax_factor = relax_factor / _max_sumWij + 0.5;
2310  V("Relax base value: " + std::to_string(relax_factor));
2311 
2312  // ---- crossflow resistance inflation ----
2313  const PetscScalar resistance_relaxation = 0.9;
2314  _added_K = _max_sumWij / min_mdot;
2315  V("New cross resistance: " + std::to_string(_added_K));
2316  _added_K = (_added_K * resistance_relaxation + (1.0 - resistance_relaxation) * _added_K_old) *
2317  relax_factor;
2318  V("Relaxed cross resistance: " + std::to_string(_added_K));
2319 
2320  // Snap-up lower-bounding
2321  if (_added_K < 10 && _added_K >= 1.0)
2322  _added_K = 1.0;
2323  if (_added_K < 1.0 && _added_K >= 0.1)
2324  _added_K = 0.5;
2325  if (_added_K < 0.1 && _added_K >= 0.01)
2326  _added_K = 1. / 3.;
2327  if (_added_K < 1e-2 && _added_K >= 1e-3)
2328  _added_K = 0.1;
2329  V("Actual added cross resistance: " + std::to_string(_added_K));
2330  LibmeshPetscCall(VecScale(unity_vec_Wij, _added_K));
2332 
2333  LibmeshPetscCall(MatDiagonalSet(mat_array[2 * Q + 2], unity_vec_Wij, ADD_VALUES));
2334 
2335  // ---- cleanup temp vectors used above ----
2336  LibmeshPetscCall(VecDestroy(&mdot_estimate));
2337  LibmeshPetscCall(VecDestroy(&pmat_diag));
2338  LibmeshPetscCall(VecDestroy(&unity_vec));
2339  LibmeshPetscCall(VecDestroy(&p_estimate));
2340  LibmeshPetscCall(VecDestroy(&sol_holder_P));
2341  LibmeshPetscCall(VecDestroy(&unity_vec_Wij));
2342  LibmeshPetscCall(VecDestroy(&sumWij_loc));
2343  LibmeshPetscCall(VecDestroy(&_Wij_loc_vec));
2344  LibmeshPetscCall(VecDestroy(&_Wij_old_loc_vec));
2345 
2346  // ---- per-equation under-relaxation ----
2347  const PetscScalar relaxation_factor_mdot = 1.0;
2348  const PetscScalar relaxation_factor_P = 1.0;
2349  const PetscScalar relaxation_factor_Wij = 0.1;
2350 
2351  V("Relax mdot: " + std::to_string(relaxation_factor_mdot));
2352  V("Relax P: " + std::to_string(relaxation_factor_P));
2353  V("Relax Wij: " + std::to_string(relaxation_factor_Wij));
2354 
2355  // mdot
2356  RelaxEquation(mat_array[Idx(0, 0)],
2357  vec_array[0],
2358  vec_array[0],
2359  _prod,
2360  relaxation_factor_mdot,
2361  [&](Vec dst)
2362  {
2363  return populateVectorFromHandle<SolutionHandle>(
2364  dst, *_mdot_soln, first_node, last_node, _n_channels);
2365  });
2366  V("mdot relaxed");
2367 
2368  // pressure
2369  RelaxEquation(mat_array[Idx(1, 1)],
2370  vec_array[1],
2371  vec_array[1],
2372  _prod,
2373  relaxation_factor_P,
2374  [&](Vec dst)
2375  {
2376  return populateVectorFromHandle<SolutionHandle>(
2377  dst, *_P_soln, first_node, last_node, _n_channels);
2378  });
2379  V("P relaxed");
2380 
2381  // crossflow
2382  RelaxEquation(mat_array[Idx(2, 2)],
2383  vec_array[2],
2384  vec_array[2],
2385  _Wij_vec,
2386  relaxation_factor_Wij,
2387  [&](Vec dst)
2388  {
2389  return populateVectorFromDense<libMesh::DenseMatrix<Real>>(
2390  dst, _Wij, first_node, last_node, _n_gaps);
2391  });
2392  V("Wij relaxed");
2393  }
2394  V("Linear solver relaxed");
2395 
2396  // ======================== Create and configure KSP =========================
2397  Mat A_nest;
2398  Vec b_nest;
2399  Vec x_nest;
2400  LibmeshPetscCall(MatCreateNest(PETSC_COMM_SELF, Q, NULL, Q, NULL, mat_array.data(), &A_nest));
2401  LibmeshPetscCall(VecCreateNest(PETSC_COMM_SELF, Q, NULL, vec_array.data(), &b_nest));
2402  V("Nested system created");
2403 
2404  KSP ksp;
2405  PC pc;
2406  LibmeshPetscCall(KSPCreate(PETSC_COMM_SELF, &ksp));
2407  LibmeshPetscCall(KSPSetType(ksp, KSPFGMRES));
2408  LibmeshPetscCall(KSPSetOperators(ksp, A_nest, A_nest));
2409  LibmeshPetscCall(KSPGetPC(ksp, &pc));
2410  LibmeshPetscCall(PCSetType(pc, PCFIELDSPLIT));
2411  LibmeshPetscCall(KSPSetTolerances(ksp, _rtol, _atol, _dtol, _maxit));
2412 
2413  // split equations
2414  std::vector<IS> rows(Q);
2415  LibmeshPetscCall(MatNestGetISs(A_nest, rows.data(), NULL));
2416  for (PetscInt j = 0; j < Q; ++j)
2417  {
2418  IS part;
2419  LibmeshPetscCall(ISDuplicate(rows[j], &part));
2420  LibmeshPetscCall(PCFieldSplitSetIS(pc, NULL, part));
2421  LibmeshPetscCall(ISDestroy(&part));
2422  }
2423  V("Linear solver assembled");
2424 
2425  // ============================== Solve =====================================
2426  LibmeshPetscCall(VecDuplicate(b_nest, &x_nest));
2427  LibmeshPetscCall(VecSet(x_nest, 0.0));
2428  LibmeshPetscCall(KSPSolve(ksp, b_nest, x_nest));
2429 
2430  // destroy solver containers first
2431  LibmeshPetscCall(VecDestroy(&b_nest));
2432  LibmeshPetscCall(MatDestroy(&A_nest));
2433  LibmeshPetscCall(KSPDestroy(&ksp));
2434  for (PetscInt i = 0; i < Q * Q; i++)
2435  LibmeshPetscCall(MatDestroy(&mat_array[i]));
2436  for (PetscInt i = 0; i < Q; i++)
2437  LibmeshPetscCall(VecDestroy(&vec_array[i]));
2438  V("Solver elements destroyed");
2439 
2440  // ====================== Extract & scatter the solution =====================
2441  Vec sol_mdot, sol_p, sol_Wij;
2442  V("Vectors to hold solution created");
2443  PetscInt num_vecs;
2444  Vec * loc_vecs;
2445  LibmeshPetscCall(VecNestGetSubVecs(x_nest, &num_vecs, &loc_vecs));
2446  LibmeshPetscCall(VecDuplicate(_mc_axial_convection_rhs, &sol_mdot));
2447  LibmeshPetscCall(VecCopy(loc_vecs[0], sol_mdot));
2448  LibmeshPetscCall(VecDuplicate(_amc_sys_mdot_rhs, &sol_p));
2449  LibmeshPetscCall(VecCopy(loc_vecs[1], sol_p));
2450  LibmeshPetscCall(VecDuplicate(_cmc_sys_Wij_rhs, &sol_Wij));
2451  LibmeshPetscCall(VecCopy(loc_vecs[2], sol_Wij));
2452  V("Solution from coupled solver copied to solution vectors");
2453 
2454  // mass flow
2455  LibmeshPetscCall(populateSolutionChan<SolutionHandle>(
2456  sol_mdot, *_mdot_soln, first_node, last_node, _n_channels));
2457 
2458  // pressure
2459  {
2460  PetscScalar * sol_p_array;
2461  LibmeshPetscCall(VecGetArray(sol_p, &sol_p_array));
2462  for (unsigned int iz = last_node; iz > first_node - 1; iz--)
2463  {
2464  const auto iz_ind = iz - first_node;
2465  for (unsigned int i_ch = 0; i_ch < _n_channels; i_ch++)
2466  {
2467  auto * node_in = _subchannel_mesh.getChannelNode(i_ch, iz - 1);
2468  PetscScalar value = sol_p_array[iz_ind * _n_channels + i_ch];
2469  _P_soln->set(node_in, value);
2470  }
2471  }
2472  LibmeshPetscCall(VecRestoreArray(sol_p, &sol_p_array));
2473  }
2474 
2475  // crossflow dense + sumWij + correction factor
2477  sol_Wij, _Wij, first_node, last_node, _n_gaps));
2478 
2479  LibmeshPetscCall(MatMult(_mc_sumWij_mat, sol_Wij, _prod));
2480  LibmeshPetscCall(populateSolutionChan<SolutionHandle>(
2481  _prod, *_SumWij_soln, first_node, last_node, _n_channels));
2482 
2483  LibmeshPetscCall(VecAbs(_prod));
2484  LibmeshPetscCall(VecMax(_prod, NULL, &_max_sumWij_new));
2485  V("Maximum estimated Wij new: " + std::to_string(_max_sumWij_new));
2487  V("Correction factor: " + std::to_string(_correction_factor));
2488  V("Solutions assigned to MOOSE variables.");
2489 
2490  // cleanup solution objects
2491  LibmeshPetscCall(VecDestroy(&x_nest));
2492  LibmeshPetscCall(VecDestroy(&sol_mdot));
2493  LibmeshPetscCall(VecDestroy(&sol_p));
2494  LibmeshPetscCall(VecDestroy(&sol_Wij));
2495  V("Solutions destroyed.");
2496 
2497  PetscFunctionReturn(LIBMESH_PETSC_SUCCESS);
2498 }
Mat _amc_sys_mdot_mat
Axial momentum system matrix.
void computeSumWij(int iblock)
Computes net diversion crossflow per channel for block iblock.
const PetscReal & _dtol
The divergence tolerance for the ksp linear solver.
void computeP(int iblock)
Computes Pressure per channel for block iblock.
libMesh::DenseMatrix< Real > _Wij_old
void computeMdot(int iblock)
Computes mass flow per channel for block iblock.
PetscScalar _added_K
Added resistances for monolithic convergence.
PetscErrorCode createPetscVector(Vec &v, PetscInt n)
Petsc Functions.
PetscFunctionBegin
Mat _cmc_sys_Wij_mat
Lateral momentum system matrix.
virtual const std::vector< unsigned int > & getChannelGaps(unsigned int i_chan) const =0
Return a vector of gap indices for a given channel index.
Mat _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)
Mat _amc_pressure_force_mat
Axial momentum conservation - pressure force.
Real value(unsigned n, unsigned alpha, unsigned beta, Real x)
void computeWijResidual(int iblock)
Computes Residual Matrix based on the lateral momentum conservation equation for block iblock...
Real f(Real x)
Test function for Brents method.
const PetscReal & _atol
The absolute convergence tolerance for the ksp linear solver.
Mat _mc_axial_convection_mat
Mass conservation - axial convection.
const PetscInt & _maxit
The maximum number of iterations to use for the ksp linear solver.
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.
std::unique_ptr< SolutionHandle > _mdot_soln
Solutions handles and link to TH tables properties.
PetscErrorCode populateDenseFromVector(const Vec &x, T &solution, const unsigned int first_axial_level, const unsigned int last_axial_level, const unsigned int cross_dimension)
const PetscReal & _rtol
The relative convergence tolerance, (relative decrease) for the ksp linear solver.
libMesh::DenseMatrix< Real > & _Wij
void computeWijPrime(int iblock)
Computes turbulent crossflow per gap for block iblock.
static const std::string alpha
Definition: NS.h:138
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.
std::unique_ptr< SolutionHandle > _SumWij_soln
const bool _verbose_subchannel
Boolean to printout information related to subchannel solve.
static const std::complex< double > j(0, 1)
Complex number "j" (also known as "i")
const ConsoleStream _console
void computeDP(int iblock)
Computes Pressure Drop per channel for block iblock.
PetscFunctionReturn(LIBMESH_PETSC_SUCCESS)
Mat _cmc_pressure_force_mat
Cross momentum conservation - pressure force.
std::unique_ptr< SolutionHandle > _P_soln
virtual const std::pair< unsigned int, unsigned int > & getGapChannels(unsigned int i_gap) const =0
Return a pair of subchannel indices for a given gap index.

◆ initializeSolution()

void QuadSubChannel1PhaseProblem::initializeSolution ( )
overrideprotectedvirtual

Function to initialize the solution & geometry fields.

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

Calculate subchannel area

Correct subchannel area and wetted perimeter in case of overlapping pins

Apply area reduction on subchannels affected by blockage

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

Implements SubChannel1PhaseProblem.

Definition at line 32 of file QuadSubChannel1PhaseProblem.C.

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

◆ initialSetup()

void SubChannel1PhaseProblem::initialSetup ( )
overridevirtualinherited

Set value for turbulent momentum modeling parameter CT

Reimplemented from ExternalProblem.

Definition at line 272 of file SubChannel1PhaseProblem.C.

273 {
275 
276  _fp = &getUserObject<SinglePhaseFluidProperties>(getParam<UserObjectName>("fp"));
278  &getUserObject<SCMFrictionClosureBase>(getParam<UserObjectName>("friction_closure"));
280  &getUserObject<SCMMixingClosureBase>(getParam<UserObjectName>("mixing_closure"));
281 
284 
285  // Create variables for output and storage
286  _mdot_soln = std::make_unique<SolutionHandle>(getVariable(0, SubChannelApp::MASS_FLOW_RATE));
287  _SumWij_soln = std::make_unique<SolutionHandle>(getVariable(0, SubChannelApp::SUM_CROSSFLOW));
288  _P_soln = std::make_unique<SolutionHandle>(getVariable(0, SubChannelApp::PRESSURE));
289  if (getParam<bool>("full_output"))
290  {
291  _DP_soln = std::make_unique<SolutionHandle>(getVariable(0, SubChannelApp::PRESSURE_DROP));
292  _ff_soln = std::make_unique<SolutionHandle>(getVariable(0, SubChannelApp::FRICTION_FACTOR));
293  }
294  _h_soln = std::make_unique<SolutionHandle>(getVariable(0, SubChannelApp::ENTHALPY));
295  _T_soln = std::make_unique<SolutionHandle>(getVariable(0, SubChannelApp::TEMPERATURE));
296  if (_pin_mesh_exist)
297  {
298  _Tpin_soln = std::make_unique<SolutionHandle>(getVariable(0, SubChannelApp::PIN_TEMPERATURE));
299  _Dpin_soln = std::make_unique<SolutionHandle>(getVariable(0, SubChannelApp::PIN_DIAMETER));
300  _HTC_soln =
301  std::make_unique<SolutionHandle>(getVariable(0, SubChannelApp::HEAT_TRANSFER_COEFFICIENT));
303  &getUserObject<SCMHTCClosureBase>(getParam<UserObjectName>("pin_HTC_closure"));
304  }
305  _rho_soln = std::make_unique<SolutionHandle>(getVariable(0, SubChannelApp::DENSITY));
306  _mu_soln = std::make_unique<SolutionHandle>(getVariable(0, SubChannelApp::VISCOSITY));
307  _S_flow_soln = std::make_unique<SolutionHandle>(getVariable(0, SubChannelApp::SURFACE_AREA));
308  _w_perim_soln = std::make_unique<SolutionHandle>(getVariable(0, SubChannelApp::WETTED_PERIMETER));
309  _q_prime_soln = std::make_unique<SolutionHandle>(getVariable(0, SubChannelApp::LINEAR_HEAT_RATE));
311  std::make_unique<SolutionHandle>(getVariable(0, SubChannelApp::DISPLACEMENT));
312  if (_duct_mesh_exist)
313  {
315  std::make_unique<SolutionHandle>(getVariable(0, SubChannelApp::DUCT_HEAT_FLUX));
316  _Tduct_soln = std::make_unique<SolutionHandle>(getVariable(0, SubChannelApp::DUCT_TEMPERATURE));
318  &getUserObject<SCMHTCClosureBase>(getParam<UserObjectName>("duct_HTC_closure"));
319  }
320 }
static const std::string PRESSURE_DROP
Definition: SubChannelApp.h:32
static const std::string FRICTION_FACTOR
Definition: SubChannelApp.h:44
static const std::string MASS_FLOW_RATE
Definition: SubChannelApp.h:28
const bool _pin_mesh_exist
Flag that informs if there is a pin mesh or not.
std::unique_ptr< SolutionHandle > _Tduct_soln
std::unique_ptr< SolutionHandle > _duct_heat_flux_soln
static const std::string DENSITY
Definition: SubChannelApp.h:37
std::unique_ptr< SolutionHandle > _T_soln
std::unique_ptr< SolutionHandle > _h_soln
std::unique_ptr< SolutionHandle > _S_flow_soln
const SCMHTCClosureBase * _pin_HTC_closure
HTC closure objects.
static const std::string PIN_DIAMETER
Definition: SubChannelApp.h:36
const SCMMixingClosureBase * _mixing_closure
Turbulent Mixing closure object.
const bool _duct_mesh_exist
Flag that informs if there is a duct mesh or not.
virtual const MooseVariableFieldBase & getVariable(const THREAD_ID tid, const std::string &var_name, Moose::VarKindType expected_var_type=Moose::VarKindType::VAR_ANY, Moose::VarFieldType expected_var_field_type=Moose::VarFieldType::VAR_FIELD_ANY) const override
static const std::string DUCT_HEAT_FLUX
Definition: SubChannelApp.h:41
static const std::string DUCT_TEMPERATURE
Definition: SubChannelApp.h:42
const SCMHTCClosureBase * _duct_HTC_closure
static const std::string WETTED_PERIMETER
Definition: SubChannelApp.h:39
std::unique_ptr< SolutionHandle > _rho_soln
static const std::string VISCOSITY
Definition: SubChannelApp.h:38
std::unique_ptr< SolutionHandle > _HTC_soln
static const std::string PIN_TEMPERATURE
Definition: SubChannelApp.h:35
static const std::string LINEAR_HEAT_RATE
Definition: SubChannelApp.h:40
std::unique_ptr< SolutionHandle > _q_prime_soln
static const std::string ENTHALPY
Definition: SubChannelApp.h:33
void initialSetup() override
virtual Real getCT() const
Return the Turbulent modeling parameter.
const SCMFrictionClosureBase * _friction_closure
Friction closure object.
std::unique_ptr< SolutionHandle > _Dpin_soln
std::unique_ptr< SolutionHandle > _mdot_soln
Solutions handles and link to TH tables properties.
static const std::string SUM_CROSSFLOW
Definition: SubChannelApp.h:30
std::unique_ptr< SolutionHandle > _displacement_soln
std::unique_ptr< SolutionHandle > _DP_soln
static const std::string PRESSURE
Definition: SubChannelApp.h:31
std::unique_ptr< SolutionHandle > _SumWij_soln
static const std::string SURFACE_AREA
Definition: SubChannelApp.h:29
Real _CT
Turbulent modeling parameter used in axial momentum equation.
std::unique_ptr< SolutionHandle > _ff_soln
static const std::string HEAT_TRANSFER_COEFFICIENT
Definition: SubChannelApp.h:45
static const std::string DISPLACEMENT
Definition: SubChannelApp.h:43
static const std::string TEMPERATURE
Definition: SubChannelApp.h:34
std::unique_ptr< SolutionHandle > _P_soln
std::unique_ptr< SolutionHandle > _w_perim_soln
const SinglePhaseFluidProperties * _fp
Non-owning pointer to fluid properties user object.
std::unique_ptr< SolutionHandle > _mu_soln
std::unique_ptr< SolutionHandle > _Tpin_soln

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

Referenced by SubChannel1PhaseProblem::computeWijFromSolve().

1955 {
1956  SNES snes;
1957  KSP ksp;
1958  PC pc;
1959  Vec x, r;
1960  PetscScalar * xx;
1961 
1963  LibmeshPetscCall(SNESCreate(PETSC_COMM_SELF, &snes));
1964  LibmeshPetscCall(VecCreate(PETSC_COMM_SELF, &x));
1965  LibmeshPetscCall(VecSetSizes(x, PETSC_DECIDE, _block_size * _n_gaps));
1966  LibmeshPetscCall(VecSetFromOptions(x));
1967  LibmeshPetscCall(VecDuplicate(x, &r));
1968 
1969 #if PETSC_VERSION_LESS_THAN(3, 13, 0)
1970  LibmeshPetscCall(PetscOptionsSetValue(PETSC_NULL, "-snes_mf", PETSC_NULL));
1971 #else
1972  LibmeshPetscCall(SNESSetUseMatrixFree(snes, PETSC_FALSE, PETSC_TRUE));
1973 #endif
1974  Ctx ctx;
1975  ctx.iblock = iblock;
1976  ctx.schp = this;
1977  LibmeshPetscCall(SNESSetFunction(snes, r, formFunction, &ctx));
1978  LibmeshPetscCall(SNESGetKSP(snes, &ksp));
1979  LibmeshPetscCall(KSPGetPC(ksp, &pc));
1980  LibmeshPetscCall(PCSetType(pc, PCNONE));
1981  LibmeshPetscCall(KSPSetTolerances(ksp, _rtol, _atol, _dtol, _maxit));
1982  LibmeshPetscCall(SNESSetFromOptions(snes));
1983  LibmeshPetscCall(VecGetArray(x, &xx));
1984  for (unsigned int i = 0; i < _block_size * _n_gaps; i++)
1985  {
1986  xx[i] = solution(i);
1987  }
1988  LibmeshPetscCall(VecRestoreArray(x, &xx));
1989 
1990  LibmeshPetscCall(SNESSolve(snes, NULL, x));
1991  LibmeshPetscCall(VecGetArray(x, &xx));
1992  for (unsigned int i = 0; i < _block_size * _n_gaps; i++)
1993  root(i) = xx[i];
1994 
1995  LibmeshPetscCall(VecRestoreArray(x, &xx));
1996  LibmeshPetscCall(VecDestroy(&x));
1997  LibmeshPetscCall(VecDestroy(&r));
1998  LibmeshPetscCall(SNESDestroy(&snes));
1999  PetscFunctionReturn(LIBMESH_PETSC_SUCCESS);
2000 }
const PetscReal & _dtol
The divergence tolerance for the ksp linear solver.
PetscFunctionBegin
const std::vector< double > x
const PetscReal & _atol
The absolute convergence tolerance for the ksp linear solver.
Real root(std::function< Real(Real)> const &f, Real x1, Real x2, Real tol=1.0e-12)
Finds the root of a function using Brent&#39;s method.
Definition: BrentsMethod.C:66
const PetscInt & _maxit
The maximum number of iterations to use for the ksp linear solver.
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.
const PetscReal & _rtol
The relative convergence tolerance, (relative decrease) for the ksp linear solver.
void * ctx
PetscFunctionReturn(LIBMESH_PETSC_SUCCESS)

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

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

423 {
424  PetscScalar * xx;
425 
427  LibmeshPetscCall(VecGetArray(x, &xx));
428  for (unsigned int iz = first_axial_level; iz < last_axial_level + 1; iz++)
429  {
430  unsigned int iz_ind = iz - first_axial_level;
431  for (unsigned int i_l = 0; i_l < cross_dimension; i_l++)
432  {
433  loc_solution(i_l, iz) = xx[iz_ind * cross_dimension + i_l];
434  }
435  }
436  LibmeshPetscCall(VecRestoreArray(x, &xx));
437 
438  PetscFunctionReturn(LIBMESH_PETSC_SUCCESS);
439 }
PetscFunctionBegin
const std::vector< double > x
PetscFunctionReturn(LIBMESH_PETSC_SUCCESS)

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

497 {
498  PetscScalar * xx;
500  LibmeshPetscCall(VecGetArray(x, &xx));
501  Node * loc_node;
502  for (unsigned int iz = first_axial_level; iz < last_axial_level + 1; iz++)
503  {
504  unsigned int iz_ind = iz - first_axial_level;
505  for (unsigned int i_l = 0; i_l < cross_dimension; i_l++)
506  {
507  loc_node = _subchannel_mesh.getChannelNode(i_l, iz);
508  loc_solution.set(loc_node, xx[iz_ind * cross_dimension + i_l]);
509  }
510  }
511  PetscFunctionReturn(LIBMESH_PETSC_SUCCESS);
512 }
PetscFunctionBegin
const std::vector< double > x
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.
PetscFunctionReturn(LIBMESH_PETSC_SUCCESS)

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

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

474 {
475  PetscScalar * xx;
477  LibmeshPetscCall(VecGetArray(x, &xx));
478  for (unsigned int iz = first_axial_level; iz < last_axial_level + 1; iz++)
479  {
480  unsigned int iz_ind = iz - first_axial_level;
481  for (unsigned int i_l = 0; i_l < cross_dimension; i_l++)
482  {
483  xx[iz_ind * cross_dimension + i_l] = loc_solution(i_l, iz);
484  }
485  }
486  LibmeshPetscCall(VecRestoreArray(x, &xx));
487  PetscFunctionReturn(LIBMESH_PETSC_SUCCESS);
488 }
PetscFunctionBegin
const std::vector< double > x
PetscFunctionReturn(LIBMESH_PETSC_SUCCESS)

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

448 {
449  PetscScalar * xx;
450 
452  LibmeshPetscCall(VecGetArray(x, &xx));
453  for (unsigned int iz = first_axial_level; iz < last_axial_level + 1; iz++)
454  {
455  unsigned int iz_ind = iz - first_axial_level;
456  for (unsigned int i_l = 0; i_l < cross_dimension; i_l++)
457  {
458  auto * loc_node = _subchannel_mesh.getChannelNode(i_l, iz);
459  xx[iz_ind * cross_dimension + i_l] = loc_solution(loc_node);
460  }
461  }
462  LibmeshPetscCall(VecRestoreArray(x, &xx));
463 
464  PetscFunctionReturn(LIBMESH_PETSC_SUCCESS);
465 }
PetscFunctionBegin
const std::vector< double > x
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.
PetscFunctionReturn(LIBMESH_PETSC_SUCCESS)

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

Referenced by formFunction().

1911 {
1912  const unsigned int last_node = (iblock + 1) * _block_size;
1913  const unsigned int first_node = iblock * _block_size + 1;
1914  libMesh::DenseVector<Real> Wij_residual_vector(_n_gaps * _block_size, 0.0);
1915  // Assign the solution to the cross-flow matrix
1916  int i = 0;
1917  for (unsigned int iz = first_node; iz < last_node + 1; iz++)
1918  {
1919  for (unsigned int i_gap = 0; i_gap < _n_gaps; i_gap++)
1920  {
1921  _Wij(i_gap, iz) = solution(i);
1922  i++;
1923  }
1924  }
1925 
1926  // Calculating sum of crossflows
1927  computeSumWij(iblock);
1928  // Solving axial flux
1929  computeMdot(iblock);
1930  // Calculation of turbulent Crossflow
1931  computeWijPrime(iblock);
1932  // Solving for Pressure Drop
1933  computeDP(iblock);
1934  // Solving for pressure
1935  computeP(iblock);
1936  // Populating lateral crossflow residual matrix
1937  computeWijResidual(iblock);
1938 
1939  // Turn the residual matrix into a residual vector
1940  for (unsigned int iz = 0; iz < _block_size; iz++)
1941  {
1942  for (unsigned int i_gap = 0; i_gap < _n_gaps; i_gap++)
1943  {
1944  int i = _n_gaps * iz + i_gap; // column wise transfer
1945  Wij_residual_vector(i) = _Wij_residual_matrix(i_gap, iz);
1946  }
1947  }
1948  return Wij_residual_vector;
1949 }
void computeSumWij(int iblock)
Computes net diversion crossflow per channel for block iblock.
void computeP(int iblock)
Computes Pressure per channel for block iblock.
void computeMdot(int iblock)
Computes mass flow per channel for block iblock.
void computeWijResidual(int iblock)
Computes Residual Matrix based on the lateral momentum conservation equation for block iblock...
libMesh::DenseMatrix< Real > _Wij_residual_matrix
libMesh::DenseMatrix< Real > & _Wij
void computeWijPrime(int iblock)
Computes turbulent crossflow per gap for block iblock.
void computeDP(int iblock)
Computes Pressure Drop per channel for block iblock.

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

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

2005 {
2007 
2008  // Create solution vector with rhs layout
2009  Vec x = nullptr;
2010  LibmeshPetscCall(VecDuplicate(rhs, &x));
2011 
2012  // KSP setup
2013  KSP ksp = nullptr;
2014  PC pc = nullptr;
2015  LibmeshPetscCall(KSPCreate(PETSC_COMM_SELF, &ksp));
2016  LibmeshPetscCall(KSPSetOperators(ksp, A, A));
2017  LibmeshPetscCall(KSPGetPC(ksp, &pc));
2018  LibmeshPetscCall(PCSetType(pc, PCJACOBI));
2019  LibmeshPetscCall(KSPSetTolerances(ksp, _rtol, _atol, _dtol, _maxit));
2020  if (ksp_prefix && *ksp_prefix)
2021  LibmeshPetscCall(KSPSetOptionsPrefix(ksp, ksp_prefix));
2022  LibmeshPetscCall(KSPSetFromOptions(ksp));
2023 
2024  // Solve
2025  LibmeshPetscCall(KSPSolve(ksp, rhs, x));
2026 
2027  // Scatter to _h_soln with sanity checks
2028  PetscScalar * xx = nullptr;
2029  LibmeshPetscCall(VecGetArray(x, &xx));
2030  for (unsigned int iz = first_node; iz <= last_node; ++iz)
2031  {
2032  const unsigned int iz_ind = iz - first_node;
2033  for (unsigned int i_ch = 0; i_ch < _n_channels; ++i_ch)
2034  {
2035  auto * node_out = _subchannel_mesh.getChannelNode(i_ch, iz);
2036  const PetscScalar h_out = xx[iz_ind * _n_channels + i_ch];
2037  if (h_out < 0.0)
2038  mooseError(
2039  name(), " : Calculation of negative Enthalpy h_out = ", h_out, " Axial Level = ", iz);
2040  _h_soln->set(node_out, h_out);
2041  }
2042  }
2043  LibmeshPetscCall(VecRestoreArray(x, &xx));
2044 
2045  // Cleanup
2046  LibmeshPetscCall(KSPDestroy(&ksp));
2047  LibmeshPetscCall(VecDestroy(&x));
2048 
2049  PetscFunctionReturn(LIBMESH_PETSC_SUCCESS);
2050 }
std::unique_ptr< SolutionHandle > _h_soln
const PetscReal & _dtol
The divergence tolerance for the ksp linear solver.
PetscFunctionBegin
const std::string & name() const
const std::vector< double > x
const PetscReal & _atol
The absolute convergence tolerance for the ksp linear solver.
const PetscInt & _maxit
The maximum number of iterations to use for the ksp linear solver.
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.
const PetscReal & _rtol
The relative convergence tolerance, (relative decrease) for the ksp linear solver.
void mooseError(Args &&... args) const
PetscFunctionReturn(LIBMESH_PETSC_SUCCESS)

◆ solverSystemConverged()

bool SubChannel1PhaseProblem::solverSystemConverged ( const unsigned int  )
overridevirtualinherited

Reimplemented from ExternalProblem.

Definition at line 420 of file SubChannel1PhaseProblem.C.

421 {
422  return _converged;
423 }
bool _converged
Variable that informs whether we exited external solve with a converged solution or not...

◆ syncSolutions()

void SubChannel1PhaseProblem::syncSolutions ( Direction  direction)
overridevirtualinherited

Implements ExternalProblem.

Definition at line 2780 of file SubChannel1PhaseProblem.C.

2781 {
2782 }

◆ validParams()

InputParameters QuadSubChannel1PhaseProblem::validParams ( )
static

Definition at line 18 of file QuadSubChannel1PhaseProblem.C.

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

Member Data Documentation

◆ _added_K

PetscScalar SubChannel1PhaseProblem::_added_K = 0.0
protectedinherited

Added resistances for monolithic convergence.

Definition at line 406 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 354 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 357 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 360 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 364 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 351 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

Mass conservation - density time derivative No implicit matrix.

Axial momentum Axial momentum conservation - compute turbulent cross fluxes

Definition at line 348 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

◆ _cmc_advective_derivative_mat

Mat SubChannel1PhaseProblem::_cmc_advective_derivative_mat
protectedinherited

Cross momentum conservation - advective (Eulerian) derivative.

Definition at line 377 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 374 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 214 of file SubChannel1PhaseProblem.h.

Referenced by 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 218 of file SubChannel1PhaseProblem.h.

Referenced by SubChannel1PhaseProblem::externalSolve().

◆ _compute_viscosity

const bool SubChannel1PhaseProblem::_compute_viscosity
protectedinherited

Flag that activates or deactivates the calculation of viscosity.

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

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

◆ _correction_factor

PetscScalar SubChannel1PhaseProblem::_correction_factor = 1.0
protectedinherited

◆ _CT

Real SubChannel1PhaseProblem::_CT
protectedinherited

Turbulent modeling parameter used in axial momentum equation.

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

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

◆ _dir_grav

const Real SubChannel1PhaseProblem::_dir_grav
protectedinherited

Definition at line 247 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 280 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

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

Referenced by SubChannel1PhaseProblem::computeDP().

◆ _gravity_direction

const MooseEnum SubChannel1PhaseProblem::_gravity_direction
protectedinherited

The direction of gravity.

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

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

◆ _hc_advective_derivative_rhs

Vec SubChannel1PhaseProblem::_hc_advective_derivative_rhs
protectedinherited

◆ _hc_cross_derivative_mat

Mat SubChannel1PhaseProblem::_hc_cross_derivative_mat
protectedinherited

◆ _hc_cross_derivative_rhs

Vec SubChannel1PhaseProblem::_hc_cross_derivative_rhs
protectedinherited

◆ _hc_sys_h_mat

Mat SubChannel1PhaseProblem::_hc_sys_h_mat
protectedinherited

◆ _hc_sys_h_rhs

Vec SubChannel1PhaseProblem::_hc_sys_h_rhs
protectedinherited

◆ _hc_time_derivative_mat

Mat SubChannel1PhaseProblem::_hc_time_derivative_mat
protectedinherited

Enthalpy Enthalpy conservation - time derivative.

Definition at line 391 of file SubChannel1PhaseProblem.h.

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

◆ _hc_time_derivative_rhs

Vec SubChannel1PhaseProblem::_hc_time_derivative_rhs
protectedinherited

◆ _HTC_soln

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

◆ _implicit_bool

const bool SubChannel1PhaseProblem::_implicit_bool
protectedinherited

◆ _interpolation_scheme

const MooseEnum SubChannel1PhaseProblem::_interpolation_scheme
protectedinherited

The interpolation method used in constructing the systems.

Definition at line 244 of file SubChannel1PhaseProblem.h.

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

◆ _kij

const Real& SubChannel1PhaseProblem::_kij
protectedinherited

◆ _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_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 336 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 210 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 230 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

◆ _prod

Vec SubChannel1PhaseProblem::_prod
protectedinherited

◆ _prodp

Vec SubChannel1PhaseProblem::_prodp
protectedinherited

◆ _q_prime_soln

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

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

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

◆ _subchannel_mesh

QuadSubChannelMesh& QuadSubChannel1PhaseProblem::_subchannel_mesh
protected

◆ _SumWij_soln

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

◆ _T_maxit

const int& SubChannel1PhaseProblem::_T_maxit
protectedinherited

Maximum iterations for the inner temperature loop.

Definition at line 234 of file SubChannel1PhaseProblem.h.

Referenced by SubChannel1PhaseProblem::externalSolve().

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

Referenced by SubChannel1PhaseProblem::externalSolve().

◆ _Tduct_soln

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

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

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

◆ _verbose_subchannel

const bool SubChannel1PhaseProblem::_verbose_subchannel
protectedinherited

◆ _w_perim_soln

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

◆ _Wij

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

◆ _Wij_old

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

◆ _Wij_residual_matrix

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

◆ _Wij_vec

Vec SubChannel1PhaseProblem::_Wij_vec
protectedinherited

◆ _WijPrime

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

◆ _z_grid

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

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