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.
GNU General Public License v3.0
191 stars 146 forks source link

Tomographic File Read but not Applied in Simulation #1227

Open cashccherry opened 3 months ago

cashccherry commented 3 months ago

Description

The mesher reads a tomographic file with differing velocities, but the wavefield looks like its run on a homogeneous model.

Tomo file model

Screenshot 2024-05-28 at 11 19 35 PM

Wavefield image

forward_image000003600 31f)

Included files:

DATA.zip run.sh.zip

Affected SPECFEM2D version

98741db1a0c8082ca57364f5b17ea95df6cbf1c2

Your software and hardware environment

FC=gfortran MPI=(can't find mpi on my computer and serial run) MacBook Pro 16 GB RAM macOS 14.0

Reproduction steps

Change the paths in run.sh to your system's specfem2d installation
Run the included script run.sh in a directory with the included folder DATA

Screenshots

When I run the script run.sh (attached) with the given tomographic file and interface file, the wavefield shows no interaction with inhomogeneities present in the model.

The tomo.xyz file is for the model pictured below with a homogeneous density.
<img width="916" alt="Screenshot 2024-05-28 at 11 19 35 PM" src="https://github.com/SPECFEM/specfem2d/assets/122390385/689631b4-65ba-444c-93fe-e7c82978b1a3">

The wavefield image below shows the waves don't interact with the model as they should.

![forward_image000003600](https://github.com/SPECFEM/specfem2d/assets/122390385/ee7e6a56-afb7-4766-814a-c04bb2c3e41e)
31f)

A further detail is that the mesher reads in the tomo file with correct min and max values, but then states that min and max velocity values are the same.

Logs

Material properties:
   MODEL                 : tomo
   nspec                 :        22500
   assign external model :  T

   assigning an external tomography velocity and density model
   model selected             : tomo
   setup with binary database :            1

   tomographic model file: ./DATA/tomo_file.xyz
      Number of grid points = NX*NZ:       22500

      read model vp : min/max =    3050.00000      /    8950.00000    
                 vs : min/max =    2526.00000      /    4365.00000    
                 rho: min/max =    3000.00000      /    3000.00000    

   number of GLL points with tomographic model values:       562500

   done reading external model

   setting up material arrays
   setting up anisotropic arrays
   all material arrays done

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

 Checking mesh and stability

 ********
 Model: P (or PI) velocity min,max =    8000.0000000000000        8000.0000000000000     
 Model: S velocity min,max         =    4179.0000564728398        4179.0000564728398     
 Model: density min,max            =    3000.0000000000000        3000.0000000000000     
 ********

OS

Mac

mnagaso commented 3 months ago

Hi Cash,

I found that your tomo_file.xyz is created with a wrong order on x and z,

You file here is:

         0          0     476800     476800
      3200       3200
       150        150
      3050       8950       2526       4365       3000       3000
         0          0       8000       4179       3000
         0       3200       8000       4179       3000
         0       6400       8000       4179       3000
         0       9600       8000       4179       3000

but what specfem2d actually needs is

         0          0     476800     476800
      3200       3200
       150        150
      3050       8950       2526       4365       3000       3000
       0.0        0.0     8000.0     4179.0     3000.0
    3200.0        0.0     8000.0     4179.0     3000.0
    6400.0        0.0     8000.0     4179.0     3000.0
    9600.0        0.0     8000.0     4179.0     3000.0

Also in your Par_file at the Velocity and density models section, you need to modify the model like:

#-----------------------------------------------------------
#
# Velocity and density models
#
#-----------------------------------------------------------

# number of model materials
nbmodels                        = 1
# available material types (see user manual for more information)

...

#   tomo:                  model_number -1 0 0 A 0 0 0 0 0 0 0 0 0 0

...

###1 -1 9999 9999 .5 0 0 9999 9999 0 0 0 0 0 0 #### REPLACED LINE HERE
1 -1 0 0 0.5 0 0 0 0 0 0 0 0 0 0

# external tomography file
TOMOGRAPHY_FILE                 = ./DATA/tomo_file_sorted.xyz

then your simulation will be fine :smiley: forward_image000003600

mnagaso commented 3 months ago

FYI: here is the code which reads the tomo file. You can see the explanation on the file format.

https://github.com/SPECFEM/specfem2d/blob/98741db1a0c8082ca57364f5b17ea95df6cbf1c2/src/specfem2D/define_external_model_from_tomo_file.f90#L536