|
| v0.14.0
|
Go to the documentation of this file.
7 namespace bio = boost::iostreams;
11 static char help[] =
"...\n\n";
19 commonData(common_data) {}
32 const double eps = 1e-12;
33 const int nb_gauss_pts = data.
getN().size1();
34 for (
int gg = 0; gg != nb_gauss_pts; gg++) {
37 str0(0, 0), str0(0, 1), str0(0, 2), str0(1, 0), str0(1, 1),
38 str0(1, 2), str0(2, 0), str0(2, 1), str0(2, 2));
41 str1[3], str1[4], str1[5],
42 str1[6], str1[7], str1[8]);
43 t_stress_0(
i,
j) -= t_stress_1(
i,
j);
44 double nrm2 = t_stress_0(
i,
j) * t_stress_0(
i,
j);
48 "derivative of energy and stress inconsistency nrm2 = %6.4e",
56 int main(
int argc,
char *argv[]) {
66 PetscBool flg_test_mat;
67 PetscInt choise_value =
HOOKE;
69 LASTOP, &choise_value, &flg_test_mat);
74 MPI_Comm_rank(PETSC_COMM_WORLD, &rank);
76 PetscBool flg = PETSC_TRUE;
103 if (flg != PETSC_TRUE) {
115 double scale_positions = 2;
121 if (dof_ptr->get()->getEntType() != MBVERTEX)
124 int dof_rank = dof_ptr->get()->getDofCoeffIdx();
125 double &fval = dof_ptr->get()->getFieldData();
127 CHKERR moab.get_coords(&ent, 1, coords);
130 fval = scale_positions * coords[dof_rank];
138 FunctionsToCalculatePiolaKirchhoffI<double>>(),
140 FunctionsToCalculatePiolaKirchhoffI<adouble>>());
171 elastic.getLoopFeRhs().getOpPtrVector().push_back(
176 std::map<int, NonlinearElasticElement::BlockData>::iterator sit =
179 elastic.getLoopFeRhs().getOpPtrVector().push_back(
181 "SPATIAL_POSITION", sit->second, elastic.
commonData, tag0,
182 false,
false,
false));
183 elastic.getLoopFeRhs().getOpPtrVector().push_back(
185 "SPATIAL_POSITION", sit->second, elastic.
commonData, tag1,
true,
186 false,
false,
false));
189 elastic.getLoopFeRhs().getOpPtrVector().push_back(
193 elastic.getLoopFeRhs());
197 if (flg_test_mat == PETSC_TRUE) {
198 PetscPrintf(PETSC_COMM_WORLD,
"Testing %s\n",
200 std::map<int, NonlinearElasticElement::BlockData>::iterator sit =
203 switch (choise_value) {
205 sit->second.materialDoublePtr = boost::make_shared<Hooke<double>>();
206 sit->second.materialAdoublePtr = boost::make_shared<Hooke<adouble>>();
209 sit->second.materialDoublePtr =
210 boost::make_shared<NeoHookean<double>>();
211 sit->second.materialAdoublePtr =
212 boost::make_shared<NeoHookean<adouble>>();
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface reference to pointer of interface.
Data on single entity (This is passed as argument to DataOperator::doWork)
virtual MoFEMErrorCode loop_finite_elements(const std::string problem_name, const std::string &fe_name, FEMethod &method, boost::shared_ptr< NumeredEntFiniteElement_multiIndex > fe_ptr=nullptr, MoFEMTypes bh=MF_EXIST, CacheTupleWeakPtr cache_ptr=CacheTupleSharedPtr(), int verb=DEFAULT_VERBOSITY)=0
Make a loop over finite elements.
MoFEMErrorCode buildProblem(const std::string name, const bool square_matrix, int verb=VERBOSE)
build problem data structures
Problem manager is used to build and partition problems.
Operator performs automatic differentiation.
structure grouping operators and data used for calculation of nonlinear elastic element
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
const VectorDouble & getFieldData() const
get dofs values
static MoFEMErrorCode Finalize()
Checks for options to be called at the conclusion of the program.
OpCheck(NonlinearElasticElement::CommonData &common_data)
MoFEMErrorCode doWork(int side, EntityType type, EntitiesFieldData::EntData &data)
Operator for linear form, usually to calculate values on right hand side.
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 interface functions.
DeprecatedCoreInterface Interface
#define CHKERR
Inline error check.
std::vector< VectorDouble > jacEnergy
implementation of Data Operators for Forces and Sources
virtual MoFEMErrorCode build_finite_elements(int verb=DEFAULT_VERBOSITY)=0
Build finite elements.
NonlinearElasticElement::CommonData & commonData
Implementation of linear elastic material.
FTensor::Index< 'i', 3 > i
Calculate explicit derivative of free energy.
MoFEMErrorCode addElement(const std::string element_name, const std::string spatial_position_field_name, const std::string material_position_field_name="MESH_NODE_POSITIONS", const bool ale=false)
Volume finite element base.
FTensor::Index< 'i', SPACE_DIM > i
MoFEMErrorCode partitionFiniteElements(const std::string name, bool part_from_moab=false, int low_proc=-1, int hi_proc=-1, int verb=VERBOSE)
partition finite elements
virtual MoFEMErrorCode modify_problem_ref_level_add_bit(const std::string &name_problem, const BitRefLevel &bit)=0
add ref level to problem
int main(int argc, char *argv[])
std::vector< MatrixDouble3by3 > sTress
static MoFEMErrorCode Initialize(int *argc, char ***args, const char file[], const char help[])
Initializes the MoFEM database PETSc, MOAB and MPI.
#define CATCH_ERRORS
Catch errors.
#define _IT_GET_DOFS_FIELD_BY_NAME_FOR_LOOP_(MFIELD, NAME, IT)
MatrixDouble & getN(const FieldApproximationBase base)
get base functions this return matrix (nb. of rows is equal to nb. of Gauss pts, nb....
FTensor::Index< 'j', 3 > j
FTensor::Index< 'j', 3 > j
std::map< int, BlockData > setOfBlocks
maps block set id with appropriate BlockData
@ AINSWORTH_LEGENDRE_BASE
Ainsworth Cole (Legendre) approx. base .
PetscErrorCode PetscOptionsGetString(PetscOptions *, const char pre[], const char name[], char str[], size_t size, PetscBool *set)
PetscErrorCode PetscOptionsGetEList(PetscOptions *, const char pre[], const char name[], const char *const *list, PetscInt next, PetscInt *value, PetscBool *set)
const char * materials_list[]
virtual MoFEMErrorCode build_fields(int verb=DEFAULT_VERBOSITY)=0
MatrixBoundedArray< double, 9 > MatrixDouble3by3
UBlasVector< double > VectorDouble
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
std::bitset< BITREFLEVEL_SIZE > BitRefLevel
Bit structure attached to each entity identifying to what mesh entity is attached.
@ MOFEM_ATOM_TEST_INVALID
virtual MoFEMErrorCode build_adjacencies(const Range &ents, int verb=DEFAULT_VERBOSITY)=0
build adjacencies
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.
Implementation of Neo-Hookean elastic material.
MoFEMErrorCode partitionGhostDofs(const std::string name, int verb=VERBOSE)
determine ghost nodes
virtual MoFEMErrorCode add_problem(const std::string &name, enum MoFEMTypes bh=MF_EXCL, int verb=DEFAULT_VERBOSITY)=0
Add problem.
PetscErrorCode PetscOptionsGetInt(PetscOptions *, const char pre[], const char name[], PetscInt *ivalue, PetscBool *set)
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
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.
MoFEMErrorCode setBlocks(boost::shared_ptr< FunctionsToCalculatePiolaKirchhoffI< double >> materialDoublePtr, boost::shared_ptr< FunctionsToCalculatePiolaKirchhoffI< adouble >> materialAdoublePtr)
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
MoFEMErrorCode partitionProblem(const std::string name, int verb=VERBOSE)
partition problem dofs (collective)
common data used by volume elements