Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

shot_record pdfs when running marmousi model #115

Open
acse-yw11823 opened this issue Jul 1, 2024 · 5 comments
Open

shot_record pdfs when running marmousi model #115

acse-yw11823 opened this issue Jul 1, 2024 · 5 comments

Comments

@acse-yw11823
Copy link

Hello, I was successfully running the script located in the /paper folder named run_fwi_2d.py. However, I noticed that the output files in the shots folder are identical. For instance, shot_number_1.pdf is exactly the same as shot_number_30.pdf.

I am using MacOS and executing the script in the terminal with the command python run_fwi_2d.py. Does anyone know why this might be happening? I would really appreciate any insight.

The code is the following:

import os
os.environ["OMP_NUM_THREADS"] = "1"

from firedrake import File
import spyro

model = {}

model["opts"] = {
    "method": "KMV",  # either CG or KMV
    "quadrature": "KMV",  # Equi or KMV
    "degree": 5,  # p order
    "dimension": 2,  # dimension
}
model["parallelism"] = {
    "type": "automatic",
}
model["mesh"] = {
    "Lz": 3.5,  # depth in km - always positive
    "Lx": 17.0,  # width in km - always positive
    "Ly": 0.0,  # thickness in km - always positive
    "meshfile": "meshes/marmousi_exact.msh",
    "initmodel": "not_used.hdf5",
    "truemodel": "velocity_models/marmousi_exact.hdf5",
}
model["BCs"] = {
    "status": True,  # True or false
    "outer_bc": "non-reflective",  # None or non-reflective (outer boundary condition)
    "damping_type": "polynomial",  # polynomial, hyperbolic, shifted_hyperbolic
    "exponent": 2,  # damping layer has a exponent variation
    "cmax": 4.5,  # maximum acoustic wave velocity in PML - km/s
    "R": 1e-6,  # theoretical reflection coefficient
    "lz": 0.9,  # thickness of the PML in the z-direction (km) - always positive
    "lx": 0.9,  # thickness of the PML in the x-direction (km) - always positive
    "ly": 0.0,  # thickness of the PML in the y-direction (km) - always positive
}
model["acquisition"] = {
    "source_type": "Ricker",
    "num_sources": 40,
    "source_pos": spyro.create_transect((-0.01, 1.0), (-0.01, 15.0), 40),
    "frequency": 5.0,
    "delay": 1.0,
    "num_receivers": 500,
    "receiver_locations": spyro.create_transect((-0.10, 0.1), (-0.10, 17.0), 500),
}
model["timeaxis"] = {
    "t0": 0.0,  # Initial time for event
    "tf": 5.00,  # Final time for event
    "dt": 0.00025,
    "amplitude": 1,  # the Ricker has an amplitude of 1.
    "nspool": 100,  # how frequently to output solution to pvds
    "fspool": 99999,  # how frequently to save solution to RAM
}
comm = spyro.utils.mpi_init(model)
mesh, V = spyro.io.read_mesh(model, comm)
vp = spyro.io.interpolate(model, mesh, V, guess=False)
if comm.ensemble_comm.rank == 0:
    File("true_velocity.pvd", comm=comm.comm).write(vp)
sources = spyro.Sources(model, mesh, V, comm)
receivers = spyro.Receivers(model, mesh, V, comm)
wavelet = spyro.full_ricker_wavelet(
    dt=model["timeaxis"]["dt"],
    tf=model["timeaxis"]["tf"],
    freq=model["acquisition"]["frequency"],
)
p, p_r = spyro.solvers.forward(model, mesh, comm, vp, sources, wavelet, receivers)
spyro.plots.plot_shots(model, comm, p_r, vmin=-1e-3, vmax=1e-3)
spyro.io.save_shots(model, comm, p_r)

The shot_number_31.pdf is like the following:
Screenshot 2024-07-01 at 16 21 03
The shot_number_3.pdf is like the following:
Screenshot 2024-07-01 at 16 22 17

@Olender
Copy link
Collaborator

Olender commented Jul 3, 2024

Can you experiment changing vmin=-1e-3, vmax=1e-3 values? Look at the max and minimum value of p_r and set it for the pdf.

@acse-yw11823
Copy link
Author

acse-yw11823 commented Jul 3, 2024 via email

@acse-yw11823
Copy link
Author

Hello,
I have implemented the method you suggested, adjusting the vmin and vmax parameters. However, I have not observed any significant changes in the visualization of the shot record. Additionally, I found that the data in shot_record_1.dat is identical to that in shot_record_11.dat. Could this issue be related to using serial execution instead of parallel?

Furthermore, there is no difference in the results even when I specify different source_num values in the forward function. For instance, both of the following calls yield the same results:

p, p_r_10 = spyro.solvers.forward(model, mesh, comm, vp, sources, wavelet, receivers, source_num = 10)

and thefollowing will give the same result

p, p_r_1 = spyro.solvers.forward(model, mesh, comm, vp, sources, wavelet, receivers, source_num = 1)

Do you have any idea about this result?
Many thanks for your time!!

@Olender
Copy link
Collaborator

Olender commented Jul 4, 2024

Could this issue be related to using serial execution instead of parallel?

Yes, currently we support using a number of cores that is a multiple of the number of sources (e.g., with 4 sources, you can use 4, 8, 16, 32, and so on). Each source is essentially a separate forward problem that utilizes spatial parallelism internally. We are also working on an enhancement (issue #105) to add the capability of running multiple shots in serial.

@acse-yw11823
Copy link
Author

acse-yw11823 commented Jul 4, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants