8#ifndef _MIX_TRANPORT_ELEMENT_HPP_
9#define _MIX_TRANPORT_ELEMENT_HPP_
98 ids.empty() ? PETSC_NULLPTR : &ids[0],
99 PETSC_COPY_VALUES, &is_local);
100 CHKERR ISAllGather(is_local, is);
101 CHKERR ISDestroy(&is_local);
115 const double y,
const double z,
132 const double y,
const double z,
136 for (
int dd = 0; dd < 3; dd++) {
152 const double x,
const double y,
153 const double z,
double &value) {
169 const double y,
const double z,
184 std::map<int, BlockData>
214 const std::string &values_name) {
250 CHKERR it->getAttributeDataStructure(temp_data);
252 temp_data.
data.Conductivity;
253 setOfBlocks[it->getMeshsetId()].cApacity = temp_data.
data.HeatCapacity;
255 it->meshset, MBTET,
setOfBlocks[it->getMeshsetId()].tEts,
true);
257 setOfBlocks[it->getMeshsetId()].tEts, MBTET,
"MIX");
261 setOfBlocks[it->getMeshsetId()].tEts, 2,
false, skeleton,
262 moab::Interface::UNION);
312 ref_tets = subtract(ref_tets, done_tets);
326 ref_faces = subtract(ref_faces, done_faces);
362 std::vector<EntityHandle> &map_gauss_pts)
375 double *error_flux_ptr;
377 th_error_flux, &fe_ent, 1, (
const void **)&error_flux_ptr);
382 double *error_div_ptr;
384 th_error_div, &fe_ent, 1, (
const void **)&error_div_ptr);
389 double *error_jump_ptr;
391 th_error_jump, &fe_ent, 1, (
const void **)&error_jump_ptr);
397 "ERROR_FLUX", 1, MB_TYPE_DOUBLE, th_error_flux,
398 MB_TAG_CREAT | MB_TAG_SPARSE, &def_val);
399 for (vector<EntityHandle>::iterator vit =
mapGaussPts.begin();
407 "ERROR_DIV", 1, MB_TYPE_DOUBLE, th_error_div,
408 MB_TAG_CREAT | MB_TAG_SPARSE, &def_val);
409 for (vector<EntityHandle>::iterator vit =
mapGaussPts.begin();
417 "ERROR_JUMP", 1, MB_TYPE_DOUBLE, th_error_jump,
418 MB_TAG_CREAT | MB_TAG_SPARSE, &def_val);
419 for (vector<EntityHandle>::iterator vit =
mapGaussPts.begin();
441 auto values_ptr = boost::make_shared<VectorDouble>();
442 auto grad_ptr = boost::make_shared<MatrixDouble>();
443 auto flux_ptr = boost::make_shared<MatrixDouble>();
445 post_proc.getOpPtrVector().push_back(
447 post_proc.getOpPtrVector().push_back(
449 post_proc.getOpPtrVector().push_back(
454 post_proc.getOpPtrVector().push_back(
456 new OpPPMap(post_proc.getPostProcMesh(), post_proc.getMapGaussPts(),
458 {{
"VALUES", values_ptr}},
460 {{
"GRAD", grad_ptr}, {
"FLUXES", flux_ptr}},
466 post_proc.getOpPtrVector().push_back(
new OpPostProc(
467 post_proc.getPostProcMesh(), post_proc.getMapGaussPts()));
471 CHKERR post_proc.writeFile(out_file.c_str());
482 ->createMPIAIJWithArrays<PetscGlobalIdx_mi_tag>(
"MIX", &Aij);
495 CHKERR MatZeroEntries(Aij);
497 CHKERR VecGhostUpdateBegin(
F, INSERT_VALUES, SCATTER_FORWARD);
498 CHKERR VecGhostUpdateEnd(
F, INSERT_VALUES, SCATTER_FORWARD);
499 CHKERR VecZeroEntries(D0);
500 CHKERR VecGhostUpdateBegin(D0, INSERT_VALUES, SCATTER_FORWARD);
501 CHKERR VecGhostUpdateEnd(D0, INSERT_VALUES, SCATTER_FORWARD);
503 CHKERR VecGhostUpdateBegin(
D, INSERT_VALUES, SCATTER_FORWARD);
504 CHKERR VecGhostUpdateEnd(
D, INSERT_VALUES, SCATTER_FORWARD);
507 "MIX",
COL,
D, INSERT_VALUES, SCATTER_REVERSE);
520 CHKERR VecGhostUpdateBegin(D0, INSERT_VALUES, SCATTER_REVERSE);
521 CHKERR VecGhostUpdateEnd(D0, INSERT_VALUES, SCATTER_REVERSE);
522 CHKERR VecAssemblyBegin(D0);
523 CHKERR VecAssemblyEnd(D0);
547 CHKERR MatAssemblyBegin(Aij, MAT_FINAL_ASSEMBLY);
548 CHKERR MatAssemblyEnd(Aij, MAT_FINAL_ASSEMBLY);
549 CHKERR VecGhostUpdateBegin(
F, ADD_VALUES, SCATTER_REVERSE);
550 CHKERR VecGhostUpdateEnd(
F, ADD_VALUES, SCATTER_REVERSE);
556 CHKERR VecNorm(
F, NORM_2, &nrm2_F);
557 PetscPrintf(PETSC_COMM_WORLD,
"nrm2_F = %6.4e\n", nrm2_F);
567 CHKERR getDirichletBCIndices(&essential_bc_ids);
568 CHKERR MatZeroRowsColumnsIS(Aij, essential_bc_ids, 1, D0,
F);
569 CHKERR ISDestroy(&essential_bc_ids);
579 CHKERR VecNorm(
F, NORM_2, &nrm2_F);
580 PetscPrintf(PETSC_COMM_WORLD,
"With BC nrm2_F = %6.4e\n", nrm2_F);
593 CHKERR KSPCreate(PETSC_COMM_WORLD, &solver);
594 CHKERR KSPSetOperators(solver, Aij, Aij);
595 CHKERR KSPSetFromOptions(solver);
599 solver,
"unsaturated transport");
600 CHKERR KSPDestroy(&solver);
604 CHKERR VecNorm(
D, NORM_2, &nrm2_D);
606 PetscPrintf(PETSC_COMM_WORLD,
"nrm2_D = %6.4e\n", nrm2_D);
608 CHKERR VecGhostUpdateBegin(
D, INSERT_VALUES, SCATTER_FORWARD);
609 CHKERR VecGhostUpdateEnd(
D, INSERT_VALUES, SCATTER_FORWARD);
613 "MIX",
COL,
D, INSERT_VALUES, SCATTER_REVERSE);
622 CHKERR VecGhostUpdateBegin(
F, INSERT_VALUES, SCATTER_FORWARD);
623 CHKERR VecGhostUpdateEnd(
F, INSERT_VALUES, SCATTER_FORWARD);
643 CHKERR VecGhostUpdateBegin(
F, ADD_VALUES, SCATTER_REVERSE);
644 CHKERR VecGhostUpdateEnd(
F, ADD_VALUES, SCATTER_REVERSE);
650 std::vector<int> ids;
651 ids.insert(ids.begin(), bcIndices.begin(), bcIndices.end());
652 std::vector<double> vals(ids.size(), 0);
660 CHKERR VecNorm(
F, NORM_2, &nrm2_F);
661 PetscPrintf(PETSC_COMM_WORLD,
"nrm2_F = %6.4e\n", nrm2_F);
662 const double eps = 1e-8;
699 "Nb dofs %d error flux^2 = %6.4e error div^2 = %6.4e error "
700 "jump^2 = %6.4e error tot^2 = %6.4e\n",
702 sumErrorJump, sumErrorFlux + sumErrorDiv + sumErrorJump);
734 const std::string flux_name, Mat aij, Vec f)
736 flux_name, flux_name,
738 cTx(ctx), Aij(aij),
F(f) {
761 if (Aij == PETSC_NULLPTR)
767 EntityHandle fe_ent = getNumeredEntFiniteElementPtr()->getEnt();
770 NN.resize(nb_row, nb_col,
false);
774 invK.resize(3, 3,
false);
777 &invK(0, 0), &invK(0, 1), &invK(0, 2), &invK(1, 0), &invK(1, 1),
778 &invK(1, 2), &invK(2, 0), &invK(2, 1), &invK(2, 2));
782 int nb_gauss_pts = row_data.
getN().size1();
783 for (
int gg = 0; gg != nb_gauss_pts; gg++) {
785 double w = getGaussPts()(3, gg) * getVolume();
786 const double x = getCoordsAtGaussPts()(gg, 0);
787 const double y = getCoordsAtGaussPts()(gg, 1);
788 const double z = getCoordsAtGaussPts()(gg, 2);
791 for (
int kk = 0; kk != nb_row; kk++) {
796 t_row(
j) = w * t_n_hdiv_row(
i) * t_inv_k(
i,
j);
797 for (
int ll = 0; ll != nb_col; ll++) {
798 NN(kk, ll) += t_row(
j) * t_n_hdiv_col(
j);
804 Mat
a = (Aij != PETSC_NULLPTR) ? Aij : getFEMethod()->ts_B;
806 &col_data.
getIndices()[0], &NN(0, 0), ADD_VALUES);
808 if (row_side != col_side || row_type != col_type) {
809 transNN.resize(nb_col, nb_row);
810 noalias(transNN) = trans(NN);
829 if (
F == PETSC_NULLPTR)
835 EntityHandle fe_ent = getNumeredEntFiniteElementPtr()->getEnt();
840 invK.resize(3, 3,
false);
845 &invK(0, 0), &invK(0, 1), &invK(0, 2), &invK(1, 0), &invK(1, 1),
846 &invK(1, 2), &invK(2, 0), &invK(2, 1), &invK(2, 2));
850 int nb_gauss_pts = data.
getN().size1();
851 for (
int gg = 0; gg < nb_gauss_pts; gg++) {
852 double w = getGaussPts()(3, gg) * getVolume();
853 const double x = getCoordsAtGaussPts()(gg, 0);
854 const double y = getCoordsAtGaussPts()(gg, 1);
855 const double z = getCoordsAtGaussPts()(gg, 2);
857 for (
int ll = 0; ll != nb_row; ll++) {
858 Nf[ll] += w * t_n_hdiv(
i) * t_inv_k(
i,
j) * t_flux(
j);
879 string val_name_col, Vec f)
899 divVec.resize(data.
getN().size2() / 3, 0);
900 if (divVec.size() != data.
getIndices().size()) {
902 "data inconsistency");
904 int nb_gauss_pts = data.
getN().size1();
910 for (; gg < nb_gauss_pts; gg++) {
911 double w = getGaussPts()(3, gg) * getVolume();
912 for (
auto &
v : divVec) {
913 v = t_base_diff_hdiv(
i,
i);
939 string flux_name_col, Mat aij, Vec f)
941 val_name_row, flux_name_col,
943 cTx(ctx), Aij(aij),
F(f) {
971 if (Aij == PETSC_NULLPTR)
979 NN.resize(nb_row, nb_col);
981 divVec.resize(nb_col,
false);
986 int nb_gauss_pts = row_data.
getN().size1();
987 for (
int gg = 0; gg < nb_gauss_pts; gg++) {
988 double w = getGaussPts()(3, gg) * getVolume();
989 for (
auto &
v : divVec) {
990 v = t_base_diff_hdiv(
i,
i);
993 noalias(NN) += w * outer_prod(row_data.
getN(gg), divVec);
996 &col_data.
getIndices()[0], &NN(0, 0), ADD_VALUES);
997 transNN.resize(nb_col, nb_row);
998 ublas::noalias(transNN) = -trans(NN);
1012 "data inconsistency");
1017 int nb_gauss_pts = data.
getN().size1();
1018 for (
int gg = 0; gg < nb_gauss_pts; gg++) {
1019 double w = getGaussPts()(3, gg) * getVolume();
1047 EntityHandle fe_ent = getNumeredEntFiniteElementPtr()->getEnt();
1049 Nf.resize(nb_row,
false);
1051 int nb_gauss_pts = data.
getN().size1();
1052 for (
int gg = 0; gg < nb_gauss_pts; gg++) {
1053 double w = getGaussPts()(3, gg) * getVolume();
1054 const double x = getCoordsAtGaussPts()(gg, 0);
1055 const double y = getCoordsAtGaussPts()(gg, 1);
1056 const double z = getCoordsAtGaussPts()(gg, 2);
1059 noalias(Nf) += w * data.
getN(gg) * flux;
1104 EntityHandle fe_ent = getNumeredEntFiniteElementPtr()->getEnt();
1107 int nb_gauss_pts = data.
getN().size1();
1108 for (
int gg = 0; gg < nb_gauss_pts; gg++) {
1109 const double x = getCoordsAtGaussPts()(gg, 0);
1110 const double y = getCoordsAtGaussPts()(gg, 1);
1111 const double z = getCoordsAtGaussPts()(gg, 2);
1116 double w = getGaussPts()(2, gg) * 0.5;
1117 if (getNormalsAtGaussPts().size1() == (
unsigned int)nb_gauss_pts) {
1119 w * prod(data.
getVectorN<3>(gg), getNormalsAtGaussPts(gg)) *
1122 noalias(nF) += w * prod(data.
getVectorN<3>(gg), getNormal()) * value;
1125 Vec f = (
F != PETSC_NULLPTR) ?
F : getFEMethod()->ts_F;
1127 &nF[0], ADD_VALUES);
1163 EntityHandle fe_ent = getNumeredEntFiniteElementPtr()->getEnt();
1165 int nb_gauss_pts = data.
getN().size1();
1166 if (3 * nb_dofs !=
static_cast<int>(data.
getN().size2())) {
1168 "wrong number of dofs");
1170 NN.resize(nb_dofs, nb_dofs);
1179 if (getNormalsAtGaussPts().size1() == (
unsigned int)nb_gauss_pts) {
1181 normal_ptr = &getNormalsAtGaussPts(0)[0];
1184 normal_ptr = &getNormal()[0];
1195 for (
int gg = 0; gg < nb_gauss_pts; gg++) {
1198 const double x = getCoordsAtGaussPts()(gg, 0);
1199 const double y = getCoordsAtGaussPts()(gg, 1);
1200 const double z = getCoordsAtGaussPts()(gg, 2);
1207 double w = getGaussPts()(2, gg);
1209 nrm2 = sqrt(t_normal(
i) * t_normal(
i));
1214 for (
int ll = 0; ll != nb_dofs; ll++) {
1220 for (
int kk = 0; kk <= ll; kk++) {
1221 NN(ll, kk) += w * t_n_hdiv_row(
i) * t_n_hdiv_col(
i);
1225 Nf[ll] += w * t_n_hdiv_row(
i) * t_normal(
i) * flux / nrm2;
1230 if (getNormalsAtGaussPts().size1() == (
unsigned int)nb_gauss_pts) {
1232 nrm2 = sqrt(t_normal(
i) * t_normal(
i));
1243 CHKERR VecSetOption(cTx.
D0, VEC_IGNORE_NEGATIVE_INDICES, PETSC_TRUE);
1245 &*Nf.begin(), INSERT_VALUES);
1246 for (
int dd = 0; dd != nb_dofs; ++dd)
1262 const std::string val_name =
"VALUES")
1275 int nb_gauss_pts = data.
getN().size1();
1277 for (
int gg = 0; gg < nb_gauss_pts; gg++) {
1295 const std::string val_name =
"VALUES")
1306 int nb_gauss_pts = data.
getDiffN().size1();
1308 for (
int gg = 0; gg < nb_gauss_pts; gg++) {
1309 ublas::matrix_column<MatrixDouble> values_grad_at_gauss_pts(
1311 noalias(values_grad_at_gauss_pts) =
1339 int nb_gauss_pts = data.
getDiffN().size1();
1343 if (
type == MBTRI && side == 0) {
1347 divVec.resize(nb_dofs);
1352 for (
int gg = 0; gg < nb_gauss_pts; gg++) {
1353 for (
auto &
v : divVec) {
1354 v = t_base_diff_hdiv(
i,
i);
1393 invK.resize(3, 3,
false);
1394 int nb_gauss_pts = data.
getN().size1();
1395 EntityHandle fe_ent = getNumeredEntFiniteElementPtr()->getEnt();
1397 Tag th_error_flux, th_error_div;
1399 "ERROR_FLUX", 1, MB_TYPE_DOUBLE, th_error_flux,
1400 MB_TAG_CREAT | MB_TAG_SPARSE, &def_val);
1401 double *error_flux_ptr;
1403 th_error_flux, &fe_ent, 1, (
const void **)&error_flux_ptr);
1406 "ERROR_DIV", 1, MB_TYPE_DOUBLE, th_error_div,
1407 MB_TAG_CREAT | MB_TAG_SPARSE, &def_val);
1408 double *error_div_ptr;
1410 th_error_div, &fe_ent, 1, (
const void **)&error_div_ptr);
1414 "ERROR_JUMP", 1, MB_TYPE_DOUBLE, th_error_jump,
1415 MB_TAG_CREAT | MB_TAG_SPARSE, &def_val);
1416 double *error_jump_ptr;
1418 th_error_jump, &fe_ent, 1, (
const void **)&error_jump_ptr);
1419 *error_jump_ptr = 0;
1422 const double h = pow(getVolume() * 12 / std::sqrt(2), (
double)1 / 3);
1424 for (
int ff = 0; ff != 4; ff++) {
1427 double *error_face_jump_ptr;
1429 th_error_jump, &face, 1, (
const void **)&error_face_jump_ptr);
1430 *error_face_jump_ptr = (1 / sqrt(
h)) * sqrt(*error_face_jump_ptr);
1431 *error_face_jump_ptr = pow(*error_face_jump_ptr, 2);
1432 *error_jump_ptr += *error_face_jump_ptr;
1435 *error_flux_ptr = 0;
1437 deltaFlux.resize(3,
false);
1438 for (
int gg = 0; gg < nb_gauss_pts; gg++) {
1439 double w = getGaussPts()(3, gg) * getVolume();
1440 const double x = getCoordsAtGaussPts()(gg, 0);
1441 const double y = getCoordsAtGaussPts()(gg, 1);
1442 const double z = getCoordsAtGaussPts()(gg, 2);
1451 ublas::matrix_column<MatrixDouble> values_grad_at_gauss_pts(
1453 noalias(deltaFlux) =
1454 prod(invK, flux_at_gauss_pt) + values_grad_at_gauss_pts;
1455 *error_flux_ptr += w * inner_prod(deltaFlux, deltaFlux);
1457 *error_div_ptr =
h * sqrt(*error_div_ptr);
1458 *error_div_ptr = pow(*error_div_ptr, 2);
1459 cTx.
errorMap[sqrt(*error_flux_ptr + *error_div_ptr + *error_jump_ptr)] =
1466 *error_jump_ptr * getVolume();
1502 const auto nb_gauss_pts = data.
getN().size1();
1503 valMap[getSkeletonSense()].resize(nb_gauss_pts);
1504 for (
auto gg = 0; gg != nb_gauss_pts; gg++) {
1505 valMap[getSkeletonSense()][gg] =
1517 volSideFe(ctx.mField), cTx(ctx) {
1525 if (
type == MBTRI) {
1526 EntityHandle fe_ent = getNumeredEntFiniteElementPtr()->getEnt();
1531 "ERROR_JUMP", 1, MB_TYPE_DOUBLE, th_error_jump,
1532 MB_TAG_CREAT | MB_TAG_SPARSE, &def_val);
1533 double *error_jump_ptr;
1535 th_error_jump, &fe_ent, 1, (
const void **)&error_jump_ptr);
1536 *error_jump_ptr = 0;
1539 EntityHandle essential_bc_meshset =
1541 if (cTx.
mField.
get_moab().contains_entities(essential_bc_meshset,
1549 CHKERR loopSideVolumes(
"MIX", volSideFe);
1552 int nb_gauss_pts = data.
getN().size1();
1555 if (valMap.size() == 1) {
1556 if (
static_cast<int>(valMap.begin()->second.size()) != nb_gauss_pts) {
1558 "wrong number of integration points");
1560 for (
int gg = 0; gg != nb_gauss_pts; gg++) {
1561 const double x = getCoordsAtGaussPts()(gg, 0);
1562 const double y = getCoordsAtGaussPts()(gg, 1);
1563 const double z = getCoordsAtGaussPts()(gg, 2);
1566 double w = getGaussPts()(2, gg);
1567 if (
static_cast<int>(getNormalsAtGaussPts().size1()) ==
1569 w *= norm_2(getNormalsAtGaussPts(gg)) * 0.5;
1573 *error_jump_ptr += w * pow(value - valMap.begin()->second[gg], 2);
1575 }
else if (valMap.size() == 2) {
1576 for (
int gg = 0; gg != nb_gauss_pts; gg++) {
1577 double w = getGaussPts()(2, gg);
1578 if (getNormalsAtGaussPts().size1() == (
unsigned int)nb_gauss_pts) {
1579 w *= norm_2(getNormalsAtGaussPts(gg)) * 0.5;
1583 double delta = valMap.at(1)[gg] - valMap.at(-1)[gg];
1584 *error_jump_ptr += w * pow(
delta, 2);
1588 "data inconsistency, wrong number of neighbors "
1589 "valMap.size() = %zu",
SmartPetscObj< Vec > values
void cholesky_solve(const TRIA &L, VEC &x, ublas::lower)
solve system L L^T x = b inplace
size_t cholesky_decompose(const MATRIX &A, TRIA &L)
decompose the symmetric positive definit matrix A into product L L^T.
@ AINSWORTH_LEGENDRE_BASE
Ainsworth Cole (Legendre) approx. base .
#define BITREFLEVEL_SIZE
max number of refinements
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
@ L2
field with C-1 continuity
@ HDIV
field with continuous normal traction
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
@ MAT_THERMALSET
block name is "MAT_THERMAL"
@ MOFEM_DATA_INCONSISTENCY
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define CHKERR
Inline error check.
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
virtual const Problem * get_problem(const std::string problem_name) const =0
Get the problem object.
virtual MoFEMErrorCode add_finite_element(const std::string &fe_name, enum MoFEMTypes bh=MF_EXCL, int verb=DEFAULT_VERBOSITY)=0
add finite element
virtual EntityHandle get_finite_element_meshset(const std::string name) const =0
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 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_BCDATA_TYPE_FOR_LOOP_(MESHSET_MANAGER, CUBITBCTYPE, IT)
Iterator that loops over a specific Cubit 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_set_bit(const std::string &name_problem, const BitRefLevel &bit)=0
set ref level for 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
FTensor::Index< 'i', SPACE_DIM > i
const double v
phase velocity of light in medium (cm/ns)
FTensor::Index< 'j', 3 > j
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
MoFEMErrorCode MatSetValues(Mat M, const EntitiesFieldData::EntData &row_data, const EntitiesFieldData::EntData &col_data, const double *ptr, InsertMode iora)
Assemble PETSc matrix.
MoFEMErrorCode VecSetValues(Vec V, const EntitiesFieldData::EntData &data, const double *ptr, InsertMode iora)
Assemble PETSc vector.
OpPostProcMapInMoab< SPACE_DIM, SPACE_DIM > OpPPMap
constexpr auto field_name
static constexpr double delta
data for evaluation of het conductivity and heat capacity elements
Range tEts
constatins elements in block set
definition of surface element
MyTriFE(MoFEM::Interface &m_field)
definition of volume element
MyVolumeFE(MoFEM::Interface &m_field)
MixTransportElement & cTx
OpDivTauU_HdivL2(MixTransportElement &ctx, const std::string flux_name_row, string val_name_col, Vec f)
MoFEMErrorCode doWork(int side, EntityType type, EntitiesFieldData::EntData &data)
Operator for linear form, usually to calculate values on right hand side.
calculate error evaluator
OpError(MixTransportElement &ctx, const std::string field_name)
MixTransportElement & cTx
MoFEMErrorCode doWork(int side, EntityType type, EntitiesFieldData::EntData &data)
Operator for linear form, usually to calculate values on right hand side.
Evaluate boundary conditions on fluxes.
FTensor::Index< 'i', 3 > i
MixTransportElement & cTx
OpEvaluateBcOnFluxes(MixTransportElement &ctx, const std::string flux_name)
MoFEMErrorCode doWork(int side, EntityType type, EntitiesFieldData::EntData &data)
Operator for linear form, usually to calculate values on right hand side.
calculate flux at integration point
OpFluxDivergenceAtGaussPts(MixTransportElement &ctx, const std::string field_name)
MixTransportElement & cTx
MoFEMErrorCode doWork(int side, EntityType type, EntitiesFieldData::EntData &data)
Operator for linear form, usually to calculate values on right hand side.
Calculate source therms, i.e. .
OpL2Source(MixTransportElement &ctx, const std::string val_name, Vec f)
MixTransportElement & cTx
MoFEMErrorCode doWork(int side, EntityType type, EntitiesFieldData::EntData &data)
Operator for linear form, usually to calculate values on right hand side.
moab::Interface & postProcMesh
std::vector< EntityHandle > & mapGaussPts
MoFEMErrorCode doWork(int side, EntityType type, EntitiesFieldData::EntData &data)
Operator for linear form, usually to calculate values on right hand side.
OpPostProc(moab::Interface &post_proc_mesh, std::vector< EntityHandle > &map_gauss_pts)
MixTransportElement & cTx
OpRhsBcOnValues(MixTransportElement &ctx, const std::string fluxes_name, Vec f)
Constructor.
MoFEMErrorCode doWork(int side, EntityType type, EntitiesFieldData::EntData &data)
Integrate boundary condition.
calculate values on adjacent tetrahedra to face
map< int, VectorDouble > & valMap
MoFEMErrorCode doWork(int side, EntityType type, EntitiesFieldData::EntData &data)
Operator for linear form, usually to calculate values on right hand side.
OpVolSide(map< int, VectorDouble > &val_map)
calculate jump on entities
OpSkeleton(MixTransportElement &ctx, const std::string flux_name)
map< int, VectorDouble > valMap
VolumeElementForcesAndSourcesCoreOnSide volSideFe
volume element to get values from adjacent tets to face
MoFEMErrorCode doWork(int side, EntityType type, EntitiesFieldData::EntData &data)
Operator for linear form, usually to calculate values on right hand side.
MixTransportElement & cTx
MoFEMErrorCode doWork(int row_side, int col_side, EntityType row_type, EntityType col_type, EntitiesFieldData::EntData &row_data, EntitiesFieldData::EntData &col_data)
Assemble matrix.
MixTransportElement & cTx
OpTauDotSigma_HdivHdiv(MixTransportElement &ctx, const std::string flux_name, Mat aij, Vec f)
MoFEMErrorCode doWork(int side, EntityType type, EntitiesFieldData::EntData &data)
Assemble matrix.
MixTransportElement & cTx
MoFEMErrorCode doWork(int row_side, int col_side, EntityType row_type, EntityType col_type, EntitiesFieldData::EntData &row_data, EntitiesFieldData::EntData &col_data)
Do calculations.
OpVDivSigma_L2Hdiv(MixTransportElement &ctx, const std::string val_name_row, string flux_name_col, Mat aij, Vec f)
Constructor.
MoFEMErrorCode doWork(int side, EntityType type, EntitiesFieldData::EntData &data)
Operator for linear form, usually to calculate values on right hand side.
Calculate values at integration points.
MoFEMErrorCode doWork(int side, EntityType type, EntitiesFieldData::EntData &data)
Operator for linear form, usually to calculate values on right hand side.
OpValuesAtGaussPts(MixTransportElement &ctx, const std::string val_name="VALUES")
MixTransportElement & cTx
virtual ~OpValuesAtGaussPts()
Calculate gradients of values at integration points.
MoFEMErrorCode doWork(int side, EntityType type, EntitiesFieldData::EntData &data)
Operator for linear form, usually to calculate values on right hand side.
OpValuesGradientAtGaussPts(MixTransportElement &ctx, const std::string val_name="VALUES")
MixTransportElement & cTx
virtual ~OpValuesGradientAtGaussPts()
MoFEMErrorCode postProc(const string out_file)
Post process results.
MoFEMErrorCode destroyMatrices()
destroy matrices
MoFEMErrorCode evaluateError()
Calculate error on elements.
MoFEMErrorCode solveLinearProblem()
solve problem
MoFEMErrorCode getDirichletBCIndices(IS *is)
get dof indices where essential boundary conditions are applied
MoFEMErrorCode createMatrices()
create matrices
MoFEM::Interface & mField
MatrixDouble valuesGradientAtGaussPts
gradients at integration points on element
virtual MoFEMErrorCode getBcOnFluxes(const EntityHandle ent, const double x, const double y, const double z, double &flux)
essential (Neumann) boundary condition (set fluxes)
MoFEMErrorCode calculateResidual()
calculate residual
MoFEMErrorCode addFiniteElements(const std::string &fluxes_name, const std::string &values_name)
add finite elements
VectorDouble valuesAtGaussPts
values at integration points on element
map< double, EntityHandle > errorMap
MyTriFE feTri
Instance of surface element.
virtual MoFEMErrorCode getBcOnValues(const EntityHandle ent, const int gg, const double x, const double y, const double z, double &value)
evaluate natural (Dirichlet) boundary conditions
MyVolumeFE feVol
Instance of volume element.
MoFEMErrorCode addFields(const std::string &values, const std::string &fluxes, const int order)
Add fields to database.
virtual MoFEMErrorCode getResistivity(const EntityHandle ent, const double x, const double y, const double z, MatrixDouble3by3 &inv_k)
natural (Dirichlet) boundary conditions (set values)
MixTransportElement(MoFEM::Interface &m_field)
construction of this data structure
std::map< int, BlockData > setOfBlocks
maps block set id with appropriate BlockData
VectorDouble divergenceAtGaussPts
divergence at integration points on element
virtual ~MixTransportElement()
destructor
virtual MoFEMErrorCode getSource(const EntityHandle ent, const double x, const double y, const double z, double &flux)
set source term
MatrixDouble fluxesAtGaussPts
fluxes at integration points on element
MoFEMErrorCode buildProblem(BitRefLevel &ref_level)
Build problem.
Add operators pushing bases from local to physical configuration.
virtual int get_comm_size() const =0
virtual moab::Interface & get_moab()=0
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.
virtual MPI_Comm & get_comm() const =0
Deprecated interface functions.
Data on single entity (This is passed as argument to DataOperator::doWork)
FTensor::Tensor2< FTensor::PackPtr< double *, Tensor_Dim0 *Tensor_Dim1 >, Tensor_Dim0, Tensor_Dim1 > getFTensor2DiffN(FieldApproximationBase base)
Get derivatives of base functions for Hdiv space.
MatrixDouble & getDiffN(const FieldApproximationBase base)
get derivatives of base functions
MatrixDouble & getN(const FieldApproximationBase base)
get base functions this return matrix (nb. of rows is equal to nb. of Gauss pts, nb....
const VectorDouble & getFieldData() const
Get DOF values on entity.
const MatrixAdaptor getVectorN(const FieldApproximationBase base, const int gg)
get Hdiv of base functions at Gauss pts
auto getFTensor1N(FieldApproximationBase base)
Get base functions for Hdiv/Hcurl spaces.
const VectorDofs & getFieldDofs() const
Get DOF data structures (const version)
const VectorInt & getIndices() const
Get global indices of degrees of freedom on entity.
default operator for TRI element
boost::shared_ptr< const NumeredEntFiniteElement > getNumeredEntFiniteElementPtr() const
Return raw pointer to NumeredEntFiniteElement.
@ OPCOL
operator doWork function is executed on FE columns
boost::ptr_deque< UserDataOperator > & getOpPtrVector()
Use to push back operator for row operator.
Thermal material data structure.
Matrix manager is used to build and partition problems.
Get vector field for H-div approximation.
Get field gradients at integration pts for scalar field rank 0, i.e. vector field.
Specialization for double precision scalar field values calculation.
Post post-proc data at points from hash maps.
keeps basic data about problem
DofIdx getNbDofsRow() const
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.
default operator for TET element
Base volume element used to integrate on skeleton.
VolumeElementForcesAndSourcesCore * getVolumeFE() const
return pointer to Generic Volume Finite Element object
Volume finite element base.