|
1 | | -We are working on a user manual; meanwhile this [paper](https://ccrm.vims.edu/yinglong/SVN_large_files/Yu_etal_OM_2025-SCHISM-Data-Assimilation.pdf) serves as interim manual. |
| 1 | +#Theory |
| 2 | +Refer to this [paper](https://ccrm.vims.edu/yinglong/SVN_large_files/Yu_etal_OM_2025-SCHISM-Data-Assimilation.pdf). |
| 3 | + |
| 4 | +#Compilation |
| 5 | + |
| 6 | +Pre-requirements: ESMF, PDAF, SCHISM as libraries; the following sections show how to build for each. |
| 7 | + |
| 8 | +## Build ESMF |
| 9 | + |
| 10 | +ESMF version must be newer than version 8.1, users can download from https://earthsystemmodeling.org/download/ |
| 11 | + |
| 12 | +Specify macros depending on your platform resources, the following use intel with intelmpi as example, more options can be found from https://earthsystemmodeling.org/docs/release/latest/ESMF_usrdoc/node10.html#SECTION000106000000000000000 : |
| 13 | + |
| 14 | +``` |
| 15 | +export ESMF_DIR= where you untar ESMF |
| 16 | +export ESMF_COMPILER=intel |
| 17 | +export ESMF_OPENMP=OFF |
| 18 | +export ESMF_PTHREADS=OFF |
| 19 | +export ESMF_COMM=intelmpi |
| 20 | +export ESMF_NETCDF=split |
| 21 | +export ESMF_NETCDF_INCLUDE="$NetCDF_FORTRAN_DIR/include -I$NetCDF_FORTRAN_DIR/include $NetCDF_C_DIR/include -I$NetCDF_C_DIR/include" |
| 22 | +export ESMF_NETCDF_LIBPATH="$NetCDF_FORTRAN_DIR/lib -L$NetCDF_FORTRAN_DIR/lib $NetCDF_C_DIR/lib -L$NetCDF_C_DIR/lib" |
| 23 | +export ESMF_NETCDF_LIBS="-lnetcdff -lnetcdf" |
| 24 | +export ESMF_PIO=OFF |
| 25 | +export ESMF_ABI=x86_64_medium #(optional) |
| 26 | +``` |
| 27 | + |
| 28 | +Then do the following: |
| 29 | + |
| 30 | +``` |
| 31 | +cd $ESMF_DIR |
| 32 | +make info >& tmp #(inspect config info) |
| 33 | +make clobber |
| 34 | +make |
| 35 | +``` |
| 36 | + |
| 37 | + |
| 38 | +This may take some time depending on your system. If successful, the library & esmf.mk will be located in `$ESMF_DIR/lib/libO/Linux`.intel.x86_64_medium.intelmpi.default/; the actual path depends on compile option. |
| 39 | + |
| 40 | +If this is a fresh install, and you intend to build schism_pdaf after, remember to unset the macro to avoid conflict when building schism_pdaf, like the following: |
| 41 | + |
| 42 | +``` |
| 43 | +unset ESMF_DIR |
| 44 | +unset ESMF_COMPILER |
| 45 | +unset ESMF_OPENMP |
| 46 | +unset ESMF_PTHREADS |
| 47 | +unset ESMF_COMM |
| 48 | +unset ESMF_NETCDF |
| 49 | +unset ESMF_PIO |
| 50 | +unset ESMF_ABI |
| 51 | +``` |
| 52 | + |
| 53 | + |
| 54 | +##Build PDAF |
| 55 | + |
| 56 | +PDAF version 3.0 is not compatible with previous version (2.3.1 and older), so if you have previous version, please update it to the latest one. |
| 57 | + |
| 58 | +Get PDAF 3.0 from github |
| 59 | + |
| 60 | +git clone https://github.com/PDAF/PDAF.git |
| 61 | + |
| 62 | +Choose build option from folder make.arch or make one and put into it. |
| 63 | + |
| 64 | +Common choices are linux_ifort_impi.h, linux_ifort_mvapich2.h, linux_mpiifort_impi.h. |
| 65 | + |
| 66 | +Change compiling option if necessary. PDAF requires BLAS and LAPACK library. If your platform provides compiler optimized math library like Intel-MKL, OpenBLAS, AOCL (AMD), these can also be used and you need to config corresponding options in the *.h file. |
| 67 | + |
| 68 | +Here we use linux_ifort_impi.h as example, define marco as following then build the lib |
| 69 | + |
| 70 | +export ARCH=linux_ifort_impi |
| 71 | + |
| 72 | +export PDAF_ARCH=$ARCH |
| 73 | + |
| 74 | +make |
| 75 | + |
| 76 | +If successful, libraries & module files are located in lib and include respectively. |
| 77 | + |
| 78 | + |
| 79 | + |
| 80 | +1.3 Build SCHISM |
| 81 | + |
| 82 | +Follow https://schism-dev.github.io/schism/stable/getting-started/getting-sourcecode.html and https://schism-dev.github.io/schism/stable/getting-started/compilation.html#cmake to build schism libs. |
| 83 | + |
| 84 | +Note: schism_pdaf only support scribe-IO under fully parallel mode (all ensembles run concurrently), and OLDIO (schout output nc files) under flexible mode (ensembles members run in batches, for under-resourced platform). |
| 85 | + |
| 86 | +If users wish to use scribe-IO, build schism with OLDIO=OFF. If OLDIO is preferred, set OLDIO=ON. |
| 87 | + |
| 88 | +schism_pdaf also supports static domain decomposition without ParMetis (requires partition.prop as input). If this feature is used, set NO_PARMETIS=ON. |
| 89 | + |
| 90 | + |
| 91 | + |
| 92 | +1.4 Build schism_pdaf |
| 93 | + |
| 94 | +Get schism_pdaf code with the following: |
| 95 | + |
| 96 | +git clone https://github.com/schism-dev/schism-esmf.git |
| 97 | + |
| 98 | +Define macros for the following: |
| 99 | + |
| 100 | +export ESMFMKFILE= where ESMF lib is located |
| 101 | + |
| 102 | +export SCHISM_BUILD_DIR= where schism build is located |
| 103 | + |
| 104 | +export PDAF_LIB_DIR=where PDAF lib is located |
| 105 | + |
| 106 | +export SCHISM_NO_PARMETIS=off (If you wish to use static decomposition, then set it on) |
| 107 | + |
| 108 | +If any library like Intel-MKL, OpenBLAS, AOCL (AMD)… is used when compiling PDAF, remember to check LDFLAGS within corresponding compiler section in the beginning of Makefile, make sure linking path & compile options are correct. |
| 109 | + |
| 110 | +Then we can build schism_pdaf with the following: |
| 111 | + |
| 112 | +make distclean |
| 113 | + |
| 114 | +make pdaf |
| 115 | + |
| 116 | +If successful, an executable schism_pdaf will be there. |
| 117 | + |
| 118 | + |
| 119 | + |
| 120 | +2. Prepare the inputs |
| 121 | + |
| 122 | +The input files include: |
| 123 | + |
| 124 | +i. standard schism inputs, these files depend on user case setups |
| 125 | + |
| 126 | +ii. schism_pdaf control files |
| 127 | + |
| 128 | +schism_pdaf.cfg: control ensemble size, # of concurrent members, scribe cores (if used), ics_set (same as ics in param.nml: coordinate system) |
| 129 | + |
| 130 | + |
| 131 | + |
| 132 | + global.nml: control parameters for ESMF & PDAF coupling info, set starting date and run hours and DA steps. Note that the time origin info, duration and SCHISM time step need to be consistent with param.nml (under any ihot setting). Specify the DA interval with ‘num_schism_dt_in_couple’ (# of SCHISM steps when calling PDAF), and this value should always be identical as delt_obs in pdaf.nml. |
| 133 | + |
| 134 | + |
| 135 | + |
| 136 | +pdaf.nml: control pdaf parameters such as filter type, localization range…etc. |
| 137 | + |
| 138 | + |
| 139 | + |
| 140 | + |
| 141 | + |
| 142 | +iii. schism_pdaf ensemble inputs |
| 143 | + |
| 144 | +We follow suggestions from PDAF and use Pham’s method (2001) to generate ensemble information. More details can be found from https://pdaf.awi.de/trac/wiki/EnsembleGeneration . |
| 145 | + |
| 146 | +In summary, users can do a freerun (no DA) and extract its snapshots for EOFs analysis. Snapshots can be extracted with ncl scripts (extract2bin.ncl or extract2bin_scrio.ncl), and use generate_covar.F90 to generate required inputs as follows: |
| 147 | + |
| 148 | +eofs.dat: number of EOFs |
| 149 | + |
| 150 | +eofs.bin: EOFs matrix |
| 151 | + |
| 152 | +svd.bin: svd values from analysis |
| 153 | + |
| 154 | +meanstate.bin (optional): usually only used for twin experiments. |
| 155 | + |
| 156 | +Note: generate_covar.F90 is serial program. If any large case needs to be analyzed, large memory is required for analysis and long execution time should be expected. These utility scripts are located at src/PDAF_bindings/utility/gen_cov/ |
| 157 | + |
| 158 | + |
| 159 | + |
| 160 | +iv. DA_data: observation inputs, file naming is data_????????.dat (?s with i8.8 format with padding 0s, representing the SCHISM time steps). If the file does not exist, the code still runs with no DA done at that DA step. |
| 161 | + |
| 162 | +Currently, it supports 6 types of observation including: elevation(z), sea-level anomaly(a), temperature (t), salinity(s), u-velocity(u), and v-velocity(v). |
| 163 | + |
| 164 | +These are ascii files and their format are as follows: |
| 165 | + |
| 166 | + |
| 167 | + |
| 168 | +1st row is total number of observations, then followed by |
| 169 | + |
| 170 | +obs-type, X, Y, Z, obs-values, |
| 171 | + |
| 172 | +If rms_type=3, one extra column is needed for observation errors. Users can also specify uniform observation error with rms_type=1,2 in pdaf.nml. |
| 173 | + |
| 174 | + |
| 175 | + |
| 176 | +Fig: Working folder structures |
| 177 | + |
| 178 | +3. How to run it |
| 179 | + |
| 180 | +When inputs are ready, users need to create each ensemble folder with naming schism_??? (i3.3 format), and link schism input file inside. makedir.pl (under src/PDAF_bindings/utility) can be used to create each member outputs dir and link input files in each dir. |
| 181 | + |
| 182 | +Users also need to create folder DA_output with two subfolder a and f for storing DA outputs after/before the DA step, respectively. |
| 183 | + |
| 184 | + DA_output/a : Analysis (After DA) |
| 185 | + |
| 186 | + DA_output/f : Forecast (Before DA) |
| 187 | + |
| 188 | +To launch the run, users may need to add esmf lib path into LD_LIBRARY_PATH in the job script or environment, like the following: |
| 189 | + |
| 190 | +export LD_LIBRARY_PATH=$LD_LIBRARY_PATH: /where_esmf_installed/lib/libO/Linux.intel.64.openmpi.default/ |
| 191 | + |
| 192 | + |
| 193 | + |
| 194 | + The following configs are mandatory! |
| 195 | + |
| 196 | + For scribe-IO: set nc_out=1 in param.nml |
| 197 | + |
| 198 | + For OLDIO: set nc_out=0 in param.nml |
| 199 | + |
| 200 | + |
| 201 | + |
| 202 | +4.Check the outputs |
| 203 | + |
| 204 | +During the run, users can check job screen output which will show PDAF config information and DA status, as well as timing information. |
| 205 | + |
| 206 | +If users choose scribe-IO, scribe output will be located in each schism_???/outputs. |
| 207 | + |
| 208 | +DA_output/ will store ensemble-mean files in OLDIO format, and users need to combine them, and link local_to_global* from schism_001/outputs/ to perform the combine task. |
| 209 | + |
| 210 | +DA effects in schism_???/output/*.nc (either scribe or schout format) only can be seen after 2nd DA (if DA frequency = output frequency), since model state update always happens at the beginning of next DA cycle. If users need to check instantaneous DA result, it will be only under DA_output/a |
| 211 | + |
| 212 | +If DA frequency > output frequency, DA effects will be seen after 1st DA + 1 output step. |
0 commit comments