CESM(CIME)笔记

一、CESM

CESM全称为Community earth system model,是集成的地球系统模型。集成一词隐含着其结构上的特别性:由几个模型共同组成,几个模型分别对地球系统中的大气、海洋、陆地、陆冰、海冰等进行模拟。中央耦合模块协调时间演化、将不同子模式的运行结果耦合在一起。

CESM主要是用Fortran编写的,netCDF是用C编写的。因为没有从Fortran程序调用C程序的标准方法,因此CESM和netCDF之间的Fortran到C层将根据用于CESM的Fortran编译器而有所不同。

下载:GitHub - ESCOMP/CESM: The Community Earth System Model

CESM2建立在CIME框架之上,CESM2用户指南的大部分内容包含在CIME文档中,建议新用户阅读。(——>第二部分CIME)

CESM2系统可以从科学和技术角度进行多种不同的配置。CESM2支持多种resolution和component set,此外,每个模型组件都有输入选项来配置特定的模型设置和参数化。

1、component

CESM2 consists of seven geophysical model components:

and an external system processing component(7+1)

·external system processing component

CESM2配有一个驱动器/耦合器(cpl7),用于协调地球物理组件的时间演变,并定期允许组件交换数据。每个组件都以几种models之一表示:“active”“data”“dead”or“stub”,允许整个系统通过允许各种“plug and play”组合来激活和取消活动组件反馈。

耦合过程:在CESM2运行过程中,模型组件及时向前集成,定期与耦合器交换信息。耦合器同时接收来自组件模型的字段,计算、映射和合并这些信息,然后将这些字段发送回组件模型。耦合器代理这一通信交换序列,并管理耦合系统的整体时间进程。(Fortran)

active组件:最先进的气候预测和分析工具,包含了循环输入数据的数据模型,用于测试test、启动spin up和模型参数化开发 model parameterization development。

dead组件:生成科学上无效的数据,仅用于支持技术系统测试。必须一起运行,绝不能与任何active或data的模型组合。

stub组件:在模型配置不需要该组件时存在,以满足接口需求(例如,大气数据强制的主动陆地组件不需要ice、ocn或glc组件,因此使用ice、ocn和glc存根)

2、component Sets

A particular mix of components, along with component-specific configuration and/or namelist settings is called a component set or compset.

3、grids

The supported grid resolutions are specified in CESM2 by setting an overall model resolution.

single point, finite volume, cubed sphere, displaced pole, and tripole

4、案例

requested resolution, component set, and machine.

CESM2.2.0 Component Sets Definitions (ucar.edu)

CESM2.2.0 Grid Resolution Definitions (ucar.edu)

CESM2.2.0 Machine Definitions (ucar.edu)

·Create a case

creates a case directory containing the scripts and XML files to configure a case (see below) for the requested resolution, component set, and machine.

./create_newcase --case /$USER/cases/b.e20.B1850.f19_g17.test --compset B1850 --res f19_g17

·Setting up the case run script

creates scripts needed to run the model along with namelist user_nl_xxx files, where xxx denotes the set of components for the given case configuration.

modify the env_mach_pes.xml file in the case directory using the xmlchange command as needed for the experiment.

./case.setup

·Build the executable using the case.build command

modify build settings in env_build.xml

./case.build

the CESM executable will appear in the directory given by the XML variable $EXEROOT

env_build.xml: EXEROOT =.../cesm.run/casename/bld

·Run the case

Modify runtime settings in env_run.xml:

Run length:$STOP_N $STOP_OPTION

短期存档:$DOUT_S —— FALSE to turn off short term archiving

./case.submit
./xmlquery RUNDIR,CASE,CASEROOT,DOUT_S,DOUT_S_ROOT
>>env_run.xml: RUNDIR = .../cesm.run/casename/run
>>env_case.xml: CASE = casename
>>env_case.xml: CASEROOT = .../cesm.run/casename
>>env_run.xml: DOUT_S = TRUE
>>env_run.xml: DOUT_S_ROOT = .../cesm.archive/casename

RUNDIR:这是运行CESM2的位置。如果$DOUT_S == FALSE,则每个组件都应该有日志文件(即形式为cpld .log.yymmdd-hhmmss),每个组件都编写自己的日志文件。

DOUT_S_ROOT:本地磁盘上的短期归档路径位置,当$DOUT_S = TRUE时由st_archive脚本调用。

Naming Conventions | Community Earth System Model (ucar.edu)

.run/casename/CaseDocs:The case namelist files are copied into this directory from the $RUNDIR

.run/casename/timing:两个总结模型性能的计时文件。

二、CIME

CIME,Common infrastructure for Modeling the Earth,包含了构建单个可执行耦合地球系统模式所需要的支持脚本(配置、构建、运行、测试)、数据模式、基础实用程序库和其他工具,是一个不需要有效预测组分就可以编译和测试的独立的软件包,但它通常都包括在模式的源代码中。

1、理论知识基础

熟悉基本的数值模拟模型概念:

POP(The Parallel Ocean Program)是由美国洛斯阿拉莫斯国家实验室开发的全球海洋环流数值模式。POP采用基于流体静力平衡和Boussinusq近似的薄层流体的三维原始动力方程进行描述的全球海洋环流模式,水平方向支持广义正交坐标,垂直方向以海洋深度为垂直坐标。在pop2中,海洋主体的流动是解析的,但是涡旋和混合等过程是参数化的。除了作为CESM地球系统耦合模式的组件,也可以用于海洋中尺度涡的模拟。更多详细信息见POP用户手册:https://www2.cesm.ucar.edu/models/cesm1.0/pop2/doc/users/POPusers_main.html

熟悉UNIX命令行终端和UNIX开发环境。

2、关键术语和概念

· components

也叫“模型”(model),7 physical components :atmosphere, ocean, sea-ice, land surface, river, ice sheet, ocean waves

a coupled earth system model is made up of components that interact through a coupler and are all controlled by a driver

these 7 components occupy physically distinct domains in the Earth system and/or require different numerical grids for solving

· component types

active:Solve a complex set of equations to describe the model's behavior. Also called prognostic or full models. These can be full General Circulation Models. Multiple active models might be available (for example POP and MPAS-ocean to represent the global ocean)

data:reduce feedbacks within the system by replacing an active model with a version that sends and receives the same variables to and from other models, but with the values read from files rather than computed from the equations.

stub: occupy the required place in the driver and do not send or receive any data

· grid/model grid

Each active model must solve its equations on a numerical grid. CIME allows models within the system to have different grids.

※ case

To build and execute a CIME-enabled climate model, you have to make choices of compset, model grid, machine and compiler. The collection of these choices, and any additional customizations you may make, is called the case.

3、调用new case的结果

create_newcase在$CASEROOT中安装文件,这些文件将构建和运行模型,并可选地将案例存档到目标平台上。

Scripts

case.setup:创建构建案例、创建名称列表和运行案例所需的各种文件和目录。

./case.setup
./case.setup --reset

case.build:在setup运行之后,在run运行之前,build component and utility libraries and model executable。

在$RUNDIR和$CASEROOT/CaseDocs中创建组件名称列表;创建耦合器组件模型mct、pio、gptl和csm_share所使用的必要的编译库,这些库将被放置在$SHAREDLIBROOT下面的路径中;为每个组件模型创建必要的编译库,它们被放置在$ exoot/bld/lib中;创建模型可执行文件($ model.exe),它放在$ exoot中。

case.build
case.build --clean
case.build --clean -all

case.submit:向队列系统提交案例,运行情况提交是开始一项工作的唯一方式。

加载必要的环境;确认锁定文件与当前xml文件一致;运行preview_namelist,它将依次运行每个组件的cime_config/buildnml脚本;运行check_input_data来验证是否存在所需的数据;将case提交到批处理队列,然后运行case.run脚本。

提交短期归档脚本案例;如果$DOUT_S为TRUE,则将st_archive发送到批处理队列,短期存档将从$RUNDIR复制并移动组件历史、日志、诊断和重新启动文件到短期存档目录$DOUT_S_ROOT;重新提交case.run 如果 $ Resubmit > 0

短期存档:cesm.run/casename/run/($RUNDIR)

存档目录:cesm.archive/casename/($DOUT_S_ROOT)

查看文件状态:cesm.archive/casename/run.log

$CASEROOT/CaseStatus文件包含按时间顺序记录所有case状态和xmlchange命令的日志。

xmlchange:允许通过命令行界面更改env_*xml文件中的变量。

#To set a single variable:
./xmlchange REST_N=4
#To set multiple variables at once:
./xmlchange REST_OPTION=ndays,REST_N=4

xmlquery:从env_*xml文件中查询变量并列出所有可用变量。

./xmlquery var1,var2,var3
./xmlquery STOP_N
>>STOP_N=10
./xmlchange STOP_N=6
./xmlquery STOP_N
>>STOP_N=6

XML files

env_archive.xml:定义要发送到短期存档的文件的模式。

env_mach_specific.xml:设置一些用于构建和/或运行的特定于机器的环境变量。

※env_build.xml:Sets model build settings. This includes component resolutions and component compile-time configuration options. You must run the case.build command after changing this file.

※env_run.xml:Sets runtime settings such as length of run, frequency of restarts, output of coupler diagnostics, and short-term and long-term archiving. This file can be edited at any time before a job starts.

4、运行case

cesm.run/casename/check_input_data:确定case所需的数据文件是否存在本地磁盘$DIN_LOC_ROOT的子目录中,会自动下载模拟所需的缺失数据。

($DIN_LOC_ROOT)8p/cess/CESM_INPUT

RUN_TYPE初始化

env_run.xml中RUN_TYPE变量 >>hybrid

startup:使用基线状态进行初始化,这些状态由每个组件独立设置,可以包括使用重启文件、初始文件、外部观察到的数据文件或内部初始化。在启动运行中,耦合器在初始化时将开始日期发送给组件。此外,耦合器不需要输入数据文件。在启动初始化中,海洋模型直到第二个海洋耦合步骤才启动。

branch:所有组件都使用来自上一次运行的一组一致的重新启动文件进行初始化(由env_run.xml中的$RUN_REFCASE和$RUN_REFDATE变量决定)。caes名称通常会在branch运行时更改,但不必须。在branch运行中,$RUN_STARTDATE设置被忽略,因为模型组件从它们的重启数据集中获得开始日期。因此,不能更改branch运行的开始日期,这与执行重新启动运行所使用的机制相同。

$RUN_REFCASE = B_f09g16;$RUN_REFDATE = 0151-01-01;$RUN_STARTDATE = 2006-01-01

通常用于需要灵敏度或参数研究,或者需要修改历史文件输出流的设置,同时仍然保持位对位的可再现性。在这种情况下,如果没有修改源代码或组件名称列表输入,新的case能够以与继续运行相同的方式产生精确的位对位重新启动。所有模型都使用重新启动文件来执行这种类型的运行。branch运行需要$RUN_REFCASE和$RUN_REFDATE。设置:之前运行的$RUN_REFCASE和$RUN_REFDATE的重启tar文件或重启目录,然后将这些文件放在$RUNDIR目录中。

$RUNDIR = cesm.run/single_test/run

hybrid: initialized like a startup but it uses initialization data sets from a previous case;

与branch运行不同,开始日期(由$RUN_STARTDATE指定)可以相对于引用case进行修改。

当$CONTINUE_RUN变量设置为FALSE时,此设置仅对初始生产运行重要。在初始运行之后,$CONTINUE_RUN变量被设置为TRUE,并且模型以大小写、日期和位对位连续的方式使用输入文件准确地重新启动。

从一个REF_CASE开始

xml变量$GET_REFCASE是一个标志,如果设置它,将自动预登台refcase重启数据。

env_run.xml: GET_REFCASE = FALSE

结果输出

每个模型组件在$RUNDIR中生成自己的输出数据集,包括历史、初始、重启、诊断、输出日志和rpointer文件。组件历史文件和重启文件为netCDF格式。重新启动文件用于重新启动相同的模型或作为其他模型用例的初始条件。

DOUT_S = TRUE
DOUT_S_ROOT = /cesm.archive/casename/

第一个设置是默认设置,因此启用了短期归档。第二个设置在成功运行结束时将文件移动到哪里。

Standard output generated from each component is saved in $RUNDIR in a log file.

生成/cesm.run/casename/logs/ocn.log.230301-100000.gz

restart a run

env_run.xml: REST_OPTION = ndays

env_run.xml: REST_N = 6

初始化为branch或hybird的运行需要先前模型运行的重新启动/初始文件(由变量$RUN_REFCASE和$RUN_REFDATE指定)。在模型运行开始之前,将这些文件预先放置到案例$RUNDIR(通常是$ exoot /../run)。通常这是通过复制相关的$RUN_REFCASE/rest/$RUN_REFDATE的内容来完成的。

vi cesm.run/casename/run/rpointer.ocn.restart

存档模型输出数据

没有启用短期归档:.run/casename/run/

启用短期归档:.archive/casename/

./rest/ ./logs/ ./ocn/ ./atm/ ./ind/…………

logs/子目录包含运行期间创建的组件日志文件。日志文件也复制到短期归档目录,因此可用于长期归档。

rest/子目录包含一个目录子集,每个目录包含一组一致的重启文件、初始文件和rpointer文件。每个子目录都有一个唯一的名称,对应于创建文件时的年、月、日和秒的模型。任何重启目录的内容都可以用于创建branch运行或hybird运行,或者备份到以前的重启日期。

数据同化和其他外部处理

如果在模型完成后DATA_ASSIMILATION为真,则将运行DATA_ASSIMILATION _SCRIPT,然后再次启动模型DATA_ASSIMILATION _CYCLES。

参考:

Quick Start: CESM Model Workflow (Upcoming/Beta Version) — CESM Upcoming/Beta Version documentation (escomp.github.io)

1. Introduction — CIME master documentation (esmci.github.io)

https://blog.csdn.net/LWY651vv/article/details/125256665

https://blog.csdn.net/qq_27984679/article/details/106201691

https://blog.csdn.net/m0_57037968/article/details/129161717?spm=1001.2014.3001.5502

可参考文件:

简明教程:

https://mp.weixin.qq.com/s?__biz=MzAwNDgyNTgxOA==&mid=2247524930&idx=4&sn=110869082b89ce9e1d5df7c181bc377d&chksm=9b27d5f7ac505ce1364a41a900736b26397df74447f49a7fe46a677b625c9c345192d4be6cc3&scene=27

推荐阅读1.2版本使用手册:https://www2.cesm.ucar.edu/models/cesm1.2/cesm/doc/usersguide/book1.html

改变分量修改namelist:https://www2.cesm.ucar.edu/models/cesm2/settings/current/

命名规则:https://www.cesm.ucar.edu/models/cesm2/naming-conventions#casenames

创建case:Creating and Setting Up A Case (ucar.edu)

case变量(可查询):CESM Component Models Namelist Definitions (ucar.edu)

  • 1
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值