#include <ArcLengthTools.hpp>
#include <HookeOps.hpp>
using namespace boost::numeric;
-my_file mesh file name\n\
-my_sr reduction of step size\n\
-my_its_d desired number of steps\n\
-my_ms maximal number of steps\n\n";
#define DATAFILENAME "load_disp.txt"
struct ArcLengthElement : public ArcLengthIntElemFEMethod {
boost::shared_ptr<ArcLengthCtx> &arc_ptr)
: ArcLengthIntElemFEMethod(m_field.
get_moab(), arc_ptr),
mField(m_field) {
EntityHandle meshset = cit->getMeshset();
CHKERRABORT(PETSC_COMM_WORLD,
mOab.get_entities_by_type(meshset, MBVERTEX, nodes,
true));
}
MOFEM_LOG_C(
"ARC_LENGTH", Sev::inform,
"Nb. PostProcNodes %lu",
};
FILE *datafile;
boost::shared_ptr<NumeredDofEntity_multiIndex> numered_dofs_rows =
problemPtr->getNumeredRowDofsPtr();
auto lit = numered_dofs_rows->lower_bound(
FieldEntity::getLoBitNumberUId(bit_number_lambda));
auto hi_lit = numered_dofs_rows->upper_bound(
FieldEntity::getHiBitNumberUId(bit_number_lambda));
if (lit == numered_dofs_rows->end()) {
fclose(datafile);
} else if (std::distance(lit, hi_lit) != 1) {
"Only one DOF is expected");
}
NumeredDofEntityByEnt::iterator dit, hi_dit;
dit = numered_dofs_rows->get<
Ent_mi_tag>().lower_bound(*nit);
hi_dit = numered_dofs_rows->get<
Ent_mi_tag>().upper_bound(*nit);
double coords[3];
for (; dit != hi_dit; dit++) {
"ARC_LENGTH", Sev::inform,
"%s [ %d ] %6.4e -> %s [ %d ] %6.4e -> %3.4f %3.4f %3.4f",
lit->get()->getName().c_str(), lit->get()->getDofCoeffIdx(),
lit->get()->getFieldData(), dit->get()->getName().c_str(),
dit->get()->getDofCoeffIdx(), dit->get()->getFieldData(), coords[0],
coords[1], coords[2]);
CHKERR PetscFPrintf(PETSC_COMM_WORLD, datafile,
"%6.4e %6.4e ",
dit->get()->getFieldData(),
lit->get()->getFieldData());
}
}
CHKERR PetscFPrintf(PETSC_COMM_WORLD, datafile,
"\n");
fclose(datafile);
}
};
struct AssembleRhsVectors :
public FEMethod {
boost::shared_ptr<ArcLengthCtx>
arcPtr;
AssembleRhsVectors(boost::shared_ptr<ArcLengthCtx> &arc_ptr)
} break;
CHKERR VecGhostUpdateBegin(
snes_f, INSERT_VALUES, SCATTER_FORWARD);
CHKERR VecGhostUpdateEnd(
snes_f, INSERT_VALUES, SCATTER_FORWARD);
} break;
default:
}
}
} break;
CHKERR VecGhostUpdateBegin(
snes_f, ADD_VALUES, SCATTER_REVERSE);
CHKERR VecGhostUpdateEnd(
snes_f, ADD_VALUES, SCATTER_REVERSE);
MOFEM_LOG_C(
"ARC_LENGTH", Sev::inform,
"\tlambda = %6.4e",
double fnorm;
MOFEM_LOG_C(
"ARC_LENGTH", Sev::inform,
"\tfnorm = %6.4e", fnorm);
}
} break;
default:
}
}
};
}
int main(
int argc,
char *argv[]) {
const string default_options = "-ksp_type fgmres \n"
"-pc_type lu \n"
"-pc_factor_mat_solver_type mumps\n"
"-mat_mumps_icntl_20 0\n"
"-ksp_monitor \n"
"-ksp_atol 1e-10 \n"
"-ksp_rtol 1e-10 \n"
"-snes_monitor \n"
"-snes_type newtonls \n"
"-snes_linesearch_type l2 \n"
"-snes_linesearch_monitor \n"
"-snes_max_it 16 \n"
"-snes_atol 1e-8 \n"
"-snes_rtol 1e-8 \n"
"-snes_converged_reason \n";
string param_file = "param_file.petsc";
if (!static_cast<bool>(ifstream(param_file))) {
std::ofstream file(param_file.c_str(), std::ios::ate);
if (file.is_open()) {
file << default_options;
file.close();
}
}
auto core_log = logging::core::get();
core_log->add_sink(
LogManager::createSink(LogManager::getStrmWorld(), "ARC_LENGTH"));
LogManager::setLog("ARC_LENGTH");
try {
CHKERR JsonConfigManager::setMeshFileFromJson();
moab::Core mb_instance;
moab::Interface &moab = mb_instance;
int rank;
MPI_Comm_rank(PETSC_COMM_WORLD, &rank);
PetscBool flg = PETSC_TRUE;
char mesh_file_name[PETSC_MAX_PATH_LEN] = "";
mesh_file_name, sizeof(mesh_file_name), &flg);
if (flg != PETSC_TRUE) {
mesh_file_name, sizeof(mesh_file_name),
&flg);
if (flg != PETSC_TRUE)
"*** ERROR -my_file or -file_name (MESH FILE NEEDED)");
}
PetscScalar step_size_reduction;
&step_size_reduction, &flg);
if (flg != PETSC_TRUE) {
step_size_reduction = 1.;
}
PetscInt max_steps;
&max_steps, &flg);
if (flg != PETSC_TRUE) {
max_steps = 5;
}
int its_d;
if (flg != PETSC_TRUE) {
its_d = 6;
}
&flg);
if (flg != PETSC_TRUE) {
}
if (std::string(mesh_file_name).find("restart") == std::string::npos) {
}
const char *option;
option = "";
CHKERR moab.load_file(mesh_file_name, 0, option);
Tag th_step_size, th_step;
double def_step_size = 1;
rval = moab.tag_get_handle("_STEPSIZE", 1, MB_TYPE_DOUBLE, th_step_size,
MB_TAG_CREAT | MB_TAG_MESH, &def_step_size);
if (rval == MB_ALREADY_ALLOCATED)
rval = MB_SUCCESS;
int def_step = 1;
rval = moab.tag_get_handle("_STEP", 1, MB_TYPE_INTEGER, th_step,
MB_TAG_CREAT | MB_TAG_MESH, &def_step);
if (rval == MB_ALREADY_ALLOCATED)
rval = MB_SUCCESS;
const void *tag_data_step_size[1];
EntityHandle root = 0;
CHKERR moab.tag_get_by_ptr(th_step_size, &root, 1, tag_data_step_size);
double &step_size = *(double *)tag_data_step_size[0];
const void *tag_data_step[1];
CHKERR moab.tag_get_by_ptr(th_step, &root, 1, tag_data_step);
int &step = *(int *)tag_data_step[0];
"Start step %d and step_size = %6.4e", step, step_size);
"_MY_REFINEMENT_LEVEL",
sizeof(
BitRefLevel), MB_TYPE_OPAQUE,
th_my_ref_level, MB_TAG_CREAT | MB_TAG_SPARSE | MB_TAG_BYTES,
&def_bit_level);
const EntityHandle root_meshset = m_field.
get_moab().get_root_set();
CHKERR m_field.
get_moab().tag_get_by_ptr(th_my_ref_level, &root_meshset, 1,
(const void **)&ptr_bit_level0);
if (step == 1) {
std::vector<BitRefLevel> bit_levels;
int ll = 1;
MOFEM_LOG_C(
"ARC_LENGTH", Sev::inform,
"Insert Interface %d",
cit->getMeshsetId());
EntityHandle cubit_meshset = cit->getMeshset();
{
EntityHandle ref_level_meshset = 0;
CHKERR moab.create_meshset(MESHSET_SET, ref_level_meshset);
->getEntitiesByTypeAndRefLevel(bit_levels.back(),
ref_level_meshset);
->getEntitiesByTypeAndRefLevel(bit_levels.back(),
ref_level_meshset);
CHKERR moab.get_entities_by_handle(ref_level_meshset, ref_level_tets,
true);
CHKERR interface_ptr->
getSides(cubit_meshset, bit_levels.back(),
true,
0);
cubit_meshset, true, true, 0);
CHKERR moab.delete_entities(&ref_level_meshset, 1);
}
EntityHandle cubit_meshset = ciit->meshset;
->updateMeshsetByEntitiesChildren(cubit_meshset,
bit_levels.back(),
cubit_meshset, MBMAXTYPE, true);
}
}
bit_level0 = bit_levels.back();
problem_bit_level = bit_level0;
"DISPLACEMENT");
"DISPLACEMENT");
"DISPLACEMENT");
"ELASTIC", "MESH_NODE_POSITIONS");
"DISPLACEMENT");
"DISPLACEMENT");
"DISPLACEMENT");
"INTERFACE", "MESH_NODE_POSITIONS");
"LAMBDA");
"LAMBDA");
"ELASTIC");
"INTERFACE");
"ARC_LENGTH");
problem_bit_level);
problem_bit_level,
BitRefLevel().set(),
"ELASTIC", MBTET);
problem_bit_level,
BitRefLevel().set(),
"INTERFACE", MBPRISM);
{
EntityHandle no_field_vertex;
{
const double coords[] = {0, 0, 0};
Range range_no_field_vertex;
range_no_field_vertex.insert(no_field_vertex);
range_no_field_vertex);
}
EntityHandle meshset_fe_arc_length;
{
CHKERR moab.create_meshset(MESHSET_SET, meshset_fe_arc_length);
CHKERR moab.add_entities(meshset_fe_arc_length, &no_field_vertex, 1);
}
meshset_fe_arc_length, "ARC_LENGTH", false);
}
}
const std::string natural_bc_fe_name = "NATURAL_BC";
"DISPLACEMENT");
"DISPLACEMENT");
"DISPLACEMENT");
natural_bc_fe_name, "MESH_NODE_POSITIONS");
natural_bc_fe_name);
CHKERR moab.get_entities_by_type(it->meshset, MBTRI, natural_bc_faces,
true);
}
CHKERR moab.get_entities_by_type(it->meshset, MBTRI, natural_bc_faces,
true);
}
natural_bc_fe_name);
}
"MESH_NODE_POSITIONS");
"ELASTIC_MECHANICS", "DISPLACEMENT");
CHKERR mmanager_ptr->printDisplacementSet();
CHKERR mmanager_ptr->printForceSet();
CHKERR mmanager_ptr->printMaterialsSet();
"ELASTIC_MECHANICS",
COL,
F);
->createMPIAIJWithArrays<PetscGlobalIdx_mi_tag>("ELASTIC_MECHANICS",
Aij);
boost::ptr_vector<CohesiveInterfaceElement::PhysicalEquation>
interface_materials;
string name = it->getName();
if (name.compare(0, 11, "MAT_ELASTIC") == 0) {
CHKERR it->getAttributeDataStructure(mydata);
MOFEM_LOG(
"ARC_LENGTH", Sev::inform) << mydata;
} else if (name.compare(0, 10, "MAT_INTERF") == 0) {
CHKERR it->getAttributeDataStructure(mydata);
MOFEM_LOG(
"ARC_LENGTH", Sev::inform) << mydata;
interface_materials.push_back(
interface_materials.back().h = 1;
interface_materials.back().youngModulus = mydata.
data.alpha;
interface_materials.back().beta = mydata.
data.beta;
interface_materials.back().ft = mydata.
data.ft;
interface_materials.back().Gf = mydata.
data.Gf;
EntityHandle meshset = it->getMeshset();
CHKERR moab.get_entities_by_type(meshset, MBTRI, tris,
true);
CHKERR moab.get_adjacencies(tris, 3,
false, ents3d,
moab::Interface::UNION);
interface_materials.back().pRisms = ents3d.subset_by_type(MBPRISM);
}
}
{
boost::ptr_vector<CohesiveInterfaceElement::PhysicalEquation>::iterator
pit = interface_materials.begin();
for (; pit != interface_materials.end(); pit++) {
}
}
boost::shared_ptr<ArcLengthCtx> arc_ctx = boost::shared_ptr<ArcLengthCtx>(
boost::scoped_ptr<ArcLengthElement> my_arc_method_ptr(
ArcLengthSnesCtx snes_ctx(m_field, "ELASTIC_MECHANICS", arc_ctx);
auto essential_pre_proc = boost::make_shared<FEMethod>();
auto essential_post_proc_rhs = boost::make_shared<FEMethod>();
auto essential_post_proc_lhs = boost::make_shared<FEMethod>();
auto get_essential_pre_proc = [&m_field, essential_pre_proc]() {
essential_pre_proc, {});
};
essential_pre_proc->preProcessHook = get_essential_pre_proc();
essential_post_proc_rhs->postProcessHook =
m_field, essential_post_proc_rhs, 1.);
essential_post_proc_lhs->postProcessHook =
m_field, essential_post_proc_lhs, 1.);
auto elastic_rhs_fe = boost::make_shared<DomainEle>(m_field);
auto elastic_lhs_fe = boost::make_shared<DomainEle>(m_field);
};
elastic_rhs_fe->getRuleHook = elastic_integration_rule;
elastic_lhs_fe->getRuleHook = elastic_integration_rule;
elastic_rhs_fe->getOpPtrVector(), {H1}, "MESH_NODE_POSITIONS");
elastic_lhs_fe->getOpPtrVector(), {H1}, "MESH_NODE_POSITIONS");
CHKERR HookeOps::opFactoryDomainRhs<SPACE_DIM, PETSC, GAUSS, DomainEleOp>(
m_field, elastic_rhs_fe->getOpPtrVector(), "DISPLACEMENT",
"MAT_ELASTIC", Sev::verbose, true);
CHKERR HookeOps::opFactoryDomainLhs<SPACE_DIM, PETSC, GAUSS, DomainEleOp>(
m_field, elastic_lhs_fe->getOpPtrVector(), "DISPLACEMENT",
"MAT_ELASTIC", Sev::verbose);
CHKERR cohesive_elements.addOps(
"DISPLACEMENT", interface_materials);
boost::scoped_ptr<ArcLengthMatShell> mat_ctx(
Mat shell_aij;
CHKERR MatCreateShell(PETSC_COMM_WORLD,
m,
n,
M,
N, (
void *)mat_ctx.get(),
&shell_aij);
CHKERR MatShellSetOperation(ShellAij, MATOP_MULT,
auto natural_bc_fe = boost::make_shared<BoundaryEle>(m_field);
};
"MESH_NODE_POSITIONS");
CHKERR BoundaryRhsBCs::AddFluxToPipeline<OpBoundaryRhsBCs>::add(
natural_bc_fe->getOpPtrVector(), m_field, "DISPLACEMENT", {}, "FORCE",
"PRESSURE", Sev::inform);
boost::scoped_ptr<PCArcLengthCtx> pc_ctx;
CHKERR SNESSetApplicationContext(snes, &snes_ctx);
CHKERR SNESSetFunction(snes,
F, SnesRhs, &snes_ctx);
CHKERR SNESSetJacobian(snes, ShellAij, Aij, SnesMat, &snes_ctx);
CHKERR SNESSetFromOptions(snes);
KSP ksp;
CHKERR SNESGetKSP(snes, &ksp);
PC pc;
CHKERR PCSetType(pc, PCSHELL);
CHKERR PCShellSetContext(pc, pc_ctx.get());
snes_ctx.getPreProcComputeRhs().push_back(essential_pre_proc);
snes_ctx.getPreProcComputeRhs().push_back(&pre_post_proc_fe);
"INTERFACE", &cohesive_elements.getFeRhs()));
loops_to_do_Rhs.push_back(
loops_to_do_Rhs.push_back(
snes_ctx.getPostProcComputeRhs().push_back(&pre_post_proc_fe);
snes_ctx.getPostProcComputeRhs().push_back(essential_post_proc_rhs);
snes_ctx.getPreProcSetOperators().push_back(essential_pre_proc);
"INTERFACE", &cohesive_elements.getFeLhs()));
loops_to_do_Mat.push_back(
loops_to_do_Mat.push_back(
snes_ctx.getPostProcSetOperators().push_back(essential_post_proc_lhs);
double gamma = 0.5, reduction = 1;
if (step == 1) {
step_size = step_size_reduction;
} else {
reduction = step_size_reduction;
step++;
}
CHKERR VecZeroEntries(arc_ctx->F_lambda);
CHKERR VecGhostUpdateBegin(arc_ctx->F_lambda, INSERT_VALUES,
SCATTER_FORWARD);
CHKERR VecGhostUpdateEnd(arc_ctx->F_lambda, INSERT_VALUES, SCATTER_FORWARD);
natural_bc_fe->ksp_f = arc_ctx->F_lambda;
*natural_bc_fe);
CHKERR VecGhostUpdateBegin(arc_ctx->F_lambda, ADD_VALUES, SCATTER_REVERSE);
CHKERR VecGhostUpdateEnd(arc_ctx->F_lambda, ADD_VALUES, SCATTER_REVERSE);
CHKERR VecAssemblyBegin(arc_ctx->F_lambda);
CHKERR VecAssemblyEnd(arc_ctx->F_lambda);
auto zero_f_lambda_on_essential_bc = boost::make_shared<FEMethod>();
zero_f_lambda_on_essential_bc->postProcessHook =
m_field, zero_f_lambda_on_essential_bc, 0., arc_ctx->F_lambda);
"ELASTIC_MECHANICS", *zero_f_lambda_on_essential_bc);
CHKERR VecDot(arc_ctx->F_lambda, arc_ctx->F_lambda, &arc_ctx->F_lambda2);
MOFEM_LOG_C(
"ARC_LENGTH", Sev::inform,
"\tFlambda2 = %6.4e",
arc_ctx->F_lambda2);
if (step > 1) {
"ELASTIC_MECHANICS",
COL,
D, INSERT_VALUES, SCATTER_FORWARD);
"ELASTIC_MECHANICS",
"DISPLACEMENT",
"X0_DISPLACEMENT",
COL,
arc_ctx->x0, INSERT_VALUES, SCATTER_FORWARD);
double x0_nrm;
CHKERR VecNorm(arc_ctx->x0, NORM_2, &x0_nrm);
"\tRead x0_nrm = %6.4e dlambda = %6.4e", x0_nrm,
arc_ctx->dLambda);
CHKERR arc_ctx->setAlphaBeta(1, 0);
} else {
CHKERR arc_ctx->setAlphaBeta(0, 1);
}
m_field);
auto disp_ptr = boost::make_shared<MatrixDouble>();
post_proc.getOpPtrVector(), {H1}, "MESH_NODE_POSITIONS");
auto hooke_common_ptr =
HookeOps::commonDataFactory<SPACE_DIM, GAUSS, DomainEleOp>(
m_field, post_proc.getOpPtrVector(), "DISPLACEMENT", "MAT_ELASTIC",
Sev::verbose);
post_proc.getOpPtrVector().push_back(
post_proc.getOpPtrVector().push_back(
new OpPPMap(post_proc.getPostProcMesh(), post_proc.getMapGaussPts(), {},
{{"DISPLACEMENT", disp_ptr}},
{{"DISPLACEMENT_GRAD", hooke_common_ptr->matGradPtr}},
{{"STRAIN", hooke_common_ptr->getMatStrain()},
{"STRESS", hooke_common_ptr->getMatCauchyStress()}}));
bool converged_state = false;
for (; step < max_steps; step++) {
if (step == 1) {
"Load Step %d step_size = %6.4e", step, step_size);
CHKERR arc_ctx->setS(step_size);
CHKERR arc_ctx->setAlphaBeta(0, 1);
double dlambda;
CHKERR my_arc_method_ptr->calculate_init_dlambda(&dlambda);
CHKERR my_arc_method_ptr->set_dlambda_to_x(D_raw, dlambda);
} else if (step == 2) {
CHKERR arc_ctx->setAlphaBeta(1, 0);
CHKERR my_arc_method_ptr->calculate_dx_and_dlambda(D_raw);
CHKERR my_arc_method_ptr->calculate_lambda_int(step_size);
CHKERR arc_ctx->setS(step_size);
double dlambda = arc_ctx->dLambda;
double dx_nrm;
CHKERR VecNorm(arc_ctx->dx, NORM_2, &dx_nrm);
"Load Step %d step_size = %6.4e dlambda0 = %6.4e "
"dx_nrm = %6.4e dx2 = %6.4e",
step, step_size, dlambda, dx_nrm, arc_ctx->dx2);
CHKERR VecAXPY(
D, 1., arc_ctx->dx);
CHKERR my_arc_method_ptr->set_dlambda_to_x(D_raw, dlambda);
} else {
CHKERR my_arc_method_ptr->calculate_dx_and_dlambda(D_raw);
CHKERR my_arc_method_ptr->calculate_lambda_int(step_size);
step_size *= reduction;
CHKERR arc_ctx->setS(step_size);
double dlambda = reduction * arc_ctx->dLambda;
CHKERR VecScale(arc_ctx->dx, reduction);
double dx_nrm;
CHKERR VecNorm(arc_ctx->dx, NORM_2, &dx_nrm);
"Load Step %d step_size = %6.4e dlambda0 = %6.4e "
"dx_nrm = %6.4e dx2 = %6.4e",
step, step_size, dlambda, dx_nrm, arc_ctx->dx2);
CHKERR VecAXPY(
D, 1., arc_ctx->dx);
CHKERR my_arc_method_ptr->set_dlambda_to_x(D_raw, dlambda);
}
CHKERR SNESSolve(snes, PETSC_NULLPTR,
D);
"ELASTIC_MECHANICS",
COL,
D, INSERT_VALUES, SCATTER_REVERSE);
cohesive_elements.getFeHistory(), 0,
CHKERR my_arc_method_ptr->remove_damaged_prisms_nodes();
int its;
CHKERR SNESGetIterationNumber(snes, &its);
"number of Newton iterations = %d", its);
SNESConvergedReason reason;
CHKERR SNESGetConvergedReason(snes, &reason);
if (reason < 0) {
CHKERR arc_ctx->setAlphaBeta(1, 0);
reduction = 0.1;
converged_state = false;
continue;
} else {
if (step > 1 && converged_state) {
reduction = pow((double)its_d / (double)(its + 1), gamma);
"reduction step_size = %6.4e", reduction);
}
"ELASTIC_MECHANICS",
COL,
D, INSERT_VALUES, SCATTER_REVERSE);
"ELASTIC_MECHANICS",
"DISPLACEMENT",
"X0_DISPLACEMENT",
COL,
arc_ctx->x0, INSERT_VALUES, SCATTER_REVERSE);
converged_state = true;
}
if (reason > 0) {
FILE *datafile;
CHKERR PetscFPrintf(PETSC_COMM_WORLD, datafile,
"%d %d ", reason, its);
fclose(datafile);
CHKERR my_arc_method_ptr->postProcessLoadPath();
}
if (step % 1 == 0) {
post_proc);
std::ostringstream ss;
ss << "out_values_" << step << ".h5m";
CHKERR post_proc.writeFile(ss.str().c_str());
}
}
"ELASTIC_MECHANICS",
COL,
D, INSERT_VALUES, SCATTER_REVERSE);
}
return 0;
}
Implementation of linear interface element.
Implementation of arc-length control for cohesive elements.
#define MOFEM_LOG_C(channel, severity, format,...)
ElementsAndOps< SPACE_DIM >::DomainEle DomainEle
ElementsAndOps< SPACE_DIM >::BoundaryEle BoundaryEle
#define CATCH_ERRORS
Catch errors.
@ AINSWORTH_LEGENDRE_BASE
Ainsworth Cole (Legendre) approx. base .
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
@ NOFIELD
scalar or vector of scalars describe (no true field)
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define CHKERR
Inline error check.
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_MESHSET(const EntityHandle meshset, const std::string &name, const bool recursive=false)=0
add MESHSET element to finite element database given by name
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 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
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.
#define MOFEM_LOG(channel, severity)
Log.
#define MOFEM_LOG_TAG(channel, tag)
Tag channel.
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.
virtual MoFEMErrorCode problem_basic_method_postProcess(const Problem *problem_ptr, BasicMethod &method, int verb=DEFAULT_VERBOSITY)=0
Set data for BasicMethod.
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.
#define _IT_CUBITMESHSETS_BY_NAME_FOR_LOOP_(MESHSET_MANAGER, NAME, IT)
Iterator that loops over Cubit BlockSet having a particular name.
#define _IT_CUBITMESHSETS_BY_BCDATA_TYPE_FOR_LOOP_(MESHSET_MANAGER, CUBITBCTYPE, IT)
Iterator that loops over a specific Cubit MeshSet in a moFEM field.
#define _IT_CUBITMESHSETS_FOR_LOOP_(MESHSET_MANAGER, IT)
Iterator that loops over all the Cubit MeshSets in a moFEM field.
#define _IT_CUBITMESHSETS_BY_SET_TYPE_FOR_LOOP_(MESHSET_MANAGER, CUBITBCTYPE, IT)
Iterator that loops over a specific Cubit MeshSet having a particular BC meshset in a moFEM field.
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
MoFEMErrorCode pushMarkDOFsOnEntities(const std::string problem_name, const std::string block_name, const std::string field_name, int lo, int hi, bool get_low_dim_ents=true)
Mark DOFs on block entities for boundary conditions.
const double n
refractive index of diffusive medium
const FTensor::Tensor2< T, Dim, Dim > Vec
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
std::bitset< BITREFLEVEL_SIZE > BitRefLevel
Bit structure attached to each entity identifying to what mesh entity is attached.
implementation of Data Operators for Forces and Sources
auto createSNES(MPI_Comm comm)
PetscErrorCode PetscOptionsGetInt(PetscOptions *, const char pre[], const char name[], PetscInt *ivalue, PetscBool *set)
PetscErrorCode PetscOptionsGetReal(PetscOptions *, const char pre[], const char name[], PetscReal *dval, PetscBool *set)
PetscErrorCode SnesRhs(SNES snes, Vec x, Vec f, void *ctx)
This is MoFEM implementation for the right hand side (residual vector) evaluation in SNES solver.
SmartPetscObj< Vec > vectorDuplicate(Vec vec)
Create duplicate vector of smart vector.
PetscErrorCode PetscOptionsGetString(PetscOptions *, const char pre[], const char name[], char str[], size_t size, PetscBool *set)
OpPostProcMapInMoab< SPACE_DIM, SPACE_DIM > OpPPMap
static constexpr int approx_order
FTensor::Index< 'm', 3 > m
Store variables for ArcLength analysis.
shell matrix for arc-length method
MoFEMErrorCode postProcessLoadPath()
MoFEM::Interface & mField
MoFEMErrorCode postProcess()
Post-processing function executed at loop completion.
boost::shared_ptr< ArcLengthCtx > arcPtr
MoFEMErrorCode preProcess()
Pre-processing function executed at loop initialization.
Constitutive (physical) equation for interface.
Cohesive element implementation.
Boundary condition manager for finite element problem setup.
virtual int get_comm_size() const =0
virtual FieldBitNumber get_field_bit_number(const std::string name) const =0
get field bit number
virtual moab::Interface & get_moab()=0
virtual EntityHandle get_field_meshset(const std::string name) const =0
get field meshset
virtual bool check_finite_element(const std::string &name) const =0
Check if finite element is in database.
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.
Definition of the displacement bc data structure.
Class (Function) to enforce essential constrains on the left hand side diagonal.
Class (Function) to enforce essential constrains on the right hand side diagonal.
Class (Function) to enforce essential constrains.
Elastic material data structure.
Linear interface data structure.
Matrix manager is used to build and partition problems.
Interface for managing meshsets containing materials and boundary conditions.
MoFEMErrorCode setMeshsetFromFile(const string file_name, const bool clean_file_options=true)
add blocksets reading config file
Specialization for MatrixDouble vector field values calculation.
Post post-proc data at points from hash maps.
Template struct for dimension-specific finite element types.
Create interface from given surface and insert flat prisms in-between.
MoFEMErrorCode getSides(const int msId, const CubitBCType cubit_bc_type, const BitRefLevel mesh_bit_level, const bool recursive, int verb=QUIET)
Store tetrahedra from each side of the interface separately in two child meshsets of the parent meshs...
MoFEMErrorCode splitSides(const EntityHandle meshset, const BitRefLevel &bit, const int msId, const CubitBCType cubit_bc_type, const bool add_interface_entities, const bool recursive=false, int verb=QUIET)
Split nodes and other entities of tetrahedra on both sides of the interface and insert flat prisms in...
Problem manager is used to build and partition problems.
Projection of edge entities with one mid-node on hierarchical basis.
intrusive_ptr for managing petsc objects
MoFEM::FEMethodsSequence FEMethodsSequence
@ CTX_SNESSETFUNCTION
Setting up nonlinear function evaluation.
@ CTX_SNESNONE
No specific SNES context.
Vec & snes_f
Reference to residual vector.
SNESContext snes_ctx
Current SNES computation context.
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface reference to pointer of interface.
Vector manager is used to create vectors \mofem_vectors.
structure for Arc Length pre-conditioner
double young_modulus
Young modulus.
NaturalBC< BoundaryEleOp >::Assembly< AT >::LinearForm< IT > BoundaryRhsBCs
BoundaryRhsBCs::OpFlux< PlasticOps::BoundaryBCs, 1, SPACE_DIM > OpBoundaryRhsBCs