22                                 {
   23 
   25 
   26  try {
   27 
   28    moab::Core mb_instance;
   29    moab::Interface &moab = mb_instance;
   30    int rank;
   31    MPI_Comm_rank(PETSC_COMM_WORLD, &rank);
   32 
   33    PetscBool flg = PETSC_TRUE;
   37    if (flg != PETSC_TRUE) {
   38      SETERRQ(PETSC_COMM_SELF, 1, "*** ERROR -my_file (MESH FILE NEEDED)");
   39    }
   40 
   41    const char *option;
   42    option = ""; 
   44 
   47 
   48    
   50    bit_level0.set(0);
   52    CHKERR moab.create_meshset(MESHSET_SET, meshset_level0);
 
   54        0, 3, bit_level0);
   57 
   58    
   60                             3);
   61    
   63    
   66                              &flg);
   67    if (flg != PETSC_TRUE) {
   69    }
   74 
   76    boost::shared_ptr<
   78    double_kirchhoff_material_ptr(
   80            double>());
   81    boost::shared_ptr<
   83        adouble_kirchhoff_material_ptr(
   86    CHKERR elastic.setBlocks(double_kirchhoff_material_ptr,
 
   87                             adouble_kirchhoff_material_ptr);
   88    CHKERR elastic.addElement(
"ELASTIC", 
"SPATIAL_POSITION");
 
   89    CHKERR elastic.setOperators(
"SPATIAL_POSITION");
 
   90 
   91    
   93    
   95                                                    bit_level0);
   96    
   98                                                     "ELASTIC");
   99 
  100    
  102 
  103    
  104    double scale_positions = 2;
  105    {
  107      double coords[3];
  109                                                dof_ptr)) {
  110        if (dof_ptr->get()->getEntType() != MBVERTEX)
  111          continue;
  113        int dof_rank = dof_ptr->get()->getDofCoeffIdx();
  114        double &fval = dof_ptr->get()->getFieldData();
  115        if (node != ent) {
  116          CHKERR moab.get_coords(&ent, 1, coords);
 
  117          node = ent;
  118        }
  119        fval = scale_positions * coords[dof_rank];
  120      }
  121    }
  122 
  123    
  125    
  127 
  130    
  132    
  136 
  137    
  140        "ELASTIC_MECHANICS", 
COL, &
F);
 
  141    Mat Aij;
  143        ->createMPIAIJWithArrays<PetscGlobalIdx_mi_tag>("ELASTIC_MECHANICS",
  144                                                        &Aij);
  145 
  146    elastic.getLoopFeRhs().snes_f = 
F;
 
  147    elastic.getLoopFeLhs().snes_B = Aij;
  148 
  150                                        elastic.getLoopFeRhs());
  151    CHKERR VecGhostUpdateBegin(
F, ADD_VALUES, SCATTER_REVERSE);
 
  152    CHKERR VecGhostUpdateEnd(
F, ADD_VALUES, SCATTER_REVERSE);
 
  155 
  157                                        elastic.getLoopFeLhs());
  158    CHKERR MatAssemblyBegin(Aij, MAT_FINAL_ASSEMBLY);
 
  159    CHKERR MatAssemblyEnd(Aij, MAT_FINAL_ASSEMBLY);
 
  160 
  161    double sum = 0;
  163    CHKERR PetscPrintf(PETSC_COMM_WORLD, 
"sum  = %4.3e\n", sum);
 
  164    double fnorm;
  165    CHKERR VecNorm(
F, NORM_2, &fnorm);
 
  166    CHKERR PetscPrintf(PETSC_COMM_WORLD, 
"fnorm  = %9.8e\n", fnorm);
 
  167 
  168    double mnorm;
  169    CHKERR MatNorm(Aij, NORM_1, &mnorm);
 
  170    CHKERR PetscPrintf(PETSC_COMM_WORLD, 
"mnorm  = %9.8e\n", mnorm);
 
  171 
  172    if (fabs(sum) > 1e-8) {
  174    }
  175    if (fabs(fnorm - 5.12196914e+00) > 1e-6) {
  177    }
  178    if (fabs(mnorm - 5.48280139e+01) > 1e-6) {
  180    }
  181 
  184  }
  186 
  188 
  189  return 0;
  190}
#define CATCH_ERRORS
Catch errors.
@ AINSWORTH_LEGENDRE_BASE
Ainsworth Cole (Legendre) approx. base .
@ MOFEM_ATOM_TEST_INVALID
#define CHKERR
Inline error check.
#define _IT_GET_DOFS_FIELD_BY_NAME_FOR_LOOP_(MFIELD, NAME, IT)
virtual MoFEMErrorCode build_finite_elements(int verb=DEFAULT_VERBOSITY)=0
Build finite elements.
virtual MoFEMErrorCode build_fields(int verb=DEFAULT_VERBOSITY)=0
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.
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.
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 partitionGhostDofs(const std::string name, int verb=VERBOSE)
determine ghost nodes
MoFEMErrorCode buildProblem(const std::string name, const bool square_matrix, int verb=VERBOSE)
build problem data structures
MoFEMErrorCode partitionProblem(const std::string name, int verb=VERBOSE)
partition problem dofs (collective)
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 add_problem(const std::string &name, enum MoFEMTypes bh=MF_EXCL, int verb=DEFAULT_VERBOSITY)=0
Add problem.
virtual MoFEMErrorCode modify_problem_ref_level_add_bit(const std::string &name_problem, const BitRefLevel &bit)=0
add ref level to problem
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
const FTensor::Tensor2< T, Dim, Dim > Vec
std::bitset< BITREFLEVEL_SIZE > BitRefLevel
Bit structure attached to each entity identifying to what mesh entity is attached.
PetscErrorCode PetscOptionsGetInt(PetscOptions *, const char pre[], const char name[], PetscInt *ivalue, PetscBool *set)
PetscErrorCode PetscOptionsGetString(PetscOptions *, const char pre[], const char name[], char str[], size_t size, PetscBool *set)
virtual MoFEMErrorCode build_adjacencies(const Range &ents, int verb=DEFAULT_VERBOSITY)=0
build adjacencies
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.
static MoFEMErrorCode Initialize(int *argc, char ***args, const char file[], const char help[])
Initializes the MoFEM database PETSc, MOAB and MPI.
static MoFEMErrorCode Finalize()
Checks for options to be called at the conclusion of the program.
Deprecated interface functions.
Matrix manager is used to build and partition problems.
Problem manager is used to build and partition problems.
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface reference to pointer of interface.
Vector manager is used to create vectors \mofem_vectors.
Implementation of elastic (non-linear) St. Kirchhoff equation.
structure grouping operators and data used for calculation of nonlinear elastic element