17                                 {
   18 
   20 
   21  try {
   22 
   23    moab::Core mb_instance;
   24    moab::Interface &moab = mb_instance;
   25 
   26    {
   27      PetscBool flg = PETSC_TRUE;
   31      ;
   32      if (flg != PETSC_TRUE) {
   33        SETERRQ(PETSC_COMM_SELF, 1, "*** ERROR -my_file (MESH FILE NEEDED)");
   34      }
   35      const char *option;
   36      option = ""; 
   38    }
   39 
   43    bit_level0.set(0);
   45        0, 3, bit_level0);
   46    ;
   47 
   48    
   49    {
   50 
   51      
   52      {
   53        
   54        
   55        
   56 
   57        bool check_if_spatial_field_exist =
   62 
   63        
   65        
   66        
   68                                                 "SPATIAL_POSITION");
   69 
   70        PetscBool flg;
   73                                  &flg);
   74        ;
   75        if (flg != PETSC_TRUE) {
   77        }
   79          
   80        }
   81 
   89                                       1);
   90 
   92 
   93        
   94        
   95        if (!check_if_spatial_field_exist) {
   97                                                           "SPATIAL_POSITION");
   99        }
  100      }
  101 
  102      
  103      {
  106                                                           "SPATIAL_POSITION");
  108                                                           "SPATIAL_POSITION");
  109 
  111                                                            "SPATIAL_POSITION");
  112                                                            
  115                                                          "DAMPER_FE");
  116 
  117        
  119        
  121      }
  122    }
  123 
  124    
  126    {
  127 
  128      int id = 0;
  130          damper.blockMaterialDataMap[id];
  131      damper.constitutiveEquationMap.insert(
  132          id,
  134 
  135      
  136      CHKERR moab.get_entities_by_type(0, MBTET, material_data.
tEts);
 
  137      material_data.
gBeta = 1;
 
  138      material_data.
vBeta = 0.3;
 
  139 
  143 
  144      for (auto &&fe_ptr : {&damper.feRhs, &damper.feLhs}) {
  145        
  146        
  147        
  148        
  149        fe_ptr->getOpPtrVector().push_back(
  153        fe_ptr->getOpPtrVector().push_back(
  156        fe_ptr->getOpPtrVector().push_back(
  160        fe_ptr->getOpPtrVector().push_back(
  163      }
  164 
  165      
  166      std::vector<int> tags;
  167      tags.push_back(1);
  168 
  170          damper.constitutiveEquationMap.at(id);
  171 
  172      
  174          "SPATIAL_POSITION", tags, ce, damper.commonData, true, false));
  175      damper.feRhs.getOpPtrVector().push_back(
  177 
  178      
  180          "SPATIAL_POSITION", tags, ce, damper.commonData, false, true));
  181      damper.feLhs.getOpPtrVector().push_back(
  183    }
  184 
  185    
  186    DM dm;
  187    DMType dm_name = "DMDAMPER";
  188    {
  190      CHKERR DMCreate(PETSC_COMM_WORLD, &dm);
 
  191      CHKERR DMSetType(dm, dm_name);
 
  193      CHKERR DMSetFromOptions(dm);
 
  194      
  197    }
  198 
  199    
  202    {
  207      CHKERR VecGhostUpdateBegin(
F, INSERT_VALUES, SCATTER_FORWARD);
 
  208      CHKERR VecGhostUpdateEnd(
F, INSERT_VALUES, SCATTER_FORWARD);
 
  209      CHKERR VecZeroEntries(U_t);
 
  210      CHKERR VecGhostUpdateBegin(U_t, INSERT_VALUES, SCATTER_FORWARD);
 
  211      CHKERR VecGhostUpdateEnd(U_t, INSERT_VALUES, SCATTER_FORWARD);
 
  213      damper.feRhs.ts_F = 
F; 
 
  214      damper.feRhs.ts_u_t = U_t;
  217      damper.feLhs.ts_B = 
M;   
 
  218      damper.feLhs.ts_a = 1.0; 
  219      damper.feLhs.ts_u_t = U_t;
  223      CHKERR MatAssemblyBegin(M, MAT_FINAL_ASSEMBLY);
 
  224      CHKERR MatAssemblyEnd(M, MAT_FINAL_ASSEMBLY);
 
  225    }
  226 
  227    
  228    {
  229 
  230      PetscViewer viewer;
  231      CHKERR PetscViewerASCIIOpen(PETSC_COMM_WORLD, 
"damper_jacobian_test.txt",
 
  232                                  &viewer);
  233      CHKERR PetscViewerDestroy(&viewer);
 
  234      
  235      
  236      
  237    }
  238 
  239    
  240    {
  245    }
  246  }
  248 
  250 
  251  return 0;
  252}
#define CATCH_ERRORS
Catch errors.
@ AINSWORTH_LEGENDRE_BASE
Ainsworth Cole (Legendre) approx. base .
#define CHKERR
Inline error check.
PetscErrorCode DMMoFEMAddElement(DM dm, std::string fe_name)
add element to dm
PetscErrorCode DMMoFEMCreateMoFEM(DM dm, MoFEM::Interface *m_field_ptr, const char problem_name[], const MoFEM::BitRefLevel bit_level, const MoFEM::BitRefLevel bit_mask=MoFEM::BitRefLevel().set())
Must be called by user to set MoFEM data structures.
PetscErrorCode DMCreateMatrix_MoFEM(DM dm, Mat *M)
PetscErrorCode DMRegister_MoFEM(const char sname[])
Register MoFEM problem.
PetscErrorCode DMoFEMLoopFiniteElements(DM dm, const char fe_name[], MoFEM::FEMethod *method, CacheTupleWeakPtr cache_ptr=CacheTupleSharedPtr())
Executes FEMethod for finite elements in DM.
PetscErrorCode DMCreateGlobalVector_MoFEM(DM dm, Vec *g)
DMShellSetCreateGlobalVector.
virtual MoFEMErrorCode add_finite_element(const std::string &fe_name, enum MoFEMTypes bh=MF_EXCL, int verb=DEFAULT_VERBOSITY)=0
add finite element
virtual MoFEMErrorCode build_finite_elements(int verb=DEFAULT_VERBOSITY)=0
Build finite elements.
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 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
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
virtual MoFEMErrorCode modify_finite_element_add_field_data(const std::string &fe_name, const std::string name_field)=0
set finite element field data
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 bool check_field(const std::string &name) const =0
check if field is in database
virtual MoFEMErrorCode loop_dofs(const Problem *problem_ptr, const std::string &field_name, RowColData rc, DofMethod &method, int lower_rank, int upper_rank, int verb=DEFAULT_VERBOSITY)=0
Make a loop over dofs.
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)
FTensor::Index< 'M', 3 > M
Dumper material parameters.
double vBeta
Poisson ration spring alpha.
double gBeta
Sheer modulus spring alpha.
Common data for nonlinear_elastic_elem model.
string spatialPositionNameDot
string spatialPositionName
boost::shared_ptr< MatrixDouble > gradDataAtGaussTmpPtr
Constitutive model functions.
Assemble internal force vector.
Implementation of Kelvin Voigt Damper.
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.
Get field gradients time derivative at integration pts for scalar field rank 0, i....
Get field gradients at integration pts for scalar field rank 0, i.e. vector field.
Projection of edge entities with one mid-node on hierarchical basis.
@ CTX_TSSETIFUNCTION
Setting up implicit function.
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface reference to pointer of interface.