I’m trying to explore different workflows for running a simulation. In this case I want to bypass the gmsh step by directly importing and mesh my 3D geometry using mshr. Here is a simple code I wrote to successfully read and mesh the .stl file
#include <dolfin.h>
#include <mshr.h>
using namespace dolfin;
int main(int argc, char **argv)
{
auto geom = std::make_shared<mshr::Surface3D>("../test.stl");
std::shared_ptr<dolfin::Mesh> mesh;
mesh = mshr::generate_mesh(geom, 100);
MeshFunction<std::size_t>
meshfile(mesh, mesh->topology().dim());
// Output cell distribution to VTK file
File file("mesh.pvd");
file << meshfile;
}
my issue now is how do I define subdomains using mshr. In gmsh I just select faces and mark them as physical regions, is there an equivalent way of doing that in mshr?
Yes that is my usual workflow. generating .step file in OnShape -> meshing & naming subdomains in gmsh -> write .xdmf using meshio -> simulate using dolfin
my intent was to somehow bypass all those gmsh and meshio bits. But it seems like this experiment is a failure!