SPECFEM / specfem2d

SPECFEM2D simulates forward and adjoint seismic wave propagation in two-dimensional acoustic, (an)elastic, poroelastic or coupled acoustic-(an)elastic-poroelastic media, with Convolution PML absorbing conditions.
https://specfem.org
GNU General Public License v3.0
203 stars 147 forks source link

🐛 [BUG] - Solver silently overrides 'model' parameter #1232

Open bch0w opened 5 months ago

bch0w commented 5 months ago

Description

This issue was brought to my attention through some SeisFlows issues (https://github.com/adjtomo/seisflows/issues/210, https://github.com/adjtomo/seisflows/issues/210) where synthetic data and synthetics were the same despite different starting and target models.

Looks like when external tomography models are used, there is a critical call in the SPECFEM2D solver that silently ignores the Par_file parameter model and hardcodes model = 'tomo'.

Present in both master and devel branches:

It's not totally silent as the logger prints out the new value of Model, but this has some unintended consequences when the User is expecting their model parameter to have a specific value.

I would suggest removing this line and instead throwing a warning to the User if Model != tomo so they know to change it in their Par_file, or throw a system exit. Alternatively we can add an exception for model != default so that other options that do not use this internal model definition are not affected.

I'm happy to implement and PR the change depending on how we decide.

Affected SPECFEM2D version

master (65cb2a4), devel (0e64075)

Your software and hardware environment

Tested on laptop running MacOS

Reproduction steps

1. Set Par_file `MODEL = default` 
2. Set mesh parameter line to tomo format (starting with -1)
3. Run solver

Screenshots

![DESCRIPTION](LINK.png)

Logs

No response

OS

Mac