72 {
74
77 true);
78 auto get_ents_by_dim = [&](const auto dim) {
80 return domain_ents;
81 } else {
83 if (dim == 0)
85 else
87 return ents;
88 }
89 };
90
91
92 auto get_base = [&]() {
93 auto domain_ents = get_ents_by_dim(
SPACE_DIM);
94 if (domain_ents.empty())
97 switch (type) {
98 case MBQUAD:
100 case MBHEX:
102 case MBTRI:
104 case MBTET:
106 default:
108 }
110 };
111
112 auto base = get_base();
115
117
119 PETSC_NULLPTR);
120
122 PETSC_NULLPTR);
126
127 auto project_ho_geometry = [&]() {
130 };
131
133 CHKERR project_ho_geometry();
134
136
137
139 Range mat_electr_ents;
141 if (
bit->getName().compare(0, 12,
"MAT_ELECTRIC") == 0) {
142 const int id =
bit->getMeshsetId();
143 auto &block_data = (*permBlockSetsPtr)[id];
144
146 bit->getMeshset(),
SPACE_DIM, block_data.domainEnts,
true);
147 mat_electr_ents.merge(block_data.domainEnts);
148
149 std::vector<double> attributes;
150 bit->getAttributes(attributes);
151 if (attributes.size() < 1) {
153 " At least one permittivity attributes should be given but "
154 "found %d",
155 attributes.size());
156 }
157 block_data.iD = id;
158 block_data.epsPermit = attributes[0];
159 }
160 }
161
162
164 Range int_electr_ents;
166 if (
bit->getName().compare(0, 12,
"INT_ELECTRIC") == 0) {
167 const int id =
bit->getMeshsetId();
168 auto &block_data = (*intBlockSetsPtr)[id];
169
171 bit->getMeshset(),
SPACE_DIM - 1, block_data.interfaceEnts,
true);
172 int_electr_ents.merge(block_data.interfaceEnts);
173
174 std::vector<double> attributes;
175 bit->getAttributes(attributes);
176 if (attributes.size() < 1) {
178 "At least one charge attributes should be given but found %d",
179 attributes.size());
180 }
181
182 block_data.iD = id;
183 block_data.chargeDensity = attributes[0];
184 }
185 }
186
188 Range electrode_ents;
189 int electrodeCount = 0;
191 if (
bit->getName().compare(0, 9,
"ELECTRODE") == 0) {
192 const int id =
bit->getMeshsetId();
193 auto &block_data = (*electrodeBlockSetsPtr)[id];
194 ++electrodeCount;
195
197 bit->getMeshset(),
SPACE_DIM - 1, block_data.electrodeEnts,
true);
198 electrode_ents.merge(block_data.electrodeEnts);
199
200
201 if (electrodeCount > 2) {
203 "Three or more electrode blocksets found");
204 ;
205 }
206 }
207 }
208
209
211 mat_electr_ents);
213 int_electr_ents);
215 electrode_ents);
216
218 PETSC_NULLPTR);
220 PETSC_NULLPTR);
221
224 CHKERR skinner.find_skin(0, mat_electr_ents,
false, skin_tris);
226 ParallelComm *pcomm =
229 CHKERR pcomm->filter_pstatus(skin_tris,
230 PSTATUS_SHARED | PSTATUS_MULTISHARED,
231 PSTATUS_NOT, -1, &proc_skin);
232 } else {
233 proc_skin = skin_tris;
234 }
235
238 "SKIN");
242
248
251
257
259 "ELECTRODE");
260
261
272
276
277 DMType dm_name = "DMMOFEM";
279
282
283
284 CHKERR DMSetType(dm, dm_name);
285
287
288
289 int local_size;
291
293
294 else
295
296 local_size = 0;
297
301}
@ AINSWORTH_LEGENDRE_BASE
Ainsworth Cole (Legendre) approx. base nme:nme847.
#define CHK_THROW_MESSAGE(err, msg)
Check and throw MoFEM exception.
#define MYPCOMM_INDEX
default communicator number PCOMM
@ MOFEM_DATA_INCONSISTENCY
PetscErrorCode DMMoFEMAddElement(DM dm, std::string fe_name)
add element to dm
PetscErrorCode DMRegister_MoFEM(const char sname[])
Register MoFEM problem.
virtual MoFEMErrorCode add_ents_to_finite_element_by_dim(const EntityHandle entities, const int dim, const std::string name, const bool recursive=true)=0
add entities to finite element
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 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 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.
auto type_from_handle(const EntityHandle h)
get type from entity handle
PetscErrorCode PetscOptionsGetInt(PetscOptions *, const char pre[], const char name[], PetscInt *ivalue, PetscBool *set)
PetscErrorCode PetscOptionsGetBool(PetscOptions *, const char pre[], const char name[], PetscBool *bval, PetscBool *set)
auto createVectorMPI(MPI_Comm comm, PetscInt n, PetscInt N)
Create MPI Vector.
auto createDM(MPI_Comm comm, const std::string dm_type_name)
Creates smart DM object.
virtual MPI_Comm & get_comm() const =0
Projection of edge entities with one mid-node on hierarchical basis.
MoFEMErrorCode buildProblem()
Build problem.
MoFEMErrorCode addDomainField(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_ZERO, int verb=-1)
Add field on domain.
MoFEMErrorCode defineFiniteElements()
Define finite elements.
MoFEMErrorCode buildFiniteElements()
Build finite elements.
MoFEMErrorCode addBoundaryField(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_ZERO, int verb=-1)
Add field on boundary.
MoFEMErrorCode buildFields()
Build fields.
MoFEMErrorCode setFieldOrder(const std::string field_name, const int order, const Range *ents=NULL)
Set field order.
MoFEMErrorCode defineProblem(const PetscBool is_partitioned=PETSC_TRUE)
define problem
MoFEMErrorCode addDataField(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_ZERO, int verb=-1)
Add field on domain.
MoFEMErrorCode setUp(const PetscBool is_partitioned=PETSC_TRUE)
Setup problem.
intrusive_ptr for managing petsc objects