bit squashing

14 views
Skip to first unread message
Assigned to lik...@wp.pl by me

ignathanas

unread,
Nov 8, 2021, 5:13:15 AM11/8/21
to MoFEM Q&A
Hello,

I am currently using crack_mesh_cut.cpp script to cut a mesh where the input file is not a restart file.

My goal is to produce a mesh with only one bitRefLevel and therefore only the cut mesh (preserving the initial cutting surface is not an issue).

The current available code produces a mesh where 3 bits:

There are 3 bit ref levels:
mapBitLevel["spatial_domain"]
mapBitLevel["mesh_cut"]
mapBitLevel["material_domain"]

In other words the output file has coexisting bits.

I am aware that the problem is that the bits need to be squashed.
However, when squashing bit, entities associated to a bit ref are deleted when using function shiftRightBitRef:


Hence, the end result is getting back the original mesh with a single BitRefLevel.
If I squash one less, I have 2 meshes Coexisting and 2 bits.

I managed to delete the part of the mesh that is related to the unwanted pre-cut tets and keep the wanted mesh, however bits are unsqusashed. 
If I squash bit using shiftRightBitRef, I end up with a mesh that has 1 bitRefLevel but all the new tets generated by cutting are deleted as shiftRightBitRef deletes them.

Then I tried to just
squash the bits by this snipet that avoids deleting the entities:

BitRefLevel bit = cp.mapBitLevel["spatial_domain"];

std::size_t idx = 0;
while (!bit.test(idx))
++idx;


int last_bit = idx+1;
cerr << "last_bit " << last_bit << "\n";
BitRefLevel shift_mask;
for (int ll = 0; ll != last_bit; ++ll)
shift_mask.set(ll);

auto ref_ents_ptr = m_field.get_ref_ents();
RefEntity_change_right_shift right_shift(1, shift_mask);
for (int ii = 0; ii < last_bit; ii++) {
// delete bits on the right which are shifted to zero
BitRefLevel delete_bits = BitRefLevel().set(0) & shift_mask;
for (RefEntity_multiIndex::iterator ent_it = ref_ents_ptr->begin();
ent_it != ref_ents_ptr->end(); ent_it++) {
MOFEM_LOG_FUNCTION();
MOFEM_LOG("BitRefSelf", Sev::noisy)
<< (*ent_it)->getBitRefLevel() << " : ";
right_shift(const_cast<boost::shared_ptr<RefEntity> &>(*ent_it));

MOFEM_LOG_FUNCTION();
MOFEM_LOG("BitRefSelf", Sev::noisy) << (*ent_it)->getBitRefLevel();
}
}


but bits are not squashed.

I think that there is something fundamental I am not.

Any help will be appreciated.
Thanks in advance.
Ignatios




Lukasz Kaczmraczyk

unread,
Nov 8, 2021, 5:19:02 AM11/8/21
to MoFEM Q&A
Hello,

The question is, why do you need squash bits? My understanding is that you like to do other analyses, i.e. thermal. Since the thermal analysis code assumes only one mesh level, so instead do bit squashing, we can make a "thermal analysis" to handle multiple levels. That is an idea. 

It looks that is no other way if you like to take back analysis to the fracture module since information about mesh levels has to be preserved.

Lukasz

ignathanas

unread,
Nov 8, 2021, 5:22:51 AM11/8/21
to MoFEM Q&A
Hi Lukasz,

OK this makes sense.
I will try to make it work at the thermoelasticity level and let you know.

Many thanks.
Ignatios

ignathanas

unread,
Nov 8, 2021, 6:30:27 PM11/8/21
to MoFEM Q&A
Hello,

does it make sense to add a simple interface constructor to determine meshsets and bit ref levels?

Ignatios

Lukasz Kaczmraczyk

unread,
Nov 9, 2021, 5:33:43 AM11/9/21
to MoFEM Q&A
Ignatios,

The simple interface is called simple for a reason, it supposes to remain simple, and we should keep API small. Since you have mesh with many bit ref levels, crack mesh, and many fields which comes from other problem, I will recommend using an API from the core interface, which gives you great flexibility. 

For example, core interface is used in this tutorial:


L.
Reply all
Reply to author
Forward
0 new messages