brendanjmeade / celeri

Next generation earthquake cycle kinematics
BSD 3-Clause "New" or "Revised" License
25 stars 7 forks source link

Convert ribbon meshing notebook to script with command line arguments #118

Open brendanjmeade opened 2 months ago

Emilycm-97 commented 2 months ago

Current Meshing Workflow:

  1. Upload the desired segment file to celeri.ui.
  2. Modify the segment file as needed and save, as this will be used for running the block model.
  3. Select the segment intended for mesh creation and delete all other segments from the file.
  4. Ensure 'create_ribbon_mesh = 1' for all segments involved in mesh creation.
  5. Save this as a separate segment file.
  6. Sort the segments by longitude in a continuous sequence (e.g., 1, 2, 3...).
  7. If necessary, install/update gmsh using the terminal and Homebrew.
  8. Update the 'mesh_ribbon_hacky' notebook with your segment file. You'll need both the original mesh segment file and sorted segment files.
  9. Run gmsh, which will generate and display the mesh, then save the .msh file required for the block model.
  10. Copy and paste the '.msh' file into the 'data>mesh' subfolder within your block model directory.
  11. Update your 'mesh_parameters.json' file and test the setup.
jploveless commented 1 month ago

Thank you for documenting this, @Emilycm-97!

This summer, I wrote a new notebook that follows this approach but automates several steps. Your post has prompted me to highlight them here so we have a written record.

  1. Segments are automatically sorted, although this assumes that the create_ribbon_mesh flag was set sensible (i.e. for a continuous sequence of segments). The automatic ordering is achieved through referencing the ordered coordinates from the block labeling routine.
  2. Gmsh functions are called within the notebook, not externally through the standalone Gmsh app. This involves importing the gmsh library, but this is now done (I believe) as part of the environment.yml for celeri
  3. All newly created .msh files are placed into the data/mesh directory.
  4. The mesh_parameters.json file is automatically updated
  5. A new segment.csv file is written that sets create_ribbon_mesh = 0, so that we don't try to re-mesh them in the future.
brendanjmeade commented 1 month ago

@Emilycm-97 Thanks for writing out your current workflow! @jploveless That's an awesome level of automation. Inspired!