v0.9.0
FEMethod_UpLevelStudent.hpp
Go to the documentation of this file.
1 /* Copyright (C) 2013, Lukasz Kaczmarczyk (likask AT wp.pl)
2  * --------------------------------------------------------------
3  * FIXME: DESCRIPTION
4  */
5 
6 /* This file is part of MoFEM.
7  * MoFEM is free software: you can redistribute it and/or modify it under
8  * the terms of the GNU Lesser General Public License as published by the
9  * Free Software Foundation, either version 3 of the License, or (at your
10  * option) any later version.
11  *
12  * MoFEM is distributed in the hope that it will be useful, but WITHOUT
13  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
15  * License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with MoFEM. If not, see <http://www.gnu.org/licenses/>. */
19 
20 #ifndef __MOABFEMETHOD_UPLEVELSTUDENT_HPP__
21 #define __MOABFEMETHOD_UPLEVELSTUDENT_HPP__
22 
23 namespace ObosleteUsersModules {
24 
27  MoFEMException(MOFEM_DATA_INCONSISTENCY,"Negative volume") {}
28 };
29 
30 /**
31  * \brief The student user interface for FE method
32  *
33  * This class give user some data structures and methods on those that
34  * structures which could be useful.
35 */
37 
38  //TET
39  double V;
40  Tag th_volume;
41  vector<ublas::vector<double,ublas::bounded_array<double, 3> > > coords_at_Gauss_nodes; ///< vector of coordinates at Gauss points
42 
43  //PRISM
44  double area3,area4;
45  double coords_face3[9];
46  double coords_face4[9];
47  double normal3[3];
48  double normal4[3];
51 
52  FEMethod_UpLevelStudent(moab::Interface& _moab,int verbose = 0);
54 
55  /** \brief Initate data structures for running FE methods
56  *
57  * It has to be run at the begining of the function when tetrahedral element
58  * is evaluated.
59  *
60  * \param _gNTET_ vector of shape of tetrahedral functions evaluated at Gauss
61  * points
62  */
63  PetscErrorCode OpStudentStart_TET(vector<double>& _gNTET_);
64 
65  /** \brief Initate data structures for running FE methods
66  *
67  * It has to be run at the begining of the function when Interface PRISM
68  * element is evaluated. The matrix element shape functions are calculated in
69  * the form that degrees of shepe functon on one face (face4), have negative
70  * value comparing to oposite face. For example
71  * gap = ShapeN_FunForPrism * nodal_displacements.
72  *
73  *
74  * \param _gNTRI_ vector of shape of tetrahedral functions evaluated at Gauss
75  * points
76  */
77  PetscErrorCode OpStudentStart_PRISM(vector<double>& _gNTRI_);
78 
79  /**
80  * \brief Finalise data structures for running FE methods
81  *
82  * It has to be run at the end of the function
83  */
84  PetscErrorCode OpStudentEnd();
85 
86  /**
87  * \brief Copy gloabl indices for dofs adjacent to nodes
88  *
89  * \param field_name name of the approx. field
90  * \param vector on return stores global indices
91  */
92  PetscErrorCode GetRowGlobalIndices(const string &field_name,vector<DofIdx> &RowGlobDofs);
93 
94  PetscErrorCode GetRowLocalIndices(const string &field_name,vector<DofIdx> &RowLocalDofs);
95 
96  /**
97  * \brief Copy gloabl indices for dofs adjacent to entities
98  *
99  * \param field_name name of the approx. field
100  * \param type type of the entity (MBEDGE, MBTRI, MBTET or MBPRISM)
101  * \param vector on return stores global indices
102  * \param side_number do need to be specified for MBTET or MBPRISM
103  */
104  PetscErrorCode GetRowGlobalIndices(const string &field_name,EntityType type,vector<DofIdx> &RowGlobDofs,int side_number = -1);
105 
106  PetscErrorCode GetRowLocalIndices(const string &field_name,EntityType type,vector<DofIdx> &RowLocalDofs,int side_number = -1);
107 
108 
109  /**
110  * \brief Copy gloabl indices for dofs adjacent to nodes
111  *
112  * \param field_name name of the approx. field
113  * \param vector on return stores global indices
114  */
115  PetscErrorCode GetColGlobalIndices(const string &field_name,vector<DofIdx> &ColGlobDofs);
116  PetscErrorCode GetColLocalIndices(const string &field_name,vector<DofIdx> &ColLocalDofs);
117 
118 
119  /**
120  * \brief Copy gloabl indices for dofs adjacent to entities
121  *
122  * \param field_name name of the approx. field
123  * \param type type of the entity (MBEDGE, MBTRI, MBTET or MBPRISM)
124  * \param vector on return stores global indices
125  * \param side_number do need to be specified for MBTET or MBPRISM */
126  PetscErrorCode GetColGlobalIndices(const string &field_name,EntityType type,vector<DofIdx> &ColGlobDofs,int side_number = -1);
127  PetscErrorCode GetColLocalIndices(const string &field_name,EntityType type,vector<DofIdx> &ColGlobDofs,int side_number = -1);
128 
129  /**
130  * \brief Copy dofs values for dofs adjacent to nodes
131  *
132  * \param field_name name of the approx. field
133  * \param vector on return stores dofs values
134  */
135  PetscErrorCode GetDataVector(const string &field_name,ublas::vector<FieldData> &Data);
136 
137  /**
138  * \brief Copy dofs values for dofs adjacent to entities
139  *
140  * \param field_name name of the approx. field
141  * \param type type of the entity (MBEDGE, MBTRI, MBTET or MBPRISM)
142  * \param vector on return stores dofs values
143  * \param side_number do need to be specified for MBTET or MBPRISM
144  */
145  PetscErrorCode GetDataVector(const string &field_name,EntityType type,ublas::vector<FieldData> &Data,int side_number = -1);
146 
147 
148  /** \brief Field data at Gauss points for L2 and H1 space
149  *
150  * Note that size of the global vector is determined by number of gauss
151  * points in shape functions, f.e. in case of tetrahedral (MBTET) g_dim =
152  * g_NTET.size()/4
153  *
154  * \param field_name name of the approx. field
155  * \param vector of vectors on return values of field at gauss points
156  &
157  */
158  PetscErrorCode GetGaussDataVector(const string &field_name,vector<ublas::vector<FieldData> > &Data);
159 
160  /** \brief Field data direvatives at Gauss points for L2 and H1 space
161  *
162  * Note that size of the global vector is determined by number of gauss
163  * points in shape functions, f.e. in case of tetrahedral (MBTET) g_dim =
164  * g_NTET.size()/4
165  *
166  * \param field_name name of the approx. field
167  * \param vector on return direvatives of the field at gauss points
168  */
169  PetscErrorCode GetGaussDiffDataVector(const string &field_name,vector< ublas::matrix<FieldData> > &Data);
170 
171  /** \brief Copy shape functions for nodes
172  *
173  * Note that size of the global vector is determined by number of gauss
174  * points in shape functions, f.e. in case of tetrahedral (MBTET) g_dim =
175  * g_NTET.size()/4
176  *
177  * \param field_name name of the approx. field
178  * \param vector on return stores
179  * values of field at gauss points
180  */
181  PetscErrorCode GetGaussRowNMatrix(const string &field_name,vector< ublas::matrix<FieldData> > &NMatrix);
182 
183  /** \brief Copy shape functions for entities and given side number
184  *
185  * Note that size of the global vector is determined by number of gauss
186  * points in shape functions, f.e. in case of tetrahedral (MBTET) g_dim =
187  * g_NTET.size()/4
188  *
189  * \param field_name name of the approx. field
190  * \param type type of the entity (MBEDGE, MBTRI, MBTET or MBPRISM)
191  * \param vector on return stores
192  * \param side_number do need to be specified for MBTET or MBPRISM
193  */
194  PetscErrorCode GetGaussRowNMatrix(const string &field_name,EntityType type,vector< ublas::matrix<FieldData> > &NMatrix,int side_number = -1);
195 
196  /** \brief Copy shape functions for nodes
197  *
198  * Note that size of the global vector is determined by number of gauss
199  * points in shape functions, f.e. in case of tetrahedral (MBTET) g_dim =
200  * g_NTET.size()/4
201  *
202  * \param field_name name of the approx. field
203  * \param vector on return stores
204  * values of field at gauss points
205  */
206  PetscErrorCode GetGaussColNMatrix(const string &field_name,vector< ublas::matrix<FieldData> > &NMatrix);
207 
208  /** \brief Copy shape functions for entities and given side number
209  *
210  * Note that size of the global vector is determined by number of gauss
211  * points in shape functions, f.e. in case of tetrahedral (MBTET) g_dim =
212  * g_NTET.size()/4
213  *
214  * \param field_name name of the approx. field
215  * \param type type of the entity (MBEDGE, MBTRI, MBTET or MBPRISM)
216  * \param vector on return stores
217  * \param side_number do need to be specified for MBTET or MBPRISM
218  */
219  PetscErrorCode GetGaussColNMatrix(const string &field_name,EntityType type,vector< ublas::matrix<FieldData> > &NMatrix,int side_number = -1);
220 
221  /** \brief Copy derivative shape functions for nodes
222  *
223  * Note that size of the global vector is determined by number of gauss
224  * points in shape functions, f.e. in case of tetrahedral (MBTET) g_dim =
225  * g_NTET.size()/4
226  *
227  * \param field_name name of the approx. field
228  * \param vector on return stores
229  * values of field at gauss points
230  */
231  PetscErrorCode GetGaussRowDiffNMatrix(const string &field_name,vector< ublas::matrix<FieldData> > &diffNMatrix);
232 
233  /** \brief Copy derivative shape functions for entities and given side number
234  *
235  * Note that size of the global vector is determined by number of gauss
236  * points in shape functions, f.e. in case of tetrahedral (MBTET) g_dim =
237  * g_NTET.size()/4
238  *
239  * \param field_name name of the approx. field
240  * \param type type of the entity (MBEDGE, MBTRI, MBTET or MBPRISM)
241  * \param vector on return stores
242  * \param side_number do need to be specified for MBTET or MBPRISM
243  */
244  PetscErrorCode GetGaussRowDiffNMatrix(const string &field_name,EntityType type,vector< ublas::matrix<FieldData> > &diffNMatrix,int side_number = -1);
245 
246  /** \brief Copy derivative shape functions for nodes
247  *
248  * Note that size of the global vector is determined by number of gauss
249  * points in shape functions, f.e. in case of tetrahedral (MBTET) g_dim =
250  * g_NTET.size()/4
251  *
252  * \param field_name name of the approx. field
253  * \param vector on return stores
254  * values of field at gauss points
255  */
256  PetscErrorCode GetGaussColDiffNMatrix(const string &field_name,vector< ublas::matrix<FieldData> > &diffNMatrix);
257 
258  /** \brief Copy derivative shape functions for entities and given side number
259  *
260  * Note that size of the global vector is determined by number of gauss
261  * points in shape functions, f.e. in case of tetrahedral (MBTET) g_dim =
262  * g_NTET.size()/4
263  *
264  * \param field_name name of the approx. field
265  * \param type type of the entity (MBEDGE, MBTRI, MBTET or MBPRISM)
266  * \param vector on return stores
267  * \param side_number do need to be specified for MBTET or MBPRISM
268  */
269  PetscErrorCode GetGaussColDiffNMatrix(const string &field_name,EntityType type,vector< ublas::matrix<FieldData> > &diffNMatrix,int side_number = -1);
270 
271  /**
272  * \brief Make B matrix for 3D field
273  *
274  * For more detail look page 30 CHAPTER 6. DISPLACEMENT METHODS, FEAP Version 7.3 Theory Manual Robert L. Taylor
275  *
276  */
277  PetscErrorCode MakeBMatrix3D(const string &field_name,
278  vector<ublas::matrix<FieldData> > &diffNMatrix,vector<ublas::matrix<FieldData> > &BMatrix);
279 
280  /** \brief Get shape functions for integration on the face
281  *
282  * Note that size of the global vector is determined by number of gauss
283  * points in shape functions on the face, face which is triangle g_dim =
284  * g_NTRI.size()/3
285  *
286  * \param EntityHandle moab entity handle to face (MBTRI) on tetrahedral (MBTET)
287  * \param field_name name of the approx. field
288  * \param vector on return stores
289  * \param entity type on face (MBVERTEX, MBEDGE or MBTRI)
290  * \param entity hande on face (it need to be given when entity type is MBEDEGE)
291  * values of field at gauss points
292  */
293  PetscErrorCode GetGaussRowFaceNMatrix(
294  EntityHandle ent,const string &field_name,vector< ublas::matrix<FieldData> > &diffNMatrix,
295  EntityType type = MBMAXTYPE,EntityHandle edge_handle = no_handle);
296 
297  /**
298  * \brief hierarhical gemetry approximation, jacobian and determinant of jacobian
299  */
300  PetscErrorCode GetHierarchicalGeometryApproximation(vector< ublas::matrix<FieldData> > &invH,vector< FieldData > &detH);
301 
302  /**
303  * \brief hierarhical gemetry approximation, diff shape functions
304  */
305  PetscErrorCode GetHierarchicalGeometryApproximation_ApplyToDiffShapeFunction(int rank,vector< ublas::matrix<FieldData> > &invH,vector< ublas::matrix<FieldData> > &diffNMatrix);
306 
307 };
308 
309 }
310 
311 #endif // __MOABFEMETHOD_UPLEVELSTUDENT_HPP__
PetscErrorCode GetGaussRowNMatrix(const string &field_name, vector< ublas::matrix< FieldData > > &NMatrix)
Copy shape functions for nodes.
PetscErrorCode GetGaussRowFaceNMatrix(EntityHandle ent, const string &field_name, vector< ublas::matrix< FieldData > > &diffNMatrix, EntityType type=MBMAXTYPE, EntityHandle edge_handle=no_handle)
Get shape functions for integration on the face.
PetscErrorCode GetRowLocalIndices(const string &field_name, vector< DofIdx > &RowLocalDofs)
PetscErrorCode GetHierarchicalGeometryApproximation(vector< ublas::matrix< FieldData > > &invH, vector< FieldData > &detH)
hierarhical gemetry approximation, jacobian and determinant of jacobian
The student user interface for FE method.
PetscErrorCode GetGaussColDiffNMatrix(const string &field_name, vector< ublas::matrix< FieldData > > &diffNMatrix)
Copy derivative shape functions for nodes.
PetscErrorCode GetHierarchicalGeometryApproximation_ApplyToDiffShapeFunction(int rank, vector< ublas::matrix< FieldData > > &invH, vector< ublas::matrix< FieldData > > &diffNMatrix)
hierarhical gemetry approximation, diff shape functions
const EntityHandle no_handle
No entity handle is indicated by zero handle, i.e. root meshset.
Definition: Common.hpp:27
FEMethod_UpLevelStudent(moab::Interface &_moab, int verbose=0)
PetscErrorCode OpStudentStart_PRISM(vector< double > &_gNTRI_)
Initate data structures for running FE methods.
PetscErrorCode GetGaussRowDiffNMatrix(const string &field_name, vector< ublas::matrix< FieldData > > &diffNMatrix)
Copy derivative shape functions for nodes.
PetscErrorCode GetGaussDiffDataVector(const string &field_name, vector< ublas::matrix< FieldData > > &Data)
Field data direvatives at Gauss points for L2 and H1 space.
PetscErrorCode GetDataVector(const string &field_name, ublas::vector< FieldData > &Data)
Copy dofs values for dofs adjacent to nodes.
PetscErrorCode GetRowGlobalIndices(const string &field_name, vector< DofIdx > &RowGlobDofs)
Copy gloabl indices for dofs adjacent to nodes.
PetscErrorCode MakeBMatrix3D(const string &field_name, vector< ublas::matrix< FieldData > > &diffNMatrix, vector< ublas::matrix< FieldData > > &BMatrix)
Make B matrix for 3D field.
PetscErrorCode OpStudentStart_TET(vector< double > &_gNTET_)
Initate data structures for running FE methods.
PetscErrorCode GetGaussDataVector(const string &field_name, vector< ublas::vector< FieldData > > &Data)
Field data at Gauss points for L2 and H1 space.
PetscErrorCode OpStudentEnd()
Finalise data structures for running FE methods.
vector< ublas::vector< double, ublas::bounded_array< double, 3 > > > coords_at_Gauss_nodes
vector of coordinates at Gauss points
PetscErrorCode GetColLocalIndices(const string &field_name, vector< DofIdx > &ColLocalDofs)
PetscErrorCode GetGaussColNMatrix(const string &field_name, vector< ublas::matrix< FieldData > > &NMatrix)
Copy shape functions for nodes.
PetscErrorCode GetColGlobalIndices(const string &field_name, vector< DofIdx > &ColGlobDofs)
Copy gloabl indices for dofs adjacent to nodes.
Name space of classes and methods which are obsolete.