initial upload
This commit is contained in:
70
utils/checkerboard/GenerateTrueGam.m
Normal file
70
utils/checkerboard/GenerateTrueGam.m
Normal file
@@ -0,0 +1,70 @@
|
||||
% generate true and initial models for checkerboard test
|
||||
|
||||
depth=[0.0 5.0 10.0 15.0 20.0 25.0 30.0 35.0 40.0 45.0 50.0 55.0 60.0 70.0 80.0 90.0 100.0 120.0];
|
||||
nLat=12;
|
||||
nLon=19;
|
||||
grid=2;
|
||||
anorm=0.06;
|
||||
gam=1.0;
|
||||
|
||||
anormP=(2+anorm)/(2-anorm);
|
||||
anormN=(2-anorm)/(2+anorm);
|
||||
|
||||
% second horizontal interpolation
|
||||
gamTrue= zeros(nLat,nLon,length(depth));
|
||||
for idepth=1:length(depth)
|
||||
gamTrue(:,:,idepth)=gam;
|
||||
end
|
||||
|
||||
perb=zeros(nLat,nLon);
|
||||
[iy,ix]=meshgrid(round([1:nLat]/grid),round([1:nLon]/grid));
|
||||
perb=(-1).^round((ix+iy));
|
||||
|
||||
for i=1:nLon
|
||||
for j=1:nLat
|
||||
if perb(i,j)>0
|
||||
perb(i,j)=anormP;
|
||||
else
|
||||
perb(i,j)=anormN;
|
||||
end
|
||||
end
|
||||
end
|
||||
for idepth=1:length(depth)
|
||||
gamTrue(:,:,idepth)=perb';
|
||||
end
|
||||
|
||||
% output MOD.true.gam
|
||||
MODtrue=fopen('MOD.true.gam','w');
|
||||
|
||||
for iz=1:length(depth)
|
||||
for iy=1:nLon
|
||||
for ix=1:nLat
|
||||
fprintf(MODtrue,'%8.4f',gamTrue(ix,iy,iz));
|
||||
end
|
||||
fprintf(MODtrue,'\n');
|
||||
end
|
||||
end
|
||||
fclose(MODtrue);
|
||||
|
||||
% output MOD.gam
|
||||
MODinit=fopen('MOD.gam','w');
|
||||
|
||||
for i=1:length(depth)
|
||||
fprintf(MODinit,'%6.1f',depth(i));
|
||||
end
|
||||
fprintf(MODinit,'\n');
|
||||
|
||||
for iz=1:length(depth)
|
||||
for iy=1:nLon
|
||||
for ix=1:nLat
|
||||
fprintf(MODinit,'%8.3f',gam);
|
||||
end
|
||||
fprintf(MODinit,'\n');
|
||||
end
|
||||
end
|
||||
fclose(MODinit);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
60
utils/checkerboard/GenerateTrueVsv.m
Normal file
60
utils/checkerboard/GenerateTrueVsv.m
Normal file
@@ -0,0 +1,60 @@
|
||||
% generate true Vsv model and initial model for checkerboard test
|
||||
|
||||
depth=[0.0 5.0 10.0 15.0 20.0 25.0 30.0 35.0 40.0 45.0 50.0 55.0 60.0 70.0 80.0 90.0 100.0 120.0];
|
||||
nLat=12;
|
||||
nLon=19;
|
||||
grid=2;
|
||||
anorm=-0.04;
|
||||
|
||||
%vel=4.0;
|
||||
|
||||
% second horizontal interpolation
|
||||
mod1d=load('mod.1d');
|
||||
velTrue= zeros(nLat,nLon,length(depth));
|
||||
for idepth=1:length(depth)
|
||||
velTrue(:,:,idepth)=mod1d(idepth);
|
||||
end
|
||||
|
||||
perb=zeros(nLat,nLon);
|
||||
[iy,ix]=meshgrid(round([1:nLat]/grid),round([1:nLon]/grid));
|
||||
perb=(-1).^round((ix+iy));
|
||||
|
||||
for idepth=1:length(depth)
|
||||
VelTrue(:,:,idepth)=velTrue(:,:,idepth)+perb'*anorm*mod1d(idepth);
|
||||
end
|
||||
|
||||
% output MOD.true.Vsv
|
||||
MODtrue=fopen('MOD.true.Vsv','w');
|
||||
|
||||
for iz=1:length(depth)
|
||||
for iy=1:nLon
|
||||
for ix=1:nLat
|
||||
fprintf(MODtrue,'%8.3f',VelTrue(ix,iy,iz));
|
||||
end
|
||||
fprintf(MODtrue,'\n');
|
||||
end
|
||||
end
|
||||
fclose(MODtrue);
|
||||
|
||||
% output MOD.Vsv
|
||||
MODinit=fopen('MOD.Vsv','w');
|
||||
|
||||
for i=1:length(depth)
|
||||
fprintf(MODinit,'%6.1f',depth(i));
|
||||
end
|
||||
fprintf(MODinit,'\n');
|
||||
|
||||
for iz=1:length(depth)
|
||||
for iy=1:nLon
|
||||
for ix=1:nLat
|
||||
fprintf(MODinit,'%8.3f',mod1d(iz));
|
||||
end
|
||||
fprintf(MODinit,'\n');
|
||||
end
|
||||
end
|
||||
fclose(MODinit);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
18
utils/checkerboard/mod.1d
Normal file
18
utils/checkerboard/mod.1d
Normal file
@@ -0,0 +1,18 @@
|
||||
2.393
|
||||
3.367
|
||||
3.412
|
||||
3.411
|
||||
3.398
|
||||
3.397
|
||||
3.416
|
||||
3.452
|
||||
3.505
|
||||
3.581
|
||||
3.689
|
||||
3.827
|
||||
4.019
|
||||
4.389
|
||||
4.456
|
||||
4.470
|
||||
4.475
|
||||
4.482
|
||||
Reference in New Issue
Block a user