72 行
2.9 KiB
Python
可执行文件
72 行
2.9 KiB
Python
可执行文件
from ramRW import PosRAM, PROF, SSPRAM, write_env_RAM, readTL_RAM
|
|
from os import system
|
|
import numpy as np
|
|
from config import AtBinPath
|
|
|
|
def call_ram(freq, sd, rd, bathm, ssp, sed):
|
|
''' ********************************************************************************* '''
|
|
''' ************************** Sound Field Calculation ****************************** '''
|
|
''' ********************************************************************************* '''
|
|
title = "Waveguide"
|
|
# Source and receiving position
|
|
bathm.r = bathm.r * 1000 # km -> m
|
|
rmax = max(bathm.r) # Maximum receiving range (unit: m)
|
|
zmax = round(max(bathm.d) * 2) # Maximum receiving depth (uint: m)
|
|
zmplt = round(max(bathm.d)*1.1) # Maximum depth of plot (uint: m)
|
|
dz = 1500 / freq / 15 # Step in depth direction: wavelength / 15
|
|
dr = 10 * dz # Step in range direction
|
|
pos = PosRAM(sd, rd, rmax, zmax, dr, dz, zmplt)
|
|
|
|
# Sound speed profile for RAM
|
|
ssp_ram = []
|
|
for it in range(len(ssp)):
|
|
rp = bathm.r[it] # Range of this profile
|
|
Z = sed[it].z
|
|
cw_p = PROF(ssp[it].z, ssp[it].c) # Water sound speed profile
|
|
cb_p = PROF(Z, sed[it].cp) # Bottom sound speed profile
|
|
rhob_p = PROF(Z, sed[it].rho) # Sea bottom density profile
|
|
Z = np.append(Z, Z[-1] + 100)
|
|
Ap = np.append(sed[it].a_p, 10)
|
|
# Ap = sed[it].a_p
|
|
attn_p = PROF(Z, Ap) # Sea bottom attenuation profile
|
|
|
|
ssp_ram.append(SSPRAM(rp, cw_p, cb_p, rhob_p, attn_p))
|
|
|
|
|
|
# Write ram.in file
|
|
write_env_RAM(title, freq, pos, bathm, ssp_ram)
|
|
# Call ram.exe
|
|
system(AtBinPath + "/ram")
|
|
# Read tl.grid
|
|
return readTL_RAM()
|
|
|
|
# if __name__=="__main__":
|
|
# ''' ********************************************************************************* '''
|
|
# ''' ***************************** Input Parameters ********************************** '''
|
|
# ''' ********************************************************************************* '''
|
|
# freq = 25 # Frequency
|
|
# sd = 40.0 # Source depth
|
|
# rd = 30.0 # Receiving depth
|
|
|
|
# # 定义坐标
|
|
# lat = 18.00
|
|
# lon = 114.00
|
|
# # 定义时间段
|
|
# timeIndex = db.timeDict['Annual']
|
|
# # 创建类
|
|
# data = db.DataBase()
|
|
# # 设置时间段
|
|
# data.set_timePeriod(timeIndex)
|
|
|
|
# [bathm, ssp, sed, base] = GetEnv(data, 25, Coord(lon, lat), R=100, azi=5)
|
|
|
|
# # 调用ram模块
|
|
# [rd, rr, TL] = call_ram(freq, sd, rd, bathm, ssp, sed)
|
|
|
|
# # Plot
|
|
# plt.pcolormesh(rr, rd, TL, vmin=40, vmax=90, cmap='jet_r', shading='auto')
|
|
# plt.xlabel("Range/m")
|
|
# plt.ylabel("Depth/m")
|
|
# plt.gca().invert_yaxis()
|
|
# plt.colorbar()
|
|
# plt.show() |