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);
598 CHKERR KSPDestroy(&solver);
602 CHKERR VecNorm(
D, NORM_2, &nrm2_D);
604 PetscPrintf(PETSC_COMM_WORLD,
"nrm2_D = %6.4e\n", nrm2_D);
606 CHKERR VecGhostUpdateBegin(
D, INSERT_VALUES, SCATTER_FORWARD);
607 CHKERR VecGhostUpdateEnd(
D, INSERT_VALUES, SCATTER_FORWARD);
611 "MIX",
COL,
D, INSERT_VALUES, SCATTER_REVERSE);
620 CHKERR VecGhostUpdateBegin(
F, INSERT_VALUES, SCATTER_FORWARD);
621 CHKERR VecGhostUpdateEnd(
F, INSERT_VALUES, SCATTER_FORWARD);
641 CHKERR VecGhostUpdateBegin(
F, ADD_VALUES, SCATTER_REVERSE);
642 CHKERR VecGhostUpdateEnd(
F, ADD_VALUES, SCATTER_REVERSE);
648 std::vector<int> ids;
649 ids.insert(ids.begin(), bcIndices.begin(), bcIndices.end());
650 std::vector<double> vals(ids.size(), 0);
658 CHKERR VecNorm(
F, NORM_2, &nrm2_F);
659 PetscPrintf(PETSC_COMM_WORLD,
"nrm2_F = %6.4e\n", nrm2_F);
660 const double eps = 1e-8;
697 "Nb dofs %d error flux^2 = %6.4e error div^2 = %6.4e error "
698 "jump^2 = %6.4e error tot^2 = %6.4e\n",
700 sumErrorJump, sumErrorFlux + sumErrorDiv + sumErrorJump);
732 const std::string flux_name, Mat aij, Vec f)
734 flux_name, flux_name,
736 cTx(ctx), Aij(aij),
F(f) {
740 MatrixDouble
NN, transNN;
759 if (Aij == PETSC_NULLPTR)
765 EntityHandle fe_ent = getNumeredEntFiniteElementPtr()->getEnt();
768 NN.resize(nb_row, nb_col,
false);
772 invK.resize(3, 3,
false);
775 &invK(0, 0), &invK(0, 1), &invK(0, 2), &invK(1, 0), &invK(1, 1),
776 &invK(1, 2), &invK(2, 0), &invK(2, 1), &invK(2, 2));
780 int nb_gauss_pts = row_data.
getN().size1();
781 for (
int gg = 0; gg != nb_gauss_pts; gg++) {
783 double w = getGaussPts()(3, gg) * getVolume();
784 const double x = getCoordsAtGaussPts()(gg, 0);
785 const double y = getCoordsAtGaussPts()(gg, 1);
786 const double z = getCoordsAtGaussPts()(gg, 2);
789 for (
int kk = 0; kk != nb_row; kk++) {
794 t_row(
j) = w * t_n_hdiv_row(
i) * t_inv_k(
i,
j);
795 for (
int ll = 0; ll != nb_col; ll++) {
796 NN(kk, ll) += t_row(
j) * t_n_hdiv_col(
j);
802 Mat
a = (Aij != PETSC_NULLPTR) ? Aij : getFEMethod()->ts_B;
804 &col_data.
getIndices()[0], &NN(0, 0), ADD_VALUES);
806 if (row_side != col_side || row_type != col_type) {
807 transNN.resize(nb_col, nb_row);
808 noalias(transNN) = trans(NN);
827 if (
F == PETSC_NULLPTR)
833 EntityHandle fe_ent = getNumeredEntFiniteElementPtr()->getEnt();
838 invK.resize(3, 3,
false);
843 &invK(0, 0), &invK(0, 1), &invK(0, 2), &invK(1, 0), &invK(1, 1),
844 &invK(1, 2), &invK(2, 0), &invK(2, 1), &invK(2, 2));
848 int nb_gauss_pts = data.
getN().size1();
849 for (
int gg = 0; gg < nb_gauss_pts; gg++) {
850 double w = getGaussPts()(3, gg) * getVolume();
851 const double x = getCoordsAtGaussPts()(gg, 0);
852 const double y = getCoordsAtGaussPts()(gg, 1);
853 const double z = getCoordsAtGaussPts()(gg, 2);
855 for (
int ll = 0; ll != nb_row; ll++) {
856 Nf[ll] += w * t_n_hdiv(
i) * t_inv_k(
i,
j) * t_flux(
j);
877 string val_name_col, Vec f)
897 divVec.resize(data.
getN().size2() / 3, 0);
898 if (divVec.size() != data.
getIndices().size()) {
900 "data inconsistency");
902 int nb_gauss_pts = data.
getN().size1();
908 for (; gg < nb_gauss_pts; gg++) {
909 double w = getGaussPts()(3, gg) * getVolume();
910 for (
auto &
v : divVec) {
911 v = t_base_diff_hdiv(
i,
i);
937 string flux_name_col, Mat aij, Vec f)
939 val_name_row, flux_name_col,
941 cTx(ctx), Aij(aij),
F(f) {
949 MatrixDouble
NN, transNN;
969 if (Aij == PETSC_NULLPTR)
977 NN.resize(nb_row, nb_col);
979 divVec.resize(nb_col,
false);
984 int nb_gauss_pts = row_data.
getN().size1();
985 for (
int gg = 0; gg < nb_gauss_pts; gg++) {
986 double w = getGaussPts()(3, gg) * getVolume();
987 for (
auto &
v : divVec) {
988 v = t_base_diff_hdiv(
i,
i);
991 noalias(NN) += w * outer_prod(row_data.
getN(gg), divVec);
994 &col_data.
getIndices()[0], &NN(0, 0), ADD_VALUES);
995 transNN.resize(nb_col, nb_row);
996 ublas::noalias(transNN) = -trans(NN);
1010 "data inconsistency");
1015 int nb_gauss_pts = data.
getN().size1();
1016 for (
int gg = 0; gg < nb_gauss_pts; gg++) {
1017 double w = getGaussPts()(3, gg) * getVolume();
1045 EntityHandle fe_ent = getNumeredEntFiniteElementPtr()->getEnt();
1047 Nf.resize(nb_row,
false);
1049 int nb_gauss_pts = data.
getN().size1();
1050 for (
int gg = 0; gg < nb_gauss_pts; gg++) {
1051 double w = getGaussPts()(3, gg) * getVolume();
1052 const double x = getCoordsAtGaussPts()(gg, 0);
1053 const double y = getCoordsAtGaussPts()(gg, 1);
1054 const double z = getCoordsAtGaussPts()(gg, 2);
1057 noalias(Nf) += w * data.
getN(gg) * flux;
1102 EntityHandle fe_ent = getNumeredEntFiniteElementPtr()->getEnt();
1105 int nb_gauss_pts = data.
getN().size1();
1106 for (
int gg = 0; gg < nb_gauss_pts; gg++) {
1107 const double x = getCoordsAtGaussPts()(gg, 0);
1108 const double y = getCoordsAtGaussPts()(gg, 1);
1109 const double z = getCoordsAtGaussPts()(gg, 2);
1114 double w = getGaussPts()(2, gg) * 0.5;
1115 if (getNormalsAtGaussPts().size1() == (
unsigned int)nb_gauss_pts) {
1117 w * prod(data.
getVectorN<3>(gg), getNormalsAtGaussPts(gg)) *
1120 noalias(nF) += w * prod(data.
getVectorN<3>(gg), getNormal()) * value;
1123 Vec f = (
F != PETSC_NULLPTR) ?
F : getFEMethod()->ts_F;
1125 &nF[0], ADD_VALUES);
1161 EntityHandle fe_ent = getNumeredEntFiniteElementPtr()->getEnt();
1163 int nb_gauss_pts = data.
getN().size1();
1164 if (3 * nb_dofs !=
static_cast<int>(data.
getN().size2())) {
1166 "wrong number of dofs");
1168 NN.resize(nb_dofs, nb_dofs);
1177 if (getNormalsAtGaussPts().size1() == (
unsigned int)nb_gauss_pts) {
1179 normal_ptr = &getNormalsAtGaussPts(0)[0];
1182 normal_ptr = &getNormal()[0];
1193 for (
int gg = 0; gg < nb_gauss_pts; gg++) {
1196 const double x = getCoordsAtGaussPts()(gg, 0);
1197 const double y = getCoordsAtGaussPts()(gg, 1);
1198 const double z = getCoordsAtGaussPts()(gg, 2);
1205 double w = getGaussPts()(2, gg);
1207 nrm2 = sqrt(t_normal(
i) * t_normal(
i));
1212 for (
int ll = 0; ll != nb_dofs; ll++) {
1218 for (
int kk = 0; kk <= ll; kk++) {
1219 NN(ll, kk) += w * t_n_hdiv_row(
i) * t_n_hdiv_col(
i);
1223 Nf[ll] += w * t_n_hdiv_row(
i) * t_normal(
i) * flux / nrm2;
1228 if (getNormalsAtGaussPts().size1() == (
unsigned int)nb_gauss_pts) {
1230 nrm2 = sqrt(t_normal(
i) * t_normal(
i));
1241 CHKERR VecSetOption(cTx.
D0, VEC_IGNORE_NEGATIVE_INDICES, PETSC_TRUE);
1243 &*Nf.begin(), INSERT_VALUES);
1244 for (
int dd = 0; dd != nb_dofs; ++dd)
1260 const std::string val_name =
"VALUES")
1273 int nb_gauss_pts = data.
getN().size1();
1275 for (
int gg = 0; gg < nb_gauss_pts; gg++) {
1293 const std::string val_name =
"VALUES")
1304 int nb_gauss_pts = data.
getDiffN().size1();
1306 for (
int gg = 0; gg < nb_gauss_pts; gg++) {
1307 ublas::matrix_column<MatrixDouble> values_grad_at_gauss_pts(
1309 noalias(values_grad_at_gauss_pts) =
1337 int nb_gauss_pts = data.
getDiffN().size1();
1341 if (type == MBTRI && side == 0) {
1345 divVec.resize(nb_dofs);
1350 for (
int gg = 0; gg < nb_gauss_pts; gg++) {
1351 for (
auto &
v : divVec) {
1352 v = t_base_diff_hdiv(
i,
i);
1356 ublas::matrix_column<MatrixDouble> flux_at_gauss_pt(
1391 invK.resize(3, 3,
false);
1392 int nb_gauss_pts = data.
getN().size1();
1393 EntityHandle fe_ent = getNumeredEntFiniteElementPtr()->getEnt();
1395 Tag th_error_flux, th_error_div;
1397 "ERROR_FLUX", 1, MB_TYPE_DOUBLE, th_error_flux,
1398 MB_TAG_CREAT | MB_TAG_SPARSE, &def_val);
1399 double *error_flux_ptr;
1401 th_error_flux, &fe_ent, 1, (
const void **)&error_flux_ptr);
1404 "ERROR_DIV", 1, MB_TYPE_DOUBLE, th_error_div,
1405 MB_TAG_CREAT | MB_TAG_SPARSE, &def_val);
1406 double *error_div_ptr;
1408 th_error_div, &fe_ent, 1, (
const void **)&error_div_ptr);
1412 "ERROR_JUMP", 1, MB_TYPE_DOUBLE, th_error_jump,
1413 MB_TAG_CREAT | MB_TAG_SPARSE, &def_val);
1414 double *error_jump_ptr;
1416 th_error_jump, &fe_ent, 1, (
const void **)&error_jump_ptr);
1417 *error_jump_ptr = 0;
1420 const double h = pow(getVolume() * 12 / std::sqrt(2), (
double)1 / 3);
1422 for (
int ff = 0; ff != 4; ff++) {
1425 double *error_face_jump_ptr;
1427 th_error_jump, &face, 1, (
const void **)&error_face_jump_ptr);
1428 *error_face_jump_ptr = (1 / sqrt(
h)) * sqrt(*error_face_jump_ptr);
1429 *error_face_jump_ptr = pow(*error_face_jump_ptr, 2);
1430 *error_jump_ptr += *error_face_jump_ptr;
1433 *error_flux_ptr = 0;
1435 deltaFlux.resize(3,
false);
1436 for (
int gg = 0; gg < nb_gauss_pts; gg++) {
1437 double w = getGaussPts()(3, gg) * getVolume();
1438 const double x = getCoordsAtGaussPts()(gg, 0);
1439 const double y = getCoordsAtGaussPts()(gg, 1);
1440 const double z = getCoordsAtGaussPts()(gg, 2);
1447 ublas::matrix_column<MatrixDouble> flux_at_gauss_pt(
1449 ublas::matrix_column<MatrixDouble> values_grad_at_gauss_pts(
1451 noalias(deltaFlux) =
1452 prod(invK, flux_at_gauss_pt) + values_grad_at_gauss_pts;
1453 *error_flux_ptr += w * inner_prod(deltaFlux, deltaFlux);
1455 *error_div_ptr =
h * sqrt(*error_div_ptr);
1456 *error_div_ptr = pow(*error_div_ptr, 2);
1457 cTx.
errorMap[sqrt(*error_flux_ptr + *error_div_ptr + *error_jump_ptr)] =
1464 *error_jump_ptr * getVolume();
1489 :
public VolumeElementForcesAndSourcesCoreOnSide::UserDataOperator {
1500 const auto nb_gauss_pts = data.
getN().size1();
1501 valMap[getSkeletonSense()].resize(nb_gauss_pts);
1502 for (
auto gg = 0; gg != nb_gauss_pts; gg++) {
1503 valMap[getSkeletonSense()][gg] =
1515 volSideFe(ctx.mField), cTx(ctx) {
1523 if (type == MBTRI) {
1524 EntityHandle fe_ent = getNumeredEntFiniteElementPtr()->getEnt();
1529 "ERROR_JUMP", 1, MB_TYPE_DOUBLE, th_error_jump,
1530 MB_TAG_CREAT | MB_TAG_SPARSE, &def_val);
1531 double *error_jump_ptr;
1533 th_error_jump, &fe_ent, 1, (
const void **)&error_jump_ptr);
1534 *error_jump_ptr = 0;
1539 if (cTx.
mField.
get_moab().contains_entities(essential_bc_meshset,
1547 CHKERR loopSideVolumes(
"MIX", volSideFe);
1550 int nb_gauss_pts = data.
getN().size1();
1553 if (valMap.size() == 1) {
1554 if (
static_cast<int>(valMap.begin()->second.size()) != nb_gauss_pts) {
1556 "wrong number of integration points");
1558 for (
int gg = 0; gg != nb_gauss_pts; gg++) {
1559 const double x = getCoordsAtGaussPts()(gg, 0);
1560 const double y = getCoordsAtGaussPts()(gg, 1);
1561 const double z = getCoordsAtGaussPts()(gg, 2);
1564 double w = getGaussPts()(2, gg);
1565 if (
static_cast<int>(getNormalsAtGaussPts().size1()) ==
1567 w *= norm_2(getNormalsAtGaussPts(gg)) * 0.5;
1571 *error_jump_ptr += w * pow(value - valMap.begin()->second[gg], 2);
1573 }
else if (valMap.size() == 2) {
1574 for (
int gg = 0; gg != nb_gauss_pts; gg++) {
1575 double w = getGaussPts()(2, gg);
1576 if (getNormalsAtGaussPts().size1() == (
unsigned int)nb_gauss_pts) {
1577 w *= norm_2(getNormalsAtGaussPts(gg)) * 0.5;
1581 double delta = valMap.at(1)[gg] - valMap.at(-1)[gg];
1582 *error_jump_ptr += w * pow(
delta, 2);
1586 "data inconsistency, wrong number of neighbors "
1587 "valMap.size() = %ld",
ForcesAndSourcesCore::UserDataOperator UserDataOperator
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 nme:nme847.
#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
FTensor::Tensor1< FTensor::PackPtr< T *, S >, Tensor_Dim > getFTensor1FromMat(ublas::matrix< T, L, A > &data)
Get tensor rank 1 (vector) form data matrix.
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)
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 dofs values
const MatrixAdaptor getVectorN(const FieldApproximationBase base, const int gg)
get Hdiv of base functions at Gauss pts
FTensor::Tensor1< FTensor::PackPtr< double *, Tensor_Dim >, Tensor_Dim > getFTensor1N(FieldApproximationBase base)
Get base functions for Hdiv/Hcurl spaces.
const VectorDofs & getFieldDofs() const
get dofs data stature FEDofEntity
const VectorInt & getIndices() const
Get global indices of dofs 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.
Get value at integration points for scalar field.
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.
Base volume element used to integrate on skeleton.
VolumeElementForcesAndSourcesCore * getVolumeFE() const
return pointer to Generic Volume Finite Element object
Volume finite element base.