20static char help[] =
"-my_file input file"
21 "-my_order order of approximation"
22 "-nb_levels number of refinements levels"
67 const double z,
double &flux) {
83 const double y,
const double z,
double &value) {
99 const double y,
const double z,
double &flux) {
107 Range &tris = mit->second.eNts;
108 if (tris.find(ent) != tris.end()) {
109 flux = mit->second.fLux;
136 CHKERR skin.find_skin(0, tets,
false, skin_faces);
145 natural_bc.insert(tris.begin(), tris.end());
150 CHKERR it->getBcDataStructure(mydata);
151 if (mydata.
data.flag1 == 1) {
155 bcFluxMap[it->getMeshsetId()].eNts = tris;
161 Range essential_bc = subtract(skin_faces, natural_bc);
165 essential_bc = intersect(bit_tris, essential_bc);
166 natural_bc = intersect(bit_tris, natural_bc);
209 typedef RefEntity_multiIndex::index<
211 const RefEntsByComposite &ref_ents =
213 RefEntsByComposite::iterator rit, hi_rit;
214 rit = ref_ents.lower_bound(boost::make_tuple(MBVERTEX, MBEDGE));
215 hi_rit = ref_ents.upper_bound(boost::make_tuple(MBVERTEX, MBEDGE));
218 for (; rit != hi_rit; rit++) {
219 refined_edges.insert((*rit)->getParentEnt());
222 Range tets_to_refine;
223 const double max_error = ufe.
errorMap.rbegin()->first;
225 for (map<double, EntityHandle>::iterator mit = ufe.
errorMap.begin();
229 if (mit->first < 0.25 * max_error)
231 tets_to_refine.insert(mit->second);
233 Range tets_to_refine_edges;
235 tets_to_refine, 1,
false, tets_to_refine_edges, moab::Interface::UNION);
236 refined_edges.merge(tets_to_refine_edges);
238 for (
int ll = 0; ll !=
nb_levels; ll++) {
242 edges = intersect(edges, refined_edges);
286 CHKERR it->getAttributeDataStructure(temp_data);
288 temp_data.
data.Conductivity;
289 setOfBlocks[it->getMeshsetId()].cApacity = temp_data.
data.HeatCapacity;
291 it->meshset, MBTET,
setOfBlocks[it->getMeshsetId()].tEts,
true);
293 intersect(ref_tets,
setOfBlocks[it->getMeshsetId()].tEts);
295 setOfBlocks[it->getMeshsetId()].tEts, MBTET,
"MIX");
318 RefEntity_multiIndex::iterator mit = ref_ents_ptr->begin();
319 for (; mit != ref_ents_ptr->end(); mit++) {
320 if (mit->get()->getEntType() == MBENTITYSET)
323 if ((all_but_0 &
bit) ==
bit) {
324 *(
const_cast<RefEntity *
>(mit->get())->getBitRefLevelPtr()) =
327 *(
const_cast<RefEntity *
>(mit->get())->getBitRefLevelPtr()) =
347 ->updateMeshsetByEntitiesChildren(meshset, ref_level, meshset,
354int main(
int argc,
char *argv[]) {
358 "-pc_factor_mat_solver_type mumps \n"
359 "-mat_mumps_icntl_20 0 \n"
363 if (!
static_cast<bool>(ifstream(
param_file))) {
364 std::ofstream file(
param_file.c_str(), std::ios::ate);
365 if (file.is_open()) {
375 moab::Core mb_instance;
376 moab::Interface &moab = mb_instance;
378 MPI_Comm_rank(PETSC_COMM_WORLD, &rank);
381 PetscBool flg = PETSC_TRUE;
385 if (flg != PETSC_TRUE) {
387 "*** ERROR -my_file (MESH FILE NEEDED)");
403 PetscPrintf(PETSC_COMM_WORLD,
404 "Read meshsets add added meshsets for bc.cfg\n");
406 PetscPrintf(PETSC_COMM_WORLD,
"%s",
407 static_cast<std::ostringstream &
>(
408 std::ostringstream().seekp(0) << *it << endl)
426 if (flg != PETSC_TRUE) {
456 for (
int ll = 1; ll !=
nb_levels; ll++) {
470 static_cast<std::ostringstream &
>(std::ostringstream().seekp(0)
const std::string default_options
Mix implementation of transport element.
#define CATCH_ERRORS
Catch errors.
#define BITREFLEVEL_SIZE
max number of refinements
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#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"
#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 RefEntity_multiIndex * get_ref_ents() const =0
Get the ref ents object.
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 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.
#define _IT_CUBITMESHSETS_BY_BCDATA_TYPE_FOR_LOOP_(MESHSET_MANAGER, CUBITBCTYPE, IT)
Iterator that loops over a specific Cubit MeshSet in a moFEM field.
#define _IT_CUBITMESHSETS_FOR_LOOP_(MESHSET_MANAGER, IT)
Iterator that loops over all the Cubit MeshSets in a moFEM field.
map< int, BcFluxData > BcFluxMap
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
PetscErrorCode PetscOptionsGetInt(PetscOptions *, const char pre[], const char name[], PetscInt *ivalue, PetscBool *set)
PetscErrorCode PetscOptionsGetString(PetscOptions *, const char pre[], const char name[], char str[], size_t size, PetscBool *set)
MoFEMErrorCode postProc(const string out_file)
Post process results.
MoFEMErrorCode destroyMatrices()
destroy matrices
MoFEMErrorCode evaluateError()
Calculate error on elements.
MoFEMErrorCode solveLinearProblem()
solve problem
MoFEMErrorCode createMatrices()
create matrices
MoFEM::Interface & mField
MoFEMErrorCode calculateResidual()
calculate residual
MoFEMErrorCode addFiniteElements(const std::string &fluxes_name, const std::string &values_name)
add finite elements
map< double, EntityHandle > errorMap
MoFEMErrorCode addFields(const std::string &values, const std::string &fluxes, const int order)
Add fields to database.
std::map< int, BlockData > setOfBlocks
maps block set id with appropriate BlockData
MoFEMErrorCode buildProblem(BitRefLevel &ref_level)
Build problem.
virtual moab::Interface & get_moab()=0
static MoFEMErrorCode Initialize(int *argc, char ***args, const char file[], const char help[])
Initializes the MoFEM database PETSc, MOAB and MPI.
static MoFEMErrorCode Finalize()
Checks for options to be called at the conclusion of the program.
Deprecated interface functions.
Definition of the heat flux bc data structure.
Thermal material data structure.
Mesh refinement interface.
MoFEMErrorCode refineTets(const EntityHandle meshset, const BitRefLevel &bit, int verb=QUIET, const bool debug=false)
refine TET in the meshset
MoFEMErrorCode addVerticesInTheMiddleOfEdges(const EntityHandle meshset, const BitRefLevel &bit, const bool recursive=false, int verb=QUIET, EntityHandle start_v=0)
make vertices in the middle of edges in meshset and add them to refinement levels defined by bit
Interface for managing meshsets containing materials and boundary conditions.
MoFEMErrorCode setMeshsetFromFile(const string file_name, const bool clean_file_options=true)
add blocksets reading config file
Struct keeps handle to refined handle.
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface refernce to pointer of interface.
Application of mix transport data structure.
MoFEMErrorCode updateMeshsetsFieldsAndElements(const int nb_levels)
update meshsets with new entities after mesh refinement
MyTransport(MoFEM::Interface &m_field, BcFluxMap &bc_flux_map)
MoFEMErrorCode getBcOnValues(const EntityHandle ent, const double x, const double y, const double z, double &value)
natural (Dirihlet) boundary conditions (set values)
MoFEMErrorCode addBoundaryElements(BitRefLevel &ref_level)
set-up boundary conditions
MoFEMErrorCode getBcOnFluxes(const EntityHandle ent, const double x, const double y, const double z, double &flux)
essential (Neumann) boundary condition (set fluxes)
MoFEMErrorCode squashBits()
Squash bits of entities.
MoFEMErrorCode refineMesh(MixTransportElement &ufe, const int nb_levels, const int order)
Refine mesh.
MoFEMErrorCode getSource(EntityHandle ent, const double x, const double y, const double z, double &flux)
set source term