www.mooseframework.org
AEFVUpwindInternalSideFlux.C
Go to the documentation of this file.
1 /****************************************************************/
2 /* MOOSE - Multiphysics Object Oriented Simulation Environment */
3 /* */
4 /* All contents are licensed under LGPL V2.1 */
5 /* See LICENSE for full restrictions */
6 /****************************************************************/
7 
9 
10 template <>
11 InputParameters
13 {
14  InputParameters params = validParams<InternalSideFluxBase>();
15  params.addClassDescription("Upwind numerical flux scheme for the advection equation using a "
16  "cell-centered finite volume method.");
17  return params;
18 }
19 
20 AEFVUpwindInternalSideFlux::AEFVUpwindInternalSideFlux(const InputParameters & parameters)
21  : InternalSideFluxBase(parameters)
22 {
23 }
24 
26 
27 void
28 AEFVUpwindInternalSideFlux::calcFlux(unsigned int /*iside*/,
29  dof_id_type /*ielem*/,
30  dof_id_type /*ineig*/,
31  const std::vector<Real> & uvec1,
32  const std::vector<Real> & uvec2,
33  const RealVectorValue & dwave,
34  std::vector<Real> & flux) const
35 {
36  mooseAssert(uvec1.size() == 1, "Invalid size for uvec1. Must be single variable coupling.");
37  mooseAssert(uvec2.size() == 1, "Invalid size for uvec1. Must be single variable coupling.");
38 
39  // assign the size of flux vector, e.g. = 1 for the advection equation
40  flux.resize(1);
41 
42  // assume a constant velocity on the left
43  RealVectorValue uadv1(1.0, 1.0, 1.0);
44 
45  // assume a constant velocity on the right
46  RealVectorValue uadv2(1.0, 1.0, 1.0);
47 
48  // normal velocity on the left and right
49  Real vdon1 = uadv1 * dwave;
50  Real vdon2 = uadv2 * dwave;
51 
52  // calculate the so-called a^plus and a^minus
53  Real aplus = 0.5 * (vdon1 + std::abs(vdon1));
54  Real amins = 0.5 * (vdon2 - std::abs(vdon2));
55 
56  // finally calculate the flux
57  flux[0] = aplus * uvec1[0] + amins * uvec2[0];
58 }
59 
60 void
62  dof_id_type /*ielem*/,
63  dof_id_type /*ineig*/,
64  const std::vector<Real> & libmesh_dbg_var(uvec1),
65  const std::vector<Real> & libmesh_dbg_var(uvec2),
66  const RealVectorValue & dwave,
67  DenseMatrix<Real> & jac1,
68  DenseMatrix<Real> & jac2) const
69 {
70  mooseAssert(uvec1.size() == 1, "Invalid size for uvec1. Must be single variable coupling.");
71  mooseAssert(uvec2.size() == 1, "Invalid size for uvec1. Must be single variable coupling.");
72 
73  // assign the size of Jacobian matrix, e.g. = (1, 1) for the advection equation
74  jac1.resize(1, 1);
75  jac2.resize(1, 1);
76 
77  // assume a constant velocity on the left
78  RealVectorValue uadv1(1.0, 1.0, 1.0);
79 
80  // assume a constant velocity on the right
81  RealVectorValue uadv2(1.0, 1.0, 1.0);
82 
83  // normal velocity on the left and right
84  Real vdon1 = uadv1 * dwave;
85  Real vdon2 = uadv2 * dwave;
86 
87  // calculate the so-called a^plus and a^minus
88  Real aplus = 0.5 * (vdon1 + std::abs(vdon1));
89  Real amins = 0.5 * (vdon2 - std::abs(vdon2));
90 
91  // finally calculate the Jacobian matrix
92  jac1(0, 0) = aplus;
93  jac2(0, 0) = amins;
94 }
InputParameters validParams< InternalSideFluxBase >()
InputParameters validParams< AEFVUpwindInternalSideFlux >()
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.
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.
A base class for computing and caching internal side flux.
AEFVUpwindInternalSideFlux(const InputParameters &parameters)