https://mooseframework.inl.gov
PCNSFVHLLCBC.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://mooseframework.inl.gov
3 //*
4 //* All rights reserved, see COPYRIGHT for full restrictions
5 //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6 //*
7 //* Licensed under LGPL 2.1, please see LICENSE for details
8 //* https://www.gnu.org/licenses/lgpl-2.1.html
9 
10 #include "PCNSFVHLLCBC.h"
11 #include "PCNSFVHLLC.h"
12 #include "NS.h"
14 
17 {
19  params.addRequiredParam<UserObjectName>(NS::fluid, "Fluid properties userobject");
20  return params;
21 }
22 
24  : FVFluxBC(parameters),
25  _fluid(UserObjectInterface::getUserObject<SinglePhaseFluidProperties>(NS::fluid)),
26  _specific_internal_energy_elem(getADMaterialProperty<Real>(NS::specific_internal_energy)),
27  _vel_elem(getADMaterialProperty<RealVectorValue>(NS::velocity)),
28  _speed_elem(getADMaterialProperty<Real>(NS::speed)),
29  _rho_elem(getADMaterialProperty<Real>(NS::density)),
30  _pressure_elem(getADMaterialProperty<Real>(NS::pressure)),
31  _rho_et_elem(getADMaterialProperty<Real>(NS::total_energy_density)),
32  _ht_elem(getADMaterialProperty<Real>(NS::specific_total_enthalpy)),
33  _eps_elem(getMaterialProperty<Real>(NS::porosity))
34 {
35 }
36 
37 ADReal
39 {
40 
43 
44  auto wave_speeds = PCNSFVHLLC::waveSpeed(_rho_elem[_qp],
45  _vel_elem[_qp],
47  _eps_elem[_qp],
52  _fluid,
53  _normal);
54  _SL = std::move(wave_speeds[0]);
55  _SM = std::move(wave_speeds[1]);
56  _SR = std::move(wave_speeds[2]);
57 
58  if (_SL >= 0)
59  return fluxElem();
60  else if (_SR <= 0)
61  return fluxBoundary();
62  else
63  {
64  if (_SM >= 0)
65  {
67  return fluxElem() + _SL * (f * hllcElem() - conservedVariableElem());
68  }
69  else
70  {
73  }
74  }
75  mooseError("Should never get here");
76  return 0;
77 }
virtual ADReal fluxBoundary()=0
static const std::string total_energy_density
Definition: NS.h:65
virtual ADReal fluxElem()=0
flux functions on elem & from boundary
virtual ADReal computeQpResidual() override
Definition: PCNSFVHLLCBC.C:38
const SinglePhaseFluidProperties & _fluid
fluid properties
Definition: PCNSFVHLLCBC.h:51
static const std::string speed
Definition: NS.h:143
virtual ADReal hllcBoundary()=0
static InputParameters validParams()
PCNSFVHLLCBC(const InputParameters &parameters)
Definition: PCNSFVHLLCBC.C:23
ADReal _rho_boundary
Definition: PCNSFVHLLCBC.h:75
static const std::string density
Definition: NS.h:33
virtual ADReal conservedVariableBoundary()=0
Real _eps_boundary
Definition: PCNSFVHLLCBC.h:82
static const std::string fluid
Definition: NS.h:87
virtual ADReal conservedVariableElem()=0
conserved variable of this equation from elem and boundary
DualNumber< Real, DNDerivativeType, true > ADReal
const ADMaterialProperty< RealVectorValue > & _vel_elem
Definition: PCNSFVHLLCBC.h:55
static const std::string specific_internal_energy
Definition: NS.h:62
static InputParameters validParams()
Definition: PCNSFVHLLCBC.C:16
void addRequiredParam(const std::string &name, const std::string &doc_string)
const ADMaterialProperty< Real > & _specific_internal_energy_elem
material properties on the elem side of the boundary
Definition: PCNSFVHLLCBC.h:54
const unsigned int _qp
static const std::string porosity
Definition: NS.h:104
ADRealVectorValue _vel_boundary
Definition: PCNSFVHLLCBC.h:76
ADReal _specific_internal_energy_boundary
Definition: PCNSFVHLLCBC.h:77
Real f(Real x)
Test function for Brents method.
ADRealVectorValue _normal
Common class for single phase fluid properties.
virtual ADReal hllcElem()=0
HLLC modifications to flux for elem & boundary, see Toro.
static std::array< ADReal, 3 > waveSpeed(const ADReal &rho_elem, const ADRealVectorValue &vel_elem, const ADReal &e_elem, Real eps_elem, const ADReal &rho_neighbor, const ADRealVectorValue &vel_neighbor, const ADReal &e_neighbor, Real eps_neighbor, const SinglePhaseFluidProperties &fluid, const ADRealVectorValue &normal)
helper function for computing wave speed
Definition: PCNSFVHLLC.C:47
ADReal _normal_speed_boundary
these quantities must be computed in preComputeWaveSpeed
Definition: PCNSFVHLLCBC.h:74
ADReal _SL
the wave speeds
Definition: PCNSFVHLLCBC.h:65
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
ADReal _normal_speed_elem
speeds normal to the interface on the element side
Definition: PCNSFVHLLCBC.h:71
static const std::string specific_total_enthalpy
Definition: NS.h:69
const ADMaterialProperty< Real > & _rho_elem
Definition: PCNSFVHLLCBC.h:57
static const std::string pressure
Definition: NS.h:56
void mooseError(Args &&... args) const
static const std::string velocity
Definition: NS.h:45
virtual void preComputeWaveSpeed()=0
this function is a call back for setting quantities for computing wave speed before calling the wave ...
const MaterialProperty< Real > & _eps_elem
Definition: PCNSFVHLLCBC.h:61