我正在学习海洋建模,并已开始与MOM6。我需要指导从哪里开始,以及如何在我的本地机器(Ubuntu)上运行模型来执行各种任务,例如重新划分或创建初始条件,或者可能是不需要花费太多时间的小运行。
1回答
在Ubuntu上安装MOM6
下载模型和基本库
后https://github.com/NOAA-GFDL/MOM6-examples/wiki/Installing-MOM6-in-a-virtual-machine-running-Ubuntu
还有视频https://www.youtube.com/watch?v=a5hKh8s_1b0&t=181s
sudo apt-get install libnetcdf- bin libnetcdf-dev libnetcdff-dev sudo apt-get install libnetcdff-dev git clone——recursive https://github.com/NOAA-GFDL/MOM6-examples demo cd demo
打开文件src/mkmf/templates/linux-gnu。并找到变量LIBS。现在在这个文件中添加语法
#添加-lnetcdff lib += -lnetcdff
编译
现在我们已经准备好开始编译,我们将执行https://github.com/NOAA-GFDL/MOM6-examples/wiki/Getting-started#compiling-the-models
这些说明是关于在intel编译器上进行设置的,所以我们必须对这些命令进行一些编辑,因为我们将使用gfortran,也就是GNUs fortran。
创建一个目录来构建高级库mkdir -p build/gnu/shared/repro/ cd build/gnu/shared/repro/
接下来,我们将运行mkmf列表路径工具,我们将为它提供FMS源代码的相对路径
../../../../src/mkmf/bin/list_paths -l…/…/…/…/ /src/FMS
因此,您所做的就是填充这个文件path_names现在我们要运行另一个mkmf工具,我们要指定我们上面编辑的linux gnu模板,我们要告诉它来构建FMS
../../../../ src / mkmf / bin / mkmf - t ../../../../ src / mkmf /模板/ linux-gnu。Mk -p libfms。a -c "-Duse_libMPI -Duse_netCDF -DSPMD"路径名称
这就生成了Makefile
最后我们可以输入
make NETCDF=3 REPRO=1 FC=mpif77 CC=mpicc libfms一个- j
这样就构建了库FMS代码,可以通过
$ 1 - 1 libfms。a -rw-rw-r- 1人遇见人遇见人
现在我们要回去,我们将创建一组新的文件夹ocean_only/ repo
cd . . / . ./ mkdir -p ocean_only/repro CD ocean_only/repro
现在我们再次运行路径列表命令,这只是下来,这一次我们将提供当前目录是一个可能的种类和规格供应你想把一些源文件在这里,这是点,然后是MOM6源代码的相对路径,我们将连接一个动态可执行文件,所以我们把动态目录的配置源和我们正在构建一个设置使用单独驱动,驱动程序有一个配置源,并且SRC下的所有源代码都被使用。
../../../../ src / mkmf / bin / list_paths ./ ../../../../ src / MOM6 / {config_src /动态,config_src / solo_driver src /{*,*/*}}/
因此,这再次创建了一个path_names文件,该文件将填充所有MOM6源代码。现在我们将再次运行mkmf工具,这次的目标是MOM6,我们必须再次将模板更改为linux-gnu
../../../../ src / mkmf / bin / mkmf - t ../../../../ src / mkmf /模板/ linux-gnu。mk -o ' i…/share /repro' -p MOM6 -l ' -l ./…/shared/repro -lfms' -c '-Duse_libMPI -Duse_netCDF -DSPMD' path_names . /
这将创建Makefile,现在我们可以使用类似的命令运行Makefile,但目标将是MOM6
make NETCDF=3 REPRO=1 FC=mpif77 CC=mpicc LD=mpif77 MOM6 -j
现在我们有了名为MOM6的可执行文件,我们将演示它的工作原理。
转到目录顶部,然后转到double_gyre
cd ../../../../ cd ocean_only/double_gyre/ mpirun -n 1 ../../build/gnu/ocean_only/repro/MOM6 ./
这是一个简单的为期10天的测试,会给出如下结果
$ mpirun -n 1 ./…/build/gnu/ocean_only/repro/MOM6备注:MPP_DOMAINS_SET_STACK_SIZE:堆栈大小设置为32768。&MPP_IO_NML HEADER_BUFFER_VAL= 16384, GLOBAL_FIELD_ON_ROOT_PE=T, IO_CLOCKS_ON=F, SHUFFLE= 0, DEFLATE_LEVEL= -1, CF_COMPLIANCE=F, /注:MPP_IO_SET_STACK_SIZE:堆栈大小设置为131072。备注:======== MOM_driver驱动的模型========备注:callTree: o程序MOM_main, MOM_driver. netF90备注:open_param_file: MOM_input已成功打开。注意:open_param_file: MOM_override已成功打开。MOM域分解whalo = 4, ehalo = 4, shalo = 4, nhalo = 4 X-AXIS = 44 Y-AXIS = 40 MOMc域分解whalo = 2, ehalo = 2, shalo = 2, nhalo = 2 X-AXIS = 22 Y-AXIS = 20注意:diag_manager_mod::diag_manager_init: prepend_date仅支持在time_init存在的情况下调用diag_manager_init。MOM域分解whalo = 4, ehalo = 4, shalo = 4, nhalo = 4 X-AXIS = 44 Y-AXIS = 40 MOM域分解whalo = 4, ehalo = 4, shalo = 4, nhalo = 4 X-AXIS = 44 Y-AXIS = 40WARNING: depth_list_setup: ./Depth_list. 4Nc不存在。创建新文件。警告:depth_list_setup: ./Depth_list。Nc不存在。创建新文件。MOM Day 0.000 0: En 1.423707E-13, MaxCFL 0.00000, Mass 5.288178268008E+18 Total Energy: 4126F9E3C5B6FEAF 7.5288188616176497E+05 Total Mass: 5.2881782680077681E+18, Change: 0.0000000000000000E+00 Error: 0.00000E+00 ( 0.0E+00) MOM Day 1.000 72: En 4.580432E-06, MaxCFL 0.00023, Mass 5.288178268008E+18 Total Energy: 42B607A80A83D4D0 2.4222139843540812E+13 Total Mass: 5.2881782680077681E+18, Change: -4.3787057037831573E+01 Error: -4.37871E+01 (-8.3E-18) MOM Day 2.000 144: En 8.958206E-06, MaxCFL 0.00040, Mass 5.288178268008E+18 Total Energy: 42C58AE533474153 4.7372590026370648E+13 Total Mass: 5.2881782680077681E+18, Change: 4.0318344822758547E+00 Error: 4.03183E+00 ( 7.6E-19) MOM Day 3.000 216: En 1.166708E-05, MaxCFL 0.00045, Mass 5.288178268008E+18 Total Energy: 42CC0E8B5CE02C7F 6.1697586479192992E+13 Total Mass: 5.2881782680077681E+18, Change: 3.7798219410031322E+01 Error: 3.77982E+01 ( 7.1E-18) MOM Day 4.000 288: En 1.542296E-05, MaxCFL 0.00044, Mass 5.288178268008E+18 Total Energy: 42D28B60D5891799 8.1559337444446391E+13 Total Mass: 5.2881782680077681E+18, Change: -5.3715335655123397E+01 Error: -5.37153E+01 (-1.0E-17) MOM Day 5.000 360: En 1.826022E-05, MaxCFL 0.00053, Mass 5.288178268008E+18 Total Energy: 42D5F4B97D5D13C3 9.6563312817231047E+13 Total Mass: 5.2881782680077681E+18, Change: -2.1099290705067006E+01 Error: -2.10993E+01 (-4.0E-18) MOM Day 6.000 432: En 2.397431E-05, MaxCFL 0.00062, Mass 5.288178268008E+18 Total Energy: 42DCD397A5E14CB5 1.2678043163166683E+14 Total Mass: 5.2881782680077681E+18, Change: -1.0757841703346941E+01 Error: -1.07578E+01 (-2.0E-18) MOM Day 7.000 504: En 2.927962E-05, MaxCFL 0.00073, Mass 5.288178268008E+18 Total Energy: 42E19A5109E607AC 1.5483585791186938E+14 Total Mass: 5.2881782680077681E+18, Change: 4.6503600220410505E+01 Error: 4.65036E+01 ( 8.8E-18) MOM Day 8.000 576: En 3.486441E-05, MaxCFL 0.00081, Mass 5.288178268008E+18 Total Energy: 42E4F5D995BB3999 1.8436920009364478E+14 Total Mass: 5.2881782680077681E+18, Change: 2.4524203108417453E+01 Error: 2.45242E+01 ( 4.6E-18) MOM Day 9.000 648: En 4.195565E-05, MaxCFL 0.00090, Mass 5.288178268008E+18 Total Energy: 42E9393C9CAC4D82 2.2186896584766006E+14 Total Mass: 5.2881782680077681E+18, Change: -2.0342624683786397E+01 Error: -2.03426E+01 (-3.8E-18) MOM Day 10.000 720: En 4.604729E-05, MaxCFL 0.00100, Mass 5.288178268008E+18 Total Energy: 42EBAEF71B9A7E17 2.4350627232664072E+14 Total Mass: 5.2881782680077681E+18, Change: 2.2570880028229340E+01 Error: 2.25709E+01 ( 4.3E-18)FATAL: NETCDF ERROR: No such file or directory File=RESTART/MOM.res.ncFATAL: NETCDF ERROR: No such file or directory File=RESTART/MOM.res.nc-------------------------------------------------------------------------- MPI_ABORT was invoked on rank 0 in communicator MPI_COMM_WORLD with errorcode 1.NOTE: invoking MPI_ABORT causes Open MPI to kill all MPI processes. You may or may not see output from other processes, depending on exactly when Open MPI kills them. -------------------------------------------------------------------------- ------------------------------------------------------- Primary job terminated normally, but 1 process returned a non-zero exit code.. Per user-direction, the job has been aborted. ------------------------------------------------------- -------------------------------------------------------------------------- mpirun detected that one or more processes exited with non-zero status, thus causing the job to be terminated. The first process to do so was:Process name: [[19779,1],0] Exit code: 1 --------------------------------------------------------------------------
因此,当我们没有创建重启时,我们将得到一个错误。我们现在就做
mkdir -p RESTART mpirun -n 1 ../../build/gnu/ocean_only/repro/MOM6
接下来我们将使用两个处理器,我们看到它现在运行得更快了
mpirun -n 2../../build/gnu/ocean_only/repro/MOM6
https://github.com/NOAA-GFDL/MOM6-examples/wiki/Ubuntu-compiler-environment