TDycores-Project / TDycore

BSD 2-Clause "Simplified" License
4 stars 0 forks source link

Demo to mark mesh faces with labels #182

Closed bishtgautam closed 3 years ago

bishtgautam commented 3 years ago

We're getting interested in running some "realistic" simulations that include non-trivial boundary conditions. In that connection, it would be nice to have a demo program that illustrates a workflow for generating and/or reading in meshes and associating boundary conditions with faces on the boundary of the problem.

The simplest such demo would do the following:

Given some sort of specification that defines a flow, including boundary conditions:

  1. Create a box mesh with labels on each of the faces of its 6 boundaries (much like Jed describes in the comments below).
  2. Save the box mesh to an HDF5 file that encodes the label information and possible a "schema" that allows TDycore to interpret which boundary conditions to assign to each label (or not, if we want to stick to integer labels and have the boundary conditions be configurable by the driver exclusively).
  3. Runs a flow simulation on the box mesh, allowing us to determine whether the BCs are being specified properly.

We can add an option to skip the first 2 steps and instead load an existing HDF5 file. This allows us to prove that we have a mechanism for reading and writing mesh files with BC information (or at least boundary face information).

Questions

@bishtgautam

jedbrown commented 3 years ago

Could you be a little more specific about what you want labeled? The PETSc box mesh generator labels the "Face Sets" (1 through 6 for a 3D box) and it should read/write those. I have a separate task to add support for named sets so we don't have so many magic numbers.

jeff-cohere commented 3 years ago

This is something that Gautam and I were discussing--a little program that creates a simple box mesh that labels faces with BC indices (probably in a simple way, using the 6 boundaries of the box domain). Also, it would have a driver-like component that runs simulations on them. Really, it's just a sandbox for us to explore how we assign and represent BCs.

jedbrown commented 3 years ago

Okay, you can currently do this with

DMCreate(comm, &dm);
DMSetType(dm, DMPLEX);
DMSetFromOptions(dm);

and then -dm_plex_shape box -dm_plex_box_faces 2,3,4. (You can make lots of other shapes this way too.) That box will have a "Face Sets" label with distinct value on each face.

    faceMarkerBottom = 1;
    faceMarkerTop    = 2;
    faceMarkerFront  = 3;
    faceMarkerBack   = 4;
    faceMarkerRight  = 5;
    faceMarkerLeft   = 6;

https://petsc.org/main/docs/manualpages/DM/DMSetFromOptions.html

jeff-cohere commented 3 years ago

We're going another way with this particular task. I'll create a new issue.