SPECFEM / specfem3d

SPECFEM3D_Cartesian simulates acoustic (fluid), elastic (solid), coupled acoustic/elastic, poroelastic or seismic wave propagation in any type of conforming mesh of hexahedra (structured & unstructured).
https://specfem.org
GNU General Public License v3.0
412 stars 229 forks source link

Issue with model updating #1378

Closed jjeeffff closed 4 years ago

jjeeffff commented 4 years ago

Dear all,

I tried to do tomography with SPECFEM3D, it occured an error when I ran the xadd_model_iso at the last step:

At line 333 of file src/tomography/read_model.f90 (unit = 40, file = 'topo/proc000004_external_mesh.bin') Fortran runtime error: I/O past end of record on unformatted file

All the external_mesh binary files are not read in. I copied the vs, vp, rho binary files and external_mesh binary files from the same DATABASES_MPI, and the vs, vp, rho files are read in successfully. It seems that the sizes of external_mesh files are different from the model files. Do you have any idea how to solve it?

Thank you very much Jeff

danielpeter commented 4 years ago

this sounds pretty similar to issue #1375

please update to the most recent devel branch version which should fix this.

jjeeffff commented 4 years ago

this sounds pretty similar to issue #1375

please update to the most recent devel branch version which should fix this.

Thanks a lot for your help. I have downloaded the devel branch version and the program works fine.

jjeeffff commented 4 years ago

this sounds pretty similar to issue #1375

please update to the most recent devel branch version which should fix this.

Hi Daniel

I used the real seismic data to do tomography, the _xadd_modeliso program run just a few seconds. And the relative update is about 10e-3, so the model changed little. But the synthetic seismograms are not very close to the real seismograms. Do you have any idea how could that be? Thanks a lot for your help.

danielpeter commented 4 years ago

this little tool xadd_model_iso is only doing a single model update using a steepest descent method with a step size given by the user input. it is not performing an iterative optimization, but consists only of a single model update step. when you want a full iterative approach, it's mainly up to you to implement it. the SPECFEM packages are focussing on the forward/adjoint problem, not on (non-linear) optimization procedures. that would be a different field, with many research options of its own. this model update tool here is mostly meant as an example of how things could look - thus, provides you only with the basic bricks, you put the mortar around to build your own wall.

note that steepest descent is really just the most basic approach for an iterative inversion procedure, faster convergence rates can be achieved by more sophisticated methods like conjugate gradient, L-BFGS and others. anyway, if you want to use it, use it in an iterative way, compute your kernels, update the model, re-compute kernels, update the model again and so on until either your kernels are zero or you run out of compute time :)

jjeeffff commented 4 years ago

this little tool xadd_model_iso is only doing a single model update using a steepest descent method with a step size given by the user input. it is not performing an iterative optimization, but consists only of a single model update step. when you want a full iterative approach, it's mainly up to you to implement it. the SPECFEM packages are focussing on the forward/adjoint problem, not on (non-linear) optimization procedures. that would be a different field, with many research options of its own. this model update tool here is mostly meant as an example of how things could look - thus, provides you only with the basic bricks, you put the mortar around to build your own wall.

note that steepest descent is really just the most basic approach for an iterative inversion procedure, faster convergence rates can be achieved by more sophisticated methods like conjugate gradient, L-BFGS and others. anyway, if you want to use it, use it in an iterative way, compute your kernels, update the model, re-compute kernels, update the model again and so on until either your kernels are zero or you run out of compute time :)

Thanks again for your help and patience. I know I have to use it in an iterative way. When I did the first iteration, the scaled gradient I got is about 10e-3, and the velocity of the model changed about 0.05m/s. What confused me is that the value of misfit function is relatively large, so I had expected a larger gradient and update of the model. Is this the normal convergence rate for the steepest descent method or I may have made some mistakes in computing the kernels? Here is the output information of the program :

initial models: vp min/max : 4569.47998 8421.29004
vs min/max : 2679.72852 4633.68604
rho min/max: 2232.23364 3464.81226

initial kernels: alpha min/max : -5.79186308E-12 3.58668065E-12 beta min/max : -2.25551904E-11 2.54527944E-11 rho min/max : -7.44321271E-12 8.39942265E-12

initial gradient: a min/max : -3.58668065E-12 5.79186308E-12 beta min/max: -2.54527944E-11 2.25551904E-11 rho min/max : -8.39942265E-12 7.44321271E-12

step length: using kernel maximum: 2.54527944E-11 step length value : 1.17865254E+09

norm model updates: a : 1.46825263E-09 beta: 1.30278712E-08 rho : 4.29925295E-09

scaled gradient: a min/max : -4.22745012E-03 6.82659401E-03 beta min/max: -3.00000012E-02 2.65847333E-02 rho min/max : -9.90000088E-03 8.77296180E-03

new models: vp min/max : 4569.42334 8421.41699
vs min/max : 2663.88306 4632.94385
rho min/max: 2230.57593 3464.09814


statistics:


integral kernels: a : -820.321716
beta: -4136.32520
rho : -1365.05457

total volume: 4.20159385E+16

norm kernels: a : 1.46825263E-09 beta: 1.30278712E-08 rho : 4.29925295E-09

root-mean square of perturbations: vp : 2.89439224E-04 vs : 2.66015017E-03 rho: 8.77844635E-04

danielpeter commented 4 years ago

how do you choose the step length?

you can try a step length test, update the model with different percentages, recompute seismograms for each and re-evaluate the misfits. then plot misfit vs. step length to have a visual. if the misfit isn't decreasing with short step lengths, then something with your kernels is wrong.

jjeeffff commented 4 years ago

how do you choose the step length?

you can try a step length test, update the model with different percentages, recompute seismograms for each and re-evaluate the misfits. then plot misfit vs. step length to have a visual. if the misfit isn't decreasing with short step lengths, then something with your kernels is wrong.

I'll try these tips. Thank you very much.