Hi all, I would like to do some tidal analysis with NEMO 4.2.x and the CPP key key_diaharm is now absent, assumingly because it is done vis XIOS. Can someone provide an example of how it is done now? Merci!
For completeness, I got an answer from Simon Mueller by email. The short answer is that one can check the AMM12 configuration for example of harmonic analysis setup.
In preparation for the harmonic analysis, the code in diamlr.F90 reads input from the XIOS xml files and compute over the course of the simulation the matrix (LHS) and writes it in a scalar XIOS output file. The same for the RHS which is a series of 2D fields. Then the python script in tools/DIAMLR/diamlr.py
is used to inverse the matrix, computes the solution to (x = A^(-1) y). The solution is written in an additional netcdf file *_diamlr_coeffs_*.nc
.
One retrieve the amplitude and phase of the analyzed tidal constituent as amp=sqrt(z1*z1+z2*z2)
and phi=atan2(-z2,z1)*radiant_to_degree
where I have renamed the two components in the analyzed file z1
ans z2
for simplicity.
Simon will update the manual in the future for documenting the procedure.
(From Simon MĂĽller)
Currently, there is, admittedly, inadequate documentation of the multiple linear regression facility in NEMO (DIAMLR) that replaced the “diaharm” approach in the NEMO user guide. That will be added for NEMO version 5. However, an example of using DIAMLR is built into the AMM12 reference configuration (and thus run in SETTE routinely), so
$ ./makenemo -r AMM12 -n MY_AMM12 -j 8
should set up everything required to demonstrate, and running the default configuration should produce the relevant intermediate files (output files with diamlr
in their name; for the definition of the regressors, M2/K1/offset
in the example, and a selection of output fields for analysis, ssh/uoce/voce/toce
in the example. Please see field group diamlr_fields
in file:
cfgs/AMM12/EXPREF/context_nemo.xml
where placeholders (__TDE_<component>_<type>__
) are used to effect substitution, at run-time, by model-supplied values for omega/phase/amplitude of individual components).
Regression coefficients can then be computed from the intermediate files using the script:
tools/DIAMLR/diamlr.py
Please note that the intermediate files effectively contain timeseries of scalar products (field-regressor and regressor-regressor) over specified intervals (1 day in the example) and can thus be curtailed or combined (e.g. across several restart files) before running the script.