create_simple_tunnel_mod3D.m 5.84 KB
Newer Older
tilman.metz's avatar
tilman.metz committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199
%creates a binary formation model for 3D seismic modeling
close all;
clear all;
clc;

%general parameters
writefiles=1;%1=yes else=no
modname='tunneltest';
plotmodels=1;%1=yes else=no
grid_spacing=0.2;

%dimensions of base model
xmax_base=300;%gridpoints
ymax_base=400; %(vertical)
zmax_base=200;

%tunnel centered in y and z coordinate, parallel to x-axis 
diameter_tunnel=20; %"edge lenght" in grid points -> tunnel is not a tube but a rectangel
%change in material properties, i.e. fault zone
x_start_fault=150; % begin of new material, at fault zone in grid points
y_start_fault=50; % 
z_start_fault=1; % 

%velocity, density base model
vp_base=5700; %m/s
vs_base=3400;
rho_base=2200; %kg/m3

%velocity, density fault zone
vp_fault=4000.0; %m/s
vs_fault=2400.0;
rho_fault=1800.0; %g/cm3

%velocities, density tunnel (assuming vacuum)
vp_tunnel=0.0; %m/s
vs_tunnel=0.00001;
rho_tunnel=1.25; %kg/m3



%----------------VP model
%creating model
mod=(zeros(xmax_base,ymax_base,zmax_base));
%filling in base parmaters
mod(:,:)=vp_base;
%filling in fault parameters (i.e. change in material properties)
mod(x_start_fault:end,y_start_fault:end,z_start_fault:end)=vp_fault;
%filling in tunnel parameters
mod(1:xmax_base,...
    round(ymax_base/2)-round(diameter_tunnel/2):round(ymax_base/2)+round(diameter_tunnel/2),...
    round(zmax_base/2)-round(diameter_tunnel/2):round(zmax_base/2)+round(diameter_tunnel/2))=vp_tunnel;

%plot models
if plotmodels==1
   h1=figure(1);
   subplot(2,2,1);
   pcolor(grid_spacing:grid_spacing:zmax_base*grid_spacing,grid_spacing:grid_spacing:ymax_base*grid_spacing,squeeze(mod(xmax_base/2,:,:)));
   shading flat;
   colorbar
   title('vp-velocity Model (y-z-plain)');
   xlabel('z in m (horizontal)');
   ylabel('y in m (vertical)');
   axis equal tight;
   
   subplot(2,2,2);
   pcolor(grid_spacing:grid_spacing:xmax_base*grid_spacing,grid_spacing:grid_spacing:zmax_base*grid_spacing,squeeze(mod(:,ymax_base/2,:))');
   shading flat;
   colorbar
   title('vp-velocity Model (x-z-plain)');
   xlabel('x in m');
   ylabel('z in m (horizontal)');
   axis equal tight;
   
   subplot(2,2,3);
   pcolor(grid_spacing:grid_spacing:xmax_base*grid_spacing,grid_spacing:grid_spacing:ymax_base*grid_spacing,squeeze(mod(:,:,zmax_base/2))');
   shading flat;
   colorbar
   title('vp-velocity Model (x-y-plain)');
   xlabel('x in m');
   ylabel('y in m (vertical)');
   axis equal tight;
end

%write models to disk
if writefiles==1
    mod=permute(mod,[2 1 3]);
    fid_mod=fopen(strcat(modname,'.vp'),'w');
    fwrite(fid_mod,mod,'float');
    fclose(fid_mod);
end

clear mod;

%----------------VS model
%creating model
mod=(zeros(xmax_base,ymax_base,zmax_base));
%filling in base parmaters
mod(:,:)=vs_base;
%filling in fault parameters (i.e. change in material properties)
mod(x_start_fault:end,y_start_fault:end,z_start_fault:end)=vs_fault;
%filling in tunnel parameters
mod(1:xmax_base,...
    round(ymax_base/2)-round(diameter_tunnel/2):round(ymax_base/2)+round(diameter_tunnel/2),...
    round(zmax_base/2)-round(diameter_tunnel/2):round(zmax_base/2)+round(diameter_tunnel/2))=vs_tunnel;

%plot models
if plotmodels==1
   h2=figure(2);
   subplot(2,2,1);
   pcolor(grid_spacing:grid_spacing:zmax_base*grid_spacing,grid_spacing:grid_spacing:ymax_base*grid_spacing,squeeze(mod(xmax_base/2,:,:)));
   shading flat;
   colorbar
   title('vs-velocity Model (y-z-plain)');
   xlabel('z in m (horizontal)');
   ylabel('y in m (vertical)');
   axis equal tight;
   
   subplot(2,2,2);
   pcolor(grid_spacing:grid_spacing:xmax_base*grid_spacing,grid_spacing:grid_spacing:zmax_base*grid_spacing,squeeze(mod(:,ymax_base/2,:))');
   shading flat;
   colorbar
   title('vs-velocity Model (x-z-plain)');
   xlabel('x in m');
   ylabel('z in m (horizontal)');
   axis equal tight;
   
   subplot(2,2,3);
   pcolor(grid_spacing:grid_spacing:xmax_base*grid_spacing,grid_spacing:grid_spacing:ymax_base*grid_spacing,squeeze(mod(:,:,zmax_base/2))');
   shading flat;
   colorbar
   title('vs-velocity Model (x-y-plain)');
   xlabel('x in m');
   ylabel('y in m (vertical)');
   axis equal tight;
end

%write models to disk
if writefiles==1
    mod=permute(mod,[2 1 3]);
    fid_mod=fopen(strcat(modname,'.vs'),'w');
    fwrite(fid_mod,mod,'float');
    fclose(fid_mod);
end

clear mod;

%----------------Rho model
%creating model
mod=(zeros(xmax_base,ymax_base,zmax_base));
%filling in base parmaters
mod(:,:)=rho_base;
%filling in fault parameters (i.e. change in material properties)
mod(x_start_fault:end,y_start_fault:end,z_start_fault:end)=rho_fault;
%filling in tunnel parameters
mod(1:xmax_base,...
    round(ymax_base/2)-round(diameter_tunnel/2):round(ymax_base/2)+round(diameter_tunnel/2),...
    round(zmax_base/2)-round(diameter_tunnel/2):round(zmax_base/2)+round(diameter_tunnel/2))=rho_tunnel;

%plot models
if plotmodels==1
   h3=figure(3);
   subplot(2,2,1);
   pcolor(grid_spacing:grid_spacing:zmax_base*grid_spacing,grid_spacing:grid_spacing:ymax_base*grid_spacing,squeeze(mod(xmax_base/2,:,:)));
   shading flat;
   colorbar
   title('Density Model (y-z-plain)');
   xlabel('z in m (horizontal)');
   ylabel('y in m (vertical)');
   axis equal tight;
   
   subplot(2,2,2);
   pcolor(grid_spacing:grid_spacing:xmax_base*grid_spacing,grid_spacing:grid_spacing:zmax_base*grid_spacing,squeeze(mod(:,ymax_base/2,:))');
   shading flat;
   colorbar
   title('Density Model (x-z-plain)');
   xlabel('x in m');
   ylabel('z in m (horizontal)');
   axis equal tight;
   
   subplot(2,2,3);
   pcolor(grid_spacing:grid_spacing:xmax_base*grid_spacing,grid_spacing:grid_spacing:ymax_base*grid_spacing,squeeze(mod(:,:,zmax_base/2))');
   shading flat;
   colorbar
   title('Density Model (x-y-plain)');
   xlabel('x in m');
   ylabel('y in m (vertical)');
   axis equal tight;
end

%write models to disk
if writefiles==1
    mod=permute(mod,[2 1 3]);
    fid_mod=fopen(strcat(modname,'.rho'),'w');
    fwrite(fid_mod,mod,'float');
    fclose(fid_mod);
end

clear mod;