📄 writetobellhopfiles.m
字号:
function WriteToBellhopFiles(Obj, Freq, RMin, RMax, DeltaR, ZRx, ZSource, EnvFile, BellhopParams, 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 Kraken(c)
%FlpFile - pointer to .flp file used by Field
%Minimum horizontal phase speed (m/s) - uses the lowest shear or sound speed in the problem
Cpmin = GetMinSoundSpeed(Obj);
LambdaMin = Cpmin/Freq;
%Compute the maximum horizontal phase speed - from the maximum grazing angle at the source and the maximum sound speed in the
%water column
WaterLayer = GetWaterColumn(Obj);
CAcMax = GetMaxSoundSpeed(WaterLayer);
ThetaGMax = max(abs([BellhopParams.StartAngle BellhopParams.EndAngle]));
if ThetaGMax > 0.999*pi/2
ThetaGMax = 0.999*pi/2;
end
%Maximum horizontal phase speed (m/s).
Cpmax = CAcMax/cos(ThetaGMax);
Nsd = length(ZSource); %Number of source depths
%Receiver depths
Nrd = length(ZRx);
if RMax == RMin
NR = 1;
else
NR = round((RMax - RMin)/DeltaR) + 1; %Number of ranges
end
if BellhopParams.UseBathyFile
BottomOpt = 'FB';
else
BottomOpt = 'F';
end
SigmaBot = 0; %Bottom roughness (ignored)
%N2-linear interpolation of sound speed profile, vacuum top layer, attenuation in dB/wavelength, Thorpe volume attenuation formula
%(see bellhop.hlp for more info)
%OptionStr = '''NVT'''; %Worked with earlier version of Acoustic toolbox
OptionStr = '''NVWT''';
NLayers = 1;
%TitleStr = ['''' Title ', ' num2str(Freq) 'Hz'''];
TitleStr = ['''' Title ''''];
RunType = BellhopParams.RunType;
RunStr = ['''' RunType ''''];
StepSize = BellhopParams.StepSize * LambdaMin;
RBox = 1.01 * RMax;
ZBox = 1.01 * GetWaterDepth(Obj);
fprintf(EnvFile, '%s\n', TitleStr);
fprintf(EnvFile, '%f\n', Freq);
fprintf(EnvFile, '%d\n', 1); %Bellhop only uses the water column layer
fprintf(EnvFile, '%s\n', OptionStr);
%Output the water column layer only. The other layers are handled by way of the bottom reflection
%coefficient file which is computed by Bounce
WriteToEnvFile(WaterLayer, Freq, Cpmax, EnvFile, 0);
fprintf(EnvFile, '%s %f\n', BottomOpt, SigmaBot);
fprintf(EnvFile, '%d\n', Nsd); %f\n', Nsd, ZSource(1:Nsd)); %Source depths
fprintf(EnvFile, '%f ', ZSource(1:Nsd));
fprintf(EnvFile, '\n');
fprintf(EnvFile, '%d\n', Nrd); %Receiver depths
fprintf(EnvFile, '%f ', ZRx(1:Nrd));
fprintf(EnvFile, '\n');
fprintf(EnvFile, '%d\n%f %f /\n', NR, RMin/1000, RMax/1000); %Receiver ranges
fprintf(EnvFile, '%s\n', RunStr);
fprintf(EnvFile, '%d\n%f %f /\n', BellhopParams.NBeams, BellhopParams.StartAngle, BellhopParams.EndAngle);
fprintf(EnvFile, '%f %f %f\n', StepSize, ZBox, RBox/1000);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -