Browse Source

Applied first adaption for earth-system model

Obtained by Hagen Radtke as zip archive on May 4th 2021.
distribute-radiation-on-surface-types
Sven Karsten 2 years ago
parent
commit
65ac97619e
  1. 10
      .gitignore
  2. 0
      bin/environs.IOW_ESM_DEBUG
  3. 0
      bin/environs.IOW_ESM_PRODUCTION
  4. 0
      bin/environs.ifc_debug
  5. 2
      bin/mkmf
  6. 11
      bin/mkmf.template.IOW_ESM_DEBUG
  7. 11
      bin/mkmf.template.IOW_ESM_PRODUCTION
  8. 21
      bin/mkmf.template.ifc
  9. 18
      bin/mkmf.template.ifc.bup
  10. 11
      bin/mkmf.template.ifc_debug
  11. 34
      build.sh
  12. 34
      build_debug.sh
  13. 34
      build_debug_fast.sh
  14. 34
      build_fast.sh
  15. 2
      exp/FMS_compile.csh
  16. 22
      exp/MOM_compile.csh
  17. 2
      exp/atmos_null_compile.csh
  18. 4
      exp/ice_compile.csh
  19. 2
      exp/land_null_compile.csh
  20. 5
      exp/mom5_ebm_compile.csh
  21. 2
      exp/nout.000000
  22. 18
      exp/oasis_compile.csh
  23. 2
      exp/ocean_compile.csh
  24. 112
      src/.vscode/tasks.json
  25. 79
      src/coupler/coupler_main.F90
  26. 1757
      src/coupler/coupler_main.F90_ori
  27. 67
      src/coupler/flux_exchange.F90
  28. 56
      src/coupler/oas_define.F90~
  29. 20
      src/coupler/surface_flux.F90
  30. 63
      src/ice_sis/ice_model.F90
  31. 5
      src/mom5/ocean_core/ocean_types.F90
  32. 9
      src/mom5/ocean_wave/ocean_wave.F90
  33. 294
      src/oasis_interface/oas_define.F90
  34. 63
      src/oasis_interface/oas_exchange_fields.F90
  35. 18
      src/oasis_interface/oas_finalize.F90
  36. 30
      src/oasis_interface/oas_init.F90
  37. 76
      src/oasis_interface/oas_receive.F90
  38. 163
      src/oasis_interface/oas_receive_field.F90
  39. 37
      src/oasis_interface/oas_send.F90
  40. 90
      src/oasis_interface/oas_send_field.F90
  41. 93
      src/oasis_interface/oas_vardef.F90
  42. 19
      src/ocean_shared/generic_tracers/generic_ERGOM.F90
  43. 88
      src/path_names_shared
  44. BIN
      src/postprocessing/mppnccombine/mppnccombine
  45. 1484
      src/postprocessing/mppnccombine/mppnccombine.c.chunking.c
  46. 228
      src/shared/exchange/oas_define.F90
  47. 18
      src/shared/exchange/oas_finalize.F90
  48. 40
      src/shared/exchange/oas_init.F90
  49. 1054
      src/shared/exchange/oas_receive_field.F90
  50. 936
      src/shared/exchange/oas_send_field.F90
  51. 89
      src/shared/exchange/oas_vardef.F90
  52. 4
      src/shared/fms/fms.F90
  53. 1
      src/shared/sat_vapor_pres/sat_vapor_pres.F90
  54. 2
      src/shared/sat_vapor_pres/sat_vapor_pres_k.F90

10
.gitignore vendored

@ -0,0 +1,10 @@
data/
doc/
exec/
test/
annex.py
generic_ERGOM.F90.2.00a
LICENSE
README
README.md
T

0
bin/environs.IOW_ESM_DEBUG

0
bin/environs.IOW_ESM_PRODUCTION

0
bin/environs.ifc_debug

2
bin/mkmf

@ -469,4 +469,4 @@ if( $suffix eq '.a' ) {
close MAKEFILE;
print " $mkfile is ready.\n";
exec 'make', '-f', $mkfile if $opt_x;
exec 'make', '-j', '8', '-f', $mkfile if $opt_x;

11
bin/mkmf.template.IOW_ESM_DEBUG

@ -0,0 +1,11 @@
# template for the Intel fortran compiler version 8
# typical use with mkmf
# mkmf -t template.ifc -c"-Duse_libMPI -Duse_netCDF" path_names /usr/local/include
# -traceback
FFLAGS = ${IOW_ESM_FFLAGS}
CPPFLAGS = ${IOW_ESM_CFLAGS}
FC = ${IOW_ESM_FC}
LD = ${IOW_ESM_LD}
LDFLAGS = ${IOW_ESM_LDFLAGS}
CC = ${IOW_ESM_CC}

11
bin/mkmf.template.IOW_ESM_PRODUCTION

@ -0,0 +1,11 @@
# template for the Intel fortran compiler version 8
# typical use with mkmf
# mkmf -t template.ifc -c"-Duse_libMPI -Duse_netCDF" path_names /usr/local/include
# -traceback
FFLAGS = ${IOW_ESM_FFLAGS}
CPPFLAGS = ${IOW_ESM_CFLAGS}
FC = ${IOW_ESM_FC}
LD = ${IOW_ESM_LD}
LDFLAGS = ${IOW_ESM_LDFLAGS}
CC = ${IOW_ESM_CC}

21
bin/mkmf.template.ifc

@ -1,18 +1,11 @@
# template for the Intel fortran compiler version 8
# typical use with mkmf
# mkmf -t template.ifc -c"-Duse_libMPI -Duse_netCDF" path_names /usr/local/include
# pkg-config --cflags-only-I ompi-fort
CPPFLAGS = -I/usr/include -I${NETCDF_INC} -I/sw/comp/openmpi/OS_13.2/2.0.1/ifort-2017.1.132/include -I/sw/comp/openmpi/OS_13.2/2.0.1/ifort-2017.1.132/lib64
FFLAGS = -O2 -traceback -ip -xHost -align all -IPF-fp-relaxed -assume byterecl -r8
# debug
#FFLAGS = -O1 -traceback -ip -xHost -align all -IPF-fp-relaxed -assume byterecl -r8
# repro
#FFLAGS = -fno-alias -automatic -safe-cray-ptr -ftz -assume byterecl -i4 -r8 -nowarn -O2 -debug minimal -fp-model precise -override-limits
FC = ifort
LD = ifort
CC = icc
# pkg-config --libs-only-L ompi-fort
# pkg-config --libs-only-l ompi-fort
LDFLAGS = -Wl,-rpath,${NETCDF_LIB},-rpath,/sw/data/hdf5/OS_13.2/1.8.18/intel_2017.1.132_threadsafe/lib64,-rpath,/sw/comp/openmpi/OS_13.2/2.0.1/ifort-2017.1.132/lib64,-rpath,/opt/torque/lib64 -L${NETCDF_LIB} -L/sw/data/hdf5/OS_13.2/1.8.18/intel_2017.1.132_threadsafe/lib64 -L/sw/comp/openmpi/OS_13.2/2.0.1/ifort-2017.1.132/lib64 -L/opt/torque/lib64 -lnetcdff -lnetcdf -lmpi_usempif08 -lmpi_usempi_ignore_tkr -lmpi_mpifh -lmpi
CFLAGS = -D__IFC
# -traceback
FFLAGS = -O3 -xAVX -r8 -fp-model precise -align array32byte
CPPFLAGS =
FC = ftn
LD = ftn
LDFLAGS =
CC = cc

18
bin/mkmf.template.ifc.bup

@ -0,0 +1,18 @@
# template for the Intel fortran compiler version 8
# typical use with mkmf
# mkmf -t template.ifc -c"-Duse_libMPI -Duse_netCDF" path_names /usr/local/include
# pkg-config --cflags-only-I ompi-fort
CPPFLAGS = -I/usr/include -I${NETCDF_INC} -I/sw/comp/openmpi/OS_13.2/2.0.1/ifort-2017.1.132/include -I/sw/comp/openmpi/OS_13.2/2.0.1/ifort-2017.1.132/lib64
FFLAGS = -O2 -ip -xHost -align all -IPF-fp-relaxed -assume byterecl -r8
# debug
#FFLAGS = -O1 -traceback -ip -xHost -align all -IPF-fp-relaxed -assume byterecl -r8
# repro
#FFLAGS = -fno-alias -automatic -safe-cray-ptr -ftz -assume byterecl -i4 -r8 -nowarn -O2 -debug minimal -fp-model precise -override-limits
FC = ifort
LD = ifort
CC = icc
# pkg-config --libs-only-L ompi-fort
# pkg-config --libs-only-l ompi-fort
LDFLAGS = -Wl,-rpath,${NETCDF_LIB},-rpath,/sw/data/hdf5/OS_13.2/1.8.18/intel_2017.1.132_threadsafe/lib64,-rpath,/sw/comp/openmpi/OS_13.2/2.0.1/ifort-2017.1.132/lib64,-rpath,/opt/torque/lib64 -L${NETCDF_LIB} -L/sw/data/hdf5/OS_13.2/1.8.18/intel_2017.1.132_threadsafe/lib64 -L/sw/comp/openmpi/OS_13.2/2.0.1/ifort-2017.1.132/lib64 -L/opt/torque/lib64 -lnetcdff -lnetcdf -lmpi_usempif08 -lmpi_usempi_ignore_tkr -lmpi_mpifh -lmpi
CFLAGS = -D__IFC

11
bin/mkmf.template.ifc_debug

@ -0,0 +1,11 @@
# template for the Intel fortran compiler version 8
# typical use with mkmf
# mkmf -t template.ifc -c"-Duse_libMPI -Duse_netCDF" path_names /usr/local/include
# -traceback
FFLAGS = -O3 -xCORE-AVX512 -r8 -fp-model precise -align array64byte -g -traceback -I/sw/dataformats/netcdf/4.6.3/skl/intel.18/include/
CPPFLAGS = -O3 -xCORE-AVX512 -fp-model precise -g -traceback -I/sw/dataformats/netcdf/4.6.3/skl/intel.18/include/
FC = mpiifort
LD = mpiifort
LDFLAGS = -g -traceback -L/sw/dataformats/netcdf/4.6.3/skl/intel.18/lib -lnetcdf -lnetcdff
CC = mpiicc

34
build.sh

@ -0,0 +1,34 @@
#!/bin/bash
# LOAD REQUIRED MODULES
module load intel/19.1.0
module load openmpi/intel.19/3.1.6
module load netcdf/intel.19/4.7.4
# GET IOW ESM ROOT PATH
export IOW_ESM_ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )/../.."
# SET SYSTEM-SPECIFIC COMPILER OPTIONS AND PATHS
# compile mode: "PRODUCTION" or "DEBUG"
export IOW_ESM_COMPILE_MODE="PRODUCTION"
# include paths
export IOW_ESM_NETCDF_INCLUDE="${NETCDF_INCLUDE_PATH}"
export IOW_ESM_NETCDF_LIBRARY="${NETCDF_LIBRARY_PATH}"
# executables
export IOW_ESM_MAKE="/usr/bin/make"
export IOW_ESM_FC="mpifort"
export IOW_ESM_CC="mpicc"
export IOW_ESM_LD="mpifort"
# compiler flags
export IOW_ESM_CPPDEFS="-DCOUP_OAS -DOASIS_IOW_ESM"
export IOW_ESM_FFLAGS="-O3 -r8 -no-prec-div -fp-model fast=2 -xHost -I${IOW_ESM_NETCDF_INCLUDE}/"
export IOW_ESM_CFLAGS="-O3 -r8 -no-prec-div -fp-model fast=2 -xHost -I${IOW_ESM_NETCDF_INCLUDE}/"
export IOW_ESM_LDFLAGS="-L${IOW_ESM_NETCDF_LIBRARY} -lnetcdf -lnetcdff -Wl,-rpath,${IOW_ESM_NETCDF_LIBRARY}"
# MAKE CLEAN
rm -r ${IOW_ESM_ROOT}/components/MOM5/exec/IOW_ESM_${IOW_ESM_COMPILE_MODE}
# RUN BUILD COMMAND
cd ${IOW_ESM_ROOT}/components/MOM5/exp
./MOM_compile.csh
cd ${IOW_ESM_ROOT}/components/MOM5

34
build_debug.sh

@ -0,0 +1,34 @@
#!/bin/bash
# LOAD REQUIRED MODULES
module load intel/19.1.0
module load openmpi/intel.19/3.1.6
module load netcdf/intel.19/4.7.4
# GET IOW ESM ROOT PATH
export IOW_ESM_ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )/../.."
# SET SYSTEM-SPECIFIC COMPILER OPTIONS AND PATHS
# compile mode: "PRODUCTION" or "DEBUG"
export IOW_ESM_COMPILE_MODE="DEBUG"
# include paths
export IOW_ESM_NETCDF_INCLUDE="${NETCDF_INCLUDE_PATH}"
export IOW_ESM_NETCDF_LIBRARY="${NETCDF_LIBRARY_PATH}"
# executables
export IOW_ESM_MAKE="/usr/bin/make"
export IOW_ESM_FC="mpifort"
export IOW_ESM_CC="mpicc"
export IOW_ESM_LD="mpifort"
# compiler flags
export IOW_ESM_CPPDEFS="-DCOUP_OAS -DOASIS_IOW_ESM"
export IOW_ESM_FFLAGS="-O0 -r8 -g -traceback -check all -fp-model fast=2 -xHost -I${IOW_ESM_NETCDF_INCLUDE}/"
export IOW_ESM_CFLAGS="-O0 -r8 -g -traceback -check all -fp-model fast=2 -xHost -I${IOW_ESM_NETCDF_INCLUDE}/"
export IOW_ESM_LDFLAGS="-g -traceback -L${IOW_ESM_NETCDF_LIBRARY} -lnetcdf -lnetcdff -Wl,-rpath,${IOW_ESM_NETCDF_LIBRARY}"
# MAKE CLEAN
rm -r ${IOW_ESM_ROOT}/components/MOM5/exec/IOW_ESM_${IOW_ESM_COMPILE_MODE}
# RUN BUILD COMMAND
cd ${IOW_ESM_ROOT}/components/MOM5/exp
./MOM_compile.csh
cd ${IOW_ESM_ROOT}/components/MOM5

34
build_debug_fast.sh

@ -0,0 +1,34 @@
#!/bin/bash
# LOAD REQUIRED MODULES
module load intel/19.1.0
module load openmpi/intel.19/3.1.6
module load netcdf/intel.19/4.7.4
# GET IOW ESM ROOT PATH
export IOW_ESM_ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )/../.."
# SET SYSTEM-SPECIFIC COMPILER OPTIONS AND PATHS
# compile mode: "PRODUCTION" or "DEBUG"
export IOW_ESM_COMPILE_MODE="DEBUG"
# include paths
export IOW_ESM_NETCDF_INCLUDE="${NETCDF_INCLUDE_PATH}"
export IOW_ESM_NETCDF_LIBRARY="${NETCDF_LIBRARY_PATH}"
# executables
export IOW_ESM_MAKE="/usr/bin/make"
export IOW_ESM_FC="mpifort"
export IOW_ESM_CC="mpicc"
export IOW_ESM_LD="mpifort"
# compiler flags
export IOW_ESM_CPPDEFS="-DCOUP_OAS -DOASIS_IOW_ESM"
export IOW_ESM_FFLAGS="-O0 -r8 -g -traceback -check all -fp-model fast=2 -xHost -I${IOW_ESM_NETCDF_INCLUDE}/"
export IOW_ESM_CFLAGS="-O0 -r8 -g -traceback -check all -fp-model fast=2 -xHost -I${IOW_ESM_NETCDF_INCLUDE}/"
export IOW_ESM_LDFLAGS="-g -traceback -L${IOW_ESM_NETCDF_LIBRARY} -lnetcdf -lnetcdff -Wl,-rpath,${IOW_ESM_NETCDF_LIBRARY}"
# MAKE CLEAN
#rm -r ${IOW_ESM_ROOT}/components/MOM5/exec/IOW_ESM_${IOW_ESM_COMPILE_MODE}
# RUN BUILD COMMAND
cd ${IOW_ESM_ROOT}/components/MOM5/exp
./MOM_compile.csh
cd ${IOW_ESM_ROOT}/components/MOM5

34
build_fast.sh

@ -0,0 +1,34 @@
#!/bin/bash
# LOAD REQUIRED MODULES
module load intel/18.0.6
module load impi/2018.5
module load netcdf/intel/4.7.3
# GET IOW ESM ROOT PATH
export IOW_ESM_ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )/../.."
# SET SYSTEM-SPECIFIC COMPILER OPTIONS AND PATHS
# compile mode: "PRODUCTION" or "DEBUG"
export IOW_ESM_COMPILE_MODE="PRODUCTION"
# include paths
export IOW_ESM_NETCDF_INCLUDE="/sw/dataformats/netcdf/intel.18/4.7.3/skl/include"
export IOW_ESM_NETCDF_LIBRARY="/sw/dataformats/netcdf/intel.18/4.7.3/skl/lib"
# executables
export IOW_ESM_MAKE="/usr/bin/make"
export IOW_ESM_FC="mpiifort"
export IOW_ESM_CC="mpiicc"
export IOW_ESM_LD="mpiifort"
# compiler flags
export IOW_ESM_CPPDEFS="-DCOUP_OAS -DOASIS_IOW_ESM"
export IOW_ESM_FFLAGS="-O3 -xCORE-AVX512 -r8 -fp-model precise -align array64byte -I${IOW_ESM_NETCDF_INCLUDE}/"
export IOW_ESM_CFLAGS="-O3 -I${IOW_ESM_NETCDF_INCLUDE}/"
export IOW_ESM_LDFLAGS="-g -traceback -L${IOW_ESM_NETCDF_LIBRARY} -lnetcdf -lnetcdff -Wl,-rpath,${IOW_ESM_NETCDF_LIBRARY}"
# MAKE CLEAN
#rm -r ${IOW_ESM_ROOT}/components/MOM5/exec/IOW_ESM_${IOW_ESM_COMPILE_MODE}
# RUN BUILD COMMAND
cd ${IOW_ESM_ROOT}/components/MOM5/exp
./MOM_compile.csh
cd ${IOW_ESM_ROOT}/components/MOM5

2
exp/FMS_compile.csh

@ -100,7 +100,7 @@ set lib_name = "lib_FMS"
mkdir -p $executable:h:h/$lib_name
cd $executable:h:h/$lib_name
$mkmf_lib -p $lib_name.a -c "$cppDefs" $srcList $pathnames_shared $lib_include_dirs
make
${IOW_ESM_MAKE}
if( $status ) then
echo "Make failed to create $lib_name.a"

22
exp/MOM_compile.csh

@ -6,11 +6,13 @@
#module load mpt/1.26
set echo
set platform = ifc # A unique identifier for your platfo
set platform = IOW_ESM_${IOW_ESM_COMPILE_MODE} # A unique identifier for your platform
# This corresponds to the mkmf templates in $root/bin dir.
set type = MOM_SIS # Type of the experiment
set help = 0
set coupled = 1 # 1: in case of COSMO_clm coupled to MOM_SIS
set argv = (`getopt -u -o h -l type: -l platform: -l help -- $*`)
while ("$argv[1]" != "--")
switch ($argv[1])
@ -51,7 +53,7 @@ set executable = $root/exec/$platform/$type/fms_$type.x # executable cre
set mppnccombine = $root/bin/mppnccombine.$platform # path to executable mppnccombine
set mkmfTemplate = $root/bin/mkmf.template.$platform # path to template for your platform
set mkmf = $root/bin/mkmf # path to executable mkmf
set cppDefs = ( "-Duse_netCDF -Duse_netCDF4 -Duse_libMPI -DUSE_OCEAN_BGC -DENABLE_ODA -DSPMD -DLAND_BND_TRACERS" )
set cppDefs = ( "-Duse_netCDF -Duse_netCDF4 -Duse_libMPI -DUSE_OCEAN_BGC -DENABLE_ODA -DSPMD -DLAND_BND_TRACERS ${IOW_ESM_CPPDEFS}")
#On Altrix systems you may include "-Duse_shared_pointers -Duse_SGI_GSM" in cppDefs for perfomance.
#These are included in the GFDL configuration of the model.
@ -78,7 +80,7 @@ source $root/bin/environs.$platform # environment variables and loadable module
# 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"
set lib_include_dirs = "$root/include $code_dir/shared/include $code_dir/shared/mpp/include -I${IOW_ESM_ROOT}/components/OASIS3-MCT/oasis3-mct/IOW_ESM_${IOW_ESM_COMPILE_MODE}/lib"
source ./FMS_compile.csh
if ( $status ) exit $status
@ -100,6 +102,12 @@ if( $type == MOM_SIS) then
cd $root/exp
source ./atmos_null_compile.csh
if ( $status ) exit $status
if ($coupled == 1) then
cd $root/exp
source ./oasis_compile.csh
if ( $status ) exit $status
endif
endif
if( $type == EBM) then
cd $root/exp
@ -142,8 +150,8 @@ if( $type == MOM_solo ) then
set libs = "$executable:h:h/lib_ocean/lib_ocean.a $executable:h:h/lib_FMS/lib_FMS.a"
else if( $type == MOM_SIS ) then
set srcList = ( coupler )
set includes = "-I$executable:h:h/lib_FMS -I$executable:h:h/lib_ocean -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 $executable:h:h/lib_FMS/lib_FMS.a"
set includes = "-I$executable:h:h/lib_FMS -I$executable:h:h/lib_ocean -I$executable:h:h/lib_ice -I${IOW_ESM_ROOT}/components/OASIS3-MCT/oasis3-mct/IOW_ESM_${IOW_ESM_COMPILE_MODE}/build/lib/mct -I${IOW_ESM_ROOT}/components/OASIS3-MCT/oasis3-mct/IOW_ESM_${IOW_ESM_COMPILE_MODE}/build/lib/psmile.MPI1 -I${IOW_ESM_ROOT}/components/OASIS3-MCT/oasis3-mct/IOW_ESM_${IOW_ESM_COMPILE_MODE}/build/lib/scrip -I${IOW_ESM_ROOT}/components/OASIS3-MCT/oasis3-mct/IOW_ESM_${IOW_ESM_COMPILE_MODE}/build/lib/mctdir -I${IOW_ESM_ROOT}/components/OASIS3-MCT/oasis3-mct/IOW_ESM_${IOW_ESM_COMPILE_MODE}/lib -I$executable:h:h/lib_oasis -I$executable:h:h/lib_atmos_null -I$executable:h:h/lib_land_null"
set libs = "$executable:h:h/lib_oasis/lib_oasis.a $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 ${IOW_ESM_ROOT}/components/OASIS3-MCT/oasis3-mct/IOW_ESM_${IOW_ESM_COMPILE_MODE}/lib/libpsmile.MPI1.a ${IOW_ESM_ROOT}/components/OASIS3-MCT/oasis3-mct/IOW_ESM_${IOW_ESM_COMPILE_MODE}/lib/libmct.a ${IOW_ESM_ROOT}/components/OASIS3-MCT/oasis3-mct/IOW_ESM_${IOW_ESM_COMPILE_MODE}/lib/libmpeu.a ${IOW_ESM_ROOT}/components/OASIS3-MCT/oasis3-mct/IOW_ESM_${IOW_ESM_COMPILE_MODE}/lib/libscrip.a $executable:h:h/lib_land_null/lib_land_null.a $executable:h:h/lib_FMS/lib_FMS.a"
else if( $type == EBM ) then
set srcList = ( coupler )
set includes = "-I$executable:h:h/lib_FMS -I$executable:h:h/lib_ocean -I$executable:h:h/lib_ice -I$executable:h:h/lib_atmos_ebm -I$executable:h:h/lib_land_lad"
@ -161,8 +169,8 @@ else if( $type == ICCM ) then
set includes = "-I$executable:h:h/lib_FMS -I$executable:h:h/lib_ocean -I$executable:h:h/lib_ice -I$executable:h:h/lib_atmos_bg -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_bg/lib_atmos_bg.a $executable:h:h/lib_atmos_phys/lib_atmos_phys.a $executable:h:h/lib_land_lad/lib_land_lad.a $executable:h:h/lib_FMS/lib_FMS.a"
endif
$mkmf_exec -o "$includes" -l "$libs" $srcList
make
$mkmf_exec -o "$includes" -l "$libs" -c "$cppDefs" $srcList
${IOW_ESM_MAKE}
if( $status ) then
echo "Make failed to create the $type executable"
exit 1

2
exp/atmos_null_compile.csh

@ -7,7 +7,7 @@ set lib_name = "lib_atmos_null"
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
${IOW_ESM_MAKE}
if( $status ) then
echo "Make failed to create $lib_name.a"

4
exp/ice_compile.csh

@ -7,8 +7,8 @@ set lib_name = "lib_ice"
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
$mkmf_lib -p $lib_name.a -c "$cppDefs" -o "-I$executable:h:h/lib_FMS" $srcList $lib_include_dirs
${IOW_ESM_MAKE}
if( $status ) then
echo "Make failed to create $lib_name.a"

2
exp/land_null_compile.csh

@ -7,7 +7,7 @@ set lib_name = "lib_land_null"
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
${IOW_ESM_MAKE}
if( $status ) then
echo "Make failed to create $lib_name.a"

5
exp/mom5_ebm_compile.csh

@ -15,8 +15,7 @@ set pathnames = $code_dir/path_names_$type # path to file containing
set mppnccombine = $root/bin/mppnccombine.$platform # path to executable mppnccombine
set mkmfTemplate = $root/bin/mkmf.template.$platform # path to template for your platform
set mkmf = $root/bin/mkmf # path to executable mkmf
set cppDefs = ( "-Duse_netCDF -Duse_netCDF3 -Duse_libMPI -DLAND_BND_TRACERS -DOVERLOAD_C8 -DOVERLOAD_C4 -DOVERLOAD_R4" )
set cppDefs = ( "-Duse_netCDF -Duse_netCDF3 -Duse_libMPI -DLAND_BND_TRACERS -DOVERLOAD_C8 -DOVERLOAD_C4 -DOVERLOAD_R4")
#
# Users must ensure the correct environment file exists for their platform.
#
@ -30,7 +29,7 @@ source $root/bin/environs.$platform # environment variables and loadable module
#NOTE: On some platforms you may need to specify the location for netcdf.h and libnetcdf.a
# by modifying the following -I and -L
if ( ! -f $mppnccombine ) then
cc -O -o $mppnccombine -I/usr/local/include -L/usr/local/lib $code_dir/postprocessing/mppnccombine/mppnccombine.c -lnetcdf
cc -O -o $mppnccombine -I/usr/local/include -L/usr/local/lib $code_dir/postprocessing/mppnccombine/mppnccombine.c -lnetcdf
endif

2
exp/nout.000000

@ -0,0 +1,2 @@
(oasis_namcouple_init) ERROR opening namcouple file namcouple with unit number
1026

18
exp/oasis_compile.csh

@ -0,0 +1,18 @@
# Build the Ice library
# The list of source files that should be compiled for this component.
set srcList = ( oasis_interface )
set lib_name = "lib_oasis"
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 -I$executable:h:h/lib_ocean -I$executable:h:h/lib_ice -I${IOW_ESM_ROOT}/components/OASIS3-MCT/oasis3-mct/IOW_ESM_${IOW_ESM_COMPILE_MODE}/build/lib/mct -I${IOW_ESM_ROOT}/components/OASIS3-MCT/oasis3-mct/IOW_ESM_${IOW_ESM_COMPILE_MODE}/build/lib/psmile.MPI1 -I${IOW_ESM_ROOT}/components/OASIS3-MCT/oasis3-mct/IOW_ESM_${IOW_ESM_COMPILE_MODE}/build/lib/scrip -I${IOW_ESM_ROOT}/components/OASIS3-MCT/oasis3-mct/IOW_ESM_${IOW_ESM_COMPILE_MODE}/build/lib/mctdir" $srcList $lib_include_dirs
${IOW_ESM_MAKE}
if( $status ) then
echo "Make failed to create $lib_name"
exit 1
endif

2
exp/ocean_compile.csh

@ -6,7 +6,7 @@ set lib_name = "lib_ocean"
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
$mkmf_lib -p $lib_name.a -c "$cppDefs" -o "-I$executable:h:h/lib_FMS" $srcList $lib_include_dirs
make
if( $status ) then

112
src/.vscode/tasks.json vendored

@ -0,0 +1,112 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "build_MOM5_haumea",
"type": "shell",
"command": "cd /media/d/hagen/iow/climate/coupled_model/IOW_ESM/components/MOM5; rsync -r -i -u src haumea1:/data/hr275/IOW_ESM/components/MOM5/.; ssh -t haumea1 'cd /data/hr275/IOW_ESM/components/MOM5/; srun -t 01:00:00 -p compute -N1 --tasks-per-node 1 --pty bash -c \"source ~/.bash_profile; source build_fast.sh\"'",
"group": {
"kind": "build",
"isDefault": true
},
"presentation": {
"reveal": "always",
"panel": "new"
},
"problemMatcher": {
"owner": "ifort",
"fileLocation": [
"relative",
"${workspaceRoot}"
],
"pattern": {
"regexp": "^/data/hr275/IOW_ESM/components/MOM5/src/(.*?)\\((.*?)\\): (warning|error) (.*)",
"file": 1,
"line": 2,
"severity": 3,
"message": 4
}
}
},
{
"label": "build_MOM5",
"type": "shell",
"command": "cd /media/d/hagen/iow/climate/coupled_model/IOW_ESM/components/MOM5; rsync -r --update -i src mvkradtk@blogin:/scratch/usr/mvkradtk/IOW_ESM/components/MOM5/.; ssh -t mvkradtk@blogin 'cd /scratch/usr/mvkradtk/IOW_ESM/components/MOM5/; source build_fast.sh'",
"group": {
"kind": "build",
"isDefault": false
},
"presentation": {
"reveal": "always",
"panel": "new"
},
//"problemMatcher": "$msCompile"
"problemMatcher": {
"owner": "ifort",
"fileLocation": ["relative", "${workspaceRoot}"],
"pattern": {
"regexp": "^/scratch/usr/mvkradtk/IOW_ESM/components/MOM5/src/(.*?)\\((.*?)\\): (warning|error) (.*)",
"file": 1,
"line": 2,
"severity": 3,
"message": 4
}
}
},
{
"label": "build_MOM5_debug",
"type": "shell",
"command": "cd /media/d/hagen/iow/climate/coupled_model/IOW_ESM/components/MOM5; rsync -r --update -i src mvkradtk@blogin:/scratch/usr/mvkradtk/IOW_ESM/components/MOM5/.; ssh -t mvkradtk@blogin 'cd /scratch/usr/mvkradtk/IOW_ESM/components/MOM5/; source build_debug_fast.sh'",
"group": {
"kind": "build",
"isDefault": false
},
"presentation": {
"reveal": "always",
"panel": "new"
},
//"problemMatcher": "$msCompile"
"problemMatcher": {
"owner": "ifort",
"fileLocation": ["relative", "${workspaceRoot}"],
"pattern": {
"regexp": "^/scratch/usr/mvkradtk/IOW_ESM/components/MOM5/src/(.*?)\\((.*?)\\): (warning|error) (.*)",
"file": 1,
"line": 2,
"severity": 3,
"message": 4
}
}
},
{
"label": "build_flux_calculator_local",
"type": "shell",
"command": "cd /media/d/hagen/iow/climate/coupled_model/IOW_ESM/components/MOM5; source build_local.sh",
"group": {
"kind": "build",
"isDefault": false
},
"presentation": {
"reveal": "always",
"panel": "new"
},
"problemMatcher": "$msCompile"
},
{
"label": "run_IOW_ESM_haumea",
"type": "shell",
"command": "ssh -t haumea1 'cd /data/hr275/IOW_ESM/scripts/run; source ~/.bash_profile; sbatch jobscript'",
"group": {
"kind": "test",
"isDefault": true
},
"presentation": {
"reveal": "always",
"panel": "new"
},
"problemMatcher": []
}
]
}

79
src/coupler/coupler_main.F90

@ -126,6 +126,7 @@ program coupler_main
! </INFO>
use constants_mod, only: constants_init
use time_manager_mod, only: time_type, set_calendar_type, set_time
@ -224,8 +225,17 @@ program coupler_main
use memutils_mod, only: print_memuse_stats
#IFDEF OASIS_IOW_ESM
use oas_vardef, only: MOM5_instance_letter
#ENDIF
implicit none
#IFDEF COUP_OAS !sandra
integer :: mpi_comm_mom
#ENDIF
!-----------------------------------------------------------------------
character(len=128) :: version = '$Id: coupler_main.F90,v 20.0 2013/12/13 23:27:07 fms Exp $'
@ -361,6 +371,8 @@ program coupler_main
! </NOTE>
! </NAMELIST>
integer, dimension(6) :: restart_interval = (/ 0, 0, 0, 0, 0, 0/)
integer, dimension(6) :: current_date = (/ 0, 0, 0, 0, 0, 0 /)
character(len=17) :: calendar = ' '
@ -384,7 +396,11 @@ program coupler_main
do_land, do_ice, do_ocean, do_flux, atmos_npes, ocean_npes, &
ice_npes, land_npes, atmos_nthreads, ocean_nthreads, &
concurrent, use_lag_fluxes, do_chksum, &
#IFDEF OASIS_IOW_ESM
check_stocks, restart_interval, MOM5_instance_letter
#ELSE
check_stocks, restart_interval
#ENDIF
integer :: initClock, mainClock, termClock
@ -417,21 +433,37 @@ character(len=256), parameter :: note_header =
!#######################################################################
call mpp_init()
#IFDEF COUP_OAS ! sandra
call oas_init(mpi_comm_mom)
call mpp_init(localcomm=mpi_comm_mom)
#ELSE
call mpp_init()
#ENDIF
!these clocks are on the global pelist
initClock = mpp_clock_id( 'Initialization' )
call mpp_clock_begin(initClock)
call fms_init
call constants_init
call coupler_init
#IFDEF COUP_OAS ! sandra
call fms_init(mpi_comm_mom)
#ELSE
call fms_init()
#ENDIF
call coupler_init
if(do_chksum) call coupler_chksum('coupler_init+', 0)
call mpp_set_current_pelist()
call constants_init
call mpp_set_current_pelist()
#IFDEF COUP_OAS ! sandra
call oas_define(mpi_comm_mom)
! write(*,*) "finished oasis define"
#ENDIF
call mpp_clock_end (initClock) !end initialization
call mpp_clock_begin(mainClock) !begin main loop
!-----------------------------------------------------------------------
@ -557,6 +589,7 @@ newClock14 = mpp_clock_id( 'final flux_check_stocks' )
Time_atmos = Time_atmos + Time_step_atmos
if (do_atmos) then
call mpp_clock_begin(newClocka)
call atmos_tracer_driver_gather_data(Atm%fields, Atm%tr_bot)
@ -581,10 +614,12 @@ newClock14 = mpp_clock_id( 'final flux_check_stocks' )
if(do_chksum) call atmos_ice_land_chksum('update_atmos_down+', (nc-1)*num_atmos_calls+na)
call mpp_clock_begin(newClockd)
call flux_down_from_atmos( Time_atmos, Atm, Land, Ice, &
Land_ice_atmos_boundary, &
Atmos_land_boundary, &
Atmos_ice_boundary )
Atmos_ice_boundary, Ice_ocean_boundary,Time_start,Time_ocean,(na==1)) ! sandra for coupling
call mpp_clock_end(newClockd)
if(do_chksum) call atmos_ice_land_chksum('flux_down_from_atmos+', (nc-1)*num_atmos_calls+na)
@ -603,10 +638,12 @@ newClock14 = mpp_clock_id( 'final flux_check_stocks' )
! ---- ice model ----
call mpp_clock_begin(newClockf)
if (do_ice .AND. Ice%pe) then
if (do_ice .AND. Ice%pe) then
if(ice_npes .NE. atmos_npes)call mpp_set_current_pelist(Ice%pelist)
call update_ice_model_fast( Atmos_ice_boundary, Ice )
endif
if(ice_npes .NE. atmos_npes) call mpp_set_current_pelist(Atm%pelist)
call mpp_clock_end(newClockf)
if(do_chksum) call atmos_ice_land_chksum('update_ice_fast+', (nc-1)*num_atmos_calls+na)
@ -623,9 +660,13 @@ newClock14 = mpp_clock_id( 'final flux_check_stocks' )
call mpp_clock_begin(newClockh)
if (do_atmos) &
call update_atmos_model_up( Land_ice_atmos_boundary, Atm )
call mpp_clock_end(newClockh)
if(do_chksum) call atmos_ice_land_chksum('update_atmos_up+', (nc-1)*num_atmos_calls+na)
!#IFDEF COUP_OAS
! call oas_send_field(Ice) ! sandra
!#ENDIF
!--------------
enddo
@ -700,6 +741,9 @@ newClock14 = mpp_clock_id( 'final flux_check_stocks' )
! does not modify either Ocean or Ice_ocean_boundary
call flux_ocean_from_ice_stocks(Ocean_state, Ocean, Ice_ocean_boundary)
#IFDEF COUP_OAS
call oas_send_field(Ice,Time_start,Time_ocean) ! sandra
#ENDIF
Time_ocean = Time_ocean + Time_step_cpld
!-----------------------------------------------------------------------
@ -735,7 +779,6 @@ newClock14 = mpp_clock_id( 'final flux_check_stocks' )
call print_memuse_stats(text)
!rabcall mpp_clock_end(newClock13)
enddo
call mpp_set_current_pelist()
@ -757,13 +800,30 @@ call mpp_clock_end(newClock14)
call mpp_clock_end(mainClock)
call mpp_clock_begin(termClock)
!#IFDEF COUP_OAS ! sandra
! call oas_finalize ! needs to be called before fms_end()
!#ENDIF
if(do_chksum) call coupler_chksum('coupler_end-', nc)
call coupler_end
call mpp_clock_end(termClock)
call print_memuse_stats( 'Memory HiWaterMark', always=.TRUE. )
call fms_end
#IFDEF COUP_OAS ! sandra
call oas_finalize ! needs to be called after fms_end()
#ENDIF
IF (mpp_pe().EQ.mpp_root_pe()) THEN
open(unit=50, file='goodfile')
write(50,*)'go on'
close(50)
ENDIF
!-----------------------------------------------------------------------
@ -1312,6 +1372,7 @@ contains
endif
call print_memuse_stats( 'ice_model_init' )
call data_override_init(Ice_domain_in = Ice%domain)
end if
if( Ocean%is_ocean_pe )then
call mpp_set_current_pelist(Ocean%pelist)

1757
src/coupler/coupler_main.F90_ori

File diff suppressed because it is too large Load Diff

67
src/coupler/flux_exchange.F90

@ -820,6 +820,7 @@ subroutine flux_exchange_init ( Time, Atm, Land, Ice, Ocean, Ocean_state,&
call setup_xmap(xmap_sfc, (/ 'ATM', 'OCN', 'LND' /), &
(/ Atm%Domain, Ice%Domain, Land%Domain /), &
"INPUT/grid_spec.nc", Atm%grid)
! sandra test not done 18122018 write(*,*) "xgrid i ", xmap_sfc%x2(1)%i
! exchange grid indices
X1_GRID_ATM = 1; X1_GRID_ICE = 2; X1_GRID_LND = 3;
call generate_sfc_xgrid( Land, Ice )
@ -862,6 +863,9 @@ subroutine flux_exchange_init ( Time, Atm, Land, Ice, Ocean, Ocean_state,&
allocate( atmos_ice_boundary%u_star(is:ie,js:je,kd) )
allocate( atmos_ice_boundary%t_flux(is:ie,js:je,kd) )
allocate( atmos_ice_boundary%q_flux(is:ie,js:je,kd) )
#IFDEF COUP_OAS !sandra
allocate( atmos_ice_boundary%lh_flux(is:ie,js:je,kd) )
#ENDIF
allocate( atmos_ice_boundary%lw_flux(is:ie,js:je,kd) )
allocate( atmos_ice_boundary%sw_flux_vis_dir(is:ie,js:je,kd) )
allocate( atmos_ice_boundary%sw_flux_vis_dif(is:ie,js:je,kd) )
@ -880,6 +884,9 @@ subroutine flux_exchange_init ( Time, Atm, Land, Ice, Ocean, Ocean_state,&
atmos_ice_boundary%u_star=0.0
atmos_ice_boundary%t_flux=0.0
atmos_ice_boundary%q_flux=0.0
#IFDEF COUP_OAS !sandra
atmos_ice_boundary%lh_flux=0.0
#ENDIF
atmos_ice_boundary%lw_flux=0.0
atmos_ice_boundary%sw_flux_vis_dir=0.0
atmos_ice_boundary%sw_flux_vis_dif=0.0
@ -1037,6 +1044,10 @@ subroutine flux_exchange_init ( Time, Atm, Land, Ice, Ocean, Ocean_state,&
allocate( ice_ocean_boundary%calving_hflx (is:ie,js:je) ) ; ice_ocean_boundary%calving_hflx = 0.0
allocate( ice_ocean_boundary%p (is:ie,js:je) ) ; ice_ocean_boundary%p = 0.0
allocate( ice_ocean_boundary%mi (is:ie,js:je) ) ; ice_ocean_boundary%mi = 0.0
#IFDEF COUP_OAS !sandra
allocate( ice_ocean_boundary%u_wind (is:ie,js:je) ) ; ice_ocean_boundary%u_wind = 0.0
allocate( ice_ocean_boundary%v_wind (is:ie,js:je) ) ; ice_ocean_boundary%v_wind = 0.0
#ENDIF
!
! allocate fields for extra tracers
@ -2141,15 +2152,17 @@ end subroutine sfc_boundary_layer
! </INOUT>
!
subroutine flux_down_from_atmos (Time, Atm, Land, Ice, &
Atmos_boundary, Land_boundary, Ice_boundary )
Atmos_boundary, Land_boundary, Ice_boundary,ice_ocean_boundary,Time_start,Timet, couple_flux_calculator ) ! for coupling sandra
type(time_type), intent(in) :: Time
type(time_type), intent(in) :: Time,Time_start,Timet ! for coupling sandra
type(atmos_data_type), intent(inout) :: Atm
type(land_data_type), intent(in) :: Land
type(ice_data_type), intent(in) :: Ice
type(land_ice_atmos_boundary_type),intent(in) :: Atmos_boundary
type(atmos_land_boundary_type), intent(inout):: Land_boundary
type(atmos_ice_boundary_type), intent(inout):: Ice_boundary
type(ice_ocean_boundary_type), intent(inout):: ice_ocean_boundary ! for coupling sandra
logical, intent(in) :: couple_flux_calculator
real, dimension(n_xgrid_sfc) :: ex_flux_sw, ex_flux_lwd, &
ex_flux_sw_dir, &
@ -2311,9 +2324,7 @@ subroutine flux_down_from_atmos (Time, Atm, Land, Ice, &
deallocate ( ex_albedo_nir_dif_fix )
!----- compute net longwave flux (down-up) -----
! (note: lw up already in ex_flux_lw)
ex_flux_lw = ex_flux_lwd - ex_flux_lw
!-----------------------------------------------------------------------
!----- adjust fluxes for implicit dependence on atmosphere ----
@ -2473,7 +2484,6 @@ subroutine flux_down_from_atmos (Time, Atm, Land, Ice, &
!-----------------------------------------------------------------------
!---- output fields on the ice grid -------
call get_from_xgrid (Ice_boundary%t_flux, 'OCN', ex_flux_t, xmap_sfc)
call get_from_xgrid (Ice_boundary%q_flux, 'OCN', ex_flux_tr(:,isphum), xmap_sfc)
call get_from_xgrid (Ice_boundary%sw_flux_vis_dir, 'OCN', ex_flux_sw_vis_dir, xmap_sfc)
@ -2490,12 +2500,13 @@ subroutine flux_down_from_atmos (Time, Atm, Land, Ice, &
call get_from_xgrid (Ice_boundary%drdt, 'OCN', ex_drdt_surf, xmap_sfc)
call get_from_xgrid (Ice_boundary%u_flux, 'OCN', ex_flux_u, xmap_sfc)
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%p, 'OCN', ex_slp, xmap_sfc) ! mw mod
call get_from_xgrid (Ice_boundary%lprec, 'OCN', ex_lprec, xmap_sfc)
call get_from_xgrid (Ice_boundary%fprec, 'OCN', ex_fprec, 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)
!!$ if (do_area_weighted_flux) then
!!$ where (AREA_ATM_SPHERE /= 0)
!!$ Ice_boundary%lprec = Ice_boundary%lprec * AREA_ATM_MODEL/AREA_ATM_SPHERE
@ -2516,17 +2527,22 @@ subroutine flux_down_from_atmos (Time, Atm, Land, Ice, &
ex_gas_fluxes%bc(n)%field(m)%values, xmap_sfc)
enddo !} m
enddo !} n
#IFDEF OASIS_IOW_ESM
if (couple_flux_calculator) then
write(*,*) 'calling oas_exchange_fields'
call oas_exchange_fields(Ice,Ice_boundary,ice_ocean_boundary,Time_start,Timet)
endif
#ENDIF
#IFDEF COUP_OAS !sandra
! write(*,*) "start oasis receive in flux exchange"
write(*,*) 'really calling oas_receive_field'
call oas_receive_field(Ice,Ice_boundary,ice_ocean_boundary,Time_start,Timet)
#ELSE
!Balaji: data_override calls moved here from coupler_main
call data_override('ICE', 'u_flux', Ice_boundary%u_flux, Time)
call data_override('ICE', 'v_flux', Ice_boundary%v_flux, Time)
call data_override('ICE', 't_flux', Ice_boundary%t_flux, Time)
call data_override('ICE', 'q_flux', Ice_boundary%q_flux, Time)
call data_override('ICE', 'lw_flux',Ice_boundary%lw_flux, Time)
call data_override('ICE', 'lw_flux_dn',Ice_boundary%lw_flux, Time, override=ov)
if (ov) then
Ice_boundary%lw_flux = Ice_boundary%lw_flux - stefan*Ice%t_surf**4
endif
! if (ov) then
! Ice_boundary%lw_flux = Ice_boundary%lw_flux - stefan*Ice%t_surf**4
! endif
call data_override('ICE', 'sw_flux_nir_dir',Ice_boundary%sw_flux_nir_dir, Time)
call data_override('ICE', 'sw_flux_vis_dir',Ice_boundary%sw_flux_vis_dir, Time)
call data_override('ICE', 'sw_flux_nir_dif',Ice_boundary%sw_flux_nir_dif, Time, override=ov)
@ -2547,13 +2563,27 @@ subroutine flux_down_from_atmos (Time, Atm, Land, Ice, &
if (ov) then
Ice_boundary%sw_flux_nir_dif = Ice_boundary%sw_flux_nir_dif*(1-Ice%albedo_nir_dif)
endif
call data_override('ICE', 'lprec', Ice_boundary%lprec, Time)
call data_override('ICE', 'fprec', Ice_boundary%fprec, Time)
call data_override('ICE', 'lw_flux',Ice_boundary%lw_flux, Time)
call data_override('ICE', 'lw_flux_dn',Ice_boundary%lw_flux, Time, override=ov)
call data_override('ICE', 't_flux', Ice_boundary%t_flux, Time)
if (ov) then
Ice_boundary%lw_flux = Ice_boundary%lw_flux - stefan*Ice%t_surf**4
endif
call data_override('ICE', 'q_flux', Ice_boundary%q_flux, Time)
call data_override('ICE', 'p', Ice_boundary%p, Time)
call data_override('ICE', 'u_flux', Ice_boundary%u_flux, Time)
call data_override('ICE', 'v_flux', Ice_boundary%v_flux, Time)
#ENDIF
call data_override('ICE', 'dhdt', Ice_boundary%dhdt, Time)
call data_override('ICE', 'dedt', Ice_boundary%dedt, Time)
call data_override('ICE', 'drdt', Ice_boundary%drdt, Time)
call data_override('ICE', 'coszen', Ice_boundary%coszen, Time)
call data_override('ICE', 'p', Ice_boundary%p, Time)
do n = 1, Ice_boundary%fluxes%num_bcs !{
do m = 1, Ice_boundary%fluxes%bc(n)%num_fields !{
@ -3480,7 +3510,6 @@ subroutine flux_up_to_atmos ( Time, Land, Ice, Land_Ice_Atmos_Boundary, Land_bou
call get_from_xgrid (diag_atm, 'ATM', ex_flux_lw, xmap_sfc)
used = send_data ( id_r_flux, diag_atm, Time )
endif
!------- tracer fluxes ------------
! tr_mol_flux diagnostic will be correct for co2 tracer only.
! will need update code to use correct molar mass for tracers other than co2

56
src/coupler/oas_define.F90~

@ -0,0 +1,56 @@
#ifdef COUP_OAS
SUBROUTINE oas_cos_define
!
! grid definitions for OASIS
!
USE oas_vardef
USE mod_oasis_namcouple ! OASIS3-MCT namcouple variables: e.g. coupling time step
USE ice_grid_mod, ONLY : &
IMPLICIT NONE
INTEGER(KIND=iintegers) :: &
! igrid, & ! ids returned by oasis_def_grid
! iptid, & ! ids returned by oasis_set_points
! imskid, & ! ids returned by oasis_set_mask
! iextent(1,3), & !
! ioffset(1,3), & !
! ji, jj, jg, & !
! jg_end, jh_beg, & !
part_id, & !
il_paral(5), & ! OASIS3 box partition
! var_nodims(2), & !
! ishape(2,2), & ! shape of arrays passed to PSMILe
! nlei_tot, nlej_tot, & ! upper halo limits on a global subdomain
! jih_tot, jjh_tot, & ! global subdomain size without halo
ierror, & !
! lev_diff, & !
! izerrstat
REAL(KIND=8) :: &
! start_lonc, &
! start_latc
CHARACTER(LEN=4) :: &
grd_t = 'momt', & ! name of t grid of mom
grd_c = 'momc' ! name of c grid of mom
CHARACTER(len=30) :: &
data_gridname='grids.nc', & ! file with the grids
data_maskname='masks.nc' ! file with the masks
! Global grid parameters :
INTEGER :: nlon, nlat, ntot ! dimensions in the 2 directions of space + total size
INTEGER :: il_size
INTEGER :: nc ! number of corners in the (i,j) plan
CALL oasis_def_partition (part_id, il_paral, ierror)

20
src/coupler/surface_flux.F90

@ -476,7 +476,25 @@ subroutine surface_flux_1d ( &
call ncar_ocean_fluxes (w_atm, th_atm, t_surf0, q_atm, q_surf0, z_atm, &
seawater, cd_m, cd_t, cd_q, u_star, b_star )
end if
#IFDEF COUP_OAS !sandra
flux_t = 0.0
flux_q = 0.0
flux_r = 0.0
flux_u = 0.0
flux_v = 0.0
dhdt_surf = 0.0
dedt_surf = 0.0
dedq_surf = 0.0
drdt_surf = 0.0
dhdt_atm = 0.0
dedq_atm = 0.0
u_star = 0.0
b_star = 0.0
q_star = 0.0
q_surf = 0.0
w_atm = 0.0
#ELSE
where (avail)
! scale momentum drag coefficient on orographic roughness
cd_m = cd_m*(log(z_atm/rough_mom+1)/log(z_atm/rough_scale+1))**2
@ -540,7 +558,7 @@ subroutine surface_flux_1d ( &
q_surf = 0.0
w_atm = 0.0
endwhere
#ENDIF
! calculate d(stress component)/d(atmos wind component)
dtaudu_atm = 0.0
dtaudv_atm = 0.0

63
src/ice_sis/ice_model.F90

@ -140,6 +140,11 @@ module ice_model_mod
real, dimension(:,:,:), pointer :: data =>NULL()
integer :: xtype
type(coupler_3d_bc_type) :: fluxes ! array of fluxes used for additional tracers
#IFDEF COUP_OAS !sandra
real, dimension(:,:,:), pointer :: lh_flux =>NULL() ! for coupling latent heat
real, dimension(:,:), pointer :: u_wind =>NULL() ! for wave model
real, dimension(:,:), pointer :: v_wind =>NULL() ! for wave model
#ENDIF
end type
type :: land_ice_boundary_type
@ -194,6 +199,8 @@ contains
call mpp_clock_begin(iceClock)
call mpp_clock_begin(iceClock3)
#IFDEF COUP_OAS !sandra
call update_ice_model_fast_old (Ice, Atmos_boundary%fluxes, &
Atmos_boundary%u_flux, &
Atmos_boundary%v_flux, &
@ -205,6 +212,7 @@ contains
Atmos_boundary%lw_flux, &
Atmos_boundary%t_flux, &
Atmos_boundary%q_flux, &
Atmos_boundary%lh_flux, & !inserted for coupling latent heat
Atmos_boundary%dhdt, &
Atmos_boundary%dedt, &
Atmos_boundary%drdt, &
@ -212,6 +220,27 @@ contains
Atmos_boundary%fprec, &
Atmos_boundary%coszen, &
Atmos_boundary%p )
#ELSE
call update_ice_model_fast_old (Ice, Atmos_boundary%fluxes, &
Atmos_boundary%u_flux, &
Atmos_boundary%v_flux, &
Atmos_boundary%u_star, &
Atmos_boundary%sw_flux_nir_dir, &
Atmos_boundary%sw_flux_nir_dif, &
Atmos_boundary%sw_flux_vis_dir, &
Atmos_boundary%sw_flux_vis_dif, &
Atmos_boundary%lw_flux, &
Atmos_boundary%t_flux, &
Atmos_boundary%q_flux, &
Atmos_boundary%dhdt, &
Atmos_boundary%dedt, &
Atmos_boundary%drdt, &
Atmos_boundary%lprec, &
Atmos_boundary%fprec, &
Atmos_boundary%coszen, &
Atmos_boundary%p )
#ENDIF
call mpp_clock_end(iceClock3)
call mpp_clock_end(iceClock)
@ -735,7 +764,7 @@ contains
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~!
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, flux_lhc, dhdt, dedt, drdt, lprec, fprec, coszen, p_surf )
type (ice_data_type), intent(inout) :: Ice
type(coupler_3d_bc_type), intent(inout) :: Atmos_boundary_fluxes
@ -744,6 +773,9 @@ contains
real, dimension(isc:iec,jsc:jec,km), intent(in) :: flux_lw ! net longwave radiation (+ down)
real, dimension(isc:iec,jsc:jec,km), intent(in) :: flux_t ! sensible heat flux (+ up)
real, dimension(isc:iec,jsc:jec,km), intent(in) :: flux_q ! specific humidity flux (+up)
#IFDEF COUP_OAS !sandra wird derzeit nicht verwendet
real, dimension(isc:iec,jsc:jec,km), optional, intent(in) :: flux_lhc ! latent heat flux (+up)
#ENDIF
real, dimension(isc:iec,jsc:jec,km), intent(in) :: flux_sw_nir_dir ! net near IR direct shortwave radiation (+ down)
real, dimension(isc:iec,jsc:jec,km), intent(in) :: flux_sw_nir_dif ! net near IR diffuse shortwave radiation (+ down)
real, dimension(isc:iec,jsc:jec,km), intent(in) :: flux_sw_vis_dir ! net visible direct shortwave radiation (+ down)
@ -780,7 +812,11 @@ contains
flux_v_new(i,j,k) = flux_v(i,j,k)
flux_t_new(i,j,k) = flux_t(i,j,k)
flux_q_new(i,j,k) = flux_q(i,j,k)
!#IFDEF COUP_OAS !sandra
! flux_lh_new(i,j,k) = flux_lhc(i,j,k)
!#ELSE
flux_lh_new(i,j,k) = hlv*flux_q(i,j,k)
!#ENDIF
flux_lw_new(i,j,k) = flux_lw(i,j,k)
flux_sw_nir_dir_new(i,j,k) = flux_sw_nir_dir(i,j,k)
flux_sw_nir_dif_new(i,j,k) = flux_sw_nir_dif(i,j,k)
@ -851,26 +887,26 @@ contains
do i=isc, iec
if (Ice%ice_mask(i,j,k)) then
if (Ice%h_snow(i,j,k)>0.0 .or. slab_ice) then
flux_lh_new(i,j,k) = flux_lh_new(i,j,k) + hlf*flux_q(i,j,k)
flux_lh_new(i,j,k) = flux_lh_new(i,j,k) + hlf*flux_q(i,j,k) ! add evaporating mass flux to longwave heat flux, but multiply it by specific freezing energy to convert it to a heat flux
latent = hlv+hlf
else
flux_lh_new(i,j,k) = flux_lh_new(i,j,k)+hlf*flux_q(i,j,k)*(1-TFI/Ice%t_ice1(i,j,k))
flux_lh_new(i,j,k) = flux_lh_new(i,j,k)+hlf*flux_q(i,j,k)*(1-TFI/Ice%t_ice1(i,j,k)) ! TFI is freezing temp (ยฐC), the latter is upper-layer ice temp (ยฐC), both negative. If ice is very cold, the factor TFI/Ice%t_ice1(i,j,k) becomes close to 1 and all evaporation is from solid ice. If ice temperature is close to freezing temp we assume that a part was already liquid and requires less energy to evaporate.
latent = hlv+hlf*(1-TFI/Ice%t_ice1(i,j,k))
end if
hfd = dhdt(i,j,k) + dedt(i,j,k)*latent + drdt(i,j,k)
hf = flux_t(i,j,k) + flux_q(i,j,k)*latent - flux_lw(i,j,k) &
hfd = dhdt(i,j,k) + dedt(i,j,k)*latent + drdt(i,j,k) ! how sensible heat, evaporation and radiation change when temperature changes
hf = flux_t(i,j,k) + flux_q(i,j,k)*latent - flux_lw(i,j,k) & !total upward heat flux which would occur at freezing temperature
- (1-Ice%pen(i,j,k))* (flux_sw_vis_dir(i,j,k)+flux_sw_vis_dif(i,j,k)+ &
flux_sw_nir_dir(i,j,k)+flux_sw_nir_dif(i,j,k)) &
- hfd*(Ice%t_surf(i,j,k)-Tfreeze)
- hfd*(Ice%t_surf(i,j,k)-Tfreeze) !(this is correction to freezing temperature)
call ice3lay_temp(Ice%h_snow(i,j,k), Ice%h_ice(i,j,k), Ice%t_ice1(i,j,k), &
Ice%t_ice2(i,j,k), ts_new, hf, hfd, Ice%pen(i,j,k)* &
(1-Ice%trn(i,j,k))*(flux_sw_vis_dir(i,j,k)+ &
flux_sw_vis_dif(i,j,k)+flux_sw_nir_dir(i,j,k)+ &
flux_sw_nir_dif(i,j,k)), -MU_TS*Ice%s_surf(i,j), &
Ice%bheat(i,j), dt_fast, Ice%tmelt(i,j,k), Ice%bmelt(i,j,k))
dts = ts_new-(Ice%t_surf(i,j,k)-Tfreeze)
dts = ts_new-(Ice%t_surf(i,j,k)-Tfreeze) ! surface temperature change during one time step
Ice%t_surf(i,j,k) = Ice%t_surf(i,j,k) + dts
flux_t_new(i,j,k) = flux_t_new(i,j,k) + dts * dhdt(i,j,k)
flux_t_new(i,j,k) = flux_t_new(i,j,k) + dts * dhdt(i,j,k) ! this changes fluxes
flux_q_new(i,j,k) = flux_q_new(i,j,k) + dts * dedt(i,j,k)
flux_lh_new(i,j,k) = flux_lh_new(i,j,k) + dts * dedt(i,j,k) * latent
flux_lw_new(i,j,k) = flux_lw_new(i,j,k) - dts * drdt(i,j,k)
@ -879,6 +915,8 @@ contains
end do
end do
call compute_ocean_roughness (Ice%mask, u_star(:,:,1), Ice%rough_mom(:,:,1), &
Ice%rough_heat(:,:,1), Ice%rough_moist(:,:,1) )
@ -914,10 +952,12 @@ contains
call sum_top_quantities ( Ice, Atmos_boundary_fluxes, flux_u_new, flux_v_new, flux_t_new, &
flux_q_new, flux_sw_nir_dir_new, flux_sw_nir_dif_new, flux_sw_vis_dir_new, &
flux_sw_vis_dif_new, flux_lw_new, lprec_new, fprec_new, flux_lh_new )
flux_sw_vis_dif_new, flux_lw_new, lprec_new, fprec_new, flux_lh_new ) ! fluxes are stored
Ice%Time = Ice%Time + Ice%Time_step_fast ! advance time
!write(*,*) "Ice%Time " , Ice%Time ! sandra
end subroutine update_ice_model_fast_old
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~!
@ -1812,6 +1852,11 @@ subroutine atm_ice_bnd_type_chksum(id, timestep, bnd_type)
write(outunit,100) 'atm_ice_bnd_type%u_star ',mpp_chksum(bnd_type%u_star)
write(outunit,100) 'atm_ice_bnd_type%t_flux ',mpp_chksum(bnd_type%t_flux)
write(outunit,100) 'atm_ice_bnd_type%q_flux ',mpp_chksum(bnd_type%q_flux)
#IFDEF COUP_OAS !sandra
write(outunit,100) 'atm_ice_bnd_type%lh_flux ',mpp_chksum(bnd_type%lh_flux)
write(outunit,100) 'atm_ice_bnd_type%u_wind ',mpp_chksum(bnd_type%u_wind)
write(outunit,100) 'atm_ice_bnd_type%v_wind ',mpp_chksum(bnd_type%v_wind)
#ENDIF
write(outunit,100) 'atm_ice_bnd_type%lw_flux ',mpp_chksum(bnd_type%lw_flux)
write(outunit,100) 'atm_ice_bnd_type%sw_flux_vis_dir ',mpp_chksum(bnd_type%sw_flux_vis_dir)
write(outunit,100) 'atm_ice_bnd_type%sw_flux_vis_dif ',mpp_chksum(bnd_type%sw_flux_vis_dif)

5
src/mom5/ocean_core/ocean_types.F90

@ -1215,7 +1215,10 @@ module ocean_types_mod
real, pointer, dimension(:,:) :: ustoke =>NULL() ! x-dir surface stokes drift
real, pointer, dimension(:,:) :: vstoke =>NULL() ! y-dir surface stokes drift
real, pointer, dimension(:,:) :: wavlen =>NULL() ! wave length
#IFDEF COUP_OAS !sandra
real, pointer, dimension(:,:) :: u_wind =>NULL() ! u_wind for wave_model
real, pointer, dimension(:,:) :: v_wind =>NULL() ! v_wind for wave model
#ENDIF
integer :: xtype ! REGRID, REDIST or DIRECT
type(coupler_2d_bc_type) :: fluxes ! array of fields used for additional tracers

9