17 #include <petscdmda.h> 21 #include <petscsnes.h> 176 const unsigned int first_axial_level,
177 const unsigned int last_axial_level,
178 const unsigned int cross_dimension);
182 const unsigned int first_axial_level,
183 const unsigned int last_axial_level,
184 const unsigned int cross_dimension);
188 const unsigned int first_axial_level,
189 const unsigned int last_axial_level,
190 const unsigned int cross_dimension);
194 const unsigned int first_axial_level,
195 const unsigned int last_axial_level,
196 const unsigned int cross_dimension);
201 const unsigned int first_axial_level,
202 const unsigned int last_axial_level,
203 const unsigned int cross_dimension);
296 const unsigned int first_axial_level,
297 const unsigned int last_axial_level,
298 const unsigned int cross_dimension)
304 ierr = VecGetArray(
x, &xx);
306 for (
unsigned int iz = first_axial_level; iz < last_axial_level + 1; iz++)
308 unsigned int iz_ind = iz - first_axial_level;
309 for (
unsigned int i_l = 0; i_l < cross_dimension; i_l++)
311 loc_solution(i_l, iz) = xx[iz_ind * cross_dimension + i_l];
314 ierr = VecRestoreArray(
x, &xx);
Vec _amc_time_derivative_rhs
virtual PetscScalar computeInterpolatedValue(PetscScalar topValue, PetscScalar botValue, PetscScalar Peclet=0.0)
Mat _amc_turbulent_cross_flows_mat
Mass conservation - density time derivative No implicit matrix.
const bool _compute_density
Flag that activates or deactivates the calculation of density.
Mat _cmc_friction_force_mat
Cross momentum conservation - friction force.
std::unique_ptr< SolutionHandle > _w_perim_soln
const bool _segregated_bool
Segregated solve.
Vec _hc_advective_derivative_rhs
virtual void externalSolve() override
Real _TR
Flag that activates or deactivates the transient parts of the equations we solve by multiplication...
Vec _amc_advective_derivative_rhs
std::unique_ptr< SolutionHandle > _S_flow_soln
std::unique_ptr< SolutionHandle > _P_soln
Mat _amc_advective_derivative_mat
Axial momentum conservation - advective (Eulerian) derivative.
virtual void computeSumWij(int iblock)
Computes net diversion crossflow per channel for block iblock.
const int & _T_maxit
Maximum iterations for the inner temperature loop.
const Real & _P_tol
Convergence tolerance for the pressure loop in external solve.
virtual void computeh(int iblock)
Computes Enthalpy per channel for block iblock.
Vec _amc_turbulent_cross_flows_rhs
virtual void computeDP(int iblock)
Computes Pressure Drop per channel for block iblock.
PetscErrorCode populateVectorFromHandle(Vec &x, const T &solution, const unsigned int first_axial_level, const unsigned int last_axial_level, const unsigned int cross_dimension)
virtual void syncSolutions(Direction direction) override
Vec _amc_pressure_force_rhs
std::unique_ptr< SolutionHandle > _Tpin_soln
Base class for inter-wrapper meshes.
virtual void computeRho(int iblock)
Computes Density per channel for block iblock.
PetscScalar _added_K
Added resistances for monolithic convergence.
virtual void computeWijPrime(int iblock)
Computes turbulent crossflow per gap for block iblock.
virtual void computeT(int iblock)
Computes Temperature per channel for block iblock.
PetscScalar _correction_factor
Vec _mc_axial_convection_rhs
PetscScalar _max_sumWij_new
const bool _implicit_bool
Flag to define the usage of a implicit or explicit solution.
std::unique_ptr< SolutionHandle > _SumWij_soln
Mat _cmc_pressure_force_mat
Cross momentum conservation - pressure force.
const Real & _P_out
Outlet Pressure.
Mat _mc_sumWij_mat
Mass conservation Mass conservation - sum of cross fluxes.
static InputParameters validParams()
const PetscReal & _dtol
The divergence tolerance for the ksp linear solver.
Base class for the 1-phase steady-state/transient interwrapper solver.
virtual PetscErrorCode createPetscVector(Vec &v, PetscInt n)
Petsc Functions.
Vec _cmc_friction_force_rhs
virtual PetscErrorCode implicitPetscSolve(int iblock)
Computes implicit solve using PetSc.
const Real & _dt
Time step.
Vec _cmc_time_derivative_rhs
std::unique_ptr< SolutionHandle > _rho_soln
const PetscReal & _rtol
The relative convergence tolerance, (relative decrease) for the ksp linear solver.
const unsigned int _n_cells
const unsigned int _block_size
Mat _mc_axial_convection_mat
Mass conservation - axial convection.
std::unique_ptr< SolutionHandle > _mdot_soln
const unsigned int _n_assemblies
virtual void computeMdot(int iblock)
Computes mass flow per channel for block iblock.
const SinglePhaseFluidProperties * _fp
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 Real & _beta
Thermal diffusion coefficient used in turbulent crossflow.
Mat _hc_time_derivative_mat
Enthalpy Enthalpy conservation - time derivative.
Vec _hc_cross_derivative_rhs
Vec _amc_cross_derivative_rhs
const PetscInt & _maxit
The maximum number of iterations to use for the ksp linear solver.
std::vector< Real > _z_grid
axial location of nodes
const MooseEnum _interpolation_scheme
The interpolation method used in constructing the systems.
Standard return structure for reusing in implicit/explicit formulations.
const bool _staggered_pressure_bool
Flag to define the usage of staggered or collocated pressure.
PetscErrorCode populateSolutionGap(const Vec &x, T &solution, const unsigned int first_axial_level, const unsigned int last_axial_level, const unsigned int cross_dimension)
Mat _amc_cross_derivative_mat
Axial momentum conservation - cross flux derivative.
const unsigned int _n_gaps
virtual PetscErrorCode petscSnesSolver(int iblock, const libMesh::DenseVector< Real > &solution, libMesh::DenseVector< Real > &root)
Computes solution of nonlinear equation using snes.
std::unique_ptr< SolutionHandle > _T_soln
const std::vector< double > x
Vec _cmc_Wij_channel_dummy
Real f(Real x)
Test function for Brents method.
Mat _hc_advective_derivative_mat
Enthalpy conservation - advective (Eulerian) derivative;.
virtual void computeP(int iblock)
Computes Pressure per channel for block iblock.
virtual void initialSetup() override
virtual PetscErrorCode createPetscMatrix(Mat &M, PetscInt n, PetscInt m)
const unsigned int _n_channels
Real root(std::function< Real(Real)> const &f, Real x1, Real x2, Real tol=1.0e-12)
Finds the root of a function using Brent's method.
virtual ~InterWrapper1PhaseProblem()
Mat _amc_time_derivative_mat
Axial momentum conservation - time derivative.
Vec _amc_friction_force_rhs
const bool _monolithic_thermal_bool
Thermal monolithic bool.
Common class for single phase fluid properties.
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.
virtual void computeWij(int iblock)
Computes cross fluxes for block iblock.
unsigned int _n_blocks
number of axial blocks
const InterWrapperMesh & _subchannel_mesh
virtual PetscScalar computeInterpolationCoefficients(PetscScalar Peclet=0.0)
Functions that computes the interpolation scheme given the Peclet number.
std::unique_ptr< SolutionHandle > _mu_soln
Mat _cmc_advective_derivative_mat
Cross momentum conservation - advective (Eulerian) derivative.
Vec _hc_added_heat_rhs
Enthalpy conservation - source and sink.
Mat _hc_sys_h_mat
System matrices.
std::unique_ptr< SolutionHandle > _DP_soln
const bool _compute_viscosity
Flag that activates or deactivates the calculation of viscosity.
PetscErrorCode populateSolutionChan(const Vec &x, T &solution, const unsigned int first_axial_level, const unsigned int last_axial_level, const unsigned int cross_dimension)
Vec _hc_time_derivative_rhs
Vec _cmc_pressure_force_rhs
virtual bool solverSystemConverged(const unsigned int) override
virtual void computeWijFromSolve(int iblock)
Computes diversion crossflow per gap for block with index iblock Block is a partition of the whole do...
const Real & _T_tol
Convergence tolerance for the temperature loop in external solve.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
static const std::string v
std::unique_ptr< SolutionHandle > _q_prime_soln
virtual void initializeSolution()
Function to initialize the solution fields.
Mat _cmc_sys_Wij_mat
Lateral momentum system matrix.
Mat _amc_pressure_force_mat
Axial momentum conservation - pressure force.
const bool _pin_mesh_exist
Flag that informs if there is a pin mesh or not.
virtual Real computeFrictionFactor(Real Re)=0
Returns friction factor.
PetscInt _global_counter
No implicit matrix.
virtual void computeMu(int iblock)
Computes Viscosity per channel for block iblock.
PetscErrorCode populateVectorFromDense(Vec &x, const T &solution, const unsigned int first_axial_level, const unsigned int last_axial_level, const unsigned int cross_dimension)
std::unique_ptr< SolutionHandle > _h_soln
virtual Real computeAddedHeat(unsigned int i_ch, unsigned int iz)
Computes added heat for channel i_ch and cell iz.
libMesh::DenseMatrix< Real > _Wij_old
const bool _compute_power
Flag that informs if we need to solve the Enthalpy/Temperature equations or not.
libMesh::DenseMatrix< Real > & _Wij
bool _converged
Variable that informs whether we exited external solve with a converged solution or not...
Vec _cmc_advective_derivative_rhs
libMesh::DenseMatrix< Real > _WijPrime
PetscFunctionReturn(LIBMESH_PETSC_SUCCESS)
Mat _hc_cross_derivative_mat
Enthalpy conservation - cross flux derivative.
libMesh::DenseMatrix< Real > _Wij_residual_matrix
InterWrapper1PhaseProblem(const InputParameters ¶ms)
virtual libMesh::DenseVector< Real > residualFunction(int iblock, libMesh::DenseVector< Real > solution)
Computes Residual per gap for block iblock.
friend PetscErrorCode formFunctionIW(SNES snes, Vec x, Vec f, void *info)
creates the residual function to be used in the PETCs snes context
Vec _amc_gravity_rhs
Axial momentum conservation - buoyancy force No implicit matrix.
Mat _cmc_time_derivative_mat
Cross momentum Cross momentum conservation - time derivative.
const Real & _CT
Turbulent modeling parameter used in axial momentum equation.
Mat _amc_sys_mdot_mat
Axial momentum system matrix.
Mat _amc_friction_force_mat
Axial momentum conservation - friction force.
const PetscReal & _atol
The absolute convergence tolerance for the ksp linear solver.