This file contains the modifications of the ``official'' MOM5
distribution, commit af3a94d40f21a4b7fd925d13b928f8721ad7d4c8
on Mon Oct 26 12:53:18 2020 +1100 for the code used for the paper:
Katzenberg, A., Levermann, A., Petri, S., Feulner, G.: Monsoon planet:
Bimodal rainfall distribution due to barrier-structure in pressure
field. Paper in writing.
Note that the updates for the ``official'' MOM5 repository after this
referred-to commit are mostly irrelevant for this paper and project,
except for a few bug fixes mentioned below. Thus, later versions of
MOM5 are expected to yield equivalent results.
To re-create the full modified source code:
1. Get the ``official'' MOM5 code from
https://github.com/mom-ocean/MOM5/commit/af3a94d40f21a4b7fd925d13b928f8721ad7d4c8 :
mkdir MonsoonPlanet
cd MonsoonPlanet
git clone https://github.com/mom-ocean/MOM5.git .
git checkout af3a94d40f21a4b7fd925d13b928f8721ad7d4c8
cd ..
git clone https://github.com/NOAA-GFDL/SM2.git
cp -av SM2/src/ocean_slab MonsoonPlanet/src/ocean_mixed_layer
2. apply this file as patch:
patch < diff-mom5-af3a94d4-MonsoonPlanet-Code.txt
Overview of the modifications:
- environment definitions and makefile templates
for the PIK HLRS2015 cluster
- mkmf script: improved handling of include files;
added handling of C++ source code;
improved TAGS generation;
- slight improvements to compile scripts for component libraries,
mostly to circumvent compiler bugs.
- augmented diagnostics in coupler interfaces
- Bug fix in src/atmos_fv_dynamics/tools/fv_restart.F90
taken from
https://github.com/mom-ocean/MOM5/commit/486c603710bc79335bbae78ce24c5bbd66a1190e
- Bug fix in src/atmos_param/physics_driver/physics_driver.F90,
dont access unallocated arrays. See also
https://github.com/mom-ocean/MOM5/commit/84f3c400d437563e02a28e0ecd30e555169eaf9b
- disambiguate subroutine names in isccp_cloud modules
- src/shared/mpp/include/mpp_global_sum.h: avoid access to
uninitialized array elements.
See https://groups.google.com/g/mom-users/c/U88ej4JpKFs
- src/shared/mpp/include/mpp_io_util.inc:
Avoid accessing unallocated data elements.
- src/shared/mpp/include/mpp_io_write.inc: write NetCDF attribute
'axis' to improve CF conventions compatibility.
- merge code for slab ocean model from
https://github.com/NOAA-GFDL/SM2.git and adapt it to compile with
this version of the FMS coupler.
diff -ur --unidirectional-new-file -b -E -Z -x CM2.1p1 -x StripedPlanet -x atmos_bgrid -x atmos_ebm -x land_lad2 -x mom5 -x generic_tracers /p/tmp/petri/mom5-af3a94d4/bin/mkmf MonsoonPlanet/bin/mkmf
--- /p/tmp/petri/mom5-af3a94d4/bin/mkmf 2014-03-18 14:03:56.000000000 +0100
+++ MonsoonPlanet/bin/mkmf 2021-03-31 13:53:54.438035758 +0200
@@ -58,8 +58,8 @@
my @list;
#some constants
my $endline = $/;
-my @src_suffixes = ( q/\.F/, q/\.F90/, q/\.c/, q/\.f/, q/\.f90/ );
-my @inc_suffixes = ( q/\.H/, q/\.fh/, q/\.h/, q/\.inc/, q/\.h90/ );
+my @src_suffixes = ( q/\.F/, q/\.F90/, q/\.c/, q/\.cc/, q/\.cpp/, q/\.f/, q/\.f90/ );
+my @inc_suffixes = ( q/\.H/, q/\.fh/, q/\.h/, q/\.hh/, q/\.inc/, q/\.h90/ );
# push @inc_suffixes, @src_suffixes; # sourcefiles can be includefiles too: DISALLOW, 6 May 2004
# suffixes for the target (mkmf -p): if isn't on the list below it's a program
my @tgt_suffixes = ( q/\.a/ );
@@ -68,6 +68,8 @@
q/.F/ => q/$(FC) $(CPPDEFS) $(CPPFLAGS) $(FPPFLAGS) $(FFLAGS) $(OTHERFLAGS) -c/,
q/.F90/ => q/$(FC) $(CPPDEFS) $(CPPFLAGS) $(FPPFLAGS) $(FFLAGS) $(OTHERFLAGS) -c/,
q/.c/ => q/$(CC) $(CPPDEFS) $(CPPFLAGS) $(CFLAGS) $(OTHERFLAGS) -c/,
+ q/.cc/ => q/$(CXX) $(CPPDEFS) $(CPPFLAGS) $(CXXFLAGS) $(OTHERFLAGS) -c/,
+ q/.cpp/ => q/$(CXX) $(CPPDEFS) $(CPPFLAGS) $(CXXFLAGS) $(OTHERFLAGS) -c/,
q/.f/ => q/$(FC) $(FFLAGS) $(OTHERFLAGS) -c/,
q/.f90/ => q/$(FC) $(FFLAGS) $(OTHERFLAGS) -c/ );
my %delim_match = ( q/'/ => q/'/, # hash to find includefile delimiter pair
@@ -117,6 +119,18 @@
print MAKEFILE "\n.DEFAULT:\n\t-echo \$@ does not exist.\n";
print MAKEFILE "all: $opt_p\n"; # first target should be program, so you can type just 'make'
+# look for -I specifications
+my @opt_incdirs;
+foreach ( split /\s+/, $opt_o ) {
+ print 'DEBUG: looking at opt_o ', $_ , "\n" if ( $opt_d );
+ if ( /^-I/ ) {
+ s/^-I// ;
+ print 'DEBUG: opt_incdirs adding ', $_, "\n" if ( $opt_d );
+ @opt_incdirs = ( @opt_incdirs, " ", $_ );
+ }
+}
+print 'DEBUG: opt_incdirs = ', @opt_incdirs , "\n" if ( $opt_d );
+
#if cppdefs flag is present, look for changes in cppdefs
my %chgdefs;
if ( $opt_c ) {
@@ -394,13 +408,13 @@
my $file = shift;
foreach ( split /\s+/, $includes_in{$file} ) {
print "object=$object, file=$file, include=$_.\n" if $opt_d;
- ( $incname, $incpath, $incsuffix ) = fileparse( $_, @inc_suffixes );
+ ( $incname, $incpath, $incsuffix ) = fileparse( $_, ( @inc_suffixes , @src_suffixes ));
if( $incsuffix ) { # only check for files with proper suffix
undef $incpath if $incpath eq './';
if( $incpath =~ /^\// ) {
@paths = $incpath; # exact incpath specified, use it
} else {
- @paths = @dirs;
+ @paths = (dirname($file), @dirs, @opt_incdirs);
}
foreach ( @paths ) {
local $/ = '/'; chomp; # remove trailing / if present
@@ -435,7 +449,7 @@
foreach ( keys %off_sources ) {
my $file = basename($_);
$file =~ s/\$\(SRCROOT\)//;
- print MAKEFILE "./$file: $_\n\tcp $_ .\n";
+ print MAKEFILE "./$file: $_\n\tcp -p $_ .\n";
}
#objects not used by other objects
@@ -456,8 +470,8 @@
#write targets
print MAKEFILE "clean: neat\n\t-rm -f .$opt_p.cppdefs \$(OBJ) $opt_p\n";
print MAKEFILE "neat:\n\t-rm -f \$(TMPFILES)\n";
-print MAKEFILE "localize: \$(OFF)\n\tcp \$(OFF) .\n" if $noff > 0;
-print MAKEFILE "TAGS: \$(SRC)\n\tetags \$(SRC)\n";
+print MAKEFILE "localize: \$(OFF)\n\tcp -p \$(OFF) .\n" if $noff > 0;
+print MAKEFILE "TAGS: \$(SRC)\n\tetags --regex='/^[ \t]*interface[ \t]+[^ \t(]+/i' --regex='/^[ \t]*type[ \t]+[^ \t(]+/i' \$(SRC)\n";
print MAKEFILE "tags: \$(SRC)\n\tctags \$(SRC)\n";
( $name, $path, $suffix ) = fileparse( $opt_p, @tgt_suffixes );
if( $suffix eq '.a' ) {
diff -ur --unidirectional-new-file -b -E -Z -x CM2.1p1 -x StripedPlanet -x atmos_bgrid -x atmos_ebm -x land_lad2 -x mom5 -x generic_tracers /p/tmp/petri/mom5-af3a94d4/bin/mkmf.html MonsoonPlanet/bin/mkmf.html
--- /p/tmp/petri/mom5-af3a94d4/bin/mkmf.html 2014-03-18 14:03:56.000000000 +0100
+++ MonsoonPlanet/bin/mkmf.html 2021-03-31 13:53:54.411370015 +0200
@@ -100,9 +100,9 @@
Makefile structure:
A sourcefile is any file with a source file suffix
-(currently .F, .F90, .c, .f. .f90). An includefile is
-any file with an include file suffix (currently .H, .fh, .h,
-.inc). A valid sourcefile can also be an includefile.
+(currently .F, .F90, .c, .cc, .cpp, .f. .f90). An includefile is
+any file with an include file suffix (currently .H, .fh, .h, .hh,
+.inc, .h90). A valid sourcefile can also be an includefile.
Each sourcefile in the list is presumed to produce an object file
with the same basename and a .o extension in the current
@@ -118,12 +118,12 @@
match invalidating all subsequent ones. See the Examples section for a closer look at precedence rules.
-
The makefile currently runs $(FC) on fortran files
-and $(CC) on C files. Flags to the compiler can be set
-in $(FFLAGS) or $(CFLAGS). The final
+
The makefile currently runs $(FC) on fortran files,
+$(CC) on C files and $(CXX) on C++ files. Flags to the compiler can be set
+in $(FFLAGS) or $(CFLAGS) or . The final
loader step executes $(LD). Flags to the loader can be
set in $(LDFLAGS). Preprocessor flags are used by
-.F, .F90 and .c files,
+.F, .F90, .c, .cc and .cpp files,
and can be set in $(CPPFLAGS). These macros have a
default meaning on most systems, and can be modified in the template
file. The predefined macros can be discovered by running make
diff -ur --unidirectional-new-file -b -E -Z -x CM2.1p1 -x StripedPlanet -x atmos_bgrid -x atmos_ebm -x land_lad2 -x mom5 -x generic_tracers /p/tmp/petri/mom5-af3a94d4/bin/environs.pik-hlrs2015-ifort MonsoonPlanet/bin/environs.pik-hlrs2015-ifort
--- /p/tmp/petri/mom5-af3a94d4/bin/environs.pik-hlrs2015-ifort 1970-01-01 01:00:00.000000000 +0100
+++ MonsoonPlanet/bin/environs.pik-hlrs2015-ifort 2021-02-26 17:09:03.164943000 +0100
@@ -0,0 +1,32 @@
+# modules must be loaded by the user in the invoking shell already!
+#source /opt/modules/default/init/tcsh
+#module purge
+#module load compiler/intel/15.0.3
+# sigh. the current module definitions to contain ITAC_ROOT
+#if ( -f $I_MPI_ROOT/../../itac_latest/bin/itacvars.csh ) \
+# source $I_MPI_ROOT/../../itac_latest/bin/itacvars.csh
+#module load mpi/intel/5.0.3.048
+#module load netcdf-fortran/4.4.2/impi
+#module load netcdf-cxx-42/4.3.3/ipmi
+#module load udunits/2.2.19
+#setenv MALLOC_CHECK_ 0
+#setenv MPI_COREDUMP_DEBUGGER `which idb`
+
+#setenv NETCDFINCLUDE "-I$NETCDF_FORTRANROOT/include -I$NETCDF_CXXROOT/include -I$NETCDF_CROOT/include"
+#setenv NETCDFLIBPATH "-L$NETCDF_CXXROOT/lib -L$NETCDF_FORTRANROOT/lib64 -L$NETCDF_CROOT/lib64 -lnetcdf_c++ -lnetcdff -lnetcdf -L$HDF5ROOT/lib -lhdf5 -lhdf5_hl -L$UDUNITSROOT/lib -ludunits2 -lstdc++"
+
+#setenv NETCDFINCLUDE -I/home/petri/netcdf-4.2.1.1-intel15/include
+#setenv NETCDFLIBPATH "-L/home/petri/netcdf-4.2.1.1-intel15/lib -lnetcdf_c++ -lnetcdff -lnetcdf -L/home/petri/hdf5-1.8.9-intel15/lib -lhdf5_hl -lhdf5 -lz -L$UDUNITSROOT/lib -ludunits2 -lstdc++ -L$CURLROOT/lib -lcurl"
+# Use system-provided curl to avoid exaggerated dependencies.
+# Problem: curl-devel is installed only on the vis-servers, not on login nodes.
+#setenv NETCDFLIBPATH "-L/home/petri/netcdf-4.2.1.1-intel15/lib -lnetcdf_c++ -lnetcdff -lnetcdf -L/home/petri/hdf5-1.8.9-intel15/lib -lhdf5_hl -lhdf5 -lz -L$UDUNITSROOT/lib -ludunits2 -lstdc++ -lcurl"
+
+setenv NETCDFINCLUDE -I/home/petri/netcdf-4.7.4-intel15/include
+setenv NETCDFLIBPATH "-L/home/petri/netcdf-4.7.4-intel15/lib -lnetcdf_c++ -lnetcdff -lnetcdf -L/home/petri/hdf5-1.10.6-intel15/lib -lhdf5_hl -lhdf5 -lz -L$UDUNITSROOT/lib -ludunits2 -lstdc++"
+
+setenv CC icc
+alias gmake gmake -j 4
+
+#setenv SCALASCA_DIR /home/petri
+
+#setenv mpirunCommand "mpirun -np"
diff -ur --unidirectional-new-file -b -E -Z -x CM2.1p1 -x StripedPlanet -x atmos_bgrid -x atmos_ebm -x land_lad2 -x mom5 -x generic_tracers /p/tmp/petri/mom5-af3a94d4/bin/mkmf.template.pik-hlrs2015-ifort MonsoonPlanet/bin/mkmf.template.pik-hlrs2015-ifort
--- /p/tmp/petri/mom5-af3a94d4/bin/mkmf.template.pik-hlrs2015-ifort 1970-01-01 01:00:00.000000000 +0100
+++ MonsoonPlanet/bin/mkmf.template.pik-hlrs2015-ifort 2021-03-31 13:53:54.436771167 +0200
@@ -0,0 +1,215 @@
+# -*-makefile-*-
+# template for the Intel fortran compiler version 15ff with Intel MPI on the PIK HLRS2015 cluster
+# typical use with mkmf
+# mkmf -t template.ifc -c"-Duse_libMPI -Duse_netCDF" path_names /usr/local/include
+
+# -fpp : run the Fortran preprocessor before compilation
+# -fno-alias : If you do not want aliasing to be assumed in the program
+# -stack_temps : allocate space for temporary arrays on the runtime stack
+# -safe-cray-ptr : Cray* pointers do not alias other variables.
+# -ftz : Flushes denormal results to zero.
+# This option flushes denormal results to zero when the
+# application is in the gradual underflow mode. It may
+# improve performance if the denormal values are not criti
+# cal to your application's behavior.
+#
+# If this option produces undesirable results of the numeri
+# cal behavior of your program, you can turn the FTZ/DAZ
+# mode off by using -no-ftz or /Qftz- in the command line
+# while still benefiting from the O3 optimizations.
+#
+# NOTE: Options -ftz and /Qftz are performance options. Set
+# ting these options does not guarantee that all denormals
+# in a program are flushed to zero. They only cause denor
+# mals generated at run time to be flushed to zero.
+# -shared-intel: Causes Intel-provided libraries to be linked in dynamically.
+# -assume byterecl : the units for the OPEN statement RECL specifier
+# (record length) value are in bytes for unformatted data,
+# not longwords
+# -Wp,-w : pass option -p to the preprocessor
+# Prevents warnings from being output.
+# -sox : save the compilation options and version number in the executable
+FFLAGS_BASE = -fpp -fno-alias -stack_temps -safe_cray_ptr -ftz -shared-intel -assume byterecl -g -i4 -r8 -Wp,-w -sox
+
+# -fltconsistency : Enables improved floating-point consistency.
+# This option enables improved floating-point consistency
+# and may slightly reduce execution speed. It limits float
+# ing-point optimizations and maintains declared precision.
+# It also disables inlining of math library functions.
+#
+# - Even if vectorization is enabled by the -x options, the
+# compiler does not vectorize reduction loops (loops
+# computing the dot product) and loops with mixed
+# precision types. Similarly, the compiler does not
+# enable certain loop transformations. For example,
+# the compiler does not transform reduction loops to
+# perform partial summation or loop interchange.
+#
+# This option causes performance degradation relative to
+# using default floating-point optimization flags.
+# The recommended method to control the semantics of float
+# ing-point calculations is to use option -fp-model
+#FFLAGS_REPRO = -fltconsistency
+#
+# -fp-model precise Disables optimizations that are not value-safe [..]
+# These semantics ensure the reproducibility of floating-point computations
+# for serial code, including code vectorized or auto-parallelized by the compiler
+# Run-to-run reproducibility for floating-point reductions in OpenMP* code may be obtained for
+# a fixed number of threads through the KMP_DETERMINISTIC_REDUCTION environment variable. For
+# more information about this environment variable, see Supported Environment Variables
+FFLAGS_REPRO = -fp-model precise
+#
+## Su-Bong Lee wrote on 13.3.2012:
+## I also did experiment using "-fp_model precise" option with "-O2",
+## Then the outputs from two identical restart run were the same.
+## Marshall Ward answered:
+## We are seeing similar issues on our machine in Australia using the intel
+## compilers (with -O2).
+##
+## On single CPU submissions of the bowl1 experiment, we saw two different
+## solutions, on the order of floating point error. The answer we get is
+## quasi-random, with no clear explanation.
+##
+## As Swathi recommends, using '-fp-model precise' gives a third solution
+## different from the other two, which we can reproduce consistently. Using
+## -fltconsistency did not address the issue for us either. This link
+## suggests Intel may soon deprecate -fltconsistency: http://goo.gl/IPBkH
+
+## -fp-model consistent generate code that will give consistent,
+## reproducible floating-point results for different optimization
+## levels or between different processors of the same architecture.
+## See the article titled: Consistency of Floating-Point Results using the Intel(R) Compiler
+## http://software.intel.com/en-us/articles/consistency-of-floating-point-results-using-the-intel-compiler/
+##
+## [..] Dynamic variations in heap alignment can lead to variations in
+## floating-point results in a similar manner. Such variations in alignment
+## typically arise from memory allocations that depend on the external
+## environment. They can be prevented from causing variations in floating-point
+## results by building with -fp-model precise, or by explicit alignment of data
+## arrays. Starting from the version 15 compiler, such run-to-run variations can
+## also be prevented by compiling with -qno-opt-dynamic-align, which is expected
+## to have much less impact on performance than -fp-model precise.
+## SIGH. With ifort 15 this option seems to be buggy. Use -fp-model precise instead.
+## With ifort 17.0.1 it works better
+#FFLAGS_REPRO = -qno-opt-dynamic-align
+#FFLAGS_REPRO = -fp-model precise -qno-opt-dynamic-align
+
+# Run-to-run reproducibility for floating-point reductions in OpenMP
+# code may be obtained for a fixed number of threads through the
+# KMP_DETERMINISTIC_REDUCTION environment variable.
+# KMP_DETERMINISTIC_REDUCTION
+# Enables (true) or disables (false) the use of a specific ordering of the
+# reduction operations for implementing the reduction clause for an OpenMP*
+# parallel region. This has the effect that, for a given number of threads, in a
+# given parallel region, for a given data set and reduction operation, a floating
+# point reduction done for an OpenMP* reduction clause has a consistent floating
+# point result from run to run, since round-off errors are identical.
+
+
+# -check : Checks for certain conditions at run time.
+# -check all : is the same as specifying check with no keyword
+# -check bounds : compile-time and run-time checking for array subscripts
+# -check arg_temp_created: Determines whether checking occurs for actual
+# arguments before routine calls.
+# -WB : Turns a compile-time bounds check into a warning.
+# -inline_debug_info : use -debug inline-debug-info
+# -fpe0 : Floating-point invalid, divide-by-zero, and overflow exceptions
+# are enabled. If any such exceptions occur, execution is aborted.
+# This option sets the -ftz ; therefore underflow results will be set
+# to zero unless you explicitly specify -no-ftz
+# -fpe3 : (default) All floating-point exceptions are disabled.
+# Floating-point underflow is gradual
+# -ftrapuv : Initializes stack local variables to an unusual value to aid error detection.
+# -fp-stack-check : generate extra code after every function call
+# By default, there is no checking. So when the FP stack
+# overflows, a NaN value is put into FP calculations and the
+# program's results differ. Unfortunately, the overflow
+# point can be far away from the point of the actual bug.
+# This option places code that causes an access violation
+# exception immediately after an incorrect call occurs, thus
+# making it easier to locate these issues.
+
+# -traceback should not cause runtime overhead (?), thus we want it for production also
+FFLAGS_DEBUG = -warn -warn noerrors -traceback
+#FFLAGS_DEBUG += -warn nointerfaces
+# options that possibly create runtime overhead, thus should be used during development
+# but nor for production.
+#FFLAGS_DEBUG += -check bounds -WB
+#FFLAGS_DEBUG += -check all -WB
+#FFLAGS_DEBUG += -check all\,noarg_temp_created -WB
+#FFLAGS_DEBUG += -fpe0 -ftrapuv
+#FFLAGS_DEBUG += -init=snan -init=arrays
+#FFLAGS_DEBUG += -debug variable_locations -debug-parameters -debug inline-debug-info
+
+FFLAGS_OPT = -O2 -no-vec # default from GFDL . need -no-vec to gain bit-wise repeatability
+#FFLAGS_OPT = -O2 #
+#FFLAGS_OPT = -O2 -xHost # vectorization makes repeated runs non-deterministic
+#FFLAGS_OPT = -O3 -no-vec # minimal speed improvement at cost of more rounding differences
+#FFLAGS_OPT = -O3 -xSSE4.1 # makes repeated runs non-deterministic
+#FFLAGS_OPT = -O3 -xHost -ipo # vectorization makes repeated runs non-deterministic
+#FFLAGS_OPT = -O3 -xHost # vectorization makes repeated runs non-deterministic
+#FFLAGS_OPT = -O3 # vectorization makes repeated runs non-deterministic
+
+FFLAGS = $(FFLAGS_BASE) $(FFLAGS_REPRO) $(FFLAGS_OPT) $(FFLAGS_DEBUG)
+
+# -Wremarks is needed for ifort >= 12 to turn on remarks
+# -diag-disable : turn off some annoying remarks
+# remark #1: last line of file ends without a newline
+# remark #981: operands are evaluated in unspecified order
+# remark #1418: external function definition with no prior declaration
+# remark #1419: external declaration in primary source file
+# remark #1572: floating-point equality and inequality comparisons are unreliable
+# remark #1782 : #pragma once is obsolete
+# warning #3180: unrecognized OpenMP #pragma
+# warning #5194: Source line truncated
+# warning #6717: This name has not been given an explicit type
+
+CXXFLAGS_BASE = -Wall -Wremarks -g -debug inline-debug-info -debug extended
+CXXFLAGS_BASE += -diag-disable 1,981,1782,1572,1418,1419,3180 # ,5194,6717
+CXXFLAGS_BASE += -ftz -fno-exceptions
+CXXFLAGS_BASE += -no-inline-factor
+#CXXFLAGS_BASE += -DONLY_TRANSPORT_ON_REDUCED_GRID
+CXXFLAGS_REPRO = $(FFLAGS_REPRO) # make it consistent with F90 compilation.
+CXXFLAGS_OPT = -O2 -no-vec # default from GFDL
+#CXXFLAGS_OPT = -O3 -xHOST
+#CXXFLAGS_OPT = -DNDEBUG # removes assertions. Greatly improves speed, but must be used only after extensive testing
+# -traceback should not cause runtime overhead (?), thus we want it for production also
+CXXFLAGS_DEBUG = -traceback
+# options that create runtime overhead, not desirable for production runs
+#CXXFLAGS_DEBUG += -check-uninit -ftrapuv -fstack-security-check
+CXXFLAGS = $(CXXFLAGS_BASE) $(CXXFLAGS_REPRO) $(CXXFLAGS_OPT) $(CXXFLAGS_DEBUG)
+
+CPPFLAGS = -I/home/petri/netcdf-4.2.1.1-intel15/include
+FC = mpiifort
+LD = mpiifort
+CC = mpiicc
+CXX= mpiicpc
+# when -g is given to the linking step, Intel will use the debugging version of the MPI library.
+# Thus, for production performance, link without -g
+# -sox Tells the compiler to save the compilation options and
+# version number in the Linux* OS executable
+# to enable debugging, we must prevent IPO
+LDFLAGS = -sox -g $(FFLAGS_REPRO) $(NETCDFLIBPATH) -traceback
+#LDFLAGS += -no-ipo
+#LDFLAGS += -lchkp -lchkpwrap
+#LDFLAGS += -lmcheck
+#LDFLAGS = -L/home/petri/netcdf-4.2.1.1-intel15/lib -lnetcdf_c++ -lnetcdff -lnetcdf -L/home/petri/hdf5-1.8.9-intel15/lib -lhdf5_hl -lhdf5 -lz -L$(UDUNITSROOT)/lib -ludunits2 -lstdc++
+
+CFLAGS_BASE = -D__IFC -g -Wall -Wremarks
+CFLAGS_REPRO = $(FFLAGS_REPRO)
+CFLAGS_DEBUG = -traceback
+# options that create runtime overhead, not desirable for production runs
+#CFLAGS_DEBUG += -check-uninit -ftrapuv
+#CFLAGS_DEBUG += -check=stack\,uninit -check-pointers=rw -check-pointers-dangling=all -fstack-security-check
+CFLAGS_OPT = -O2 -no-vec
+#CFLAGS_OPT = -O3 -xHOST
+#CFLAGS_OPT += -DNDEBUG
+CFLAGS = $(CFLAGS_BASE) $(CFLAGS_REPRO) $(CFLAGS_DEBUG) $(CFLAGS_OPT)
+
+#LPJ_OPTFLAGS= -O3 -ipo -xHOST -no-prec-div -traceback
+LPJ_OPTFLAGS= -O2 -no-ipo -traceback
+#LPJ_OPTFLAGS= -g -no-ipo -traceback
+
+# the Intel compiler requires that libraries are built using xiar if -ipo is used as compiler / linker option.
+# LPJ wants that option, thus we need xiar here.
+AR = xiar
diff -ur --unidirectional-new-file -b -E -Z -x CM2.1p1 -x StripedPlanet -x atmos_bgrid -x atmos_ebm -x land_lad2 -x mom5 -x generic_tracers /p/tmp/petri/mom5-af3a94d4/bin/mkmf.template.pik-hlrs2015-ifort-debug MonsoonPlanet/bin/mkmf.template.pik-hlrs2015-ifort-debug
--- /p/tmp/petri/mom5-af3a94d4/bin/mkmf.template.pik-hlrs2015-ifort-debug 1970-01-01 01:00:00.000000000 +0100
+++ MonsoonPlanet/bin/mkmf.template.pik-hlrs2015-ifort-debug 2021-03-31 13:53:54.394561260 +0200
@@ -0,0 +1,221 @@
+# -*-makefile-*-
+# template for the Intel fortran compiler version 15ff with Intel MPI on the PIK HLRS2015 cluster
+# typical use with mkmf
+# mkmf -t template.ifc -c"-Duse_libMPI -Duse_netCDF" path_names /usr/local/include
+
+# -fpp : run the Fortran preprocessor before compilation
+# -fno-alias : If you do not want aliasing to be assumed in the program
+# -stack_temps : allocate space for temporary arrays on the runtime stack
+# -safe-cray-ptr : Cray* pointers do not alias other variables.
+# -ftz : Flushes denormal results to zero.
+# This option flushes denormal results to zero when the
+# application is in the gradual underflow mode. It may
+# improve performance if the denormal values are not criti
+# cal to your application's behavior.
+#
+# If this option produces undesirable results of the numeri
+# cal behavior of your program, you can turn the FTZ/DAZ
+# mode off by using -no-ftz or /Qftz- in the command line
+# while still benefiting from the O3 optimizations.
+#
+# NOTE: Options -ftz and /Qftz are performance options. Set
+# ting these options does not guarantee that all denormals
+# in a program are flushed to zero. They only cause denor
+# mals generated at run time to be flushed to zero.
+# -shared-intel: Causes Intel-provided libraries to be linked in dynamically.
+# -assume byterecl : the units for the OPEN statement RECL specifier
+# (record length) value are in bytes for unformatted data,
+# not longwords
+# -Wp,-w : pass option -p to the preprocessor
+# Prevents warnings from being output.
+# -sox : save the compilation options and version number in the executable
+FFLAGS_BASE = -fpp -fno-alias -stack_temps -safe_cray_ptr -ftz -shared-intel -assume byterecl -g -i4 -r8 -Wp,-w -sox
+
+# -fltconsistency : Enables improved floating-point consistency.
+# This option enables improved floating-point consistency
+# and may slightly reduce execution speed. It limits float
+# ing-point optimizations and maintains declared precision.
+# It also disables inlining of math library functions.
+#
+# - Even if vectorization is enabled by the -x options, the
+# compiler does not vectorize reduction loops (loops
+# computing the dot product) and loops with mixed
+# precision types. Similarly, the compiler does not
+# enable certain loop transformations. For example,
+# the compiler does not transform reduction loops to
+# perform partial summation or loop interchange.
+#
+# This option causes performance degradation relative to
+# using default floating-point optimization flags.
+# The recommended method to control the semantics of float
+# ing-point calculations is to use option -fp-model
+FFLAGS_REPRO = -fltconsistency
+#
+# -fp-model precise Disables optimizations that are not value-safe [..]
+# These semantics ensure the reproducibility of floating-point computations
+# for serial code, including code vectorized or auto-parallelized by the compiler
+# Run-to-run reproducibility for floating-point reductions in OpenMP* code may be obtained for
+# a fixed number of threads through the KMP_DETERMINISTIC_REDUCTION environment variable. For
+# more information about this environment variable, see Supported Environment Variables
+#FFLAGS_REPRO = -fp-model precise
+#
+## Su-Bong Lee wrote on 13.3.2012:
+## I also did experiment using "-fp_model precise" option with "-O2",
+## Then the outputs from two identical restart run were the same.
+## Marshall Ward answered:
+## We are seeing similar issues on our machine in Australia using the intel
+## compilers (with -O2).
+##
+## On single CPU submissions of the bowl1 experiment, we saw two different
+## solutions, on the order of floating point error. The answer we get is
+## quasi-random, with no clear explanation.
+##
+## As Swathi recommends, using '-fp-model precise' gives a third solution
+## different from the other two, which we can reproduce consistently. Using
+## -fltconsistency did not address the issue for us either. This link
+## suggests Intel may soon deprecate -fltconsistency: http://goo.gl/IPBkH
+
+## -fp-model consistent generate code that will give consistent,
+## reproducible floating-point results for different optimization
+## levels or between different processors of the same architecture.
+## See the article titled: Consistency of Floating-Point Results using the Intel(R) Compiler
+## http://software.intel.com/en-us/articles/consistency-of-floating-point-results-using-the-intel-compiler/
+##
+## [..] Dynamic variations in heap alignment can lead to variations in
+## floating-point results in a similar manner. Such variations in alignment
+## typically arise from memory allocations that depend on the external
+## environment. They can be prevented from causing variations in floating-point
+## results by building with -fp-model precise, or by explicit alignment of data
+## arrays. Starting from the version 15 compiler, such run-to-run variations can
+## also be prevented by compiling with -qno-opt-dynamic-align, which is expected
+## to have much less impact on performance than -fp-model precise.
+## SIGH. With ifort 15 this option seems to be buggy. Use -fp-model precise instead.
+## With ifort 17.0.1 it works better
+FFLAGS_REPRO = -qno-opt-dynamic-align
+#FFLAGS_REPRO = -fp-model precise -qno-opt-dynamic-align
+
+# Run-to-run reproducibility for floating-point reductions in OpenMP
+# code may be obtained for a fixed number of threads through the
+# KMP_DETERMINISTIC_REDUCTION environment variable.
+# KMP_DETERMINISTIC_REDUCTION
+# Enables (true) or disables (false) the use of a specific ordering of the
+# reduction operations for implementing the reduction clause for an OpenMP*
+# parallel region. This has the effect that, for a given number of threads, in a
+# given parallel region, for a given data set and reduction operation, a floating
+# point reduction done for an OpenMP* reduction clause has a consistent floating
+# point result from run to run, since round-off errors are identical.
+
+
+# -check : Checks for certain conditions at run time.
+# -check all : is the same as specifying check with no keyword
+# -check bounds : compile-time and run-time checking for array subscripts
+# -check arg_temp_created: Determines whether checking occurs for actual
+# arguments before routine calls.
+# -WB : Turns a compile-time bounds check into a warning.
+# -inline_debug_info : use -debug inline-debug-info
+# -fpe0 : Floating-point invalid, divide-by-zero, and overflow exceptions
+# are enabled. If any such exceptions occur, execution is aborted.
+# This option sets the -ftz ; therefore underflow results will be set
+# to zero unless you explicitly specify -no-ftz
+# -fpe3 : (default) All floating-point exceptions are disabled.
+# Floating-point underflow is gradual
+# -ftrapuv : Initializes stack local variables to an unusual value to aid error detection.
+# -fp-stack-check : generate extra code after every function call
+# By default, there is no checking. So when the FP stack
+# overflows, a NaN value is put into FP calculations and the
+# program's results differ. Unfortunately, the overflow
+# point can be far away from the point of the actual bug.
+# This option places code that causes an access violation
+# exception immediately after an incorrect call occurs, thus
+# making it easier to locate these issues.
+
+# -traceback should not cause runtime overhead (?), thus we want it for production also
+FFLAGS_DEBUG = -warn -warn noerrors -traceback
+#FFLAGS_DEBUG += -warn nointerfaces
+# options that possibly create runtime overhead, thus should be used during development
+# but nor for production.
+#FFLAGS_DEBUG += -check bounds -WB
+FFLAGS_DEBUG += -check all -WB
+#FFLAGS_DEBUG += -check all\,noarg_temp_created -WB
+#FFLAGS_DEBUG += -fpe0 -ftrapuv
+FFLAGS_DEBUG += -init=snan -init=arrays
+#FFLAGS_DEBUG += -debug variable_locations -debug-parameters -debug inline-debug-info
+
+FFLAGS_OPT = -O0
+#FFLAGS_OPT = -O2 -no-vec # default from GFDL
+#FFLAGS_OPT = -O3 -no-vec # minimal speed improvement at cost of more rounding differences
+#FFLAGS_OPT = -O3 -xSSE4.1 # makes repeated runs non-deterministic
+
+FFLAGS = $(FFLAGS_BASE) $(FFLAGS_REPRO) $(FFLAGS_OPT) $(FFLAGS_DEBUG)
+
+# -Wremarks is needed for ifort >= 12 to turn on remarks
+# -diag-disable : turn off some annoying remarks
+# remark #1: last line of file ends without a newline
+# remark #981: operands are evaluated in unspecified order
+# remark #1418: external function definition with no prior declaration
+# remark #1419: external declaration in primary source file
+# remark #1572: floating-point equality and inequality comparisons are unreliable
+# remark #1782 : #pragma once is obsolete
+# warning #3180: unrecognized OpenMP #pragma
+# warning #5194: Source line truncated
+# warning #6717: This name has not been given an explicit type
+
+CXXFLAGS_BASE = -Wall -Wremarks -g -debug inline-debug-info -debug extended
+CXXFLAGS_BASE += -diag-disable 1,981,1782,1572,1418,1419,3180 # ,5194,6717
+CXXFLAGS_BASE += -ftz -fno-exceptions
+#CXXFLAGS_BASE += -no-inline-factor
+#CXXFLAGS_BASE+= -DONLY_TRANSPORT_ON_REDUCED_GRID
+CXXFLAGS_REPRO = $(FFLAGS_REPRO) # make it consistent with F90 compilation.
+#CXXFLAGS_OPT = -O2 -no-vec # default from GFDL for bit-wise repeatability
+#CXXFLAGS_OPT = -O3 -xHOST
+#CXXFLAGS_OPT = -DNDEBUG # removes assertions. Greatly improves speed, but must be used only after extensive testing
+# -traceback should not cause runtime overhead (?), thus we want it for production also
+CXXFLAGS_DEBUG = -traceback
+# options that create runtime overhead, not desirable for production runs
+CXXFLAGS_DEBUG += -check-uninit # for older icpc versions
+CXXFLAGS_DEBUG += -ftrapuv
+CXXFLAGS_DEBUG += -check=stack\,uninit -check-pointers=rw -check-pointers-dangling=all -fstack-security-check
+# there are several preprocessor defines to enable several debugging facilities
+CXXFLAGS_DEBUG += -DDO_PRINT_SUMS
+CXXFLAGS_DEBUG += -DDO_VARIABLE_CHECKSUMS
+CXXFLAGS_DEBUG += -DTRACE_AEOLUS_INIT
+#CXXFLAGS_DEBUG += -DTRACE_AEOLUS_UPDATE
+CXXFLAGS_DEBUG += -DDEBUG_STOCK_MOVE
+CXXFLAGS_DEBUG += -DDEBUG_AEOLUS_STOCKS
+CXXFLAGS = $(CXXFLAGS_BASE) $(CXXFLAGS_REPRO) $(CXXFLAGS_OPT) $(CXXFLAGS_DEBUG)
+
+CPPFLAGS = -I/home/petri/netcdf-4.2.1.1-intel15/include
+FC = mpiifort # -check_mpi -trace
+#LD = mpiifort -v -check_mpi -trace -profile=vtfs
+LD = mpiifort -v #-check_mpi -profile=vtmc
+CC = mpiicc # -check_mpi -trace
+CXX= mpiicpc # -check_mpi -trace
+
+# when -g is given to the linking step, Intel will use the debugging version of the MPI library.
+# Thus, for production performance, link without -g
+# -sox Tells the compiler to save the compilation options and
+# version number in the Linux* OS executable
+# to enable debugging, we must prevent IPO
+LDFLAGS = -sox -g $(FFLAGS_REPRO) $(NETCDFLIBPATH) -traceback
+LDFLAGS += -no-ipo
+LDFLAGS += -lchkp -lchkpwrap
+LDFLAGS += -lmcheck
+#LDFLAGS = -L/home/petri/netcdf-4.2.1.1-intel15/lib -lnetcdf_c++ -lnetcdff -lnetcdf -L/home/petri/hdf5-1.8.9-intel15/lib -lhdf5_hl -lhdf5 -lz -L$(UDUNITSROOT)/lib -ludunits2 -lstdc++
+
+CFLAGS_BASE = -D__IFC -g -Wall -Wremarks
+CFLAGS_REPRO = $(FFLAGS_REPRO)
+CFLAGS_DEBUG = -traceback
+# options that create runtime overhead, not desirable for production runs
+CFLAGS_DEBUG += -check-uninit -ftrapuv
+CFLAGS_DEBUG += -check=stack\,uninit -check-pointers=rw -check-pointers-dangling=all -fstack-security-check
+#CFLAGS_OPT = -O2 -no-vec
+#CFLAGS_OPT = -O3 -xHOST
+CFLAGS = $(CFLAGS_BASE) $(CFLAGS_REPRO) $(CFLAGS_DEBUG) $(CFLAGS_OPT)
+
+#LPJ_OPTFLAGS= -O3 -ipo -xHOST -no-prec-div -traceback
+#LPJ_OPTFLAGS=-no-ipo -DDEBUG3 -traceback
+LPJ_OPTFLAGS=-no-ipo -traceback
+
+# the Intel compiler requires that libraries are built using xiar if -ipo is used as compiler / linker option.
+# LPJ wants that option, thus we need xiar here.
+AR = xiar
diff -ur --unidirectional-new-file -b -E -Z -x CM2.1p1 -x StripedPlanet -x atmos_bgrid -x atmos_ebm -x land_lad2 -x mom5 -x generic_tracers /p/tmp/petri/mom5-af3a94d4/bin/mkmf.template.pik-hlrs2015-ifort-vec MonsoonPlanet/bin/mkmf.template.pik-hlrs2015-ifort-vec
--- /p/tmp/petri/mom5-af3a94d4/bin/mkmf.template.pik-hlrs2015-ifort-vec 1970-01-01 01:00:00.000000000 +0100
+++ MonsoonPlanet/bin/mkmf.template.pik-hlrs2015-ifort-vec 2021-03-31 13:53:54.415183622 +0200
@@ -0,0 +1,213 @@
+# -*-makefile-*-
+# template for the Intel fortran compiler version 15ff with Intel MPI on the PIK HLRS2015 cluster
+# typical use with mkmf
+# mkmf -t template.ifc -c"-Duse_libMPI -Duse_netCDF" path_names /usr/local/include
+
+# -fpp : run the Fortran preprocessor before compilation
+# -fno-alias : If you do not want aliasing to be assumed in the program
+# -stack_temps : allocate space for temporary arrays on the runtime stack
+# -safe-cray-ptr : Cray* pointers do not alias other variables.
+# -ftz : Flushes denormal results to zero.
+# This option flushes denormal results to zero when the
+# application is in the gradual underflow mode. It may
+# improve performance if the denormal values are not criti
+# cal to your application's behavior.
+#
+# If this option produces undesirable results of the numeri
+# cal behavior of your program, you can turn the FTZ/DAZ
+# mode off by using -no-ftz or /Qftz- in the command line
+# while still benefiting from the O3 optimizations.
+#
+# NOTE: Options -ftz and /Qftz are performance options. Set
+# ting these options does not guarantee that all denormals
+# in a program are flushed to zero. They only cause denor
+# mals generated at run time to be flushed to zero.
+# -shared-intel: Causes Intel-provided libraries to be linked in dynamically.
+# -assume byterecl : the units for the OPEN statement RECL specifier
+# (record length) value are in bytes for unformatted data,
+# not longwords
+# -Wp,-w : pass option -p to the preprocessor
+# Prevents warnings from being output.
+# -sox : save the compilation options and version number in the executable
+FFLAGS_BASE = -fpp -fno-alias -stack_temps -safe_cray_ptr -ftz -shared-intel -assume byterecl -g -i4 -r8 -Wp,-w -sox
+
+# -fltconsistency : Enables improved floating-point consistency.
+# This option enables improved floating-point consistency
+# and may slightly reduce execution speed. It limits float
+# ing-point optimizations and maintains declared precision.
+# It also disables inlining of math library functions.
+#
+# - Even if vectorization is enabled by the -x options, the
+# compiler does not vectorize reduction loops (loops
+# computing the dot product) and loops with mixed
+# precision types. Similarly, the compiler does not
+# enable certain loop transformations. For example,
+# the compiler does not transform reduction loops to
+# perform partial summation or loop interchange.
+#
+# This option causes performance degradation relative to
+# using default floating-point optimization flags.
+# The recommended method to control the semantics of float
+# ing-point calculations is to use option -fp-model
+#FFLAGS_REPRO = -fltconsistency
+#
+# -fp-model precise Disables optimizations that are not value-safe [..]
+# These semantics ensure the reproducibility of floating-point computations
+# for serial code, including code vectorized or auto-parallelized by the compiler
+# Run-to-run reproducibility for floating-point reductions in OpenMP* code may be obtained for
+# a fixed number of threads through the KMP_DETERMINISTIC_REDUCTION environment variable. For
+# more information about this environment variable, see Supported Environment Variables
+FFLAGS_REPRO = -fp-model precise
+#
+## Su-Bong Lee wrote on 13.3.2012:
+## I also did experiment using "-fp_model precise" option with "-O2",
+## Then the outputs from two identical restart run were the same.
+## Marshall Ward answered:
+## We are seeing similar issues on our machine in Australia using the intel
+## compilers (with -O2).
+##
+## On single CPU submissions of the bowl1 experiment, we saw two different
+## solutions, on the order of floating point error. The answer we get is
+## quasi-random, with no clear explanation.
+##
+## As Swathi recommends, using '-fp-model precise' gives a third solution
+## different from the other two, which we can reproduce consistently. Using
+## -fltconsistency did not address the issue for us either. This link
+## suggests Intel may soon deprecate -fltconsistency: http://goo.gl/IPBkH
+
+## -fp-model consistent generate code that will give consistent,
+## reproducible floating-point results for different optimization
+## levels or between different processors of the same architecture.
+## See the article titled: Consistency of Floating-Point Results using the Intel(R) Compiler
+## http://software.intel.com/en-us/articles/consistency-of-floating-point-results-using-the-intel-compiler/
+#FFLAGS_REPRO = -fp-model consistent
+##
+## [..] Dynamic variations in heap alignment can lead to variations in
+## floating-point results in a similar manner. Such variations in alignment
+## typically arise from memory allocations that depend on the external
+## environment. They can be prevented from causing variations in floating-point
+## results by building with -fp-model precise, or by explicit alignment of data
+## arrays. Starting from the version 15 compiler, such run-to-run variations can
+## also be prevented by compiling with -qno-opt-dynamic-align, which is expected
+## to have much less impact on performance than -fp-model precise.
+## SIGH. With ifort 15 this option seems to be buggy. Use -fp-model precise instead.
+## With ifort 17.0.1 it works better
+#FFLAGS_REPRO = -qno-opt-dynamic-align
+#FFLAGS_REPRO = -fp-model precise -qno-opt-dynamic-align
+
+# Run-to-run reproducibility for floating-point reductions in OpenMP
+# code may be obtained for a fixed number of threads through the
+# KMP_DETERMINISTIC_REDUCTION environment variable.
+# KMP_DETERMINISTIC_REDUCTION
+# Enables (true) or disables (false) the use of a specific ordering of the
+# reduction operations for implementing the reduction clause for an OpenMP*
+# parallel region. This has the effect that, for a given number of threads, in a
+# given parallel region, for a given data set and reduction operation, a floating
+# point reduction done for an OpenMP* reduction clause has a consistent floating
+# point result from run to run, since round-off errors are identical.
+
+
+# -check : Checks for certain conditions at run time.
+# -check all : is the same as specifying check with no keyword
+# -check bounds : compile-time and run-time checking for array subscripts
+# -check arg_temp_created: Determines whether checking occurs for actual
+# arguments before routine calls.
+# -WB : Turns a compile-time bounds check into a warning.
+# -inline_debug_info : use -debug inline-debug-info
+# -fpe0 : Floating-point invalid, divide-by-zero, and overflow exceptions
+# are enabled. If any such exceptions occur, execution is aborted.
+# This option sets the -ftz ; therefore underflow results will be set
+# to zero unless you explicitly specify -no-ftz
+# -fpe3 : (default) All floating-point exceptions are disabled.
+# Floating-point underflow is gradual
+# -ftrapuv : Initializes stack local variables to an unusual value to aid error detection.
+# -fp-stack-check : generate extra code after every function call
+# By default, there is no checking. So when the FP stack
+# overflows, a NaN value is put into FP calculations and the
+# program's results differ. Unfortunately, the overflow
+# point can be far away from the point of the actual bug.
+# This option places code that causes an access violation
+# exception immediately after an incorrect call occurs, thus
+# making it easier to locate these issues.
+
+# -traceback should not cause runtime overhead (?), thus we want it for production also
+FFLAGS_DEBUG = -warn -warn noerrors -traceback
+#FFLAGS_DEBUG += -warn nointerfaces
+# options that possibly create runtime overhead, thus should be used during development
+# but nor for production.
+#FFLAGS_DEBUG += -check bounds -WB
+#FFLAGS_DEBUG += -check all -WB
+#FFLAGS_DEBUG += -check all\,noarg_temp_created -WB
+#FFLAGS_DEBUG += -fpe0 -ftrapuv
+#FFLAGS_DEBUG += -init=snan -init=arrays
+#FFLAGS_DEBUG += -debug variable_locations -debug-parameters -debug inline-debug-info
+
+#FFLAGS_OPT = -O2 -no-vec # default from GFDL
+#FFLAGS_OPT = -O3 -xHost -ipo
+FFLAGS_OPT = -O3 -xHost
+#FFLAGS_OPT = -O3 -xHost -qopt-report -qopt-report-annotate
+#FFLAGS_OPT = -O3 -xHost -parallel -guide
+
+FFLAGS = $(FFLAGS_BASE) $(FFLAGS_REPRO) $(FFLAGS_OPT) $(FFLAGS_DEBUG)
+
+# -Wremarks is needed for ifort >= 12 to turn on remarks
+# -diag-disable : turn off some annoying remarks
+# remark #1: last line of file ends without a newline
+# remark #981: operands are evaluated in unspecified order
+# remark #1418: external function definition with no prior declaration
+# remark #1419: external declaration in primary source file
+# remark #1572: floating-point equality and inequality comparisons are unreliable
+# remark #1782 : #pragma once is obsolete
+# warning #3180: unrecognized OpenMP #pragma
+# warning #5194: Source line truncated
+# warning #6717: This name has not been given an explicit type
+
+CXXFLAGS_BASE = -Wall -Wremarks -g -debug inline-debug-info -debug extended
+CXXFLAGS_BASE += -diag-disable 1,981,1782,1572,1418,1419,3180 # ,5194,6717
+CXXFLAGS_BASE += -ftz -fno-exceptions
+CXXFLAGS_BASE += -no-inline-factor
+#CXXFLAGS_BASE += -DONLY_TRANSPORT_ON_REDUCED_GRID
+CXXFLAGS_REPRO = $(FFLAGS_REPRO) # make it consistent with F90 compilation
+#CXXFLAGS_OPT = -O2 -no-vec # default from GFDL
+CXXFLAGS_OPT = -O3 -xHOST
+CXXFLAGS_OPT += -DNDEBUG # removes assertions. Greatly improves speed, but must be used only after extensive testing
+# -traceback should not cause runtime overhead (?), thus we want it for production also
+CXXFLAGS_DEBUG = -traceback
+# options that create runtime overhead, not desirable for production runs
+#CXXFLAGS_DEBUG += -check-uninit -ftrapuv -fstack-security-check
+CXXFLAGS = $(CXXFLAGS_BASE) $(CXXFLAGS_REPRO) $(CXXFLAGS_OPT) $(CXXFLAGS_DEBUG)
+
+CPPFLAGS = -I/home/petri/netcdf-4.2.1.1-intel15/include
+FC = mpiifort
+LD = mpiifort
+CC = mpiicc
+CXX= mpiicpc
+# when -g is given to the linking step, Intel will use the debugging version of the MPI library.
+# Thus, for production performance, link without -g
+# -sox Tells the compiler to save the compilation options and
+# version number in the Linux* OS executable
+# to enable debugging, we must prevent IPO
+LDFLAGS = -sox -g $(FFLAGS_REPRO) $(NETCDFLIBPATH) -traceback
+#LDFLAGS += -no-ipo
+#LDFLAGS += -lchkp -lchkpwrap
+#LDFLAGS += -lmcheck
+#LDFLAGS = -L/home/petri/netcdf-4.2.1.1-intel15/lib -lnetcdf_c++ -lnetcdff -lnetcdf -L/home/petri/hdf5-1.8.9-intel15/lib -lhdf5_hl -lhdf5 -lz -L$(UDUNITSROOT)/lib -ludunits2 -lstdc++
+
+CFLAGS_BASE = -D__IFC -g -Wall -Wremarks
+CFLAGS_REPRO = $(FFLAGS_REPRO)
+CFLAGS_DEBUG = -traceback
+# options that create runtime overhead, not desirable for production runs
+#CFLAGS_DEBUG += -check-uninit -ftrapuv
+#CFLAGS_DEBUG += -check=stack\,uninit -check-pointers=rw -check-pointers-dangling=all -fstack-security-check
+#CFLAGS_OPT = -O2 -no-vec
+CFLAGS_OPT = -O3 -xHOST
+CFLAGS_OPT += -DNDEBUG
+CFLAGS = $(CFLAGS_BASE) $(CFLAGS_REPRO) $(CFLAGS_DEBUG) $(CFLAGS_OPT)
+
+LPJ_OPTFLAGS= -O3 -no-ipo -xHOST -no-prec-div -traceback
+#LPJ_OPTFLAGS= -O2 -no-ipo -traceback
+#LPJ_OPTFLAGS= -g -no-ipo -traceback
+
+# the Intel compiler requires that libraries are built using xiar if -ipo is used as compiler / linker option.
+# LPJ wants that option, thus we need xiar here.
+AR = xiar
diff -ur --unidirectional-new-file -b -E -Z -x CM2.1p1 -x StripedPlanet -x atmos_bgrid -x atmos_ebm -x land_lad2 -x mom5 -x generic_tracers /p/tmp/petri/mom5-af3a94d4/exp/FMS_compile.csh MonsoonPlanet/exp/FMS_compile.csh
--- /p/tmp/petri/mom5-af3a94d4/exp/FMS_compile.csh 2020-10-21 09:05:09.195613000 +0200
+++ MonsoonPlanet/exp/FMS_compile.csh 2021-03-31 13:53:54.741253000 +0200
@@ -6,13 +6,25 @@
$root/bin/list_paths $root/src/shared
mv path_names $pathnames_shared
-set srcList = ( shared/tridiagonal shared/tracer_manager shared/topography shared/time_manager shared/time_interp shared/station_data shared/sat_vapor_pres shared/random_numbers shared/platform shared/oda_tools shared/diag_manager shared/data_override shared/constants shared/column_diagnostics shared/axis_utils shared/astronomy shared/amip_interp shared/fft shared/field_manager shared/horiz_interp shared/include shared/memutils shared/mosaic shared/coupler shared/test )
+#set srcList = ( shared/tridiagonal shared/tracer_manager shared/topography shared/time_manager shared/time_interp shared/station_data shared/sat_vapor_pres shared/random_numbers shared/platform shared/oda_tools shared/diag_manager shared/data_override shared/constants shared/column_diagnostics shared/axis_utils shared/astronomy shared/amip_interp shared/fft shared/field_manager shared/horiz_interp shared/include shared/memutils shared/mosaic shared/coupler shared/test )
+set srcList = ( shared/tridiagonal shared/tracer_manager shared/topography shared/time_manager shared/time_interp shared/station_data shared/sat_vapor_pres shared/random_numbers shared/platform shared/oda_tools shared/diag_manager shared/data_override shared/constants shared/column_diagnostics shared/axis_utils shared/amip_interp shared/fft shared/field_manager shared/horiz_interp shared/include shared/memutils shared/mosaic shared/coupler shared/test )
set lib_name = "lib_FMS"
mkdir -p $executable:h:h/$lib_name
+
+# astronomy.F90 must be compiled with stricter floating point semantics to prevent buggy vectorization
+set pathnames_astro = $executable:h:h/$lib_name/astronomy_command-$$
+if ( `ifort --version | head -1` =~ "*17.0.4*" & "$vec" == "-vec" ) then
+ echo 'compiling astronomy.F90 with fp-model consistent to prevent buggy vectorization'
+ echo '$(FC) -fp-model consistent $(CPPDEFS) $(CPPFLAGS) $(FPPFLAGS) $(FFLAGS) $(OTHERFLAGS) -fp-model consistent -c /p/projects/climber3/petri/POEM/src/shared/astronomy/astronomy.F90' > $pathnames_astro
+else
+ echo > $pathnames_astro
+ set srcList = ( $srcList shared/astronomy )
+endif
+
cd $executable:h:h/$lib_name
-$mkmf_lib -p $lib_name.a -c "$cppDefs" $srcList $pathnames_shared $lib_include_dirs
+$mkmf_lib -p $lib_name.a -c "$cppDefs" $srcList $pathnames_astro $pathnames_shared $lib_include_dirs
make
if( $status ) then
diff -ur --unidirectional-new-file -b -E -Z -x CM2.1p1 -x StripedPlanet -x atmos_bgrid -x atmos_ebm -x land_lad2 -x mom5 -x generic_tracers /p/tmp/petri/mom5-af3a94d4/exp/MOM_compile.csh MonsoonPlanet/exp/MOM_compile.csh
--- /p/tmp/petri/mom5-af3a94d4/exp/MOM_compile.csh 2022-12-21 10:27:22.459914000 +0100
+++ MonsoonPlanet/exp/MOM_compile.csh 2021-06-03 10:21:32.795316452 +0200
@@ -1,33 +1,51 @@
#!/bin/csh -f
# Minimal compile script for fully coupled model CM2M experiments
-set platform = gfortran # A unique identifier for your platform
+#set echo
+set platform = gfortran # A unique identifier for your platfo
# This corresponds to the mkmf templates in $root/bin dir.
-set type = MOM_solo # Type of the experiment
+if ( `hostname` =~ login0? ) then
+ set platform = pik-iplex-ifort11
+ if ( -d /p ) then ### argl. what a hack. from hostname nor domain we can distinguish iplex and hpc2015 clusters
+ set platform = pik-hlrs2015-ifort
+ endif
+endif
+if ( `hostname` =~ viss0?* ) then
+ set platform = pik-vis-ifort11
+endif
+if ( `hostname` =~ pc89 ) then
+ set platform = pik-pc89-gfortran
+endif
+if ( `hostname` =~ zuse ) then
+ set platform = ifi-zuse-ifort11
+endif
+
+
+
+set type = "" # MOM_solo # Type of the experiment
+set help = 1 # if invoked without --type then print help
set unit_testing = 0
-set help = 0
-set debug = 0
+set debug = ""
+set vec = "" # -vec or -omp
set repro = 0
-set use_netcdf4 = 0
+set use_netcdf4 = 1
set environ = 1
-
-set argv = (`getopt -u -o h -l type: -l platform: -l help -l unit_testing -l debug -l repro -l use_netcdf4 -l no_environ -- $*`)
+set argv = (`getopt -u -o hd -l type: -l platform: -l help -l unit_testing -l debug -l repro -l vec -l omp -l use_netcdf4 -l no_environ -- $*`)
if ($status != 0) then
# Die if there are incorrect options
set help = 1
goto help
endif
+
while ("$argv[1]" != "--")
switch ($argv[1])
case --type:
- set type = $argv[2]; shift argv; breaksw
+ set type = $argv[2]; set help = 0; shift argv; breaksw
case --platform:
set platform = $argv[2]; shift argv; breaksw
case --unit_testing:
set unit_testing = 1; breaksw
- case --debug:
- set debug = 1; breaksw
case --repro:
set repro = 1; breaksw
case --use_netcdf4:
@@ -35,20 +53,31 @@
case --no_environ:
set environ = 0; breaksw
case --help:
- set help = 1; breaksw
case -h:
set help = 1; breaksw
+ case --debug:
+ case -d:
+ set debug = "-debug"; breaksw
+ case --vec:
+ set vec = "-vec"; breaksw
+ case --omp:
+ set vec = "-omp"; breaksw
endsw
shift argv
end
+
+if ("" == "$type") echo "Option --type is required!"
+
shift argv
help:
if ( $help ) then
echo "The optional arguments are:"
- echo "--type followed by the type of the model, one of the following (default is MOM_solo):"
+ echo "--type followed by the type of the experiment, currently one of the following:"
echo " MOM_solo : solo ocean model"
echo " MOM_SIS : ocean-seaice model"
+ echo " SLAB_SIS : slab -seaice model"
echo " CM2M : ocean-seaice-land-atmosphere coupled climate model"
+ echo " SLAB_CM2M: slab -seaice-land-atmosphere coupled climate model"
echo " ESM2M : ocean-seaice-land-atmosphere coupled climate model with biogeochemistry, EarthSystemModel"
echo " ICCM : ocean-seaice-land-atmosphere coupled model"
echo " EBM : ocean-seaice-land-atmosphere coupled model with energy balance atmosphere"
@@ -57,23 +86,28 @@
echo " ACCESS-ESM : ocean component of ACCESS-ESM model with CSIRO BGC (Wombat)."
echo " ACCESS-OM-BGC: ocean component of ACCESS-OM model with CSIRO BGC (Wombat)."
echo
- echo "--platform followed by the platform name that has a corresponding environ file in the ../bin dir, default is gfortran"
+ echo "--platform followed by the platform name that has a corresponding environ file in the ../bin dir, default is $platform"
+ echo "--debug | -d to append -debug to the platform name, so that mkmf template with debug options is used,"
+ echo " and the executable is built in a directory with -debug appended to its name."
+ echo "--vec Compile with highest optimization and vectorisation (default is without vectorisation)"
+ echo "--omp Compile with highest optimization and OpenMP"
echo
- echo "--use_netcdf4 use NetCDF4, the default is NetCDF4. Warning: many of the standard experiments don't work with NetCDF4."
+ echo "--use_netcdf4 use NetCDF4, the default is NetCDF3. Warning: many of the standard experiments don't work with NetCDF4."
echo
echo "--no_environ do not source platform specific environment. Allows customising/overriding default environment"
echo
exit 1
endif
+set echo
#
# User does not need to change anything below!
#
set root = $cwd:h # The directory you created when you checkout
set code_dir = $root/src # source code directory
-set executable = $root/exec/$platform/$type/fms_$type.x # executable created after compilation
+set executable = $root/exec/$platform$vec$debug/$type/fms_$type.x # executable created after compilation
set mppnccombine = $root/bin/mppnccombine.$platform # path to executable mppnccombine
-set mkmfTemplate = $root/bin/mkmf.template.$platform # path to template for your platform
+set mkmfTemplate = $root/bin/mkmf.template.$platform$vec$debug # path to template for your platform
set mkmf = $root/bin/mkmf # path to executable mkmf
set cppDefs = ( "-Duse_netCDF -Duse_netCDF3 -Duse_libMPI -DUSE_OCEAN_BGC -DENABLE_ODA -DSPMD -DLAND_BND_TRACERS" )
#On Altrix systems you may include "-Duse_shared_pointers -Duse_SGI_GSM" in cppDefs for perfomance.
@@ -102,7 +136,7 @@
setenv DEBUG true
endif
-if ( $debug ) then
+if ( "$debug" != "" ) then
setenv DEBUG true
endif
@@ -121,27 +155,36 @@
if ( $environ ) then
source $root/bin/environs.$platform # environment variables and loadable modules
endif
+if ( $status ) exit $status
+
+env | grep NETCDF
#
# compile mppnccombine.c, needed only if $npes > 1
-if ( ! -f $mppnccombine ) then
- cc -O -o $mppnccombine -I/usr/local/include -L/usr/local/lib $code_dir/postprocessing/mppnccombine/mppnccombine.c -lm -lnetcdf
-endif
+ if ( ! -f $mppnccombine ) then
+ $CC -O -g -o $mppnccombine $NETCDFINCLUDE $code_dir/postprocessing/mppnccombine/mppnccombine.c $NETCDFLIBPATH
+ if ( $status ) exit $status
+ endif
set mkmf_lib = "$mkmf -f -m Makefile -a $code_dir -t $mkmfTemplate"
set lib_include_dirs = "$root/include $code_dir/shared/include $code_dir/shared/mpp/include"
# Build version
source ./version_compile.csh
+if ( $status ) exit $status
# Build FMS.
source ./FMS_compile.csh
-
+if ( $status ) exit $status
set includes = "-I$code_dir/shared/include -I$executable:h:h/lib_FMS -I$executable:h:h/lib_ocean -I$executable:h:h/lib_version/"
# Build the core ocean.
cd $root/exp
-source ./ocean_compile.csh
+if ( $type == SLAB_SIS | $type == SLAB_CM2M) then
+ source ./slab_compile.csh
+else
+ source ./ocean_compile.csh
+endif
if ( $status ) exit $status
if( $type != MOM_solo && $type != ACCESS-OM && $type != ACCESS-CM && $type != ACCESS-OM-BGC && $type != ACCESS-ESM) then
@@ -149,7 +192,7 @@
source ./ice_compile.csh
if ( $status ) exit $status
endif
-if( $type == MOM_SIS) then
+if( $type == MOM_SIS | $type == SLAB_SIS) then
cd $root/exp
source ./land_null_compile.csh
if ( $status ) exit $status
@@ -163,17 +206,17 @@
source ./atmos_ebm_compile.csh
if ( $status ) exit $status
endif
-if( $type == CM2M | $type == ESM2M | $type == ICCM ) then
+if( $type == CM2M | $type == ESM2M | $type == ICCM | $type == SLAB_CM2M) then
cd $root/exp
source ./atmos_phys_compile.csh
if ( $status ) exit $status
endif
-if( $type == CM2M | $type == ESM2M ) then
+if( $type == CM2M | $type == ESM2M | $type == SLAB_CM2M ) then
cd $root/exp
source ./atmos_fv_compile.csh
if ( $status ) exit $status
endif
-if( $type == CM2M | $type == ICCM | $type == EBM ) then
+if( $type == CM2M | $type == ICCM | $type == EBM | $type == SLAB_CM2M) then
cd $root/exp
source ./land_lad_compile.csh
if ( $status ) exit $status
@@ -195,7 +238,7 @@
cd $executable:h
if( $type == MOM_solo ) then
set srcList = ( mom5/drivers )
- set libs = "$executable:h:h/lib_ocean/lib_ocean.a $executable:h:h/lib_FMS/lib_FMS.a"
+ set libs = "$executable:h:h/lib_ocean/lib_ocean.a"
else if( $type == ACCESS-CM || $type == ACCESS-ESM) then
set srcList = ( accesscm_coupler )
set includes = "-I$executable:h:h/lib_FMS -I$executable:h:h/$type/lib_ocean"
@@ -204,11 +247,15 @@
else if( $type == ACCESS-OM || $type == ACCESS-OM-BGC) then
set srcList = ( accessom_coupler )
set includes = "-I$executable:h:h/lib_FMS -I$executable:h:h/$type/lib_ocean"
- set libs = "$executable:h:h/$type/lib_ocean/lib_ocean.a $executable:h:h/lib_FMS/lib_FMS.a"
+ set libs = "$executable:h:h/$type/lib_ocean/lib_ocean.a"
else if( $type == MOM_SIS ) then
set srcList = ( coupler )
set includes = "$includes -I$executable:h:h/lib_ice -I$executable:h:h/lib_atmos_null -I$executable:h:h/lib_land_null"
set libs = "$executable:h:h/lib_ocean/lib_ocean.a $executable:h:h/lib_ice/lib_ice.a $executable:h:h/lib_atmos_null/lib_atmos_null.a $executable:h:h/lib_land_null/lib_land_null.a"
+else if( $type == SLAB_SIS ) then
+ set srcList = ( coupler )
+ set includes = "-I$executable:h:h/lib_FMS -I$executable:h:h/lib_slab -I$executable:h:h/lib_ice -I$executable:h:h/lib_atmos_null -I$executable:h:h/lib_land_null"
+ set libs = "$executable:h:h/lib_slab/lib_slab.a $executable:h:h/lib_ice/lib_ice.a $executable:h:h/lib_atmos_null/lib_atmos_null.a $executable:h:h/lib_land_null/lib_land_null.a"
else if( $type == EBM ) then
set srcList = ( coupler )
set includes = "$includes -I$executable:h:h/lib_ice -I$executable:h:h/lib_atmos_ebm -I$executable:h:h/lib_land_lad"
@@ -217,6 +264,10 @@
set srcList = ( coupler )
set includes = "$includes -I$executable:h:h/lib_ice -I$executable:h:h/lib_atmos_fv -I$executable:h:h/lib_atmos_phys -I$executable:h:h/lib_land_lad"
set libs = "$executable:h:h/lib_ocean/lib_ocean.a $executable:h:h/lib_ice/lib_ice.a $executable:h:h/lib_atmos_fv/lib_atmos_fv.a $executable:h:h/lib_atmos_phys/lib_atmos_phys.a $executable:h:h/lib_land_lad/lib_land_lad.a"
+else if( $type == SLAB_CM2M ) then
+ set srcList = ( coupler )
+ set includes = "-I$executable:h:h/lib_FMS -I$executable:h:h/lib_slab -I$executable:h:h/lib_ice -I$executable:h:h/lib_atmos_fv -I$executable:h:h/lib_atmos_phys -I$executable:h:h/lib_land_lad"
+ set libs = "$executable:h:h/lib_slab/lib_slab.a $executable:h:h/lib_ice/lib_ice.a $executable:h:h/lib_atmos_fv/lib_atmos_fv.a $executable:h:h/lib_atmos_phys/lib_atmos_phys.a $executable:h:h/lib_land_lad/lib_land_lad.a"
else if( $type == ESM2M ) then
set srcList = ( coupler )
set includes = "$includes -I$executable:h:h/lib_ice -I$executable:h:h/lib_atmos_fv -I$executable:h:h/lib_atmos_phys -I$executable:h:h/lib_land_lad2"
diff -ur --unidirectional-new-file -b -E -Z -x CM2.1p1 -x StripedPlanet -x atmos_bgrid -x atmos_ebm -x land_lad2 -x mom5 -x generic_tracers /p/tmp/petri/mom5-af3a94d4/exp/atmos_phys_compile.csh MonsoonPlanet/exp/atmos_phys_compile.csh
--- /p/tmp/petri/mom5-af3a94d4/exp/atmos_phys_compile.csh 2014-05-14 22:04:13.000000000 +0200
+++ MonsoonPlanet/exp/atmos_phys_compile.csh 2021-03-31 13:53:54.743637000 +0200
@@ -1,12 +1,31 @@
# Build the am3 library
-set srcList = ( atmos_param/diag_integral atmos_param/monin_obukhov atmos_shared/vert_advection atmos_shared/tracer_driver/tropchem atmos_shared/tracer_driver/stratchem atmos_shared/tracer_driver atmos_shared/tracer_driver/aer_ccn_act atmos_shared/interpolator atmos_shared/atmos_nudge atmos_param/vert_turb_driver atmos_param/vert_diff_driver atmos_param/vert_diff atmos_param/topo_drag atmos_param/strat_cloud atmos_param/stable_bl_turb atmos_param/shallow_physics atmos_param/shallow_cu atmos_param/shallow_conv atmos_param/sea_esf_rad atmos_param/rh_clouds atmos_param/ras atmos_param/radiation_driver atmos_param/physics_driver atmos_param/my25_turb atmos_param/moist_processes atmos_param/moist_conv atmos_param/mg_drag atmos_param/lscale_cond atmos_param/lin_cloud_microphys atmos_param/grey_radiation atmos_param/fsrad atmos_param/entrain atmos_param/edt atmos_param/dry_adj atmos_param/donner_deep atmos_param/diffusivity atmos_param/diag_cloud_rad atmos_param/diag_cloud atmos_param/damping_driver atmos_param/cu_mo_trans atmos_param/cosp/quickbeam atmos_param/cosp/llnl atmos_param/cosp/icarus-scops-3.7 atmos_param/cosp/actsim atmos_param/cosp/MODIS_simulator atmos_param/cosp/MISR_simulator atmos_param/cosp atmos_param/clouds atmos_param/cloud_zonal atmos_param/cloud_rad atmos_param/cloud_obs atmos_param/cloud_generator atmos_param/cg_drag atmos_param/betts_miller atmos_param/clubb )
+set srcList = ( atmos_param/diag_integral atmos_param/monin_obukhov atmos_shared/vert_advection atmos_shared/tracer_driver/tropchem atmos_shared/tracer_driver/stratchem atmos_shared/tracer_driver atmos_shared/tracer_driver/aer_ccn_act atmos_shared/interpolator atmos_shared/atmos_nudge atmos_param/vert_turb_driver atmos_param/vert_diff_driver atmos_param/vert_diff atmos_param/topo_drag atmos_param/strat_cloud atmos_param/stable_bl_turb atmos_param/shallow_physics atmos_param/shallow_cu atmos_param/shallow_conv atmos_param/rh_clouds atmos_param/ras atmos_param/radiation_driver atmos_param/physics_driver atmos_param/my25_turb atmos_param/moist_processes atmos_param/moist_conv atmos_param/mg_drag atmos_param/lscale_cond atmos_param/lin_cloud_microphys atmos_param/grey_radiation atmos_param/fsrad atmos_param/entrain atmos_param/edt atmos_param/dry_adj atmos_param/donner_deep atmos_param/diffusivity atmos_param/diag_cloud_rad atmos_param/diag_cloud atmos_param/damping_driver atmos_param/cu_mo_trans atmos_param/cosp/quickbeam atmos_param/cosp/llnl atmos_param/cosp/icarus-scops-3.7 atmos_param/cosp/actsim atmos_param/cosp/MODIS_simulator atmos_param/cosp/MISR_simulator atmos_param/cosp atmos_param/clouds atmos_param/cloud_zonal atmos_param/cloud_rad atmos_param/cloud_obs atmos_param/cloud_generator atmos_param/cg_drag atmos_param/betts_miller atmos_param/clubb )
+
+set sea_esf_rad_files = ( `(cd $root/src ; find atmos_param/sea_esf_rad -name '*.F90' -print | grep -v longwave_tables)` )
set lib_name = "lib_atmos_phys"
mkdir -p $executable:h:h/$lib_name
+
+# ifort 17.0.1.132 and 19.x produce buggy code when compiling
+# src/atmos_param/sea_esf_rad/longwave_tables.F90
+# with full optimization: -O3 -xHOST -qopenmp -parallel
+# It works when compiled without -O3 -xHOST .
+# That file contains only an init routine, so no-optimization should not matter for run time.
+set pathnames = $executable:h:h/$lib_name/longwave_tables_command-$$
+set srcList = ( $pathnames $sea_esf_rad_files $srcList )
+if ( X"$debug$vec" =~ '*omp*' ) then
+ echo compiling longwave_tables.F90 without optimization to avoid compiler bug with combination of optimization and openmp
+# $(FC) $(CPPDEFS) $(CPPFLAGS) $(FPPFLAGS) $(FFLAGS) $(OTHERFLAGS) -c /p/projects/climber3/petri/POEM/src/atmos_param/sea_esf_rad/longwave_tables.F90
+ echo '$(FC) -O0 $(CPPDEFS) $(CPPFLAGS) $(FPPFLAGS) $(FFLAGS) $(OTHERFLAGS) -O0 -c atmos_param/sea_esf_rad/longwave_tables.F90' > $pathnames
+else
+ echo atmos_param/sea_esf_rad/longwave_tables.F90 > $pathnames
+endif
+
cd $executable:h:h/$lib_name
$mkmf_lib -p $lib_name.a -c "$cppDefs" -o "-I$executable:h:h/lib_FMS" $srcList $lib_include_dirs
+rm -f $pathnames
make
if( $status ) then
diff -ur --unidirectional-new-file -b -E -Z -x CM2.1p1 -x StripedPlanet -x atmos_bgrid -x atmos_ebm -x land_lad2 -x mom5 -x generic_tracers /p/tmp/petri/mom5-af3a94d4/exp/land_lad2_compile.csh MonsoonPlanet/exp/land_lad2_compile.csh
--- /p/tmp/petri/mom5-af3a94d4/exp/land_lad2_compile.csh 2014-05-14 22:04:13.000000000 +0200
+++ MonsoonPlanet/exp/land_lad2_compile.csh 2021-03-31 13:53:54.738991000 +0200
@@ -4,9 +4,16 @@
set lib_name = "lib_land_lad2"
+# TODO: compiler version check.
+# land_lad2 is fixed to ifort version 15.0.3.
+# gfortran and all other tested ifort versions produce wrong code for
+# writing and reading restart information.
+
+# land_lad2 must be compiled without OpenMP , at least with ifort 15.0.3
+
mkdir -p $executable:h:h/$lib_name
cd $executable:h:h/$lib_name
-$mkmf_lib -p $lib_name.a -c "-DUSE_LOG_DIAG_FIELD_INFO $cppDefs" -o "-I$executable:h:h/lib_FMS" $srcList $lib_include_dirs
+$mkmf_lib -p $lib_name.a -c "-DUSE_LOG_DIAG_FIELD_INFO -qno-openmp $cppDefs" -o "-I$executable:h:h/lib_FMS -qno-openmp" $srcList $lib_include_dirs
make
if( $status ) then
diff -ur --unidirectional-new-file -b -E -Z -x CM2.1p1 -x StripedPlanet -x atmos_bgrid -x atmos_ebm -x land_lad2 -x mom5 -x generic_tracers /p/tmp/petri/mom5-af3a94d4/exp/land_lad_compile.csh MonsoonPlanet/exp/land_lad_compile.csh
--- /p/tmp/petri/mom5-af3a94d4/exp/land_lad_compile.csh 2014-05-14 22:04:13.000000000 +0200
+++ MonsoonPlanet/exp/land_lad_compile.csh 2021-03-31 13:53:54.493014000 +0200
@@ -1,12 +1,27 @@
# Build the land_lad library
-set srcList = ( land_param land_lad/vegetation land_lad/soil land_lad )
-
set lib_name = "lib_land_lad"
+# land_model.F90 must be compiled without vectorization!
+# ifort 15.0.3.187 apparently has a bug.
+# With ifort 17.0.1.132 land_model.F90 can be compiled with vectorization.
+set pathnames = $executable:h:h/$lib_name/land_model_command-$$
+
+set srcList = ( land_param land_lad/vegetation land_lad/soil land_lad/numerics.F90 land_lad/land_types.F90 $pathnames )
+
mkdir -p $executable:h:h/$lib_name
+
+if ( `$(FC) --version` =~ 15.0.3 ) then
+ echo compiling land_model.F90 without vectorization because of compiler bug (ifort 15.0.3)
+# $(FC) $(CPPDEFS) $(CPPFLAGS) $(FPPFLAGS) $(FFLAGS) $(OTHERFLAGS) -c -I/p/projects/climber3/petri/POEM/src/shared/include /p/projects/climber3/petri/POEM/src/land_lad/land_model.F90
+ echo '$(FC) -no-vec $(CPPDEFS) $(CPPFLAGS) $(FPPFLAGS) $(FFLAGS) $(OTHERFLAGS) -no-vec -c land_lad/land_model.F90' > $pathnames
+else
+ echo land_lad/land_model.F90 > $pathnames
+endif
+
cd $executable:h:h/$lib_name
$mkmf_lib -p $lib_name.a -c "$cppDefs" -o "-I$executable:h:h/lib_FMS" $srcList $lib_include_dirs
+rm -f $pathnames
make
if( $status ) then
diff -ur --unidirectional-new-file -b -E -Z -x CM2.1p1 -x StripedPlanet -x atmos_bgrid -x atmos_ebm -x land_lad2 -x mom5 -x generic_tracers /p/tmp/petri/mom5-af3a94d4/exp/slab_compile.csh MonsoonPlanet/exp/slab_compile.csh
--- /p/tmp/petri/mom5-af3a94d4/exp/slab_compile.csh 1970-01-01 01:00:00.000000000 +0100
+++ MonsoonPlanet/exp/slab_compile.csh 2021-06-03 10:21:33.031343000 +0200
@@ -0,0 +1,15 @@
+# Build the Mixed-Layer Slab Ocean library
+
+set srcList = ( ocean_mixed_layer mom5/ocean_core/ocean_parameters.F90 )
+
+set lib_name = "lib_slab"
+
+mkdir -p $executable:h:h/$lib_name
+cd $executable:h:h/$lib_name
+$mkmf_lib -p $lib_name.a -c "$cppDefs" -o "-I$executable:h:h/lib_FMS" $srcList $lib_include_dirs
+make
+
+if( $status ) then
+ echo "Make failed to create $lib_name.a"
+ exit 1
+endif
diff -ur --unidirectional-new-file -b -E -Z -x CM2.1p1 -x StripedPlanet -x atmos_bgrid -x atmos_ebm -x land_lad2 -x mom5 -x generic_tracers /p/tmp/petri/mom5-af3a94d4/src/atmos_coupled/atmos_model.F90 MonsoonPlanet/src/atmos_coupled/atmos_model.F90
--- /p/tmp/petri/mom5-af3a94d4/src/atmos_coupled/atmos_model.F90 2018-10-11 09:29:43.512910640 +0200
+++ MonsoonPlanet/src/atmos_coupled/atmos_model.F90 2021-03-31 13:53:48.746860039 +0200
@@ -58,7 +58,7 @@
use atmosphere_mod, only: surf_diff_type
use atmosphere_mod, only: atmosphere_restart
use coupler_types_mod, only: coupler_2d_bc_type
-
+use diag_manager_mod, only: register_diag_field, send_data
!-----------------------------------------------------------------------
@@ -93,6 +93,7 @@
real, pointer, dimension(:,:) :: slp => null() ! sea level pressure
real, pointer, dimension(:,:) :: gust => null() ! gustiness factor
real, pointer, dimension(:,:) :: coszen => null() ! cosine of the zenith angle
+ real, pointer, dimension(:,:) :: coszen_radwt => null() ! cosine of the zenith angle, radiation weighted, Climber-2 style
real, pointer, dimension(:,:) :: flux_sw => null() ! net shortwave flux (W/m2) at the surface
real, pointer, dimension(:,:) :: flux_sw_dir =>null()
real, pointer, dimension(:,:) :: flux_sw_dif =>null()
@@ -175,19 +176,45 @@
type(restart_file_type), pointer, save :: Til_restart => null()
logical :: in_different_file = .false.
+
+! Diagnostics For Debugging Atmosphere Output
+integer :: used
+!integer :: id_lon, id_lat, id_lonb, id_latb, axes
+! to update_atmos_model_down
+integer :: id_u_star_down, id_b_star_down, id_q_star_down, id_t, id_dtaudu, id_dtaudv, id_u_flux_in, id_v_flux_in
+integer :: id_land_frac_down
+integer :: id_albedo, id_albedo_vis_dir, id_albedo_nir_dir, id_albedo_vis_dif, id_albedo_nir_dif
+! internal state at time of atmos_model_down
+integer :: id_lprec_down, id_fprec_down
+integer :: id_t_bot_down, id_sphum_bot_down, id_co2_bot_down, id_p_bot_down, id_z_bot_down, id_p_surf_down, id_slp_down, id_u_bot_down, id_v_bot_down
+! from update_atmos_model_down
+integer :: id_u_flux, id_v_flux, id_gust_down
+integer :: id_coszen, id_coszen_radwt, id_flux_sw, id_flux_sw_dir, id_flux_sw_dif
+integer :: id_flux_sw_down_vis_dir, id_flux_sw_down_vis_dif, id_flux_sw_down_total_dir, id_flux_sw_down_total_dif
+integer :: id_flux_sw_vis, id_flux_sw_vis_dir, id_flux_sw_vis_dif, id_flux_lw
+integer :: id_dtmass, id_dflux_t, id_dflux_sphum, id_dflux_co2, id_delta_t, id_delta_sphum, id_delta_co2, id_delta_u, id_delta_v
+! to update_atmos_model_up
+integer :: id_u_star_up, id_b_star_up, id_q_star_up, id_dt_sphum, id_dt_co2, id_dt_t
+integer :: id_land_frac_up
+! from update_atmos_model_up
+integer :: id_lprec, id_fprec, id_gust_up
+integer :: id_t_bot, id_sphum_bot, id_co2_bot, id_p_bot, id_z_bot, id_p_surf, id_slp, id_u_bot, id_v_bot
+
!-----------------------------------------------------------------------
character(len=128) :: version = '$Id: atmos_model.F90,v 20.0 2013/12/13 23:08:05 fms Exp $'
character(len=128) :: tagname = '$Name: tikal $'
integer :: ivapor = NO_TRACER ! index of water vapor tracer
+integer :: ico2 = NO_TRACER ! index of CO2 tracer
!-----------------------------------------------------------------------
character(len=80) :: restart_format = 'atmos_coupled_mod restart format 01'
!-----------------------------------------------------------------------
logical :: do_netcdf_restart = .true.
logical :: restart_tbot_qbot = .false.
-namelist /atmos_model_nml/ do_netcdf_restart, restart_tbot_qbot
+logical :: restart_zbot_pbot = .false.
+namelist /atmos_model_nml/ do_netcdf_restart, restart_tbot_qbot, restart_zbot_pbot
contains
@@ -231,6 +258,34 @@
!-----------------------------------------------------------------------
call mpp_clock_begin(atmClock)
+ if (id_t > 0) used = send_data(id_t, Surface_boundary%t, Atmos%Time)
+ if (id_albedo > 0) used = send_data(id_albedo, Surface_boundary%albedo, Atmos%Time)
+ if (id_albedo_vis_dir > 0) used = send_data(id_albedo_vis_dir, Surface_boundary%albedo_vis_dir, Atmos%Time)
+ if (id_albedo_nir_dir > 0) used = send_data(id_albedo_nir_dir, Surface_boundary%albedo_nir_dir, Atmos%Time)
+ if (id_albedo_vis_dif > 0) used = send_data(id_albedo_vis_dif, Surface_boundary%albedo_vis_dif, Atmos%Time)
+ if (id_albedo_nir_dif > 0) used = send_data(id_albedo_nir_dif, Surface_boundary%albedo_nir_dif, Atmos%Time)
+ if (id_u_star_down > 0) used = send_data(id_u_star_down, Surface_boundary%u_star, Atmos%Time)
+ if (id_b_star_down > 0) used = send_data(id_b_star_down, Surface_boundary%b_star, Atmos%Time)
+ if (id_q_star_down > 0) used = send_data(id_q_star_down, Surface_boundary%q_star, Atmos%Time)
+ if (id_dtaudu > 0) used = send_data(id_dtaudu, Surface_boundary%dtaudu, Atmos%Time)
+ if (id_dtaudv > 0) used = send_data(id_dtaudv, Surface_boundary%dtaudv, Atmos%Time)
+ if (id_u_flux_in > 0) used = send_data(id_u_flux_in, Surface_boundary%u_flux, Atmos%Time)
+ if (id_v_flux_in > 0) used = send_data(id_v_flux_in, Surface_boundary%v_flux, Atmos%Time)
+ if (id_land_frac_down > 0) used = send_data(id_land_frac_down, Surface_boundary%land_frac, Atmos%Time)
+
+ if (id_lprec_down > 0) used = send_data(id_lprec_down, Atmos%lprec, Atmos%Time)
+ if (id_fprec_down > 0) used = send_data(id_fprec_down, Atmos%fprec, Atmos%Time)
+ if (id_t_bot_down > 0) used = send_data(id_t_bot_down, Atmos%t_bot, Atmos%Time)
+ if (id_sphum_bot_down > 0) used = send_data(id_sphum_bot_down, Atmos%tr_bot(:,:,ivapor), Atmos%Time)
+ if (id_co2_bot_down > 0) used = send_data(id_co2_bot_down, Atmos%tr_bot(:,:,ico2), Atmos%Time)
+ if (id_p_bot_down > 0) used = send_data(id_p_bot_down, Atmos%p_bot, Atmos%Time)
+ if (id_z_bot_down > 0) used = send_data(id_z_bot_down, Atmos%z_bot, Atmos%Time)
+ if (id_p_surf_down > 0) used = send_data(id_p_surf_down, Atmos%p_surf, Atmos%Time)
+ if (id_slp_down > 0) used = send_data(id_slp_down, Atmos%slp, Atmos%Time)
+ if (id_u_bot_down > 0) used = send_data(id_u_bot_down, Atmos%u_bot, Atmos%Time)
+ if (id_v_bot_down > 0) used = send_data(id_v_bot_down, Atmos%v_bot, Atmos%Time)
+
+
call atmosphere_down (Atmos%Time, Surface_boundary%land_frac, &
Surface_boundary%t, Surface_boundary%albedo, &
Surface_boundary%albedo_vis_dir, &
@@ -248,6 +303,7 @@
Surface_boundary%frac_open_sea, &
Atmos%gust, &
Atmos%coszen, &
+ Atmos%coszen_radwt, &
Atmos%flux_sw, &
Atmos%flux_sw_dir, &
Atmos%flux_sw_dif, &
@@ -262,6 +318,31 @@
Atmos%Surf_diff )
!-----------------------------------------------------------------------
+ if (id_u_flux > 0) used = send_data(id_u_flux, Surface_boundary%u_flux, Atmos%Time)
+ if (id_v_flux > 0) used = send_data(id_v_flux, Surface_boundary%v_flux, Atmos%Time)
+ if (id_gust_down > 0) used = send_data(id_gust_down, Atmos%gust, Atmos%Time)
+ if (id_coszen > 0) used = send_data(id_coszen, Atmos%coszen, Atmos%Time)
+ if (id_coszen_radwt > 0) used = send_data(id_coszen_radwt, Atmos%coszen_radwt, Atmos%Time)
+ if (id_flux_sw > 0) used = send_data(id_flux_sw, Atmos%flux_sw, Atmos%Time)
+ if (id_flux_sw_dir > 0) used = send_data(id_flux_sw_dir, Atmos%flux_sw_dir, Atmos%Time)
+ if (id_flux_sw_dif > 0) used = send_data(id_flux_sw_dif, Atmos%flux_sw_dif, Atmos%Time)
+ if (id_flux_sw_down_vis_dir > 0) used = send_data(id_flux_sw_down_vis_dir, Atmos%flux_sw_down_vis_dir, Atmos%Time)
+ if (id_flux_sw_down_vis_dif > 0) used = send_data(id_flux_sw_down_vis_dif, Atmos%flux_sw_down_vis_dif, Atmos%Time)
+ if (id_flux_sw_down_total_dir > 0) used = send_data(id_flux_sw_down_total_dir, Atmos%flux_sw_down_total_dir, Atmos%Time)
+ if (id_flux_sw_down_total_dif > 0) used = send_data(id_flux_sw_down_total_dif, Atmos%flux_sw_down_total_dif, Atmos%Time)
+ if (id_flux_sw_vis > 0) used = send_data(id_flux_sw_vis, Atmos%flux_sw_vis, Atmos%Time)
+ if (id_flux_sw_vis_dir > 0) used = send_data(id_flux_sw_vis_dir, Atmos%flux_sw_vis_dir, Atmos%Time)
+ if (id_flux_sw_vis_dif > 0) used = send_data(id_flux_sw_vis_dif, Atmos%flux_sw_vis_dif, Atmos%Time)
+ if (id_flux_lw > 0) used = send_data(id_flux_lw, Atmos%flux_lw, Atmos%Time)
+ if (id_dtmass > 0) used = send_data(id_dtmass, Atmos%Surf_diff%dtmass, Atmos%Time)
+ if (id_dflux_t > 0) used = send_data(id_dflux_t, Atmos%Surf_diff%dflux_t, Atmos%Time)
+ if (id_dflux_sphum > 0) used = send_data(id_dflux_sphum, Atmos%Surf_diff%dflux_tr(:,:,ivapor), Atmos%Time)
+ if (id_dflux_co2 > 0) used = send_data(id_dflux_co2, Atmos%Surf_diff%dflux_tr(:,:,ico2), Atmos%Time)
+ if (id_delta_t > 0) used = send_data(id_delta_t, Atmos%Surf_diff%delta_t, Atmos%Time)
+ if (id_delta_sphum > 0) used = send_data(id_delta_sphum, Atmos%Surf_diff%delta_tr(:,:,ivapor), Atmos%Time)
+ if (id_delta_co2 > 0) used = send_data(id_delta_co2, Atmos%Surf_diff%delta_tr(:,:,ico2), Atmos%Time)
+ if (id_delta_u > 0) used = send_data(id_delta_u, Atmos%Surf_diff%delta_u, Atmos%Time)
+ if (id_delta_v > 0) used = send_data(id_delta_v, Atmos%Surf_diff%delta_v, Atmos%Time)
call mpp_clock_end(atmClock)
end subroutine update_atmos_model_down
@@ -308,6 +389,13 @@
!-----------------------------------------------------------------------
call mpp_clock_begin(atmClock)
+ if (id_u_star_up > 0) used = send_data(id_u_star_up, Surface_boundary%u_star, Atmos%Time)
+ if (id_b_star_up > 0) used = send_data(id_b_star_up, Surface_boundary%b_star, Atmos%Time)
+ if (id_q_star_up > 0) used = send_data(id_q_star_up, Surface_boundary%q_star, Atmos%Time)
+ if (id_dt_t > 0) used = send_data(id_dt_t, Surface_boundary%dt_t, Atmos%Time)
+ if (id_dt_sphum > 0) used = send_data(id_dt_sphum, Surface_boundary%dt_tr(:,:,ivapor), Atmos%Time)
+ if (id_dt_co2 > 0) used = send_data(id_dt_co2, Surface_boundary%dt_tr(:,:,ico2), Atmos%Time)
+ if (id_land_frac_up > 0) used = send_data(id_land_frac_up, Surface_boundary%land_frac, Atmos%Time)
Atmos%Surf_diff%delta_t = Surface_boundary%dt_t
Atmos%Surf_diff%delta_tr = Surface_boundary%dt_tr
@@ -327,6 +415,19 @@
call get_bottom_wind (Atmos % u_bot, Atmos % v_bot)
+ if (id_lprec > 0) used = send_data(id_lprec, Atmos%lprec, Atmos%Time)
+ if (id_fprec > 0) used = send_data(id_fprec, Atmos%fprec, Atmos%Time)
+ if (id_gust_up > 0) used = send_data(id_gust_up, Atmos%gust, Atmos%Time)
+
+ if (id_t_bot > 0) used = send_data(id_t_bot, Atmos%t_bot, Atmos%Time)
+ if (id_sphum_bot > 0) used = send_data(id_sphum_bot, Atmos%tr_bot(:,:,ivapor), Atmos%Time)
+ if (id_co2_bot > 0) used = send_data(id_co2_bot, Atmos%tr_bot(:,:,ico2), Atmos%Time)
+ if (id_p_bot > 0) used = send_data(id_p_bot, Atmos%p_bot, Atmos%Time)
+ if (id_z_bot > 0) used = send_data(id_z_bot, Atmos%z_bot, Atmos%Time)
+ if (id_p_surf > 0) used = send_data(id_p_surf, Atmos%p_surf, Atmos%Time)
+ if (id_slp > 0) used = send_data(id_slp, Atmos%slp, Atmos%Time)
+ if (id_u_bot > 0) used = send_data(id_u_bot, Atmos%u_bot, Atmos%Time)
+ if (id_v_bot > 0) used = send_data(id_v_bot, Atmos%v_bot, Atmos%Time)
!------ global integrals ------
@@ -418,6 +519,9 @@
ivapor = get_tracer_index( MODEL_ATMOS, 'mix_rat' )
if (ivapor==NO_TRACER) &
call error_mesg('atmos_model_init', 'Cannot find water vapor in ATM tracer table', FATAL)
+ ico2 = get_tracer_index( MODEL_ATMOS, 'co2' )
+ if (ico2==NO_TRACER) &
+ call error_mesg('atmos_model_init', 'Cannot find CO2 in ATM tracer table', NOTE)
!-----------------------------------------------------------------------
! ----- initialize atmospheric model -----
@@ -455,6 +559,7 @@
Atmos % flux_sw_vis_dif(nlon,nlat), &
Atmos % flux_lw (nlon,nlat), &
Atmos % coszen (nlon,nlat), &
+ Atmos % coszen_radwt(nlon,nlat), &
Atmos % lprec (nlon,nlat), &
Atmos % fprec (nlon,nlat) )
@@ -472,6 +577,7 @@
Atmos % flux_sw_vis_dir (i,j) = 0.0
Atmos % flux_sw_vis_dif(i,j) = 0.0
Atmos % coszen(i,j) = 0.0
+ Atmos % coszen_radwt(i,j) = 0.0
enddo
enddo
!-----------------------------------------------------------------------
@@ -528,6 +634,10 @@
id_restart = register_restart_field(Til_restart, filename, 't_bot', Atmos%t_bot, domain=Atmos%domain)
id_restart = register_restart_field(Til_restart, filename, 'q_bot', Atmos%tr_bot(:,:,ivapor), domain=Atmos%domain)
end if
+ if (restart_zbot_pbot) then
+ id_restart = register_restart_field(Til_restart, filename, 'z_bot', Atmos%z_bot, domain=Atmos%domain, mandatory=.false.)
+ id_restart = register_restart_field(Til_restart, filename, 'p_bot', Atmos%p_bot, domain=Atmos%domain, mandatory=.false.)
+ end if
call get_time (Atmos % Time_step, sec, day)
dt = sec + 86400*day ! integer seconds
@@ -569,6 +679,10 @@
call read_data ( unit, Atmos % t_bot )
call read_data ( unit, Atmos % tr_bot(:,:,ivapor) )
endif
+ if (restart_zbot_pbot) then
+ call read_data ( unit, Atmos % z_bot )
+ call read_data ( unit, Atmos % p_bot )
+ endif
call close_file (unit)
!---- if the time step has changed then convert ----
@@ -604,6 +718,105 @@
deallocate (area)
!-----------------------------------------------------------------------
+ ! to update_atmos_model_down
+ id_land_frac_down = register_diag_field('atmos_model_down_in', 'land_frac_down', Atmos%axes(1:2), Atmos%Time, 'fraction amount of land in a grid box', '1')
+ id_u_star_down = register_diag_field('atmos_model_down_in', 'u_star', Atmos%axes(1:2), Atmos%Time, 'friction velocity (in)', 'unit')
+ id_b_star_down = register_diag_field('atmos_model_down_in', 'b_star', Atmos%axes(1:2), Atmos%Time, 'bouyancy scale (in)', 'unit')
+ id_q_star_down = register_diag_field('atmos_model_down_in', 'q_star', Atmos%axes(1:2), Atmos%Time, 'moisture scale (in)', 'unit')
+ id_t = register_diag_field('atmos_model_down_in', 't', Atmos%axes(1:2), Atmos%Time, 'surface temperature (in)', 'K', 0.0)
+ id_albedo = register_diag_field('atmos_model_down_in', 'albedo', Atmos%axes(1:2), Atmos%Time, 'albedo', '1', 0.0)
+ id_albedo_vis_dir = register_diag_field('atmos_model_down_in', 'albedo_vis_dir', Atmos%axes(1:2), Atmos%Time, 'albedo_vis_dir', '1', 0.0)
+ id_albedo_nir_dir = register_diag_field('atmos_model_down_in', 'albedo_nir_dir', Atmos%axes(1:2), Atmos%Time, 'albedo_nir_dir', '1', 0.0)
+ id_albedo_vis_dif = register_diag_field('atmos_model_down_in', 'albedo_vis_dif', Atmos%axes(1:2), Atmos%Time, 'albedo_vis_dif', '1', 0.0)
+ id_albedo_nir_dif = register_diag_field('atmos_model_down_in', 'albedo_nir_dif', Atmos%axes(1:2), Atmos%Time, 'albedo_nir_dif', '1', 0.0)
+ id_dtaudu = register_diag_field('atmos_model_down_in', 'dtaudu', Atmos%axes(1:2), Atmos%Time, 'derivative of zonal wind stress w.r.t. the lowest zonal level wind speed (in)', 'unit')
+ id_dtaudv = register_diag_field('atmos_model_down_in', 'dtaudv', Atmos%axes(1:2), Atmos%Time, 'derivative of meridional wind stress w.r.t. the lowest meridional level wind speed (in)', 'unit')
+ id_u_flux_in = register_diag_field('atmos_model_down_in', 'u_flux_in', Atmos%axes(1:2), Atmos%Time, 'zonal wind stress (in)', 'pa')
+ id_v_flux_in = register_diag_field('atmos_model_down_in', 'v_flux_in', Atmos%axes(1:2), Atmos%Time, 'meridional wind stress (in)', 'pa')
+ ! internal state of atmosphere, was copied to Atmos structure in previous get_bottom_XXX invocations during init or update_atmos_model_up
+ ! they are repeated here for easier synopsis with input/output variables
+ id_lprec_down = register_diag_field('atmos_model_down', 'lprec', Atmos%axes(1:2), Atmos%Time, 'mass of liquid precipitation since last time step (internal)', 'kg/m2')
+ id_fprec_down = register_diag_field('atmos_model_down', 'fprec', Atmos%axes(1:2), Atmos%Time, 'mass of frozen precipitation since last time step (internal)', 'kg/m2')
+ id_t_bot_down = register_diag_field('atmos_model_down', 't_bot', Atmos%axes(1:2), Atmos%Time, 'temperature at lowest model level (internal)', 'K', 0.0)
+ id_sphum_bot_down = register_diag_field('atmos_model_down', 'tr_sphum_bot', Atmos%axes(1:2), Atmos%Time, 'specific humidity (tracer) at lowest model level (internal)', 'kg/kg(?)')
+ if (ico2 /= NO_TRACER) then
+ id_co2_bot_down = register_diag_field('atmos_model_down', 'tr_co2_bot', Atmos%axes(1:2), Atmos%Time, 'co2 (tracer) at lowest model level (internal)', 'kg/kg wet air(?)')
+ else
+ id_co2_bot_down = -1
+ endif
+ id_p_bot_down = register_diag_field('atmos_model_down', 'p_bot', Atmos%axes(1:2), Atmos%Time, 'pressure at lowest model level (internal)', 'pa')
+ id_z_bot_down = register_diag_field('atmos_model_down', 'z_bot', Atmos%axes(1:2), Atmos%Time, 'height above the surface for the lowest model level (out)', 'm')
+ id_p_surf_down = register_diag_field('atmos_model_down', 'p_surf', Atmos%axes(1:2), Atmos%Time, 'surface pressure (internal)', 'unit')
+ id_slp_down = register_diag_field('atmos_model_down', 'slp', Atmos%axes(1:2), Atmos%Time, 'sea level pressure (internal)', 'pa')
+ id_u_bot_down = register_diag_field('atmos_model_down', 'u_bot', Atmos%axes(1:2), Atmos%Time, 'zonal wind component at lowest model level (internal)', 'unit')
+ id_v_bot_down = register_diag_field('atmos_model_down', 'v_bot', Atmos%axes(1:2), Atmos%Time, 'meridional wind component at lowest model level (internal)', 'unit')
+ ! from update_atmos_model_down
+ id_u_flux = register_diag_field('atmos_model_down', 'u_flux', Atmos%axes(1:2), Atmos%Time, 'zonal wind stress (out)', 'pa')
+ id_v_flux = register_diag_field('atmos_model_down', 'v_flux', Atmos%axes(1:2), Atmos%Time, 'meridional wind stress (out)', 'pa')
+ id_gust_down = register_diag_field('atmos_model_down', 'gust', Atmos%axes(1:2), Atmos%Time, 'gustiness factor (downward) (out)', '')
+ id_coszen = register_diag_field('atmos_model_down', 'coszen', Atmos%axes(1:2), Atmos%Time, 'cosine of the zenith angle (out)', '')
+ id_coszen_radwt = register_diag_field('atmos_model_down', 'coszen_radwt', Atmos%axes(1:2), Atmos%Time, 'cosine of the zenith angle radiation-weighted (out)', '')
+ id_flux_sw = register_diag_field('atmos_model_down', 'flux_sw', Atmos%axes(1:2), Atmos%Time, 'net shortwave flux at the surface (out)', 'W/m2')
+ id_flux_sw_dir = register_diag_field('atmos_model_down', 'flux_sw_dir', Atmos%axes(1:2), Atmos%Time, 'flux_sw_dir (out)', 'W/m2')
+ id_flux_sw_dif = register_diag_field('atmos_model_down', 'flux_sw_dif', Atmos%axes(1:2), Atmos%Time, 'flux_sw_dif (out)', 'W/m2')
+ id_flux_sw_down_vis_dir = register_diag_field('atmos_model_down', 'flux_sw_down_vis_dir', Atmos%axes(1:2), Atmos%Time, 'flux_sw_down_vis_dir (out)', 'W/m2')
+ id_flux_sw_down_vis_dif = register_diag_field('atmos_model_down', 'flux_sw_down_vis_dif', Atmos%axes(1:2), Atmos%Time, 'flux_sw_down_vis_dif (out)', 'W/m2')
+ id_flux_sw_down_total_dir = register_diag_field('atmos_model_down', 'flux_sw_down_total_dir', Atmos%axes(1:2), Atmos%Time, 'flux_sw_down_total_dir (out)', 'W/m2')
+ id_flux_sw_down_total_dif = register_diag_field('atmos_model_down', 'flux_sw_down_total_dif', Atmos%axes(1:2), Atmos%Time, 'flux_sw_down_total_dif (out)', 'W/m2')
+ id_flux_sw_vis = register_diag_field('atmos_model_down', 'flux_sw_vis', Atmos%axes(1:2), Atmos%Time, 'flux_sw_vis (out)', 'W/m2')
+ id_flux_sw_vis_dir = register_diag_field('atmos_model_down', 'flux_sw_vis_dir', Atmos%axes(1:2), Atmos%Time, 'flux_sw_vis_dir (out)', 'W/m2')
+ id_flux_sw_vis_dif = register_diag_field('atmos_model_down', 'flux_sw_vis_dif', Atmos%axes(1:2), Atmos%Time, 'flux_sw_vis_dif (out)', 'W/m2')
+ id_flux_lw = register_diag_field('atmos_model_down', 'flux_lw', Atmos%axes(1:2), Atmos%Time, 'downward (FMS says net) longwave flux at the surface (out)', 'W/m2')
+ id_dtmass = register_diag_field('atmos_model_down', 'dtmass', Atmos%axes(1:2), Atmos%Time, 'dtmass longname (out)', 'unit')
+ id_dflux_t = register_diag_field('atmos_model_down', 'dflux_t', Atmos%axes(1:2), Atmos%Time, 'derivative of implicit part of downward temperature flux at the top of the lowest atmospheric layer (out)', 'J/(m2 K)')
+ id_dflux_sphum = register_diag_field('atmos_model_down', 'dflux_tr_sphum', Atmos%axes(1:2), Atmos%Time, 'derivative of implicit part of downward flux of specific humidity at the top of the lowest atmospheric layer (out)', 'kg/(m2 s)')
+ if (ico2 /= NO_TRACER) then
+ id_dflux_co2 = register_diag_field('atmos_model_down', 'dflux_tr_co2', Atmos%axes(1:2), Atmos%Time, 'derivative of implicit part of downward flux of co2 at the top of the lowest atmospheric layer (out)', 'kg/(m2 s)?')
+ else
+ id_dflux_co2 = -1
+ end if
+ id_delta_t = register_diag_field('atmos_model_down', 'delta_t', Atmos%axes(1:2), Atmos%Time, 'increment in temperature in the lowest atmospheric layer (out)', 'K')
+ id_delta_sphum = register_diag_field('atmos_model_down', 'delta_tr_sphum', Atmos%axes(1:2), Atmos%Time, 'increment in specific humidity (tracer) in the lowest atmospheric layer (out)', 'kg/kg')
+ if (ico2 /= NO_TRACER) then
+ id_delta_co2 = register_diag_field('atmos_model_down', 'delta_tr_co2', Atmos%axes(1:2), Atmos%Time, 'increment in co2 (tracer) in the lowest atmospheric layer (out)', 'kg/kg?')
+ else
+ id_delta_co2 = -1
+ end if
+ id_delta_u = register_diag_field('atmos_model_down', 'delta_u', Atmos%axes(1:2), Atmos%Time, 'delta_u (out)', 'unit')
+ id_delta_v = register_diag_field('atmos_model_down', 'delta_v', Atmos%axes(1:2), Atmos%Time, 'delta_v (out)', 'unit')
+ ! to update_atmos_model_up
+ id_land_frac_up = register_diag_field('atmos_model_up_in', 'land_frac_up', Atmos%axes(1:2), Atmos%Time, 'fraction amount of land in a grid box', '1')
+ id_u_star_up = register_diag_field('atmos_model_up_in', 'u_star', Atmos%axes(1:2), Atmos%Time, 'friction velocity (in)', 'unit')
+ id_b_star_up = register_diag_field('atmos_model_up_in', 'b_star', Atmos%axes(1:2), Atmos%Time, 'bouyancy scale (in)', 'unit')
+ id_q_star_up = register_diag_field('atmos_model_up_in', 'q_star', Atmos%axes(1:2), Atmos%Time, 'moisture scale (in)', 'unit')
+ id_dt_t = register_diag_field('atmos_model_up_in', 'dt_t', Atmos%axes(1:2), Atmos%Time, 'increment in temperature in the lowest atmospheric layer (in)', 'K')
+ id_dt_sphum = register_diag_field('atmos_model_up_in', 'dt_tr_sphum', Atmos%axes(1:2), Atmos%Time, 'increment in specific humidity (tracer) in the lowest atmospheric layer (in)', 'kg/kg')
+ if (ico2 /= NO_TRACER) then
+ id_dt_co2 = register_diag_field('atmos_model_up_in', 'dt_tr_co2', Atmos%axes(1:2), Atmos%Time, 'increment in co2 (tracer) in the lowest atmospheric layer (in)', 'kg/kg?')
+ else
+ id_dt_co2 = -1
+ end if
+ ! from update_atmos_model_up
+ id_lprec = register_diag_field('atmos_model_up', 'lprec', Atmos%axes(1:2), Atmos%Time, 'mass of liquid precipitation since last time step (out)', 'kg/m2')
+ id_fprec = register_diag_field('atmos_model_up', 'fprec', Atmos%axes(1:2), Atmos%Time, 'mass of frozen precipitation since last time step (out)', 'kg/m2')
+ id_gust_up = register_diag_field('atmos_model_up', 'gust_up', Atmos%axes(1:2), Atmos%Time, 'gustiness factor (upward) (out)', 'm/s')
+ id_t_bot = register_diag_field('atmos_model_up', 't_bot', Atmos%axes(1:2), Atmos%Time, 'temperature at lowest model level (out)', 'K', 0.0)
+ id_sphum_bot = register_diag_field('atmos_model_up', 'tr_sphum_bot', Atmos%axes(1:2), Atmos%Time, 'specific humidity (tracer) at lowest model level (out)', 'kg/kg?')
+ if (ico2 /= NO_TRACER) then
+ id_co2_bot = register_diag_field('atmos_model_up', 'tr_co2_bot', Atmos%axes(1:2), Atmos%Time, 'co2 (tracer) at lowest model level (out)', 'kg/kg wet air?')
+ else
+ id_co2_bot = -1
+ end if
+ id_p_bot = register_diag_field('atmos_model_up', 'p_bot', Atmos%axes(1:2), Atmos%Time, 'pressure at lowest model level (out)', 'pa')
+ id_z_bot = register_diag_field('atmos_model_up', 'z_bot', Atmos%axes(1:2), Atmos%Time, 'height above the surface for the lowest model level (out)', 'm')
+ id_p_surf = register_diag_field('atmos_model_up', 'p_surf', Atmos%axes(1:2), Atmos%Time, 'surface pressure (out)', 'unit')
+ id_slp = register_diag_field('atmos_model_up', 'slp', Atmos%axes(1:2), Atmos%Time, 'sea level pressure (out)', 'pa')
+ id_u_bot = register_diag_field('atmos_model_up', 'u_bot', Atmos%axes(1:2), Atmos%Time, 'zonal wind component at lowest model level (out)', 'unit')
+ id_v_bot = register_diag_field('atmos_model_up', 'v_bot', Atmos%axes(1:2), Atmos%Time, 'meridional wind component at lowest model level (out)', 'unit')
+
+
+ call atmos_data_type_chksum('atmos_model_init',0,Atmos)
+!-----------------------------------------------------------------------
atmClock = mpp_clock_id( 'Atmosphere', flags=clock_flag_default, grain=CLOCK_COMPONENT )
end subroutine atmos_model_init
!
@@ -671,6 +884,7 @@
Atmos % flux_sw_vis_dif , &
Atmos % flux_lw , &
Atmos % coszen , &
+ Atmos % coszen_radwt, &
Atmos % lprec , &
Atmos % fprec )
@@ -723,9 +937,15 @@
call write_data ( unit, Atmos % t_bot )
call write_data ( unit, Atmos % tr_bot(:,:,ivapor) )
endif
+ if(restart_zbot_pbot) then
+ call write_data ( unit, Atmos % z_bot )
+ call write_data ( unit, Atmos % p_bot )
+ endif
call close_file (unit)
endif
+ call atmos_data_type_chksum('atmos_model_local_restart',0,Atmos)
+
end subroutine atmos_model_local_restart
!
!#######################################################################
@@ -822,6 +1042,7 @@
write(outunit,100) ' atm%slp ', mpp_chksum(atm%slp )
write(outunit,100) ' atm%gust ', mpp_chksum(atm%gust )
write(outunit,100) ' atm%coszen ', mpp_chksum(atm%coszen )
+ write(outunit,100) ' atm%coszen_radwt ', mpp_chksum(atm%coszen_radwt )
write(outunit,100) ' atm%flux_sw ', mpp_chksum(atm%flux_sw )
write(outunit,100) ' atm%flux_sw_dir ', mpp_chksum(atm%flux_sw_dir )
write(outunit,100) ' atm%flux_sw_dif ', mpp_chksum(atm%flux_sw_dif )
diff -ur --unidirectional-new-file -b -E -Z -x CM2.1p1 -x StripedPlanet -x atmos_bgrid -x atmos_ebm -x land_lad2 -x mom5 -x generic_tracers /p/tmp/petri/mom5-af3a94d4/src/atmos_fv_dynamics/driver/coupled/atmosphere.F90 MonsoonPlanet/src/atmos_fv_dynamics/driver/coupled/atmosphere.F90
--- /p/tmp/petri/mom5-af3a94d4/src/atmos_fv_dynamics/driver/coupled/atmosphere.F90 2018-10-11 09:29:43.517736265 +0200
+++ MonsoonPlanet/src/atmos_fv_dynamics/driver/coupled/atmosphere.F90 2021-03-31 13:53:50.898663501 +0200
@@ -186,7 +186,7 @@
u_star, b_star, q_star, &
dtau_du, dtau_dv, tau_x, tau_y, &
frac_open_sea, &
- gust, coszen, flux_sw, &
+ gust, coszen, coszen_radwt, flux_sw, &
flux_sw_dir, flux_sw_dif, &
flux_sw_down_vis_dir, &
flux_sw_down_vis_dif, &
@@ -212,7 +212,7 @@
q_star, dtau_du, dtau_dv
real, intent(in), dimension(:,:) :: frac_open_sea
real, intent(inout), dimension(:,:) :: tau_x, tau_y
- real, intent(out), dimension(:,:) :: gust, coszen, flux_sw, &
+ real, intent(out), dimension(:,:) :: gust, coszen, coszen_radwt, flux_sw, &
flux_sw_dir, flux_sw_dif, &
flux_sw_down_vis_dir, &
flux_sw_down_total_dir, &
@@ -227,6 +227,8 @@
real zvir
#include "fv_point.inc"
+ coszen_radwt = 0.
+
zvir = rvgas/rdgas - 1.
call fv_print_chksums( 'Entering atmosphere_down' )
diff -ur --unidirectional-new-file -b -E -Z -x CM2.1p1 -x StripedPlanet -x atmos_bgrid -x atmos_ebm -x land_lad2 -x mom5 -x generic_tracers /p/tmp/petri/mom5-af3a94d4/src/atmos_fv_dynamics/driver/coupled/fv_physics.F90 MonsoonPlanet/src/atmos_fv_dynamics/driver/coupled/fv_physics.F90
--- /p/tmp/petri/mom5-af3a94d4/src/atmos_fv_dynamics/driver/coupled/fv_physics.F90 2018-10-11 09:29:43.518945268 +0200
+++ MonsoonPlanet/src/atmos_fv_dynamics/driver/coupled/fv_physics.F90 2021-03-31 13:53:50.900129191 +0200
@@ -213,6 +213,8 @@
num_phys_windows = (nx_dom/nx_win)*(ny_dom/ny_win)
write(text,'(a,2i4)') 'num_phys_windows, numthreads',num_phys_windows,numthreads
call error_mesg ('fv_physics_init', trim(text), NOTE)
+ write(text,'(a,4i4)') ' nx_dom, ny_dom, nx_win, ny_win', nx_dom, ny_dom, nx_win, ny_win
+ call error_mesg ('fv_physics_init', trim(text), NOTE)
allocate(physics_window_x(num_phys_windows))
allocate(physics_window_y(num_phys_windows))
i = 1
diff -ur --unidirectional-new-file -b -E -Z -x CM2.1p1 -x StripedPlanet -x atmos_bgrid -x atmos_ebm -x land_lad2 -x mom5 -x generic_tracers /p/tmp/petri/mom5-af3a94d4/src/atmos_fv_dynamics/tools/fv_restart.F90 MonsoonPlanet/src/atmos_fv_dynamics/tools/fv_restart.F90
--- /p/tmp/petri/mom5-af3a94d4/src/atmos_fv_dynamics/tools/fv_restart.F90 2022-12-21 10:27:22.549678505 +0100
+++ MonsoonPlanet/src/atmos_fv_dynamics/tools/fv_restart.F90 2021-03-31 13:53:50.845650909 +0200
@@ -1233,6 +1233,7 @@
phis_alloc(ids:ide,jcs:jce) = phis(ids:ide,jcs:jce)
call mpp_write(iuic, phis_field, fv_domain, phis_alloc)
allocate (delp_alloc(ids:ide,jds:jde,nlev))
+ delp_alloc = -999.9
delp_alloc(ids:ide,jcs:jce,:) = delp(ids:ide,jcs:jce,:) !RASF Bug fix for array bounds
call mpp_write(iuic, delp_field, fv_domain, delp_alloc) !RASF Bug fix for array bounds
deallocate(delp_alloc)
diff -ur --unidirectional-new-file -b -E -Z -x CM2.1p1 -x StripedPlanet -x atmos_bgrid -x atmos_ebm -x land_lad2 -x mom5 -x generic_tracers /p/tmp/petri/mom5-af3a94d4/src/atmos_null/atmos_model.F90 MonsoonPlanet/src/atmos_null/atmos_model.F90
--- /p/tmp/petri/mom5-af3a94d4/src/atmos_null/atmos_model.F90 2014-03-18 14:03:56.000000000 +0100
+++ MonsoonPlanet/src/atmos_null/atmos_model.F90 2021-03-31 13:53:52.349289941 +0200
@@ -112,6 +112,7 @@
real, pointer, dimension(:,:) :: slp => NULL() ! sea level pressure
real, pointer, dimension(:,:) :: gust => NULL() ! gustiness factor
real, pointer, dimension(:,:) :: coszen => NULL() ! cosine of the zenith angle
+ real, pointer, dimension(:,:) :: coszen_radwt => NULL() ! cosine of the zenith angle, radiation weighted
real, pointer, dimension(:,:) :: flux_sw => NULL() ! net shortwave flux (W/m2) at the surface
real, pointer, dimension(:,:) :: flux_sw_dir =>NULL()
real, pointer, dimension(:,:) :: flux_sw_dif =>NULL()
@@ -433,6 +434,7 @@
allocate ( Atmos % slp(is:ie,js:je) )
allocate ( Atmos % gust(is:ie,js:je) )
allocate ( Atmos % coszen(is:ie,js:je) )
+allocate ( Atmos % coszen_radwt(is:ie,js:je) )
allocate ( Atmos % flux_sw(is:ie,js:je) )
allocate ( Atmos % flux_sw_dir (is:ie,js:je) )
allocate ( Atmos % flux_sw_dif (is:ie,js:je) )
@@ -457,6 +459,7 @@
Atmos % slp = 1.e5
Atmos % gust = 0.0
Atmos % coszen = 0.0
+Atmos % coszen_radwt = 0.0
Atmos % flux_sw = 0.0
Atmos % flux_lw = 0.0
Atmos % flux_sw_dir = 0.0
@@ -625,6 +628,7 @@
write(outunit,100) ' atm%slp ', mpp_chksum(atm%slp )
write(outunit,100) ' atm%gust ', mpp_chksum(atm%gust )
write(outunit,100) ' atm%coszen ', mpp_chksum(atm%coszen )
+ write(outunit,100) ' atm%coszen_radwt ', mpp_chksum(atm%coszen_radwt )
write(outunit,100) ' atm%flux_sw ', mpp_chksum(atm%flux_sw )
write(outunit,100) ' atm%flux_sw_dir ', mpp_chksum(atm%flux_sw_dir )
write(outunit,100) ' atm%flux_sw_dif ', mpp_chksum(atm%flux_sw_dif )
diff -ur --unidirectional-new-file -b -E -Z -x CM2.1p1 -x StripedPlanet -x atmos_bgrid -x atmos_ebm -x land_lad2 -x mom5 -x generic_tracers /p/tmp/petri/mom5-af3a94d4/src/atmos_param/cosp/quickbeam/radar_simulator.F90 MonsoonPlanet/src/atmos_param/cosp/quickbeam/radar_simulator.F90
--- /p/tmp/petri/mom5-af3a94d4/src/atmos_param/cosp/quickbeam/radar_simulator.F90 2014-03-18 14:03:56.000000000 +0100
+++ MonsoonPlanet/src/atmos_param/cosp/quickbeam/radar_simulator.F90 2021-03-31 13:53:50.635124329 +0200
@@ -119,7 +119,8 @@
real*8, dimension(:), allocatable :: &
Di, Deq, & ! discrete drop sizes (um)
Ni, Ntemp, & ! discrete concentrations (cm^-3 um^-1)
- rhoi ! discrete densities (kg m^-3)
+ rhoi, & ! discrete densities (kg m^-3)
+ xx_rhoi ! to expand parameter xx to array parameter
real*8, dimension(ngate) :: &
z_vol, & ! effective reflectivity factor (mm^6/m^3)
@@ -297,17 +298,18 @@
select case(hp%dtype(tp))
case(4)
ns = 1
- allocate(Di(ns),Ni(ns),rhoi(ns),xxa(ns),Deq(ns))
+ allocate(Di(ns),Ni(ns),rhoi(ns),xx_rhoi(ns),xxa(ns),Deq(ns))
if (use_mie_table == 1) allocate(mt_qext(ns),mt_qbsca(ns),Ntemp(ns))
Di = hp%p1(tp)
Ni = 0.
case default
ns = nsizes
- allocate(Di(ns),Ni(ns),rhoi(ns),xxa(ns),Deq(ns))
+ allocate(Di(ns),Ni(ns),rhoi(ns),xx_rhoi(ns),xxa(ns),Deq(ns))
if (use_mie_table == 1) allocate(mt_qext(ns),mt_qbsca(ns),Ntemp(ns))
Di = D
Ni = 0.
end select
+ xx_rhoi = xx
! :: create a DSD (using scaling factor if applicable)
! hp%scaled(tp,iRe_type)=.false. ! turn off N scaling
@@ -389,7 +391,7 @@
end select
call zeff(freq,Di,Ni,ns,k2,mt_ttl(itt),0,do_ray, &
- ze,zr,kr,mt_qext,mt_qbsca,xx)
+ ze,zr,kr,mt_qext,mt_qbsca,xx_rhoi)
else
@@ -414,7 +416,7 @@
end select
call zeff(freq,Di,Ni,ns,k2,mt_tti(itt),1,do_ray, &
- ze,zr,kr,mt_qext,mt_qbsca,xx)
+ ze,zr,kr,mt_qext,mt_qbsca,xx_rhoi)
endif
#endif
@@ -441,7 +443,7 @@
!endif
- deallocate(Di,Ni,rhoi,xxa,Deq)
+ deallocate(Di,Ni,rhoi, xx_rhoi,xxa,Deq)
if (use_mie_table == 1) deallocate(mt_qext,mt_qbsca,Ntemp)
#ifdef COSP_GFDL
diff -ur --unidirectional-new-file -b -E -Z -x CM2.1p1 -x StripedPlanet -x atmos_bgrid -x atmos_ebm -x land_lad2 -x mom5 -x generic_tracers /p/tmp/petri/mom5-af3a94d4/src/atmos_param/diag_integral/diag_integral.F90 MonsoonPlanet/src/atmos_param/diag_integral/diag_integral.F90
--- /p/tmp/petri/mom5-af3a94d4/src/atmos_param/diag_integral/diag_integral.F90 2018-10-11 09:29:43.584242643 +0200
+++ MonsoonPlanet/src/atmos_param/diag_integral/diag_integral.F90 2021-03-31 13:53:50.372817731 +0200
@@ -24,6 +24,7 @@
open_namelist_file, check_nml_error, &
fms_init, &
mpp_pe, mpp_root_pe,&
+ WARNING,&
FATAL, write_version_number, &
stdlog, close_file
use constants_mod, only: radius, constants_init
@@ -1187,6 +1188,7 @@
! local variables:
real :: field_avg(max_num_field)
+ logical :: field_skip(max_num_field)
real :: xtime, rcount
integer :: nn, ninc, nst, nend, fields_to_print
integer :: i, kount
@@ -1195,6 +1197,7 @@
! local variables:
!
! field_avg
+! field_skip
! xtime
! rcount
! nn
@@ -1223,28 +1226,37 @@
call mpp_sum (rcount)
call mpp_sum (field_sum(i))
icount = rcount
+ field_skip(i) = .false.
!--------------------------------------------------------------------
! verify that all the data expected for an integral has been
! obtained.
!--------------------------------------------------------------------
- if (icount == 0 ) call error_mesg &
+ if (icount == 0 ) then
+ call error_mesg &
('diag_integral_mod', &
'field_count equals zero for field_name ' // &
- field_name(i)(1:len_trim(field_name(i))), FATAL )
+ field_name(i)(1:len_trim(field_name(i))), WARNING )
+ field_skip(i) = .true.
+ end if
kount = icount/field_size
if ((field_size*1.0)*kount /= rcount) then
print*,"name,pe,kount,field_size,icount,rcount=",trim(field_name(i)),mpp_pe(),kount,field_size,icount,rcount
call error_mesg &
('diag_integral_mod', &
- 'field_count not a multiple of field_size', FATAL )
+ 'field_count not a multiple of field_size', WARNING )
+ field_skip(i) = .true.
endif
!----------------------------------------------------------------------
! define the global integral for field i. reinitialize the point
! and data accumulators.
!----------------------------------------------------------------------
+ if (field_skip(i)) then
+ field_avg(fields_to_print) = 9e33 ! missing value
+ else
field_avg(fields_to_print) = field_sum(i)/ &
(sum_area*float(kount))
+ end if
field_sum (i) = 0.0
field_count(i) = 0
end do
diff -ur --unidirectional-new-file -b -E -Z -x CM2.1p1 -x StripedPlanet -x atmos_bgrid -x atmos_ebm -x land_lad2 -x mom5 -x generic_tracers /p/tmp/petri/mom5-af3a94d4/src/atmos_param/monin_obukhov/monin_obukhov.F90 MonsoonPlanet/src/atmos_param/monin_obukhov/monin_obukhov.F90
--- /p/tmp/petri/mom5-af3a94d4/src/atmos_param/monin_obukhov/monin_obukhov.F90 2014-03-18 14:03:56.000000000 +0100
+++ MonsoonPlanet/src/atmos_param/monin_obukhov/monin_obukhov.F90 2021-03-31 13:53:50.111446346 +0200
@@ -859,14 +859,19 @@
integer :: ni, nj, nk, ier
real, parameter :: ustar_min = 1.e-10
+real, dimension(1,1) :: u_star1, b_star1
+real, dimension(1,1,1) :: z1, k_m1, k_h1
if(.not.module_is_initialized) call monin_obukhov_init
ni = 1; nj = 1; nk = 1
+z1 = z; u_star1 = u_star; b_star1 = b_star
call monin_obukhov_diff(vonkarm, &
& ustar_min, &
& neutral, stable_option, rich_crit, zeta_trans, &
- & ni, nj, nk, z, u_star, b_star, k_m, k_h, ier)
+ & ni, nj, nk, z1, u_star1, b_star1, k_m1, k_h1, ier)
+
+k_m = k_m1(1,1,1); k_h = k_h1(1,1,1)
end subroutine mo_diff_0d_1
@@ -880,14 +885,16 @@
integer :: ni, nj, nk, ier
real, parameter :: ustar_min = 1.e-10
+real, dimension(1,1) :: u_star1, b_star1
if(.not.module_is_initialized) call monin_obukhov_init
ni = 1; nj = 1; nk = size(z(:))
+u_star1 = u_star; b_star1 = b_star
call monin_obukhov_diff(vonkarm, &
& ustar_min, &
& neutral, stable_option, rich_crit, zeta_trans, &
- & ni, nj, nk, z, u_star, b_star, k_m, k_h, ier)
+ & ni, nj, nk, z, u_star1, b_star1, k_m, k_h, ier)
end subroutine mo_diff_0d_n
diff -ur --unidirectional-new-file -b -E -Z -x CM2.1p1 -x StripedPlanet -x atmos_bgrid -x atmos_ebm -x land_lad2 -x mom5 -x generic_tracers /p/tmp/petri/mom5-af3a94d4/src/atmos_param/physics_driver/physics_driver.F90 MonsoonPlanet/src/atmos_param/physics_driver/physics_driver.F90
--- /p/tmp/petri/mom5-af3a94d4/src/atmos_param/physics_driver/physics_driver.F90 2018-10-11 09:29:43.598148354 +0200
+++ MonsoonPlanet/src/atmos_param/physics_driver/physics_driver.F90 2021-03-31 13:53:49.961422984 +0200
@@ -2942,6 +2942,7 @@
lsc_rain(is:ie,js:je,:), &
lsc_snow_size(is:ie,js:je,:), &
lsc_rain_size(is:ie,js:je,:), &
+#ifdef CLUBB
! ---> h1g
dcond_ls_liquid=dcond_ls_liquid, dcond_ls_ice=dcond_ls_ice, &
Ndrop_act_CLUBB=Ndrop_act_CLUBB, Icedrop_act_CLUBB=Icedrop_act_CLUBB, &
@@ -2950,6 +2951,7 @@
tdt_shf = tdt_shf, &
qdt_lhf = qdt_lhf, &
! <--- h1g
+#endif
Aerosol=Aerosol, mask=mask, &
kbot=kbot, shallow_cloud_area=shallow_cloud_area(is:ie,js:je,:), &
shallow_liquid=shallow_liquid(is:ie,js:je,:), &
@@ -2996,6 +2998,7 @@
lsc_rain(is:ie,js:je,:), &
lsc_snow_size(is:ie,js:je,:), &
lsc_rain_size(is:ie,js:je,:), &
+#ifdef CLUBB
! ---> h1g
dcond_ls_liquid=dcond_ls_liquid, dcond_ls_ice=dcond_ls_ice, &
Ndrop_act_CLUBB=Ndrop_act_CLUBB, Icedrop_act_CLUBB=Icedrop_act_CLUBB, &
@@ -3004,6 +3007,7 @@
tdt_shf = tdt_shf, &
qdt_lhf = qdt_lhf, &
! <--- h1g
+#endif
Aerosol=Aerosol, mask=mask, kbot=kbot, &
cell_cld_frac= cell_cld_frac(is:ie,js:je,:), &
cell_liq_amt=cell_liq_amt(is:ie,js:je,:), &
@@ -3046,6 +3050,7 @@
lsc_rain(is:ie,js:je,:), &
lsc_snow_size(is:ie,js:je,:), &
lsc_rain_size(is:ie,js:je,:), &
+#ifdef CLUBB
! ---> h1g
dcond_ls_liquid=dcond_ls_liquid, dcond_ls_ice=dcond_ls_ice, &
Ndrop_act_CLUBB=Ndrop_act_CLUBB, Icedrop_act_CLUBB=Icedrop_act_CLUBB, &
@@ -3054,6 +3059,7 @@
tdt_shf = tdt_shf, &
qdt_lhf = qdt_lhf, &
! <--- h1g
+#endif
Aerosol=Aerosol, mask=mask, kbot= kbot, &
shallow_cloud_area= shallow_cloud_area(is:ie,js:je,:), &
shallow_liquid=shallow_liquid(is:ie,js:je,:), &
@@ -3088,6 +3094,7 @@
lsc_rain(is:ie,js:je,:), &
lsc_snow_size(is:ie,js:je,:), &
lsc_rain_size(is:ie,js:je,:), &
+#ifdef CLUBB
! ---> h1g
dcond_ls_liquid=dcond_ls_liquid, dcond_ls_ice=dcond_ls_ice, &
Ndrop_act_CLUBB=Ndrop_act_CLUBB, Icedrop_act_CLUBB=Icedrop_act_CLUBB, &
@@ -3096,6 +3103,7 @@
tdt_shf = tdt_shf, &
qdt_lhf = qdt_lhf, &
! <--- h1g
+#endif
Aerosol=Aerosol, mask=mask, kbot=kbot, &
hydrostatic=hydrostatic, phys_hydrostatic=phys_hydrostatic )
endif
diff -ur --unidirectional-new-file -b -E -Z -x CM2.1p1 -x StripedPlanet -x atmos_bgrid -x atmos_ebm -x land_lad2 -x mom5 -x generic_tracers /p/tmp/petri/mom5-af3a94d4/src/atmos_param/sea_esf_rad/isccp_clouds.F90 MonsoonPlanet/src/atmos_param/sea_esf_rad/isccp_clouds.F90
--- /p/tmp/petri/mom5-af3a94d4/src/atmos_param/sea_esf_rad/isccp_clouds.F90 2018-10-11 09:29:43.698040069 +0200
+++ MonsoonPlanet/src/atmos_param/sea_esf_rad/isccp_clouds.F90 2021-03-31 13:53:49.944022178 +0200
@@ -836,7 +836,7 @@
! Generate sub-cloud structures
!
seed(:) = (pfull(:, j, nlev) - int(pfull(:, j, nlev))) * 100 + 1
- call scops(strat, conv, seed, frac_out)
+ call isccp_clouds_scops(strat, conv, seed, frac_out)
!
! Take scops predictions of cloud fraction and fill in emmissivity and optical
@@ -862,14 +862,14 @@
qv(:, j, :), at(:, j, :), dem_wv)
! Call Icarus...
- call icarus(dtau, pFull(:, j, :), &
+ call isccp_clouds_icarus(dtau, pFull(:, j, :), &
dem, dem_wv, at(:, j, :), skt(:, j), &
(/ (emsfclw, j = 1, nPoints) /), &
boxtau = boxtau, boxptop = boxptop)
else
! We're asking for the real cloud tops.
! We don't correct very optically thin clouds either.
- call icarus(dtau, pFull(:, j, :), &
+ call isccp_clouds_icarus(dtau, pFull(:, j, :), &
boxtau = boxtau, boxptop = boxptop)
end if
@@ -1140,14 +1140,14 @@
qv(:, j, :), at(:, j, :), dem_wv)
! Call Icarus...
- call icarus(dtau, pFull(:, j, :), &
+ call isccp_clouds_icarus(dtau, pFull(:, j, :), &
dem, dem_wv, at(:, j, :), skt(:, j), &
(/ (emsfclw, j = 1, nPoints) /), &
boxtau = boxtau, boxptop = boxptop)
else
! We're asking for the real cloud tops.
! We don't correct very optically thin clouds either.
- call icarus(dtau, pFull(:, j, :), &
+ call isccp_clouds_icarus(dtau, pFull(:, j, :), &
boxtau = boxtau, boxptop = boxptop)
end if
@@ -1573,7 +1573,7 @@
! Pincus additions start here
!
!######################################################################
- subroutine scops(cc, conv, seed, frac_out)
+ subroutine isccp_clouds_scops(cc, conv, seed, frac_out)
real, dimension(:, :), & ! Dimensions nPoints, nLev
intent( in) :: cc, & ! Cloud cover in each model level (fraction)
! NOTE: This is the HORIZONTAL area of each grid box covered by clouds
@@ -1723,9 +1723,9 @@
end do !loop over nlev
- end subroutine scops
+ end subroutine isccp_clouds_scops
! -------------------------------------------------------------------
- subroutine icarus(dtau, pfull, & ! Required
+ subroutine isccp_clouds_icarus(dtau, pfull, & ! Required
dem, dem_wv, at, skt, emsfc_lw, iTrop, & ! Optional
boxtau, boxptop)
!
@@ -1987,7 +1987,7 @@
boxptop(:, :) = ptop(:, :) / 100.
boxtau(:, :) = tau(:, :)
- end subroutine icarus
+ end subroutine isccp_clouds_icarus
! -------------------------------------------------------------------
! ------------------------------------------------------
function computeIsccpJointHistograms(tau, ptop, sunlit) result(isccpJointHistogram)
diff -ur --unidirectional-new-file -b -E -Z -x CM2.1p1 -x StripedPlanet -x atmos_bgrid -x atmos_ebm -x land_lad2 -x mom5 -x generic_tracers /p/tmp/petri/mom5-af3a94d4/src/atmos_param/sea_esf_rad/radiative_gases.F90 MonsoonPlanet/src/atmos_param/sea_esf_rad/radiative_gases.F90
--- /p/tmp/petri/mom5-af3a94d4/src/atmos_param/sea_esf_rad/radiative_gases.F90 2018-10-11 09:29:43.721152267 +0200
+++ MonsoonPlanet/src/atmos_param/sea_esf_rad/radiative_gases.F90 2021-08-02 10:51:27.913328000 +0200
@@ -1497,9 +1497,11 @@
!--------------------------------------------------------------------
! deallocate the timeseries arrays.
!--------------------------------------------------------------------
- deallocate (co2_value, ch4_value, n2o_value, f11_value, &
+ if (associated(co2_value)) deallocate(co2_value)
+ deallocate (ch4_value, n2o_value, f11_value, &
f12_value, f113_value, f22_value)
- deallocate (Co2_time_list, Ch4_time_list, N2o_time_list, &
+ if (associated(Co2_time_list)) deallocate(Co2_time_list)
+ deallocate (Ch4_time_list, N2o_time_list, &
F11_time_list, F12_time_List, &
F113_time_list, F22_time_list)
diff -ur --unidirectional-new-file -b -E -Z -x CM2.1p1 -x StripedPlanet -x atmos_bgrid -x atmos_ebm -x land_lad2 -x mom5 -x generic_tracers /p/tmp/petri/mom5-af3a94d4/src/coupler/coupler_main.F90 MonsoonPlanet/src/coupler/coupler_main.F90
--- /p/tmp/petri/mom5-af3a94d4/src/coupler/coupler_main.F90 2018-10-11 09:29:43.853219376 +0200
+++ MonsoonPlanet/src/coupler/coupler_main.F90 2021-03-31 13:53:51.962574442 +0200
@@ -1002,7 +1002,7 @@
if( Ocean%is_ocean_pe )then
call mpp_set_current_pelist( Ocean%pelist )
-! call omp_set_num_threads(ocean_nthreads)
+!$ call omp_set_num_threads(ocean_nthreads)
! base_cpu = get_cpu_affinity()
! !$OMP PARALLEL
! call set_cpu_affinity( base_cpu + omp_get_thread_num() )
@@ -1180,7 +1180,7 @@
call mpp_close(unit)
-20 format (6i4,2x,a3)
+20 format (6i6,2x,a3)
!-----------------------------------------------------------------------
!----- compute the time steps ------
diff -ur --unidirectional-new-file -b -E -Z -x CM2.1p1 -x StripedPlanet -x atmos_bgrid -x atmos_ebm -x land_lad2 -x mom5 -x generic_tracers /p/tmp/petri/mom5-af3a94d4/src/coupler/flux_exchange.F90 MonsoonPlanet/src/coupler/flux_exchange.F90
--- /p/tmp/petri/mom5-af3a94d4/src/coupler/flux_exchange.F90 2022-12-21 10:27:22.662285700 +0100
+++ MonsoonPlanet/src/coupler/flux_exchange.F90 2021-03-31 13:53:51.964495301 +0200
@@ -155,8 +155,9 @@
use mpp_mod, only: mpp_npes, mpp_pe, mpp_root_pe, &
mpp_error, stderr, stdout, stdlog, FATAL, NOTE, mpp_set_current_pelist, &
mpp_clock_id, mpp_clock_begin, mpp_clock_end, mpp_sum, &
- CLOCK_COMPONENT, CLOCK_SUBCOMPONENT, CLOCK_ROUTINE, lowercase, &
+ CLOCK_COMPONENT, CLOCK_SUBCOMPONENT, CLOCK_ROUTINE, CLOCK_LOOP, lowercase, &
input_nml_file
+ use mpp_mod, only: mpp_get_current_pelist_name
use mpp_domains_mod, only: mpp_get_compute_domain, mpp_get_compute_domains, &
mpp_global_sum, mpp_redistribute, operator(.EQ.)
@@ -289,6 +290,10 @@
id_t_ref_land, id_rh_ref_land, id_u_ref_land, id_v_ref_land, &
id_q_ref, id_q_ref_land, id_q_flux_land, id_rh_ref_cmip
+ integer :: id_lprec, id_fprec, &
+ id_sw_flux, &
+ id_sw_flux_vis_dir, id_sw_flux_nir_dir, id_sw_flux_vis_dif, id_sw_flux_nir_dif
+
integer :: id_co2_atm_dvmr, id_co2_surf_dvmr
integer, allocatable :: id_tr_atm(:), id_tr_surf(:), id_tr_flux(:), id_tr_mol_flux(:)
@@ -432,6 +437,7 @@
integer :: cplClock, sfcClock, fluxAtmDnClock, fluxLandIceClock, &
fluxIceOceanClock, fluxOceanIceClock, regenClock, fluxAtmUpClock, &
cplOcnClock
+ integer :: sfcDOClock, sfcFOClock, sfcPutXgridClock, sfcGetXgridClock, sfcFluxClock, sfcMOprofClock, sfcAtmOcnFluxClock, sfcDiagClock
logical :: ocn_pe, ice_pe
integer, allocatable, dimension(:) :: ocn_pelist, ice_pelist
@@ -875,6 +881,7 @@
allocate( atmos_ice_boundary%dedt(is:ie,js:je,kd) )
allocate( atmos_ice_boundary%drdt(is:ie,js:je,kd) )
allocate( atmos_ice_boundary%coszen(is:ie,js:je,kd) )
+ allocate( atmos_ice_boundary%coszen_radwt(is:ie,js:je,kd) )
allocate( atmos_ice_boundary%p(is:ie,js:je,kd) )
! initialize boundary values for override experiments (mjh)
atmos_ice_boundary%u_flux=0.0
@@ -893,6 +900,7 @@
atmos_ice_boundary%dedt=0.0
atmos_ice_boundary%drdt=0.0
atmos_ice_boundary%coszen=0.0
+ atmos_ice_boundary%coszen_radwt=0.0
atmos_ice_boundary%p=0.0
! allocate fields for extra fluxes
@@ -961,6 +969,14 @@
!Balaji: clocks on atm%pe only
cplClock = mpp_clock_id( 'Land-ice-atm coupler', flags=clock_flag_default, grain=CLOCK_COMPONENT )
sfcClock = mpp_clock_id( 'SFC boundary layer', flags=clock_flag_default, grain=CLOCK_SUBCOMPONENT )
+ sfcDOClock = mpp_clock_id( 'SFC boundary layer data_override', flags=clock_flag_default, grain=CLOCK_LOOP )
+ sfcFOClock = mpp_clock_id( 'SFC boundary layer override fluxes', flags=clock_flag_default, grain=CLOCK_LOOP )
+ sfcPutXgridClock = mpp_clock_id( 'SFC boundary layer put_to_xgrid', flags=clock_flag_default, grain=CLOCK_LOOP )
+ sfcGetXgridClock = mpp_clock_id( 'SFC boundary layer get_from_xgrid', flags=clock_flag_default, grain=CLOCK_LOOP )
+ sfcFluxClock = mpp_clock_id( 'SFC boundary layer surface_flux', flags=clock_flag_default, grain=CLOCK_LOOP )
+ sfcMOProfClock = mpp_clock_id( 'SFC boundary layer mo_profile', flags=clock_flag_default, grain=CLOCK_LOOP )
+ sfcAtmOcnFluxClock = mpp_clock_id( 'SFC boundary layer atm_ocean_flux', flags=clock_flag_default, grain=CLOCK_LOOP )
+ sfcDiagClock = mpp_clock_id( 'SFC boundary layer diagnostics', flags=clock_flag_default, grain=CLOCK_LOOP )
fluxAtmDnClock = mpp_clock_id( 'Flux DN from atm', flags=clock_flag_default, grain=CLOCK_ROUTINE )
fluxLandIceClock = mpp_clock_id( 'Flux land to ice', flags=clock_flag_default, grain=CLOCK_ROUTINE )
regenClock = mpp_clock_id( 'XGrid generation', flags=clock_flag_default, grain=CLOCK_ROUTINE )
@@ -1333,6 +1349,7 @@
ex_cd_q = 0.0
ex_frac_open_sea =0.
!-----------------------------------------------------------------------
+ call mpp_clock_begin(sfcDOClock)
!Balaji: data_override stuff moved from coupler_main
call data_override ('ATM', 't_bot', Atm%t_bot , Time)
call data_override ('ATM', 'z_bot', Atm%z_bot , Time)
@@ -1415,9 +1432,9 @@
call data_override ('LND', 'albedo_nir_dir', Land%albedo_nir_dir,Time)
call data_override ('LND', 'albedo_vis_dif', Land%albedo_vis_dif,Time)
call data_override ('LND', 'albedo_nir_dif', Land%albedo_nir_dif,Time)
-
+ call mpp_clock_end(sfcDOClock)
!---- put atmosphere quantities onto exchange grid ----
-
+ call mpp_clock_begin(sfcPutXgridClock)
! [4] put all the qantities we need onto exchange grid
! [4.1] put atmosphere quantities onto exchange grid
if (do_forecast) then
@@ -1513,6 +1530,7 @@
! fluxes will be 0
endif
enddo
+ call mpp_clock_end(sfcPutXgridClock)
ex_land_frac = 0.0
call put_logical_to_real (Land%mask, 'LND', ex_land_frac, xmap_sfc)
@@ -1544,6 +1562,7 @@
end if
! [5] compute explicit fluxes and tendencies at all available points ---
+ call mpp_clock_begin(sfcFluxClock)
call some(xmap_sfc, ex_avail)
call surface_flux (&
ex_t_atm, ex_tr_atm(:,isphum), ex_u_atm, ex_v_atm, ex_p_atm, ex_z_atm, &
@@ -1580,7 +1599,9 @@
endif
#endif
+ call mpp_clock_end(sfcFluxClock)
+ call mpp_clock_begin(sfcMOprofClock)
zrefm = 10.0
zrefh = z_ref_heat
! ---- optimize calculation ----
@@ -1609,10 +1630,12 @@
ex_dfdtr_surf (:,tr) = ex_dfdtr_surf (:,isphum)
ex_flux_tr (:,tr) = ex_dfdtr_surf(:,tr)*(ex_tr_surf(:,tr)-ex_tr_atm(:,tr))
enddo
+ call mpp_clock_end(sfcMOprofClock)
! Combine explicit ocean flux and implicit land flux of extra flux fields.
! Calculate ocean explicit flux here
+ call mpp_clock_begin(sfcAtmOcnFluxClock)
call atmos_ocean_fluxes_calc(ex_gas_fields_atm, ex_gas_fields_ice, ex_gas_fluxes, ex_seawater)
@@ -1637,8 +1660,10 @@
enddo !} i
endif !}
enddo !} n
+ call mpp_clock_end(sfcAtmOcnFluxClock)
! [5.2] override tracer fluxes and derivatives
+ call mpp_clock_begin(sfcFOClock)
do tr = 1,n_exch_tr
if( tr_table(tr)%atm == NO_TRACER ) cycle ! it should never happen, though
@@ -1686,6 +1711,7 @@
! For sensible heat flux names are "ex_flux_t", "ex_dhdt_surf", and "ex_dhdt_atm";
! despite the name those are actually in energy units, W/m2, W/(m2 degK), and
! W/(m2 degK) respectively
+ call mpp_clock_end(sfcFOClock)
where (ex_avail) ex_drag_q = ex_wind*ex_cd_q
! [6] get mean quantities on atmosphere grid
@@ -1693,6 +1719,7 @@
ex_t_surf4 = ex_t_surf ** 4
! [6.2] put relevant quantities onto atmospheric boundary
+ call mpp_clock_begin(sfcGetXgridClock)
call get_from_xgrid (Land_Ice_Atmos_Boundary%t, 'ATM', ex_t_surf4 , xmap_sfc, complete=.false.)
call get_from_xgrid (Land_Ice_Atmos_Boundary%frac_open_sea,'ATM',ex_frac_open_sea, xmap_sfc)
call get_from_xgrid (Land_Ice_Atmos_Boundary%albedo, 'ATM', ex_albedo , xmap_sfc, complete=.false.)
@@ -1718,9 +1745,11 @@
if (do_forecast) then
call get_from_xgrid (Ice%t_surf, 'OCN', ex_t_surf, xmap_sfc)
end if
+ call mpp_clock_end(sfcGetXgridClock)
Land_Ice_Atmos_Boundary%t = Land_Ice_Atmos_Boundary%t ** 0.25
!Balaji: data_override calls moved here from coupler_main
+ call mpp_clock_begin(sfcDOClock)
call data_override('ATM', 't', Land_Ice_Atmos_Boundary%t, Time)
call data_override('ATM', 'albedo', Land_Ice_Atmos_Boundary%albedo, Time)
@@ -1742,6 +1771,7 @@
call data_override('ATM', 'b_star', Land_Ice_Atmos_Boundary%b_star, Time)
! call data_override('ATM', 'q_star', Land_Ice_Atmos_Boundary%q_star, Time)
call data_override('ATM', 'rough_mom', Land_Ice_Atmos_Boundary%rough_mom, Time)
+ call mpp_clock_end(sfcDOClock)
! [6.3] save atmos albedo fix and old albedo (for downward SW flux calculations)
! on exchange grid
@@ -1762,7 +1792,7 @@
ex_albedo_vis_dif_fix = 0.
ex_albedo_nir_dif_fix = 0.
-
+ call mpp_clock_begin(sfcPutXgridClock)
call put_to_xgrid (Land_Ice_Atmos_Boundary%albedo, 'ATM', ex_albedo_fix, xmap_sfc, complete=.false.)
call put_to_xgrid (Land_Ice_Atmos_Boundary%albedo_vis_dir, 'ATM', &
ex_albedo_vis_dir_fix, xmap_sfc, complete=.false.)
@@ -1772,6 +1802,7 @@
ex_albedo_vis_dif_fix, xmap_sfc, complete=.false.)
call put_to_xgrid (Land_Ice_Atmos_Boundary%albedo_nir_dif, 'ATM', &
ex_albedo_nir_dif_fix, xmap_sfc, complete=.true.)
+ call mpp_clock_end(sfcPutXgridClock)
ex_albedo_fix = (1.0-ex_albedo) / (1.0-ex_albedo_fix)
ex_albedo_vis_dir_fix = (1.0-ex_albedo_vis_dir) / (1.0-ex_albedo_vis_dir_fix)
ex_albedo_nir_dir_fix = (1.0-ex_albedo_nir_dir) / (1.0-ex_albedo_nir_dir_fix)
@@ -1793,6 +1824,7 @@
!=======================================================================
! [7] diagnostics section
+ call mpp_clock_begin(sfcDiagClock)
!------- save static fields first time only ------
if (first_static) then
@@ -2062,6 +2094,7 @@
(log(ex_z_atm/ex_rough_mom+1)/log(ex_z_atm/ex_rough_scale+1))**2, xmap_sfc)
used = send_data(id_rough_scale, diag_atm, Time)
endif
+ call mpp_clock_end(sfcDiagClock)
!Balaji
call mpp_clock_end(sfcClock)
@@ -2166,7 +2199,7 @@
ex_lprec, ex_fprec, &
ex_tprec, & ! temperature of precipitation, currently equal to atm T
ex_u_star_smooth, &
- ex_coszen
+ ex_coszen, ex_coszen_radwt
real, dimension(n_xgrid_sfc) :: ex_gamma , ex_dtmass, &
ex_delta_t, ex_delta_u, ex_delta_v, ex_dflux_t
@@ -2183,6 +2216,8 @@
character(32) :: tr_name ! name of the tracer
integer :: tr, n, m ! tracer indices
+ real, dimension(size(Atmos_Boundary%t,1),size(Atmos_Boundary%t,2)) :: diag_atm, diag_atm2
+
!Balaji
call mpp_clock_begin(cplClock)
call mpp_clock_begin(fluxAtmDnClock)
@@ -2244,6 +2279,7 @@
call put_to_xgrid (Atm%t_bot, 'ATM', ex_tprec, xmap_sfc, complete=.false.)
!!$ endif
+ call put_to_xgrid (Atm%coszen_radwt, 'ATM', ex_coszen_radwt, xmap_sfc, complete=.false.)
call put_to_xgrid (Atm%coszen, 'ATM', ex_coszen, xmap_sfc, complete=.true.)
call put_to_xgrid (Atm%flux_lw, 'ATM', ex_flux_lwd, xmap_sfc, remap_method=remap_method, complete=.false.)
@@ -2454,6 +2490,11 @@
endif
enddo
+#ifdef PIK_COUPLER_COSZEN_TO_LAND
+ call get_from_xgrid (Land_boundary%coszen_radwt, 'LND', ex_coszen_radwt, xmap_sfc)
+#endif
+
+
! current time is Time: is that ok? not available in land_data_type
!Balaji: data_override calls moved here from coupler_main
call data_override('LND', 't_flux', Land_boundary%t_flux, Time )
@@ -2496,6 +2537,7 @@
call get_from_xgrid (Ice_boundary%v_flux, 'OCN', ex_flux_v, xmap_sfc)
call get_from_xgrid (Ice_boundary%u_star, 'OCN', ex_u_star, xmap_sfc)
call get_from_xgrid (Ice_boundary%coszen, 'OCN', ex_coszen, xmap_sfc)
+ call get_from_xgrid (Ice_boundary%coszen_radwt, 'OCN', ex_coszen_radwt, xmap_sfc)
call get_from_xgrid (Ice_boundary%p, 'OCN', ex_slp, xmap_sfc) ! mw mod
call get_from_xgrid (Ice_boundary%lprec, 'OCN', ex_lprec, xmap_sfc)
@@ -2586,7 +2628,8 @@
call stock_move( &
& FROM = Atm_stock(ISTOCK_HEAT), &
& TO = Lnd_stock(ISTOCK_HEAT), &
- & DATA = (-Land_boundary%t_flux + Land_boundary%lw_flux + Land_boundary%sw_flux - Land_boundary%fprec*HLF), &
+! & DATA = (-Land_boundary%t_flux + Land_boundary%lw_flux + Land_boundary%sw_flux - Land_boundary%fprec*HLF), &
+ & DATA = (-Land_boundary%t_flux + Land_boundary%lw_flux + Land_boundary%sw_flux - Land_boundary%fprec*HLF - Land_boundary%lprec*HLV), &
& grid_index=X1_GRID_LND, &
& xmap=xmap_sfc, &
& delta_t=Dt_atm, &
@@ -2608,7 +2651,9 @@
call stock_move( &
& FROM = Atm_stock(ISTOCK_HEAT), &
& TO = Ice_stock(ISTOCK_HEAT), &
- & DATA = (-Ice_boundary%t_flux + Ice_boundary%lw_flux - Ice_boundary%fprec*HLF + Ice_boundary%sw_flux_vis_dir + &
+! & DATA = (-Ice_boundary%t_flux + Ice_boundary%lw_flux - Ice_boundary%fprec*HLF + Ice_boundary%sw_flux_vis_dir + &
+! Ice_boundary%sw_flux_vis_dif + Ice_boundary%sw_flux_nir_dir + Ice_boundary%sw_flux_nir_dif), &
+ & DATA = (-Ice_boundary%t_flux + Ice_boundary%lw_flux - Ice_boundary%fprec*HLF - Ice_boundary%lprec*HLV + Ice_boundary%sw_flux_vis_dir + &
Ice_boundary%sw_flux_vis_dif + Ice_boundary%sw_flux_nir_dir + Ice_boundary%sw_flux_nir_dif), &
& grid_index=X1_GRID_ICE, &
& xmap=xmap_sfc, &
@@ -2627,6 +2672,41 @@
!------- meridional wind stress -----------
used = send_data ( id_v_flux, Atmos_boundary%v_flux, Time )
+ if (id_lprec > 0) then
+ call get_from_xgrid (diag_atm , 'ATM', ex_lprec, xmap_sfc)
+ ! should be identical to Atm%lprec
+ used = send_data(id_lprec, diag_atm, Time)
+ end if
+ if (id_fprec > 0) then
+ call get_from_xgrid (diag_atm , 'ATM', ex_fprec, xmap_sfc)
+ ! should be identical to Atm%fprec
+ used = send_data(id_fprec, diag_atm, Time)
+ end if
+ if (id_sw_flux > 0) then
+ call get_from_xgrid (diag_atm , 'ATM', ex_flux_sw, xmap_sfc)
+ ! should be identical to Atm%flux_sw
+ used = send_data(id_sw_flux, diag_atm, Time)
+ end if
+ if (id_sw_flux_vis_dir > 0 .or. id_sw_flux_nir_dir > 0) then
+ call get_from_xgrid (diag_atm , 'ATM', ex_flux_sw_vis_dir, xmap_sfc)
+ used = send_data(id_sw_flux_vis_dir, diag_atm, Time)
+ end if
+ if (id_sw_flux_nir_dir > 0) then
+ call get_from_xgrid (diag_atm2 , 'ATM', ex_flux_sw_dir, xmap_sfc)
+ diag_atm2 = diag_atm2 - diag_atm
+ used = send_data(id_sw_flux_nir_dir, diag_atm2, Time)
+ end if
+ if (id_sw_flux_vis_dif > 0 .or. id_sw_flux_nir_dif > 0) then
+ call get_from_xgrid (diag_atm , 'ATM', ex_flux_sw_vis_dif, xmap_sfc)
+ used = send_data(id_sw_flux_vis_dif, diag_atm, Time)
+ end if
+ if (id_sw_flux_nir_dif > 0) then
+ call get_from_xgrid (diag_atm2 , 'ATM', ex_flux_sw_dif, xmap_sfc)
+ diag_atm2 = diag_atm2 - diag_atm
+ used = send_data(id_sw_flux_nir_dif, diag_atm2, Time)
+ end if
+
+
!Balaji
call mpp_clock_end(fluxAtmDnClock)
call mpp_clock_end(cplClock)
@@ -2677,6 +2757,7 @@
type(land_ice_boundary_type), intent(inout):: Land_Ice_Boundary
integer :: ier
+ logical :: used
real, dimension(n_xgrid_runoff) :: ex_runoff, ex_calving, ex_runoff_hflx, ex_calving_hflx
real, dimension(size(Land_Ice_Boundary%runoff,1),size(Land_Ice_Boundary%runoff,2),1) :: ice_buf
!Balaji
@@ -2705,6 +2786,27 @@
call data_override('ICE', 'runoff_hflx' , Land_Ice_Boundary%runoff_hflx , Time)
call data_override('ICE', 'calving_hflx', Land_Ice_Boundary%calving_hflx, Time)
+ ! reading additional runoff fluxes from data_table e.g. from land ice model
+ ! unit[runoff_add] : kg/m**2/s
+ ! unit[runoff_hflx_add] : W/m**2
+ call data_override('ICE', 'runoff_add' , ice_buf(:,:,1) , Time, override=used)
+ if (used) then
+ if ( maxval(ice_buf) > 1 .or. minval(ice_buf) < -1 ) then
+ call error_mesg ('flux_exchange_mod', &
+ 'runoff_add read from data_table is out of range', FATAL)
+ end if
+ Land_Ice_Boundary%runoff = Land_Ice_Boundary%runoff + ice_buf(:,:,1)
+ end if
+ call data_override('ICE', 'runoff_hflx_add' , ice_buf(:,:,1) , Time, override=used)
+ if (used) then
+ if ( maxval(ice_buf) > 10000 .or. minval(ice_buf) < -1000 ) then
+ call error_mesg ('flux_exchange_mod', &
+ 'runoff_hflx_add read from data_table is out of range', FATAL)
+ end if
+ Land_Ice_Boundary%runoff_hflx = Land_Ice_Boundary%runoff_hflx + ice_buf(:,:,1)
+ end if
+
+
! compute stock increment
ice_buf(:,:,1) = Land_Ice_Boundary%runoff + Land_Ice_Boundary%calving
call stock_move(from=Lnd_stock(ISTOCK_WATER), to=Ice_stock(ISTOCK_WATER), &
@@ -3536,7 +3638,8 @@
call stock_move( &
& TO = Atm_stock(ISTOCK_HEAT), &
& FROM = Lnd_stock(ISTOCK_HEAT), &
- & DATA = data_lnd * HLV, &
+! & DATA = data_lnd * HLV, &
+ & DATA = 0 * data_lnd * HLV, &
& grid_index=X1_GRID_LND, &
& xmap=xmap_sfc, &
& delta_t=Dt_atm, &
@@ -3560,7 +3663,8 @@
call stock_move( &
& TO = Atm_stock(ISTOCK_HEAT), &
& FROM = Ice_stock(ISTOCK_HEAT), &
- & DATA = data_ice * HLV, &
+! & DATA = data_ice * HLV, &
+ & DATA = 0 * data_ice * HLV, &
& grid_index=X1_GRID_ICE, &
& xmap=xmap_sfc, &
& delta_t=Dt_atm, &
@@ -4082,6 +4186,23 @@
id_q_flux_land = register_diag_field( mod_name, 'evap_land', land_axes, Time, &
'evaporation rate over land', 'kg/m2/s', missing_value=-1.0 )
+
+ id_lprec = register_diag_field( mod_name, 'lprec', atmos_axes, Time, &
+ 'liquid precipitation rate', 'kg/m2/s' )
+ id_fprec = register_diag_field( mod_name, 'fprec', atmos_axes, Time, &
+ 'frozen precipitation rate', 'kg/m2/s' )
+ id_sw_flux = register_diag_field( mod_name, 'sw_flux', atmos_axes, Time, &
+ 'net shortwave radiation at surface', 'W/m2' )
+ id_sw_flux_vis_dir = register_diag_field( mod_name, 'sw_flux_vis_dir', atmos_axes, Time, &
+ 'net shortwave radiation at surface vis dir', 'W/m2' )
+ id_sw_flux_nir_dir = register_diag_field( mod_name, 'sw_flux_nir_dir', atmos_axes, Time, &
+ 'net shortwave radiation at surface nir dir', 'W/m2' )
+ id_sw_flux_vis_dif = register_diag_field( mod_name, 'sw_flux_vis_dif', atmos_axes, Time, &
+ 'net shortwave radiation at surface vis dif', 'W/m2' )
+ id_sw_flux_nir_dif = register_diag_field( mod_name, 'sw_flux_nir_dif', atmos_axes, Time, &
+ 'net shortwave radiation at surface nir dif', 'W/m2' )
+
+
end subroutine diag_field_init
!#######################################################################
@@ -4361,6 +4482,7 @@
! Atm%lprec liquid precipitation (kg/m2)
! Atm%fprec water equivalent frozen precipitation (kg/m2)
! Atm%coszen cosine of the zenith angle
+! Atm%coszen_radwt cosine of the zenith angle, radiation weighted, for coupling with Aeolus
!
! (the following five fields are gathered into a data type for convenience in passing
! this information through the different levels of the atmospheric model --
diff -ur --unidirectional-new-file -b -E -Z -x CM2.1p1 -x StripedPlanet -x atmos_bgrid -x atmos_ebm -x land_lad2 -x mom5 -x generic_tracers /p/tmp/petri/mom5-af3a94d4/src/coupler/surface_flux.F90 MonsoonPlanet/src/coupler/surface_flux.F90
--- /p/tmp/petri/mom5-af3a94d4/src/coupler/surface_flux.F90 2022-12-21 10:27:22.711084080 +0100
+++ MonsoonPlanet/src/coupler/surface_flux.F90 2021-03-31 13:53:51.961341414 +0200
@@ -40,6 +40,7 @@
use sat_vapor_pres_mod, only: escomp, descomp
use constants_mod, only: cp_air, hlv, stefan, rdgas, rvgas, grav, vonkarm
use mpp_mod, only: input_nml_file
+use mpp_mod, only: mpp_clock_id, mpp_clock_begin, mpp_clock_end, CLOCK_LOOP
implicit none
private
@@ -278,6 +279,7 @@
raoult_sat_vap, &
do_simple
+integer :: id_clock_escomp = 0, id_clock_mo_drag = 0
contains
@@ -389,8 +391,10 @@
t_surf1 = t_surf0 + del_temp
+ call mpp_clock_begin(id_clock_escomp)
call escomp ( t_surf0, e_sat ) ! saturation vapor pressure
call escomp ( t_surf1, e_sat1 ) ! perturbed vapor pressure
+ call mpp_clock_end(id_clock_escomp)
if(use_mixing_ratio) then
! surface mixing ratio at saturation
@@ -467,9 +471,11 @@
endif
! monin-obukhov similarity theory
+ call mpp_clock_begin(id_clock_mo_drag)
call mo_drag (thv_atm, thv_surf, z_atm, &
rough_mom, rough_heat, rough_moist, w_atm, &
cd_m, cd_t, cd_q, u_star, b_star, avail )
+ call mpp_clock_end(id_clock_mo_drag)
! override with ocean fluxes from NCAR calculation
if (ncar_ocean_flux .or. ncar_ocean_flux_orig) then
@@ -745,6 +751,9 @@
do_init = .false.
+ id_clock_escomp = mpp_clock_id('SFC boundary layer sur_flux_escomp', grain=CLOCK_LOOP)
+ id_clock_mo_drag = mpp_clock_id('SFC boundary layer sur_flux_mo_drag', grain=CLOCK_LOOP)
+
end subroutine surface_flux_init
diff -ur --unidirectional-new-file -b -E -Z -x CM2.1p1 -x StripedPlanet -x atmos_bgrid -x atmos_ebm -x land_lad2 -x mom5 -x generic_tracers /p/tmp/petri/mom5-af3a94d4/src/ice_param/ocean_albedo.F90 MonsoonPlanet/src/ice_param/ocean_albedo.F90
--- /p/tmp/petri/mom5-af3a94d4/src/ice_param/ocean_albedo.F90 2014-03-18 14:03:56.000000000 +0100
+++ MonsoonPlanet/src/ice_param/ocean_albedo.F90 2021-03-31 13:53:46.830117873 +0200
@@ -23,7 +23,7 @@
implicit none
private
-public compute_ocean_albedo, compute_ocean_albedo_new
+public compute_ocean_albedo, compute_ocean_albedo_new, compute_ocean_albedo_climber2
!-----------------------------------------------------------------------
character(len=256) :: version = '$Id: ocean_albedo.F90,v 19.0 2012/01/06 20:37:11 fms Exp $'
@@ -55,10 +55,14 @@
! ocean_albedo_option = 5 : separate treatment of dif/dir shortwave using
! NCAR CCMS3.0 scheme (Briegleb et al, 1986,
! J. Clim. and Appl. Met., v. 27, 214-226)
+!
+! ocean_albedo_option = 6 : Climber-2-style albedo, for coupling with Aeolus
+! This needs radiation-weighted coszen
interface compute_ocean_albedo
module procedure compute_ocean_albedo_old ! obsolete - remove later
module procedure compute_ocean_albedo_new
+ module procedure compute_ocean_albedo_climber2
end interface
! ocean surface albedo data
@@ -394,6 +398,62 @@
!#######################################################################
+ subroutine compute_ocean_albedo_climber2 (ocean, coszen, albedo_vis_dir, &
+ albedo_vis_dif, albedo_nir_dir, albedo_nir_dif, lat, coszen_radwt)
+
+!-----------------------------------------------------------------------
+! input
+! ocean = logical flag; = true if ocean point
+! coszen_radwt = cosine of zenith angle (in radians), radiation-weighted
+! lat = latitude (radians)
+!
+! output
+! albedo = surface albedo
+!-----------------------------------------------------------------------
+ logical, intent(in) :: ocean(:,:)
+ real, intent(in) :: coszen(:,:)
+ real, intent(out) :: albedo_vis_dir(:,:)
+ real, intent(out) :: albedo_vis_dif(:,:)
+ real, intent(out) :: albedo_nir_dir(:,:)
+ real, intent(out) :: albedo_nir_dif(:,:)
+ real, intent(in) :: lat(:,:)
+ real, intent(in) :: coszen_radwt(:,:)
+!-----------------------------------------------------------------------
+
+!-----------------------------------------------------------------------
+!------------ calculate surface albedo over open water -----------------
+!-----------------------------------------------------------------------
+
+ if (first) call ocean_albedo_init(ocean,lat)
+
+ if (ocean_albedo_option >=1 .and. ocean_albedo_option <= 5) &
+ call compute_ocean_albedo_new(ocean, coszen, albedo_vis_dir, &
+ albedo_vis_dif, albedo_nir_dir, albedo_nir_dif, lat)
+
+ if (ocean_albedo_option == 6) then
+ where (coszen_radwt > 0.0001)
+ albedo_vis_dir = MIN(0.05/coszen_radwt, 0.20)
+ elsewhere
+ albedo_vis_dir = 0.05
+ end where
+ albedo_vis_dif = 0.07
+ albedo_nir_dir = albedo_vis_dir
+ albedo_nir_dif = 0.07
+ endif
+
+ where (.not.ocean)
+ albedo_vis_dir = 0.0
+ albedo_vis_dif = 0.0
+ albedo_nir_dir = 0.0
+ albedo_nir_dif = 0.0
+ end where
+
+!-----------------------------------------------------------------------
+
+ end subroutine compute_ocean_albedo_climber2
+
+!#######################################################################
+
subroutine ocean_albedo_init(ocean,lat)
logical, intent(in), optional :: ocean(:,:)
real, intent(in), optional :: lat(:,:)
@@ -428,9 +488,9 @@
write (unit, nml=ocean_albedo_nml)
endif
- if (ocean_albedo_option < 1 .or. ocean_albedo_option > 5) &
+ if (ocean_albedo_option < 1 .or. ocean_albedo_option > 6) &
call error_mesg ('ocean_albedo', &
- 'ocean_albedo_option must = 1,2,3,4 or 5', FATAL)
+ 'ocean_albedo_option must = 1,2,3,4 or 5 or 6', FATAL)
if(ocean_albedo_option == 2) then
if ( present(ocean) .and. present(lat) ) then
diff -ur --unidirectional-new-file -b -E -Z -x CM2.1p1 -x StripedPlanet -x atmos_bgrid -x atmos_ebm -x land_lad2 -x mom5 -x generic_tracers /p/tmp/petri/mom5-af3a94d4/src/ice_sis/ice_model.F90 MonsoonPlanet/src/ice_sis/ice_model.F90
--- /p/tmp/petri/mom5-af3a94d4/src/ice_sis/ice_model.F90 2022-12-21 10:27:22.772037896 +0100
+++ MonsoonPlanet/src/ice_sis/ice_model.F90 2021-03-31 13:53:54.143868433 +0200
@@ -134,6 +134,7 @@
real, dimension(:,:,:), pointer :: dedt =>NULL()
real, dimension(:,:,:), pointer :: drdt =>NULL()
real, dimension(:,:,:), pointer :: coszen =>NULL()
+ real, dimension(:,:,:), pointer :: coszen_radwt =>NULL()
real, dimension(:,:,:), pointer :: p =>NULL()
real, dimension(:,:,:), pointer :: data =>NULL()
integer :: xtype
@@ -209,6 +210,7 @@
Atmos_boundary%lprec, &
Atmos_boundary%fprec, &
Atmos_boundary%coszen, &
+ Atmos_boundary%coszen_radwt, &
Atmos_boundary%p )
call mpp_clock_end(iceClock3)
call mpp_clock_end(iceClock)
@@ -733,7 +735,7 @@
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~!
subroutine update_ice_model_fast_old (Ice, Atmos_boundary_fluxes, flux_u, flux_v, u_star, &
flux_sw_nir_dir, flux_sw_nir_dif, flux_sw_vis_dir, flux_sw_vis_dif,&
- flux_lw, flux_t, flux_q, dhdt, dedt, drdt, lprec, fprec, coszen, p_surf )
+ flux_lw, flux_t, flux_q, dhdt, dedt, drdt, lprec, fprec, coszen, coszen_radwt, p_surf )
type (ice_data_type), intent(inout) :: Ice
type(coupler_3d_bc_type), intent(inout) :: Atmos_boundary_fluxes
@@ -749,6 +751,7 @@
real, dimension(isc:iec,jsc:jec,km), intent(in) :: dhdt, dedt, drdt ! d(flux)/d(surf_temp) (+ up)
real, dimension(isc:iec,jsc:jec,km), intent(in) :: lprec, fprec ! liquid & frozen precip. rate [kg/(m^2*sec)](+ down)
real, dimension(isc:iec,jsc:jec,km), intent(in) :: coszen ! cosine of the zenith angle
+ real, dimension(isc:iec,jsc:jec,km), intent(in) :: coszen_radwt ! cosine of the zenith angle, radiation weighted
real, dimension(isc:iec,jsc:jec,km), intent(in), optional :: p_surf
real, dimension(isc:iec,jsc:jec,km) :: flux_t_new, flux_q_new, flux_lh_new, flux_lw_new
@@ -895,7 +898,7 @@
else
call compute_ocean_albedo (Ice%mask, coszen(:,:,1), Ice%albedo_vis_dir(:,:,1),&
Ice%albedo_vis_dif(:,:,1), Ice%albedo_nir_dir(:,:,1),&
- Ice%albedo_nir_dif(:,:,1), latitude )
+ Ice%albedo_nir_dif(:,:,1), latitude, coszen_radwt(:,:,1) )
endif
if (id_alb_vis_dir>0) sent = send_data(id_alb_vis_dir, all_avg(Ice%albedo_vis_dir,Ice%part_size(isc:iec,jsc:jec,:)), &
@@ -1820,6 +1823,7 @@
write(outunit,100) 'atm_ice_bnd_type%dedt ',mpp_chksum(bnd_type%dedt)
write(outunit,100) 'atm_ice_bnd_type%drdt ',mpp_chksum(bnd_type%drdt)
write(outunit,100) 'atm_ice_bnd_type%coszen ',mpp_chksum(bnd_type%coszen)
+ write(outunit,100) 'atm_ice_bnd_type%coszen_radwt ',mpp_chksum(bnd_type%coszen_radwt)
write(outunit,100) 'atm_ice_bnd_type%p ',mpp_chksum(bnd_type%p)
! write(outunit,100) 'atm_ice_bnd_type%data ',mpp_chksum(bnd_type%data)
100 FORMAT("CHECKSUM::",A32," = ",Z20)
diff -ur --unidirectional-new-file -b -E -Z -x CM2.1p1 -x StripedPlanet -x atmos_bgrid -x atmos_ebm -x land_lad2 -x mom5 -x generic_tracers /p/tmp/petri/mom5-af3a94d4/src/land_lad/land_model.F90 MonsoonPlanet/src/land_lad/land_model.F90
--- /p/tmp/petri/mom5-af3a94d4/src/land_lad/land_model.F90 2014-03-18 14:03:56.000000000 +0100
+++ MonsoonPlanet/src/land_lad/land_model.F90 2021-03-31 13:53:48.781736716 +0200
@@ -52,6 +52,7 @@
CYCLIC_GLOBAL_DOMAIN, mpp_get_compute_domains, &
mpp_get_domain_components, mpp_get_pelist, &
mpp_define_mosaic
+ use mpp_domains_mod, only: NULL_DOMAIN2D
use fms_mod, only: write_version_number, error_mesg, FATAL, NOTE, &
mpp_pe, mpp_npes, mpp_root_pe, &
@@ -77,7 +78,7 @@
use constants_mod, only: radius, hlf, hlv, tfreeze, pi
- use diag_manager_mod, only: diag_axis_init
+ use diag_manager_mod, only: diag_axis_init, register_diag_field, send_data
use field_manager_mod, only: MODEL_LAND
use tracer_manager_mod, only: register_tracers, get_tracer_index, NO_TRACER
@@ -205,6 +206,9 @@
integer :: landClock
integer :: isphum ! number of specific humidity in the tracer array, or NO_TRACER
+integer :: id_lprec = -1, id_fprec = -1, id_lwnet = -1, id_swdown = -1, id_t_surf = -1, id_wind = -1
+integer :: id_qflux = -1, id_dedq = -1, id_q_ca = -1, id_evap_surf = -1
+
contains ! -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
@@ -274,6 +278,7 @@
! for mosaic grid, grid area will be calculated based on exchange grid and grid cell.
#ifndef LAND_GRID_FROM_ATMOS
+ write(*,*) 'SP1 grid_file', grid_file
if( field_exist(grid_file, 'AREA_LND') ) then
call field_size( grid_file, 'AREA_LND', siz)
nlon = siz(1)
@@ -392,7 +397,16 @@
axl_file = 'INPUT/'//trim(axl_file)
nxgrid = get_mosaic_xgrid_size(axl_file)
allocate(i1(nxgrid), j1(nxgrid), i2(nxgrid), j2(nxgrid), xgrid_area(nxgrid))
+ write(*,*) 'SP2 aXl_file', aXl_file
+ ! sigh. get_mosaic_xgrid() eventually invokes read_compressed_2d,
+ ! which insists on having a current_domain set. atmos_fv_physics sets
+ ! its domain sometime before this land model init is invoked,
+ ! but that appears somehow inapropriate.
+ ! atmos_aeolus does not invoke set_domain at all, so that this
+ ! get_mosaic_xgrid crashes without current domain set.
+ call set_domain(NULL_DOMAIN2D)
call get_mosaic_xgrid(aXl_file, i1, j1, i2, j2, xgrid_area)
+ write(*,*) 'SP2 finished aXl_file', aXl_file
do m = 1, nxgrid
i = i2(m); j = j2(m)
gfrac(i,j) = gfrac(i,j) + xgrid_area(m)
@@ -598,7 +612,7 @@
! initialize land diagnostics -- create diagnostic axes to be used by all
! diagnostic routine in submodules
- call init_land_diag ( gblon, gblat, theLand%domain, id_lon, id_lat, &
+ call init_land_diag ( time, gblon, gblat, theLand%domain, id_lon, id_lat, &
glon=glon, glat=glat )
bnd%axes = (/id_lon, id_lat/)
@@ -700,10 +714,29 @@
! ---- local vars ----------------------------------------------------------
real, dimension(theLand%is:theLand%ie, theLand%js:theLand%je, theLand%n_tiles) :: &
q_flux, dedt ! slm Mar 19 2002
+ integer :: used
call mpp_clock_begin(landClock)
call set_domain (theLand%domain)
+ ! write out input data
+ if (id_lprec > 0) used = send_data(id_lprec, atmos2land%lprec(:,:,1), theLand%soil%Time)
+ if (id_fprec > 0) used = send_data(id_fprec, atmos2land%fprec(:,:,1), theLand%soil%Time)
+ if (id_t_surf > 0) used = send_data(id_t_surf, bnd%t_surf(:,:,1), theLand%soil%Time)
+ if (id_swdown > 0) used = send_data(id_swdown, atmos2land%sw_flux(:,:,1), theLand%soil%Time)
+ ! possibly we need to use the sum of sw_flux_down_total_dir and sw_flux_down_total_dif
+ ! instead to get total downwelling sw, not net
+ if (id_lwnet > 0) used = send_data(id_lwnet, atmos2land%lw_flux(:,:,1), theLand%soil%Time)
+ if (id_wind > 0) used = send_data(id_wind, atmos2land%wind(:,:,1), theLand%soil%Time)
+#ifdef LAND_BND_TRACERS
+ if (id_qflux > 0) used = send_data(id_qflux, atmos2land%tr_flux(:,:,1,isphum), theLand%soil%Time)
+ if (id_dedq > 0) used = send_data(id_dedq, atmos2land%dfdtr(:,:,1,isphum), theLand%soil%Time)
+#else
+ if (id_qflux > 0) used = send_data(id_qflux, atmos2land%q_flux(:,:,1), theLand%soil%Time)
+ if (id_dedq > 0) used = send_data(id_dedq, atmos2land%ddedq(:,:,1), theLand%soil%Time)
+#endif
+ if (id_q_ca > 0) used = send_data(id_q_ca, bnd%tr(:,:,1,isphum), theLand%soil%Time)
+
call update_vegetation_fast_down ( &
theLand%vegetation, theLand%soil, &
#ifdef LAND_BND_TRACERS
@@ -742,6 +775,8 @@
! after calculations, update boundary conditions visible to the atmosphere
call update_land_bnd_fast ( bnd )
+ if (id_evap_surf > 0) used = send_data(id_evap_surf, q_flux(:,:,1), theLand%soil%Time)
+
call nullify_domain()
call mpp_clock_end(landClock)
end subroutine update_land_model_fast
@@ -868,8 +903,9 @@
!
!
-subroutine init_land_diag(glonb, glatb, domain, id_lon, id_lat, glon, glat)
+subroutine init_land_diag(time, glonb, glatb, domain, id_lon, id_lat, glon, glat)
+ type(time_type), intent(in):: time
real, intent(in) :: glonb(:,:), glatb(:,:) ! longitude and latitude corners of grid
! cells, specified for the global grid
! (not only domain)
@@ -884,6 +920,7 @@
real :: rad2deg ! conversion factor radian -> degrees
real :: lon(size(glonb,1)-1), lat(size(glatb,2)-1)
integer :: i, j
+ integer :: axes(2)
rad2deg = 180./pi
nlon = size(glonb,1)-1
@@ -937,6 +974,27 @@
endif
+ axes = (/ id_lon, id_lat /)
+ id_lprec = register_diag_field ( module_name, 'lprec', axes, &
+ time, 'liquid precipitation rate (input)', 'kg/(m2 s)', missing_value=-100.0 )
+ id_fprec = register_diag_field ( module_name, 'fprec', axes, &
+ time, 'frozen precipitation rate (input)', 'kg/(m2 s)', missing_value=-100.0 )
+ id_lwnet = register_diag_field ( module_name, 'lwnet', axes, &
+ time, 'net longwave radiative flux (input)', 'W/m2', missing_value=-999.0 )
+ id_swdown = register_diag_field ( module_name, 'swdown', axes, &
+ time, 'downwelling shortwave radiative flux (input)', 'W/m2', missing_value=-999.0 )
+ id_t_surf = register_diag_field ( module_name, 't_surf', axes, &
+ time, 'surface temperature (input then updated by lad. sigh.)', 'degK', missing_value=-999.0 )
+ id_wind = register_diag_field ( module_name, 'wind', axes, &
+ time, 'wind speed (input)', 'm/s', missing_value=-999.0 )
+ id_qflux = register_diag_field ( module_name, 'qflux', axes, &
+ time, 'water vapor flux near surface (input)', 'kg/(m^2 s)', missing_value=-999.0 )
+ id_dedq = register_diag_field ( module_name, 'dedq', axes, &
+ time, 'Moisture flux humidity sensitivity (input)', 'kg/m^2/s', missing_value=-999.0 )
+ id_q_ca = register_diag_field ( module_name, 'q_ca', axes, &
+ time, 'surface/canopy humidity (land_lad state)', 'kg/kg', missing_value=-999.0 )
+ id_evap_surf = register_diag_field( module_name, 'evap_surf', axes, &
+ time, 'evaporation at surface (land_lad internal)', 'kg/(m^2 s)', missing_value=-999.0 )
end subroutine init_land_diag
!
diff -ur --unidirectional-new-file -b -E -Z -x CM2.1p1 -x StripedPlanet -x atmos_bgrid -x atmos_ebm -x land_lad2 -x mom5 -x generic_tracers /p/tmp/petri/mom5-af3a94d4/src/land_lad/land_types.F90 MonsoonPlanet/src/land_lad/land_types.F90
--- /p/tmp/petri/mom5-af3a94d4/src/land_lad/land_types.F90 2018-10-11 09:29:43.901720007 +0200
+++ MonsoonPlanet/src/land_lad/land_types.F90 2021-03-31 13:53:48.758694049 +0200
@@ -411,6 +411,8 @@
allocate( a2l % sw_flux_down_vis_dif (is:ie,js:je,n_tiles) )
allocate( a2l % sw_flux_down_total_dif (is:ie,js:je,n_tiles) )
+ allocate( a2l % wind (is:ie,js:je,n_tiles) )
+
#ifdef LAND_BND_TRACERS
allocate( a2l % tr_flux(is:ie,js:je,n_tiles,n_tracers) )
allocate( a2l % dfdtr(is:ie,js:je,n_tiles,n_tracers) )
@@ -490,6 +492,8 @@
deallocate( a2l % sw_flux_down_vis_dif )
deallocate( a2l % sw_flux_down_total_dif )
+ deallocate( a2l % wind )
+
#ifdef LAND_BND_TRACERS
deallocate( a2l % tr_flux )
deallocate( a2l % dfdtr )
diff -ur --unidirectional-new-file -b -E -Z -x CM2.1p1 -x StripedPlanet -x atmos_bgrid -x atmos_ebm -x land_lad2 -x mom5 -x generic_tracers /p/tmp/petri/mom5-af3a94d4/src/land_lad/soil/rivers.F90 MonsoonPlanet/src/land_lad/soil/rivers.F90
--- /p/tmp/petri/mom5-af3a94d4/src/land_lad/soil/rivers.F90 2018-10-11 09:29:43.906012089 +0200
+++ MonsoonPlanet/src/land_lad/soil/rivers.F90 2021-03-31 13:53:48.776841954 +0200
@@ -221,7 +221,7 @@
! ---- diagnostic field ids --------------------------------------------------
integer :: id_discharge, id_discharge_snow
integer :: id_adis_water,id_adis_snow ! area-weighted discharges
-integer :: id_dest, id_basin
+integer :: id_dcount, id_dest, id_basin
logical :: module_is_initialized =.FALSE.
contains ! ******************************************************************
@@ -818,6 +818,9 @@
'kg/(m2 s)', missing_value=-999.0 )
! static fields
+ id_dcount = register_static_field ( &
+ mod_name, 'dcount', (/id_lon, id_lat/), &
+ 'count of cells which route into this destination point', 'none', missing_value=0.0 )
id_dest = register_static_field ( &
mod_name, 'dest', (/id_lon, id_lat/), &
'destination points', 'none', missing_value=0.0 )
@@ -1074,6 +1077,7 @@
integer :: i,j
integer, allocatable :: &
+ dcount(:,:), & ! count of cells which route into this destination cell
dpoint(:,:), & ! destination point map
basin (:,:) ! basin number
@@ -1084,6 +1088,8 @@
if( id_dest > 0.or.id_basin>0 ) then
! allocate global destination points arrays
allocate( &
+ dcount( lbound(rivers%i_dest,1):ubound(rivers%i_dest,1), &
+ lbound(rivers%i_dest,2):ubound(rivers%i_dest,2) ), &
dpoint( lbound(rivers%i_dest,1):ubound(rivers%i_dest,1), &
lbound(rivers%i_dest,2):ubound(rivers%i_dest,2) ), &
basin ( lbound(rivers%i_dest,1):ubound(rivers%i_dest,1), &
@@ -1091,6 +1097,7 @@
! clean up the arrays of destination points, basins, and the number of
! river basins
+ dcount = 0
dpoint = 0
basin = 0
nbasins = 0
@@ -1106,9 +1113,13 @@
dpoint(id,jd) = nbasins
endif
basin(i,j) = dpoint(id,jd)
+ dcount(id,jd) = dcount(id,jd) + 1
endif
enddo
enddo
+ if (id_dcount > 0) &
+ used = send_data (id_dcount, &
+ dcount(rivers%is:rivers%ie, rivers%js:rivers%je)*1.0, rivers%time)
if (id_dest > 0) &
used = send_data (id_dest, &
dpoint(rivers%is:rivers%ie, rivers%js:rivers%je)*1.0, rivers%time)
diff -ur --unidirectional-new-file -b -E -Z -x CM2.1p1 -x StripedPlanet -x atmos_bgrid -x atmos_ebm -x land_lad2 -x mom5 -x generic_tracers /p/tmp/petri/mom5-af3a94d4/src/ocean_mixed_layer/ocean_model.F90 MonsoonPlanet/src/ocean_mixed_layer/ocean_model.F90
--- /p/tmp/petri/mom5-af3a94d4/src/ocean_mixed_layer/ocean_model.F90 2021-06-03 09:01:49.650678001 +0200
+++ MonsoonPlanet/src/ocean_mixed_layer/ocean_model.F90 2021-06-03 10:21:32.407573445 +0200
@@ -94,25 +94,15 @@
! argument Ice_boundary was renamed to Ice_ocean_boundary. A new subroutine,
! ocean_model_save_restart, has been added for incremental
! checkpointing. These changes bitwise reproduce answers.
-!
-! sdu 11/30/08 modified code to allow use of the mosiac gridspec type.
-!
-! LAT 3/6/09 Added option to restore the SST to historical (time varying) data, rather
-! than climatological data. At this time, the historical data is
-! HadISST1_SST_Dec1869-2004_1x1.nc. This is controlled via a namelist option,
-! do_restore_histsst. For backward compatibility, do_restore_sst uses the
-! climatological SST data. A fatal error will result if both of these
-! namelists are set to true. The new diagnostic, sst_histobs, was created.
-
module ocean_model_mod
- use constants_mod, only: Tfreeze, hlv, hlf, pi, rho0r ! MS mod
+ use constants_mod, only: Tfreeze, hlv, hlf, pi
use time_manager_mod, only: time_type, operator(+), operator(>), get_date, &
get_time, set_time
- use mpp_mod, only: mpp_pe, mpp_npes
+ use mpp_mod, only: mpp_pe, mpp_npes, stdout, mpp_error
use mpp_domains_mod, only: mpp_domains_init, mpp_define_domains, domain2D, &
mpp_define_layout, mpp_get_compute_domain, &
@@ -120,19 +110,14 @@
use mpp_parameter_mod, only: AGRID, BGRID_NE, CGRID_NE, BGRID_SW, CGRID_SW
- use fms_mod, only: close_file, check_nml_error, error_mesg, NOTE, &
+ use fms_mod, only: open_namelist_file, close_file, check_nml_error, error_mesg, &
WARNING, FATAL, write_version_number, stdlog, open_restart_file, &
- file_exist, read_data, write_data, set_domain, mpp_pe, &
- mpp_root_pe, open_restart_file
+ file_exist, field_exist, read_data, write_data, set_domain, mpp_pe, &
+ mpp_root_pe, open_restart_file, field_size
- use diag_manager_mod, only: diag_axis_init, register_diag_field, send_data
-#ifdef INTERNAL_FILE_NML
- USE mpp_mod, ONLY: input_nml_file
-#else
- USE fms_mod, ONLY: open_namelist_file
-#endif
+ use diag_manager_mod, only: diag_axis_init, register_diag_field, send_data, set_diag_global_att
- use ocean_grids_mod, only: ocean_grids_init, set_ocean_grid_size, set_ocean_hgrid_arrays
+ use mosaic_mod, only: get_mosaic_ntiles, get_mosaic_ncontacts, get_mosaic_contact
! TK Mod: do not use ice_spec version of get_sea_surface in the
! ocean model. It has its own version (for data override).
@@ -142,6 +127,9 @@
! TK added this use statement, needed in local get_sea_surface routine...
use data_override_mod,only: data_override
use coupler_types_mod,only: coupler_2d_bc_type
+
+use ocean_parameters_mod, only: ocean_parameters_init, ocean_parameters_end
+
!
! Tom Knutson
!
@@ -211,8 +199,10 @@
end interface
!-----------------------------------------------------------------------
-character(len=128), parameter :: version = '$Id$'
-character(len=128), parameter :: tagname = '$Name$'
+
+character(len=128), parameter :: version = '$Id: ocean_model.F90,v 20.0 2013/12/13 23:43:43 fms Exp $'
+character(len=128), parameter :: tagname = '$Name: tikal $'
+
!
type, public :: ocean_public_type
@@ -286,17 +276,14 @@
fprec =>NULL() ! mass flux of frozen precipitation (Kg/m2/s)
real, dimension(:,:), pointer :: runoff =>NULL(), & ! mass flux of liquid runoff (Kg/m2/s)
calving =>NULL() ! mass flux of frozen runoff (Kg/m2/s)
- real, pointer, dimension(:,:) :: runoff_hflx =>NULL() ! heat flux of liquid runoff (kg/m2/s)
- real, pointer, dimension(:,:) :: calving_hflx =>NULL() ! heat flux of frozen runoff (kg/m2/s)
real, dimension(:,:), pointer :: p =>NULL() ! pressure on the surface of the ocean (Pa)
! (Not used in mixed layer model)
- real, pointer, dimension(:,:) :: mi =>NULL() ! mass of overlying sea ice
- integer :: wind_stagger = -999 ! member needed by coupler for SIS2. Not used.
- integer :: xtype ! REGRID, REDIST or DIRECT
+ real, pointer, dimension(:,:) :: runoff_hflx =>NULL() ! heat flux of liquid runoff (kg/m2/s)
+ real, pointer, dimension(:,:) :: calving_hflx =>NULL() ! heat flux of frozen runoff (kg/m2/s)
+ integer :: xtype !REGRID, REDIST or DIRECT
type(coupler_2d_bc_type) :: fluxes ! array of fields used for additional tracers
- real, pointer, dimension(:,:) :: ustar_berg !> This is here for compatibility and is unused
- real, pointer, dimension(:,:) :: area_berg !> This is here for compatibility and is unused
- real, pointer, dimension(:,:) :: mass_berg !> This is here for compatibility and is unused
+ real, pointer, dimension(:,:) :: mi =>NULL() ! mass of overlying sea ice
+ real, pointer, dimension(:,:) :: wnd =>NULL() ! wind speed
end type ice_ocean_boundary_type
!
@@ -311,8 +298,6 @@
id_lwflx, id_shflx, id_lhflx, id_snwflx, id_frazil
integer :: id_qflx_adj, id_qflux_restore_sst, id_net_hflx ! TK Mod
integer :: id_sst_obs ! TK mod
- integer :: id_sst_histobs ! LAT mod: 3/6/09 - historical SST diagnostic
- integer :: id_pme, id_river ! MS mod
logical :: sent
real :: mlcp
@@ -326,9 +311,8 @@
integer :: layout(2)=(/0,0/)
logical :: do_qflux_adj = .false. ! TK mod
logical :: do_restore_sst = .false. ! TK mod
- logical :: do_restore_histsst = .false. ! LAT mod: 3/6/09 historical SST
real :: sst_restore_timescale = 5.0 ! TK mod; restoring time scale for SST in days
- real :: uniform_init_t_surf = -273.0
+
!
!
@@ -350,11 +334,6 @@
! TYPE="logical" DEFAULT=".false.">
! Restore mixed layer temperature toward observed SST?
!
-!
-! Restore mixed layer temperature toward observed historical SST? In this
-! case, the HadISST1_SST_Dec1869-2004_1x1.nc data.
-!
!
! Time scale for mixed layer temperature restoring (if used)
@@ -362,9 +341,7 @@
!
namelist /ocean_model_nml/ mixed_layer_depth, mixed_layer_salin, layout, &
- do_qflux_adj, do_restore_sst, do_restore_histsst,&
- sst_restore_timescale, uniform_init_t_surf
- ! LAT Mod: 3/6/09 - added do_restore_histsst
+ do_qflux_adj, do_restore_sst, sst_restore_timescale ! TK Mod
!-----------------------------------------------------------------------
!-------- mpp domain2d types ---------
@@ -402,9 +379,15 @@
integer :: i, j, is, ie, js, je, domain_flags
integer :: rcode, ncid, varid, dims(4), start(4), nread(4)
character(len=80) :: domainname
+ integer :: grid_version = -1, ntiles, stdoutunit
+ real, allocatable, dimension(:,:) :: tmpx, tmpy
+ integer, dimension(4) :: xsize
+ character(len=256) :: grd_file, ocean_mosaic, ocean_hgrid, topog, attvalue
module_is_initialized = .TRUE.
+ stdoutunit=stdout()
+
allocate (Ocean_state)
Ocean_state%is_ocean_pe = Ocean_sfc%is_ocean_pe
if (.not.ocean_state%is_ocean_pe) return
@@ -412,11 +395,6 @@
!
! read namelist
!
-#ifdef INTERNAL_FILE_NML
- READ (input_nml_file, NML=ocean_model_nml, IOSTAT=io)
- IF ( io > 0 ) CALL error_mesg('ocean_model_mod',&
- & 'Error reading internal namelist ocean_model_nml.', FATAL)
-#else
unit = open_namelist_file()
ierr=1
do while (ierr /= 0)
@@ -424,18 +402,61 @@
ierr = check_nml_error (io, 'ocean_model_nml')
enddo
10 call close_file (unit)
-#endif
!
! write version number and namelist
!
call write_version_number(version, tagname)
- unit = stdlog()
- if ( mpp_pe() == mpp_root_pe() ) write (unit, nml=ocean_model_nml)
+ if ( mpp_pe() == mpp_root_pe() ) write (stdlog(), nml=ocean_model_nml)
-! Initilize the grid
- call ocean_grids_init()
- call set_ocean_grid_size(im, jm, 'INPUT/grid_spec.nc')
+ call ocean_parameters_init()
+ grd_file = "INPUT/grid_spec.nc"
+ rcode = nf_open(grd_file,0,ncid)
+!
+! Grid specification file could not be opened.
+!
+ if (rcode/=0) call error_mesg ('ocean_model_mod', &
+ 'cannot open '//grd_file, FATAL)
+ rcode = nf_inq_varid(ncid, 'wet', varid)
+ if (rcode == 0) then
+ call error_mesg('ocean_model_mod', &
+ 'reading grid_spec version 0', WARNING)
+ grid_version = 0
+ rcode = nf_inq_vardimid(ncid, varid, dims)
+ rcode = nf_inq_dimlen(ncid, dims(1), im)
+ rcode = nf_inq_dimlen(ncid, dims(2), jm)
+ else
+ !
+ ! Determine if the grid is mosaic file
+ !
+ if(field_exist(grd_file, 'ocn_mosaic_file') .or. field_exist(grd_file, 'gridfiles') ) then ! read from mosaic file
+ write(stdoutunit,*) '==>Note from ocean_grids_mod(set_ocean_grid_size): read grid from mosaic version grid'
+ grid_version = 2
+ if( field_exist(grd_file, 'ocn_mosaic_file') ) then ! coupler mosaic
+ call read_data(grd_file, "ocn_mosaic_file", ocean_mosaic)
+ ocean_mosaic = "INPUT/"//trim(ocean_mosaic)
+ else
+ ocean_mosaic = trim(grd_file)
+ end if
+ ntiles = get_mosaic_ntiles(ocean_mosaic)
+ if(ntiles .NE. 1) call mpp_error(FATAL, '==>Error from ocean_model_mod: '//&
+ 'ntiles should be 1 for ocean mosaic, contact developer')
+ ! Notify diag_manager of mosaic grid
+ call set_diag_global_att ('ocean','mosaic','1')
+ call read_data(ocean_mosaic, "gridfiles", ocean_hgrid)
+ ocean_hgrid = 'INPUT/'//trim(ocean_hgrid)
+ call field_size(ocean_hgrid, 'x', xsize)
+
+ if(mod(xsize(1),2) .NE. 1) call mpp_error(FATAL, '==>Error from ocean_model_mod: '//&
+ 'x-size of x in file '//trim(ocean_hgrid)//' should be 2*ni+1')
+ if(mod(xsize(2),2) .NE. 1) call mpp_error(FATAL, '==>Error from ocean_model_mod: '//&
+ 'y-size of x in file '//trim(ocean_hgrid)//' should be 2*nj+1')
+ im = (xsize(1)-1)/2
+ jm = (xsize(2)-1)/2
+ else
+ call mpp_error(FATAL, 'ocean_model_mod: unknown grid_spec version, can handly only version 0 or 2 (mosaic)')
+ end if
+ end if
!
! set up domains
!
@@ -450,14 +471,62 @@
call mpp_get_compute_domain( Ocean_sfc%Domain, is, ie, js, je )
allocate ( rmask (is:ie, js:je), Ocean_state%mask (is:ie, js:je) )
- allocate ( geo_lonv (1:im+1,1:jm+1), geo_latv (1:im+1,1:jm+1) )
-
- call set_ocean_hgrid_arrays(geo_lonv, geo_latv, rmask, Ocean_sfc%Domain)
+ allocate ( geo_lon (is:ie , js:je ), geo_lat (is:ie , js:je ) )
+ if (grid_version == 0) then
+ start = 1; nread = 1;
+ start(1) = is; nread(1) = ie-is+1;
+ start(2) = js; nread(2) = je-js+1;
+ rcode = nf_get_vara_double(ncid, varid, start, nread, rmask)
Ocean_state%mask = .false.; where (rmask > 0.5) Ocean_state%mask = .true.
+
+ allocate ( geo_lonv (1:im+1,1:jm+1), geo_latv (1:im+1,1:jm+1) )
+ start = 1; nread = 1;
+ nread(1) = im+1;
+ nread(2) = jm+1;
+ rcode = nf_inq_varid(ncid, 'geo_lonc', varid)
+ !
+ ! The geo_lonc field could not be located on the grid specification file.
+ !
+ if (rcode/=0) call error_mesg ('ocean_model_mod', &
+ 'cannot find geo_lonc on INPUT/grid_spec.nc', FATAL)
+ rcode = nf_get_vara_double(ncid, varid, start, nread, geo_lonv)
+ rcode = nf_inq_varid(ncid, 'geo_latc', varid)
+ !
+ ! The geo_latc field could not be located on the grid specification file.
+ !
+ if (rcode/=0) call error_mesg ('ocean_model_mod', &
+ 'cannot find geo_latc on INPUT/grid_spec.nc', FATAL)
+ rcode = nf_get_vara_double(ncid, varid, start, nread, geo_latv)
+ else ! grid_spec version 2
+ ! compute Ocean_state%mask
+ call read_data(grd_file, "ocn_topog_file", topog)
+ topog = 'INPUT/'//trim(topog)
+ call read_data(topog, "depth", rmask, Ocean_sfc%Domain)
+ Ocean_state%mask = .false.; where (rmask > 0) Ocean_state%mask = .true.
+ ! compute grid cell centers
+ allocate(tmpx(xsize(1),xsize(2)), tmpy(xsize(1),xsize(2)) )
+ start = 1; nread = 1
+ nread(1) = xsize(1)
+ nread(2) = xsize(2)
+ call read_data(ocean_hgrid, "x", tmpx, start, nread, no_domain=.true.)
+ call read_data(ocean_hgrid, "y", tmpy, start, nread, no_domain=.true.)
+ allocate ( geo_lonv (1:im+1,1:jm+1), geo_latv (1:im+1,1:jm+1) )
+ do j = js, je+1
+ do i = is, ie+1
+ geo_lonv(i,j) = tmpx(2*i-1,2*j-1)
+ geo_latv(i,j) = tmpy(2*i-1,2*j-1)
+ end do
+ end do
+ deallocate(tmpx, tmpy)
+ end if
deallocate ( rmask )
- allocate ( geo_lon (is:ie , js:je ), geo_lat (is:ie , js:je ) )
+ ! Debugging
+ !write(*,*) 'geo_lonv', geo_lonv, ';'
+ !write(*,*) 'geo_latv', geo_latv, ';'
+ !write(*,*) 'Ocean_state%mask', Ocean_state%mask, ';'
+ !stop
geo_lon = (geo_lonv(is:ie,js:je) +geo_lonv(is+1:ie+1,js:je) &
+geo_lonv(is:ie,js+1:je+1)+geo_lonv(is+1:ie+1,js+1:je+1))/4
@@ -512,7 +581,6 @@
else
! Cold start ssts are 0C poleward of 65 deg lat and 28C at equator
Ocean_sfc%t_surf = 34*cos(pi*geo_lat/180.)**2 - 6. + Tfreeze
- if(uniform_init_t_surf > -100.0 ) Ocean_sfc%t_surf = Tfreeze + uniform_init_t_surf
where (Ocean_sfc%t_surf < Tfreeze) Ocean_sfc%t_surf = Tfreeze
Ocean_sfc%u_surf = 0.
Ocean_sfc%v_surf = 0.
@@ -568,7 +636,6 @@
real, dimension(size(Ocean_state%mask,1),size(Ocean_state%mask,2)) :: sst, hflx
real, dimension(size(Ocean_state%mask,1),size(Ocean_state%mask,2)) :: qflux_restore_sst, & ! TK mod
qflux_adj, net_hflx ! TK Mod
- real, dimension(size(Ocean_state%mask,1),size(Ocean_state%mask,2)) :: pme, river ! MS mod
real :: dt_ocean
integer :: dy, sc
@@ -602,8 +669,6 @@
!
call error_mesg( 'Update_ocean_model', 'Ice_ocean_boundary not correctly initialized.', FATAL )
- pme = 0.0 ! MS mod
- river = 0.0 ! MS mod
hflx = 0.0
net_hflx = 0.0 ! TK Mod
! mlcp = 4e6*mixed_layer_depth TK Mod: removed extra statement.
@@ -619,16 +684,7 @@
qflux_restore_sst(:,:) = 0.0
-
-! LAT mod: 3/6/09 - SST restoring must be either from the climatology or
-! historical datasets.
- if (do_restore_sst .and. do_restore_histsst) then
- call error_mesg('Update_ocean_model', &
- 'do_restore_sst and do_restore_histsst cannot both be set to true.', FATAL)
- endif
-
-! LAT mod: 3/6/09 - added option for restoring to historical SSTs
- if (do_restore_sst .or. do_restore_histsst) then
+ if (do_restore_sst) then
! TK Mod (1/09/2004) moved this statement inside this if statement
! since it is only needed if sst restoring is active.
@@ -639,9 +695,6 @@
! TK Mod: 4/24/04
if (id_sst_obs > 0) &
sent = send_data(id_sst_obs, sst, Ocean_state%ocean_time, mask=Ocean_state%mask)
-! LAT Mod: 3/6/09 - added diagnostic id for historical restoring SSTs
- if (id_sst_histobs > 0) &
- sent = send_data(id_sst_histobs, sst, Ocean_state%ocean_time, mask=Ocean_state%mask)
! Find the heat flux restoring term (qflux_restore_sst) due to sst
! restoring. The qflux_restore_sst values are saved for use in later
@@ -687,9 +740,6 @@
Ocean_sfc%t_surf = Ocean_sfc%t_surf + dt_ocean*net_hflx/mlcp
- pme = (Ice_ocean_boundary%lprec + Ice_ocean_boundary%fprec - Ice_ocean_boundary%q_flux)*rho0r ! MS mod
- river = (Ice_ocean_boundary%runoff + Ice_ocean_boundary%calving)*rho0r ! MS mod
-
!
end where
@@ -729,11 +779,6 @@
if (id_frazil > 0) &
sent = send_data(id_frazil, Ocean_sfc%frazil/dt_ocean, Ocean_state%ocean_time, &
mask=Ocean_state%mask)
-! MS mods
- if (id_pme > 0) &
- sent = send_data(id_pme, pme, Ocean_state%ocean_time, mask=Ocean_state%mask)
- if (id_river > 0) &
- sent = send_data(id_river, river, Ocean_state%ocean_time, mask=Ocean_state%mask)
! TK mods
if (do_qflux_adj) then
@@ -741,13 +786,12 @@
sent = send_data(id_qflx_adj, qflux_adj, Ocean_state%ocean_time, mask=Ocean_state%mask)
end if
-! LAT mod: 3/6/09 - added option to send data for restoring historical SSTs
- if (do_restore_sst .or. do_restore_histsst) then
+ if (do_restore_sst) then
if (id_qflux_restore_sst > 0) &
sent = send_data(id_qflux_restore_sst, qflux_restore_sst, Ocean_state%ocean_time, mask=Ocean_state%mask)
end if
- if (do_qflux_adj .or. do_restore_sst .or. do_restore_histsst) then
+ if (do_qflux_adj .or. do_restore_sst) then
if (id_net_hflx > 0) &
sent = send_data(id_net_hflx, net_hflx, Ocean_state%ocean_time, mask=Ocean_state%mask)
end if
@@ -793,6 +837,8 @@
call close_file (unit)
+ call ocean_parameters_end()
+
module_is_initialized = .FALSE.
end subroutine ocean_model_end
@@ -915,33 +961,17 @@
Time, 'frazil', 'W/m^2', &
missing_value=1.e10)
-! MS mods
- id_pme = register_diag_field('ocean_model','PME', axt, Time, &
- 'prec-evap (liquid, frozen, evapor)', 'm/sec', missing_value=1.e10)
-
- id_river = register_diag_field('ocean_model','RIVER', axt, Time, &
- 'river flux (liquid, frozen)', 'm/sec', missing_value=1.e10)
-
! TK mods
-! LAT mod: 3/6/09 - added calls/diagnostics for restoring historical SST case
- if (do_restore_sst .or. do_restore_histsst) then
+ if (do_restore_sst) then
id_qflux_restore_sst = register_diag_field('ocean_model', &
'QFLX_RESTORE_SST',axt, &
Time, 'surface heat flux for SST restoring', 'W/m^2', &
missing_value=1.e10)
- if (do_restore_histsst) then
- call error_mesg ('ocean_model_mod', 'restoring to historical SSTs', NOTE)
- id_sst_histobs = register_diag_field('ocean_model', &
- 'SST_HISTOBS',axt, &
- Time, 'Observed historical SST for restoring', 'K', &
- missing_value=1.e10)
- else
- call error_mesg ('ocean_model_mod', 'restoring to climatological SSTs', NOTE)
+
id_sst_obs = register_diag_field('ocean_model', &
'SST_OBS',axt, &
Time, 'Observed SST for restoring', 'K', &
missing_value=1.e10)
- endif
end if
if (do_qflux_adj) then
@@ -951,8 +981,7 @@
missing_value=1.e10)
end if
-! LAT mod: 3/6/09 - added restoring historical SST case
- if (do_qflux_adj .or. do_restore_sst .or. do_restore_histsst) then
+ if (do_qflux_adj .or. do_restore_sst) then
id_net_hflx = register_diag_field('ocean_model', &
'NET_HFLX',axt, &
Time, 'net heat flux into mixed layer after adjustments', &
@@ -1098,12 +1127,7 @@
! TK Mod: change these to ocean grid:
call data_override('OCN', 'sic_obs', icec, time)
call data_override('OCN', 'sit_obs', iceh, time)
-! LAT Mod: 3/6/09 - added override for restoring historical SST case
- if (do_restore_histsst) then
- call data_override('OCN', 'sst_histobs', sst, time)
- else
call data_override('OCN', 'sst_obs', sst, time)
- endif
! call data_override('ICE', 'sic_obs', icec, time)
! call data_override('ICE', 'sit_obs', iceh, time)
! call data_override('ICE', 'sst_obs', sst, time)
@@ -1230,7 +1254,8 @@
WRITE (outunit,100) 'ocean_public_type%sea_lev', mpp_chksum(bnd_type%sea_lev)
WRITE (outunit,100) 'ocean_public_type%frazil ', mpp_chksum(bnd_type%frazil)
WRITE (outunit,100) 'ocean_public_type%u_surf ', mpp_chksum(bnd_type%u_surf)
- WRITE (outunit,100) 'ocean_public_type%area ', mpp_chksum(bnd_type%area)
+ ! %area is not initialised in ocean_mixed_layer
+ !WRITE (outunit,100) 'ocean_public_type%area ', mpp_chksum(bnd_type%area)
WRITE (outunit,100) 'ocean_public_type%v_surf ', mpp_chksum(bnd_type%v_surf)
DO n = 1, bnd_type%fields%num_bcs
diff -ur --unidirectional-new-file -b -E -Z -x CM2.1p1 -x StripedPlanet -x atmos_bgrid -x atmos_ebm -x land_lad2 -x mom5 -x generic_tracers /p/tmp/petri/mom5-af3a94d4/src/postprocessing/mppnccombine/mppnccombine.c MonsoonPlanet/src/postprocessing/mppnccombine/mppnccombine.c
--- /p/tmp/petri/mom5-af3a94d4/src/postprocessing/mppnccombine/mppnccombine.c 2018-10-11 09:29:44.137141960 +0200
+++ MonsoonPlanet/src/postprocessing/mppnccombine/mppnccombine.c 2021-03-31 13:53:47.071881070 +0200
@@ -940,7 +940,10 @@
}
/* Definitions done */
- nc__enddef(ncoutfile->ncfid,headerpad,4,0,4);
+ n = nc__enddef(ncoutfile->ncfid,headerpad,4,0,4);
+ if (n != 0) {
+ fprintf(stderr, "nc__enddef failed with %d: %s\n", n, nc_strerror(n));
+ }
}
/* Copy all data values of the dimensions and variables to memory */
@@ -1143,8 +1146,8 @@
nctypelen(ncinfile->datatype[v])*recsize);
if (ncvarput(ncoutfile->ncfid,v,outstart,count,values)==(-1))
{
- fprintf(stderr,"Error: cannot write variable \"%s\"'s values!\n",
- ncinfile->varname[v]);
+ fprintf(stderr,"Error: cannot write variable \"%s\"'s values! ncerr=%d\n",
+ ncinfile->varname[v], ncerr);
return(1);
}
}
diff -ur --unidirectional-new-file -b -E -Z -x CM2.1p1 -x StripedPlanet -x atmos_bgrid -x atmos_ebm -x land_lad2 -x mom5 -x generic_tracers /p/tmp/petri/mom5-af3a94d4/src/preprocessing/generate_grids/atmos/atmos_grid_generator.csh MonsoonPlanet/src/preprocessing/generate_grids/atmos/atmos_grid_generator.csh
--- /p/tmp/petri/mom5-af3a94d4/src/preprocessing/generate_grids/atmos/atmos_grid_generator.csh 2014-03-18 14:03:57.000000000 +0100
+++ MonsoonPlanet/src/preprocessing/generate_grids/atmos/atmos_grid_generator.csh 2021-03-31 13:53:47.276446865 +0200
@@ -18,7 +18,13 @@
#######################################################################
set echo
- set platform = "ncrc.intel" # A unique identifier for your platform
+# set platform = "ncrc.intel" # A unique identifier for your platform
+if ( `hostname` =~ login0? ) then
+ set platform = pik-iplex-ifort11
+endif
+if ( `hostname` =~ viss0? ) then
+ set platform = pik-vis-ifort11
+endif
#
set root = $cwd:h:h:h:h # The directory that contains src/ and bin/
set npes = 1
@@ -44,7 +50,7 @@
set mkmfTemplate = $root/bin/mkmf.debugtemplate.$platform
endif
set mkmf = $root/bin/mkmf # path to executable mkmf
- set cppDefs = ( "-Duse_netCDF -Duse_netCDF3 -Duse_libMPI -DOVERLOAD_C8" ) # list of cpp #defines to be passed to the source files
+ set cppDefs = ( "-Duse_netCDF -Duse_netCDF3 -DOVERLOAD_C8 -Duse_libMPI -DOVERLOAD_C4 -DOVERLOAD_R4") # list of cpp #defines to be passed to the source files
# list the source code
set CORE = " $tooldir/{atmos_grid.f90,atmos_grid_generator.f90} "
diff -ur --unidirectional-new-file -b -E -Z -x CM2.1p1 -x StripedPlanet -x atmos_bgrid -x atmos_ebm -x land_lad2 -x mom5 -x generic_tracers /p/tmp/petri/mom5-af3a94d4/src/preprocessing/regrid_2d/regrid_2d.f90 MonsoonPlanet/src/preprocessing/regrid_2d/regrid_2d.f90
--- /p/tmp/petri/mom5-af3a94d4/src/preprocessing/regrid_2d/regrid_2d.f90 2014-03-18 14:03:57.000000000 +0100
+++ MonsoonPlanet/src/preprocessing/regrid_2d/regrid_2d.f90 2021-03-31 13:53:47.148858585 +0200
@@ -330,7 +330,13 @@
if(.not.found_yc) call mpp_error(FATAL,'regrid_2d: field y_C is not in the file '//trim(dest_grid) )
if(.not.found_angle) call mpp_error(FATAL,'regrid_2d: field angle_C is not in the file '//trim(dest_grid) )
endif
- if(.not.found_wet) call mpp_error(FATAL,'regrid_2d: field wet is not in the file '//trim(dest_grid) )
+! kienert@pik-potsdam.de: changed the next lines so that regridding onto a dest. grid without field 'wet' is possible
+! if apply_dest_mask is false
+ if(.not.found_wet) then
+ if(apply_dest_mask) then
+ call mpp_error(FATAL,'regrid_2d: field wet is not in the file '//trim(dest_grid) )
+ endif
+ endif
if(.not. apply_dest_mask) mask_dst = 1.0 ! will get global data
diff -ur --unidirectional-new-file -b -E -Z -x CM2.1p1 -x StripedPlanet -x atmos_bgrid -x atmos_ebm -x land_lad2 -x mom5 -x generic_tracers /p/tmp/petri/mom5-af3a94d4/src/shared/astronomy/astronomy.F90 MonsoonPlanet/src/shared/astronomy/astronomy.F90
--- /p/tmp/petri/mom5-af3a94d4/src/shared/astronomy/astronomy.F90 2022-12-21 10:27:22.936584443 +0100
+++ MonsoonPlanet/src/shared/astronomy/astronomy.F90 2021-03-31 13:53:51.140617127 +0200
@@ -77,6 +77,7 @@
module procedure daily_mean_solar_cal_2d
module procedure daily_mean_solar_cal_1d
module procedure daily_mean_solar_cal_2level
+ module procedure daily_mean_solar_cal_2level_radwt
module procedure daily_mean_solar_cal_0d
end interface
@@ -2466,6 +2467,177 @@
+!###################################################################
+!
+!
+! daily_mean_solar_cal_2level_radwt receives 1d arrays and time_type input.
+! It uses code copied from daily_mean_solar_2d to compute desired astronomical variables.
+! In addition to daily_mean solar, also radiation-weighted cosz
+! is computed.
+!
+!
+! daily_mean_solar_cal_2level receives 1d arrays and time_type input.
+! It uses code copied from daily_mean_solar_2d to compute desired astronomical variables.
+! In addition to daily_mean solar, also radiation-weighted cosz
+! is computed. [Georg Feulner: Radiation-weighted daily average solar zenith angle, 27.11.13]
+! Blowing-up to 2-D variables is avoided here.
+!
+!
+! call daily_mean_solar_cal_2level_radwt (lat, time, cosz, solar, cosz_radwt)
+!
+!
+! latitudes of model grid points
+!
+!
+! time of year
+!
+!
+! cosine of solar zenith angle
+!
+!
+! shortwave flux factor: cosine of zenith angle *
+! daylight fraction / (earth-sun distance squared)
+!
+!
+! radiation-weighted cosine of solar zenith angle
+!
+!
+!
+subroutine daily_mean_solar_cal_2level_radwt (lat, time, cosz, solar, cosz_radwt)
+
+ real, dimension(:), intent(in) :: lat
+ type(time_type), intent(in) :: time
+ real, dimension(:), intent(out) :: cosz, solar, cosz_radwt
+
+!---------------------------------------------------------------------
+! local variables
+
+ real :: rrsun ! earth-sun distance (r) relative to semi-major axis
+ ! of orbital ellipse (a) : (a/r)**2
+ ! [ dimensionless ]
+ real, dimension(size(lat,1)) :: lat2 ! lat with slightly shifted poles to avoid singularity in tangens
+ real, dimension(size(lat,1)) :: tan_lat, sin_lat, cos_lat
+ real, dimension(size(lat,1)) :: cos_half_day
+ real, dimension(size(lat,1)) :: HA_SS ! hour angle at sunset; same as half_day elsewhere in this module
+ real, dimension(size(lat,1)) :: sin_HA_SS
+ real, dimension(size(lat,1)) :: fracday
+ real, dimension(size(lat,1)) :: factor_A
+ real :: time_since_ae ! time of year; autumnal equinox = 0.0,
+ ! one year = 2 * pi
+ ! [ radians ]
+ real :: ang ! orbital position relative to NH autumnal equinox [ radians ]
+ real :: dec ! solar declination angle in earth's orbit
+ real :: tan_dec, sin_dec, cos_dec
+ real :: eps = 1.0E-05
+ integer :: i
+
+! code from daily_mean_solar_cal_2d: convert the time_types to reals and
+! then calculate the astronomy fields.
+ time_since_ae = orbital_time(time)
+
+! code from daily_mean_solar_2d: calculate the astronomy fields.
+ ang = angle (time_since_ae)
+ dec = declination(ang)
+ rrsun = r_inv_squared(ang)
+
+! code adapted from half_day_2d
+ tan_dec = tan(dec)
+ ! adjust latitude so that its tangent will be defined.
+ ! TODO: compare to range 0.5*PI +/- eps instead of rounded 0.5*PI
+ where (lat == 0.5*PI)
+ lat2 = lat - eps
+ elsewhere
+ where (lat == -0.5*PI)
+ lat2 = lat + eps
+ elsewhere
+ lat2 = lat
+ end where
+ end where
+ tan_lat = tan(lat2)
+ ! define the cosine of the half-day length. adjust for cases of
+ ! all daylight or all night.
+ cos_half_day = -tan_lat * tan_dec
+ where (cos_half_day <= -1.0)
+ HA_SS = PI
+ elsewhere
+ where (cos_half_day >= +1.0)
+ HA_SS = 0.0
+ elsewhere
+ HA_SS = acos(cos_half_day)
+ end where
+ end where
+ !where(cos_half_day > -1.0 .and. cos_half_day < 1.0) HA_SS = acos(cos_half_day)
+
+! code from daily_mean_solar_2d
+ ! where the entire day is dark, define cosz to be zero. otherwise
+ ! use the standard formula. define the daylight fraction and earth-
+ ! sun distance.
+ !write(*,*) 'HA_SS', HA_SS
+ !write(*,*) 'lat', lat
+ !write(*,*) 'dec', dec
+! new code
+!
+ sin_lat(:)=sin(lat(:))
+ !write(*,*) 'sin_lat', sin_lat
+ cos_lat(:)=cos(lat(:))
+ !write(*,*) 'cos_lat', cos_lat
+ sin_dec=sin(dec)
+ !write(*,*) 'sin_dec', sin_dec
+ cos_dec=cos(dec)
+ !write(*,*) 'cos_dec', cos_dec
+ sin_HA_SS(:) = sin(HA_SS(:))
+ !write(*,*) 'sin_HA_SS', sin_HA_SS
+ !write(*,*) 'sin(lat)*sin(dec)', sin_lat*sin_dec
+ !write(*,*) 'cos(lat)*cos(dec)', cos_lat*cos_dec
+ !write(*,*) 'daily_mean_solar_cal_2level_radwt: size lat ',size(lat), 'bounds', lbound(lat), ubound(lat)
+ !write(*,*) ' size cosz ', size(cosz), 'bounds', lbound(cosz), ubound(cosz)
+ !write(*,*) ' size HA_SS ', size(HA_SS), 'bounds', lbound(HA_SS), ubound(HA_SS)
+! code from daily_mean_solar_2d
+ where (HA_SS .eq. 0) ! (HA_SS .lt. eps .and. HA_SS .gt. -eps)
+ cosz = 0.0
+ elsewhere
+ ! cosz = sin(lat)*sin(dec) + cos(lat)*cos(dec)*sin(HA_SS)/HA_SS
+ cosz = sin_lat*sin_dec + cos_lat*cos_dec*sin_HA_SS/HA_SS
+ end where
+ ! Sigh deeply. ifort 17.0.4 produces buggy code for the above where-construct
+ ! when compiling with options -O3 -xCORE-AVX2 -qno-opt-dynamic-align ,
+ ! also with -fp-model precise . It works correctly with -fp-model consistent ,
+ ! or without vectorization.
+ ! Symptoms: Error: floating invalid is raised in the elsewhere branch.
+ ! The same problem occurs when the where-construct is replaced by an explicit do-loop.
+ ! Also, when the write-statement inside the do-loop is un-commented,
+ ! it apparently prevents the buggy optimization.
+ !do i=1,size(cosz)
+ ! if (HA_SS(i) .eq. 0) then
+ ! cosz(i) = 0.0
+ ! else
+ ! !write(*,*) i !, HA_SS(i), sin_HA_SS(i)
+ ! !flush(*)
+ ! cosz(i) = sin_lat(i)*sin_dec + cos_lat(i)*cos_dec*sin_HA_SS(i)/HA_SS(i)
+ ! end if
+ !end do
+ !write(*,*) 'finished cosz', cosz
+ fracday = HA_SS/PI
+
+! code from daily_mean_solar_cal_2level
+ solar = cosz*fracday*rrsun
+
+! new code
+!
+ factor_A = 2 * sin_lat**2 * sin_dec**2 * HA_SS &
+ + 4 * sin_lat * sin_dec * cos_lat * cos_dec * sin_HA_SS &
+ + cos_lat**2 * cos_dec**2 * (HA_SS + sin(2*HA_SS)/2) ! from G.F. 27.11.13
+ where (cosz > 0)
+ ! Note: <\cos\theta_\mbox{s}> in the equations of G.F. is equal to astronomy_mod HA_SS*cosz/PI
+ cosz_radwt = factor_A / (2*cosz*HA_SS) ! from G.F. 28.11.13
+ elsewhere
+ cosz_radwt = 0
+ end where
+
+end subroutine daily_mean_solar_cal_2level_radwt
+
+
+
!###################################################################
!
diff -ur --unidirectional-new-file -b -E -Z -x CM2.1p1 -x StripedPlanet -x atmos_bgrid -x atmos_ebm -x land_lad2 -x mom5 -x generic_tracers /p/tmp/petri/mom5-af3a94d4/src/shared/axis_utils/axis_utils.F90 MonsoonPlanet/src/shared/axis_utils/axis_utils.F90
--- /p/tmp/petri/mom5-af3a94d4/src/shared/axis_utils/axis_utils.F90 2022-12-21 10:27:22.938298171 +0100
+++ MonsoonPlanet/src/shared/axis_utils/axis_utils.F90 2021-03-31 13:53:51.059271220 +0200
@@ -64,7 +64,7 @@
character(len=16), dimension(3) :: z_names
character(len=16), dimension(2) :: t_names
character(len=16), dimension(3) :: lon_units, lat_units
- character(len=8) , dimension(4) :: z_units
+ character(len=8) , dimension(5) :: z_units
character(len=3) , dimension(6) :: t_units
character(len=32) :: name
integer :: i,j
@@ -75,7 +75,7 @@
t_names = (/'time','t '/)
lon_units = (/'degrees_e ', 'degrees_east', 'degreese '/)
lat_units = (/'degrees_n ', 'degrees_north', 'degreesn '/)
- z_units = (/'cm ','m ','pa ','hpa'/)
+ z_units = (/'cm ','m ','pa ','hpa ','meters'/)
t_units = (/'sec', 'min','hou','day','mon','yea'/)
call mpp_get_atts(axis,cartesian=axis_cart)
diff -ur --unidirectional-new-file -b -E -Z -x CM2.1p1 -x StripedPlanet -x atmos_bgrid -x atmos_ebm -x land_lad2 -x mom5 -x generic_tracers /p/tmp/petri/mom5-af3a94d4/src/shared/constants/constants.F90 MonsoonPlanet/src/shared/constants/constants.F90
--- /p/tmp/petri/mom5-af3a94d4/src/shared/constants/constants.F90 2022-12-21 10:27:23.005024000 +0100
+++ MonsoonPlanet/src/shared/constants/constants.F90 2021-03-31 13:53:51.836329427 +0200
@@ -229,7 +229,10 @@
subroutine constants_init
! dummy routine.
-
+ !if (mpp_pe() == mpp_root_pe()) then
+ write(*,*) version
+ write(*,*) tagname
+ !end if
end subroutine constants_init
end module constants_mod
diff -ur --unidirectional-new-file -b -E -Z -x CM2.1p1 -x StripedPlanet -x atmos_bgrid -x atmos_ebm -x land_lad2 -x mom5 -x generic_tracers /p/tmp/petri/mom5-af3a94d4/src/shared/data_override/data_override.F90 MonsoonPlanet/src/shared/data_override/data_override.F90
--- /p/tmp/petri/mom5-af3a94d4/src/shared/data_override/data_override.F90 2022-12-21 10:27:23.045772341 +0100
+++ MonsoonPlanet/src/shared/data_override/data_override.F90 2021-03-31 13:53:51.731535090 +0200
@@ -514,7 +514,11 @@
index1 = i ! field found
exit
enddo
- if(index1 .eq. -1) return ! NO override was performed
+ if(index1 .eq. -1) then
+ if(mpp_pe() == mpp_root_pe() .and. debug_data_override) &
+ call mpp_error(WARNING,'this field is NOT found in data_table: '//trim(gridname)//' '//trim(fieldname))
+ return ! NO override was performed
+ endif
allocate(data_3D(size(data_2D,1),size(data_2D,2),1))
data_3D(:,:,1) = data_2D
@@ -608,7 +612,7 @@
enddo
if(index1 .eq. -1) then
if(mpp_pe() == mpp_root_pe() .and. debug_data_override) &
- call mpp_error(WARNING,'this field is NOT found in data_table: '//trim(fieldname_code))
+ call mpp_error(WARNING,'this field is NOT found in data_table: '//trim(gridname)//' '//trim(fieldname_code))
return ! NO override was performed
endif
endif
@@ -1016,7 +1020,7 @@
enddo
if(index1 .eq. -1) then
if(mpp_pe() == mpp_root_pe() .and. debug_data_override) &
- call mpp_error(WARNING,'this field is NOT found in data_table: '//trim(fieldname_code))
+ call mpp_error(WARNING,'this field is NOT found in data_table: '//trim(gridname)//' '//trim(fieldname_code))
return ! NO override was performed
endif
endif
diff -ur --unidirectional-new-file -b -E -Z -x CM2.1p1 -x StripedPlanet -x atmos_bgrid -x atmos_ebm -x land_lad2 -x mom5 -x generic_tracers /p/tmp/petri/mom5-af3a94d4/src/shared/diag_manager/diag_manager.F90 MonsoonPlanet/src/shared/diag_manager/diag_manager.F90
--- /p/tmp/petri/mom5-af3a94d4/src/shared/diag_manager/diag_manager.F90 2022-12-21 10:27:23.052731505 +0100
+++ MonsoonPlanet/src/shared/diag_manager/diag_manager.F90 2021-03-31 13:53:51.640411062 +0200
@@ -3299,6 +3299,8 @@
#ifndef INTERNAL_FILE_NML
INTEGER :: nml_unit
#endif
+ INTEGER :: pe
+ CHARACTER(len=11) :: this_pe
CHARACTER(len=256) :: err_msg_local
NAMELIST /diag_manager_nml/ append_pelist_name, mix_snapshot_average_fields, max_output_fields, &
@@ -3425,7 +3427,9 @@
! open diag field log file
IF ( do_diag_field_log.AND.mpp_pe().EQ.mpp_root_pe() ) THEN
- CALL mpp_open(diag_log_unit, 'diag_field_log.out', nohdrs=.TRUE.)
+ pe = mpp_pe()
+ write(this_pe,'(i6.6)') pe
+ CALL mpp_open(diag_log_unit, 'diag_field_log.'//trim(this_pe)//'.out', nohdrs=.TRUE.)
WRITE (diag_log_unit,'(777a)') &
& 'Module', SEP, 'Field', SEP, 'Long Name', SEP,&
& 'Units', SEP, 'Number of Axis', SEP, 'Time Axis', SEP,&
diff -ur --unidirectional-new-file -b -E -Z -x CM2.1p1 -x StripedPlanet -x atmos_bgrid -x atmos_ebm -x land_lad2 -x mom5 -x generic_tracers /p/tmp/petri/mom5-af3a94d4/src/shared/diag_manager/diag_util.F90 MonsoonPlanet/src/shared/diag_manager/diag_util.F90
--- /p/tmp/petri/mom5-af3a94d4/src/shared/diag_manager/diag_util.F90 2022-12-21 10:27:23.057437364 +0100
+++ MonsoonPlanet/src/shared/diag_manager/diag_util.F90 2021-03-31 13:53:51.642175759 +0200
@@ -704,7 +704,11 @@
axes_list=''
DO i = 1, SIZE(axes)
+ if (axes(i) > 0) then
CALL get_diag_axis_name(axes(i),axis_name)
+ else
+ axis_name = '?'
+ endif
IF ( TRIM(axes_list) /= '' ) axes_list = TRIM(axes_list)//','
axes_list = TRIM(axes_list)//TRIM(axis_name)
END DO
diff -ur --unidirectional-new-file -b -E -Z -x CM2.1p1 -x StripedPlanet -x atmos_bgrid -x atmos_ebm -x land_lad2 -x mom5 -x generic_tracers /p/tmp/petri/mom5-af3a94d4/src/shared/drifters/drifters_core.F90 MonsoonPlanet/src/shared/drifters/drifters_core.F90
--- /p/tmp/petri/mom5-af3a94d4/src/shared/drifters/drifters_core.F90 2022-12-21 10:27:23.065672000 +0100
+++ MonsoonPlanet/src/shared/drifters/drifters_core.F90 2021-03-31 13:53:50.990371734 +0200
@@ -5,6 +5,8 @@
#include
module drifters_core_mod
+ use quicksort_mod, only: qksrt_quicksort
+
implicit none
private
@@ -176,7 +178,6 @@
character(*), intent(out) :: ermesg
integer ier, np_add, np_remove, i, j, n_diff !, iflag
integer indices_to_remove(size(indices_to_remove_in))
- external qksrt_quicksort
ermesg = ''
ier = 0
diff -ur --unidirectional-new-file -b -E -Z -x CM2.1p1 -x StripedPlanet -x atmos_bgrid -x atmos_ebm -x land_lad2 -x mom5 -x generic_tracers /p/tmp/petri/mom5-af3a94d4/src/shared/drifters/quicksort.F90 MonsoonPlanet/src/shared/drifters/quicksort.F90
--- /p/tmp/petri/mom5-af3a94d4/src/shared/drifters/quicksort.F90 2022-12-21 10:27:23.071473000 +0100
+++ MonsoonPlanet/src/shared/drifters/quicksort.F90 2021-03-31 13:53:50.983948000 +0200
@@ -1,8 +1,15 @@
#undef _TYP
#define _TYP integer
+module quicksort_mod
+
+private
+public qksrt_quicksort
+
! Written by Magnus Lie Hetland
+contains
+
function qksrt_partition(n, list, start, end) result(top)
implicit none
integer, intent(in) :: n
@@ -58,8 +65,7 @@
integer, intent(in) :: n
_TYP, intent(inout) :: list(n)
integer, intent(in) :: start, end
- integer :: split, qksrt_partition
- external :: qksrt_partition
+ integer :: split
if(start < end) then ! If there are two or more elements...
split = qksrt_partition(n, list, start, end) ! ... partition the sublist...
call qksrt_quicksort(n, list, start, split-1) ! ... and sort both halves.
@@ -67,6 +73,7 @@
endif
end subroutine qksrt_quicksort
+end module quicksort_mod
#ifdef _TEST_SORT
program test
diff -ur --unidirectional-new-file -b -E -Z -x CM2.1p1 -x StripedPlanet -x atmos_bgrid -x atmos_ebm -x land_lad2 -x mom5 -x generic_tracers /p/tmp/petri/mom5-af3a94d4/src/shared/exchange/stock_constants.F90 MonsoonPlanet/src/shared/exchange/stock_constants.F90
--- /p/tmp/petri/mom5-af3a94d4/src/shared/exchange/stock_constants.F90 2022-12-21 10:27:23.073751000 +0100
+++ MonsoonPlanet/src/shared/exchange/stock_constants.F90 2021-03-31 13:53:51.017961949 +0200
@@ -147,6 +147,7 @@
! that register_diag_field returns when it can't register the filed -- otherwise the registration
! is attempted every time this subroutine is called
+ integer, dimension(NCOMPS,NELEMS), save :: now_valueDiagID = initID
integer, dimension(NCOMPS,NELEMS), save :: f_valueDiagID = initID
integer, dimension(NCOMPS,NELEMS), save :: c_valueDiagID = initID
integer, dimension(NCOMPS,NELEMS), save :: fmc_valueDiagID = initID
@@ -194,6 +195,14 @@
if(mpp_pe() == mpp_root_pe()) then
+ if(now_valueDiagID(comp,elem) == initID) then
+ field_name = trim(COMP_NAMES(comp)) // trim(STOCK_NAMES(elem))
+ field_name = trim(field_name) // 'StocksChange_Sum'
+ units = trim(STOCK_UNITS(elem))
+ now_valueDiagID(comp,elem) = register_diag_field('stock_print', field_name, Time, &
+ units=units)
+ endif
+
if(f_valueDiagID(comp,elem) == initID) then
field_name = trim(COMP_NAMES(comp)) // trim(STOCK_NAMES(elem))
field_name = trim(field_name) // 'StocksChange_Flux'
@@ -239,6 +248,9 @@
endif
+ DiagID=now_valueDiagID(comp,elem)
+ diagField = q_now(comp)
+ if (DiagID > 0) used = send_data(DiagID, diagField, Time)
DiagID=f_valueDiagID(comp,elem)
diagField = f_value(comp)
if (DiagID > 0) used = send_data(DiagID, diagField, Time)
diff -ur --unidirectional-new-file -b -E -Z -x CM2.1p1 -x StripedPlanet -x atmos_bgrid -x atmos_ebm -x land_lad2 -x mom5 -x generic_tracers /p/tmp/petri/mom5-af3a94d4/src/shared/fms/fms.F90 MonsoonPlanet/src/shared/fms/fms.F90
--- /p/tmp/petri/mom5-af3a94d4/src/shared/fms/fms.F90 2022-12-21 10:27:23.150695962 +0100
+++ MonsoonPlanet/src/shared/fms/fms.F90 2021-03-31 13:53:51.093851530 +0200
@@ -671,9 +671,9 @@
LOGICAL :: opened
! Variables for sample namelists
- INTEGER :: i1, i2
- REAL :: r1, r2
- LOGICAL :: l1
+ INTEGER :: i1 = 1, i2 = 2
+ REAL :: r1 = 1.0, r2 = 2.0
+ LOGICAL :: l1 = .FALSE.
NAMELIST /a_nml/ i1, r1
NAMELIST /b_nml/ i2, r2, l1
NAMELIST /badType1_nml/ i1, r1
diff -ur --unidirectional-new-file -b -E -Z -x CM2.1p1 -x StripedPlanet -x atmos_bgrid -x atmos_ebm -x land_lad2 -x mom5 -x generic_tracers /p/tmp/petri/mom5-af3a94d4/src/shared/mosaic/read_mosaic.c MonsoonPlanet/src/shared/mosaic/read_mosaic.c
--- /p/tmp/petri/mom5-af3a94d4/src/shared/mosaic/read_mosaic.c 2022-12-21 10:27:23.187194788 +0100
+++ MonsoonPlanet/src/shared/mosaic/read_mosaic.c 2021-03-31 13:53:51.812196655 +0200
@@ -8,6 +8,17 @@
#ifdef use_netCDF
#include
#endif
+
+/* Sigh deeply. type confusion at the F90/C interface is not detected.
+ * This hits e.g. when using EBM code (which si compiled with -DOVERLOAD_R4)
+ * with a mosaic grid definition (whereas the mom4p1_ebm1 example cases uses
+ * a non-mosaic grid definition, and thus does not invoke this module here).
+ * With the Intel compiler, we always use REAL*8, and thus always need
+ * double values here. Regardless of what happens in the fms modules.
+ * Thus we hard undef this symbol here.
+ */
+//#undef OVERLOAD_R4
+
/*********************************************************************
void netcdf_error( int status )
status is the returning value of netcdf call. this routine will
diff -ur --unidirectional-new-file -b -E -Z -x CM2.1p1 -x StripedPlanet -x atmos_bgrid -x atmos_ebm -x land_lad2 -x mom5 -x generic_tracers /p/tmp/petri/mom5-af3a94d4/src/shared/mpp/include/mpp_io_write.inc MonsoonPlanet/src/shared/mpp/include/mpp_io_write.inc
--- /p/tmp/petri/mom5-af3a94d4/src/shared/mpp/include/mpp_io_write.inc 2022-12-21 10:27:23.273635802 +0100
+++ MonsoonPlanet/src/shared/mpp/include/mpp_io_write.inc 2021-03-31 13:53:51.375091395 +0200
@@ -479,6 +479,8 @@
call mpp_write_meta( unit, axis%id, 'cartesian_axis', cval=axis%cartesian)
axis%natt = axis%natt + 1
endif
+ ! CF Conventions define attribute axis , and do not know cartesian_axis
+ if( PRESENT(cartesian) )call mpp_write_meta( unit, axis%id, 'axis', cval=axis%cartesian)
if( PRESENT(sense) )then
if( sense.EQ.-1 )then
call mpp_write_meta( unit, axis%id, 'positive', cval='down')
diff -ur --unidirectional-new-file -b -E -Z -x CM2.1p1 -x StripedPlanet -x atmos_bgrid -x atmos_ebm -x land_lad2 -x mom5 -x generic_tracers /p/tmp/petri/mom5-af3a94d4/src/shared/sat_vapor_pres/sat_vapor_pres.F90 MonsoonPlanet/src/shared/sat_vapor_pres/sat_vapor_pres.F90
--- /p/tmp/petri/mom5-af3a94d4/src/shared/sat_vapor_pres/sat_vapor_pres.F90 2022-12-21 10:27:23.357331759 +0100
+++ MonsoonPlanet/src/shared/sat_vapor_pres/sat_vapor_pres.F90 2021-03-31 13:53:51.111065749 +0200
@@ -555,7 +555,7 @@
else
if(show_all_bad_values) call show_all_bad ( temp )
write(err_msg_local,'(a47,i7)') 'saturation vapor pressure table overflow, nbad=', nbad
- if(fms_error_handler('lookup_es',err_msg_local,err_msg)) return
+ if(fms_error_handler('lookup_es_0d',err_msg_local,err_msg)) return
endif
end subroutine lookup_es_0d
@@ -587,7 +587,7 @@
if(show_bad_value_count_by_slice) call temp_check ( temp )
if(show_all_bad_values) call show_all_bad ( temp )
write(err_msg_local,'(a47,i7)') 'saturation vapor pressure table overflow, nbad=', nbad
- if(fms_error_handler('lookup_es',err_msg_local,err_msg)) return
+ if(fms_error_handler('lookup_es_1d',err_msg_local,err_msg)) return
endif
!-----------------------------------------------
@@ -621,7 +621,7 @@
if(show_bad_value_count_by_slice) call temp_check ( temp )
if(show_all_bad_values) call show_all_bad ( temp )
write(err_msg_local,'(a47,i7)') 'saturation vapor pressure table overflow, nbad=', nbad
- if(fms_error_handler('lookup_es',err_msg_local,err_msg)) return
+ if(fms_error_handler('lookup_es_2d',err_msg_local,err_msg)) return
endif
!-----------------------------------------------
@@ -654,7 +654,7 @@
if(show_bad_value_count_by_slice) call temp_check ( temp )
if(show_all_bad_values) call show_all_bad ( temp )
write(err_msg_tmp,'(a47,i7)') 'saturation vapor pressure table overflow, nbad=', nbad
- if(fms_error_handler('lookup_es',err_msg_tmp,err_msg)) return
+ if(fms_error_handler('lookup_es_3d',err_msg_tmp,err_msg)) return
endif
end subroutine lookup_es_3d
@@ -945,7 +945,7 @@
else
if(show_all_bad_values) call show_all_bad ( temp )
write(err_msg_local,'(a47,i7)') 'saturation vapor pressure table overflow, nbad=', nbad
- if(fms_error_handler('lookup_des',err_msg_local,err_msg)) return
+ if(fms_error_handler('lookup_des_0d',err_msg_local,err_msg)) return
endif
end subroutine lookup_des_0d
@@ -978,7 +978,7 @@
if(show_bad_value_count_by_slice) call temp_check ( temp )
if(show_all_bad_values) call show_all_bad ( temp )
write(err_msg_local,'(a47,i7)') 'saturation vapor pressure table overflow, nbad=', nbad
- if(fms_error_handler('lookup_es',err_msg_local,err_msg)) return
+ if(fms_error_handler('lookup_des_1d',err_msg_local,err_msg)) return
endif
!-----------------------------------------------
@@ -1011,7 +1011,7 @@
if(show_bad_value_count_by_slice) call temp_check ( temp )
if(show_all_bad_values) call show_all_bad ( temp )
write(err_msg_local,'(a47,i7)') 'saturation vapor pressure table overflow, nbad=', nbad
- if(fms_error_handler('lookup_es',err_msg_local,err_msg)) return
+ if(fms_error_handler('lookup_des_2d',err_msg_local,err_msg)) return
endif
!-----------------------------------------------
@@ -1042,7 +1042,7 @@
if(show_bad_value_count_by_slice) call temp_check ( temp )
if(show_all_bad_values) call show_all_bad ( temp )
write(err_msg_tmp,'(a47,i7)') 'saturation vapor pressure table overflow, nbad=', nbad
- if(fms_error_handler('lookup_des',err_msg_tmp,err_msg)) return
+ if(fms_error_handler('lookup_des_3d',err_msg_tmp,err_msg)) return
endif
end subroutine lookup_des_3d
@@ -1327,7 +1327,7 @@
else
if(show_all_bad_values) call show_all_bad ( temp )
write(err_msg_local,'(a47,i7)') 'saturation vapor pressure table overflow, nbad=', nbad
- if(fms_error_handler('lookup_es',err_msg_local,err_msg)) return
+ if(fms_error_handler('lookup_es_des_0d',err_msg_local,err_msg)) return
endif
end subroutine lookup_es_des_0d
@@ -1359,7 +1359,7 @@
if(show_bad_value_count_by_slice) call temp_check ( temp )
if(show_all_bad_values) call show_all_bad ( temp )
write(err_msg_local,'(a47,i7)') 'saturation vapor pressure table overflow, nbad=', nbad
- if(fms_error_handler('lookup_es',err_msg_local,err_msg)) return
+ if(fms_error_handler('lookup_es_des_1d',err_msg_local,err_msg)) return
endif
end subroutine lookup_es_des_1d
@@ -1391,7 +1391,7 @@
if(show_bad_value_count_by_slice) call temp_check ( temp )
if(show_all_bad_values) call show_all_bad ( temp )
write(err_msg_local,'(a47,i7)') 'saturation vapor pressure table overflow, nbad=', nbad
- if(fms_error_handler('lookup_es',err_msg_local,err_msg)) return
+ if(fms_error_handler('lookup_es_des_2d',err_msg_local,err_msg)) return
endif
end subroutine lookup_es_des_2d
@@ -1423,7 +1423,7 @@
if(show_bad_value_count_by_slice) call temp_check ( temp )
if(show_all_bad_values) call show_all_bad ( temp )
write(err_msg_local,'(a47,i7)') 'saturation vapor pressure table overflow, nbad=', nbad
- if(fms_error_handler('lookup_es',err_msg_local,err_msg)) return
+ if(fms_error_handler('lookup_es_des_3d',err_msg_local,err_msg)) return
endif
end subroutine lookup_es_des_3d
@@ -2239,7 +2239,7 @@
if ( err_msg_local == '' ) then
if(present(err_msg)) err_msg = ''
else
- if(fms_error_handler('lookup_es',err_msg_local,err_msg)) return
+ if(fms_error_handler('sat_vapor_pres_init',err_msg_local,err_msg)) return
endif
module_is_initialized = .true.
@@ -2411,7 +2411,7 @@
do i=1,size(temp)
ind = int(dtinv*(temp(i)-tmin+teps))
if (ind < 0 .or. ind > nlim) then
- write(unit,'(a,e10.3,a,i4,a,i6)') 'Bad temperature=',temp(i),' at i=',i,' pe=',mpp_pe()
+ write(unit,'(a,e10.3,a,i7,a,i6)') 'Bad temperature=',temp(i),' at i=',i,' pe=',mpp_pe()
endif
enddo
diff -ur --unidirectional-new-file -b -E -Z -x CM2.1p1 -x StripedPlanet -x atmos_bgrid -x atmos_ebm -x land_lad2 -x mom5 -x generic_tracers /p/tmp/petri/mom5-af3a94d4/src/tools/edit_landXocean/Makefile MonsoonPlanet/src/tools/edit_landXocean/Makefile
--- /p/tmp/petri/mom5-af3a94d4/src/tools/edit_landXocean/Makefile 2012-10-26 09:54:25.000000000 +0200
+++ MonsoonPlanet/src/tools/edit_landXocean/Makefile 2021-06-03 10:21:31.681784000 +0200
@@ -1,10 +1,10 @@
# The following three directory may need to set.
-NETCDFPATH = /usr/local/netcdf-3.6.2
+NETCDFPATH = /home/petri/netcdf-4.7.4-intel15
SHAREDIR = $(PWD)/../../shared/mosaic
COREDIR = $(PWD)
TOOLSHAREDIR = $(PWD)/../shared
-CFLAGS = -O2 -fast -I$(TOOLSHAREDIR) -I$(COREDIR) -I$(SHAREDIR) -I${NETCDFPATH}/include -I/usr/include
-LDFLAGS = -L${NETCDFPATH}/lib -lm -lnetcdf
+CFLAGS = -O2 -fast -I$(TOOLSHAREDIR) -I$(COREDIR) -I$(SHAREDIR) -I${NETCDFPATH}/include # -I/usr/include
+LDFLAGS = -L${NETCDFPATH}/lib -lm -lnetcdf -lnetcdf -L/home/petri/hdf5-1.10.6-intel15/lib -lhdf5_hl -lhdf5 -lz -L${UDUNITSROOT}/lib -ludunits2
DEFFLAG = -Duse_netCDF
LNFLAGS = -v
CC = icc
diff -ur --unidirectional-new-file -b -E -Z -x CM2.1p1 -x StripedPlanet -x atmos_bgrid -x atmos_ebm -x land_lad2 -x mom5 -x generic_tracers /p/tmp/petri/mom5-af3a94d4/src/tools/fregrid/Makefile MonsoonPlanet/src/tools/fregrid/Makefile
--- /p/tmp/petri/mom5-af3a94d4/src/tools/fregrid/Makefile 1970-01-01 01:00:00.000000000 +0100
+++ MonsoonPlanet/src/tools/fregrid/Makefile 2021-06-03 10:21:31.867066000 +0200
@@ -0,0 +1,64 @@
+# The following three directory may need to set.
+NETCDFPATH = /home/petri/netcdf-4.7.4-intel15
+SHAREDIR = $(PWD)/../../shared/mosaic
+COREDIR = $(PWD)
+TOOLSHAREDIR = $(PWD)/../shared
+#CFLAGS = -O3 -g -traceback -I$(TOOLSHAREDIR) -I$(COREDIR) -I$(SHAREDIR) -I${NETCDFPATH}/include
+#CFLAGS_O2 = -O2 -g -traceback -I$(TOOLSHAREDIR) -I$(COREDIR) -I$(SHAREDIR) -I${NETCDFPATH}/include
+CFLAGS = -g -O2 -DMAXXGRID=6e21 -traceback -Wall -Wremarks -I$(TOOLSHAREDIR) -I$(COREDIR) -I$(SHAREDIR) -I${NETCDFPATH}/include
+CFLAGS_O2 = -g -O2 -DMAXXGRID=6e21 -traceback -Wall -Wremarks -I$(TOOLSHAREDIR) -I$(COREDIR) -I$(SHAREDIR) -I${NETCDFPATH}/include
+#LDFLAGS = -L${NETCDFPATH}/lib/shared -lm -lnetcdf -lhdf5_hl -lhdf5 -lmpi -lz
+LDFLAGS = -L${NETCDFPATH}/lib -lm -lnetcdf -lnetcdf -L/home/petri/hdf5-1.10.6-intel15/lib -lhdf5_hl -lhdf5 -lz -L${UDUNITSROOT}/lib -ludunits2
+DEFFLAG = -Duse_netCDF
+LNFLAGS = -v
+CC = icc
+
+OBJS = mosaic_util.o gradient_c2l.o create_xgrid.o interp.o read_mosaic.o mpp.o mpp_domain.o mpp_io.o tool_util.o \
+ conserve_interp.o bilinear_interp.o fregrid_util.o fregrid.o
+
+HEADERS = Makefile $(TOOLSHAREDIR)/mpp.h $(TOOLSHAREDIR)/mpp_domain.h \
+ $(TOOLSHAREDIR)/mpp_io.h $(SHAREDIR)/mosaic_util.h \
+ $(SHAREDIR)/interp.h $(SHAREDIR)/create_xgrid.h
+fregrid: $(OBJS)
+ $(CC) $(LNFLAGS) -o $@ $(OBJS) $(LDFLAGS)
+
+fregrid.o: $(COREDIR)/fregrid.c $(HEADERS)
+ $(CC) $(CFLAGS) -c $(COREDIR)/fregrid.c
+
+fregrid_util.o: $(COREDIR)/fregrid_util.c $(HEADERS)
+ $(CC) $(CFLAGS) -c $(COREDIR)/fregrid_util.c
+
+conserve_interp.o: $(COREDIR)/conserve_interp.c $(HEADERS)
+ $(CC) $(CFLAGS) -c $(COREDIR)/conserve_interp.c
+
+bilinear_interp.o: $(COREDIR)/bilinear_interp.c $(HEADERS)
+ $(CC) $(CFLAGS) -c $(COREDIR)/bilinear_interp.c
+
+mosaic_util.o: $(SHAREDIR)/mosaic_util.c $(HEADERS)
+ $(CC) $(CFLAGS) -c $(SHAREDIR)/mosaic_util.c
+
+gradient_c2l.o: $(SHAREDIR)/gradient_c2l.c $(HEADERS)
+ $(CC) $(CFLAGS) -c $(SHAREDIR)/gradient_c2l.c
+
+create_xgrid.o: $(SHAREDIR)/create_xgrid.c $(HEADERS)
+ $(CC) $(CFLAGS_O2) -c $(SHAREDIR)/create_xgrid.c
+
+interp.o: $(SHAREDIR)/interp.c $(HEADERS)
+ $(CC) $(CFLAGS) -c $(SHAREDIR)/interp.c
+
+read_mosaic.o: $(SHAREDIR)/read_mosaic.c $(HEADERS)
+ $(CC) $(DEFFLAG) $(CFLAGS) -c $(SHAREDIR)/read_mosaic.c
+
+mpp.o: $(TOOLSHAREDIR)/mpp.c $(HEADERS)
+ $(CC) $(CFLAGS) -c $(TOOLSHAREDIR)/mpp.c
+
+mpp_domain.o: $(TOOLSHAREDIR)/mpp_domain.c $(HEADERS)
+ $(CC) $(CFLAGS) -c $(TOOLSHAREDIR)/mpp_domain.c
+
+mpp_io.o: $(TOOLSHAREDIR)/mpp_io.c $(HEADERS)
+ $(CC) $(CFLAGS) -c $(TOOLSHAREDIR)/mpp_io.c
+
+tool_util.o: $(TOOLSHAREDIR)/tool_util.c $(HEADERS)
+ $(CC) $(CFLAGS) -c $(TOOLSHAREDIR)/tool_util.c
+
+
diff -ur --unidirectional-new-file -b -E -Z -x CM2.1p1 -x StripedPlanet -x atmos_bgrid -x atmos_ebm -x land_lad2 -x mom5 -x generic_tracers /p/tmp/petri/mom5-af3a94d4/src/tools/fregrid/fregrid.c MonsoonPlanet/src/tools/fregrid/fregrid.c
--- /p/tmp/petri/mom5-af3a94d4/src/tools/fregrid/fregrid.c 2014-03-18 14:03:57.000000000 +0100
+++ MonsoonPlanet/src/tools/fregrid/fregrid.c 2021-03-31 13:53:48.833500774 +0200
@@ -785,7 +785,7 @@
for(l=0; lvar[l].has_taxis && m>0) continue;
level_t = m + scalar_in->var[l].lstart;
- /*--- to reduce memory usage, we are only do remapping for on horizontal level one time */
+ /*--- to reduce memory usage, we are only do remapping for one horizontal level one time */
for(level_n =0; level_n < scalar_in->var[l].nn; level_n++) {
if(extrapolate) {
get_input_data(ntiles_in, scalar_in, grid_in, bound_T, l, -1, level_n, level_t, extrapolate, stop_crit);
@@ -834,12 +834,13 @@
/* then interp vector field */
for(l=0; l0) continue;
+ if( !u_in->var[l].has_taxis && m>0) continue;
+ for(level_z=u_in->var[l].kstart; level_z <= u_in->var[l].kend; level_z++) {
level_t = m + u_in->var[l].lstart;
get_input_data(ntiles_in, u_in, grid_in, bound_T, l, level_z, level_n, level_t, extrapolate, stop_crit);
get_input_data(ntiles_in, v_in, grid_in, bound_T, l, level_z, level_n, level_t, extrapolate, stop_crit);
- allocate_field_data(ntiles_out, u_out, grid_out, u_in[n].var[l].nz);
- allocate_field_data(ntiles_out, v_out, grid_out, u_in[n].var[l].nz);
+ allocate_field_data(ntiles_out, u_out, grid_out, u_in->var[l].nz);
+ allocate_field_data(ntiles_out, v_out, grid_out, v_in->var[l].nz);
if( opcode & BILINEAR )
do_vector_bilinear_interp(interp, l, ntiles_in, grid_in, ntiles_out, grid_out, u_in, v_in, u_out, v_out, finer_step, fill_missing);
else
@@ -857,6 +858,7 @@
}
}
}
+ }
if(mpp_pe() == mpp_root_pe() ) {
printf("Successfully running fregrid and the following output file are generated.\n");
diff -ur --unidirectional-new-file -b -E -Z -x CM2.1p1 -x StripedPlanet -x atmos_bgrid -x atmos_ebm -x land_lad2 -x mom5 -x generic_tracers /p/tmp/petri/mom5-af3a94d4/src/tools/make_coupler_mosaic/Makefile MonsoonPlanet/src/tools/make_coupler_mosaic/Makefile
--- /p/tmp/petri/mom5-af3a94d4/src/tools/make_coupler_mosaic/Makefile 1970-01-01 01:00:00.000000000 +0100
+++ MonsoonPlanet/src/tools/make_coupler_mosaic/Makefile 2021-06-03 10:21:32.319815000 +0200
@@ -0,0 +1,49 @@
+# The following three directory may need to set.
+NETCDFPATH = /home/petri/netcdf-4.7.4-intel15
+SHAREDIR = $(PWD)/../../shared/mosaic
+COREDIR = $(PWD)
+TOOLSHAREDIR = $(PWD)/../shared
+CFLAGS = -O2 -g -I$(TOOLSHAREDIR) -I$(COREDIR) -I$(SHAREDIR) -I${NETCDFPATH}/include # -I/usr/include
+LDFLAGS = -L${NETCDFPATH}/lib -lm -lnetcdf -lnetcdf -L/home/petri/hdf5-1.10.6-intel15/lib -lhdf5_hl -lhdf5 -lz -L${UDUNITSROOT}/lib -ludunits2
+DEFFLAG = -Dfix_truncate
+LNFLAGS = -v
+CC = icc
+
+OBJS = make_coupler_mosaic.o create_xgrid.o gradient_c2l.o interp.o read_mosaic.o mpp_domain.o mpp_io.o tool_util.o \
+ mosaic_util.o mpp.o
+
+HEADERS = Makefile $(TOOLSHAREDIR)/mpp.h $(TOOLSHAREDIR)/mpp_domain.h \
+ $(TOOLSHAREDIR)/mpp_io.h $(SHAREDIR)/mosaic_util.h \
+ $(SHAREDIR)/create_xgrid.h
+make_coupler_mosaic: $(OBJS)
+ $(CC) $(LNFLAGS) -o $@ $(OBJS) $(LDFLAGS)
+
+make_coupler_mosaic.o: $(COREDIR)/make_coupler_mosaic.c $(HEADERS)
+ $(CC) $(CFLAGS) -c $(COREDIR)/make_coupler_mosaic.c
+
+mosaic_util.o: $(SHAREDIR)/mosaic_util.c $(HEADERS)
+ $(CC) $(DEFFLAG) $(CFLAGS) -c $(SHAREDIR)/mosaic_util.c
+
+create_xgrid.o: $(SHAREDIR)/create_xgrid.c $(HEADERS)
+ $(CC) $(CFLAGS) -c $(SHAREDIR)/create_xgrid.c
+
+mpp.o: $(TOOLSHAREDIR)/mpp.c $(HEADERS)
+ $(CC) $(CFLAGS) -c $(TOOLSHAREDIR)/mpp.c
+
+mpp_domain.o: $(TOOLSHAREDIR)/mpp_domain.c $(HEADERS)
+ $(CC) $(CFLAGS) -c $(TOOLSHAREDIR)/mpp_domain.c
+
+mpp_io.o: $(TOOLSHAREDIR)/mpp_io.c $(HEADERS)
+ $(CC) $(CFLAGS) -c $(TOOLSHAREDIR)/mpp_io.c
+
+gradient_c2l.o: $(SHAREDIR)/gradient_c2l.c $(HEADERS)
+ $(CC) $(CFLAGS) -c $(SHAREDIR)/gradient_c2l.c $<
+
+interp.o: $(SHAREDIR)/interp.c $(HEADERS)
+ $(CC) $(CFLAGS) -c $(SHAREDIR)/interp.c
+
+tool_util.o: $(TOOLSHAREDIR)/tool_util.c $(HEADERS)
+ $(CC) $(CFLAGS) -c $(TOOLSHAREDIR)/tool_util.c
+
+read_mosaic.o: $(SHAREDIR)/read_mosaic.c $(HEADERS)
+ $(CC) -Duse_netCDF $(CFLAGS) $(INCLUDES) -c $(SHAREDIR)/read_mosaic.c
diff -ur --unidirectional-new-file -b -E -Z -x CM2.1p1 -x StripedPlanet -x atmos_bgrid -x atmos_ebm -x land_lad2 -x mom5 -x generic_tracers /p/tmp/petri/mom5-af3a94d4/src/tools/make_coupler_mosaic/make_coupler_mosaic.c MonsoonPlanet/src/tools/make_coupler_mosaic/make_coupler_mosaic.c
--- /p/tmp/petri/mom5-af3a94d4/src/tools/make_coupler_mosaic/make_coupler_mosaic.c 2014-03-18 14:03:57.000000000 +0100
+++ MonsoonPlanet/src/tools/make_coupler_mosaic/make_coupler_mosaic.c 2021-06-03 10:21:32.317236551 +0200
@@ -219,7 +219,7 @@
}
-void get_global_area(int nx, int ny, const double *x, const double *y, double *area)
+void get_grid_global_area(int nx, int ny, const double *x, const double *y, double *area)
{
double *x_local, *y_local, *area_local;
int nxc, nyc, isc, iec, jsc, jec;
@@ -571,7 +571,7 @@
else {
for(n=0; n