|
| v0.14.0
|
Go to the documentation of this file.
13 using namespace MoFEM;
15 static char help[] =
"...\n\n";
17 int main(
int argc,
char *argv[]) {
26 MPI_Comm_rank(PETSC_COMM_WORLD, &rank);
28 PetscBool flg = PETSC_TRUE;
32 if (flg != PETSC_TRUE) {
33 SETERRQ(PETSC_COMM_SELF, 1,
"*** ERROR -my_file (MESH FILE NEEDED)");
47 CHKERR moab.create_meshset(MESHSET_SET, meshset_level0);
90 if (flg != PETSC_TRUE) {
110 CHKERR moab.get_entities_by_type(it->meshset, MBTRI, tris,
true);
117 CHKERR moab.get_entities_by_type(it->meshset, MBTRI, tris,
true);
126 int order_velocity = 1;
167 double scale_positions = 2;
173 if (dof_ptr->get()->getEntType() != MBVERTEX)
176 int dof_rank = dof_ptr->get()->getDofCoeffIdx();
177 double &fval = dof_ptr->get()->getFieldData();
179 CHKERR moab.get_coords(&ent, 1, coords);
182 fval = scale_positions * coords[dof_rank];
186 double scale_velocities = 4;
192 if (dof_ptr->get()->getEntType() != MBVERTEX)
195 int dof_rank = dof_ptr->get()->getDofCoeffIdx();
196 double &fval = dof_ptr->get()->getFieldData();
198 CHKERR moab.get_coords(&ent, 1, coords);
201 fval = scale_velocities * coords[dof_rank];
226 "ELASTIC_MECHANICS",
COL, &
F);
231 ->createMPIAIJWithArrays<PetscGlobalIdx_mi_tag>(
"ELASTIC_MECHANICS",
238 inertia.getLoopFeMassRhs().ts_F =
F;
239 inertia.getLoopFeMassRhs().ts_a = 1;
240 inertia.getLoopFeMassLhs().ts_B = Aij;
241 inertia.getLoopFeMassLhs().ts_a = 1;
243 inertia.getLoopFeVelRhs().ts_F =
F;
244 inertia.getLoopFeVelRhs().ts_a = 1;
245 inertia.getLoopFeVelLhs().ts_B = Aij;
246 inertia.getLoopFeVelLhs().ts_a = 1;
249 inertia.getLoopFeMassRhs());
251 inertia.getLoopFeVelRhs());
252 CHKERR VecGhostUpdateBegin(
F, ADD_VALUES, SCATTER_REVERSE);
253 CHKERR VecGhostUpdateEnd(
F, ADD_VALUES, SCATTER_REVERSE);
258 inertia.getLoopFeMassLhs());
260 inertia.getLoopFeVelLhs());
261 CHKERR MatAssemblyBegin(Aij, MAT_FINAL_ASSEMBLY);
262 CHKERR MatAssemblyEnd(Aij, MAT_FINAL_ASSEMBLY);
266 CHKERR PetscPrintf(PETSC_COMM_WORLD,
"sum = %9.8e\n", sum);
268 CHKERR VecNorm(
F, NORM_2, &fnorm);
269 CHKERR PetscPrintf(PETSC_COMM_WORLD,
"fnorm = %9.8e\n", fnorm);
272 CHKERR MatNorm(Aij, NORM_1, &mnorm);
273 CHKERR PetscPrintf(PETSC_COMM_WORLD,
"mnorm = %9.8e\n", mnorm);
275 if (fabs(sum - 6.27285463e+00) > 1e-8) {
278 if (fabs(fnorm - 1.28223353e+00) > 1e-6) {
281 if (fabs(mnorm - 1.31250000e+00) > 1e-6) {
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface reference to pointer of interface.
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.
MoFEMErrorCode setVelocityOperators(string velocity_field_name, string spatial_position_field_name, string material_position_field_name="MESH_NODE_POSITIONS", bool ale=false)
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
#define _IT_CUBITMESHSETS_BY_BCDATA_TYPE_FOR_LOOP_(MESHSET_MANAGER, CUBITBCTYPE, IT)
Iterator that loops over a specific Cubit MeshSet in a moFEM field.
static MoFEMErrorCode Finalize()
Checks for options to be called at the conclusion of the program.
MoFEMErrorCode setConvectiveMassOperators(string velocity_field_name, string spatial_position_field_name, string material_position_field_name="MESH_NODE_POSITIONS", bool ale=false, bool linear=false)
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.
MoFEMErrorCode addVelocityElement(string element_name, string velocity_field_name, string spatial_position_field_name, string material_position_field_name="MESH_NODE_POSITIONS", bool ale=false, BitRefLevel bit=BitRefLevel())
DeprecatedCoreInterface Interface
structure grouping operators and data used for calculation of mass (convective) element
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
#define CHKERR
Inline error check.
MoFEMErrorCode addConvectiveMassElement(string element_name, string velocity_field_name, string spatial_position_field_name, string material_position_field_name="MESH_NODE_POSITIONS", bool ale=false, BitRefLevel bit=BitRefLevel())
virtual MoFEMErrorCode add_finite_element(const std::string &fe_name, enum MoFEMTypes bh=MF_EXCL, int verb=DEFAULT_VERBOSITY)=0
add finite element
implementation of Data Operators for Forces and Sources
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
virtual MoFEMErrorCode build_finite_elements(int verb=DEFAULT_VERBOSITY)=0
Build finite elements.
virtual MoFEMErrorCode add_ents_to_finite_element_by_bit_ref(const BitRefLevel &bit, const BitRefLevel &mask, const std::string &name, EntityType type, int verb=DEFAULT_VERBOSITY)=0
add TET entities from given refinement level to finite element database given by name
int main(int argc, char *argv[])
virtual MoFEMErrorCode modify_finite_element_add_field_data(const std::string &fe_name, const std::string name_field)=0
set finite element field data
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
Vector manager is used to create vectors \mofem_vectors.
Matrix manager is used to build and partition problems.
MoFEMErrorCode setBlocks()
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)
@ AINSWORTH_LEGENDRE_BASE
Ainsworth Cole (Legendre) approx. base .
const FTensor::Tensor2< T, Dim, Dim > Vec
PetscErrorCode PetscOptionsGetString(PetscOptions *, const char pre[], const char name[], char str[], size_t size, PetscBool *set)
virtual MoFEMErrorCode build_fields(int verb=DEFAULT_VERBOSITY)=0
const double D
diffusivity
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.
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)
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 partitionProblem(const std::string name, int verb=VERBOSE)
partition problem dofs (collective)