75 {
77
80 true);
81 auto get_ents_by_dim = [&](const auto dim) {
83 return domain_ents;
84 } else {
86 if (dim == 0)
88 else
90 return ents;
91 }
92 };
93
94
95 auto get_base = [&]() {
96 auto domain_ents = get_ents_by_dim(
SPACE_DIM);
97 if (domain_ents.empty())
101 case MBQUAD:
103 case MBHEX:
105 case MBTRI:
107 case MBTET:
109 default:
111 }
113 };
114
115 auto base = get_base();
118
120
122 PETSC_NULLPTR);
123
125 PETSC_NULLPTR);
129
130 auto project_ho_geometry = [&]() {
133 };
134
136 CHKERR project_ho_geometry();
137
139
140
142 Range mat_electr_ents;
144 if (
bit->getName().compare(0, 12,
"MAT_ELECTRIC") == 0) {
145 const int id =
bit->getMeshsetId();
146 auto &block_data = (*permBlockSetsPtr)[id];
147
149 bit->getMeshset(),
SPACE_DIM, block_data.domainEnts,
true);
150 mat_electr_ents.merge(block_data.domainEnts);
151
152 std::vector<double> attributes;
153 bit->getAttributes(attributes);
154 if (attributes.size() < 1) {
156 " At least one permittivity attributes should be given but "
157 "found %zu",
158 attributes.size());
159 }
160 block_data.epsPermit = attributes[0];
161 block_data.iD = id;
162 }
163 }
164
165
167 Range int_electr_ents;
169 if (
bit->getName().compare(0, 12,
"INT_ELECTRIC") == 0) {
170 const int id =
bit->getMeshsetId();
171 auto &block_data = (*intBlockSetsPtr)[id];
172
174 bit->getMeshset(),
SPACE_DIM - 1, block_data.interfaceEnts,
true);
175 int_electr_ents.merge(block_data.interfaceEnts);
176
177 std::vector<double> attributes;
178 bit->getAttributes(attributes);
179 if (attributes.size() < 1) {
181 "At least one charge attributes should be given but found %zu",
182 attributes.size());
183 }
184 block_data.chargeDensity = attributes[0];
185
186 block_data.iD = id;
187 }
188 }
189
191 Range electrode_ents;
192 int electrodeCount = 0;
194 if (
bit->getName().compare(0, 9,
"ELECTRODE") == 0) {
195 const int id =
bit->getMeshsetId();
196 auto &block_data = (*electrodeBlockSetsPtr)[id];
197 ++electrodeCount;
198
200 bit->getMeshset(),
SPACE_DIM - 1, block_data.electrodeEnts,
true);
201 electrode_ents.merge(block_data.electrodeEnts);
202
203
204 if (electrodeCount > 2) {
206 "Three or more electrode blocksets found");
207 ;
208 }
209 }
210 }
211
212
214 mat_electr_ents);
216 int_electr_ents);
218 electrode_ents);
219
221 PETSC_NULLPTR);
223 PETSC_NULLPTR);
224
227 CHKERR skinner.find_skin(0, mat_electr_ents,
false, skin_tris);
229 ParallelComm *pcomm =
232 CHKERR pcomm->filter_pstatus(skin_tris,
233 PSTATUS_SHARED | PSTATUS_MULTISHARED,
234 PSTATUS_NOT, -1, &proc_skin);
235 } else {
236 proc_skin = skin_tris;
237 }
238
241 "SKIN");
245
251
254
260
262 "ELECTRODE");
263
264
275
279
280 DMType dm_name = "DMMOFEM";
282
285
286
287 CHKERR DMSetType(dm, dm_name);
288
290
291
292 int local_size;
294
296
297 else
298
299 local_size = 0;
300
304}
@ AINSWORTH_LEGENDRE_BASE
Ainsworth Cole (Legendre) approx. base .
#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 data field.
MoFEMErrorCode setUp(const PetscBool is_partitioned=PETSC_TRUE)
Setup problem.
intrusive_ptr for managing petsc objects