v0.14.0
small_strain_plasticity_problem_paraboloidal.cpp
Go to the documentation of this file.
1 /** \file small_strain_plasticity.cpp
2  * \ingroup small_strain_plasticity
3  * \brief Small strain plasticity example
4  *
5  */
6 
7 /* This file is part of MoFEM.
8  * MoFEM is free software: you can redistribute it and/or modify it under
9  * the terms of the GNU Lesser General Public License as published by the
10  * Free Software Foundation, either version 3 of the License, or (at your
11  * option) any later version.
12  *
13  * MoFEM is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
16  * License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with MoFEM. If not, see <http://www.gnu.org/licenses/>. */
20 
21 #include <MoFEM.hpp>
22 using namespace MoFEM;
23 
24 #include <boost/program_options.hpp>
25 using namespace std;
26 namespace po = boost::program_options;
27 
28 #include <boost/numeric/ublas/vector_proxy.hpp>
29 #include <boost/numeric/ublas/matrix.hpp>
30 #include <boost/numeric/ublas/matrix_proxy.hpp>
31 #include <boost/numeric/ublas/vector.hpp>
32 #include <boost/numeric/ublas/symmetric.hpp>
33 
34 #include <adolc/adolc.h>
37 
39 #include <TimeForceScale.hpp>
40 #include <SurfacePressure.hpp>
41 #include <NodalForce.hpp>
42 #include <EdgeForce.hpp>
43 #include <DirichletBC.hpp>
44 
46 #include <PostProcOnRefMesh.hpp>
47 
48 #include <string>
49 
50 using namespace boost::numeric;
51 
52 static char help[] = "...\n"
53  "\n";
54 
55 int main(int argc, char *argv[]) {
56 
57  MoFEM::Core::Initialize(&argc, &argv, (char *)0, help);
58  try {
59 
60  moab::Core mb_instance;
61  moab::Interface &moab = mb_instance;
62  ParallelComm *pcomm = ParallelComm::get_pcomm(&moab, MYPCOMM_INDEX);
63  if (pcomm == NULL)
64  pcomm = new ParallelComm(&moab, PETSC_COMM_WORLD);
65 
66  PetscBool flg = PETSC_TRUE;
67  char mesh_file_name[255];
68  CHKERR PetscOptionsGetString(PETSC_NULL, "-my_file", mesh_file_name, 255,
69  &flg);
70  if (flg != PETSC_TRUE) {
71  SETERRQ(PETSC_COMM_SELF, 1, "*** ERROR -my_file (MESH FILE NEEDED)");
72  }
73 
74  PetscInt order;
75  CHKERR PetscOptionsGetInt(PETSC_NULL, "-my_order", &order, &flg);
76  if (flg != PETSC_TRUE) {
77  order = 2;
78  }
79  PetscInt bubble_order;
80  CHKERR PetscOptionsGetInt(PETSC_NULL, "-my_bubble_order", &bubble_order,
81  &flg);
82  if (flg != PETSC_TRUE) {
83  bubble_order = order;
84  }
85 
86  // use this if your mesh is partitioned and you run code on parts,
87  // you can solve very big problems
88  PetscBool is_partitioned = PETSC_FALSE;
89  CHKERR PetscOptionsGetBool(PETSC_NULL, "-my_is_partitioned",
90  &is_partitioned, &flg);
91 
92  // Read mesh to MOAB
93  if (is_partitioned == PETSC_TRUE) {
94  const char *option;
95  option = "PARALLEL=BCAST_DELETE;PARALLEL_RESOLVE_SHARED_ENTS;PARTITION="
96  "PARALLEL_PARTITION;";
97  rval = moab.load_file(mesh_file_name, 0, option);
99  } else {
100  const char *option;
101  option = "";
102  rval = moab.load_file(mesh_file_name, 0, option);
104  }
105 
107  {
108  cp.tAgs.resize(3);
109  cp.tAgs[0] = 0;
110  cp.tAgs[1] = 1;
111  cp.tAgs[2] = 2;
112  cp.tOl = 1e-12;
113 
114  double young_modulus = 1;
115  double poisson_ratio = 0.25;
116  cp.sIgma_yt = 1;
117  cp.sIgma_yc = 1;
118 
119  cp.Ht = 0.1;
120  cp.Hc = 0.1;
121 
122  cp.nup = 0.3;
123 
124  {
125  CHKERR PetscOptionsGetReal(0, "-my_young_modulus", &young_modulus, 0);
126  CHKERR PetscOptionsGetReal(0, "-my_poisson_ratio", &poisson_ratio, 0);
129  CHKERR PetscOptionsGetReal(0, "-my_sigma_yt", &cp.sIgma_yt, 0);
130  CHKERR PetscOptionsGetReal(0, "-my_sigma_yc", &cp.sIgma_yc, 0);
131 
132  CHKERR PetscOptionsGetReal(0, "-my_Ht", &cp.Ht, 0);
133  CHKERR PetscOptionsGetReal(0, "-my_Hc", &cp.Hc, 0);
134 
135  CHKERR PetscOptionsGetReal(0, "-my_nt", &cp.nt, 0);
136  CHKERR PetscOptionsGetReal(0, "-my_nc", &cp.nc, 0);
137 
138  CHKERR PetscOptionsGetReal(0, "-my_nup", &cp.nup, 0);
139  }
140 
141  PetscPrintf(PETSC_COMM_WORLD, "young_modulus = %4.2e \n", young_modulus);
142  PetscPrintf(PETSC_COMM_WORLD, "poisson_ratio = %4.2e \n", poisson_ratio);
143 
144  PetscPrintf(PETSC_COMM_WORLD, "sIgma_yt = %4.2e \n", cp.sIgma_yt);
145  PetscPrintf(PETSC_COMM_WORLD, "sIgma_yc = %4.2e \n", cp.sIgma_yt);
146 
147  PetscPrintf(PETSC_COMM_WORLD, "nup = %4.2e \n", cp.nup);
148 
149  cp.sTrain.resize(6, false);
150  cp.sTrain.clear();
151  cp.plasticStrain.resize(6, false);
152  cp.plasticStrain.clear();
153  cp.internalVariables.resize(2, false);
154  cp.internalVariables.clear();
155  cp.createMatAVecR();
156  cp.snesCreate();
157  // CHKERR SNESSetFromOptions(cp.sNes);
158  }
159 
160  MoFEM::Core core(moab);
161  MoFEM::Interface &m_field = core;
162 
163  // ref meshset ref level 0
164  CHKERR m_field.seed_ref_level_3D(0, BitRefLevel().set(0));
165  vector<BitRefLevel> bit_levels;
166  bit_levels.push_back(BitRefLevel().set(0));
167 
168  {
169 
170  BitRefLevel problem_bit_level = bit_levels.back();
171  Range CubitSideSets_meshsets;
172  CHKERR m_field.get_cubit_meshsets(SIDESET, CubitSideSets_meshsets);
173 
174  // Fields
175  CHKERR m_field.add_field("DISPLACEMENT", H1, AINSWORTH_LEGENDRE_BASE, 3);
176  CHKERR m_field.add_field("MESH_NODE_POSITIONS", H1,
178  // add entitities (by tets) to the field
179  CHKERR m_field.add_ents_to_field_by_type(0, MBTET, "DISPLACEMENT");
180  CHKERR m_field.add_ents_to_field_by_type(0, MBTET, "MESH_NODE_POSITIONS");
181 
182  // set app. order
183  CHKERR m_field.set_field_order(0, MBTET, "DISPLACEMENT", bubble_order);
184  CHKERR m_field.set_field_order(0, MBTRI, "DISPLACEMENT", order);
185  CHKERR m_field.set_field_order(0, MBEDGE, "DISPLACEMENT", order);
186  CHKERR m_field.set_field_order(0, MBVERTEX, "DISPLACEMENT", 1);
187 
188  CHKERR m_field.set_field_order(0, MBTET, "MESH_NODE_POSITIONS",
189  order > 1 ? 2 : 1);
190  CHKERR m_field.set_field_order(0, MBTRI, "MESH_NODE_POSITIONS",
191  order > 1 ? 2 : 1);
192  CHKERR m_field.set_field_order(0, MBEDGE, "MESH_NODE_POSITIONS",
193  order > 1 ? 2 : 1);
194  CHKERR m_field.set_field_order(0, MBVERTEX, "MESH_NODE_POSITIONS", 1);
195 
196  // build field
197  CHKERR m_field.build_fields();
198  {
199  // 10 node tets
200  Projection10NodeCoordsOnField ent_method_material(
201  m_field, "MESH_NODE_POSITIONS");
202  CHKERR m_field.loop_dofs("MESH_NODE_POSITIONS", ent_method_material, 0);
203  }
204 
205  // FE
206  CHKERR m_field.add_finite_element("PLASTIC");
207  // Define rows/cols and element data
209  "DISPLACEMENT");
211  "DISPLACEMENT");
213  "DISPLACEMENT");
215  "PLASTIC", "MESH_NODE_POSITIONS");
216  CHKERR m_field.add_ents_to_finite_element_by_type(0, MBTET, "PLASTIC");
217 
218  // Add Neumann forces
219  CHKERR MetaNeummanForces::addNeumannBCElements(m_field, "DISPLACEMENT");
220  CHKERR MetaNodalForces::addElement(m_field, "DISPLACEMENT");
221  CHKERR MetaEdgeForces::addElement(m_field, "DISPLACEMENT");
222 
223  // build finite elements
224  CHKERR m_field.build_finite_elements();
225  // build adjacencies
226  CHKERR m_field.build_adjacencies(problem_bit_level);
227 
228  DMType dm_name = "PLASTIC_PROB";
229  CHKERR DMRegister_MoFEM(dm_name);
230  // craete dm instance
231  DM dm;
232  CHKERR DMCreate(PETSC_COMM_WORLD, &dm);
233  CHKERR DMSetType(dm, dm_name);
234  {
235  // set dm datastruture which created mofem datastructures
236  CHKERR DMMoFEMCreateMoFEM(dm, &m_field, dm_name, problem_bit_level);
237  CHKERR DMSetFromOptions(dm);
238  CHKERR DMMoFEMSetIsPartitioned(dm, is_partitioned);
239  // add elements to dm
240  CHKERR DMMoFEMAddElement(dm, "PLASTIC");
241  CHKERR DMMoFEMAddElement(dm, "FORCE_FE");
242  CHKERR DMMoFEMAddElement(dm, "PRESSURE_FE");
243  CHKERR DMSetUp(dm);
244  }
245 
246  // create matrices
247  Vec F, D;
248  Mat Aij;
249  {
251  CHKERR VecDuplicate(D, &F);
252  CHKERR DMCreateMatrix_MoFEM(dm, &Aij);
253  CHKERR VecZeroEntries(D);
254  CHKERR VecGhostUpdateBegin(D, INSERT_VALUES, SCATTER_FORWARD);
255  CHKERR VecGhostUpdateEnd(D, INSERT_VALUES, SCATTER_FORWARD);
256  CHKERR DMoFEMMeshToLocalVector(dm, D, INSERT_VALUES, SCATTER_REVERSE);
257  CHKERR MatZeroEntries(Aij);
258  }
259 
260  // assemble Aij and F
261  DirichletDisplacementBc dirichlet_bc(m_field, "DISPLACEMENT", Aij, D, F);
262  dirichlet_bc.methodsOp.push_back(
263  new TimeForceScale("-my_displacements_history", false));
264 
265  SmallStrainPlasticity small_strain_plasticity(m_field);
266  {
267  PetscBool bbar = PETSC_TRUE;
268  CHKERR PetscOptionsGetBool(0, "-my_bbar", &bbar, 0);
269  small_strain_plasticity.commonData.bBar = bbar;
270  }
271  {
272  small_strain_plasticity.feRhs.getOpPtrVector().push_back(
274  "DISPLACEMENT", small_strain_plasticity.commonData));
275  small_strain_plasticity.feRhs.getOpPtrVector().push_back(
277  m_field, "DISPLACEMENT", small_strain_plasticity.commonData, cp,
278  false));
279  small_strain_plasticity.feRhs.getOpPtrVector().push_back(
281  "DISPLACEMENT", small_strain_plasticity.commonData));
282  small_strain_plasticity.feLhs.getOpPtrVector().push_back(
284  "DISPLACEMENT", small_strain_plasticity.commonData));
285  small_strain_plasticity.feLhs.getOpPtrVector().push_back(
287  m_field, "DISPLACEMENT", small_strain_plasticity.commonData, cp,
288  false));
289  small_strain_plasticity.feLhs.getOpPtrVector().push_back(
291  "DISPLACEMENT", small_strain_plasticity.commonData));
292  small_strain_plasticity.feUpdate.getOpPtrVector().push_back(
294  "DISPLACEMENT", small_strain_plasticity.commonData));
295  small_strain_plasticity.feUpdate.getOpPtrVector().push_back(
297  m_field, "DISPLACEMENT", small_strain_plasticity.commonData, cp,
298  false));
299  small_strain_plasticity.feUpdate.getOpPtrVector().push_back(
301  "DISPLACEMENT", small_strain_plasticity.commonData));
302  CHKERR small_strain_plasticity.createInternalVariablesTag();
303  }
304 
305  // Setting finite element method for applying tractions
306  boost::ptr_map<string, NeummanForcesSurface> neumann_forces;
307  boost::ptr_map<string, NodalForce> nodal_forces;
308  boost::ptr_map<string, EdgeForce> edge_forces;
309  TimeForceScale time_force_scale("-my_load_history", false);
310  {
311  // forces and pressures on surface
312  CHKERR MetaNeummanForces::setMomentumFluxOperators(
313  m_field, neumann_forces, PETSC_NULL, "DISPLACEMENT");
314  // noadl forces
315  CHKERR MetaNodalForces::setOperators(m_field, nodal_forces, PETSC_NULL,
316  "DISPLACEMENT");
317  // edge forces
318  CHKERR MetaEdgeForces::setOperators(m_field, edge_forces, PETSC_NULL,
319  "DISPLACEMENT");
320  for (boost::ptr_map<string, NeummanForcesSurface>::iterator mit =
321  neumann_forces.begin();
322  mit != neumann_forces.end(); mit++) {
323  mit->second->methodsOp.push_back(
324  new TimeForceScale("-my_load_history", false));
325  }
326  for (boost::ptr_map<string, NodalForce>::iterator mit =
327  nodal_forces.begin();
328  mit != nodal_forces.end(); mit++) {
329  mit->second->methodsOp.push_back(
330  new TimeForceScale("-my_load_history", false));
331  }
332  for (boost::ptr_map<string, EdgeForce>::iterator mit =
333  edge_forces.begin();
334  mit != edge_forces.end(); mit++) {
335  mit->second->methodsOp.push_back(
336  new TimeForceScale("-my_load_history", false));
337  }
338  }
339 
340  // Adding elements to DMSnes
341  {
342  // Rhs
343  CHKERR DMMoFEMSNESSetFunction(dm, DM_NO_ELEMENT, NULL, &dirichlet_bc,
344  NULL);
345  {
346  boost::ptr_map<string, NeummanForcesSurface>::iterator fit;
347  fit = neumann_forces.begin();
348  for (; fit != neumann_forces.end(); fit++) {
350  dm, fit->first.c_str(), &fit->second->getLoopFe(), NULL, NULL);
351  }
352  fit = nodal_forces.begin();
353  for (; fit != nodal_forces.end(); fit++) {
355  dm, fit->first.c_str(), &fit->second->getLoopFe(), NULL, NULL);
356  }
357  fit = edge_forces.begin();
358  for (; fit != edge_forces.end(); fit++) {
360  dm, fit->first.c_str(), &fit->second->getLoopFe(), NULL, NULL);
361  }
362  }
363  CHKERR DMMoFEMSNESSetFunction(dm, "PLASTIC",
364  &small_strain_plasticity.feRhs,
365  PETSC_NULL, PETSC_NULL);
367  &dirichlet_bc);
368 
369  // Lhs
370  CHKERR DMMoFEMSNESSetJacobian(dm, DM_NO_ELEMENT, NULL, &dirichlet_bc,
371  NULL);
373  dm, "PLASTIC", &small_strain_plasticity.feLhs, NULL, NULL);
375  &dirichlet_bc);
376  }
377 
378  // Create Time Stepping solver
379  SNES snes;
380  SnesCtx *snes_ctx;
381  {
382  CHKERR SNESCreate(PETSC_COMM_WORLD, &snes);
383  // CHKERR SNESSetDM(snes,dm);
384  CHKERR DMMoFEMGetSnesCtx(dm, &snes_ctx);
385  CHKERR SNESSetFunction(snes, F, SnesRhs, snes_ctx);
386  CHKERR SNESSetJacobian(snes, Aij, Aij, SnesMat, snes_ctx);
387  CHKERR SNESSetFromOptions(snes);
388  }
389 
390  PostProcVolumeOnRefinedMesh post_proc(m_field);
391  {
393  CHKERR post_proc.addFieldValuesPostProc("DISPLACEMENT");
394  CHKERR post_proc.addFieldValuesGradientPostProc("DISPLACEMENT");
395  CHKERR post_proc.addFieldValuesPostProc("MESH_NODE_POSITIONS");
396  }
397 
398  {
399  double final_time = 1, delta_time = 0.1;
400  CHKERR PetscOptionsGetReal(0, "-my_final_time", &final_time, 0);
401  CHKERR PetscOptionsGetReal(0, "-my_delta_time", &delta_time, 0);
402  double delta_time0 = delta_time;
403 
404  // CHKERR MatView(Aij,PETSC_VIEWER_DRAW_SELF);
405  // std::string wait;
406  // std::cin >> wait;
407 
408  Vec D0;
409  CHKERR VecDuplicate(D, &D0);
410 
412  {
413  Range node_set;
414  for (_IT_CUBITMESHSETS_BY_NAME_FOR_LOOP_(m_field, "LoadPath", cit)) {
415  EntityHandle meshset = cit->getMeshset();
416  Range nodes;
417  rval = moab.get_entities_by_type(meshset, MBVERTEX, nodes, true);
419  node_set.merge(nodes);
420  }
421  PetscPrintf(PETSC_COMM_WORLD, "Nb. nodes in load path: %u\n",
422  node_set.size());
423  const Problem *problem_ptr;
424  CHKERR m_field.get_problem("PLASTIC_PROB", &problem_ptr);
425  boost::shared_ptr<NumeredDofEntity_multiIndex> numered_dofs_rows =
426  problem_ptr->getNumeredDofsRows();
427  Range::iterator nit = node_set.begin();
428  for (; nit != node_set.end(); nit++) {
429  NumeredDofEntityByEnt::iterator dit, hi_dit;
430  dit = numered_dofs_rows->get<Ent_mi_tag>().lower_bound(*nit);
431  hi_dit = numered_dofs_rows->get<Ent_mi_tag>().upper_bound(*nit);
432  for (; dit != hi_dit; dit++) {
433  load_path_dofs_view.insert(*dit);
434  }
435  }
436  }
437 
438  int step = 0;
439  double t = 0;
440  SNESConvergedReason reason = SNES_CONVERGED_ITERATING;
441  for (; t < final_time; step++) {
442 
443  t += delta_time;
444  PetscPrintf(PETSC_COMM_WORLD, "Step %d Time %6.4g final time %3.2g\n",
445  step, t, final_time);
446 
447  // set time
448  {
449  dirichlet_bc.ts_t = t;
450  {
451  boost::ptr_map<string, NeummanForcesSurface>::iterator fit;
452  fit = neumann_forces.begin();
453  for (; fit != neumann_forces.end(); fit++) {
454  fit->second->getLoopFe().ts_t = t;
455  }
456  fit = nodal_forces.begin();
457  for (; fit != nodal_forces.end(); fit++) {
458  fit->second->getLoopFe().ts_t = t;
459  }
460  fit = edge_forces.begin();
461  for (; fit != edge_forces.end(); fit++) {
462  fit->second->getLoopFe().ts_t = t;
463  }
464  }
465  }
466 
467  // solve problem at step
468  {
469  // dirichlet_bc.snes_B = Aij;
470  // small_strain_plasticity.feLhs.snes_B = Aij;
471  CHKERR VecAssemblyBegin(D);
472  CHKERR VecAssemblyEnd(D);
473  CHKERR VecCopy(D, D0);
474  if (step == 0 || reason < 0) {
475  CHKERR SNESSetLagJacobian(snes, -2);
476  } else {
477  CHKERR SNESSetLagJacobian(snes, -1);
478  }
479  CHKERR SNESSolve(snes, PETSC_NULL, D);
480 
481  int its;
482  CHKERR SNESGetIterationNumber(snes, &its);
483 
484  // CHKERR MatView(Aij,PETSC_VIEWER_DRAW_SELF);
485  // std::string wait;
486  // std::cin >> wait;
487 
488  CHKERR PetscPrintf(PETSC_COMM_WORLD,
489  "number of Newton iterations = %D\n", its);
490 
491  CHKERR SNESGetConvergedReason(snes, &reason);
492 
493  if (reason < 0) {
494  t -= delta_time;
495  delta_time *= 0.1;
496  CHKERR VecCopy(D0, D);
497  } else {
498  const int its_d = 7;
499  const double gamma = 0.5;
500  const double max_reudction = 1;
501  const double min_reduction = 1e-1;
502  double reduction;
503  reduction = pow((double)its_d / (double)(its + 1), gamma);
504  if (delta_time >= max_reudction * delta_time0 && reduction > 1) {
505  reduction = 1;
506  } else if (delta_time <= min_reduction * delta_time0 &&
507  reduction < 1) {
508  reduction = 1;
509  }
510 
511  CHKERR PetscPrintf(
512  PETSC_COMM_WORLD,
513  "reduction delta_time = %6.4e delta_time = %6.4e\n",
514  reduction, delta_time);
515  delta_time *= reduction;
516  if (reduction > 1 && delta_time < min_reduction * delta_time0) {
517  delta_time = min_reduction * delta_time0;
518  }
519 
520  CHKERR DMoFEMMeshToGlobalVector(dm, D, INSERT_VALUES,
521  SCATTER_REVERSE);
523  dm, "PLASTIC", &small_strain_plasticity.feUpdate);
524 
525  {
526  double scale;
527  CHKERR time_force_scale.getForceScale(t, scale);
528  NumeredDofEntity_multiIndex_uid_view_ordered::iterator it,
529  hi_it;
530  it = load_path_dofs_view.begin();
531  hi_it = load_path_dofs_view.end();
532  for (; it != hi_it; it++) {
533  PetscPrintf(PETSC_COMM_WORLD,
534  "load_path %s [ %d ] %6.4e %6.4e %6.4e\n",
535  (*it)->getName().c_str(), (*it)->getDofCoeffIdx(),
536  (*it)->getFieldData(), t, scale);
537  }
538  }
539 
540  // Save data on mesh
541  {
542  CHKERR DMoFEMLoopFiniteElements(dm, "PLASTIC", &post_proc);
543  string out_file_name;
544  {
545  std::ostringstream stm;
546  stm << "out_" << step << ".h5m";
547  out_file_name = stm.str();
548  }
549  CHKERR PetscPrintf(PETSC_COMM_WORLD, "out file %s\n",
550  out_file_name.c_str());
551  rval = post_proc.postProcMesh.write_file(
552  out_file_name.c_str(), "MOAB", "PARALLEL=WRITE_PART");
554  }
555  }
556  }
557  }
558 
559  CHKERR VecDestroy(&D0);
560  }
561 
562  {
563  CHKERR MatDestroy(&Aij);
564  CHKERR VecDestroy(&F);
565  CHKERR VecDestroy(&D);
566  }
567  }
568  }
569  CATCH_ERRORS;
570 
572 
573  return 0;
574 }
SmallStrainPlasticity::OpGetCommonDataAtGaussPts
Definition: SmallStrainPlasticity.hpp:413
MethodForForceScaling.hpp
MoFEM::Ent_mi_tag
Definition: TagMultiIndices.hpp:21
SIDESET
@ SIDESET
Definition: definitions.h:147
MYPCOMM_INDEX
#define MYPCOMM_INDEX
default communicator number PCOMM
Definition: definitions.h:215
SmallStrainParaboloidalPlasticity::nt
double nt
Definition: SmallStrainPlasticityMaterialModels.hpp:175
MoFEM::CoreInterface::loop_dofs
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.
MoFEM::CoreTmp< 0 >
Core (interface) class.
Definition: Core.hpp:82
H1
@ H1
continuous field
Definition: definitions.h:85
SmallStrainPlasticity::feUpdate
MyVolumeFE feUpdate
Definition: SmallStrainPlasticity.hpp:362
SmallStrainParaboloidalPlasticity::lambda
double lambda
Definition: SmallStrainPlasticityMaterialModels.hpp:171
EntityHandle
young_modulus
double young_modulus
Young modulus.
Definition: plastic.cpp:172
SmallStrainPlasticity::OpUpdate
Definition: SmallStrainPlasticity.hpp:418
MetaNodalForces::addElement
static MoFEMErrorCode addElement(MoFEM::Interface &m_field, const std::string field_name, Range *intersect_ptr=NULL)
Add element taking information from NODESET.
Definition: NodalForce.hpp:92
PostProcTemplateOnRefineMesh::postProcMesh
moab::Interface & postProcMesh
Definition: PostProcOnRefMesh.hpp:122
CHKERRQ_MOAB
#define CHKERRQ_MOAB(a)
check error code of MoAB function
Definition: definitions.h:454
SmallStrainParaboloidalPlasticity
Small strain plasticity with paraboloidal yield criterion (Isotropic Hardening)
Definition: SmallStrainPlasticityMaterialModels.hpp:162
MoFEM::CoreInterface::modify_finite_element_add_field_row
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
SmallStrainPlasticity::ClosestPointProjection::plasticStrain
VectorDouble plasticStrain
Definition: SmallStrainPlasticity.hpp:489
SmallStrainPlasticity::ClosestPointProjection::sTrain
VectorDouble sTrain
Definition: SmallStrainPlasticity.hpp:485
NodalForce.hpp
LAMBDA
#define LAMBDA(E, NU)
Definition: fem_tools.h:22
MoFEM::CoreInterface::get_problem
virtual const Problem * get_problem(const std::string problem_name) const =0
Get the problem object.
MoFEM.hpp
MoFEM::DMoFEMMeshToLocalVector
PetscErrorCode DMoFEMMeshToLocalVector(DM dm, Vec l, InsertMode mode, ScatterMode scatter_mode)
set local (or ghosted) vector values on mesh for partition only
Definition: DMMoFEM.cpp:527
MoFEM::Projection10NodeCoordsOnField
Projection of edge entities with one mid-node on hierarchical basis.
Definition: Projection10NodeCoordsOnField.hpp:24
MoFEM::CoreTmp< 0 >::Finalize
static MoFEMErrorCode Finalize()
Checks for options to be called at the conclusion of the program.
Definition: Core.cpp:112
SmallStrainPlasticity::ClosestPointProjection::tAgs
vector< int > tAgs
Definition: SmallStrainPlasticity.hpp:506
out_file_name
char out_file_name[255]
Definition: initial_diffusion.cpp:53
SmallStrainPlasticity::ClosestPointProjection::snesCreate
PetscErrorCode snesCreate()
Definition: SmallStrainPlasticity.cpp:1027
DirichletDisplacementBc
Set Dirichlet boundary conditions on displacements.
Definition: DirichletBC.hpp:57
SmallStrainPlasticity::ClosestPointProjection::createMatAVecR
virtual PetscErrorCode createMatAVecR()
Definition: SmallStrainPlasticity.cpp:924
MoFEM::CoreInterface::add_ents_to_field_by_type
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.
MoFEM::DMMoFEMAddElement
PetscErrorCode DMMoFEMAddElement(DM dm, std::string fe_name)
add element to dm
Definition: DMMoFEM.cpp:501
order
constexpr int order
Definition: dg_projection.cpp:18
MoFEM::DeprecatedCoreInterface
Deprecated interface functions.
Definition: DeprecatedCoreInterface.hpp:16
MoFEM::Interface
DeprecatedCoreInterface Interface
Definition: Interface.hpp:1975
MetaNodalForces::setOperators
static MoFEMErrorCode setOperators(MoFEM::Interface &m_field, boost::ptr_map< std::string, NodalForce > &nodal_forces, Vec F, const std::string field_name)
Set integration point operators.
Definition: NodalForce.hpp:128
MoFEM::DMCreateGlobalVector_MoFEM
PetscErrorCode DMCreateGlobalVector_MoFEM(DM dm, Vec *g)
DMShellSetCreateGlobalVector.
Definition: DMMoFEM.cpp:1171
MoFEM::CoreInterface::add_ents_to_finite_element_by_type
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
MoFEM::Exceptions::rval
static MoFEMErrorCodeGeneric< moab::ErrorCode > rval
Definition: Exceptions.hpp:74
SmallStrainParaboloidalPlasticity::sIgma_yt
double sIgma_yt
Definition: SmallStrainPlasticityMaterialModels.hpp:174
MoFEM::DMCreateMatrix_MoFEM
PetscErrorCode DMCreateMatrix_MoFEM(DM dm, Mat *M)
Definition: DMMoFEM.cpp:1201
CHKERR
#define CHKERR
Inline error check.
Definition: definitions.h:535
ContactOps::scale
double scale
Definition: EshelbianContact.hpp:22
SmallStrainPlasticity::ClosestPointProjection::tOl
double tOl
Definition: SmallStrainPlasticity.hpp:491
MoFEM::CoreInterface::add_finite_element
virtual MoFEMErrorCode add_finite_element(const std::string &fe_name, enum MoFEMTypes bh=MF_EXCL, int verb=DEFAULT_VERBOSITY)=0
add finite element
SmallStrainParaboloidalPlasticity::nc
double nc
Definition: SmallStrainPlasticityMaterialModels.hpp:175
MoFEM
implementation of Data Operators for Forces and Sources
Definition: Common.hpp:10
MoFEM::CoreInterface::modify_finite_element_add_field_col
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
TimeForceScale
Force scale operator for reading two columns.
Definition: TimeForceScale.hpp:18
MoFEM::PetscOptionsGetReal
PetscErrorCode PetscOptionsGetReal(PetscOptions *, const char pre[], const char name[], PetscReal *dval, PetscBool *set)
Definition: DeprecatedPetsc.hpp:152
MoFEM::CoreInterface::build_finite_elements
virtual MoFEMErrorCode build_finite_elements(int verb=DEFAULT_VERBOSITY)=0
Build finite elements.
MoFEM::CoreInterface::add_field
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.
SmallStrainPlasticity::feLhs
MyVolumeFE feLhs
Definition: SmallStrainPlasticity.hpp:361
TimeForceScale.hpp
DM_NO_ELEMENT
#define DM_NO_ELEMENT
Definition: DMMoFEM.hpp:10
help
static char help[]
Definition: small_strain_plasticity_problem_paraboloidal.cpp:52
MoFEM::DMoFEMMeshToGlobalVector
PetscErrorCode DMoFEMMeshToGlobalVector(DM dm, Vec g, InsertMode mode, ScatterMode scatter_mode)
set ghosted vector values on all existing mesh entities
Definition: DMMoFEM.cpp:539
MoFEM::DMMoFEMGetSnesCtx
PetscErrorCode DMMoFEMGetSnesCtx(DM dm, MoFEM::SnesCtx **snes_ctx)
get MoFEM::SnesCtx data structure
Definition: DMMoFEM.cpp:1098
MoFEM::NumeredDofEntity_multiIndex_uid_view_ordered
multi_index_container< boost::shared_ptr< NumeredDofEntity >, indexed_by< ordered_unique< const_mem_fun< NumeredDofEntity::interface_type_DofEntity, UId, &NumeredDofEntity::getLocalUniqueId > > > > NumeredDofEntity_multiIndex_uid_view_ordered
Definition: DofsMultiIndices.hpp:503
MoFEM::DMRegister_MoFEM
PetscErrorCode DMRegister_MoFEM(const char sname[])
Register MoFEM problem.
Definition: DMMoFEM.cpp:47
SmallStrainPlasticityMaterialModels.hpp
Small Strain plasticity material models.
poisson_ratio
double poisson_ratio
Poisson ratio.
Definition: plastic.cpp:173
SmallStrainPlasticity::commonData
CommonData commonData
Definition: SmallStrainPlasticity.hpp:394
Projection10NodeCoordsOnField.hpp
MoFEM::DMMoFEMSNESSetJacobian
PetscErrorCode DMMoFEMSNESSetJacobian(DM dm, const char fe_name[], MoFEM::FEMethod *method, MoFEM::BasicMethod *pre_only, MoFEM::BasicMethod *post_only)
set SNES Jacobian evaluation function
Definition: DMMoFEM.cpp:763
PostProcTemplateVolumeOnRefinedMesh::generateReferenceElementMesh
MoFEMErrorCode generateReferenceElementMesh()
Generate reference mesh on single element.
Definition: PostProcOnRefMesh.hpp:301
PostProcTemplateOnRefineMesh::addFieldValuesGradientPostProc
MoFEMErrorCode addFieldValuesGradientPostProc(const std::string field_name, Vec v=PETSC_NULL)
Add operator to post-process L2 or H1 field gradient.
Definition: PostProcOnRefMesh.hpp:195
PostProcOnRefMesh.hpp
Post-process fields on refined mesh.
t
constexpr double t
plate stiffness
Definition: plate.cpp:59
SmallStrainPlasticity
Small strain finite element implementation.
Definition: SmallStrainPlasticity.hpp:320
MoFEM::DMMoFEMCreateMoFEM
PetscErrorCode DMMoFEMCreateMoFEM(DM dm, MoFEM::Interface *m_field_ptr, const char problem_name[], const MoFEM::BitRefLevel bit_level, const MoFEM::BitRefLevel bit_mask=MoFEM::BitRefLevel().set())
Must be called by user to set MoFEM data structures.
Definition: DMMoFEM.cpp:118
SmallStrainPlasticity.hpp
Operators and data structures for small strain plasticity.
mesh_file_name
char mesh_file_name[255]
Definition: mesh_smoothing.cpp:23
SmallStrainPlasticity::ClosestPointProjection::internalVariables
VectorDouble internalVariables
Definition: SmallStrainPlasticity.hpp:486
MetaEdgeForces::addElement
static MoFEMErrorCode addElement(MoFEM::Interface &m_field, const std::string field_name, Range *intersect_ptr=NULL)
Add element taking information from NODESET.
Definition: EdgeForce.hpp:62
SmallStrainParaboloidalPlasticity::nup
double nup
Definition: SmallStrainPlasticityMaterialModels.hpp:172
MoFEM::SnesRhs
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:27
Range
MoFEM::CoreTmp< 0 >::Initialize
static MoFEMErrorCode Initialize(int *argc, char ***args, const char file[], const char help[])
Initializes the MoFEM database PETSc, MOAB and MPI.
Definition: Core.cpp:72
TimeForceScale::getForceScale
MoFEMErrorCode getForceScale(const double ts_t, double &scale)
Definition: TimeForceScale.hpp:89
SmallStrainParaboloidalPlasticity::mu
double mu
Definition: SmallStrainPlasticityMaterialModels.hpp:170
CATCH_ERRORS
#define CATCH_ERRORS
Catch errors.
Definition: definitions.h:372
MoFEM::TSMethod::ts_t
PetscReal ts_t
time
Definition: LoopMethods.hpp:162
PostProcVolumeOnRefinedMesh
Post processing.
Definition: PostProcOnRefMesh.hpp:955
MoFEM::Core
CoreTmp< 0 > Core
Definition: Core.hpp:1094
std
Definition: enable_if.hpp:5
SmallStrainParaboloidalPlasticity::Hc
double Hc
Definition: SmallStrainPlasticityMaterialModels.hpp:173
SmallStrainPlasticity::OpAssembleRhs
Definition: SmallStrainPlasticity.hpp:438
SmallStrainPlasticity::createInternalVariablesTag
PetscErrorCode createInternalVariablesTag()
Definition: SmallStrainPlasticity.cpp:34
AINSWORTH_LEGENDRE_BASE
@ AINSWORTH_LEGENDRE_BASE
Ainsworth Cole (Legendre) approx. base .
Definition: definitions.h:60
MoFEM::ForcesAndSourcesCore::getOpPtrVector
boost::ptr_deque< UserDataOperator > & getOpPtrVector()
Use to push back operator for row operator.
Definition: ForcesAndSourcesCore.hpp:83
EigenMatrix::Vec
const FTensor::Tensor2< T, Dim, Dim > Vec
Definition: MatrixFunction.hpp:66
MoFEM::PetscOptionsGetString
PetscErrorCode PetscOptionsGetString(PetscOptions *, const char pre[], const char name[], char str[], size_t size, PetscBool *set)
Definition: DeprecatedPetsc.hpp:172
SmallStrainParaboloidalPlasticity::Ht
double Ht
Definition: SmallStrainPlasticityMaterialModels.hpp:173
MoFEM::CoreInterface::build_fields
virtual MoFEMErrorCode build_fields(int verb=DEFAULT_VERBOSITY)=0
MoFEM::DeprecatedCoreInterface::seed_ref_level_3D
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...
Definition: DeprecatedCoreInterface.cpp:18
DirichletDisplacementBc::methodsOp
boost::ptr_vector< MethodForForceScaling > methodsOp
Definition: DirichletBC.hpp:76
MoFEM::CoreInterface::modify_finite_element_add_field_data
virtual MoFEMErrorCode modify_finite_element_add_field_data(const std::string &fe_name, const std::string name_filed)=0
set finite element field data
SmallStrainParaboloidalPlasticity::sIgma_yc
double sIgma_yc
Definition: SmallStrainPlasticityMaterialModels.hpp:174
_IT_CUBITMESHSETS_BY_NAME_FOR_LOOP_
#define _IT_CUBITMESHSETS_BY_NAME_FOR_LOOP_(MESHSET_MANAGER, NAME, IT)
Iterator that loops over Cubit BlockSet having a particular name.
Definition: MeshsetsManager.hpp:94
ReactionDiffusionEquation::D
const double D
diffusivity
Definition: reaction_diffusion.cpp:20
SmallStrainPlasticity::CommonData::bBar
bool bBar
Definition: SmallStrainPlasticity.hpp:389
MoFEM::Types::BitRefLevel
std::bitset< BITREFLEVEL_SIZE > BitRefLevel
Bit structure attached to each entity identifying to what mesh entity is attached.
Definition: Types.hpp:40
SmallStrainPlasticity::OpAssembleLhs
Definition: SmallStrainPlasticity.hpp:456
MoFEM::CoreInterface::build_adjacencies
virtual MoFEMErrorCode build_adjacencies(const Range &ents, int verb=DEFAULT_VERBOSITY)=0
build adjacencies
SmallStrainPlasticity::feRhs
MyVolumeFE feRhs
calculate right hand side for tetrahedral elements
Definition: SmallStrainPlasticity.hpp:360
main
int main(int argc, char *argv[])
Definition: small_strain_plasticity_problem_paraboloidal.cpp:55
MoFEM::SnesCtx
Interface for nonlinear (SNES) solver.
Definition: SnesCtx.hpp:13
MoFEM::Problem
keeps basic data about problem
Definition: ProblemsMultiIndices.hpp:54
EdgeForce.hpp
MoFEM::CoreInterface::set_field_order
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.
MoFEM::SnesMat
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:139
MoFEM::DMoFEMLoopFiniteElements
PetscErrorCode DMoFEMLoopFiniteElements(DM dm, const char fe_name[], MoFEM::FEMethod *method, CacheTupleWeakPtr cache_ptr=CacheTupleSharedPtr())
Executes FEMethod for finite elements in DM.
Definition: DMMoFEM.cpp:590
MoFEM::PetscOptionsGetInt
PetscErrorCode PetscOptionsGetInt(PetscOptions *, const char pre[], const char name[], PetscInt *ivalue, PetscBool *set)
Definition: DeprecatedPetsc.hpp:142
DirichletBC.hpp
SurfacePressure.hpp
MU
#define MU(E, NU)
Definition: fem_tools.h:23
F
@ F
Definition: free_surface.cpp:394
MoFEM::DMMoFEMSetIsPartitioned
PetscErrorCode DMMoFEMSetIsPartitioned(DM dm, PetscBool is_partitioned)
Definition: DMMoFEM.cpp:1127
MoFEM::DMMoFEMSNESSetFunction
PetscErrorCode DMMoFEMSNESSetFunction(DM dm, const char fe_name[], MoFEM::FEMethod *method, MoFEM::BasicMethod *pre_only, MoFEM::BasicMethod *post_only)
set SNES residual evaluation function
Definition: DMMoFEM.cpp:722
MetaEdgeForces::setOperators
static MoFEMErrorCode setOperators(MoFEM::Interface &m_field, boost::ptr_map< std::string, EdgeForce > &edge_forces, Vec F, const std::string field_name, std::string mesh_node_positions="MESH_NODE_POSITIONS")
Set integration point operators.
Definition: EdgeForce.hpp:97
MoFEM::PetscOptionsGetBool
PetscErrorCode PetscOptionsGetBool(PetscOptions *, const char pre[], const char name[], PetscBool *bval, PetscBool *set)
Definition: DeprecatedPetsc.hpp:182
PostProcTemplateOnRefineMesh::addFieldValuesPostProc
MoFEMErrorCode addFieldValuesPostProc(const std::string field_name, Vec v=PETSC_NULL)
Add operator to post-process L2, H1, Hdiv, Hcurl field value.
Definition: PostProcOnRefMesh.hpp:153
SmallStrainPlasticity::OpCalculateStress
Definition: SmallStrainPlasticity.hpp:603