18 params.
addClassDescription(
"One-dimensional slope limiting to get the limited slope of cell " 19 "average variable for the advection equation using a cell-centered " 20 "finite volume method.");
22 MooseEnum scheme(
"none minmod mc superbee",
"none");
32 std::vector<RealGradient>
37 unsigned int nvars = 1;
51 unsigned int nside = elem->n_sides();
54 unsigned int nsten = nside + 1;
57 std::vector<RealGradient> ugrad(nvars,
RealGradient(0., 0., 0.));
60 std::vector<Real> xc(nsten, 0.);
63 xc[0] = elem->vertex_average()(0);
66 std::vector<std::vector<Real>> ucell(nsten, std::vector<Real>(nvars, 0.));
84 std::vector<std::vector<Real>>
sigma(nsten, std::vector<Real>(nvars, 0.));
94 unsigned int bflag = 0;
98 for (
is = 0;
is < nside;
is++)
103 if (elem->neighbor_ptr(
is) != NULL)
105 const Elem * neig = elem->neighbor_ptr(
is);
106 if (this->
hasBlocks(neig->subdomain_id()))
108 xc[in] = neig->vertex_average()(0);
118 for (iv = 0; iv < nvars; iv++)
119 sigma[in][iv] = (ucell[0][iv] - ucell[in][iv]) / (xc[0] - xc[in]);
148 for (iv = 0; iv < nvars; iv++)
153 ugrad[iv](0) =
sigma[1][iv];
155 ugrad[iv](0) =
sigma[2][iv];
168 for (iv = 0; iv < nvars; iv++)
169 sigma[0][iv] = (ucell[1][iv] - ucell[2][iv]) / (xc[1] - xc[2]);
171 for (iv = 0; iv < nvars; iv++)
174 ugrad[iv](0) = std::min(
sigma[0][iv], 2. * std::min(
sigma[1][iv],
sigma[2][iv]));
176 ugrad[iv](0) = std::max(
sigma[0][iv], 2. * std::max(
sigma[1][iv],
sigma[2][iv]));
188 for (iv = 0; iv < nvars; iv++)
195 sigma1 = std::min(
sigma[2][iv], 2. *
sigma[1][iv]);
196 else if (
sigma[2][iv] < 0. &&
sigma[1][iv] < 0.)
197 sigma1 = std::max(
sigma[2][iv], 2. *
sigma[1][iv]);
201 sigma2 = std::min(2. *
sigma[2][iv],
sigma[1][iv]);
202 else if (
sigma[2][iv] < 0. &&
sigma[1][iv] < 0.)
203 sigma2 = std::max(2. *
sigma[2][iv],
sigma[1][iv]);
206 if (sigma1 > 0. && sigma2 > 0.)
207 ugrad[iv](0) = std::max(sigma1, sigma2);
208 else if (sigma1 < 0. && sigma2 < 0.)
209 ugrad[iv](0) = std::min(sigma1, sigma2);
215 mooseError(
"Unknown 1D TVD-type slope limiter scheme");
One-dimensional slope limiting to get the limited slope of cell average variable for the advection eq...
static InputParameters validParams()
static InputParameters validParams()
MooseVariable * _u
the input variable
MooseEnum _scheme
One-D slope limiting scheme.
OutputData getElementalValue(const Elem *elem, unsigned int idx=0) const
ADRealEigenVector< T, D, asd > abs(const ADRealEigenVector< T, D, asd > &)
PetscErrorCode PetscInt const PetscInt IS * is
Base class for slope limiting to limit the slopes of cell average variables.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
OutputData getElementalValueOld(const Elem *elem, unsigned int idx=0) const
void mooseError(Args &&... args) const
const Elem * _current_elem
bool hasBlocks(const SubdomainName &name) const
registerMooseObject("RdgApp", AEFVSlopeLimitingOneD)
virtual std::vector< RealGradient > limitElementSlope() const override
compute the limited slope of the cell
AEFVSlopeLimitingOneD(const InputParameters ¶meters)