|
| v0.14.0
|
Go to the documentation of this file.
21 using namespace MoFEM;
25 #include <boost/numeric/ublas/vector_proxy.hpp>
26 #include <boost/numeric/ublas/matrix.hpp>
27 #include <boost/numeric/ublas/matrix_proxy.hpp>
28 #include <boost/numeric/ublas/vector.hpp>
29 #include <adolc/adolc.h>
33 #include <boost/iostreams/tee.hpp>
34 #include <boost/iostreams/stream.hpp>
37 namespace bio = boost::iostreams;
38 using bio::tee_device;
41 static char help[] =
"...\n\n";
43 int main(
int argc,
char *argv[]) {
53 PetscBool flg = PETSC_TRUE;
56 if(flg != PETSC_TRUE) {
57 SETERRQ(PETSC_COMM_SELF,1,
"*** ERROR -my_file (MESH FILE NEEDED)");
62 ParallelComm* pcomm = ParallelComm::get_pcomm(&moab,
MYPCOMM_INDEX);
63 if(pcomm == NULL) pcomm =
new ParallelComm(&moab,PETSC_COMM_WORLD);
80 bool check_if_spatial_field_exist = m_field.
check_field(
"SPATIAL_POSITION");
105 if(flg != PETSC_TRUE) {
146 if (!check_if_spatial_field_exist) {
148 ierr = m_field.
loop_dofs(
"MESH_NODE_POSITIONS", ent_method_material); CHKERRQ(
ierr);
193 material_data[0].gAlpha = 1;
194 material_data[0].vAlpha = 0.3;
195 material_data[0].gBeta = 1;
196 material_data[0].vBeta = 0.3;
197 material_data[0].gBetaHat = 1;
198 material_data[0].vBetaHat = 0.3;
199 material_data[0].oMega = 1;
200 material_data[0].vIscosity = 1;
201 material_data[0].pErmeability = 2.;
205 rval = moab.tag_get_handle(
206 "BLOCK_ID",1,MB_TYPE_INTEGER,th_block_id,MB_TAG_CREAT|MB_TAG_SPARSE,&def_block
212 common_data.
muName =
"CHEMICAL_LOAD";
213 common_data.
muNameDot =
"CHEMICAL_LOAD_DOT";
218 for(
int ss = 0;ss<2;ss++) {
279 DMType dm_name =
"DMGEL";
282 ierr = DMCreate(PETSC_COMM_WORLD,&dm);CHKERRQ(
ierr);
283 ierr = DMSetType(dm,dm_name);CHKERRQ(
ierr);
285 ierr = DMSetFromOptions(dm); CHKERRQ(
ierr);
299 ierr = VecGhostUpdateBegin(
F,INSERT_VALUES,SCATTER_FORWARD); CHKERRQ(
ierr);
300 ierr = VecGhostUpdateEnd(
F,INSERT_VALUES,SCATTER_FORWARD); CHKERRQ(
ierr);
301 ierr = VecZeroEntries(U_t); CHKERRQ(
ierr);
302 ierr = VecGhostUpdateBegin(U_t,INSERT_VALUES,SCATTER_FORWARD); CHKERRQ(
ierr);
303 ierr = VecGhostUpdateEnd(U_t,INSERT_VALUES,SCATTER_FORWARD); CHKERRQ(
ierr);
313 ierr = VecAssemblyBegin(
F); CHKERRQ(
ierr);
315 ierr = MatAssemblyBegin(
M,MAT_FINAL_ASSEMBLY); CHKERRQ(
ierr);
316 ierr = MatAssemblyEnd(
M,MAT_FINAL_ASSEMBLY); CHKERRQ(
ierr);
323 ierr = PetscViewerASCIIOpen(PETSC_COMM_WORLD,
"gel_jacobian_test.txt",&viewer); CHKERRQ(
ierr);
324 ierr = PetscViewerDestroy(&viewer); CHKERRQ(
ierr);
332 ierr = MatNorm(
M,NORM_1,&mnorm); CHKERRQ(
ierr);
333 ierr = PetscPrintf(PETSC_COMM_WORLD,
"mnorm = %9.8e\n",mnorm); CHKERRQ(
ierr);
335 if(fabs(mnorm-6.54443978e+01)>1e-6) {
342 ierr = VecDestroy(&U_t); CHKERRQ(
ierr);
344 ierr = DMDestroy(&dm); CHKERRQ(
ierr);
map< int, BlockMaterialData > blockMaterialData
#define MYPCOMM_INDEX
default communicator number PCOMM
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.
PetscReal ts_a
shift for U_t (see PETSc Time Solver)
Vec & ts_F
residual vector
#define CHKERRQ_MOAB(a)
check error code of MoAB function
string spatialPositionName
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
@ L2
field with C-1 continuity
Projection of edge entities with one mid-node on hierarchical basis.
static MoFEMErrorCode Finalize()
Checks for options to be called at the conclusion of the program.
string spatialPositionNameDot
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.
PetscErrorCode DMMoFEMAddElement(DM dm, std::string fe_name)
add element to dm
Implementation of Gel constitutive model.
Deprecated interface functions.
DeprecatedCoreInterface Interface
int main(int argc, char *argv[])
PetscErrorCode DMCreateGlobalVector_MoFEM(DM dm, Vec *g)
DMShellSetCreateGlobalVector.
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
static MoFEMErrorCodeGeneric< moab::ErrorCode > rval
FTensor::Index< 'M', 3 > M
PetscErrorCode DMCreateMatrix_MoFEM(DM dm, Mat *M)
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.
Common data for gel model.
Vec & ts_u_t
time derivative of state vector
PetscErrorCode DMRegister_MoFEM(const char sname[])
Register MoFEM problem.
Post-process fields on refined mesh.
virtual bool check_field(const std::string &name) const =0
check if field is in database
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.
virtual MoFEMErrorCode modify_finite_element_add_field_data(const std::string &fe_name, const std::string name_field)=0
set finite element field data
Implementation of Gel finite element.
Calculating right hand side.
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.
static MoFEMErrorCodeGeneric< PetscErrorCode > ierr
@ AINSWORTH_LEGENDRE_BASE
Ainsworth Cole (Legendre) approx. base .
boost::ptr_deque< UserDataOperator > & getOpPtrVector()
Use to push back operator for row operator.
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
DEPRECATED MoFEMErrorCode seed_ref_level_3D(const EntityHandle meshset, const BitRefLevel &bit, int verb=-1)
seed 2D entities in the meshset and their adjacencies (only TETs adjacencies) in a particular BitRefL...
Assemble internal force vector.
Constitutive model functions.
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.
Mat & ts_B
Preconditioner for ts_A.
PetscErrorCode DMoFEMLoopFiniteElements(DM dm, const char fe_name[], MoFEM::FEMethod *method, CacheTupleWeakPtr cache_ptr=CacheTupleSharedPtr())
Executes FEMethod for finite elements in DM.
PetscErrorCode PetscOptionsGetInt(PetscOptions *, const char pre[], const char name[], PetscInt *ivalue, PetscBool *set)
boost::shared_ptr< Gel::ConstitutiveEquation< adouble > > constitutiveEquationPtr
Calculate internal forces for solvent flux.
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.
definition of volume element