https://mooseframework.inl.gov
GradientOperator.h
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 #pragma once
11 
12 #include "Moose.h"
13 #include "MooseTypes.h"
14 #include "libmesh/vector_value.h"
15 #include "RankTwoTensor.h"
16 
17 template <class C>
18 class GradientOperator : public C
19 {
20 protected:
23  gradOp(unsigned int component, const RealVectorValue & g, const Real & v, const Point & p)
24  {
26  this->addGradOp(G, component, g, v, p);
27  return G;
28  }
29 };
30 
32 {
33 class Cartesian
34 {
35 protected:
38  unsigned int component,
39  const RealVectorValue & g,
40  const Real & /*v*/,
41  const Point & /*p*/)
42  {
43  for (auto j : make_range(3))
44  G(component, j) += g(j);
45  }
46 };
47 
49 {
50 protected:
53  unsigned int component,
54  const RealVectorValue & g,
55  const Real & v,
56  const Point & p)
57  {
58  for (auto j : make_range(2))
59  G(component, j) += g(j);
60 
61  // R
62  if (component == 0)
63  G(2, 2) += v / p(0);
64  }
65 };
66 
68 {
69 protected:
72  unsigned int /*component*/,
73  const RealVectorValue & g,
74  const Real & v,
75  const Point & p)
76  {
77  G(0, 0) += g(0);
78  G(1, 1) += v / p(0);
79  G(2, 2) += v / p(0);
80  }
81 };
82 }
83 
static const std::string component
Definition: NS.h:153
static const std::string G
Definition: NS.h:166
void addGradOp(RankTwoTensor &G, unsigned int, const RealVectorValue &g, const Real &v, const Point &p)
Accumulate the contribution of the gradient operator in a given direction for a given tensor...
GradientOperator< GradientOperatorCoordinates::CentrosymmetricSpherical > GradientOperatorCentrosymmetricSpherical
void addGradOp(RankTwoTensor &G, unsigned int component, const RealVectorValue &g, const Real &, const Point &)
Accumulate the contribution of the gradient operator in a given direction for a given tensor...
GradientOperator< GradientOperatorCoordinates::Cartesian > GradientOperatorCartesian
static const std::string v
Definition: NS.h:84
GradientOperator< GradientOperatorCoordinates::AxisymmetricCylindrical > GradientOperatorAxisymmetricCylindrical
IntRange< T > make_range(T beg, T end)
static const std::complex< double > j(0, 1)
Complex number "j" (also known as "i")
RankTwoTensor gradOp(unsigned int component, const RealVectorValue &g, const Real &v, const Point &p)
Returns the gradient operator in a given direction.
void addGradOp(RankTwoTensor &G, unsigned int component, const RealVectorValue &g, const Real &v, const Point &p)
Accumulate the contribution of the gradient operator in a given direction for a given tensor...
static const std::string C
Definition: NS.h:168