73 {
75
78 true);
79 auto get_ents_by_dim = [&](const auto dim) {
81 return domain_ents;
82 } else {
84 if (dim == 0)
86 else
88 return ents;
89 }
90 };
91
92
93 auto get_base = [&]() {
94 auto domain_ents = get_ents_by_dim(
SPACE_DIM);
95 if (domain_ents.empty())
99 case MBQUAD:
101 case MBHEX:
103 case MBTRI:
105 case MBTET:
107 default:
109 }
111 };
112
113 auto base = get_base();
116
118
120 PETSC_NULLPTR);
121
123 PETSC_NULLPTR);
127
128 auto project_ho_geometry = [&]() {
131 };
132
134 CHKERR project_ho_geometry();
135
138
139
141 Range mat_electr_ents;
143 if (
bit->getName().compare(0, 12,
"MAT_ELECTRIC") == 0) {
144 const int id =
bit->getMeshsetId();
145 auto &block_data = (*permBlockSetsPtr)[id];
146
148 bit->getMeshset(),
SPACE_DIM, block_data.domainEnts,
true);
149 mat_electr_ents.merge(block_data.domainEnts);
150
151 const auto params_from_json =
152 json_config->getParamsFromBlockset("MAT_ELECTRIC", id);
153 if (!params_from_json.empty()) {
154 block_data.epsPermit = params_from_json.at("permittivity");
155 } else {
156 std::vector<double> attributes;
157 bit->getAttributes(attributes);
158 if (attributes.size() < 1) {
160 " At least one permittivity attributes should be given but "
161 "found %zu",
162 attributes.size());
163 }
164 block_data.epsPermit = attributes[0];
165 }
166 block_data.iD = id;
167 }
168 }
169
170
172 Range int_electr_ents;
174 if (
bit->getName().compare(0, 12,
"INT_ELECTRIC") == 0) {
175 const int id =
bit->getMeshsetId();
176 auto &block_data = (*intBlockSetsPtr)[id];
177
179 bit->getMeshset(),
SPACE_DIM - 1, block_data.interfaceEnts,
true);
180 int_electr_ents.merge(block_data.interfaceEnts);
181
182 const auto params_from_json =
183 json_config->getParamsFromBlockset("INT_ELECTRIC", id);
184 if (!params_from_json.empty()) {
185 block_data.chargeDensity = params_from_json.at("charge_density");
186 } else {
187 std::vector<double> attributes;
188 bit->getAttributes(attributes);
189 if (attributes.size() < 1) {
191 "At least one charge attributes should be given but found %zu",
192 attributes.size());
193 }
194 block_data.chargeDensity = attributes[0];
195 }
196
197 block_data.iD = id;
198 }
199 }
200
202 Range electrode_ents;
203 int electrodeCount = 0;
205 if (
bit->getName().compare(0, 9,
"ELECTRODE") == 0) {
206 const int id =
bit->getMeshsetId();
207 auto &block_data = (*electrodeBlockSetsPtr)[id];
208 ++electrodeCount;
209
211 bit->getMeshset(),
SPACE_DIM - 1, block_data.electrodeEnts,
true);
212 electrode_ents.merge(block_data.electrodeEnts);
213
214
215 if (electrodeCount > 2) {
217 "Three or more electrode blocksets found");
218 ;
219 }
220 }
221 }
222
223
225 mat_electr_ents);
227 int_electr_ents);
229 electrode_ents);
230
232 PETSC_NULLPTR);
234 PETSC_NULLPTR);
235
238 CHKERR skinner.find_skin(0, mat_electr_ents,
false, skin_tris);
240 ParallelComm *pcomm =
243 CHKERR pcomm->filter_pstatus(skin_tris,
244 PSTATUS_SHARED | PSTATUS_MULTISHARED,
245 PSTATUS_NOT, -1, &proc_skin);
246 } else {
247 proc_skin = skin_tris;
248 }
249
252 "SKIN");
256
262
265
271
273 "ELECTRODE");
274
275
286
290
291 DMType dm_name = "DMMOFEM";
293
296
297
298 CHKERR DMSetType(dm, dm_name);
299
301
302
303 int local_size;
305
307
308 else
309
310 local_size = 0;
311
315}
@ 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