#ifndef __MAGNETICELEMENT_HPP__
#define __MAGNETICELEMENT_HPP__
};
};
};
if (
bit->getName().compare(0, 9,
"NATURALBC") == 0) {
faces, true);
}
}
}
ParallelComm *pcomm =
if (
bit->getName().compare(0, 10,
"ESSENTIALBC") == 0) {
faces, true);
}
}
CHKERR skin.find_skin(0, tets,
false, skin_faces);
CHKERR pcomm->filter_pstatus(skin_faces,
PSTATUS_SHARED | PSTATUS_MULTISHARED,
PSTATUS_NOT, -1, &proc_skin);
}
}
1);
3);
"MESH_NODE_POSITIONS");
Projection10NodeCoordsOnField ent_method_material(
mField,
"MESH_NODE_POSITIONS");
}
"MESH_NODE_POSITIONS");
}
}
}
auto material_grad_mat = boost::make_shared<MatrixDouble>();
auto material_det_vec = boost::make_shared<VectorDouble>();
auto material_inv_grad_mat = boost::make_shared<MatrixDouble>();
vol_fe.getOpPtrVector().push_back(
new OpCurlCurl(
blockData));
vol_fe.getOpPtrVector().push_back(
new OpStab(
blockData));
new OpGetHONormalsOnFace("MESH_NODE_POSITIONS"));
new OpCalculateHOCoords("MESH_NODE_POSITIONS"));
new OpHOSetCovariantPiolaTransformOnFace3D(
HCURL));
->createMPIAIJ<PetscGlobalIdx_mi_tag>(problem_ptr->
getName(),
&vol_fe);
KSP solver;
CHKERR KSPCreate(PETSC_COMM_WORLD, &solver);
CHKERR KSPSetFromOptions(solver);
SCATTER_REVERSE);
if (regression_test) {
double nrm2;
const double expected_value = 4.6772e+01;
if ((nrm2 - expected_value) / expected_value >
tol) {
"Regression test failed %6.4e != %6.4e", nrm2, expected_value);
}
}
}
PostProcBrokenMeshInMoab<VolumeElementForcesAndSourcesCore> post_proc(
true);
auto pos_ptr = boost::make_shared<MatrixDouble>();
auto field_val_ptr = boost::make_shared<MatrixDouble>();
post_proc.getOpPtrVector().push_back(
new OpCalculateVectorFieldValues<3>("MESH_NODE_POSITIONS", pos_ptr));
post_proc.getOpPtrVector().push_back(
using OpPPMap = OpPostProcMapInMoab<3, 3>;
post_proc.getOpPtrVector().push_back(
post_proc.getPostProcMesh(), post_proc.getMapGaussPts(),
{},
{{"MESH_NODE_POSITIONS", pos_ptr},
{blockData.fieldName, field_val_ptr}},
{},
{}
)
);
post_proc.getOpPtrVector().push_back(new OpPostProcessCurl(
blockData, post_proc.getPostProcMesh(), post_proc.getMapGaussPts()));
&post_proc);
CHKERR post_proc.writeFile(
"out_values.h5m");
}
struct OpCurlCurl
blockData(data) {
sYmm = true;
}
EntityType col_type,
if (row_type == MBVERTEX)
if (col_type == MBVERTEX)
const int nb_row_dofs = row_data.getN().size2() / 3;
if (nb_row_dofs == 0)
const int nb_col_dofs = col_data.getN().size2() / 3;
if (nb_col_dofs == 0)
entityLocalMatrix.resize(nb_row_dofs, nb_col_dofs, false);
entityLocalMatrix.clear();
if (nb_row_dofs != static_cast<int>(row_data.getFieldData().size())) {
"Number of base functions and DOFs on entity is different on "
"rows %d!=%d",
nb_row_dofs, row_data.getFieldData().size());
}
if (nb_col_dofs != static_cast<int>(col_data.getFieldData().size())) {
SETERRQ2(
"Number of base functions and DOFs on entity is different on cols",
nb_col_dofs, col_data.getFieldData().size());
}
const double c0 = 1. / blockData.mU;
const int nb_gauss_pts = row_data.getN().size1();
auto t_row_curl_base = row_data.getFTensor2DiffN<3, 3>();
for (int gg = 0; gg != nb_gauss_pts; gg++) {
for (int aa = 0; aa != nb_row_dofs; aa++) {
auto t_col_curl_base = col_data.getFTensor2DiffN<3, 3>(gg, 0);
for (int bb = 0; bb != nb_col_dofs; bb++) {
t_local_mat += c0 *
w * t_row_curl(
i) * t_col_curl(
i);
++t_local_mat;
++t_col_curl_base;
}
++t_row_curl_base;
}
}
nb_col_dofs, &col_data.getIndices()[0],
&entityLocalMatrix(0, 0), ADD_VALUES);
if (row_side != col_side || row_type != col_type) {
entityLocalMatrix = trans(entityLocalMatrix);
nb_row_dofs, &row_data.getIndices()[0],
&entityLocalMatrix(0, 0), ADD_VALUES);
}
}
};
struct OpStab
blockData(data) {
sYmm = true;
}
EntityType col_type,
if (row_type == MBVERTEX)
if (col_type == MBVERTEX)
const int nb_row_dofs = row_data.getN().size2() / 3;
if (nb_row_dofs == 0)
const int nb_col_dofs = col_data.getN().size2() / 3;
if (nb_col_dofs == 0)
entityLocalMatrix.resize(nb_row_dofs, nb_col_dofs, false);
entityLocalMatrix.clear();
if (nb_row_dofs != static_cast<int>(row_data.getFieldData().size())) {
"Number of base functions and DOFs on entity is different on "
"rows %d!=%d",
nb_row_dofs, row_data.getFieldData().size());
}
if (nb_col_dofs != static_cast<int>(col_data.getFieldData().size())) {
SETERRQ2(
"Number of base functions and DOFs on entity is different on cols",
nb_col_dofs, col_data.getFieldData().size());
}
const double c0 = 1. / blockData.mU;
const double c1 = blockData.ePsilon * c0;
const int nb_gauss_pts = row_data.getN().size1();
for (int gg = 0; gg != nb_gauss_pts; gg++) {
&row_data.getVectorN<3>(gg)(0,
HVEC0),
&row_data.getVectorN<3>(gg)(0,
HVEC1),
&row_data.getVectorN<3>(gg)(0,
HVEC2), 3);
for (int aa = 0; aa != nb_row_dofs; aa++) {
&col_data.getVectorN<3>(gg)(0,
HVEC0),
&col_data.getVectorN<3>(gg)(0,
HVEC1),
&col_data.getVectorN<3>(gg)(0,
HVEC2), 3);
for (int bb = 0; bb != nb_col_dofs; bb++) {
t_local_mat += c1 *
w * t_row_base(
i) * t_col_base(
i);
++t_col_base;
++t_local_mat;
}
++t_row_base;
}
}
nb_col_dofs, &col_data.getIndices()[0],
&entityLocalMatrix(0, 0), ADD_VALUES);
if (row_side != col_side || row_type != col_type) {
entityLocalMatrix = trans(entityLocalMatrix);
nb_row_dofs, &row_data.getIndices()[0],
&entityLocalMatrix(0, 0), ADD_VALUES);
}
}
};
struct OpNaturalBC
blockData(data) {}
if (row_type == MBVERTEX)
const int nb_row_dofs = row_data.getN().size2() / 3;
if (nb_row_dofs == 0)
naturalBC.resize(nb_row_dofs, false);
naturalBC.clear();
const int nb_gauss_pts = row_data.getN().size1();
auto t_row_base = row_data.getFTensor1N<3>();
for (int gg = 0; gg != nb_gauss_pts; gg++) {
double area;
const double r = sqrt(x * x + y * y);
t_j(2) = 0;
for (int aa = 0; aa != nb_row_dofs; aa++) {
t_f +=
w * t_row_base(
i) * t_j(
i);
++t_row_base;
++t_f;
}
}
&row_data.getIndices()[0], &naturalBC[0], ADD_VALUES);
}
};
struct OpPostProcessCurl
std::vector<EntityHandle> &mapGaussPts;
std::vector<EntityHandle> &map_gauss_pts)
blockData(data), postProcMesh(post_proc_mesh),
mapGaussPts(map_gauss_pts) {}
if (row_type == MBVERTEX)
double def_val[] = {0, 0, 0};
CHKERR postProcMesh.tag_get_handle(
"MAGNETIC_INDUCTION_FIELD", 3,
MB_TAG_CREAT | MB_TAG_SPARSE, def_val);
const int nb_row_dofs = row_data.getN().size2() / 3;
if (nb_row_dofs == 0)
const void *tags_ptr[mapGaussPts.size()];
if (nb_row_dofs != row_data.getFieldData().size())
"Wrong number of base functions and DOFs %d != %d",
nb_row_dofs, row_data.getFieldData().size());
const int nb_gauss_pts = row_data.getN().size1();
if (nb_gauss_pts != static_cast<int>(mapGaussPts.size())) {
"Inconsistency number of dofs %d!=%d", nb_gauss_pts,
mapGaussPts.size());
}
CHKERR postProcMesh.tag_get_by_ptr(
th, &mapGaussPts[0],
mapGaussPts.size(), tags_ptr);
auto t_curl_base = row_data.getFTensor2DiffN<3, 3>();
for (int gg = 0; gg != nb_gauss_pts; gg++) {
double *ptr = &((double *)tags_ptr[gg])[0];
&ptr[2]);
auto t_dof = row_data.getFTensor0FieldData();
for (int aa = 0; aa != nb_row_dofs; aa++) {
++t_curl_base;
++t_dof;
}
}
}
};
};
#endif //__MAGNETICELEMENT_HPP__