v0.14.0
Loading...
Searching...
No Matches
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 ()
 
virtual MoFEMErrorCode scaleParameters ()=0
 
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< doublegravity = 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 ( )
inline

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", "",
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
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);
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 switch (body_type_id) {
209 case PLANE:
210 rollerDataVec.push_back(new PlaneRigidBody(center_coords, disp, ii));
211 break;
212 case SPHERE:
213 rollerDataVec.push_back(new SphereRigidBody(center_coords, disp, ii));
214 break;
215 case CYLINDER:
216 rollerDataVec.push_back(
217 new CylinderRigidBody(center_coords, disp, ii));
218 break;
219 case CONE:
220 rollerDataVec.push_back(new ConeRigidBody(center_coords, disp, ii));
221 break;
222 case TORUS:
223 rollerDataVec.push_back(new TorusRigidBody(center_coords, disp, ii));
224 break;
225 case ROLLER:
226 rollerDataVec.push_back(new RollerRigidBody(center_coords, disp, ii));
227 break;
228 case STL:
229 rollerDataVec.push_back(new STLRigidBody(center_coords, disp, ii));
230 break;
231 case NURBS:
232 // code to be executed if
233 break;
234 default:
235 // SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
236 // "this type of rigid body is not supported, check spelling "
237 // "(plane, sphere, cylinder, torus, superquadric, stl, nurbs)");
238 break;
239 }
240 auto &rol = rollerDataVec.back();
241 CHKERR rol.getBodyOptions();
242
243 char pos_data_file[255];
244 PetscBool ctg_flag = PETSC_FALSE;
245 param = "-position_data" + to_string(ii);
246 CHKERR PetscOptionsString(param.c_str(), "", "", "", pos_data_file, 255,
247 &ctg_flag);
248 if (ctg_flag) {
249 rol.methodOpForRollerPosition =
250 boost::make_shared<TimeAccelerogram>(string(param));
251 rol.originCoords.clear();
252 rol.rollerDisp.clear();
253 }
254
255 param = "-direction_data" + to_string(ii);
256 CHKERR PetscOptionsString(param.c_str(), "", "", "", pos_data_file, 255,
257 &ctg_flag);
258 if (ctg_flag) {
259 rol.methodOpForRollerDirection =
260 boost::make_shared<TimeAccelerogram>(string(param));
261 rol.BodyDirectionScaled = VectorDouble({0, 0, 0});
262 }
263
264 }
265 }
266
267 if (with_contact && rollerDataVec.empty()) {
268 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
269 "provide at least one body data for contact (-body1 "
270 "sphere -radius r and opional -move x,y) ");
271 }
272 // }
273
274 ierr = PetscOptionsEnd();
275 CHKERRQ(ierr);
276
278 }
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
static PetscErrorCode ierr
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:346
@ MOFEM_DATA_INCONSISTENCY
Definition: definitions.h:31
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:416
#define CHKERR
Inline error check.
Definition: definitions.h:535
UBlasVector< double > VectorDouble
Definition: Types.hpp:68
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 ( )
inlinevirtual

Implements CacheParams.

Definition at line 280 of file BasicFeTools.hpp.

280 {
282
284 young_modulus = 1;
290
294 // cn_cont = 1; // perhaps these should be always assigned by user
295 // cn_pl = 1;
296
298 }
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:447
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:440
double young_modulus_inv

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