Hi all,
I'd like to have apply a stress or force to certain parts of a mesh at different points of a simulation. The mesh I'm using was designed so as to have different element IDs for different regions. I would like to use the same general stress/force function for different parts of the mesh, using the id to distinguish the different mesh parts.
In a previous post, I asked about doing a similar process for one mesh that was copied and translated and used the element id to distinguish between different meshes:
int elid= elem->subdomain_id();
In that process I designated elem->subdomain_id() in the following manner:
int num_parts = 9;
vector<shared_ptr<Mesh>> mesh_shared_ptr_vec(num_parts);
vector<MeshBase*> meshes(num_parts);
for (int part = 0; part < num_parts; ++part)
{
mesh_shared_ptr_vec[part] = make_shared<Mesh>(init.comm(), NDIM);
mesh_shared_ptr_vec[part]->read(mesh_filename);
mesh_shared_ptr_vec[part]->prepare_for_use();
// the IBFE interface still takes in raw pointers, so we need to get it from the
// shared_ptr:
meshes[part]= mesh_shared_ptr_vec[part].get();
}
for (int part = 0; part < num_parts; ++part)
{
MeshBase* mesh = meshes[part];
for (auto& elem : mesh->element_ptr_range())
{
elem->subdomain_id() = part;
}
}
If now I have a single mesh, with different element IDs from the meshing process, would I need to designate these mesh ids? Do I need to register stress/forcing functions for each id? The main difference is navigating a mesh with multiple parts rather than a vector of meshes Thanks for any advice.
-Alex