defrun_new.F
路径
LMDZ.MARS\libf\dynphy_lonlat\phymars\defrun_new.F
所属目录/模块
libf/dynphy_lonlat/phymars
文件定位
GCM 运行参数配置文件读取器。defrun_new 打开并解析 run.def,将时间步进、耗散参数、网格缩放(zoom)、海绵层、物理过程频率和起始输出等控制参数写入 control_mod/logic_mod/serre_mod/sponge_mod 等公共模块变量,供后续动力-物理循环使用。仅在非并行(#ifndef CPP_PARA)模式下编译。
定义的符号
| 符号 |
类型 |
行号 |
作用 |
defrun_new |
subroutine |
1 |
读取 run.def 运行参数 |
依赖的模块
| use 模块 |
only 列表 |
用途 |
待确认 |
ioipsl_getincom |
getin |
从 run.def 读取键值对 |
|
sponge_mod |
callsponge, nsponge, mode_sponge, tetasponge |
海绵层控制参数 |
|
control_mod |
ndynstep, day_step, iperiod, iconser, dissip_period, iphysiq, anneeref, ecritstart, timestart, nday_r |
运行控制参数 |
|
logic_mod |
hybrid, purmats, fxyhypb, ysinus, iflag_phys |
逻辑开关 |
|
serre_mod |
clon, clat, grossismx, grossismy, dzoomx, dzoomy, alphax, alphay, taux, tauy |
网格缩放(zoom)参数 |
|
INCLUDE 头文件:
| 头文件 |
用途 |
dimensions.h |
网格维度参数 |
paramet.h |
物理参数 |
comdissnew.h |
耗散参数公共块(lstardis/nitergdiv/nitergrot/niterh/tetagdiv/tetagrot/tetatemp/coefdis) |
iniprint.h |
输出单元 lunout |
调用的关键例程
| 被调用例程 |
所在模块/文件 |
调用位置 |
作用 |
getin |
ioipsl_getincom |
多处 |
从 run.def 文件读取各配置键值 |
输入
| 输入 |
来源 |
类型/维度 |
单位 |
含义 |
tapedef |
调用方 |
INTEGER |
— |
run.def 文件使用的 Fortran 单元号(通常 99) |
etatinit |
调用方 |
LOGICAL |
— |
.true. 表示由 newstart 调用(初始化模式),.false. 表示由 GCM 主循环调用(一致性校验模式) |
输出
本例程无显式输出参数,所有配置值通过 USE 关联的模块变量传出。
共享状态与副作用
通过 USE 模块变量大量写入:
control_mod: nday_r, ndynstep, day_step, iperiod, iconser, dissip_period, iphysiq, anneeref, ecritstart, timestart
logic_mod: hybrid, purmats, fxyhypb, ysinus, iflag_phys
serre_mod: clon, clat, grossismx, grossismy, alphax, alphay, dzooomx, dzooomy, taux, tauy
sponge_mod: callsponge, nsponge, mode_sponge, tetasponge
comdissnew.h(公共块): lstardis, nitergdiv, nitergrot, niterh, tetagdiv, tetagrot, tetatemp, coefdis
iniprint.h: lunout
- 文件 I/O: 打开并读取
run.def;可能打开 lmdz.out 作为日志输出文件
核心逻辑
- 初始化:设
anneeref=0(火星无参考年),打开 run.def 验证存在性后关闭(后续 getin 自行打开),配置 lunout 输出单元。
- 时间步进参数:依次读取
nday(默认 1 天)、ndynstep(若 > 0 则覆盖 nday)、day_step(默认 960 步/天)、iperiod(Matsuno 周期,默认 5 步,须整除 day_step)、iconser(控制输出周期,默认 120 步)。
- 耗散参数:
dissip_period(默认 5 步)、lstardis(star 算子,默认 .true.)、nitergdiv/nitergrot/niterh(迭代次数,默认 1/2/2)、tetagdiv/tetagrot/tetatemp(耗散时标,默认 4000/5000/5000 s)、coefdis(默认 0)。
- 积分方案:
hybrid(混合坐标,默认 .true.)、purmats(纯 Matsuno,默认 .false.)、iflag_phys(物理开关,默认 1)、iphysiq(物理周期,默认 20 步,须整除 day_step)。
- 起始输出:
timestart(起始日期,默认 -9999)、ecritstart(start.nc 写出频率,须为 iphysiq 倍数)。
- Zoom 参数(
etatinit 分支):
- GCM 模式(
.false.):读取 zoom 参数并与 start 文件中已有值做一致性校验,不一致则 STOP。
- 初始化模式(
.true.):直接读取 clon(默认 63°)、clat(默认 0°)、grossismx/grossismy(默认 1.0)、fxyhypb(默认 .false.)、dzooomx/dzooomy(默认 0)、taux/tauy(默认 2.0),并从 grossismx 计算 alphax = 1 - 1/grossismx。
- 海绵层:
callsponge(默认 .true.)、nsponge(默认 3 层)、mode_sponge(默认 2)、tetasponge(默认 30000 s)。
- 后处理:
ysinus=.false.(火星固定正则网格);无 zoom 时强制 fxyhypb=.false.,有 zoom 时须 fxyhypb=.true. 否则 STOP。
伪代码
SUBROUTINE defrun_new(tapedef, etatinit)
anneeref ← 0
OPEN run.def → verify exists → CLOSE
configure lunout
-- 时间步进 --
getin nday, ndynstep, day_step, iperiod, iconser
-- 耗散 --
getin dissip_period, lstardis, nitergdiv, nitergrot, niterh
getin tetagdiv, tetagrot, tetatemp, coefdis
-- 积分方案 --
getin hybrid, purmats, iflag_phys, iphysiq
-- 起始输出 --
getin timestart, ecritstart
-- Zoom(分支)--
IF .NOT.etatinit THEN ! GCM 模式
getin clon/clat/grossismx/grossismy/fxyhypb/dzoomx/dzoomy/taux/tauy
校验与 start 文件一致
ELSE ! 初始化模式
getin 同上,直接赋值
alphax ← 1 - 1/grossismx
alphay ← 1 - 1/grossismy
ENDIF
-- 海绵层 --
getin callsponge, nsponge, mode_sponge, tetasponge
ysinus ← .false.
IF no zoom THEN fxyhypb ← .false.
IF zoom AND NOT fxyhypb THEN STOP
END SUBROUTINE
参与的主题流程
| 主题 |
参与方式 |
| GCM 运行配置 |
从 run.def 读取全部运行参数,驱动整个模拟流程 |
| 网格缩放(Zoom) |
读取并校验 zoom 参数,控制网格加密区域 |
写法特点
- Fixed-form Fortran 带 F90 扩展(
USE、! 注释、:: 声明)。
- 条件编译:整体包裹在
#ifndef CPP_PARA 中,并行模式下直接 STOP。
- 大量
getin 调用:约 30+ 个配置参数,每个都有硬编码默认值。
- 一致性校验:GCM 模式下 zoom 参数与
start 文件做差值比较(ABS(x - xx) >= 0.001),不匹配即 STOP。
- 法语注释:源码保留大量法语注释(P. Le Van, L. Fairhead)。
复现要点
- 需要
run.def 文件在当前工作目录可用。
tapedef 通常传 99(newstart.F 和 start2archive.F 均用 99)。
etatinit 决定 zoom 参数行为:初始化 vs 一致性校验。
- 并行模式下本例程不可用(
CPP_PARA 宏排除)。
待确认
comdissnew.h 公共块中的变量是否在其他文件中被修改。
serre_mod 的具体模块定义位置(可能不在 dynphy_lonlat 目录内)。
相关页面