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 or not).
GNU General Public License v3.0
412 stars 229 forks source link

Removing the use of passing global variables as an argument, and use modules instead #1033

Closed EtienneBachmann closed 6 years ago

EtienneBachmann commented 7 years ago

Hi all,

I noticed that a lot of global variables (ie defined in the specfem_par module) are given as arguments to subfunctions. A better way should be to mimic the 2D code, by removing them from the subfunction arguments, and to define them with the module directly in the subfunction. This will:

I started to apply it in the routines of the files I added in my last commit. It is a long, but useful work!

Thanks, Best regards

Etienne

komatits commented 7 years ago

Hi Etienne,

That would be extremely useful. Daniel a few years ago started to do it and it really helped a lot, the code is much easier to write and to maintain since then. Good idea to move everything to modules.

Cheers, Dimitri.

On 06/08/2017 03:23 AM, EtienneBachmann wrote:

Hi all,

I noticed that a lot of global variables (ie defined in the specfem_par module) are given as arguments to subfunctions. A better way should be to mimic the 2D code, by removing them from the subfunction arguments, and to define them with the module directly in the subfunction. This will:

  • Reduce significantly the compilation time.
  • Reduce the length of the code.
  • Maybe remove the "internal error" that happens sometimes with the Intel compiler. I noticed it is often linked to the evaluation of the arguments of a function.

I started to apply it in the routines of the files I added in my last commit. It is a long, but useful work!

Thanks, Best regards

Etienne

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/geodynamics/specfem3d/issues/1033, or mute the thread https://github.com/notifications/unsubscribe-auth/AFjDKUKi5DrjrS0-HS6drEYqmqzq7bVDks5sB00igaJpZM4Nzd-F.

-- Dimitri Komatitsch, CNRS Research Director (DR CNRS) Laboratory of Mechanics and Acoustics, Marseille, France http://komatitsch.free.fr

komatits commented 6 years ago

Done I think. (Etienne has committed many changes)