Issue 2000 - Generate thin mesh layer - #2011
Open
icui wants to merge 7 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces an optional “thin” SPECFEM++ mesh database output path in the MESHFEM3D globe mesher, gated by a new Par_file flag (SPECFEMPP_DATABASE), while keeping the existing solver database output unchanged. It also updates the global_small_mesh benchmark to exercise and validate the new thin-database output.
Changes:
- Added
SPECFEMPP_DATABASEparameter plumbing (read fromPar_file, broadcast via MPI, carried through mesher control flow). - Added per-element context capture (reference anchors + shell bounds + crust flag) and hooks to accumulate per-region data and write a single merged output per rank.
- Updated the globe benchmark configuration/workflow to enable ellipticity and run thin-database validation via
uv“examples” dependencies.
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| fortran/meshfem3d_globe/shared/shared_par.f90 | Adds the SPECFEMPP_DATABASE input parameter with default .false.. |
| fortran/meshfem3d_globe/shared/read_parameter_file.F90 | Reads the new SPECFEMPP_DATABASE flag from the Par_file. |
| fortran/meshfem3d_globe/shared/broadcast_computed_parameters.f90 | Broadcasts SPECFEMPP_DATABASE so non-root MPI ranks receive the flag. |
| fortran/meshfem3d_globe/shared/rules.mk | Wires a new adjacency_graph shared object/module into the make-based build (currently references missing source/module). |
| fortran/meshfem3d_globe/shared/CMakeLists.txt | Adds adjacency_graph.f90 to shared sources (currently references a missing file). |
| fortran/meshfem3d_globe/meshfem3D/meshfem3D_par.f90 | Adds allocatable arrays to store per-element context for the thin database. |
| fortran/meshfem3d_globe/meshfem3D/compute_element_properties.f90 | Captures reference-anchor coordinates and per-element radial bounds/crust flag for thin-db output. |
| fortran/meshfem3d_globe/meshfem3D/create_regions_mesh.F90 | Allocates/deallocates thin-db context arrays and calls the region-accumulation hook when enabled. |
| fortran/meshfem3d_globe/meshfem3D/create_meshes.f90 | Calls the final “write merged per-rank thin-db” hook after all regions complete. |
| fortran/meshfem3d_globe/meshfem3D/rules.mk | Wires the new thin-db writer object/module into the make-based build (currently references missing source/module). |
| fortran/meshfem3d_globe/meshfem3D/CMakeLists.txt | Adds save_database_specfempp.F90 to mesh sources (currently references a missing file). |
| benchmarks/src/dim3_globe/global_small_mesh/README.md | Documents enabling SPECFEMPP_DATABASE and describes the validation coverage. |
| benchmarks/src/dim3_globe/global_small_mesh/DATA/Par_file | Enables ELLIPTICITY and sets SPECFEMPP_DATABASE = .true. for the benchmark. |
| benchmarks/src/dim3_globe/global_small_mesh/CMakeLists.txt | Adds a post-mesh uv run ... python check_database.py validation step (currently references a missing script). |
| benchmarks/src/dim3_globe/global_small_mesh/CMakeFiles/Snakefile.in | Adds outputs and a check_database rule to validate the generated thin-db files (currently references a missing script). |
Suppressed comments (2)
fortran/meshfem3d_globe/shared/rules.mk:99
shared_MODULESnow expects$(FC_MODDIR)/adjacency_graph_shared.$(FC_MODEXT), but no module producing that.modfile is present infortran/meshfem3d_globe/shared/(andadjacency_graph.f90itself is missing). This will cause the Makefile module dependency stage to fail.
shared_MODULES = \
$(FC_MODDIR)/adjacency_graph_shared.$(FC_MODEXT) \
$(FC_MODDIR)/constants.$(FC_MODEXT) \
$(FC_MODDIR)/manager_adios.$(FC_MODEXT) \
$(FC_MODDIR)/manager_hdf5.$(FC_MODEXT) \
$(FC_MODDIR)/model_prem_par.$(FC_MODEXT) \
fortran/meshfem3d_globe/meshfem3D/rules.mk:150
meshfem3D_MODULESnow expects$(FC_MODDIR)/specfempp_database_par.$(FC_MODEXT), but there is no source in this PR checkout that definesmodule specfempp_database_par. This will break the Makefile module dependency list and anyuse specfempp_database_parsites.
meshfem3D_MODULES = \
$(FC_MODDIR)/specfempp_database_par.$(FC_MODEXT) \
$(FC_MODDIR)/regions_mesh_par.$(FC_MODEXT) \
$(FC_MODDIR)/regions_mesh_par2.$(FC_MODEXT) \
$(FC_MODDIR)/mpi_interfaces_par.$(FC_MODEXT) \
$(FC_MODDIR)/gapp2_mantle_model_constants.$(FC_MODEXT) \
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
88
to
93
| moho_stretching.f90 | ||
| save_arrays_solver.f90 | ||
| save_arrays_solver_hdf5.F90 | ||
| save_database_specfempp.F90 | ||
| save_model_meshfiles.f90 | ||
| save_model_meshfiles_hdf5.F90 |
Comment on lines
14
to
18
| set(MESHFEM3DG_SHARED_SOURCES | ||
| adjacency_graph.f90 | ||
| assemble_MPI_scalar.f90 | ||
| assemble_MPI_vector.f90 | ||
| auto_ner.f90 |
Comment on lines
124
to
129
| $O/moho_stretching.check.o \ | ||
| $O/save_arrays_solver.check.o \ | ||
| $O/save_arrays_solver_hdf5.check.o \ | ||
| $O/save_database_specfempp.check.o \ | ||
| $O/save_model_meshfiles.check.o \ | ||
| $O/save_model_meshfiles_hdf5.check.o \ |
Comment on lines
12
to
17
| file( | ||
| COPY | ||
| ${CMAKE_CURRENT_SOURCE_DIR}/README.md | ||
| ${CMAKE_CURRENT_SOURCE_DIR}/check_database.py | ||
| ${CMAKE_CURRENT_SOURCE_DIR}/DATA | ||
| DESTINATION ${CURRENT_BENCHMARK_BUILD_DIR} |
Comment on lines
+40
to
+46
| input: | ||
| expand( | ||
| str(example_dir / "DATABASES_MPI" / "proc{rank:06d}_specfempp_database.bin"), | ||
| rank=range(nproc), | ||
| ), | ||
| script=example_dir / "check_database.py", | ||
| output: |
Comment on lines
35
to
39
| $O/shared_par.shared_module.o \ | ||
| $O/adios_manager.shared_adios_module.o \ | ||
| $O/adjacency_graph.shared.o \ | ||
| $O/assemble_MPI_scalar.shared.o \ | ||
| $O/assemble_MPI_vector.shared.o \ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
###Summary
Adds an optional thin SPECFEM++ database writer to MESHFEM3D Globe without touching the full mesh writer.
SPECFEMPP_DATABASEPar_fileoption.uvexamplesdependency group.Reference Geometry
Reference anchors are captured after Moho and radial-layer stretching, but before:
A centralized
specfempp_has_reference_geometry()helper determines whether reference geometry is required, including internal-topography models andSUPPRESS_INTERNAL_TOPOGRAPHY.The database header contains an explicit
HAS_REFERENCE_GEOMETRYflag so readers can determine whether the reference-node record is present without inferring it from other options.Testing
xmeshfem3D_globe.Issue Number
Closes #2000
Checklist
Please make sure to check developer documentation on specfem docs.