⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 writetoscooterfiles.m

📁 水声模型 很不错的东西
💻 M
字号:
function WriteToScooterFiles(Obj, Freq, RMin, RMax, DeltaR,  ZRx,  ZSource, EnvFile, FlpFile, Title)
%WriteToScootFiles(Obj, Freq, RMax, DeltaR,  ZRxMin, ZRxMax, DeltaZ, ZSource, EnvFile, FieldsFile)
%
%Outputs acoustic layer data to an environment file and a .flp for use by Scooter and Fields
%
%Freq - frequency (Hz)
%RMin - minimum receiver range (m)
%RMax - maximum receiver range (m)
%DeltaR - receiver range step (m)
%ZRx - vector of receiver depths (m)
%ZSource - source depth (m)
%EnvFile - pointer to environment file used by Scooter
%FlpFile - pointer to .flp file used by Fields


%Minimum horizontal phase speed (m/s)
%For scooter Cpmin is related to the range sample interval by DeltaR = Cpmin / Freq
Cpmin = Freq*DeltaR;

MinSpeed = GetMinSoundSpeed(Obj);

if Cpmin > 0.9*MinSpeed
   Cpmin = 0.9*MinSpeed;
end


%Maximum horizontal phase speed (m/s).
%Defines minimum grazing angle - use a very large value to include rays near normal incidence
Cpmax = 1e9;  

%Maximum range passed to Scooter - this has little to do with the receiver range but instead controls
%the wavenumber spacing.  Here we define it in terms of the number of wavenumber samples, which is
% specified by NK:
NK = 2000;
RMaxScoot = NK*DeltaR;
if RMaxScoot < 2*RMax
   RMaxScoot = 2*RMax;
end

Nsd = length(ZSource);  %Number of source depths

%Receiver depths
Nrd = length(ZRx);

%Linear interpolation of sound speed profile, vacuum top layer, attenuation in dB/wavelength
%(see kraken.hlp for more info)
OptionStr = '''NVW''';  
NLayers = length(Obj.LayerArr);   
         
         
%TitleStr = ['''' Title ', ' num2str(Freq) 'Hz'''];
TitleStr = ['''' Title ''''];
         
fprintf(EnvFile, '%s\n', TitleStr);
fprintf(EnvFile, '%f\n', Freq);
fprintf(EnvFile, '%d\n', NLayers-1);  %Bottom half-space isn't counted so subtract 1
fprintf(EnvFile, '%s\n', OptionStr);

%Output the layers in order of increasing depth - this is the order in which they are
%stored in the array
ZTop = 0;
for ILayer = 1:NLayers
   WriteToEnvFile(Obj.LayerArr{ILayer}, Freq, Cpmax, EnvFile, ZTop);
   ZTop = ZTop + GetLayerThickness(Obj.LayerArr{ILayer});
end

fprintf(EnvFile, '%f  %f\n', Cpmin, Cpmax);        
fprintf(EnvFile, '%f\n', RMaxScoot/1000);        

fprintf(EnvFile, '%d\n%f\n', Nsd, ZSource(1:Nsd)); 
fprintf(EnvFile, '%d\n', Nrd);
fprintf(EnvFile, '%f  ', ZRx(1:Nrd));
fprintf(EnvFile, '\n');

if ~isempty(FlpFile)
    %Now output the required information to the .flp file
    %Options for processing Scooter output with Fields
    %Cylindrical coords, linear output, integrate over +ve and -ve wavenumbers, polynomial interpolation
    %(see fields.hlp for more info)
    FieldOpt = '''RLBO'''; 
    
    if RMax == RMin
        NRange = 1;
    else
        NRange = round((RMax - RMin)/DeltaR) + 1;  %Number of ranges
    end
    
    fprintf(FlpFile, '%s\n', FieldOpt);
    fprintf(FlpFile, '%f  %f  %d\n', RMin/1000, RMax/1000, NRange);
end

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -