https://mooseframework.inl.gov
AEFVUpwindInternalSideFlux.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 
11 
13 
16 {
18  params.addClassDescription("Upwind numerical flux scheme for the advection equation using a "
19  "cell-centered finite volume method.");
20  params.addParam<Real>("velocity", 1.0, "Advective velocity");
21  return params;
22 }
23 
25  : InternalSideFluxBase(parameters), _velocity(getParam<Real>("velocity"))
26 {
27 }
28 
30 
31 void
32 AEFVUpwindInternalSideFlux::calcFlux(unsigned int /*iside*/,
33  dof_id_type /*ielem*/,
34  dof_id_type /*ineig*/,
35  const std::vector<Real> & uvec1,
36  const std::vector<Real> & uvec2,
37  const RealVectorValue & dwave,
38  std::vector<Real> & flux) const
39 {
40  mooseAssert(uvec1.size() == 1, "Invalid size for uvec1. Must be single variable coupling.");
41  mooseAssert(uvec2.size() == 1, "Invalid size for uvec1. Must be single variable coupling.");
42 
43  // assign the size of flux vector, e.g. = 1 for the advection equation
44  flux.resize(1);
45 
46  // assume a constant velocity on the left
47  RealVectorValue uadv1(_velocity, 0.0, 0.0);
48 
49  // assume a constant velocity on the right
50  RealVectorValue uadv2(_velocity, 0.0, 0.0);
51 
52  // normal velocity on the left and right
53  Real vdon1 = uadv1 * dwave;
54  Real vdon2 = uadv2 * dwave;
55 
56  // calculate the so-called a^plus and a^minus
57  Real aplus = 0.5 * (vdon1 + std::abs(vdon1));
58  Real amins = 0.5 * (vdon2 - std::abs(vdon2));
59 
60  // finally calculate the flux
61  flux[0] = aplus * uvec1[0] + amins * uvec2[0];
62 }
63 
64 void
66  dof_id_type /*ielem*/,
67  dof_id_type /*ineig*/,
68  const std::vector<Real> & libmesh_dbg_var(uvec1),
69  const std::vector<Real> & libmesh_dbg_var(uvec2),
70  const RealVectorValue & dwave,
71  DenseMatrix<Real> & jac1,
72  DenseMatrix<Real> & jac2) const
73 {
74  mooseAssert(uvec1.size() == 1, "Invalid size for uvec1. Must be single variable coupling.");
75  mooseAssert(uvec2.size() == 1, "Invalid size for uvec1. Must be single variable coupling.");
76 
77  // assign the size of Jacobian matrix, e.g. = (1, 1) for the advection equation
78  jac1.resize(1, 1);
79  jac2.resize(1, 1);
80 
81  // assume a constant velocity on the left
82  RealVectorValue uadv1(_velocity, 0.0, 0.0);
83 
84  // assume a constant velocity on the right
85  RealVectorValue uadv2(_velocity, 0.0, 0.0);
86 
87  // normal velocity on the left and right
88  Real vdon1 = uadv1 * dwave;
89  Real vdon2 = uadv2 * dwave;
90 
91  // calculate the so-called a^plus and a^minus
92  Real aplus = 0.5 * (vdon1 + std::abs(vdon1));
93  Real amins = 0.5 * (vdon2 - std::abs(vdon2));
94 
95  // finally calculate the Jacobian matrix
96  jac1(0, 0) = aplus;
97  jac2(0, 0) = amins;
98 }
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
static InputParameters validParams()
registerMooseObject("RdgApp", AEFVUpwindInternalSideFlux)
const Real _velocity
advective velocity
virtual void calcFlux(unsigned int iside, dof_id_type ielem, dof_id_type ineig, const std::vector< Real > &uvec1, const std::vector< Real > &uvec2, const RealVectorValue &dwave, std::vector< Real > &flux) const override
Solve the Riemann problem.
Upwind numerical flux scheme for the advection equation using a cell-centered finite volume method...
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
A base class for computing and caching internal side flux.
void resize(const unsigned int new_m, const unsigned int new_n)
virtual void calcJacobian(unsigned int iside, dof_id_type ielem, dof_id_type ineig, const std::vector< Real > &uvec1, const std::vector< Real > &uvec2, const RealVectorValue &dwave, DenseMatrix< Real > &jac1, DenseMatrix< Real > &jac2) const override
Compute the Jacobian matrix.
void addClassDescription(const std::string &doc_string)
static InputParameters validParams()
AEFVUpwindInternalSideFlux(const InputParameters &parameters)
uint8_t dof_id_type