v0.9.0
Classes | Macros | Functions | Variables
nonlinear_elasticity_atom.cpp File Reference
#include <MoFEM.hpp>
#include <MethodForForceScaling.hpp>
#include <DirichletBC.hpp>
#include <Projection10NodeCoordsOnField.hpp>
#include <boost/numeric/ublas/vector_proxy.hpp>
#include <boost/numeric/ublas/matrix.hpp>
#include <boost/numeric/ublas/matrix_proxy.hpp>
#include <boost/numeric/ublas/vector.hpp>
#include <SurfacePressure.hpp>
#include <NodalForce.hpp>
#include <FluidPressure.hpp>
#include <BodyForce.hpp>
#include <ThermalStressElement.hpp>
#include <FEMethod_LowLevelStudent.hpp>
#include <FEMethod_UpLevelStudent.hpp>
#include <PostProcVertexMethod.hpp>
#include <PostProcDisplacementAndStrainOnRefindedMesh.hpp>
#include <complex_for_lazy.h>
#include <ArcLengthTools.hpp>
#include <FEMethod_ComplexForLazy.hpp>
#include <FEMethod_DriverComplexForLazy.hpp>
#include <SurfacePressureComplexForLazy.hpp>
#include <PostProcNonLinearElasticityStresseOnRefindedMesh.hpp>

Go to the source code of this file.

Classes

struct  NL_ElasticFEMethod
 

Macros

#define RND_EPS   1e-6
 

Functions

double roundn (double n)
 
int main (int argc, char *argv[])
 

Variables

static char help [] = "...\n\n"
 
static int debug = 1
 

Macro Definition Documentation

◆ RND_EPS

#define RND_EPS   1e-6

Definition at line 60 of file nonlinear_elasticity_atom.cpp.

Function Documentation

◆ main()

int main ( int  argc,
char *  argv[] 
)

Definition at line 87 of file nonlinear_elasticity_atom.cpp.

87  {
88 
89  PetscInitialize(&argc,&argv,(char *)0,help);
90 
91  try {
92 
93  moab::Core mb_instance;
94  moab::Interface& moab = mb_instance;
95  int rank;
96  MPI_Comm_rank(PETSC_COMM_WORLD,&rank);
97 
98  PetscBool flg = PETSC_TRUE;
99  char mesh_file_name[255];
100  ierr = PetscOptionsGetString(PETSC_NULL,"-my_file",mesh_file_name,255,&flg); CHKERRQ(ierr);
101  if(flg != PETSC_TRUE) {
102  SETERRQ(PETSC_COMM_SELF,1,"*** ERROR -my_file (MESH FILE NEEDED)");
103  }
104 
105  const char *option;
106  option = "";//"PARALLEL=BCAST;";//;DEBUG_IO";
107  rval = moab.load_file(mesh_file_name, 0, option); CHKERRQ_MOAB(rval);
108  ParallelComm* pcomm = ParallelComm::get_pcomm(&moab,MYPCOMM_INDEX);
109  if(pcomm == NULL) pcomm = new ParallelComm(&moab,PETSC_COMM_WORLD);
110 
111  MoFEM::Core core(moab);
112  MoFEM::Interface& m_field = core;
113 
114  Range CubitSIDESETs_meshsets;
115  ierr = m_field.get_cubit_meshsets(SIDESET,CubitSIDESETs_meshsets); CHKERRQ(ierr);
116 
117  //ref meshset ref level 0
118  ierr = m_field.seed_ref_level_3D(0,0); CHKERRQ(ierr);
119  BitRefLevel bit_level0;
120  bit_level0.set(0);
121  EntityHandle meshset_level0;
122  rval = moab.create_meshset(MESHSET_SET,meshset_level0); CHKERRQ_MOAB(rval);
123  ierr = m_field.seed_ref_level_3D(0,bit_level0); CHKERRQ(ierr);
124  ierr = m_field.get_entities_by_ref_level(bit_level0,BitRefLevel().set(),meshset_level0); CHKERRQ(ierr);
125 
126  //Fields
127  ierr = m_field.add_field("SPATIAL_POSITION",H1,AINSWORTH_LEGENDRE_BASE,3); CHKERRQ(ierr);
128 
129  //FE
130  ierr = m_field.add_finite_element("ELASTIC"); CHKERRQ(ierr);
131 
132  //Define rows/cols and element data
133  ierr = m_field.modify_finite_element_add_field_row("ELASTIC","SPATIAL_POSITION"); CHKERRQ(ierr);
134  ierr = m_field.modify_finite_element_add_field_col("ELASTIC","SPATIAL_POSITION"); CHKERRQ(ierr);
135  ierr = m_field.modify_finite_element_add_field_data("ELASTIC","SPATIAL_POSITION"); CHKERRQ(ierr);
136 
137  //define problems
138  ierr = m_field.add_problem("ELASTIC_MECHANICS"); CHKERRQ(ierr);
139 
140  //set finite elements for problems
141  ierr = m_field.modify_problem_add_finite_element("ELASTIC_MECHANICS","ELASTIC"); CHKERRQ(ierr);
142 
143  //set refinement level for problem
144  ierr = m_field.modify_problem_ref_level_add_bit("ELASTIC_MECHANICS",bit_level0); CHKERRQ(ierr);
145 
146  //add entitities (by tets) to the field
147  ierr = m_field.add_ents_to_field_by_type(0,MBTET,"SPATIAL_POSITION"); CHKERRQ(ierr);
148 
149  //add finite elements entities
150  ierr = m_field.add_ents_to_finite_element_by_bit_ref(bit_level0,BitRefLevel().set(),"ELASTIC",MBTET); CHKERRQ(ierr);
151 
152  //set app. order
153  PetscInt order;
154  ierr = PetscOptionsGetInt(PETSC_NULL,"-my_order",&order,&flg); CHKERRQ(ierr);
155  if(flg != PETSC_TRUE) {
156  order = 4;
157  }
158  ierr = m_field.set_field_order(0,MBTET,"SPATIAL_POSITION",order); CHKERRQ(ierr);
159  ierr = m_field.set_field_order(0,MBTRI,"SPATIAL_POSITION",order); CHKERRQ(ierr);
160  ierr = m_field.set_field_order(0,MBEDGE,"SPATIAL_POSITION",order); CHKERRQ(ierr);
161  ierr = m_field.set_field_order(0,MBVERTEX,"SPATIAL_POSITION",1); CHKERRQ(ierr);
162 
163  ierr = m_field.add_finite_element("NEUAMNN_FE"); CHKERRQ(ierr);
164  ierr = m_field.modify_finite_element_add_field_row("NEUAMNN_FE","SPATIAL_POSITION"); CHKERRQ(ierr);
165  ierr = m_field.modify_finite_element_add_field_col("NEUAMNN_FE","SPATIAL_POSITION"); CHKERRQ(ierr);
166  ierr = m_field.modify_finite_element_add_field_data("NEUAMNN_FE","SPATIAL_POSITION"); CHKERRQ(ierr);
167  ierr = m_field.modify_problem_add_finite_element("ELASTIC_MECHANICS","NEUAMNN_FE"); CHKERRQ(ierr);
169  Range tris;
170  rval = moab.get_entities_by_type(it->meshset,MBTRI,tris,true); CHKERRQ_MOAB(rval);
171  ierr = m_field.add_ents_to_finite_element_by_type(tris,MBTRI,"NEUAMNN_FE"); CHKERRQ(ierr);
172  }
174  Range tris;
175  rval = moab.get_entities_by_type(it->meshset,MBTRI,tris,true); CHKERRQ_MOAB(rval);
176  ierr = m_field.add_ents_to_finite_element_by_type(tris,MBTRI,"NEUAMNN_FE"); CHKERRQ(ierr);
177  }
178 
179  #ifdef NONLINEAR_TEMPERATUTE
180 
181  ierr = m_field.add_field("TEMPERATURE",H1,AINSWORTH_LEGENDRE_BASE,1); CHKERRQ(ierr);
182  ierr = m_field.modify_finite_element_add_field_data("ELASTIC","TEMPERATURE"); CHKERRQ(ierr);
183  ierr = m_field.add_ents_to_field_by_type(0,MBTET,"TEMPERATURE"); CHKERRQ(ierr);
184  ierr = m_field.set_field_order(0,MBTET,"TEMPERATURE",1); CHKERRQ(ierr);
185  ierr = m_field.set_field_order(0,MBTRI,"TEMPERATURE",1); CHKERRQ(ierr);
186  ierr = m_field.set_field_order(0,MBEDGE,"TEMPERATURE",1); CHKERRQ(ierr);
187  ierr = m_field.set_field_order(0,MBVERTEX,"TEMPERATURE",1); CHKERRQ(ierr);
188 
189  #endif //NONLINEAR_TEMPERATUTE
190 
191  //build field
192  ierr = m_field.build_fields(); CHKERRQ(ierr);
193 
194  {
195  EntityHandle node = 0;
196  double coords[3];
197  for(_IT_GET_DOFS_FIELD_BY_NAME_FOR_LOOP_(m_field,"SPATIAL_POSITION",dof_ptr)) {
198  if(dof_ptr->get()->getEntType()!=MBVERTEX) continue;
199  EntityHandle ent = dof_ptr->get()->getEnt();
200  int dof_rank = dof_ptr->get()->getDofCoeffIdx();
201  double &fval = dof_ptr->get()->getFieldData();
202  if(node!=ent) {
203  rval = moab.get_coords(&ent,1,coords); CHKERRQ_MOAB(rval);
204  node = ent;
205  }
206  fval = coords[dof_rank];
207  }
208  }
209 
210  #ifdef NONLINEAR_TEMPERATUTE
211 
212  {
213  EntityHandle node = 0;
214  double coords[3];
215  for(_IT_GET_DOFS_FIELD_BY_NAME_FOR_LOOP_(m_field,"TEMPERATURE",dof_ptr)) {
216  if(dof_ptr->getEntType()!=MBVERTEX) continue;
217  EntityHandle ent = dof_ptr->getEnt();
218  if(node!=ent) {
219  rval = moab.get_coords(&ent,1,coords); CHKERRQ_MOAB(rval);
220  node = ent;
221  }
222  double &fval = dof_ptr->getFieldData();
223  fval = coords[0];
224  }
225  }
226 
227  #endif //NONLINEAR_TEMPERATUTE
228 
229  //build finite elemnts
230  ierr = m_field.build_finite_elements(); CHKERRQ(ierr);
231 
232  //build adjacencies
233  ierr = m_field.build_adjacencies(bit_level0); CHKERRQ(ierr);
234 
235  //build problem
236  ierr = m_field.build_problems(); CHKERRQ(ierr);
237 
238  //partition
239  ierr = m_field.partition_problem("ELASTIC_MECHANICS"); CHKERRQ(ierr);
240  ierr = m_field.partition_finite_elements("ELASTIC_MECHANICS"); CHKERRQ(ierr);
241  ierr = m_field.partition_ghost_dofs("ELASTIC_MECHANICS"); CHKERRQ(ierr);
242 
243  //create matrices
244  Vec F;
245  ierr = m_field.VecCreateGhost("ELASTIC_MECHANICS",COL,&F); CHKERRQ(ierr);
246  Vec D;
247  ierr = VecDuplicate(F,&D); CHKERRQ(ierr);
248  Mat Aij;
249  ierr = m_field.MatCreateMPIAIJWithArrays("ELASTIC_MECHANICS",&Aij); CHKERRQ(ierr);
250 
251  const double young_modulus = 1.;
252  const double poisson_ratio = 0.;
253  NL_ElasticFEMethod my_fe(m_field,LAMBDA(young_modulus,poisson_ratio),MU(young_modulus,poisson_ratio));
254  #ifdef NONLINEAR_TEMPERATUTE
255  my_fe.thermal_expansion = 0.1;
256  #endif //NONLINEAR_TEMPERATUTE
257 
258  NeummanForcesSurfaceComplexForLazy neumann_forces(m_field,Aij,F);
259  NeummanForcesSurfaceComplexForLazy::MyTriangleSpatialFE &fe_spatial = neumann_forces.getLoopSpatialFe();
261  ierr = fe_spatial.addForce(it->getMeshsetId()); CHKERRQ(ierr);
262  }
264  ierr = fe_spatial.addPreassure(it->getMeshsetId()); CHKERRQ(ierr);
265  }
266 
267  SpatialPositionsBCFEMethodPreAndPostProc MyDirichletBC(m_field,"SPATIAL_POSITION",Aij,D,F);
268 
269  SnesCtx snes_ctx(m_field,"ELASTIC_MECHANICS");
270 
271  SNES snes;
272  ierr = SNESCreate(PETSC_COMM_WORLD,&snes); CHKERRQ(ierr);
273  ierr = SNESSetApplicationContext(snes,&snes_ctx); CHKERRQ(ierr);
274  ierr = SNESSetFunction(snes,F,SnesRhs,&snes_ctx); CHKERRQ(ierr);
275  ierr = SNESSetJacobian(snes,Aij,Aij,SnesMat,&snes_ctx); CHKERRQ(ierr);
276  ierr = SNESSetFromOptions(snes); CHKERRQ(ierr);
277 
278  SnesCtx::loops_to_do_type& loops_to_do_Rhs = snes_ctx.get_loops_to_do_Rhs();
279  snes_ctx.get_preProcess_to_do_Rhs().push_back(&MyDirichletBC);
280  loops_to_do_Rhs.push_back(SnesCtx::loop_pair_type("ELASTIC",&my_fe));
281  loops_to_do_Rhs.push_back(SnesCtx::loop_pair_type("NEUAMNN_FE",&fe_spatial));
282  snes_ctx.get_postProcess_to_do_Rhs().push_back(&MyDirichletBC);
283 
284  SnesCtx::loops_to_do_type& loops_to_do_Mat = snes_ctx.get_loops_to_do_Mat();
285  snes_ctx.get_preProcess_to_do_Mat().push_back(&MyDirichletBC);
286  loops_to_do_Mat.push_back(SnesCtx::loop_pair_type("ELASTIC",&my_fe));
287  loops_to_do_Mat.push_back(SnesCtx::loop_pair_type("NEUAMNN_FE",&fe_spatial));
288  snes_ctx.get_postProcess_to_do_Mat().push_back(&MyDirichletBC);
289 
290  ierr = m_field.set_local_ghost_vector("ELASTIC_MECHANICS",COL,D,INSERT_VALUES,SCATTER_FORWARD); CHKERRQ(ierr);
291  ierr = VecGhostUpdateBegin(D,INSERT_VALUES,SCATTER_FORWARD); CHKERRQ(ierr);
292  ierr = VecGhostUpdateEnd(D,INSERT_VALUES,SCATTER_FORWARD); CHKERRQ(ierr);
293 
294  double step_size = -1.;
295  ierr = neumann_forces.setForceScale(step_size); CHKERRQ(ierr);
296  ierr = SNESSolve(snes,PETSC_NULL,D); CHKERRQ(ierr);
297  int its;
298  ierr = SNESGetIterationNumber(snes,&its); CHKERRQ(ierr);
299  ierr = PetscPrintf(PETSC_COMM_WORLD,"number of Newton iterations = %D\n",its); CHKERRQ(ierr);
300  ierr = VecGhostUpdateBegin(D,INSERT_VALUES,SCATTER_FORWARD); CHKERRQ(ierr);
301  ierr = VecGhostUpdateEnd(D,INSERT_VALUES,SCATTER_FORWARD); CHKERRQ(ierr);
302 
303  {
304 
305  //Open mesh_file_name.txt for writing
306  ofstream myfile;
307  #ifdef NONLINEAR_TEMPERATUTE
308  myfile.open(("nonlinear_thermal_expansion_"+string(mesh_file_name)+".txt").c_str());
309  #else
310  myfile.open(("nonlinear_"+string(mesh_file_name)+".txt").c_str());
311  #endif
312 
313  //Output displacements
314  cout << "<<<< Displacements (X-Translation, Y-Translation, Z-Translation) >>>>>" << endl;
315  myfile << "<<<< Displacements (X-Translation, Y-Translation, Z-Translation) >>>>>" << endl;
316 
317  const DofEntity_multiIndex *dofs_ptr;
318  ierr = m_field.get_dofs(&dofs_ptr); CHKERRQ(ierr);
320  for(_IT_GET_DOFS_FIELD_BY_NAME_FOR_LOOP_(m_field,"SPATIAL_POSITION",dof_ptr)) {
321  if(dof_ptr->get()->getEntType()!=MBVERTEX) continue;
322  dofs_view.insert(*dof_ptr);
323  }
324  for(
325  DofEntity_multiIndex_uid_view::iterator
326  dit=dofs_view.begin();dit!=dofs_view.end();dit++
327  ) {
328  double coords[3];
329  EntityHandle ent = dit->get()->getEnt();
330  rval = moab.get_coords(&ent,1,coords); CHKERRQ_MOAB(rval);
331 
332  if(dit->get()->getDofCoeffIdx()==0)
333  {
334  //Round and truncate to 3 decimal places
335  double fval = dit->get()->getFieldData()-coords[dit->get()->getDofCoeffIdx()];
336  cout << boost::format("%.3lf") % roundn(fval) << " ";
337  myfile << boost::format("%.3lf") % roundn(fval) << " ";
338  }
339  if(dit->get()->getDofCoeffIdx()==1)
340  {
341  //Round and truncate to 3 decimal places
342  double fval = dit->get()->getFieldData()-coords[dit->get()->getDofCoeffIdx()];
343  cout << boost::format("%.3lf") % roundn(fval) << " ";
344  myfile << boost::format("%.3lf") % roundn(fval) << " ";
345  }
346  if(dit->get()->getDofCoeffIdx()==2)
347  {
348  //Round and truncate to 3 decimal places
349  double fval = dit->get()->getFieldData()-coords[dit->get()->getDofCoeffIdx()];
350  cout << boost::format("%.3lf") % roundn(fval) << endl;
351  myfile << boost::format("%.3lf") % roundn(fval) << endl;
352  }
353 
354  }
355 
356  }
357 
358  if(debug) {
359 
360  //Save data on mesh
361  ierr = m_field.set_global_ghost_vector("ELASTIC_MECHANICS",COL,D,INSERT_VALUES,SCATTER_REVERSE); CHKERRQ(ierr);
362  //ierr = VecView(F,PETSC_VIEWER_STDOUT_WORLD); CHKERRQ(ierr);
363  PostProcVertexMethod ent_method(moab,"SPATIAL_POSITION");
364  ierr = m_field.loop_dofs("ELASTIC_MECHANICS","SPATIAL_POSITION",COL,ent_method); CHKERRQ(ierr);
365 
366  if(pcomm->rank()==0) {
367  EntityHandle out_meshset;
368  rval = moab.create_meshset(MESHSET_SET,out_meshset); CHKERRQ_MOAB(rval);
369  ierr = m_field.get_problem_finite_elements_entities("ELASTIC_MECHANICS","ELASTIC",out_meshset); CHKERRQ(ierr);
370  rval = moab.write_file("out.vtk","VTK","",&out_meshset,1); CHKERRQ_MOAB(rval);
371  rval = moab.delete_entities(&out_meshset,1); CHKERRQ_MOAB(rval);
372  }
373 
374  PostProcFieldsAndGradientOnRefMesh fe_post_proc_method(moab);
375  ierr = m_field.loop_finite_elements("ELASTIC_MECHANICS","ELASTIC",fe_post_proc_method); CHKERRQ(ierr);
376  if(pcomm->rank()==0) {
377  rval = fe_post_proc_method.moab_post_proc.write_file("out_post_proc.vtk","VTK",""); CHKERRQ_MOAB(rval);
378  }
379 
380  }
381 
382  //detroy matrices
383  ierr = VecDestroy(&F); CHKERRQ(ierr);
384  ierr = VecDestroy(&D); CHKERRQ(ierr);
385  ierr = MatDestroy(&Aij); CHKERRQ(ierr);
386  ierr = SNESDestroy(&snes); CHKERRQ(ierr);
387 
388 
389  } catch (MoFEMException const &e) {
390  SETERRQ(PETSC_COMM_SELF,e.errorCode,e.errorMessage);
391  }
392 
393  PetscFinalize();
394 
395  return 0;
396 }
#define CHKERRQ_MOAB(a)
check error code of MoAB function
Definition: definitions.h:515
virtual MoFEMErrorCode add_ents_to_finite_element_by_bit_ref(const BitRefLevel &bit, const BitRefLevel &mask, const std::string &name, EntityType type, int verb=DEFAULT_VERBOSITY)=0
add TET entities from given refinement level to finite element database given by name
virtual MoFEMErrorCode modify_finite_element_add_field_col(const std::string &fe_name, const std::string &name_row)=0
set field col which finite element use
multi_index_container< boost::shared_ptr< DofEntity >, indexed_by< ordered_unique< const_mem_fun< DofEntity, const UId &, &DofEntity::getGlobalUniqueId > > > > DofEntity_multiIndex_uid_view
multi-index view on DofEntity by uid
#define LAMBDA(E, NU)
Definition: fem_tools.h:32
virtual MoFEMErrorCode add_ents_to_finite_element_by_type(const EntityHandle entities, const EntityType type, const std::string &name, const bool recursive=true)=0
add entities to finite element
virtual MoFEMErrorCode build_adjacencies(const Range &ents, int verb=DEFAULT_VERBOSITY)=0
build adjacencies
DEPRECATED MoFEMErrorCode set_global_ghost_vector(const Problem *problem_ptr, RowColData rc, Vec V, InsertMode mode, ScatterMode scatter_mode) const
set values of vector from/to mesh database (collective)collective - need tu be run on all processors ...
DEPRECATED MoFEMErrorCode get_entities_by_ref_level(const BitRefLevel &bit, const BitRefLevel &mask, const EntityHandle meshset)
add all ents from ref level given by bit to meshset
DEPRECATED MoFEMErrorCode get_cubit_meshsets(const unsigned int cubit_bc_type, Range &meshsets)
get all CUBIT meshsets by CUBIT type
virtual DEPRECATED MoFEMErrorCode build_problems(int verb=-1)=0
build problem data structures
PetscErrorCode SnesMat(SNES snes, Vec x, Mat A, Mat B, void *ctx)
This is MoFEM implementation for the left hand side (tangent matrix) evaluation in SNES solver.
Definition: SnesCtx.cpp:121
virtual MoFEMErrorCode modify_problem_add_finite_element(const std::string &name_problem, const std::string &fe_name)=0
add finite element to problem, this add entities assigned to finite element to a particular problem
DEPRECATED MoFEMErrorCode set_local_ghost_vector(const Problem *problem_ptr, RowColData rc, Vec V, InsertMode mode, ScatterMode scatter_mode) const
set values of vector from/to meshdatabase
virtual MoFEMErrorCode add_field(const std::string &name, const FieldSpace space, const FieldApproximationBase base, const FieldCoefficientsNumber nb_of_coefficients, const TagType tag_type=MB_TAG_SPARSE, const enum MoFEMTypes bh=MF_EXCL, int verb=DEFAULT_VERBOSITY)=0
Add field.
virtual MoFEMErrorCode set_field_order(const EntityHandle meshset, const EntityType type, const std::string &name, const ApproximationOrder order, int verb=DEFAULT_VERBOSITY)=0
Set order approximation of the entities in the field.
Core (interface) class.
Definition: Core.hpp:50
char mesh_file_name[255]
virtual MoFEMErrorCode get_dofs(const DofEntity_multiIndex **dofs_ptr) const =0
Get dofs multi index.
static char help[]
static MoFEMErrorCodeGeneric< moab::ErrorCode > rval
Definition: Exceptions.hpp:84
DEPRECATED typedef NeumannForcesSurfaceComplexForLazy NeummanForcesSurfaceComplexForLazy
PetscErrorCode PetscOptionsGetString(PetscOptions *, const char pre[], const char name[], char str[], size_t size, PetscBool *set)
DEPRECATED MoFEMErrorCode partition_finite_elements(const std::string &name, bool part_from_moab=false, int low_proc=-1, int hi_proc=-1, int verb=-1)
partition finite elements
double roundn(double n)
multi_index_container< boost::shared_ptr< DofEntity >, indexed_by< ordered_unique< tag< Unique_mi_tag >, member< DofEntity, UId, &DofEntity::globalUId > >, ordered_non_unique< tag< Composite_Name_And_Ent_And_EntDofIdx_mi_tag >, composite_key< DofEntity, const_mem_fun< DofEntity::interface_type_Field, boost::string_ref, &DofEntity::getNameRef >, const_mem_fun< DofEntity, EntityHandle, &DofEntity::getEnt >, const_mem_fun< DofEntity, DofIdx, &DofEntity::getEntDofIdx > > >, ordered_non_unique< tag< Unique_Ent_mi_tag >, const_mem_fun< DofEntity, const UId &, &DofEntity::getEntGlobalUniqueId > >, ordered_non_unique< tag< FieldName_mi_tag >, const_mem_fun< DofEntity::interface_type_Field, boost::string_ref, &DofEntity::getNameRef > >, ordered_non_unique< tag< Ent_mi_tag >, const_mem_fun< DofEntity, EntityHandle, &DofEntity::getEnt > >, ordered_non_unique< tag< Composite_Name_And_Ent_mi_tag >, composite_key< DofEntity, const_mem_fun< DofEntity::interface_type_Field, boost::string_ref, &DofEntity::getNameRef >, const_mem_fun< DofEntity, EntityHandle, &DofEntity::getEnt > > >, ordered_non_unique< tag< Composite_Name_And_Type_mi_tag >, composite_key< DofEntity, const_mem_fun< DofEntity::interface_type_Field, boost::string_ref, &DofEntity::getNameRef >, const_mem_fun< DofEntity::interface_type_RefEntity, EntityType, &DofEntity::getEntType > > > > > DofEntity_multiIndex
MultiIndex container keeps DofEntity.
CHKERRQ(ierr)
virtual MoFEMErrorCode add_ents_to_field_by_type(const Range &ents, const EntityType type, const std::string &name, int verb=DEFAULT_VERBOSITY)=0
Add entities to field meshset.
DEPRECATED typedef DirichletSpatialPositionsBc SpatialPositionsBCFEMethodPreAndPostProc
Definition: DirichletBC.hpp:99
#define _IT_CUBITMESHSETS_BY_BCDATA_TYPE_FOR_LOOP_(MESHSET_MANAGER, CUBITBCTYPE, IT)
Iterator that loops over a specific Cubit MeshSet in a moFEM field.
Interface for nonlinear (SNES) solver.
Definition: SnesCtx.hpp:27
#define _IT_GET_DOFS_FIELD_BY_NAME_FOR_LOOP_(MFIELD, NAME, IT)
Definition: Interface.hpp:1659
Ainsworth Cole (Legendre) approx. base .
Definition: definitions.h:146
static int debug
virtual MoFEMErrorCode loop_dofs(const Problem *problem_ptr, const std::string &field_name, RowColData rc, DofMethod &method, int lower_rank, int upper_rank, int verb=DEFAULT_VERBOSITY)=0
Make a loop over dofs.
virtual MoFEMErrorCode modify_problem_ref_level_add_bit(const std::string &name_problem, const BitRefLevel &bit)=0
add ref level to problem
DEPRECATED MoFEMErrorCode partition_problem(const std::string &name, int verb=-1)
partition problem dofs (collective)
DEPRECATED MoFEMErrorCode VecCreateGhost(const std::string &name, RowColData rc, Vec *V) const
create ghost vector for problem (collective)collective - need to be run on all processors in communic...
virtual MoFEMErrorCode add_finite_element(const std::string &fe_name, enum MoFEMTypes bh=MF_EXCL, int verb=DEFAULT_VERBOSITY)=0
add finite element
#define MU(E, NU)
Definition: fem_tools.h:33
PetscErrorCode PetscOptionsGetInt(PetscOptions *, const char pre[], const char name[], PetscInt *ivalue, PetscBool *set)
virtual MoFEMErrorCode modify_finite_element_add_field_data(const std::string &fe_name, const std::string &name_filed)=0
set finite element field data
#define MYPCOMM_INDEX
default communicator number PCOMM
Definition: definitions.h:285
std::bitset< BITREFLEVEL_SIZE > BitRefLevel
Bit structure attached to each entity identifying to what mesh entity is attached.
Definition: Types.hpp:51
DEPRECATED MoFEMErrorCode partition_ghost_dofs(const std::string &name, int verb=-1)
determine ghost nodes
virtual MoFEMErrorCode build_fields(int verb=DEFAULT_VERBOSITY)=0
virtual MoFEMErrorCode add_problem(const std::string &name, enum MoFEMTypes bh=MF_EXCL, int verb=DEFAULT_VERBOSITY)=0
Add problem.
virtual MoFEMErrorCode get_problem_finite_elements_entities(const std::string &name, const std::string &fe_name, const EntityHandle meshset)=0
add finite elements to the meshset
virtual MoFEMErrorCode modify_finite_element_add_field_row(const std::string &fe_name, const std::string &name_row)=0
set field row which finite element use
continuous field
Definition: definitions.h:171
DEPRECATED MoFEMErrorCode MatCreateMPIAIJWithArrays(const std::string &name, Mat *Aij, int verb=DEFAULT_VERBOSITY)
DEPRECATED MoFEMErrorCode seed_ref_level_3D(const EntityHandle meshset, const BitRefLevel &bit, int verb=-1)
seed 2D entities in the meshset and their adjacencies (only TETs adjacencies) in a particular BitRefL...
PetscErrorCode SnesRhs(SNES snes, Vec x, Vec f, void *ctx)
This is MoFEM implementation for the right hand side (residual vector) evaluation in SNES solver.
Definition: SnesCtx.cpp:23
virtual MoFEMErrorCode build_finite_elements(int verb=DEFAULT_VERBOSITY)=0
Build finite elementsBuild finite element data structures. Have to be run before problem and adjacenc...
DEPRECATED MoFEMErrorCode loop_finite_elements(const Problem *problem_ptr, const std::string &fe_name, FEMethod &method, int lower_rank, int upper_rank, MoFEMTypes bh, int verb=DEFAULT_VERBOSITY)

◆ roundn()

double roundn ( double  n)

Definition at line 61 of file nonlinear_elasticity_atom.cpp.

61  {
62  //break n into fractional part (fract) and integral part (intp)
63  double fract, intp;
64  fract = modf(n,&intp);
65  // case where n approximates zero, set n to "positive" zero
66  if (abs(intp)==0) {
67  if(abs(fract)<=RND_EPS) {
68  n=0.000;
69  }
70  }
71  return n;
72 }
#define RND_EPS

Variable Documentation

◆ debug

int debug = 1
static

Definition at line 74 of file nonlinear_elasticity_atom.cpp.

◆ help

char help[] = "...\n\n"
static

Definition at line 57 of file nonlinear_elasticity_atom.cpp.