Advanced Multi-Physics (AMP)
On-Line Documentation
DiffusionRotatedAnisotropicModel.h
Go to the documentation of this file.
1#ifndef included_AMP_DiffusionRotatedAnisotropicModel
2#define included_AMP_DiffusionRotatedAnisotropicModel
3
4#include "AMP/mesh/Mesh.h"
5#include "AMP/operators/Operator.h"
6
7namespace AMP::Operator {
8
9
10/* ----------------------------------------------------------------------------------
11 Implementation of a rotated anisotropic constant-coefficient diffusion equation
12---------------------------------------------------------------------------------- */
13/* Abstract base class representing a linear diffusion problem:
14 - grad \dot ( D * grad u ) = s.
15 where the diffusion tensor D represents rotations and anisotropies. Specifically, the PDEs are
16 as follows:
17
18 - In 1D, the PDE is -u_xx = f.
19
20 - In 2D, the PDE is -u_xx -eps*u_yy = f, but rotated an angle of theta radians counter clockwise
21 from the positive x axis.
22 - In 2D, the input database should specify the constants "eps", and "theta" otherwise they are
23 set to default values of eps=1 and theta=0 (the isotropic case).
24
25 - In 3D, the PDE is -u_xx -epsy*u_yy - epsz*u_zz = f, but rotated according in 3D according the
26 the so-called "extrinsic" 3-1-3 Euler angles (see
27 https://en.wikipedia.org/wiki/Euler_angles#Definition_by_extrinsic_rotations) gamma, beta, and
28 alpha. A new coordinate system XYZ is obtained from rotating the xyz coordinate system by: 1.
29 first rotating gamma radians around the z axis, 2. then beta radians about the x axis, 3. then
30 alpha radians about the z axis. 19-point finite differences are used.
31 - In 3D, the input database should specify the constants "epsy", "epsz", "gamma", "beta", and
32 "alpha" otherwise they are set to default values of epsy=epsz=1 and gamma=beta=alpha=0 (the
33 isotropic case).
34
35 - Note that for eps = epsy = epsz = 1, the PDEs are isotropic and grid aligned (the rotation
36 angles have no impact in this case).
37
38 This base class translates the operator "- grad \dot ( D * grad u )" into the form of that
39 discretized by DiffusionFDOperator
40*/
42{
43
44public:
45 // Flag indicating whether a derived class provides an exact solution
47 // Shorthand for dimension of PDE
48 size_t d_dim;
49 // Diffusion coefficients, cxx, etc.
50 std::shared_ptr<AMP::Database> d_c_db;
51 // Database used to construct class
52 std::shared_ptr<AMP::Database> d_input_db;
53
54 // Constructor
55 RotatedAnisotropicDiffusionModel( std::shared_ptr<AMP::Database> input_db );
56
57 // Destructor
59
60 /* Pure virtual functions */
61 virtual double sourceTerm( const AMP::Mesh::Point &p ) const = 0;
62
63 /* Virtual functions */
64 virtual double exactSolution( const AMP::Mesh::Point & ) const
65 {
66 AMP_ERROR( "Base class cannot provide an implementation of this function" );
67 }
68
69private:
71 std::vector<double> getSecondOrderPDECoefficients1D() const;
72 std::vector<double> getSecondOrderPDECoefficients2D() const;
73 std::vector<double> getSecondOrderPDECoefficients3D() const;
74};
75
76
77/* ----------------------------------------------------------------------------------------------
78 Implementation of a MANUFACTURED rotated anisotropic constant-coefficient diffusion equation
79---------------------------------------------------------------------------------------------- */
80/* A source term and corresponding exact solution are provided */
82{
83
84 //
85public:
86 // Constructor
87 ManufacturedRotatedAnisotropicDiffusionModel( std::shared_ptr<AMP::Database> input_db )
89 {
90 // Set flag indicating this class does provide an implementation of exactSolution
92 }
93
94 // Destructor
96
97 double sourceTerm( const AMP::Mesh::Point &p ) const override;
98 double exactSolution( const AMP::Mesh::Point &p ) const override;
99
100 //
101private:
102 // Exact solution, and corresponding source term
103 // 1D
104 double exactSolution_( double x ) const;
105 double sourceTerm_( double x ) const;
106 // 2D
107 double exactSolution_( double x, double y ) const;
108 double sourceTerm_( double x, double y ) const;
109 // 3D
110 double exactSolution_( double x, double y, double z ) const;
111 double sourceTerm_( double x, double y, double z ) const;
112
113 // Constants to translate the exact solutions (trig functions), so as to avoid cases of these
114 // functions being zero (and or constant) along boundaries (providing better opportunities for
115 // identifying bugs in boundary computations).
116 constexpr static double d_X_SHIFT = -0.325;
117 constexpr static double d_Y_SHIFT = +0.987;
118 constexpr static double d_Z_SHIFT = -0.478;
119};
120} // namespace AMP::Operator
121
122#endif
double exactSolution_(double x, double y, double z) const
ManufacturedRotatedAnisotropicDiffusionModel(std::shared_ptr< AMP::Database > input_db)
double exactSolution(const AMP::Mesh::Point &p) const override
double sourceTerm_(double x, double y, double z) const
double sourceTerm(const AMP::Mesh::Point &p) const override
std::vector< double > getSecondOrderPDECoefficients3D() const
virtual double sourceTerm(const AMP::Mesh::Point &p) const =0
RotatedAnisotropicDiffusionModel(std::shared_ptr< AMP::Database > input_db)
virtual double exactSolution(const AMP::Mesh::Point &) const
std::vector< double > getSecondOrderPDECoefficients1D() const
std::vector< double > getSecondOrderPDECoefficients2D() const
#define AMP_ERROR(MSG)
Throw error.



Advanced Multi-Physics (AMP)
Oak Ridge National Laboratory
Idaho National Laboratory
Los Alamos National Laboratory
This page automatically produced from the
source code by doxygen
Last updated: Tue Mar 10 2026 13:06:41.
Comments on this page