👨🎓个人主页:研学社的博客
💥💥💞💞欢迎来到本博客❤️❤️💥💥
🏆博主优势:🌞🌞🌞博客内容尽量做到思维缜密,逻辑清晰,为了方便读者。
⛳️座右铭:行百里者,半于九十。
📋📋📋本文目录如下:🎁🎁🎁
目录
💥1 概述
本文基于基于Bender进行光线追踪研究。追踪从源到接收器的光线(两者都在速度模型中:矩阵)。这是通过“弯曲”初始线性射线直到传播时间最短来完成的(费马原理)。它非常严格,因此它可以自行重建屈光和临界屈光(如果条件给定)。
读取输入参数并运行 GetModels 函数来设置光线追踪器的所有内容。然后 RayBender 函数运行,直到行程时间最小化。
参数:
模型.txt:输入文件中的速度模型。这必须与 Bender2D.m 位于同一目录中 来源:(x,z) 源的位置(接受 0) 接收器:接收器的 (x,z) 位置(接受 0) dx=10:模型在 X 方向上的像元大小 dz=5:模型在 Z 方向上的像元大小 dray=0.025:dz向上和向下弯曲光线的百分比。较小的值可提高准确性,但会使代码变慢。 dr=20:射线上的节点数。较大的值可提高准确性,但会使代码变慢。
📚2 运行结果
部分代码:
SOURCE = [10 45]; %Source Position
RECEIVER = [80 0]; %Receiver Position
% Model Differentials
dx=10; %Delta X
dz=5; %Delta Z
dray=0.025; % Porcentage to change ray
dr=20; %Node in ray
%% Creat the models needed for the computation
[iModelX,iModelZ,iModelS,xmin,xmax,zmin,zmax,F] = GetModels(Model,dx,dz);
%% Bend ray
[ray0,T0] = RayBender(SOURCE,RECEIVER,dz,dray,dr,F); % Call the ray bender function
%% Figures
h=pcolor(iModelX',iModelZ',Model);
set(gca,'Ydir','reverse')
set(h, 'EdgeColor', 'none');
colormap(flipud(jet))
colorbar
xlim([xmin xmax])
ylim([zmin zmax])
hold on
plot(SOURCE(1),SOURCE(2),'ok','MarkerFaceColor','r','MarkerSize',7.5)
plot(RECEIVER(1),RECEIVER(2),'vk','MarkerFaceColor','w','MarkerSize',7.5)
plot(ray0(:,1),ray0(:,2),'-k','LineWidth', 0.5)
%% FUNCTIONS
%% FIX INPUT DATA
function [iModelX,iModelZ,iModelS,xmin,xmax,zmin,zmax,F] = GetModels(Model,dx,dz)
% Slowness Model
ModelS=1./Model;% Compute slowness
% Coodinates
vx=0:dx:(size(Model,2)-1)*dx; % Vector of X coordinates
vz=(0:dz:(size(Model,1)-1)*dz)'; % Vector of Z coordinates
ModelX=repmat(vx,size(Model,1),1); % Matrix of X coordinates
ModelZ=repmat(vz,1,size(Model,2)); % Matriz of Z coordinates
%Transposed matrix for later
iModelS=ModelS';
iModelX=ModelX';
iModelZ=ModelZ';
zmax=max(vz); % Z max
zmin=min(vz); % Z min
xmax=max(vx); % X max
xmin=min(vx); % X min
F=griddedInterpolant(iModelX,iModelZ,iModelS); % Grid data
end
%% RAY BENDER: Pseudobending method for fast ray tracing
function [ray0,T0] = RayBender(SOURCE,RECEIVER,dz,dray,dr,F)
%RayBender Bend the Ray Paths little by little
%Initial linear ray
ray0=[SOURCE(1):(RECEIVER(1)-SOURCE(1))/dr:RECEIVER(1);SOURCE(2):(RECEIVER(2)-SOURCE(2))/dr:RECEIVER(2)]';
% Time of initial ray
T0=GetTime(ray0,F); %T
movedz=dz*dray;
NCC=0;
while NCC<dr-1
NCC=0;
for j=2:dr
%Bend a point of the ray up and down
%Also get the travel time of each test
rayz1(:,1)=[ray0(1:j-1,2); ray0(j,2)+movedz; ray0(j+1:end,2)];
%rayz1(rayz1>zmax)=zmax;
%rayz1(rayz1<zmin)=zmin;
T1=GetTime([ray0(:,1) rayz1],F);
rayz2(:,1)=[ray0(1:j-1,2); ray0(j,2)-movedz; ray0(j+1:end,2)];
%rayz2(rayz2>zmax)=zmax;
%rayz2(rayz2<zmin)=zmin;
T2=GetTime([ray0(:,1) rayz2],F);
if T1<T0 && T1<T2 % If RAY 1 is the solution
ray0=[ray0(:,1) rayz1];
T0=T1;
elseif T2<T0 && T2<T1 % If RAY 2 is the solution
ray0=[ray0(:,1) rayz1];
T0=T2;
else
NCC=NCC+1; % Keep Count of NO CHANGES
end
end
end
end
🎉3 参考文献
部分理论来源于网络,如有侵权请联系删除。
[1]闫润,黄立波,郭辉,王永鑫,张鑫铖,张鸿儒.实时光线追踪相关研究综述[J].计算机科学与探索,2023,17(02):263-278.