物理侧打印控制和 abort 组页
输入范围
LMDZ.COMMON-6.3\LMDZ.COMMON\libf\phy_common\init_print_control_mod.F90
LMDZ.COMMON-6.3\LMDZ.COMMON\libf\phy_common\print_control_mod.F90
LMDZ.COMMON-6.3\LMDZ.COMMON\libf\phy_common\abort_physic.F90
Mars 运行参与度:条件经过/必经支撑。Mars 物理包大量调用 abort_physic;打印控制由物理初始化路径设置 lunout/prt_level/debug。
文件清单
| 文件 | 行数 | 主要符号 | 作用 |
|---|---|---|---|
print_control_mod.F90 |
27 | lunout, prt_level, debug, set_print_control |
保存物理侧输出 unit、打印级别和 debug flag。 |
init_print_control_mod.F90 |
68 | init_print_control |
通过 getin_p 读取打印控制,必要时打开 lmdz.out_0000。 |
abort_physic.F90 |
50 | abort_physic |
物理侧异常/退出处理,打印原因并 dump getin 配置。 |
初始化流程
print_control_mod默认lunout=6、prt_level=0、debug=.FALSE.,并声明THREADPRIVATE(lunout,prt_level,debug)。init_print_control调用getin_p('prt_level',prt_level)、getin_p('lunout',lunout)、getin_p('debug',debug)。- 若当前是 root 且
lunout不是 5/6,则在 unit100+rank打开lmdz.out_0000。 - 最后调用
set_print_control写回模块变量。
abort_physic
abort_physic(modname,message,ierr) 先输出 in abort_physic,在 CPP_IOIPSL 构建的 OpenMP master 区调用 histclo、restclo,并只在 mpi_rank==0 时调用 getin_dump;随后打印停止模块、原因和 ierr。ierr==0 时只打印正常信息并返回;非零时在 CPP_MPI 下调用 MPI_ABORT(COMM_LMDZ_PHY,1,...),否则执行 stop 1。逐分支细节见 abort_physic。
复现要点
lunout/prt_level/debug是 OpenMP threadprivate;复现多线程输出时必须确认初始化在正确线程上下文传播。abort_physic的histclo/restclo/getin_dump只在CPP_IOIPSL的 OpenMP master 区执行,其中getin_dump还限制为mpi_rank==0。abort_physic不负责恢复物理状态,只用于终止前输出诊断。
待确认
histclo/restclo的内部错误处理属于 IOIPSL 外部库行为,组页不展开。