MPAS | Modify Source Code


Compilation

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#!/bin/bash
############################## Directory Listing ############################
export SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
source /home/wpsze/MPAS-A/intel-oneapi/mpas_env_intel.sh

which mpiicc && mpiicc --version
which mpiifort && mpiifort --version
which mpiicpc && mpiicpc --version
which icc && icc --version
which ifort && ifort --version

echo $NETCDF
echo $PNETCDF
echo $PIO

##--Intel MPI与Open MPI、MPICH等MPI实现不同:
##--mpiicc、mpiicpc和mpiifort命令:使用Intel编译器
##--mpicc、mpif90和mpifc命令:默认使用GNU编译器

do_init_atmosphere=True # True, False
do_atmosphere=True
do_build_tables=True

mpas_version="MPASv822-verify"

echo "Copy MPAS-Model to build-mpas ... "
rm -rf build-mpas
rm -rf ${mpas_version}
cp -r "MPASv8.2.2-modify" "build-mpas"
cd build-mpas

############################## init_atmosphere ############################
if [[ ${do_init_atmosphere} == True ]]; then
echo "=== init_atmosphere ===="

make clean CORE=init_atmosphere
make clean CORE=atmosphere

# mpas_dmpar.F:
# call MPI_Allreduce(inArray, outArray, nElements, MPI_INTEGERKIND, MPI_MAX, dminfo % comm, mpi_ierr)
# Warning: Rank mismatch between actual argument at (1) and actual argument at (2) (scalar and rank-1)

#export FFLAGS="-w -fallow-argument-mismatch -O2"
#export FCFLAGS="-w -fallow-argument-mismatch -O2"

#make -j8 gfortran CORE=init_atmosphere PRECISION=single DEBUG=true USE_PIO2=true >& log_build2.txt
make intel-mpi CORE=init_atmosphere PRECISION=single USE_PIO2=true 2>&1 |tee log_build_init.txt

### Check MPAS model.
#ls -la init_atmosphere_model
echo "=== init_atmosphere (end) ===="
fi

############################## atmosphere_model ############################
if [[ ${do_atmosphere} == True ]]; then
echo "=== atmosphere_model ===="
#--- To preserve all executables except atmosphere_model and clean the MPAS infrastructure, run:
make clean CORE=atmosphere

#export FFLAGS="-w -fallow-argument-mismatch -O2"
#export FCFLAGS="-w -fallow-argument-mismatch -O2"

# DEBUG=true
make -j8 intel-mpi CORE=atmosphere PRECISION=single USE_PIO2=true 2>&1 |tee log_build_atm.txt
#make -j8 intel-mpi CORE=atmosphere PRECISION=single USE_PIO2=true DEBUG=true 2>&1 |tee log_build_atm.txt
#make intel-mpi CORE=atmosphere PRECISION=single MPAS_MPI_F08=false USE_PIO2=true 2>&1 |tee log_build_atm.txt

### Check MPAS model.
#ls -la atmosphere_model
echo "=== atmosphere_model (end) ===="
wait

fi

if [[ -f atmosphere_model ]]; then
mkdir -p $SCRIPT_DIR/${mpas_version}
mv streams.init_atmosphere $SCRIPT_DIR/${mpas_version}
mv namelist.init_atmosphere $SCRIPT_DIR/${mpas_version}
mv init_atmosphere_model $SCRIPT_DIR/${mpas_version}

mv atmosphere_model $SCRIPT_DIR/${mpas_version}
mv build_tables $SCRIPT_DIR/${mpas_version}
mv namelist.atmosphere $SCRIPT_DIR/${mpas_version}
mv streams.atmosphere $SCRIPT_DIR/${mpas_version}
mv stream_list.atmosphere.diagnostics $SCRIPT_DIR/${mpas_version}
mv stream_list.atmosphere.output $SCRIPT_DIR/${mpas_version}
mv stream_list.atmosphere.surface $SCRIPT_DIR/${mpas_version}

mv ./src/core_atmosphere/physics/physics_wrf/files/* $SCRIPT_DIR/${mpas_version}/

if [[ ${do_build_tables} == True ]]; then
cd $SCRIPT_DIR/${mpas_version}
./build_tables
fi

fi

Serial/Parallel compilation

  • Serial
  • Parallel make -j8

mpi_f08 issue

Simple MPAS I/O Layer (SMIOL)


MPAS | Modify Source Code
https://waipangsze.github.io/2026/09/09/MPAS-Modify-Source-Code/
Author
wpsze
Posted on
September 9, 2026
Updated on
September 9, 2026
Licensed under