-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
342 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
# from mpi4py.MPI import COMM_WORLD | ||
# import debugpy | ||
# debugpy.listen(3000 + COMM_WORLD.rank) | ||
# debugpy.wait_for_client() | ||
import spyro | ||
import numpy as np | ||
import math | ||
|
||
|
||
def run_forward(dt): | ||
# dt = float(sys.argv[1]) | ||
|
||
final_time = 1.0 | ||
|
||
dictionary = {} | ||
dictionary["options"] = { | ||
"cell_type": "Q", # simplexes such as triangles or tetrahedra (T) or quadrilaterals (Q) | ||
"variant": "lumped", # lumped, equispaced or DG, default is lumped "method":"MLT", # (MLT/spectral_quadrilateral/DG_triangle/DG_quadrilateral) You can either specify a cell_type+variant or a method | ||
"degree": 4, # p order | ||
"dimension": 2, # dimension | ||
} | ||
|
||
# Number of cores for the shot. For simplicity, we keep things serial. | ||
# spyro however supports both spatial parallelism and "shot" parallelism. | ||
dictionary["parallelism"] = { | ||
"type": "custom", # options: automatic (same number of cores for evey processor) or spatial | ||
"seperate_shots" : True, | ||
"shots_per_core": [[0, 1]], | ||
} | ||
|
||
# Define the domain size without the PML. Here we'll assume a 1.00 x 1.00 km | ||
# domain and reserve the remaining 250 m for the Perfectly Matched Layer (PML) to absorb | ||
# outgoing waves on three sides (eg., -z, +-x sides) of the domain. | ||
dictionary["mesh"] = { | ||
"Lz": 2.0, # depth in km - always positive # Como ver isso sem ler a malha? | ||
"Lx": 2.0, # width in km - always positive | ||
"Ly": 0.0, # thickness in km - always positive | ||
"mesh_file": None, | ||
"mesh_type": "firedrake_mesh", | ||
} | ||
dictionary["acquisition"] = { | ||
"source_type": "ricker", | ||
"source_locations": spyro.create_transect((-0.55, 0.7), (-0.55, 1.3), 2), | ||
"frequency": 5.0, | ||
"delay": 0.2, | ||
"delay_type": "time", | ||
"receiver_locations": spyro.create_transect((-1.45, 0.7), (-1.45, 1.3), 200), | ||
} | ||
|
||
# Simulate for 2.0 seconds. | ||
dictionary["time_axis"] = { | ||
"initial_time": 0.0, # Initial time for event | ||
"final_time": final_time, # Final time for event | ||
"dt": dt, # timestep size | ||
"amplitude": 1, # the Ricker has an amplitude of 1. | ||
"output_frequency": 100, # how frequently to output solution to pvds | ||
"gradient_sampling_frequency": 100, # how frequently to save solution to RAM | ||
} | ||
|
||
dictionary["visualization"] = { | ||
"forward_output": True, | ||
"forward_output_filename": "results/forward_output.pvd", | ||
"fwi_velocity_model_output": False, | ||
"velocity_model_filename": None, | ||
"gradient_output": False, | ||
"gradient_filename": None, | ||
} | ||
|
||
Wave_obj = spyro.AcousticWave(dictionary=dictionary) | ||
Wave_obj.set_mesh(mesh_parameters={"dx": 0.02, "periodic": True}) | ||
|
||
Wave_obj.set_initial_velocity_model(constant=1.5) | ||
Wave_obj.forward_solve() | ||
|
||
rec_out = Wave_obj.receivers_output | ||
|
||
return rec_out | ||
|
||
|
||
if __name__ == "__main__": | ||
run_forward(0.0005) |
Oops, something went wrong.