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

Calculated Hessian for the elastic example. It gives zero values #64

Closed
ADharaUTEXAS123007 opened this issue Oct 17, 2023 · 2 comments
Closed

Comments

@ADharaUTEXAS123007
Copy link

I calculated the full hessian (using the method : https://ausargeo.com/deepwave/example_hessian) for the model in elastic FWI example (https://ausargeo.com/deepwave/example_elastic). got zero values between vp and vs. Attaching plot of the hessian.

Screen Shot 2023-10-17 at 9 12 35 AM

Here is the code snippet
def wrap(vp,vs,rho):
out = deepwave.elastic(
*deepwave.common.vpvsrho_to_lambmubuoyancy(vp, vs, rho),
dx, dt,
source_amplitudes_y=source_amplitudes,
source_locations_y=source_locations,
receiver_locations_y=receiver_locations,
pml_freq=freq,
)[-2]
return loss_fn(out, observed_data)

hess = torch.autograd.functional.hessian(wrap, (vp, vs, rho))

@ADharaUTEXAS123007
Copy link
Author

Here is the complete code

ny = 100
nx = 100
dx = 4.0

vp_background = torch.ones(ny, nx, device=device) * 1500
vs_background = torch.ones(ny, nx, device=device) * 1000
rho_background = torch.ones(ny, nx, device=device) * 2200

vp_true = vp_background.clone()
vp_true[10:20, 30:40] = 1600
vs_true = vs_background.clone()
vs_true[10:20, 45:55] = 1100
rho_true = rho_background.clone()
rho_true[10:20, 60:70] = 2300

n_shots = 8

n_sources_per_shot = 1
d_source = 12
first_source = 8
source_depth = 2

n_receivers_per_shot = nx-1
d_receiver = 1
first_receiver = 0
receiver_depth = 2

freq = 15
nt = 200
dt = 0.004
peak_time = 1.5 / freq

source_locations

source_locations = torch.zeros(n_shots, n_sources_per_shot, 2,
dtype=torch.long, device=device)
source_locations[..., 0] = source_depth
source_locations[:, 0, 1] = (torch.arange(n_shots) * d_source +
first_source)

receiver_locations

receiver_locations = torch.zeros(n_shots, n_receivers_per_shot, 2,
dtype=torch.long, device=device)
receiver_locations[..., 0] = receiver_depth
receiver_locations[:, :, 1] = (
(torch.arange(n_receivers_per_shot) * d_receiver +
first_receiver)
.repeat(n_shots, 1)
)

source_amplitudes

source_amplitudes = (
(deepwave.wavelets.ricker(freq, nt, dt, peak_time))
.repeat(n_shots, n_sources_per_shot, 1).to(device)
)

def wrap(vp,vs,rho):
out = deepwave.elastic(
*deepwave.common.vpvsrho_to_lambmubuoyancy(vp, vs, rho),
dx, dt,
source_amplitudes_y=source_amplitudes,
source_locations_y=source_locations,
receiver_locations_y=receiver_locations,
pml_freq=freq,
)[-2]
return loss_fn(out, observed_data)

hess = torch.autograd.functional.hessian(wrap, (vp, vs, rho))

@ar4
Copy link
Owner

ar4 commented Oct 17, 2023 via email

@ar4 ar4 closed this as completed in 5386203 Oct 17, 2023
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