v0.13.0
Public Member Functions | List of all members
BlockParamData Struct Reference

#include <users_modules/multifield_plasticity/src/BasicFeTools.hpp>

Inheritance diagram for BlockParamData:
[legend]
Collaboration diagram for BlockParamData:
[legend]

Public Member Functions

MoFEMErrorCode getOptionsFromCommandLine ()
 
MoFEMErrorCode scaleParameters ()
 
- Public Member Functions inherited from CacheParams
 CacheParams ()
 
template<typename T1 , typename T2 >
int getClosestRollerID (Tensor1< T1, 3 > &t_coords, Tensor1< T2, 3 > &t_disp)
 

Additional Inherited Members

- Public Attributes inherited from CacheParams
double young_modulus
 
double young_modulus_inv
 
double poisson
 
double density
 
double sigmaY
 
double cn_pl
 
double H
 
double C1_k
 
double Q_inf
 
double b_iso
 
double visH
 
double scale_constraint
 
MatrixDouble mtD
 
double cn_cont
 
double rollers_stop_time
 
- Static Public Attributes inherited from CacheParams
static vector< double > gravity = vector<double>({0,0,0})
 
static double spring_stiffness = 0
 
static int closest_roller_id = 0
 
static double delta = std::numeric_limits<double>::epsilon()
 
static Tensor1< double, 3 > omega
 
static Tensor2< double, 3, 3 > Omega
 
static Tensor4< double, 3, 3, 3, 3 > Is
 
static boost::ptr_vector< RigidBodyDatarollerDataVec
 
static RigidBodyDataclosest_roller
 

Detailed Description

Definition at line 103 of file BasicFeTools.hpp.

Member Function Documentation

◆ getOptionsFromCommandLine()

MoFEMErrorCode BlockParamData::getOptionsFromCommandLine ( )

Definition at line 105 of file BasicFeTools.hpp.

105  {
107 
108  // CHKERR PetscOptionsInsertString(NULL, default_options);
109  CHKERR PetscOptionsInsertString(
110  NULL, "-mat_mumps_icntl_14 1200 -mat_mumps_icntl_24 1 "
111  "-mat_mumps_icntl_13 1 -mat_mumps_icntl_20 0");
112 
113  CHKERR PetscOptionsBegin(PETSC_COMM_WORLD, "", "", "none");
114 
115  int nb_ent_grav = 3;
116  CHKERR PetscOptionsGetRealArray(NULL, NULL, "-gravity", gravity.data(),
117  &nb_ent_grav, PETSC_NULL);
118  // for elastic
119  CHKERR PetscOptionsScalar("-young", "Young's modulus", "", young_modulus,
120  &young_modulus, PETSC_NULL);
121 
122  CHKERR PetscOptionsScalar("-poisson", "Poisson ratio", "", poisson,
123  &poisson, PETSC_NULL);
124  CHKERR PetscOptionsScalar("-density", "Density", "", density, &density,
125  PETSC_NULL);
126 
127  PetscBool with_contact = PETSC_FALSE;
128  CHKERR PetscOptionsBool("-with_contact", "run calculations with contact",
129  "", with_contact, &with_contact, PETSC_NULL);
130 
131  double rot_vec[3] = {0, 0, 1};
132  int nb_ent = 3;
133  PetscBool is_rotating;
134  // get rotation velocity vector
135  CHKERR PetscOptionsGetRealArray(NULL, NULL, "-rot_omega", rot_vec, &nb_ent,
136  &is_rotating);
137  if (nb_ent < 3 && is_rotating) {
138  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
139  "provide an appropriate number of entries for omega vector (3)");
140  }
141  {
142  Tensor1<double, 3> t1_omega(rot_vec[0], rot_vec[1], rot_vec[2]);
143  omega(i) = t1_omega(i);
144  Omega(i, k) = levi_civita<double>(i, j, k) * t1_omega(j);
145  }
146 
147  if (poisson >= 0.5)
148  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
149  "poisson ratio value not supported");
150 
151  CHKERR PetscOptionsScalar("-sigmaY", "SigmaY - limit stress", "", sigmaY,
152  &sigmaY, PETSC_NULL);
153  CHKERR PetscOptionsScalar("-H", "Hardening modulus", "", H, &H, PETSC_NULL);
154  CHKERR PetscOptionsScalar("-cn_pl",
155  "cn_pl parameter for active set constrains", "",
156  cn_pl, &cn_pl, PETSC_NULL);
157  CHKERR PetscOptionsScalar("-scale_constraint", "constraint scale", "",
158  scale_constraint, &scale_constraint, PETSC_NULL);
159  CHKERR PetscOptionsScalar("-C1_k", "1st Backstress", "", C1_k, &C1_k,
160  PETSC_NULL);
161  CHKERR PetscOptionsScalar("-Q_inf", "Saturation stress", "", Q_inf, &Q_inf,
162  PETSC_NULL);
163  CHKERR PetscOptionsScalar("-b_iso", "Isotropic exponent", "", b_iso, &b_iso,
164  PETSC_NULL);
165  CHKERR PetscOptionsScalar("-visH", "viscous hardening", "", visH, &visH,
166  PETSC_NULL);
167  // for contact
168  CHKERR PetscOptionsScalar("-spring",
169  "Springs stiffness on the boundary (contact)", "",
170  spring_stiffness, &spring_stiffness, PETSC_NULL);
171 
172  CHKERR PetscOptionsScalar("-cn_cont",
173  "cn_cont parameter for active set constrains", "",
174  cn_cont, &cn_cont, PETSC_NULL);
175  CHKERR PetscOptionsScalar(
176  "-rollers_stop", "Time at which rollers will stop moving", "",
177  rollers_stop_time, &rollers_stop_time, PETSC_NULL);
178 
179  constexpr int MAX_NB_OF_ROLLERS = 10;
180  // if (with_contact) {
181 
182  const char *body_list[] = {"plane", "sphere", "cylinder", "cone",
183  "torus", "roller", "stl", "nurbs"};
184  for (int ii = 0; ii < MAX_NB_OF_ROLLERS; ++ii) {
185  int nb_coord = 3;
186  int nb_disp = 3;
187  int nb_dirs = 3;
188  VectorDouble center_coords({0, 0, 0});
189  VectorDouble disp({0, 0, 0});
190  VectorDouble direction({0, 0, 1});
191  PetscBool flg = PETSC_FALSE;
192  PetscBool rflg;
193  string param = "-body" + to_string(ii);
194  // char mesh_file_name[255];
195  // CHKERR PetscOptionsString(param.c_str(), "file name", "", "mesh.vtk",
196  // mesh_file_name, 255, &flg);
197  int body_type_id = LASTBODY;
198  CHKERR PetscOptionsGetEList(PETSC_NULL, NULL, param.c_str(), body_list,
199  LASTBODY, &body_type_id, &flg);
200 
201  param = "-coords" + to_string(ii);
202  CHKERR PetscOptionsGetRealArray(NULL, NULL, param.c_str(),
203  &center_coords(0), &nb_coord, &rflg);
204  param = "-move" + to_string(ii);
205  CHKERR PetscOptionsGetRealArray(NULL, NULL, param.c_str(), &disp(0),
206  &nb_disp, &rflg);
207  if (flg) {
208 
209  switch (body_type_id) {
210  case PLANE:
211  rollerDataVec.push_back(new PlaneRigidBody(center_coords, disp, ii));
212  break;
213  case SPHERE:
214  rollerDataVec.push_back(new SphereRigidBody(center_coords, disp, ii));
215  break;
216  case CYLINDER:
217  rollerDataVec.push_back(
218  new CylinderRigidBody(center_coords, disp, ii));
219  break;
220  case CONE:
221  rollerDataVec.push_back(new ConeRigidBody(center_coords, disp, ii));
222  break;
223  case TORUS:
224  rollerDataVec.push_back(new TorusRigidBody(center_coords, disp, ii));
225  break;
226  case ROLLER:
227  rollerDataVec.push_back(
228  new RollerRigidBody(center_coords, disp, ii));
229  break;
230  case STL:
231  rollerDataVec.push_back(new STLRigidBody(center_coords, disp, ii));
232  break;
233  case NURBS:
234  // code to be executed if
235  break;
236  default:
237  // SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
238  // "this type of rigid body is not supported, check spelling "
239  // "(plane, sphere, cylinder, torus, superquadric, stl, nurbs)");
240  break;
241  }
242  CHKERR rollerDataVec.back().getBodyOptions();
243 
244  char pos_data_file[255];
245  PetscBool ctg_flag = PETSC_FALSE;
246  param = "-position_data" + to_string(ii);
247  CHKERR PetscOptionsString(param.c_str(), "", "", "", pos_data_file, 255,
248  &ctg_flag);
249  if (ctg_flag) {
250  rollerDataVec.back().positionDataParamName = string(param);
251  rollerDataVec.back().originCoords.clear();
252  rollerDataVec.back().rollerDisp.clear();
253  }
254  }
255  }
256 
257  if (with_contact && rollerDataVec.empty()) {
258  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
259  "provide at least one body data for contact (-body1 "
260  "sphere -radius r and opional -move x,y) ");
261  }
262  // }
263 
264  ierr = PetscOptionsEnd();
265  CHKERRQ(ierr);
266 
268  }
static Index< 'k', 3 > k
static Index< 'j', 3 > j
static Index< 'i', 3 > i
@ TORUS
Definition: RigidBodies.hpp:22
@ ROLLER
Definition: RigidBodies.hpp:23
@ STL
Definition: RigidBodies.hpp:24
@ PLANE
Definition: RigidBodies.hpp:18
@ CYLINDER
Definition: RigidBodies.hpp:20
@ NURBS
Definition: RigidBodies.hpp:25
@ CONE
Definition: RigidBodies.hpp:21
@ SPHERE
Definition: RigidBodies.hpp:19
@ LASTBODY
Definition: RigidBodies.hpp:26
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:359
@ MOFEM_DATA_INCONSISTENCY
Definition: definitions.h:44
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:429
#define CHKERR
Inline error check.
Definition: definitions.h:548
static MoFEMErrorCodeGeneric< PetscErrorCode > ierr
Definition: Exceptions.hpp:87
UBlasVector< double > VectorDouble
Definition: Types.hpp:79
PetscErrorCode PetscOptionsGetRealArray(PetscOptions *, const char pre[], const char name[], PetscReal dval[], PetscInt *nmax, PetscBool *set)
PetscErrorCode PetscOptionsGetEList(PetscOptions *, const char pre[], const char name[], const char *const *list, PetscInt next, PetscInt *value, PetscBool *set)
static vector< double > gravity
double cn_cont
double poisson
double young_modulus
static double spring_stiffness
static Tensor1< double, 3 > omega
double scale_constraint
double density
static Tensor2< double, 3, 3 > Omega
double rollers_stop_time
static boost::ptr_vector< RigidBodyData > rollerDataVec

◆ scaleParameters()

MoFEMErrorCode BlockParamData::scaleParameters ( )
virtual

Implements CacheParams.

Definition at line 270 of file BasicFeTools.hpp.

270  {
272 
274  young_modulus = 1;
276  H *= young_modulus_inv;
280 
284  // cn_cont = 1; // perhaps these should be always assigned by user
285  // cn_pl = 1;
286 
288  }
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:460
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:453
double young_modulus_inv

The documentation for this struct was generated from the following file: