Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 9

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Acoustic Wave Equation Solver

by: HENDERSON PINTO %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


%%%%%%%%%%%%%%%%%

clear
clc

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Defining Space and Time


Dimensions and Source Position %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
Depth = 6000; %%%%%%%% [Meters] %%%%%%%%
Offset = 12000; %%%%%%%% [Meters] %%%%%%%%
b = 1; %%%%%%%% [Seconds] %%%%%%%%
C = 3000; %%%%%%%% [Meters/Seconds] %%%%%%%%%
h = 60; %%%%%%%% Step size of the space [Meters]%%%
%%%%%%
k =(h/C)*sqrt((3/8)); %%%%%%%% Step size of the time [Seconds]%%%%%%%%%

r = (C.*k)/h; %%%%%%%% Stability Parameter %%%%%%%%

SourceOffset = 5000; %%%%%%%% Source position Offset %%%%%%%%


SourceDepth = 40; %%%%%%%% Source position Depth %%%%%%%%
GridSourceOffset = round((SourceOffset)/h); %%%%%%%% Grid position for
source in offset %%%%%%%%%
GridSourceDepth = round((SourceDepth)/h) ; %%%%%%%% Grid position for
source in depth %%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Defining Space and Time Grid


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

GridOffset = (Offset/h)+1; %%%%%%%% Number of grid points in offset %%


%%%%%%%
GridDepth = (Depth/h)+1; %%%%%%%% Number of grid points in depth %%
%%%%%%%
GridTime = (b/k)+1; %%%%%%%% Number of grid points in time %%
%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Defining Seismic Source =


Ricker Wavelet %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SpaceDomainOffset= linspace(-0.05,0.05,40);
SpaceDomainDepth = linspace(-0.05,0.05,40);
Wavelet_Frequency=50;
[O,D] = meshgrid(SpaceDomainOffset,SpaceDomainDepth);
t = O.^2+D.^2;
Ricker_Wavelet = (1 - 2*pi^2*Wavelet_Frequency^2*t).*exp(-
pi^2*Wavelet_Frequency^2*t);
surf(O,D,Ricker_Wavelet)
title('Ricker Wavelet')
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Defining Velocity Model %%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%% Homogeneous Velocity Model %%%%%%%%%%%%%%%%%


% C=ones(101,201);
% C=3000*C;

%%%%%%%%%%%%%%%%%%%%% Low Velocity Model %%%%%%%%%%%%%%%%%


%
% V1=1000;
% V2=1000;
% V3=1000;
% V4=1000;
% V5=2000;
% V6=3000;
%
%
% VModel=imread('LowVelocityLayer201_101','bmp');
% image(VModel)
% [y,x,z]=size(VModel);
% C=zeros(y,x); %%%%%%%%%%% Pre-Allocating the velocity
field %%%%%%%%%%%%%%%%%%%%%
%
% for i=1:y
% for j=1:x
% if VModel(i,j)==15 %%%%%%%% White %%%%%%%%%
% C(i,j,1)=V1;
% end
% if VModel(i,j)==11 %%%%%%%% Yellow %%%%%%%%%
% C(i,j)=V2;
% end
% if VModel(i,j)==9 %%%%%%%% Red %%%%%%%%%
% C(i,j)=V3;
% end
% if VModel(i,j)==12 %%%%%%%% Blue %%%%%%%%%
% C(i,j)=V4;
% end
% if VModel(i,j)==7 %%%%%%%% Grey %%%%%%%%%
% C(i,j)=V5;
% end
% if VModel(i,j)==0 %%%%%%%% Black %%%%%%%%%
% C(i,j)=V6;
% end
% end
% end

%
% %%%%%%%%%%%%%%%%%%%%% High Velocity Model %%%%%%%%%%%%%%%%%
%
% V1=1000;
% V2=1000;
% V3=1000;
% V4=1000;
% V5=1000;
% V6=3000;
%
%
% VModel=imread('HighVelocityLayer201_101','bmp');
% image(VModel)
% [y,x,z]=size(VModel);
% C=zeros(y,x); %%%%%%%%%%% Pre-Allocating the velocity
field %%%%%%%%%%%%%%%%%%%%%
%
% for i=1:y
% for j=1:x
% if VModel(i,j)==15 %%%%%%%% White %%%%%%%%%
% C(i,j,1)=V1;
% end
% if VModel(i,j)==11 %%%%%%%% Yellow %%%%%%%%%
% C(i,j)=V2;
% end
% if VModel(i,j)==9 %%%%%%%% Red %%%%%%%%%
% C(i,j)=V3;
% end
% if VModel(i,j)==12 %%%%%%%% Blue %%%%%%%%%
% C(i,j)=V4;
% end
% if VModel(i,j)==7 %%%%%%%% Grey %%%%%%%%%
% C(i,j)=V5;
% end
% if VModel(i,j)==0 %%%%%%%% Black %%%%%%%%%
% C(i,j)=V6;
% end
% end
% end
%
%
%

% %%%%%%%%%%%%%%%%%%%%% Salt Dome %%%%%%%%%%%%%%%%%

V1=1000;
V2=1000;
V3=1000;
V4=1000;
V5=2000;
V6=3000;

VModel=imread('SaltDome3_101_201','bmp');
image(VModel)
[y,x,z]=size(VModel);
C=zeros(y,x); %%%%%%%%%%% Pre-Allocating the velocity
field %%%%%%%%%%%%%%%%%%%%%

for i=1:y
for j=1:x
if VModel(i,j)==15 %%%%%%%% White %%%%%%%%%
C(i,j,1)=V1;
end
if VModel(i,j)==11 %%%%%%%% Yellow %%%%%%%%%
C(i,j)=V2;
end
if VModel(i,j)==9 %%%%%%%% Red %%%%%%%%%
C(i,j)=V3;
end
if VModel(i,j)==12 %%%%%%%% Blue %%%%%%%%%
C(i,j)=V4;
end
if VModel(i,j)==7 %%%%%%%% Grey %%%%%%%%%
C(i,j)=V5;
end
if VModel(i,j)==0 %%%%%%%% Black %%%%%%%%%
C(i,j)=V6;
end
end
end
%

% %%%%%%%%%%%%%%%%%%%%% Barent Sea Velocity Model %%%%%%%%%%%%%%%%%


%
% V1=1000;
% V2=1000;
% V3=1500;
% V4=2000;
% V5=2500;
% V6=3000;
%
%
% VModel=imread('BarentSea16_201x101','bmp');
% image(VModel)
% [y,x,z]=size(VModel);
% C=zeros(y,x); %%%%%%%%%%% Pre-Allocating the velocity
field %%%%%%%%%%%%%%%%%%%%%
%
% for i=1:y
% for j=1:x
% if VModel(i,j)==15 %%%%%%%% White %%%%%%%%%
% C(i,j,1)=V1;
% end
% if VModel(i,j)==11 %%%%%%%% Yellow %%%%%%%%%
% C(i,j)=V2;
% end
% if VModel(i,j)==9 %%%%%%%% Red %%%%%%%%%
% C(i,j)=V3;
% end
% if VModel(i,j)==12 %%%%%%%% Blue %%%%%%%%%
% C(i,j)=V4;
% end
% if VModel(i,j)==7 %%%%%%%% Grey %%%%%%%%%
% C(i,j)=V5;
% end
% if VModel(i,j)==0 %%%%%%%% Black %%%%%%%%%
% C(i,j)=V6;
% end
% end
% end

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Defining Past Wave


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%

Past_Wave = zeros(GridDepth,GridOffset); %%%%%%%%%% Pre-


Allocating the Past-Wave %%%%%%%%%

for i =0:length(Ricker_Wavelet)-1
for j = 0:length(Ricker_Wavelet)-1

Past_Wave(GridSourceDepth+j,GridSourceOffset+i) =
Ricker_Wavelet(i+1,j+1);
end
end

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Definig Present Wave


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%

Present_Wave = zeros(GridDepth,GridOffset); %%%%%%%%%% Pre-


Allocating the present wave%%%%%%%%%

r = C.*k/h; %%%%%%%%%% Stability Verification %%%%%%%%%%


for i = 2:GridDepth-1
for j = 2:GridOffset-1

Present_Wave(i,j) = (1-2*r(i,j).^2).*Past_Wave(i,j) +
((r(i,j).^2)/2).*(Past_Wave(i+1,j)+Past_Wave(i-1,j)+ Past_Wave(i,j+1) +
Past_Wave(i,j-1));
end
end

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Defining Future Wave


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%

for t = 1:GridTime

Future_Wave = zeros(GridDepth,GridOffset); %%%%%%%%%% Pre-


Allocating the future wave %%%%%%%%%

r = C.*k/h; %%%%%%%%%% Stability Verification %%%%%%%%%%


for i = 3:GridDepth-2
for j = 3:GridOffset-2
Future_Wave(i,j)= (r(i,j).^2/12).*(- Present_Wave(i,j-2)+
16*Present_Wave(i,j-1) - 30*Present_Wave(i,j)+ 16*Present_Wave(i,j+1) -
Present_Wave(i,j+2) - Present_Wave(i-2,j)+ 16*Present_Wave(i-1,j) -
30*Present_Wave(i,j)+ 16*Present_Wave(i+1,j) -Present_Wave(i+2,j))+
2*Present_Wave(i,j) - Past_Wave(i,j);
%
end
end

Past_Wave = Present_Wave;
Present_Wave = Future_Wave;

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Defining geophones %%%%%%%%%


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Geophone(1,t)=Present_Wave(10,7);
Geophone2(1,t)=Present_Wave(10,12);
Geophone3(1,t)=Present_Wave(10,24);
Geophone4(1,t)=Present_Wave(10,36);
Geophone5(1,t)=Present_Wave(10,48);
Geophone6(1,t)=Present_Wave(10,60);
Geophone7(1,t)=Present_Wave(10,72);
Geophone8(1,t)=Present_Wave(10,84);
Geophone9(1,t)=Present_Wave(10,96);
Geophone10(1,t)=Present_Wave(10,108);
Geophone11(1,t)=Present_Wave(10,120);
Geophone12(1,t)=Present_Wave(10,132);
Geophone13(1,t)=Present_Wave(10,144);
Geophone14(1,t)=Present_Wave(10,156);
Geophone15(1,t)=Present_Wave(10,168);
Geophone16(1,t)=Present_Wave(10,170);
Geophone17(1,t)=Present_Wave(10,182);
Geophone18(1,t)=Present_Wave(10,194);

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Plotting the wave


solution %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% solution
[O,D] =
meshgrid(linspace(0,Offset,GridOffset),linspace(0,Depth,GridDepth));
surf(O,D,Future_Wave,'edgecolor','none')
% map = [0, 0, 0.3
% 0, 0, 0.4
% 0, 0, 0.5
% 0, 0, 0.6
% 0, 0, 0.8
% 0, 0, 1.0];
colormap winter
set(gca,'YDir','reverse');
shading interp
axis square
view(0,90);
title('Acoustive Wave Propagation')
xlabel('Offset [m]')
ylabel('Depth [m]')
drawnow ()

end

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Plotting Seismograms %%%%%%%%%%%%%%%%%


%
[p,tiempo]=size(Geophone);
tiempo=(1:tiempo);
tiempo=0.0122*tiempo;
figure (3)
subplot (3,1,1)
plot(tiempo,Geophone)
title('Seismograph 1 (Offset=600m)')
xlabel('Time [s]')
ylabel('Amplitude')
subplot (3,1,2)
xlim([0,2.5])

plot(tiempo,Geophone10)
title('Seismograph 2 (Offset=6000m)')
xlabel('Time [s]')
ylabel('Amplitude')
xlim([0,b])

subplot (3,1,3)
plot(tiempo,Geophone3)
title('Seismograph 3 (Offset=11400m)')
xlabel('Time [s]')
ylabel('Amplitude')
xlim([0,b])

%%%%%%%%%%%%%%%%%%%%%%%%%%%% Plotting the Shot Gather %%%%%%%%%%%%%%%%%%%


%
figure (4)
hold on
set (gca,'Ydir','reverse')
plot(Geophone9*8,tiempo)
plot((Geophone8*8-1),tiempo)
plot(Geophone7*8-2,tiempo)
plot(Geophone6*8-3,tiempo)
plot(Geophone5*8-4,tiempo)
plot(Geophone4*8-5,tiempo)
plot(Geophone3*8-6,tiempo)
plot(Geophone2*8-7,tiempo)
plot(Geophone*8-8,tiempo)
plot(Geophone10*8+1,tiempo)
plot(Geophone11*8+2,tiempo)
plot(Geophone12*8+3,tiempo)
plot(Geophone13*8+4,tiempo)
plot(Geophone14*8+5,tiempo)
plot(Geophone15*8+6,tiempo)
plot(Geophone16*8+7,tiempo)
plot(Geophone17*8+8,tiempo)
plot(Geophone18*8+9,tiempo)
title('Shot Gather')
xlabel('Receiver Station # [m]')
xlim([-8,10])
ylabel('Time [s]')
ylim([0,b])

REFERENCES

Alford, R. M., Kelly, K. R., and Boore, D. M. Accuracy of finite-difference modeling of acoustic
wave propagation: Geophysics, v. 39, no. 6, p. 834-842. 1974

Bates, C.C., T.F. Gaskell and RB. Price, 1982. Geophysics in the Affairs of Man, Oxford, 492pp.).

Chen Jing-Bo. A stability formula for Lax-Wendroff methods with fourth-order in time and general-
order in space for the scalar wave equation. 2011

Feynman Richard, Lectures in Physics, Volume 1, Chapter 47: Sound. The wave equation, Caltech
1963, 2006, 2013).

LeVeque, Randall J., 1955- Finite difference methods for ordinary and partial differential
equations: steady-state and time-dependent problems

Lines Laurence R., Rafael Slawinski, and Phillip R. Bording. A recipe for stability analysis of
finite-diference wave equations computations. CREWES Research Report, 10:6 p., 1998.).
Margrave Gary F. Numerical Methods of Exploration Seismology with algorithms in MATLAB.
Gary F. Department of Geology and Geophysics. The University of Calgary. July 11, 2003
Rezzolla Luciano. Numerical Methods for the Solution of Partial Differential Equations. Lecture
Notes for the COMPSTAR School on Computational Astrophysics, 8-13/02/10, Caen, France.
Albert Einstein Institute, Max-Planck-Institute for Gravitational Physics, Potsdam, Germany
September 28, 2011
Zakaria Ahmad, John Penrose , Frank Thomas and Xiuming Wang The Two Dimensional
Numerical Modeling Of Acoustic Wave Propagation in Shallow Water. Centre for Marine Science
and Technology, Curtin University of Technology. 2CSIRO Petroleum.

. Uk+1(i,j)= (r(i,j).^2/12).*(- Uk(i,j-2)+ 16*Uk(i,j-1) - 30*Uk(i,j)+


16*Uk(i,j+1) - Uk(i,j+2) - Uk(i-2,j)+ 16*Uk(i-1,j) - 30*Uk(i,j)+
16*Uk(i+1,j) -Uk(i+2,j))+ 2*Uk(i,j) – Uk-1(i,j);
%

Mathews John H., Kurtis D. Fink, "Numerical methods using matlab", fourth edition 2004,
Pearson..

You might also like