lect_start_archive.F
路径
LMDZ.MARS\libf\dynphy_lonlat\phymars\lect_start_archive.F
所属目录/模块
libf/dynphy_lonlat/phymars
文件定位
初始场归档文件(start_archive)读取与网格插值主例程。从 NetCDF 格式的 start_archive 文件读取全部大气、地表、土壤和示踪剂初始状态,通过垂直插值(interp_vert)和水平插值(interp_horiz)将旧网格数据重映射到当前模拟网格,并完成质量守恒修正。由 newstart 在初始化阶段调用。
作者:05/1997 初版,12/2003 混合坐标修改。
定义的符号
| 符号 |
类型 |
行号 |
作用 |
lect_start_archive_mod |
module |
1 |
包装 lect_start_archive 子例程 |
lect_start_archive |
subroutine |
7 |
读取 start_archive 并插值到当前网格 |
依赖的模块
| use 模块 |
only 列表 |
用途 |
待确认 |
infotrac |
tname |
示踪剂名称(新命名约定) |
— |
comsoil_h |
nsoilmx, layer, mlayer, volcapa, inertiedat |
土壤层参数与热惯量 |
— |
planete_h |
全模块 |
行星轨道参数 |
— |
comvert_mod |
ap, bp, aps, bps, preff |
垂直坐标系数 |
— |
comconst_mod |
kappa, g, pi |
物理常数 |
— |
comslope_mod |
nslope, def_slope, def_slope_mean, subslope_dist, end_comslope_h, ini_comslope_h |
坡面参数 |
— |
interp_line_mod |
interp_line |
一维线性插值(土壤深度方向) |
— |
surfini_mod |
locate_watercaptag |
水冰帽标记定位 |
— |
geometry_mod |
longitude, latitude |
经纬度 |
— |
netcdf |
全模块 |
NetCDF Fortran 接口 |
— |
surfdat_h |
watercaptag |
水冰帽标记数组 |
— |
调用的关键例程
| 被调用例程 |
所在模块/文件 |
调用位置 |
作用 |
interp_horiz |
外部 |
1248-1601(30+ 处) |
水平插值(旧网格→新网格) |
interp_vert |
本目录 |
1528, 1538, 1550, 1558, 1598 |
垂直插值(旧垂直层→新垂直层) |
interp_line |
interp_line_mod |
1395, 1469, 1494 |
一维线性插值(土壤深度方向) |
gr_dyn_fi |
外部 |
1258-1646(15+ 处) |
动力网格→物理标量网格转换 |
scal_wind |
本目录 |
1563 |
风场自然坐标转换;把 us/vs 平均到 u/v 风点 |
locate_watercaptag |
surfini_mod |
1301 |
水冰帽标记初始化 |
| NetCDF API |
netcdf |
全例程 |
NF_INQ_VARID / NF_GET_VAR* / nf90_get_var |
输入
| 输入 |
来源 |
类型/维度 |
单位 |
含义 |
ngrid |
参数 |
integer |
— |
物理网格列数 |
nlayer |
参数 |
integer |
— |
大气层数 |
nqtot |
参数 |
integer |
— |
平流示踪剂数 |
surfith |
参数 |
real(iip1,jjp1) |
J m⁻² K⁻¹ s⁻¹/² |
地表热惯量 |
nid |
参数 |
integer |
— |
NetCDF 文件标识符 |
输出
| 输出 |
去向 |
类型/维度 |
单位 |
含义 |
date |
OUT |
real |
day |
选定初始日期 |
tsurf |
OUT |
real(ngrid,nslope) |
K |
地表温度 |
tsoil |
OUT |
real(ngrid,nsoilmx,nslope) |
K |
土壤温度 |
inertiesoil |
OUT |
real(ngrid,nsoilmx,nslope) |
J m⁻² K⁻¹ s⁻¹/² |
土壤热惯量 |
albedo |
OUT |
real(ngrid,2,nslope) |
— |
地表反照率(vis/nir) |
emis |
OUT |
real(ngrid,nslope) |
— |
地表发射率 |
q2 |
OUT |
real(ngrid,nlayer+1) |
— |
PBL 风方差 |
t |
OUT |
real(iip1,jjp1,llm) |
K |
温度 |
ucov/vcov |
OUT |
real(...,llm) |
m/s |
协变风场 |
ps |
OUT |
real(iip1,jjp1) |
Pa |
地表气压 |
h |
OUT |
real(iip1,jjp1,llm) |
K |
位温 |
q |
OUT |
real(iip1,jjp1,llm,nqtot) |
— |
示踪剂混合比 |
qsurf |
OUT |
real(ngrid,nqtot,nslope) |
— |
地表示踪剂 |
watercap/peren_co2ice |
OUT |
real(ngrid,nslope) |
kg/m² |
永久水冰/CO₂冰帽 |
tauscaling |
OUT |
real(ngrid) |
— |
尘转换因子 |
totcloudfrac |
OUT |
real(ngrid) |
— |
亚网格云分数 |
phisold_newgrid |
OUT |
real(iip1,jjp1) |
m²/s² |
插值后的地表位势 |
共享状态与副作用
comsoil_h:读写 mlayer/layer/volcapa/inertiedat(土壤深度和热惯量)
comslope_mod:设置 nslope/def_slope/def_slope_mean/subslope_dist
surfdat_h::watercaptag:设置水冰帽标记
planete_h:读取行星轨道参数
- 交互式 I/O:从终端读取日期选择(
read(*,*) date)和缺失示踪剂初始化值
- 文件 I/O:从
nid 对应的 NetCDF 文件读取所有初始场
核心逻辑
- 示踪剂命名检测:检查是否使用旧命名(
q01,q02,...)或新命名(tname)
- 读取维度:从 NetCDF 获取
Time/latitude/longitude/altitude/subsurface_layers/nslope 维度
- 数组分配:按旧网格维度分配所有
...old 数组
- 读取静态场:
controle(100 元素控制参数表)、坐标、垂直系数 aps/bps、土壤深度 soildepth、热惯量 inertiedat、地表位势 phisinit、ptotalold/co2icetotalold(从 tab_cntrl(99:100))
- 交互式日期选择:显示可用日期列表,从终端读取用户选择
- 读取时间相关场:
- 2D:
co2ice/co2_surf、emis、ps、tsurf、q2surf、tauscaling、totcloudfrac、watercap、perenial_co2ice、watercaptag、albedo
- 地表示踪剂:按
tname 或旧命名循环读取 *_surf
- 土壤温度:
tsoil 或旧格式 Tg01,Tg02,...
- 3D 大气:
temp、u、v、q2atm
- 3D 示踪剂:按
tname 或旧命名循环读取
- 水平插值(2D 变量):
interp_horiz → gr_dyn_fi 对 phis、co2ice、tsurf、emis、tauscaling、totcloudfrac、watercap、peren_co2ice、watercaptag、albedo
- 质量守恒修正:
ps *= ptotalold/ptotal、co2ice *= co2icetotalold/co2icetotal
- 土壤深度插值(如需要):
interp_line 对热惯量和土壤温度
- 热惯量水平插值:
interp_horiz → gr_dyn_fi
- 3D 大气插值:
- 温度:
interp_vert → interp_horiz
- PBL 方差 q2:
interp_vert → interp_horiz → gr_dyn_fi
- 风场:
interp_vert → interp_horiz → scal_wind → 乘以 cu/cv 得协变风
- 示踪剂:逐示踪剂
interp_vert → interp_horiz
- 位温初始化:
h = t * (ps/preff)^kappa
- 释放数组
伪代码
Detect tracer naming convention (old q01..qN vs new tname)
Read dimensions from NetCDF (Time, lat, lon, alt, soil layers, nslope)
Allocate old-grid arrays
Read static fields (control table, coords, vertical coeffs, soil, phis)
Read ptotalold and co2icetotalold from tab_cntrl(99:100)
Display available dates; read user selection from terminal
Read time-dependent 2D fields (co2ice, emis, ps, tsurf, q2surf, etc.)
Read surface tracers (loop nqtot, using tname or q01..qN)
Read soil temperatures (tsoil or old Tg01..TgN format)
Read 3D atmospheric fields (temp, u, v, q2atm, tracers)
FOR each 2D variable:
interp_horiz(old → new grid) → gr_dyn_fi(scalar grid)
Correct ps and co2ice for mass conservation
IF soil depths differ:
interp_line for thermal inertia and soil temperature
interp_horiz + gr_dyn_fi for thermal inertia and soil temperature
FOR each 3D variable:
interp_vert(old vertical → new vertical)
interp_horiz(old horizontal → new horizontal)
Convert winds: scal_wind → ucov = unat * cu, vcov = vnat * cv
Compute potential temperature: h = t * (ps/preff)^kappa
Deallocate all old-grid arrays
参与的主题流程
| 主题 |
参与方式 |
| 初始场读取与垂直重映射 |
核心例程,完成全部 start_archive 读取和网格插值 |
| CO₂ 循环 |
读取 co2ice/co2_surf,修正 CO₂ 冰帽质量守恒 |
| 水冰帽初始化 |
读取 watercap/watercaptag,必要时调用 locate_watercaptag |
写法特点
- 固定格式 Fortran 77/90 混合:
.F 后缀,f77 列格式 + f90 USE/allocate
- 多格式兼容:支持旧(
q01/Tg01/co2ice/sig_s)和新(tname/tsoil/co2_surf/bps)两种 start_archive 格式
#ifdef NC_DOUBLE:条件编译支持单/双精度 NetCDF 读取
- 交互式输入:日期选择和缺失示踪剂值输入使用
read(*,*)(非脚本化)
no_slope 兼容:旧归档无 nslope 维度时,读取后复制到 slope=1
- 100 元素
tab_cntrl:与 ini_archive 写入的 controle 数组对应,tab0=50 偏移后读取 ptotalold(99) 和 co2icetotalold(100)
复现要点
- 需要先由
ini_archive 写入对应格式的 start_archive 文件
interp_vert 处理垂直层不匹配,interp_line 处理土壤层不匹配
- 质量守恒修正(
ps 和 co2ice)确保插值后总质量不变
- 需要
interp_horiz/gr_dyn_fi/scal_wind 辅助例程可用
planete_h 提供行星轨道参数用于日期计算
待确认
planete_h 全模块 USE 的具体读写变量待确认
- 交互式
read(*,*) 在批处理环境下的替代方案待确认
no_slope 分支在 nslope>1 的模拟中的正确性待确认
相关页面