v0.14.0
Functions | Variables
small_strain_plasticity_problem.cpp File Reference
#include <MoFEM.hpp>
#include <boost/program_options.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 <boost/numeric/ublas/symmetric.hpp>
#include <adolc/adolc.h>
#include <SmallStrainPlasticity.hpp>
#include <SmallStrainPlasticityMaterialModels.hpp>
#include <MethodForForceScaling.hpp>
#include <TimeForceScale.hpp>
#include <SurfacePressure.hpp>
#include <NodalForce.hpp>
#include <EdgeForce.hpp>
#include <DirichletBC.hpp>
#include <Projection10NodeCoordsOnField.hpp>
#include <PostProcOnRefMesh.hpp>
#include <string>

Go to the source code of this file.

Functions

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

Variables

static char help []
 

Function Documentation

◆ main()

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

Definition at line 55 of file small_strain_plasticity_problem.cpp.

55  {
56 
57  MoFEM::Core::Initialize(&argc, &argv, (char *)0, help);
58 
59  try {
60 
61  moab::Core mb_instance;
62  moab::Interface &moab = mb_instance;
63  ParallelComm *pcomm = ParallelComm::get_pcomm(&moab, MYPCOMM_INDEX);
64  if (pcomm == NULL)
65  pcomm = new ParallelComm(&moab, PETSC_COMM_WORLD);
66 
67  PetscBool flg = PETSC_TRUE;
68  char mesh_file_name[255];
69  CHKERR PetscOptionsGetString(PETSC_NULL, "-my_file", mesh_file_name, 255,
70  &flg);
71  if (flg != PETSC_TRUE) {
72  SETERRQ(PETSC_COMM_SELF, 1, "*** ERROR -my_file (MESH FILE NEEDED)");
73  }
74 
75  PetscInt order;
76  CHKERR PetscOptionsGetInt(PETSC_NULL, "-my_order", &order, &flg);
77  if (flg != PETSC_TRUE) {
78  order = 2;
79  }
80  PetscInt bubble_order;
81  CHKERR PetscOptionsGetInt(PETSC_NULL, "-my_bubble_order", &bubble_order,
82  &flg);
83  if (flg != PETSC_TRUE) {
84  bubble_order = order;
85  }
86 
87  // use this if your mesh is partitioned and you run code on parts,
88  // you can solve very big problems
89  PetscBool is_partitioned = PETSC_FALSE;
90  CHKERR PetscOptionsGetBool(PETSC_NULL, "-my_is_partitioned",
91  &is_partitioned, &flg);
92 
93  // Read mesh to MOAB
94  if (is_partitioned == PETSC_TRUE) {
95  const char *option;
96  option = "PARALLEL=BCAST_DELETE;PARALLEL_RESOLVE_SHARED_ENTS;PARTITION="
97  "PARALLEL_PARTITION;";
98  rval = moab.load_file(mesh_file_name, 0, option);
100  } else {
101  const char *option;
102  option = "";
103  rval = moab.load_file(mesh_file_name, 0, option);
105  }
106 
108  {
109  cp.tAgs.resize(3);
110  cp.tAgs[0] = 0;
111  cp.tAgs[1] = 1;
112  cp.tAgs[2] = 2;
113  cp.tOl = 1e-12;
114 
115  double young_modulus = 1;
116  double poisson_ratio = 0.25;
117  cp.sIgma_y = 1;
118  cp.H = 0.1;
119  cp.K = 0;
120  cp.phi = 1;
121  {
122  CHKERR PetscOptionsGetReal(0, "-my_young_modulus", &young_modulus, 0);
123  CHKERR PetscOptionsGetReal(0, "-my_poisson_ratio", &poisson_ratio, 0);
126  CHKERR PetscOptionsGetReal(0, "-my_sigma_y", &cp.sIgma_y, 0);
127  CHKERR PetscOptionsGetReal(0, "-my_H", &cp.H, 0);
128  CHKERR PetscOptionsGetReal(0, "-my_K", &cp.K, 0);
129  CHKERR PetscOptionsGetReal(0, "-my_phi", &cp.phi, 0);
130  }
131 
132  PetscPrintf(PETSC_COMM_WORLD, "young_modulus = %4.2e \n", young_modulus);
133  PetscPrintf(PETSC_COMM_WORLD, "poisson_ratio = %4.2e \n", poisson_ratio);
134  PetscPrintf(PETSC_COMM_WORLD, "sIgma_y = %4.2e \n", cp.sIgma_y);
135  PetscPrintf(PETSC_COMM_WORLD, "H = %4.2e \n", cp.H);
136  PetscPrintf(PETSC_COMM_WORLD, "K = %4.2e \n", cp.K);
137  PetscPrintf(PETSC_COMM_WORLD, "phi = %4.2e \n", cp.phi);
138 
139  cp.sTrain.resize(6, false);
140  cp.sTrain.clear();
141  cp.plasticStrain.resize(6, false);
142  cp.plasticStrain.clear();
143  cp.internalVariables.resize(7, false);
144  cp.internalVariables.clear();
145  cp.createMatAVecR();
146  cp.snesCreate();
147  // CHKERR SNESSetFromOptions(cp.sNes);
148  }
149 
150  MoFEM::Core core(moab);
151  MoFEM::Interface &m_field = core;
152 
153  // ref meshset ref level 0
154  CHKERR m_field.seed_ref_level_3D(0, BitRefLevel().set(0));
155  vector<BitRefLevel> bit_levels;
156  bit_levels.push_back(BitRefLevel().set(0));
157 
158  {
159 
160  BitRefLevel problem_bit_level = bit_levels.back();
161  Range CubitSideSets_meshsets;
162  CHKERR m_field.get_cubit_meshsets(SIDESET, CubitSideSets_meshsets);
163 
164  // Fields
165  CHKERR m_field.add_field("DISPLACEMENT", H1, AINSWORTH_LEGENDRE_BASE, 3);
166  CHKERR m_field.add_field("MESH_NODE_POSITIONS", H1,
168  // add entitities (by tets) to the field
169  CHKERR m_field.add_ents_to_field_by_type(0, MBTET, "DISPLACEMENT");
170  CHKERR m_field.add_ents_to_field_by_type(0, MBTET, "MESH_NODE_POSITIONS");
171 
172  // set app. order
173  CHKERR m_field.set_field_order(0, MBTET, "DISPLACEMENT", bubble_order);
174  CHKERR m_field.set_field_order(0, MBTRI, "DISPLACEMENT", order);
175  CHKERR m_field.set_field_order(0, MBEDGE, "DISPLACEMENT", order);
176  CHKERR m_field.set_field_order(0, MBVERTEX, "DISPLACEMENT", 1);
177 
178  CHKERR m_field.set_field_order(0, MBTET, "MESH_NODE_POSITIONS",
179  order > 1 ? 2 : 1);
180  CHKERR m_field.set_field_order(0, MBTRI, "MESH_NODE_POSITIONS",
181  order > 1 ? 2 : 1);
182  CHKERR m_field.set_field_order(0, MBEDGE, "MESH_NODE_POSITIONS",
183  order > 1 ? 2 : 1);
184  CHKERR m_field.set_field_order(0, MBVERTEX, "MESH_NODE_POSITIONS", 1);
185 
186  // build field
187  CHKERR m_field.build_fields();
188  {
189  // 10 node tets
190  Projection10NodeCoordsOnField ent_method_material(
191  m_field, "MESH_NODE_POSITIONS");
192  CHKERR m_field.loop_dofs("MESH_NODE_POSITIONS", ent_method_material, 0);
193  }
194 
195  // FE
196  CHKERR m_field.add_finite_element("PLASTIC");
197  // Define rows/cols and element data
199  "DISPLACEMENT");
201  "DISPLACEMENT");
203  "DISPLACEMENT");
205  "PLASTIC", "MESH_NODE_POSITIONS");
206  CHKERR m_field.add_ents_to_finite_element_by_type(0, MBTET, "PLASTIC");
207 
208  // Add Neumann forces
209  CHKERR MetaNeummanForces::addNeumannBCElements(m_field, "DISPLACEMENT");
210  CHKERR MetaNodalForces::addElement(m_field, "DISPLACEMENT");
211  CHKERR MetaEdgeForces::addElement(m_field, "DISPLACEMENT");
212 
213  // build finite elements
214  CHKERR m_field.build_finite_elements();
215  // build adjacencies
216  CHKERR m_field.build_adjacencies(problem_bit_level);
217 
218  DMType dm_name = "PLASTIC_PROB";
219  CHKERR DMRegister_MoFEM(dm_name);
220  // craete dm instance
221  DM dm;
222  CHKERR DMCreate(PETSC_COMM_WORLD, &dm);
223  CHKERR DMSetType(dm, dm_name);
224  {
225  // set dm datastruture which created mofem datastructures
226  CHKERR DMMoFEMCreateMoFEM(dm, &m_field, dm_name, problem_bit_level);
227  CHKERR DMSetFromOptions(dm);
228  CHKERR DMMoFEMSetIsPartitioned(dm, is_partitioned);
229  // add elements to dm
230  CHKERR DMMoFEMAddElement(dm, "PLASTIC");
231  CHKERR DMMoFEMAddElement(dm, "FORCE_FE");
232  CHKERR DMMoFEMAddElement(dm, "PRESSURE_FE");
233  CHKERR DMSetUp(dm);
234  }
235 
236  // create matrices
237  Vec F, D;
238  Mat Aij;
239  {
241  CHKERR VecDuplicate(D, &F);
242  CHKERR DMCreateMatrix_MoFEM(dm, &Aij);
243  CHKERR VecZeroEntries(D);
244  CHKERR VecGhostUpdateBegin(D, INSERT_VALUES, SCATTER_FORWARD);
245  CHKERR VecGhostUpdateEnd(D, INSERT_VALUES, SCATTER_FORWARD);
246  CHKERR DMoFEMMeshToLocalVector(dm, D, INSERT_VALUES, SCATTER_REVERSE);
247  CHKERR MatZeroEntries(Aij);
248  }
249 
250  // assemble Aij and F
251  DirichletDisplacementBc dirichlet_bc(m_field, "DISPLACEMENT", Aij, D, F);
252  dirichlet_bc.methodsOp.push_back(
253  new TimeForceScale("-my_displacements_history", false));
254 
255  SmallStrainPlasticity small_strain_plasticity(m_field);
256  {
257  PetscBool bbar = PETSC_TRUE;
258  CHKERR PetscOptionsGetBool(0, "-my_bbar", &bbar, 0);
259  small_strain_plasticity.commonData.bBar = bbar;
260  }
261  {
262  small_strain_plasticity.feRhs.getOpPtrVector().push_back(
264  "DISPLACEMENT", small_strain_plasticity.commonData));
265  small_strain_plasticity.feRhs.getOpPtrVector().push_back(
267  m_field, "DISPLACEMENT", small_strain_plasticity.commonData,
268  cp));
269  small_strain_plasticity.feRhs.getOpPtrVector().push_back(
271  "DISPLACEMENT", small_strain_plasticity.commonData));
272  small_strain_plasticity.feLhs.getOpPtrVector().push_back(
274  "DISPLACEMENT", small_strain_plasticity.commonData));
275  small_strain_plasticity.feLhs.getOpPtrVector().push_back(
277  m_field, "DISPLACEMENT", small_strain_plasticity.commonData,
278  cp));
279  small_strain_plasticity.feLhs.getOpPtrVector().push_back(
281  "DISPLACEMENT", small_strain_plasticity.commonData));
282  small_strain_plasticity.feUpdate.getOpPtrVector().push_back(
284  "DISPLACEMENT", small_strain_plasticity.commonData));
285  small_strain_plasticity.feUpdate.getOpPtrVector().push_back(
287  m_field, "DISPLACEMENT", small_strain_plasticity.commonData,
288  cp));
289  small_strain_plasticity.feUpdate.getOpPtrVector().push_back(
291  "DISPLACEMENT", small_strain_plasticity.commonData));
292  CHKERR small_strain_plasticity.createInternalVariablesTag();
293  }
294 
295  // Setting finite element method for applying tractions
296  boost::ptr_map<string, NeummanForcesSurface> neumann_forces;
297  boost::ptr_map<string, NodalForce> nodal_forces;
298  boost::ptr_map<string, EdgeForce> edge_forces;
299  TimeForceScale time_force_scale("-my_load_history", false);
300  {
301  // forces and pressures on surface
302  CHKERR MetaNeummanForces::setMomentumFluxOperators(
303  m_field, neumann_forces, PETSC_NULL, "DISPLACEMENT");
304  // noadl forces
305  CHKERR MetaNodalForces::setOperators(m_field, nodal_forces, PETSC_NULL,
306  "DISPLACEMENT");
307  // edge forces
308  CHKERR MetaEdgeForces::setOperators(m_field, edge_forces, PETSC_NULL,
309  "DISPLACEMENT");
310  for (boost::ptr_map<string, NeummanForcesSurface>::iterator mit =
311  neumann_forces.begin();
312  mit != neumann_forces.end(); mit++) {
313  mit->second->methodsOp.push_back(
314  new TimeForceScale("-my_load_history", false));
315  }
316  for (boost::ptr_map<string, NodalForce>::iterator mit =
317  nodal_forces.begin();
318  mit != nodal_forces.end(); mit++) {
319  mit->second->methodsOp.push_back(
320  new TimeForceScale("-my_load_history", false));
321  }
322  for (boost::ptr_map<string, EdgeForce>::iterator mit =
323  edge_forces.begin();
324  mit != edge_forces.end(); mit++) {
325  mit->second->methodsOp.push_back(
326  new TimeForceScale("-my_load_history", false));
327  }
328  }
329 
330  // Adding elements to DMSnes
331  {
332  // Rhs
333  CHKERR DMMoFEMSNESSetFunction(dm, DM_NO_ELEMENT, NULL, &dirichlet_bc,
334  NULL);
335  {
336  boost::ptr_map<string, NeummanForcesSurface>::iterator fit;
337  fit = neumann_forces.begin();
338  for (; fit != neumann_forces.end(); fit++) {
340  dm, fit->first.c_str(), &fit->second->getLoopFe(), NULL, NULL);
341  }
342  fit = nodal_forces.begin();
343  for (; fit != nodal_forces.end(); fit++) {
345  dm, fit->first.c_str(), &fit->second->getLoopFe(), NULL, NULL);
346  }
347  fit = edge_forces.begin();
348  for (; fit != edge_forces.end(); fit++) {
350  dm, fit->first.c_str(), &fit->second->getLoopFe(), NULL, NULL);
351  }
352  }
353  CHKERR DMMoFEMSNESSetFunction(dm, "PLASTIC",
354  &small_strain_plasticity.feRhs,
355  PETSC_NULL, PETSC_NULL);
357  &dirichlet_bc);
358 
359  // Lhs
360  CHKERR DMMoFEMSNESSetJacobian(dm, DM_NO_ELEMENT, NULL, &dirichlet_bc,
361  NULL);
363  dm, "PLASTIC", &small_strain_plasticity.feLhs, NULL, NULL);
365  &dirichlet_bc);
366  }
367 
368  // Create Time Stepping solver
369  SNES snes;
370  SnesCtx *snes_ctx;
371  {
372  CHKERR SNESCreate(PETSC_COMM_WORLD, &snes);
373  // CHKERR SNESSetDM(snes,dm);
374  CHKERR DMMoFEMGetSnesCtx(dm, &snes_ctx);
375  CHKERR SNESSetFunction(snes, F, SnesRhs, snes_ctx);
376  CHKERR SNESSetJacobian(snes, Aij, Aij, SnesMat, snes_ctx);
377  CHKERR SNESSetFromOptions(snes);
378  }
379 
380  PostProcVolumeOnRefinedMesh post_proc(m_field);
381  {
382  CHKERR post_proc.generateReferenceElementMesh();
383  CHKERR post_proc.addFieldValuesPostProc("DISPLACEMENT");
384  CHKERR post_proc.addFieldValuesGradientPostProc("DISPLACEMENT");
385  CHKERR post_proc.addFieldValuesPostProc("MESH_NODE_POSITIONS");
386  }
387 
388  {
389  double final_time = 1, delta_time = 0.1;
390  CHKERR PetscOptionsGetReal(0, "-my_final_time", &final_time, 0);
391  CHKERR PetscOptionsGetReal(0, "-my_delta_time", &delta_time, 0);
392  double delta_time0 = delta_time;
393 
394  // CHKERR MatView(Aij,PETSC_VIEWER_DRAW_SELF);
395  // std::string wait;
396  // std::cin >> wait;
397 
398  Vec D0;
399  CHKERR VecDuplicate(D, &D0);
400 
402  {
403  Range node_set;
404  for (_IT_CUBITMESHSETS_BY_NAME_FOR_LOOP_(m_field, "LoadPath", cit)) {
405  EntityHandle meshset = cit->getMeshset();
406  Range nodes;
407  rval = moab.get_entities_by_type(meshset, MBVERTEX, nodes, true);
409  node_set.merge(nodes);
410  }
411  PetscPrintf(PETSC_COMM_WORLD, "Nb. nodes in load path: %u\n",
412  node_set.size());
413  const Problem *problem_ptr;
414  CHKERR m_field.get_problem("PLASTIC_PROB", &problem_ptr);
415  boost::shared_ptr<NumeredDofEntity_multiIndex> numered_dofs_rows =
416  problem_ptr->getNumeredDofsRows();
417  Range::iterator nit = node_set.begin();
418  for (; nit != node_set.end(); nit++) {
419  NumeredDofEntityByEnt::iterator dit, hi_dit;
420  dit = numered_dofs_rows->get<Ent_mi_tag>().lower_bound(*nit);
421  hi_dit = numered_dofs_rows->get<Ent_mi_tag>().upper_bound(*nit);
422  for (; dit != hi_dit; dit++) {
423  load_path_dofs_view.insert(*dit);
424  }
425  }
426  }
427 
428  int step = 0;
429  double t = 0;
430  SNESConvergedReason reason = SNES_CONVERGED_ITERATING;
431  for (; t < final_time; step++) {
432 
433  t += delta_time;
434  PetscPrintf(PETSC_COMM_WORLD, "Step %d Time %6.4g final time %3.2g\n",
435  step, t, final_time);
436 
437  // set time
438  {
439  dirichlet_bc.ts_t = t;
440  {
441  boost::ptr_map<string, NeummanForcesSurface>::iterator fit;
442  fit = neumann_forces.begin();
443  for (; fit != neumann_forces.end(); fit++) {
444  fit->second->getLoopFe().ts_t = t;
445  }
446  fit = nodal_forces.begin();
447  for (; fit != nodal_forces.end(); fit++) {
448  fit->second->getLoopFe().ts_t = t;
449  }
450  fit = edge_forces.begin();
451  for (; fit != edge_forces.end(); fit++) {
452  fit->second->getLoopFe().ts_t = t;
453  }
454  }
455  }
456 
457  // solve problem at step
458  {
459  // dirichlet_bc.snes_B = Aij;
460  // small_strain_plasticity.feLhs.snes_B = Aij;
461  CHKERR VecAssemblyBegin(D);
462  CHKERR VecAssemblyEnd(D);
463  CHKERR VecCopy(D, D0);
464  if (step == 0 || reason < 0) {
465  CHKERR SNESSetLagJacobian(snes, -2);
466  } else {
467  CHKERR SNESSetLagJacobian(snes, -1);
468  }
469  CHKERR SNESSolve(snes, PETSC_NULL, D);
470 
471  int its;
472  CHKERR SNESGetIterationNumber(snes, &its);
473 
474  // CHKERR MatView(Aij,PETSC_VIEWER_DRAW_SELF);
475  // std::string wait;
476  // std::cin >> wait;
477 
478  CHKERR PetscPrintf(PETSC_COMM_WORLD,
479  "number of Newton iterations = %D\n", its);
480 
481  CHKERR SNESGetConvergedReason(snes, &reason);
482 
483  if (reason < 0) {
484  t -= delta_time;
485  delta_time *= 0.1;
486  CHKERR VecCopy(D0, D);
487  } else {
488  const int its_d = 6;
489  const double gamma = 0.5;
490  const double max_reudction = 1;
491  const double min_reduction = 1e-1;
492  double reduction;
493  reduction = pow((double)its_d / (double)(its + 1), gamma);
494  if (delta_time >= max_reudction * delta_time0 && reduction > 1) {
495  reduction = 1;
496  } else if (delta_time <= min_reduction * delta_time0 &&
497  reduction < 1) {
498  reduction = 1;
499  }
500 
501  CHKERR PetscPrintf(
502  PETSC_COMM_WORLD,
503  "reduction delta_time = %6.4e delta_time = %6.4e\n",
504  reduction, delta_time);
505  delta_time *= reduction;
506  if (reduction > 1 && delta_time < min_reduction * delta_time0) {
507  delta_time = min_reduction * delta_time0;
508  }
509 
510  CHKERR DMoFEMMeshToGlobalVector(dm, D, INSERT_VALUES,
511  SCATTER_REVERSE);
513  dm, "PLASTIC", &small_strain_plasticity.feUpdate);
514 
515  {
516  double scale;
517  CHKERR time_force_scale.getForceScale(t, scale);
518  NumeredDofEntity_multiIndex_uid_view_ordered::iterator it,
519  hi_it;
520  it = load_path_dofs_view.begin();
521  hi_it = load_path_dofs_view.end();
522  for (; it != hi_it; it++) {
523  PetscPrintf(PETSC_COMM_WORLD,
524  "load_path %s [ %d ] %6.4e %6.4e %6.4e\n",
525  (*it)->getName().c_str(),
526  // (*it)->getNbOfCoeffs(),
527  (*it)->getDofCoeffIdx(), (*it)->getFieldData(), t,
528  scale);
529  }
530  }
531 
532  // Save data on mesh
533  {
534  CHKERR DMoFEMLoopFiniteElements(dm, "PLASTIC", &post_proc);
535  string out_file_name;
536  {
537  std::ostringstream stm;
538  stm << "out_" << step << ".h5m";
539  out_file_name = stm.str();
540  }
541  CHKERR PetscPrintf(PETSC_COMM_WORLD, "out file %s\n",
542  out_file_name.c_str());
543  rval = post_proc.postProcMesh.write_file(
544  out_file_name.c_str(), "MOAB", "PARALLEL=WRITE_PART");
546  }
547  }
548  }
549  }
550 
551  CHKERR VecDestroy(&D0);
552  }
553 
554  {
555  CHKERR MatDestroy(&Aij);
556  CHKERR VecDestroy(&F);
557  CHKERR VecDestroy(&D);
558  }
559  }
560  }
561  CATCH_ERRORS;
562 
564 
565  return 0;
566 }

Variable Documentation

◆ help

char help[]
static
Initial value:
= "...\n"
"\n"

Definition at line 52 of file small_strain_plasticity_problem.cpp.

SmallStrainPlasticity::OpGetCommonDataAtGaussPts
Definition: SmallStrainPlasticity.hpp:413
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
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
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
CHKERRQ_MOAB
#define CHKERRQ_MOAB(a)
check error code of MoAB function
Definition: definitions.h:454
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
SmallStrainJ2Plasticity::sIgma_y
double sIgma_y
Definition: SmallStrainPlasticityMaterialModels.hpp:45
SmallStrainPlasticity::ClosestPointProjection::plasticStrain
VectorDouble plasticStrain
Definition: SmallStrainPlasticity.hpp:489
SmallStrainPlasticity::ClosestPointProjection::sTrain
VectorDouble sTrain
Definition: SmallStrainPlasticity.hpp:485
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::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
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
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.
DM_NO_ELEMENT
#define DM_NO_ELEMENT
Definition: DMMoFEM.hpp:10
SmallStrainJ2Plasticity::phi
double phi
Definition: SmallStrainPlasticityMaterialModels.hpp:44
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
help
static char help[]
Definition: small_strain_plasticity_problem.cpp:52
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
poisson_ratio
double poisson_ratio
Poisson ratio.
Definition: plastic.cpp:173
SmallStrainJ2Plasticity
J2 plasticity (Kinematic Isotropic (Linear) Hardening)
Definition: SmallStrainPlasticityMaterialModels.hpp:32
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
SmallStrainJ2Plasticity::mu
double mu
Definition: SmallStrainPlasticityMaterialModels.hpp:40
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
SmallStrainJ2Plasticity::lambda
double lambda
Definition: SmallStrainPlasticityMaterialModels.hpp:41
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
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
CATCH_ERRORS
#define CATCH_ERRORS
Catch errors.
Definition: definitions.h:372
SmallStrainJ2Plasticity::H
double H
Definition: SmallStrainPlasticityMaterialModels.hpp:42
PostProcVolumeOnRefinedMesh
Post processing.
Definition: PostProcOnRefMesh.hpp:955
MoFEM::Core
CoreTmp< 0 > Core
Definition: Core.hpp:1094
SmallStrainPlasticity::OpAssembleRhs
Definition: SmallStrainPlasticity.hpp:438
AINSWORTH_LEGENDRE_BASE
@ AINSWORTH_LEGENDRE_BASE
Ainsworth Cole (Legendre) approx. base .
Definition: definitions.h:60
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
SmallStrainJ2Plasticity::K
double K
Definition: SmallStrainPlasticityMaterialModels.hpp:43
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
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
_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
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
MoFEM::SnesCtx
Interface for nonlinear (SNES) solver.
Definition: SnesCtx.hpp:13
MoFEM::Problem
keeps basic data about problem
Definition: ProblemsMultiIndices.hpp:54
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
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
SmallStrainPlasticity::OpCalculateStress
Definition: SmallStrainPlasticity.hpp:603