NeoPZ
CedricTest.h
Go to the documentation of this file.
1 #ifndef CEDRICTEST_HH
2 #define CEDRICTEST_HH
3 
4 #include "pzmanvector.h"
5 #include "pzfmatrix.h"
6 #include "pzcmesh.h"
7 
8 class TPZGeoMesh;
9 
11 class TCedricTest {
12 
13 public:
15 
17 public:
18  TCedricTest();
19 
20  void GenerateNodes(TPZGeoMesh *gmesh, int64_t nelem);
21 
23  TPZGeoMesh *HexahedralMesh(int64_t nelem,int MaterialId);
24  TPZGeoMesh *PyramidalAndTetrahedralMesh(int64_t nelem,int MaterialId);
25  TPZGeoMesh *TetrahedralMesh(int64_t nelem,int MaterialId);
26  TPZGeoMesh *TetrahedralMeshUsingRefinement(int64_t nelem,int MaterialId);
27 
28  int AddBoundaryElements(TPZGeoMesh *gmesh);
29 
31 
33 
34  void UnwrapElements(TPZCompMesh *cmesh);
35 
36  static REAL fx(REAL x, REAL x0, REAL eps) {
37  REAL a = x*x*(1-x)*(1-x)*exp(-(x-x0)*(x-x0)/eps);
38 // REAL a = 4.*x*(1-x);
39  return a;
40  }
41 
42  static REAL dfx(REAL x, REAL x0, REAL eps) {
43  REAL a = 2*x*(1-x)*(1-x)*exp(-(x-x0)*(x-x0)/eps);
44  REAL b = -2*(1-x)*x*x*exp(-(x-x0)*(x-x0)/eps);
45  REAL c = -2.*(x-x0)*x*x*(1-x)*(1-x)*exp(-(x-x0)*(x-x0)/eps)/eps;
46  REAL result = a+b+c;
47 // REAL result = 4.*(1-2.*x);
48  return result;
49  }
50 
51  static REAL d2fx(REAL x, REAL x0, REAL eps) {
52 
53  REAL result = 2*pow(M_E,((x - x0)*(-x + x0))/eps)*(1 - x)*(1-x) -
54  8*pow(M_E,((x - x0)*(-x + x0))/eps)*(1 - x)*x +
55  2*pow(M_E,((x - x0)*(-x + x0))/eps)*(x*x) -
56  (2*pow(M_E,((x - x0)*(-x + x0))/eps)*(1 - x)*(1-x)*x*x)/eps +
57  4*pow(M_E,((x - x0)*(-x + x0))/eps)*(1 - x)*(1-x)*x*
58  (-((x - x0)/eps) + (-x + x0)/eps) -
59  4*pow(M_E,((x - x0)*(-x + x0))/eps)*(1 - x)*(x*x)*
60  (-((x - x0)/eps) + (-x + x0)/eps) +
61  pow(M_E,((x - x0)*(-x + x0))/eps)*(1 - x)*(1-x)*(x*x)*
62  (-((x - x0)/eps) + (-x + x0)/eps)*(-((x - x0)/eps) + (-x + x0)/eps);
63 // REAL result = -8.;
64  return result;
65  }
66 
67  static void Exact(const TPZVec<REAL> &x, TPZVec<STATE> &func, TPZFMatrix<STATE> &deriv) {
68  REAL v[3] = {fx(x[0],fX0[0],fEps[0]), fx(x[1],fX0[1],fEps[1]), fx(x[2],fX0[2],fEps[2])};
69  func[0] = v[0]*v[1]*v[2];
70  for(int i=0;i<3;i++) {
71  REAL dvz = dfx(x[i],fX0[i],fEps[i]);
72  deriv(i,0) = dvz*v[(i+1)%3]*v[(i+2)%3];
73  }
74  }
75 
77  void DeformGMesh(TPZGeoMesh &gmesh);
78 
80  void CheckConsistency(TPZGeoMesh *mesh);
81 
82  void Run(int nsubdivisions,int geocase,int POrder,int MaterialId,std::ostream &out=std::cout);
83 
84  void LoadInterpolation(TPZCompMesh *cmesh);
85 
86  void InterpolationError(int nsubdivisions,int geocase, int MaterialId,std::ostream &out);
87 };
88 
89 #endif
TPZGeoMesh * HexahedralMesh(int64_t nelem, int MaterialId)
Definition: CedricTest.cpp:617
int AddBoundaryElements(TPZGeoMesh *gmesh)
Definition: CedricTest.cpp:724
static REAL d2fx(REAL x, REAL x0, REAL eps)
Definition: CedricTest.h:51
TPZGeoMesh * TetrahedralMesh(int64_t nelem, int MaterialId)
Definition: CedricTest.cpp:502
void CheckConsistency(TPZGeoMesh *mesh)
verify if the faces without neighbour should be orthogonal to the main planes
Definition: CedricTest.cpp:652
void LoadInterpolation(TPZCompMesh *cmesh)
Definition: CedricTest.cpp:220
static void Exact(const TPZVec< REAL > &x, TPZVec< STATE > &func, TPZFMatrix< STATE > &deriv)
Definition: CedricTest.h:67
static REAL dfx(REAL x, REAL x0, REAL eps)
Definition: CedricTest.h:42
void GenerateNodes(TPZGeoMesh *gmesh, int64_t nelem)
Definition: CedricTest.cpp:441
void DeformGMesh(TPZGeoMesh &gmesh)
Deform the geometric mesh according to the coordinates of fDeformed.
Definition: CedricTest.cpp:79
static TPZManVector< REAL, 3 > fEps
Definition: CedricTest.h:14
void Run(int nsubdivisions, int geocase, int POrder, int MaterialId, std::ostream &out=std::cout)
Definition: CedricTest.cpp:246
TPZGeoMesh * PyramidalAndTetrahedralMesh(int64_t nelem, int MaterialId)
Definition: CedricTest.cpp:457
TPZGeoMesh * TetrahedralMeshUsingRefinement(int64_t nelem, int MaterialId)
Definition: CedricTest.cpp:544
void InterpolationError(int nsubdivisions, int geocase, int MaterialId, std::ostream &out)
Definition: CedricTest.cpp:92
Contains TPZMatrixclass which implements full matrix (using column major representation).
Free store vector implementation.
static TPZManVector< REAL, 3 > fX0
Definition: CedricTest.h:14
Contains declaration of TPZCompMesh class which is a repository for computational elements...
TPZFlopCounter pow(const TPZFlopCounter &orig, const TPZFlopCounter &xp)
Returns the power and increments the counter of the power.
Definition: pzreal.h:487
void CreateCondensedElements(TPZCompMesh *cmesh)
Definition: CedricTest.cpp:745
void UnwrapElements(TPZCompMesh *cmesh)
Definition: CedricTest.cpp:789
This class implements a geometric mesh for the pz environment. Geometry.
Definition: pzgmesh.h:48
Implements computational mesh. Computational Mesh.
Definition: pzcmesh.h:47
TPZCompMesh * GenerateCompMesh(TPZGeoMesh *gmesh)
Definition: CedricTest.cpp:700
expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ exp
Definition: tfadfunc.h:125
TPZGeoMesh fDeformed
Definition: CedricTest.h:16
static REAL fx(REAL x, REAL x0, REAL eps)
Definition: CedricTest.h:36