Data structures
Physical Parameter
Data structure for physical parameter array in JUDI. A PhysicalParameter
inherits from julia AbstractVector
JUDI.PhysicalParameter
— TypePhysicalParameter
n::NTuple{N, T}
d::NTuple{N, Tf}
o::NTuple{N, Tf}
data::Union{Array, Number}
PhysicalParameter structure for physical space parameter.
n
: number of gridpoints in (x,y,z) for 3D or (x,z) for 2D
d
: grid spacing in (x,y,z) or (x,z) (in meters)
o
: origin of coordinate system in (x,y,z) or (x,z) (in meters)
data
: the array of the parameter values of size n
Constructor
A PhysicalParameter
can be constructed in various ways but always require the origin o
and grid spacing d
that cannot be infered from the array.
PhysicalParameter(v::Array{T}, d, o) where `v` is an n-dimensional array and n=size(v)
PhysicalParameter(n, d, o; T=Float32) Creates a zero PhysicalParameter
PhysicalParameter(v::Array{T}, A::PhysicalParameter{T, N}) where {T<:Real, N} Creates a PhysicalParameter from the Array `v` with n, d, o from `A`
PhysicalParameter(v::Array{T, N}, n::NTuple{N, T}, d::NTuple{N, T}, o::Tuple) where `v` is a vector or nd-array that is reshaped into shape `n`
PhysicalParameter(v::T, n::NTuple{N, T}, d::NTuple{N, T}, o::Tuple) Creates a constant (single number) PhyicalParameter
Unless specified otherwise with the return_array
option in Options
, the result of a migration/FWIgradient(judiJacobian
, fwi_objective
, lsrtm_objective
) will be wrapped into a PhysicalParameter
. THis allow better handling of different model parts and a better representation of the dimensional array.
Model structure
Data structure for velocity models in JUDI.
JUDI.Model
— FunctionModel(n, d, o, m; epsilon=nothing, delta=nothing, theta=nothing,
phi=nothing, rho=nothing, qp=nothing, vs=nothing, nb=40)
The parameters n
, d
, o
and m
are mandatory, whith nb
and other physical parameters being optional input arguments.
where
m
: velocity model in slowness squared (s^2/km^2)
epsilon
: Epsilon thomsen parameter ( between -1 and 1)
delta
: Delta thomsen parameter ( between -1 and 1 and delta < epsilon)
theta
: Anisotopy dip in radian
phi
: Anisotropy asymuth in radian
rho
: density (g / m^3)
qp
: P-wave attenuation for visco-acoustic models
vs
: S-wave velocity for elastic models.
nb
: Number of ABC points
Accessible fields include all of the above parameters p.n, p.d, p.o, p.data
. Additionaly, arithmetic operation are all impemented such as addition, multiplication, broadcasting and indexing. Linear algebra operation are implemented as well but will return a standard Julia vector if the matrix used is external to JUDI.
Access fields:
Accessible fields include all of the above parameters, which can be accessed as follows:
# Access model
model.m
# Access number of grid points
model.n
Geometry structure
JUDI's geometry structure contains the information of either the source or the receiver geometry. Construct an (in-core) geometry object for either a source or receiver set up:
JUDI.Geometry
— TypeGeometryIC
xloc::Array{Array{T, 1},1}
yloc::Array{Array{T, 1},1}
zloc::Array{Array{T, 1},1}
t::Vector{StepRangeLen{T}}
Geometry structure for seismic sources or receivers. Each field is a cell array, where individual cell entries contain values or arrays with coordinates and sampling information for the corresponding shot position. The first three entries are in meters and the last three entries in milliseconds.
GeometryOOC{T} <: Geometry{T}
container::Array{SegyIO.SeisCon,1}
t::Vector{StepRangeLen{T}}
nrec::Array{Integer,1}
key::String
segy_depth_key::String
Constructors
Only pass dt
and n
and automatically set t
:
Geometry(xloc, yloc, zloc; dt=[], nt=[])
Pass single array as coordinates/parameters for all nsrc
experiments:
Geometry(xloc, yloc, zloc, dt=[], nt=[], nsrc=1)
Create geometry structure for either source or receivers from a SegyIO.SeisBlock object. segy_depth_key
is the SegyIO keyword that contains the depth coordinate and key
is set to either source
for source geometry or receiver
for receiver geometry:
Geometry(SeisBlock; key="source", segy_depth_key="")
Create geometry structure for from a SegyIO.SeisCon object (seismic data container):
Geometry(SeisCon; key="source", segy_depth_key="")
Examples
(1) Set up receiver geometry for 2D experiment with 4 source locations and 80 fixed receivers:
xrec = range(100,stop=900,length=80)
yrec = range(0,stop=0,length=80)
zrec = range(50,stop=50,length=80)
dt = 4f0
t = 1000f0
rec_geometry = Geometry(xrec, yrec, zrec; dt=dt, t=t, nsrc=4)
(2) Set up corresponding source geometry (coordinates can be of type linspace
or regular arrays):
xsrc = [200,400,600,800]
ysrc = [0,0,0,0]
zsrc = [50,50,50,50]
src_geometry = Geometry(xsrc, ysrc, zsrc; dt=dt, t=t, nsrc=4)
(3) Read source and receiver geometries from SEG-Y file:
using SegyIO
seis_block = segy_read("test_file.segy")
rec_geometry = Geometry(seis_block; key="receiver", segy_depth_key="RecGroupElevation")
src_geometry = Geometry(seis_block; key="source", segy_depth_key="SourceDepth")
Check the seis_block's header entries to findall out which keywords contain the depth coordinates. The source depth keyword is either SourceDepth
or SourceSurfaceElevation
. The receiver depth keyword is typically RecGroupElevation
.
(4) Read source and receiver geometries from out-of-core SEG-Y files (for large data sets). Returns an out-of-core geometry object GeometryOOC
without the source/receiver coordinates, but a lookup table instead:
using SegyIO
seis_container = segy_scan("/path/to/data/directory","filenames",["GroupX","GroupY","RecGroupElevation","SourceDepth","dt"])
rec_geometry = Geometry(seis_container; key="receiver", segy_depth_key="RecGroupElevation")
src_geometry = Geometry(seis_container; key="source", segy_depth_key="SourceDepth")
From the optional arguments, you have to pass (at least) two of dt
, nt
and t
. The third value is automatically determined and set from the two other values. a Geometry
can be constructed in a number of different ways for in-core and out-of-core cases. Check our examples and the source for additional details while the documentation is being extended.
Access fields:
Accessible fields include all of the above parameters, which can be accessed as follows:
# Access cell arrays of x coordinates:
geometry.xloc
# Access x coordinates of the i-th source location
geometry.xloc[i]
# Access j-th receiver location (in x) of the i-th source location
geometry.xloc[i][j]
Geometry utilities
A few utilities to manipulates geometries are provided as well.
JUDI.super_shot_geometry
— Functionsuper_shot_geometry(Geometry)
Merge all the sub-geometries 1:get_nsrc(Geometry)
into a single supershot geometry
JUDI.reciprocal_geom
— Functionreciprocal_geom(sourceGeom, recGeom)
Applies reciprocity to the par of geometries sourceGeom
and recGeom
where each source becomes a receiver and each receiver becomes a source.
This method expects:
- Both geometries to be In Core. If the geometries are OOC they will be converted to in core geometries
- The metadata to be compatible. In details all the time sampling rates (dt) and recording times (t) must be the same
- The source to be single point sources. This method will error if a simultaneous sources (multiple poisiton for a single source) are used.
Options structure
The options structure allows setting several modeling parameters.
JUDI.Options
— FunctionJUDIOptions
space_order::Integer
free_surface::Bool
limit_m::Bool
buffer_size::AbstractFloat
save_rate::AbstractFloat
save_data_to_disk::Bool
file_path::String
file_name::String
sum_padding::Bool
optimal_checkpointing::Bool
frequencies::Array
IC::String
subsampling_factor::Integer
dft_subsampling_factor::Integer
return_array::Bool
dt_comp::Real
f0::Real
Options structure for seismic modeling.
space_order
: finite difference space order for wave equation (default is 8, needs to be multiple of 4)
free_surface
: set to true
to enable a free surface boundary condition.
limit_m
: for 3D modeling, limit modeling domain to area with receivers (saves memory)
buffer_size
: if limit_m=true
, define buffer area on each side of modeling domain (in meters)
save_data_to_disk
: if true
, saves shot records as separate SEG-Y files
file_path
: path to directory where data is saved
file_name
: shot records will be saved as specified file name plus its source coordinates
sum_padding
: when removing the padding area of the gradient, sum into boundary rows/columns for true adjoints
optimal_checkpointing
: instead of saving the forward wavefield, recompute it using optimal checkpointing
frequencies
: calculate the FWI/LS-RTM gradient in the frequency domain for a given set of frequencies
subsampling_factor
: compute forward wavefield on a time axis that is reduced by a given factor (default is 1)
dft_subsampling_factor
: compute on-the-fly DFTs on a time axis that is reduced by a given factor (default is 1)
IC
: Imaging condition. Options are 'as, isic, fwi' with "as" for adjoint state, isic for the inverse scattering imaging condition and FWI for the complement of isic (i.e isic + fwi = as)
isic
: Inverse scattering imaging condition. Deprecated, use IC="isic"
instead.
return_array
: return data from nonlinear/linear modeling as a plain Julia array.
dt_comp
: overwrite automatically computed computational time step with this value.
f0
: define peak frequency.
Constructor
All arguments are optional keyword arguments with the following default values:
Options(;space_order=8, free_surface=false,
limit_m=false, buffer_size=1e3,
save_data_to_disk=false, file_path="",
file_name="shot", sum_padding=false,
optimal_checkpointing=false,
num_checkpoints=nothing, checkpoints_maxmem=nothing,
frequencies=[], isic=false,
subsampling_factor=1, dft_subsampling_factor=1, return_array=false,
dt_comp=nothing, f0=0.015f0)
notes
Option
has been renamed JUDIOptions
as of JUDI version 4.0
to avoid potential (and exisiting) conflicts wiht other packages exporting an Options structure.