diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..e627ed90f69b3b3d8559760944babc6051aa86fe --- /dev/null +++ b/.gitignore @@ -0,0 +1,10 @@ +# Ignore the object directories generated by the fcm compilation +/build/with_fcm/arch_* + +# Ignore the content of the fcm directory but not the directory itself +/build/with_fcm/fcm/** +!/build/with_fcm/fcm/.gitkeep + +# Ignore the content of the fiat directory but not the directory itself +/build/with_fcm/fiat/** +!/build/with_fcm/fiat/.gitkeep diff --git a/README.md b/README.md index 64e915c488be7b629729623749d406eefca8448c..9f6fbe130aa3a42aa471a8fcaaf1b1024b6b0c47 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,18 @@ # PHYEX PHYsique EXternalisée + +## Build + +The build systems can be found in the `build` directory. + +The PHYEX compilation depends on the fiat (https://github.com/ecmwf-ifs/fiat) package. + +### Build with FCM + +In the `with_fcm` subdirectory, a build system based on the FCM (https://github.com/metomi/fcm) tool is available. +The command `make_fcm.sh` (call it with the '-h' option to get help): + - clone the fcm tool + - clone the fiat package + - compile the PHYEX and (part of) the fiat package + - create a shared library (.so) +The resulting shared library (libphyex.so) is under the architecture specific directory created by the script. diff --git a/build/with_fcm/README.md b/build/with_fcm/README.md new file mode 100644 index 0000000000000000000000000000000000000000..bf27fb29e11acc416a184ecd60891c268c27f3e8 --- /dev/null +++ b/build/with_fcm/README.md @@ -0,0 +1,16 @@ +Directory organisation: +- the fcm subdirectory contains the fcm tool. In the PHYEX git repository, this directory is empty. + It will be populated on first call to the make\_fcm.sh script and content is not tracked by git. +- the fiat subdirectory contains the fiat package from the ECMWF. In the PHYEX git repository, this directory is empty. + It will be populated on first call to the make\_fcm.sh script and content is not tracked by git. +- the arch subdirectory contains architecture specific files. An alternative arch directory can be + provided on the command line when calling the make\_fcm.sh script +- arch\_\* subdirectories are automatically created by the make\_fcm.sh script and are tracked by git. +- the make\_fcm.sh script will: + - populate the fcm and fiat directories on first call + - create the arch\_$ARCH directory, poulate it with arch specific files and a compilation script + - execute the newly created compilation script + +Note: full cleaning is achieved by removing the arch\_\* subdirectories. +Note: documentation of the make\_fcm.sh script can be obtained with the -h option + diff --git a/build/with_fcm/arch/arch-X64_JEANZAY.env b/build/with_fcm/arch/arch-X64_JEANZAY.env new file mode 100644 index 0000000000000000000000000000000000000000..d62b4f56797f4c056d3fd6b3d10314397e214484 --- /dev/null +++ b/build/with_fcm/arch/arch-X64_JEANZAY.env @@ -0,0 +1,8 @@ +module purge +module load gcc/9.1.0 +module load intel-all +module load gcc/9.1.0 +module load hdf5/1.10.5-mpi +module load netcdf/4.7.2-mpi +module load netcdf-fortran/4.5.2-mpi +source $I_MPI_ROOT/intel64/bin/mpivars.sh release_mt diff --git a/build/with_fcm/arch/arch-X64_JEANZAY.fcm b/build/with_fcm/arch/arch-X64_JEANZAY.fcm new file mode 100644 index 0000000000000000000000000000000000000000..b7753a4f5063076db0dae88c5ab6d1b6210f5f4f --- /dev/null +++ b/build/with_fcm/arch/arch-X64_JEANZAY.fcm @@ -0,0 +1,33 @@ +# Compilation +$FCOMPILER = mpiifort +$BASE_FFLAGS = -fPIC -i4 -r8 -auto -align all -fp-model strict +$PROD_FFLAGS = -g -traceback -O3 -xHost -qopt-zmm-usage=high +$DEV_FFLAGS = -g -O1 -traceback +$DEBUG_FFLAGS = -g -traceback -check bounds +$CCOMPILER = +$BASE_CFLAGS = +$PROD_CFLAGS = +$DEV_CFLAGS = +$DEBUG_CFLAGS = +$OMP_FFLAGS = -qopenmp -qopenmp-threadprivate=compat + +# Preprocessor +$FPP_FLAGS = +$CPP_FLAGS = + +# Linker +$LINK = mpiifort +$BASE_LD = -fPIC -i4 -r8 -auto +$OMP_LD = +$LD_EXE_TO_SHARED = + +# Other +$AR = ar + +#Kept for latter use +#$FPP = mpiifort -E +#$MAKE = gmake +#$FPP_FLAGS = -P +#$FPP_DEF = KEY_NONE CPP_NETCDF4 +#$MPI_LD +#$MPI_FFLAGS diff --git a/build/with_fcm/arch/arch-gnu.env b/build/with_fcm/arch/arch-gnu.env new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/build/with_fcm/arch/arch-gnu.fcm b/build/with_fcm/arch/arch-gnu.fcm new file mode 100644 index 0000000000000000000000000000000000000000..92bfee6d9d09cbd0c5834bb76ebe0603465d6f5e --- /dev/null +++ b/build/with_fcm/arch/arch-gnu.fcm @@ -0,0 +1,33 @@ +# Compilation +$FCOMPILER = gfortran +$BASE_FFLAGS = -c -fPIC -fdefault-real-8 -fdefault-double-8 -ffree-line-length-none +$PROD_FFLAGS = -O3 +$DEV_FFLAGS = -O1 +$DEBUG_FFLAGS = -check bounds +$CCOMPILER = gcc +$BASE_CFLAGS = -c -fPIC +$PROD_CFLAGS = -O3 +$DEV_CFLAGS = -O1 +$DEBUG_CFLAGS = -check bounds +$OMP_FFLAGS = + +# Preprocessor +$FPP_FLAGS = LINUX +$CPP_FLAGS = LINUX + +# Linker +$LINK = gfortran +$BASE_LD = -fPIC -fdefault-real-8 -fdefault-double-8 +$OMP_LD = +$LD_EXE_TO_SHARED = -shared + +# Other +$AR = ar + +#Kept for latter use +#$FPP = gfortran -E +#$MAKE = gmake +#$FPP_FLAGS = -P +#$FPP_DEF = +#$MPI_LD +#$MPI_FFLAGS diff --git a/build/with_fcm/fcm-make.cfg b/build/with_fcm/fcm-make.cfg new file mode 100644 index 0000000000000000000000000000000000000000..c0a290bb48349f56c9cb8670a66fc8ff47dc4464 --- /dev/null +++ b/build/with_fcm/fcm-make.cfg @@ -0,0 +1,151 @@ +steps = build + +################################################################################################ +# 1 - INCLUDE FILES +include = arch.fcm +include = config.fcm + +################################################################################################ +# 2 - CONFIGURATION FOR COMPILERS +# Set Fortran compiler/linker +build.prop{fc} = $FCOMPILER +# Set Fortran compiler options +build.prop{fc.flags} = $BASE_FFLAGS $COMPIL_FFLAGS +#build.prop{fc.include-paths} = /usr/include +build.prop{fc.defs} = $FPP_FLAGS WITHOUT_CXXDEMANGLE +# Set C compiler/linker +build.prop{cc} = $CCOMPILER +# Set C compiler options +build.prop{cc.flags} = $BASE_CFLAGS $COMPIL_CFLAGS +#build.prop{cc.include-paths} = /usr/include +build.prop{cc.defs} = $CPP_FLAGS WITHOUT_CXXDEMANGLE +# Set linker +build.prop{ld} = $LINK +# Set archive command +build.prop{ar} = $AR + +################################################################################################ +# 3 - TARGET + +############################# +# 3.1 Target definition to build a static lib +#build.target = libphyex.a +#build.target-rename = libo.a:libphyex.a + +############################# +# 3.2 Target definition to build a static lib +#We need a shared library (.so) but this cannot be build directly with fcm +#The FCM support team says: "FCM doesn’t support building shared libraries." +#We use a dummy program to force fcm to use the linker and we add the needed flags +#to build a shared library instead of a program + +# 3.2.a target is the dummy program but linking is hacked and result is renamed +build.target = libphyex.so +build.target-rename = dummyprog.exe:libphyex.so +build.prop{fc.flags-ld} = $LD_FLAGS $LD_EXE_TO_SHARED + +# 3.2.b dependencies (internal and external) +$util = util1 util2 util3 util4 util5 util6 util7 util8 util9 util10 util11 util12 util13 util14 util15 util16 +$mpi = mpi2 mpi3 mpi4 mpi5 mpi6 mpi7 mpi8 mpi9 mpi10 mpi11 mpi12 mpi13 mpi14 mpi15 mpi16 mpi17 mpi18 mpi19 +$system = system1 system2 system3 system4 system5 system6 system7 system8 system10 system11 system12 system13 +build.prop{ns-dep.o} = common parkind drhook $util $mpi oml mpl gstats1 $system +build.prop{fc.libs} = $LIBS + +# 3.2.c shared lib entry points +build.prop{dep.o.special} = $ENTRYPOINTS + +################################################################################################ +# 4 - SOURCES + +############################# +# 4.1 Dummy programm to force linking +build.source[dummyprog] = src/dummyprog.F90 + +############################# +# 4.2 Main directory +build.source[common] = src/common/ + +############################# +# 4.3 Fiat directory +$FIAT = src/fiat +#It would be easier to put the entire fiat directory but there are issues +#with entry points declared twice: in C and in fortran; FCM does not like this +#The issue has been reported to the FCM support team but they have no solution. +#build.source[fiat] = $FIAT + +# parkind and drhook must be compiled in order to be able to use them in PHYEX. + +# In a first attempt, the mpl needed files were included one-by-one, then +# the one-by-one definition was replaced by a directory inclusion (beacause there was too much to include). +# In case it would be needed to go back to the one-by-one definition, the first needed files are the folowing ones: +# $FIAT/fiat/mpl/internal/mpl_mpif.F90 $FIAT/fiat/mpl/internal/mpl_data_module.F90 +# $FIAT/fiat/mpl/internal/mpl_myrank_mod.F90 $FIAT/fiat/mpl/internal/mpi4to8.F90 +# $FIAT/fiat/mpl/internal/mpi4to8_m.F90 $FIAT/fiat/mpl/internal/mpi4to8_s.F90 +# $FIAT/fiat/mpl/internal/mpl_message_mod.F90 $FIAT/fiat/mpl/internal/mpl_abort_mod.F90 +# $FIAT/fiat/mpl/mpl_module.F90 $FIAT/fiat/mpl/internal/mpl_waitany_mod.F90 +# $FIAT/fiat/mpl/internal/mpl_write_mod.F90 + +# 4.3.a Modules and include files needed to compile source codes +build.source[parkind] = $FIAT/parkind +build.source[drhook] = $FIAT/fiat/drhook +build.source[include1] = $FIAT/fiat/include/fiat +build.source[util1] = $FIAT/fiat/util/ec_parkind.F90 +build.source[util2] = $FIAT/fiat/util/ec_args_mod.F90 +build.source[util3] = $FIAT/fiat/util/ec_lun.F90 +build.source[mpi1] = $FIAT/mpi_serial/mpif.h +build.source[oml] = $FIAT/fiat/oml/oml_mod.F90 +build.source[gstats1] = $FIAT/fiat/gstats/yomgstats.F90 + +# 4.3.b Second order dependencies (sources needed for execution, and new module and include files) +build.source[util4] = $FIAT/fiat/util/abor1.F90 +# After preprocessing, abor1 does not depend anymore on fckit_module +# I did not succeed to enable the preprocessing step and, at the same time, +# setting util4 to be used in the ns-dep.o property +build.prop{no-dep.f.module}[util4] = fckit_module +build.source[util5] = $FIAT/fiat/util/abor1_c.c +build.source[system1] = $FIAT/fiat/system/internal/tabort.c +build.source[mpi2] = $FIAT/mpi_serial/mpi_comm_rank.F +build.source[mpi3] = $FIAT/mpi_serial/mpi_comm_size.F +build.source[mpi4] = $FIAT/mpi_serial/mpi_send.F +build.source[mpi5] = $FIAT/mpi_serial/mpi_recv.F +build.source[mpi6] = $FIAT/mpi_serial/mpi_initialized.F +build.source[mpi7] = $FIAT/mpi_serial/mpi_error_string.F +build.source[mpi8] = $FIAT/mpi_serial/mpi_barrier.F +build.source[mpi9] = $FIAT/mpi_serial/mpi_abort.F +build.source[util6] = $FIAT/fiat/util/loc_addr.c +build.source[system2] = $FIAT/fiat/system/getstk.c +build.source[system3] = $FIAT/fiat/system/getrss.c +build.source[system4] = $FIAT/fiat/system/getpag.c +build.source[system5] = $FIAT/fiat/system/gethwm.c +build.source[system6] = $FIAT/fiat/system/getcurheap.c +build.source[system7] = $FIAT/fiat/system/getstackusage.c +build.source[system8] = $FIAT/fiat/system/getmaxrss.c +build.source[util7] = $FIAT/fiat/util/internal/ecomp_version.c +build.source[util8] = $FIAT/fiat/util/internal/ecmpi_version.c +build.source[util9] = $FIAT/fiat/util/internal/get_openmp.F90 +build.source[util10] = $FIAT/fiat/util/ec_set_umask.c +build.source[util11] = $FIAT/fiat/util/ec_pmon.F90 +build.source[util12] = $FIAT/fiat/util/ec_args.c +build.source[util13] = $FIAT/fiat/util/ec_flush.F90 +build.source[system9] = $FIAT/fiat/system/getstatm.h +build.source[mpl] = $FIAT/fiat/mpl +build.source[util14] = $FIAT/fiat/util/ec_env_mod.F90 +build.source[mpi10] = $FIAT/mpi_serial/mpi_comm_create.F +build.source[mpi11] = $FIAT/mpi_serial/mpi_init_thread.F +build.source[mpi12] = $FIAT/mpi_serial/mpi_buffer_detach.F +build.source[mpi13] = $FIAT/mpi_serial/mpi_comm_group.F +build.source[mpi14] = $FIAT/mpi_serial/mpi_finalized.F +build.source[mpi15] = $FIAT/mpi_serial/mpi_init.F +build.source[mpi16] = $FIAT/mpi_serial/mpi_group_incl.F +build.source[mpi17] = $FIAT/mpi_serial/mpi_finalize.F +build.source[mpi18] = $FIAT/mpi_serial/mpi_buffer_attach.F +build.source[mpi19] = $FIAT/mpi_serial/mpi_bcast.F +build.source[system10] = $FIAT/fiat/system/ec_get_cycles.c +build.source[util15] = $FIAT/fiat/util/ec_meminfo.F90 +build.source[util16] = $FIAT/fiat/util/ec_env.c +build.source[system11] = $FIAT/fiat/system/internal/linuxtrbk.c +build.source[util17] = $FIAT/fiat/util/internal/raise.h +build.source[system12] = $FIAT/fiat/system/getstatm.c +build.source[system13] = $FIAT/fiat/system/internal/linux_bind.c + + diff --git a/build/with_fcm/fcm/.gitkeep b/build/with_fcm/fcm/.gitkeep new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/build/with_fcm/fiat/.gitkeep b/build/with_fcm/fiat/.gitkeep new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/build/with_fcm/make_fcm.sh b/build/with_fcm/make_fcm.sh new file mode 100755 index 0000000000000000000000000000000000000000..c7cc486b670a0062c9d4890915a4f6d2195becb5 --- /dev/null +++ b/build/with_fcm/make_fcm.sh @@ -0,0 +1,159 @@ +#!/bin/bash + +fcm_version=tags/2021.05.0 +fiat_version=1295120464c3905e5edcbb887e4921686653eab8 + +function parse_args() +{ + # default values + ARCH_PATH=$PWD/arch + ARCH=gnu + # pass unrecognized arguments to fcm + FCM_ARGS="" + + while (($# > 0)) + do + OPTION="$1" ; shift + case "$OPTION" in + "-h") cat <<EOF + Usage : +$0 [options] +--help -h help +--arch-path ARCH_PATH directory for architecture specific files (see below) [./arch] +--arch ARCH build using arch files $ARCH_PATH/arch-ARCH.* [gnu] + +Unrecognized options are passed to the fcm build command. Useful options include : +--new clean build tree before building +--jobs=N parallel build, similar to make -j N +--ignore-lock ignore lock indicating another build is ongoing, useful after an interrupted build + +For details on FCM, see + http://metomi.github.io/fcm/doc/user_guide/build.html + http://metomi.github.io/fcm/doc/user_guide/command_ref.html#fcm-build +EOF + exit;; + "--arch") + ARCH=$1 ; shift ;; + "--arch-path") + ARCH_PATH=$1 ; shift ;; + *) + FCM_ARGS="$FCM_ARGS $OPTION" + ;; + esac + done +} + +function check_install_fcm() +{ + if [ ! -f fcm/bin/fcm ]; then + echo "Performing FCM installation..." + cd fcm + rm -f .gitkeep + git clone https://github.com/metomi/fcm.git . + git checkout tags/$fcm_version + touch .gitkeep + cd .. + echo "...FCM installation done" + fi +} + +function check_install_fiat() +{ + if [ ! -d fiat/src ]; then + echo "Performing fiat cloning..." + cd fiat + rm -f .gitkeep + git clone https://github.com/ecmwf-ifs/fiat.git . + git checkout $fiat_version + touch .gitkeep + cd .. + echo "...fiat cloning done" + fi +echo +} + +function build_compilation_script() +{ +cat <<EOF > compilation.sh +#!/bin/bash + +. arch.env + +level=PROD #PROD DEV or DEBUG + +#fcm variables begin with a dollar sign + +COMPIL_FFLAGS="\\\$\${level}_FFLAGS" +COMPIL_FFLAGS="\$COMPIL_FFLAGS \\\$OMP_FFLAGS" + +COMPIL_CFLAGS="\\\$\${level}_CFLAGS" + +LD_FLAGS="\\\$BASE_LD" +LD_FLAGS="\$LD_FLAGS \$OMP_LD" + +LIBS="rt dl" + +ENTRYPOINTS="rain_ice.o shallow_mf.o turb.o ice_adjust.o ini_neb.o" + +FCM_ARGS="$FCM_ARGS" + +echo "\\\$COMPIL_FFLAGS = \$COMPIL_FFLAGS" > config.fcm +echo "\\\$COMPIL_CFLAGS = \$COMPIL_CFLAGS" >> config.fcm +echo "\\\$LD_FLAGS = \$LD_FLAGS" >> config.fcm +echo "\\\$ENTRYPOINTS = \$ENTRYPOINTS" >> config.fcm +echo "\\\$LIBS = \$LIBS" >> config.fcm + +export PATH=$PWD/../fcm/bin/:\$PATH + +echo "This script has generated config.fcm which is included by fcm-make.cfg, the FCM configuration file." +echo "Running : fcm make \$FCM_ARGS" + +fcm make \$FCM_ARGS +EOF +chmod +x compilation.sh +} + +#################################### + +# Parse command line arguments +parse_args $* + +# Change current working dir +cd -P $(dirname $0) + +# Check the fcm installation +check_install_fcm + +# Check the fiat installation +check_install_fiat + +# Create the build directory and populate it +builddir=arch_$ARCH +if [ -d $builddir ]; then + echo "$builddir already exists. To rerun compilation, please enter this directory and use the compilation.sh script." + echo "Otherwise, you can remove the $builddir directory and execute again this script." + exit 1 +fi +mkdir $builddir +cp ${ARCH_PATH}/arch-${ARCH}.env $builddir/arch.env +cp ${ARCH_PATH}/arch-${ARCH}.fcm $builddir/arch.fcm +cp fcm-make.cfg $builddir +cd $builddir +mkdir src +cd src +ln -s ../../../../src/common . +ln -s ../../fiat/src fiat +cat <<EOF > dummyprog.F90 +PROGRAM DUMMYPROG + PRINT*, "CREATED TO FORCE FCM TO LINK SOMETHING" +END PROGRAM DUMMYPROG +EOF +cd .. +build_compilation_script + +# Run the compilation +./compilation.sh +ln -s build/bin/libphyex.so . + +# Check if python can open the resulting shared lib +python3 -c "from ctypes import cdll; cdll.LoadLibrary('./libphyex.so')" diff --git a/docs/TODO b/docs/TODO index 3c75ded6b079d8541595e7be7a74e073224f446f..5e2a3d1124007df6720b9a18484dc62f56c88fef 100644 --- a/docs/TODO +++ b/docs/TODO @@ -32,8 +32,6 @@ Merge pb: - rain_ice_old a rebrancher dans Meso-NH - appels à condensation temporairement supprimés de src/mesonh/micro/radtr_satel.f90, src/mesonh/micro/ice_adjust_elec.f90 et src/mesonh/micro/lima_adjust_split.f90 - - rain_ice_red: le cas test MesoNH n'est pas bit repro (diffs > 1% sur rapports de melange) - sur la modif src/mesonh/rain_ice_red au commit bdd10dd (First rain_ice new/red merge) - shallow_mf (appels dans aro_shallow et arp_shallow): Dans Méso-NH: shallow_mf doit être appelé avec PDX=XDXHAT(1) et PDY=XDYHAT(1) Dans AROME/ARP: où trouver la taille de maille? @@ -80,3 +78,13 @@ Regarder s'il ne serait pas possible/souhaitable de supprimer modd_lunit de PHYE Nettoyage des répertoires aux nécessaire Initialiser dans AROME la variable ldiag_in_run de MODD_DIAG_IN_RUN pour pouvoir phaser le modd + +Faire une branche GPU qui contient les codes utilisés pour générer les fichiers pour Philippe. + +Ajouter un répertoire pour héberger un pseudo-modèle qui contiendrait les cas tests de Philippe. + +La taille du buffer utilisé pour th_r_from_thl_rt doit être mise en module et utilisée pour déclarer le module dans les routines appelantes et dans th_r_from_thl_rt + +rain_ice: + - séparer l'avance temporelle du découpage en sous-blocs en créant une couche driver supplémentaire. Cette couche pourrait avoir différentes implémentations (filtre LLMICRO seul, filtre LLMICRO + découpage en sous-blocs, filtre LLMICRO + découpage en sous-blocs en respectant les colonnes, en passant tous les points) + - mettre le code des interpolations linéaires et bi-linéaires dans des routines avec deux implémentations: avec et sans packing diff --git a/src/arome/aux/modi_tridiag_w.F90 b/src/arome/aux/modi_tridiag_w.F90 deleted file mode 100644 index f7926ae5d02134ced88fc284ac4149555ce874c4..0000000000000000000000000000000000000000 --- a/src/arome/aux/modi_tridiag_w.F90 +++ /dev/null @@ -1,3 +0,0 @@ -MODULE MODI_TRIDIAG_W -! Empty module for PHYEX, used in TURB 3D -END MODULE MODI_TRIDIAG_W diff --git a/src/arome/gmkpack_ignored_files b/src/arome/gmkpack_ignored_files index 65b11385d18b9e020361a35e5b74fb74b5b2e0a4..453d9746c1d2bd85f47eb1860727d81e5eeb4ca7 100644 --- a/src/arome/gmkpack_ignored_files +++ b/src/arome/gmkpack_ignored_files @@ -195,3 +195,6 @@ phyex/micro/mode_fmwritbidon.F90 phyex/turb/modd_dynn.F90 phyex/turb/mode_thermo_mono.F90 phyex/turb/modn_turb.F90 +mse/dummy/second_mnh.F90 +mse/dummy/les_mean_subgrid_surf.F90 +mse/dummy/les_mean_subgrid_3d.F90 diff --git a/src/arome/aux/get_halo.F90 b/src/common/aux/get_halo.F90 similarity index 100% rename from src/arome/aux/get_halo.F90 rename to src/common/aux/get_halo.F90 diff --git a/src/arome/aux/gradient_m.F90 b/src/common/aux/gradient_m.F90 similarity index 96% rename from src/arome/aux/gradient_m.F90 rename to src/common/aux/gradient_m.F90 index 1bd9756426595532b522bad83ab2cf96f73fa4c1..fab0852b50d08c6c5060e587497e7cbb2ba9a1da 100644 --- a/src/arome/aux/gradient_m.F90 +++ b/src/common/aux/gradient_m.F90 @@ -1,5 +1,9 @@ +!MNH_LIC Copyright 1994-2020 CNRS, Meteo-France and Universite Paul Sabatier +!MNH_LIC This is part of the Meso-NH software governed by the CeCILL-C licence +!MNH_LIC version 1. See LICENSE, CeCILL-C_V1-en.txt and CeCILL-C_V1-fr.txt +!MNH_LIC for details. version 1. ! ######spl - FUNCTION GX_M_M(PA,PDXX,PDZZ,PDZX, KKA, KKU, KL) RESULT(PGX_M_M) + FUNCTION GX_M_M(PA,PDXX,PDZZ,PDZX,KKA,KKU,KL) RESULT(PGX_M_M) USE PARKIND1, ONLY : JPRB USE YOMHOOK , ONLY : LHOOK, DR_HOOK ! ####################################################### @@ -53,13 +57,14 @@ !! ------------- !! Original 18/07/94 !! 19/07/00 add the LFLAT switch (J. Stein) +!! J.Escobar : 15/09/2015 : WENO5 & JPHEXT <> 1 !------------------------------------------------------------------------- ! !* 0. DECLARATIONS ! ! USE MODI_SHUMAN, ONLY: DXF, MZF, DZM, MXF, MXM -USE MODD_CONF +USE MODD_CONF, ONLY:LFLAT ! IMPLICIT NONE ! @@ -70,10 +75,9 @@ REAL, DIMENSION(:,:,:), INTENT(IN) :: PA ! variable at the mass point REAL, DIMENSION(:,:,:), INTENT(IN) :: PDXX ! metric coefficient dxx REAL, DIMENSION(:,:,:), INTENT(IN) :: PDZZ ! metric coefficient dzz REAL, DIMENSION(:,:,:), INTENT(IN) :: PDZX ! metric coefficient dzx -INTEGER, INTENT(IN),OPTIONAL :: KKA, KKU ! near ground and uppest atmosphere array indexes -INTEGER, INTENT(IN),OPTIONAL :: KL ! +1 if grid goes from ground to atmosphere top, -1 otherwise - ! +INTEGER, INTENT(IN),OPTIONAL :: KKA, KKU ! near ground and uppest atmosphere array indexes (AROME) +INTEGER, INTENT(IN),OPTIONAL :: KL ! +1 if grid goes from ground to atmosphere top, -1 otherwise (AROME) REAL, DIMENSION(SIZE(PA,1),SIZE(PA,2),SIZE(PA,3)) :: PGX_M_M ! result mass point ! ! @@ -100,7 +104,9 @@ END IF ! IF (LHOOK) CALL DR_HOOK('GX_M_M',1,ZHOOK_HANDLE) END FUNCTION GX_M_M -! ######spl +! +! +! ####################################################### FUNCTION GX_M_U(KKA, KKU, KL,PY,PDXX,PDZZ,PDZX) RESULT(PGX_M_U) USE PARKIND1, ONLY : JPRB USE YOMHOOK , ONLY : LHOOK, DR_HOOK @@ -165,7 +171,7 @@ END FUNCTION GX_M_M ! ------------ ! USE MODI_SHUMAN -USE MODD_CONF +USE MODD_CONF, ONLY:LFLAT USE MODD_PARAMETERS ! IMPLICIT NONE @@ -173,15 +179,14 @@ IMPLICIT NONE !* 0.1 Declarations of arguments and result ! ------------------------------------ ! +INTEGER, INTENT(IN) :: KKA, KKU ! near ground and uppest atmosphere array indexes +INTEGER, INTENT(IN) :: KL ! +1 if grid goes from ground to atmosphere top, -1 otherwise REAL, DIMENSION(:,:,:), INTENT(IN) :: PDXX ! d*xx REAL, DIMENSION(:,:,:), INTENT(IN) :: PDZX ! d*zx REAL, DIMENSION(:,:,:), INTENT(IN) :: PDZZ ! d*zz ! REAL, DIMENSION(:,:,:), INTENT(IN) :: PY ! variable at mass ! localization -INTEGER, INTENT(IN) :: KKA, KKU ! near ground and uppest atmosphere array indexes -INTEGER, INTENT(IN) :: KL ! +1 if grid goes from ground to atmosphere top, -1 otherwise - REAL, DIMENSION(SIZE(PY,1),SIZE(PY,2),SIZE(PY,3)) :: PGX_M_U ! result at flux ! side INTEGER IIU,IKU,JI,JK diff --git a/src/arome/aux/gradient_u.F90 b/src/common/aux/gradient_u.F90 similarity index 100% rename from src/arome/aux/gradient_u.F90 rename to src/common/aux/gradient_u.F90 diff --git a/src/arome/aux/gradient_v.F90 b/src/common/aux/gradient_v.F90 similarity index 100% rename from src/arome/aux/gradient_v.F90 rename to src/common/aux/gradient_v.F90 diff --git a/src/arome/aux/gradient_w.F90 b/src/common/aux/gradient_w.F90 similarity index 100% rename from src/arome/aux/gradient_w.F90 rename to src/common/aux/gradient_w.F90 diff --git a/src/arome/aux/ibm_mixinglength.f90 b/src/common/aux/ibm_mixinglength.F90 similarity index 100% rename from src/arome/aux/ibm_mixinglength.f90 rename to src/common/aux/ibm_mixinglength.F90 diff --git a/src/arome/aux/modd_argslist_ll.F90 b/src/common/aux/modd_argslist_ll.F90 similarity index 100% rename from src/arome/aux/modd_argslist_ll.F90 rename to src/common/aux/modd_argslist_ll.F90 diff --git a/src/common/aux/modd_budget.F90 b/src/common/aux/modd_budget.F90 new file mode 100644 index 0000000000000000000000000000000000000000..0abc3bc40e7a7c44154890338d98956e9a1a0344 --- /dev/null +++ b/src/common/aux/modd_budget.F90 @@ -0,0 +1,688 @@ +! ######spl + MODULE MODD_BUDGET +! ################## +! +!!**** *MODD_BUDGET* - declaration of budget variables +!! +!! PURPOSE +!! ------- +! The purpose of this declarative module is to specify the budget +! variables. +! +!! +!!** IMPLICIT ARGUMENTS +!! ------------------ +!! MODD_PARAMETERS: JPBUMAX, JPBUPROCMAX +!! +!! REFERENCE +!! --------- +!! Book2 of documentation of Meso-NH (module MODD_BUDGET) +!! +!! AUTHOR +!! ------ +!! P. Hereil *Meteo France* +!! +!! MODIFICATIONS +!! ------------- +!! Original 23/02/95 +!! J.-P. Lafore 10/02/98 adding of rhodj declaration for budget +!! V. Ducrocq 4/06/99 // +!! J.-P. Pinty 25/09/00 additional budget terms for C2R2 scheme +!! D. Gazen 22/01/01 add NCHEMSV +!! V. Masson 06/11/02 new flags for budget calls and time counters +!! V. Masson 27/11/02 add 2way nesting effect +!! P. Jabouille 07/07/04 add budget terms for microphysics +!! C. Barthe 19/11/09 add budget terms for electricity +!------------------------------------------------------------------------------- +! +!* 0. DECLARATIONS +! ------------ +USE MODD_PARAMETERS, ONLY :JPBUMAX, JPBUPROMAX +! +IMPLICIT NONE + +SAVE +! +INTEGER, PARAMETER:: NBUDGET_RHO = 0 ! Reference number for budget of RhoJ +INTEGER, PARAMETER:: NBUDGET_U = 1 ! Reference number for budget of RhoJu and/or LES budgets with u +INTEGER, PARAMETER:: NBUDGET_V = 2 ! Reference number for budget of RhoJv and/or LES budgets with u +INTEGER, PARAMETER:: NBUDGET_W = 3 ! Reference number for budget of RhoJw and/or LES budgets with u +INTEGER, PARAMETER:: NBUDGET_TH = 4 ! Reference number for budget of RhoJTh and/or LES budgets with th +INTEGER, PARAMETER:: NBUDGET_TKE = 5 ! Reference number for budget of RhoJTke and/or LES budgets with Tke +INTEGER, PARAMETER:: NBUDGET_RV = 6 ! Reference number for budget of RhoJrv and/or LES budgets with rv +INTEGER, PARAMETER:: NBUDGET_RC = 7 ! Reference number for budget of RhoJrc and/or LES budgets with rc +INTEGER, PARAMETER:: NBUDGET_RR = 8 ! Reference number for budget of RhoJrr and/or LES budgets with rr +INTEGER, PARAMETER:: NBUDGET_RI = 9 ! Reference number for budget of RhoJri and/or LES budgets with ri +INTEGER, PARAMETER:: NBUDGET_RS = 10 ! Reference number for budget of RhoJrs and/or LES budgets with rs +INTEGER, PARAMETER:: NBUDGET_RG = 11 ! Reference number for budget of RhoJrg and/or LES budgets with rg +INTEGER, PARAMETER:: NBUDGET_RH = 12 ! Reference number for budget of RhoJrh and/or LES budgets with rh +INTEGER, PARAMETER:: NBUDGET_SV1 = 13 ! Reference number for 1st budget of RhoJsv and/or LES budgets with sv +! +TYPE TBUDGETDATA + INTEGER :: NBUDGET +ENDTYPE +! +TYPE TBUDGETCONF_t + LOGICAL :: LBU_ENABLE=.FALSE. + LOGICAL :: LBUDGET_U=.FALSE. ! flag to compute budget of RhoJu and/or LES budgets with u + LOGICAL :: LBUDGET_V=.FALSE. ! flag to compute budget of RhoJv and/or LES budgets with u + LOGICAL :: LBUDGET_W=.FALSE. ! flag to compute budget of RhoJw and/or LES budgets with u + LOGICAL :: LBUDGET_TH=.FALSE. ! flag to compute budget of RhoJTh and/or LES budgets with th + LOGICAL :: LBUDGET_TKE=.FALSE.! flag to compute budget of RhoJTke and/or LES budgets with Tke + LOGICAL :: LBUDGET_RV=.FALSE. ! flag to compute budget of RhoJrv and/or LES budgets with rv + LOGICAL :: LBUDGET_RC=.FALSE. ! flag to compute budget of RhoJrc and/or LES budgets with rc + LOGICAL :: LBUDGET_RR=.FALSE. ! flag to compute budget of RhoJrr and/or LES budgets with rr + LOGICAL :: LBUDGET_RI=.FALSE. ! flag to compute budget of RhoJri and/or LES budgets with ri + LOGICAL :: LBUDGET_RS=.FALSE. ! flag to compute budget of RhoJrs and/or LES budgets with rs + LOGICAL :: LBUDGET_RG=.FALSE. ! flag to compute budget of RhoJrg and/or LES budgets with rg + LOGICAL :: LBUDGET_RH=.FALSE. ! flag to compute budget of RhoJrh and/or LES budgets with rh + LOGICAL :: LBUDGET_SV=.FALSE. ! flag to compute budget of RhoJsv and/or LES budgets with sv +END TYPE TBUDGETCONF_t +! +TYPE(TBUDGETCONF_t), TARGET :: TBUCONF +! +! General variables +LOGICAL :: LBU_ENABLE=.FALSE. +! +INTEGER, DIMENSION(JPBUMAX,JPBUPROMAX) & ! number of processes to be + :: NBUINC=0 ! avoided for every budget + ! between one active + ! source to the next one +INTEGER, DIMENSION(JPBUMAX) & ! counter for all the processes + :: NBUCTR_ACTV=0 ! activated or not +! +CHARACTER (LEN=4) :: CBUTYPE ! type of desired budget 'CART' + ! (cartesian box) or 'MASK' (budget + ! zone defined by a mask) or 'NONE' + ! (no budget) +INTEGER :: NBUMOD=0 ! model in which budget is + ! calculated +INTEGER, DIMENSION(:), & ! number of processes for each + ALLOCATABLE :: NBUPROCNBR ! budget +! +INTEGER, DIMENSION(:), & ! process counter linked to each + ALLOCATABLE :: NBUPROCCTR ! budget +! +CHARACTER(LEN=2), DIMENSION(:,:), & ! resulting string character of the + ALLOCATABLE :: CBUACTION ! transcription of the budget actions + ! (integer) read in namelists or + ! set by default +CHARACTER (LEN=16), DIMENSION(:,:),& ! names of records on the FM file + ALLOCATABLE :: CBURECORD ! for the budgets +! +CHARACTER (LEN=99), DIMENSION(:,:),& ! name of a process for a budget. It + ALLOCATABLE :: CBUCOMMENT ! will appear in the comment part of + ! the previous record +! +LOGICAL :: LBU_BEG=.FALSE. ! switch for budget beginning +! +REAL :: XBULEN=0. ! length in seconds of the budget + ! temporal average +! +INTEGER :: NBUSTEP=0 ! number of model timesteps required + ! for the budget time average +REAL :: XBUWRI=0. ! period in seconds of + ! budget writing on FM-files +INTEGER :: NBUWRNB=0 ! number of budget periods when storage + ! arrays are written on FM-files +INTEGER :: NBUTSHIFT=0 ! temporal shift for budgets writing +! +INTEGER :: NBUKH=0 ! lowest and highest K indice values +INTEGER :: NBUKL=0 ! lowest and highest K indice values + ! of the budget box +LOGICAL :: LBU_KCP=.FALSE. ! switch for compression in K + ! direction +! +! Variables used by the cartesian box case ('CART') only +! +INTEGER :: NBUIL=0 ! lowest and highest I indice values +INTEGER :: NBUIH=0 ! lowest and highest I indice values + ! of the cartesian box +INTEGER :: NBUJL=0 ! lowest and highest J indice values +INTEGER :: NBUJH=0 ! lowest and highest J indice values + ! of the cartesian box +LOGICAL :: LBU_ICP=.FALSE. ! switch for compression in I + ! direction +LOGICAL :: LBU_JCP=.FALSE. ! switch for comppression in J + ! direction +! +! Variables used by the mask case ('MASK') only +! +INTEGER :: NBUMASK=0 ! number of MASK zones for which + ! budgets are performed +LOGICAL, DIMENSION(:,:,:), & ! define the zone where the MASK + ALLOCATABLE :: LBU_MASK ! is True +! +REAL, DIMENSION(:,:,:,:), & ! surface for each mask at each + ALLOCATABLE :: XBUSURF ! budget step +! +INTEGER :: NBUTIME=0 ! number of budget time periods +! +! Variables for budget storage +! +! General variables +INTEGER :: NBUSIL=0 ! lowest and highest I indices of the intersection +INTEGER :: NBUSIH=0 ! lowest and highest I indices of the intersection + ! of the cartesian box with the sub-domain +INTEGER :: NBUSJL=0 ! lowest and highest J indices of the intersection +INTEGER :: NBUSJH=0 ! lowest and highest J indices of the intersection + ! of the global cartesian box +INTEGER :: NBUIMAX_ll=0 ! second dimension of the budget +INTEGER :: NBUJMAX_ll=0 ! second dimension of the budget + ! array in the global domain (in CART case) +! +INTEGER :: NBUIMAX=0 ! first dimension of the budget + ! tabular +INTEGER :: NBUJMAX=0 ! second dimension of the budget + ! tabular +INTEGER :: NBUKMAX=0 ! dimension along K of the budget + ! tabular +REAL, DIMENSION(:,:,:,:), & ! budget arrays for RU, RV and + ALLOCATABLE :: XBURU, XBURV, XBURW ! RW (wind components) respectively +REAL, DIMENSION(:,:,:,:), & ! budget arrays for RTH (potential + ALLOCATABLE :: XBURTH, XBURTKE ! temperature) and RTKE (kinetic + ! energy) +REAL, DIMENSION(:,:,:,:), & ! budget arrays for RRV (water vapor) + ALLOCATABLE :: XBURRV, XBURRC ! and RRC (cloud water) +REAL, DIMENSION(:,:,:,:), & ! budget arrays for RRR (rain water) + ALLOCATABLE :: XBURRR, XBURRI ! and RRI (ice) +REAL, DIMENSION(:,:,:,:), & ! budget arrays for RRS (snow) + ALLOCATABLE :: XBURRS, XBURRG ! and RRG (graupel) +REAL, DIMENSION(:,:,:,:), & ! budget array for RRH (hail) + ALLOCATABLE :: XBURRH ! +REAL, DIMENSION(:,:,:,:,:), & + ALLOCATABLE :: XBURSV ! Budget of the SVx +REAL, DIMENSION(:,:,:), & ! budget arrays for RHODJ at + ALLOCATABLE :: XBURHODJ , & ! scalar localization + XBURHODJU, & ! U localization + XBURHODJV, & ! V localization + XBURHODJW ! and W localization +! +! Allowed processes for the budget of the x scalar variables +! (transport part only) +! +! For each budget, the switches values (from 0 to JPBUPROMAX) for budgets +! activation may be set by the user in a namelist. Their default value is 0. +! In the following declaration, the corresponding process names are given +! beside as comments. +! +! Allowed processes for the budget of RU (wind component along x) +! +! Courant namelist: NAM_BURU +! +LOGICAL :: LBU_RU=.FALSE. ! True when the budget of RU is performed +! +INTEGER :: NASSEU=0 ! time filter +INTEGER :: NNESTU=0 ! Efffect of 2way nesting on U +INTEGER :: NADVXU=0 ! advection along X +INTEGER :: NADVYU=0 ! advection along Y +INTEGER :: NADVZU=0 ! advection along Z +INTEGER :: NFRCU=0 ! forcing +INTEGER :: NNUDU=0 ! nudging +INTEGER :: NCURVU=0 ! curvature +INTEGER :: NCORU=0 ! Coriolis terms +INTEGER :: NDIFU=0 ! numerical diffusion +INTEGER :: NRELU=0 ! relaxation +INTEGER :: NHTURBU=0 ! horizontal TURBulence +INTEGER :: NVTURBU=0 ! vertical turbulence +INTEGER :: NDRAGU=0 ! vegetation drag +INTEGER :: NMAFLU=0 ! mass flux +INTEGER :: NPRESU=0 ! pressure term +! +! Allowed processes for the budget of RV (wind component along y) +! +! Courant namelist: NAM_BURV +! +LOGICAL :: LBU_RV=.FALSE. ! True when the budget of RV is performed +! +INTEGER :: NASSEV=0 ! time filter +INTEGER :: NNESTV=0 ! Efffect of 2way nesting on V +INTEGER :: NADVXV=0 ! advection along X +INTEGER :: NADVYV=0 ! advection along Y +INTEGER :: NADVZV=0 ! advection along Z +INTEGER :: NFRCV=0 ! forcing +INTEGER :: NNUDV=0 ! nudging +INTEGER :: NCURVV=0 ! curvature +INTEGER :: NCORV=0 ! Coriolis terms +INTEGER :: NDIFV=0 ! numerical diffusion +INTEGER :: NRELV=0 ! relaxation +INTEGER :: NHTURBV=0 ! horizontal turbulence +INTEGER :: NVTURBV=0 ! vertical turbulence +INTEGER :: NDRAGV=0 ! vegetation drag +INTEGER :: NMAFLV=0 ! mass flux +INTEGER :: NPRESV=0 ! pressure term +! +! Allowed processes for the budget of RW (wind vertical component) +! +! Courant namelist: NAM_BURW +! +LOGICAL :: LBU_RW=.FALSE. ! True when the budget of RW is performed +! +INTEGER :: NASSEW=0 ! time filter +INTEGER :: NNESTW=0 ! Efffect of 2way nesting on W +INTEGER :: NADVXW=0 ! advection along X +INTEGER :: NADVYW=0 ! advection along Y +INTEGER :: NADVZW=0 ! advection along Z +INTEGER :: NFRCW=0 ! forcing +INTEGER :: NNUDW=0 ! nudging +INTEGER :: NCURVW=0 ! curvature +INTEGER :: NCORW=0 ! Coriolis terms +INTEGER :: NGRAVW=0 ! gravity term +INTEGER :: NDIFW=0 ! numerical diffusion +INTEGER :: NRELW=0 ! relaxation +INTEGER :: NHTURBW=0 ! horizontal turbulence +INTEGER :: NVTURBW=0 ! vertical turbulence +INTEGER :: NPRESW=0 ! pressure term +! +! Allowed processes for the budget of RTH (potential temperature) +! +! Courant namelist: NAM_BURTH +! +LOGICAL :: LBU_RTH=.FALSE. ! True when the budget of RTH is performed +! +INTEGER :: NASSETH=0 ! time filter +INTEGER :: NNESTTH=0 ! Efffect of 2way nesting on Th +INTEGER :: NADVTH=0 ! Total advection for PPM +INTEGER :: NADVXTH=0 ! advection along X (all except PPM) +INTEGER :: NADVYTH=0 ! advection along Y (all except PPM) +INTEGER :: NADVZTH=0 ! advection along Z (all except PPM) +INTEGER :: NFRCTH=0 ! forcing +INTEGER :: N2DADVTH=0 ! 2d advecting forcing +INTEGER :: N2DRELTH=0 ! 2d relaxation forcing +INTEGER :: NNUDTH=0 ! nudging +INTEGER :: NPREFTH=0 ! theta source term due to the reference pressure + ! (Dyn. Sources) only present if KRR>0 +INTEGER :: NDIFTH=0 ! numerical diffusion +INTEGER :: NRELTH=0 ! relaxation +INTEGER :: NRADTH=0 ! RADiation +INTEGER :: NDCONVTH=0 ! KAFR CONVection +INTEGER :: NMAFLTH=0 ! Mass flux +INTEGER :: NHTURBTH=0 ! horizontal turbulence +INTEGER :: NVTURBTH=0 ! vertical turbulence +INTEGER :: NDISSHTH=0 ! dissipative heating +INTEGER :: NNEGATH=0 ! negative correction induced by hydrometeors +INTEGER :: NREVATH=0 ! rain evaporation +INTEGER :: NCONDTH=0 ! evaporation/condensation +INTEGER :: NHENUTH=0 ! HEterogenous NUcleation ICE3 +INTEGER :: NHONTH=0 ! HOmogeneous Nucleation ICE3 +INTEGER :: NSFRTH=0 ! Spontaneous FReezing ICE3 +INTEGER :: NDEPSTH=0 ! DEPosition on Snow ICE3 +INTEGER :: NDEPGTH=0 ! DEPosition on Graupel ICE3 +INTEGER :: NRIMTH=0 ! RIMing of cloudwater ICE3 +INTEGER :: NACCTH=0 ! ACCretion of rainwater ICE3 +INTEGER :: NCFRZTH=0 ! Conversion FReeZing ICE3 +INTEGER :: NWETGTH=0 ! WET Growth of graupel ICE3 +INTEGER :: NDRYGTH=0 ! DRY Growth of graupel ICE3 +INTEGER :: NGMLTTH=0 ! Graupel MeLTing ICE3 +INTEGER :: NIMLTTH=0 ! Ice MeLTing ICE3 +INTEGER :: NBERFITH=0 ! BERgeron-FIndeisen gth. ICE3 +INTEGER :: NCDEPITH=0 ! Cond./DEPosition on ice ICE3 +INTEGER :: NWETHTH=0 ! wet growth of hail ICE4 +INTEGER :: NHMLTTH=0 ! melting of hail ICE4 +INTEGER :: NHINDTH=0 ! Heterogeneous Nucleation by Deposition C3R5 +INTEGER :: NHINCTH=0 ! Heterogeneous Nucleation by Contact C3R5 +INTEGER :: NHONHTH=0 ! Haze Homogeneous Nucleation C3R5 +INTEGER :: NHONCTH=0 ! droplet homogeneous nucleation C3R5 +INTEGER :: NHONRTH=0 ! drop homogeneous nucleation C3R5 +INTEGER :: NCEDSTH=0 ! adjustment C3R5 +! +! Allowed processes for the budget of RTKE (kinetic energy) +! +! Courant namelist: NAM_BURTKE +! +LOGICAL :: LBU_RTKE=.FALSE. ! True when the budget of RTKE is performed +! +INTEGER :: NASSETKE=0 ! time filter +INTEGER :: NADVTKE=0 ! Total advection for PPM +INTEGER :: NADVXTKE=0 ! advection along X (all except PPM) +INTEGER :: NADVYTKE=0 ! advection along Y (all except PPM) +INTEGER :: NADVZTKE=0 ! advection along Z (all except PPM) +INTEGER :: NFRCTKE=0 ! forcing +INTEGER :: NDIFTKE=0 ! numerical diffusion +INTEGER :: NRELTKE=0 ! relaxation +INTEGER :: NDPTKE=0 ! dynamic production of TKE +INTEGER :: NTPTKE=0 ! thermal production of TKE +INTEGER :: NDRAGTKE=0 ! vegetation drag +INTEGER :: NDISSTKE=0 ! dissipation of TKE +INTEGER :: NTRTKE=0 ! turbulent transport of TKE +! +! +! Allowed processes for the budget of moist variable RRV (water vapor) +! +! Courant namelist: NAM_BURRV +! +LOGICAL :: LBU_RRV=.FALSE. ! true when the budget of RRV is performed +! +INTEGER :: NASSERV=0 ! time filter +INTEGER :: NNESTRV=0 ! Effect of 2way nesting on Rv +INTEGER :: NADVRV=0 ! Total advection for PPM +INTEGER :: NADVXRV=0 ! advection along X (all except PPM) +INTEGER :: NADVYRV=0 ! advection along Y (all except PPM) +INTEGER :: NADVZRV=0 ! advection along Z (all except PPM) +INTEGER :: NFRCRV=0 ! forcing +INTEGER :: N2DADVRV=0 ! 2d advecting forcing +INTEGER :: N2DRELRV=0 ! 2d relaxation forcing +INTEGER :: NNUDRV=0 ! nudging +INTEGER :: NDIFRV=0 ! numerical diffusion +INTEGER :: NRELRV=0 ! relaxation +INTEGER :: NDCONVRV=0 ! KAFR CONVection +INTEGER :: NMAFLRV=0 ! Mass flux +INTEGER :: NHTURBRV=0 ! horizontal turbulence +INTEGER :: NVTURBRV=0 ! vertical turbulence +INTEGER :: NNEGARV=0 ! negative correction +INTEGER :: NREVARV=0 ! rain evaporation +INTEGER :: NCONDRV=0 ! evaporation/condensation +INTEGER :: NHENURV=0 ! HEterogenous NUcleation ICE3 +INTEGER :: NDEPSRV=0 ! DEPosition on Snow ICE3 +INTEGER :: NDEPGRV=0 ! DEPosition on Graupel ICE3 +INTEGER :: NCDEPIRV=0 ! Cond./DEPosition on ice ICE3 +INTEGER :: NHINDRV=0 ! Heterogeneous Nucleation by Deposition C3R5 +INTEGER :: NHONHRV=0 ! Haze Homogeneous Nucleation C3R5 +INTEGER :: NCEDSRV=0 ! adjustement C3R5 +! +! Allowed processes for the budget of moist variable RRC (cloud water) +! +! Courant namelist: NAM_BURRC +! +LOGICAL :: LBU_RRC=.FALSE. ! True when the budget of RRC is performed +! +INTEGER :: NASSERC=0 ! time filter +INTEGER :: NNESTRC=0 ! Efffect of 2way nesting on Rc +INTEGER :: NADVRC=0 ! Total advection for PPM +INTEGER :: NADVXRC=0 ! advection along X (all except PPM) +INTEGER :: NADVYRC=0 ! advection along Y (all except PPM) +INTEGER :: NADVZRC=0 ! advection along Z (all except PPM) +INTEGER :: NFRCRC=0 ! forcing +INTEGER :: NDIFRC=0 ! numerical diffusion +INTEGER :: NRELRC=0 ! relaxation +INTEGER :: NDCONVRC=0 ! Deep CONVection +INTEGER :: NHTURBRC=0 ! horizontal turbulence +INTEGER :: NVTURBRC=0 ! vertical turbulence +INTEGER :: NNEGARC=0 ! negative correction +INTEGER :: NACCRRC=0 ! accretion +INTEGER :: NAUTORC=0 ! autoconversion +INTEGER :: NCONDRC=0 ! evaporation/condensation +INTEGER :: NHONRC=0 ! HOmogeneous Nucleation ICE3 +INTEGER :: NRIMRC=0 ! RIMing of cloudwater ICE3 +INTEGER :: NWETGRC=0 ! WET Growth of graupel ICE3 +INTEGER :: NDRYGRC=0 ! DRY Growth of graupel ICE3 +INTEGER :: NIMLTRC=0 ! Ice MeLTing ICE3 +INTEGER :: NBERFIRC=0 ! BERgeron-FIndeisen gth. ICE3 +INTEGER :: NCDEPIRC=0 ! Cond./DEPosition on ice ICE3 +INTEGER :: NHENURC=0 ! CCN Activation C2R2 +INTEGER :: NSEDIRC=0 ! sedimentation C2R2 +INTEGER :: NWETHRC=0 ! wet growth of hail +INTEGER :: NHINCRC=0 ! Heterogeneous Nucleation by Contact C3R5 +INTEGER :: NHONCRC=0 ! droplet homogeneous nucleation C3R5 +INTEGER :: NCEDSRC=0 ! adjustment C3R5 +INTEGER :: NREVARC=0 ! evaporation of rain drops +INTEGER :: NDEPORC=0 ! ground deposition +INTEGER :: NDEPOTRRC=0 ! deposition on tree +! +! Allowed processes for the budget of moist variable RRR (rain water) +! +! Courant namelist: NAM_BURRR +! +LOGICAL :: LBU_RRR=.FALSE. ! True when the budget of RRR is performed +! +INTEGER :: NASSERR=0 ! time filter +INTEGER :: NNESTRR=0 ! Efffect of 2way nesting on Rr +INTEGER :: NADVRR=0 ! Total advection for PPM +INTEGER :: NADVXRR=0 ! advection along X (all except PPM) +INTEGER :: NADVYRR=0 ! advection along Y (all except PPM) +INTEGER :: NADVZRR=0 ! advection along Z (all except PPM) +INTEGER :: NFRCRR=0 ! forcing +INTEGER :: NDIFRR=0 ! numerical diffusion +INTEGER :: NRELRR=0 ! relaxation +INTEGER :: NNEGARR=0 ! negative correction +INTEGER :: NACCRRR=0 ! accretion +INTEGER :: NAUTORR=0 ! autoconversion +INTEGER :: NREVARR=0 ! rain evaporation +INTEGER :: NSEDIRR=0 ! sedimentation +INTEGER :: NSFRRR=0 ! Spontaneous FReezing ICE3 +INTEGER :: NACCRR=0 ! ACCretion of rainwater ICE3 +INTEGER :: NCFRZRR=0 ! Conversion FReeZing ICE3 +INTEGER :: NWETGRR=0 ! WET Growth of graupel ICE3 +INTEGER :: NDRYGRR=0 ! DRY Growth of graupel ICE3 +INTEGER :: NGMLTRR=0 ! Graupel MeLTing ICE3 +INTEGER :: NWETHRR=0 ! wet growth of hail ICE4 +INTEGER :: NHMLTRR=0 ! melting of hail ICE4 +INTEGER :: NHONRRR=0 ! drop homogeneous nucleation C3R5 +! +! Allowed processes for the budget of moist variable RRI (ice) +! +! Courant namelist: NAM_BURRI +! +LOGICAL :: LBU_RRI=.FALSE. ! True when the budget of RRI is performed +! +INTEGER :: NASSERI=0 ! time filter +INTEGER :: NNESTRI=0 ! Efffect of 2way nesting on Ri +INTEGER :: NADVRI=0 ! Total advection for PPM +INTEGER :: NADVXRI=0 ! advection along X (all except PPM) +INTEGER :: NADVYRI=0 ! advection along Y (all except PPM) +INTEGER :: NADVZRI=0 ! advection along Z (all except PPM) +INTEGER :: NFRCRI=0 ! forcing +INTEGER :: NDIFRI=0 ! numerical diffusion +INTEGER :: NRELRI=0 ! relaxation +INTEGER :: NDCONVRI=0 ! Deep CONVection +INTEGER :: NHTURBRI=0 ! horizontal turbulence +INTEGER :: NVTURBRI=0 ! vertical turbulence +INTEGER :: NNEGARI=0 ! negative correction +INTEGER :: NSEDIRI=0 ! SEDImentation ICE3 +INTEGER :: NHENURI=0 ! HEterogenous NUcleation ICE3 +INTEGER :: NHONRI=0 ! HOmogeneous Nucleation ICE3 +INTEGER :: NAGGSRI=0 ! AGGregation of snow ICE3 +INTEGER :: NAUTSRI=0 ! AUToconversion of ice ICE3 +INTEGER :: NCFRZRI=0 ! Conversion FReeZing ICE3 +INTEGER :: NWETGRI=0 ! WET Growth of graupel ICE3 +INTEGER :: NDRYGRI=0 ! DRY Growth of graupel ICE3 +INTEGER :: NIMLTRI=0 ! Ice MeLTing ICE3 +INTEGER :: NBERFIRI=0 ! BERgeron-FIndeisen gth. ICE3 +INTEGER :: NCDEPIRI=0 ! Cond./DEPosition on ice ICE3 +INTEGER :: NWETHRI=0 ! wet growth of hail ICE4 +INTEGER :: NHINDRI=0 ! heterogeneous nucleation by deposition C3R5 +INTEGER :: NHINCRI=0 ! heterogeneous nucleation by contact C3R5 +INTEGER :: NHONHRI=0 ! haze homogeneous nucleation source C3R5 +INTEGER :: NHONCRI=0 ! droplet homogeneous nucleation C3R5 +INTEGER :: NCNVIRI=0 ! Conversion of snow to r_i C3R5 +INTEGER :: NCNVSRI=0 ! Conversion of pristine ice to r_s C3R5 +INTEGER :: NHMSRI=0 ! Hallett-Mossop ice multiplication process due to snow riming C3R5 +INTEGER :: NHMGRI=0 ! Hallett-Mossop ice multiplication process due to graupel riming C3R5 +INTEGER :: NCEDSRI=0 ! adjustement C3R5 +! +! Allowed processes for the budget of moist variable RRS (snow) +! +! Courant namelist: NAM_BURRS +! +LOGICAL :: LBU_RRS=.FALSE. ! True when the budget of RRS is performed +! +INTEGER :: NASSERS=0 ! time filter +INTEGER :: NNESTRS=0 ! Efffect of 2way nesting on Rs +INTEGER :: NADVRS=0 ! Total advection for PPM +INTEGER :: NADVXRS=0 ! advection along X (all except PPM) +INTEGER :: NADVYRS=0 ! advection along Y (all except PPM) +INTEGER :: NADVZRS=0 ! advection along Z (all except PPM) +INTEGER :: NFRCRS=0 ! forcing +INTEGER :: NDIFRS=0 ! numerical diffusion +INTEGER :: NRELRS=0 ! relaxation +INTEGER :: NNEGARS=0 ! negative correction +INTEGER :: NSEDIRS=0 ! SEDImentation ICE3 +INTEGER :: NDEPSRS=0 ! DEPosition on Snow ICE3 +INTEGER :: NAGGSRS=0 ! AGGregation of snow ICE3 +INTEGER :: NAUTSRS=0 ! AUToconversion of ice ICE3 +INTEGER :: NRIMRS=0 ! RIMing of cloudwater ICE3 +INTEGER :: NACCRS=0 ! ACCretion of rainwater ICE3 +INTEGER :: NCMELRS=0 ! Conversion MeLTing ICE3 +INTEGER :: NWETGRS=0 ! WET Growth of graupel ICE3 +INTEGER :: NDRYGRS=0 ! DRY Growth of graupel ICE3 +INTEGER :: NWETHRS=0 ! wet growth of hail ICE4 +INTEGER :: NCNVIRS=0 ! Conversion of snow to r_i C3R5 +INTEGER :: NCNVSRS=0 ! Conversion of pristine ice to r_s C3R5 +INTEGER :: NHMSRS=0 ! Hallett-Mossop ice multiplication process due to snow riming C3R5 +! +! Allowed processes for the budget of moist variable RRG (graupel) +! +! Courant namelist: NAM_BURRG +! +LOGICAL :: LBU_RRG=.FALSE. ! True when the budget of RRG is performed +! +INTEGER :: NASSERG=0 ! time filter +INTEGER :: NNESTRG=0 ! Efffect of 2way nesting on Rg +INTEGER :: NADVRG=0 ! Total advection for PPM +INTEGER :: NADVXRG=0 ! advection along X (all except PPM) +INTEGER :: NADVYRG=0 ! advection along Y (all except PPM) +INTEGER :: NADVZRG=0 ! advection along Z (all except PPM) +INTEGER :: NFRCRG=0 ! forcing +INTEGER :: NDIFRG=0 ! numerical diffusion +INTEGER :: NRELRG=0 ! relaxation +INTEGER :: NNEGARG=0 ! negative correction +INTEGER :: NSEDIRG=0 ! SEDImentation ICE3 +INTEGER :: NSFRRG=0 ! Spontaneous FReezing ICE3 +INTEGER :: NDEPGRG=0 ! DEPosition on Snow ICE3 +INTEGER :: NRIMRG=0 ! RIMing of cloudwater ICE3 +INTEGER :: NACCRG=0 ! ACCretion of rainwater ICE3 +INTEGER :: NCMELRG=0 ! Conversion MeLTing ICE3 +INTEGER :: NCFRZRG=0 ! Conversion FReeZing ICE3 +INTEGER :: NWETGRG=0 ! WET Growth of graupel ICE3 +INTEGER :: NDRYGRG=0 ! DRY Growth of graupel ICE3 +INTEGER :: NGMLTRG=0 ! Graupel MeLTing ICE3 +INTEGER :: NWETHRG=0 ! wet growth of hail ICE4 +INTEGER :: NHONRRG=0 ! drop homogeneous nucleation C3R5 +INTEGER :: NHMGRG=0 ! Hallett-Mossop ice multiplication process due to graupel riming +INTEGER :: NCOHGRG=0 ! conversion of hail to graupel +! +! Allowed processes for the budget of moist variable RRH (hail) +! +! Courant namelist: NAM_BURRH +! +LOGICAL :: LBU_RRH=.FALSE. ! True when the budget of RRH is performed +! +INTEGER :: NASSERH=0 ! time filter +INTEGER :: NNESTRH=0 ! Efffect of 2way nesting on Rh +INTEGER :: NADVRH=0 ! Total advection for PPM +INTEGER :: NADVXRH=0 ! advection along X (all except PPM) +INTEGER :: NADVYRH=0 ! advection along Y (all except PPM) +INTEGER :: NADVZRH=0 ! advection along Z (all except PPM) +INTEGER :: NFRCRH=0 ! forcing +INTEGER :: NDIFRH=0 ! numerical diffusion +INTEGER :: NRELRH=0 ! relaxation +INTEGER :: NNEGARH=0 ! negative correction +INTEGER :: NSEDIRH=0 ! sedimentation +INTEGER :: NWETGRH=0 ! wet growth of graupel +INTEGER :: NWETHRH=0 ! wet growth of hail +INTEGER :: NHMLTRH=0 ! melting +INTEGER :: NCOHGRH=0 ! conversion of hail to graupel +! +! Courant namelist: NAM_BURSV +! +LOGICAL :: LBU_RSV=.FALSE. ! True when the budget of RSVx is performed +! +INTEGER :: NASSESV=0 ! Asselin-Robert time filter +INTEGER :: NNESTSV=0 ! Efffect of 2way nesting on Sv +INTEGER :: NADVSV=0 ! Total advection for PPM +INTEGER :: NADVXSV=0 ! advection along X (all except PPM) +INTEGER :: NADVYSV=0 ! advection along Y (all except PPM) +INTEGER :: NADVZSV=0 ! advection along Z (all except PPM) +INTEGER :: NFRCSV=0 ! forcing +INTEGER :: NDIFSV=0 ! numerical diffusion +INTEGER :: NRELSV=0 ! relaxation +INTEGER :: NDCONVSV=0 ! Deep CONVection +INTEGER :: NMAFLSV=0 ! mass flux +INTEGER :: NHTURBSV=0 ! horizontal turbulence +INTEGER :: NVTURBSV=0 ! vertical turbulence +INTEGER :: NCHEMSV=0 ! chemistry activity +! +INTEGER :: NNEGASV=0 +! +! Allowed processes for the budget of electric charge carried by water vapor +INTEGER :: NDEPSQV=0 +INTEGER :: NDEPGQV=0 +INTEGER :: NREVAQV=0 +INTEGER :: NDEPIQV=0 +INTEGER :: NNEUTQV=0 +! +! Allowed processes for the budget of electric charge carried by cloud droplets +INTEGER :: NAUTOQC=0 +INTEGER :: NACCRQC=0 +INTEGER :: NRIMQC=0 +INTEGER :: NWETGQC=0 +INTEGER :: NDRYGQC=0 +INTEGER :: NIMLTQC=0 +INTEGER :: NBERFIQC=0 +INTEGER :: NDEPIQC=0 +INTEGER :: NINDQC=0 ! inductive process +INTEGER :: NSEDIQC=0 +INTEGER :: NNEUTQC=0 +! +! Allowed processes for the budget of electric charge carried by rain drops +INTEGER :: NAUTOQR=0 +INTEGER :: NACCRQR=0 +INTEGER :: NREVAQR=0 +INTEGER :: NACCQR=0 +INTEGER :: NCFRZQR=0 +INTEGER :: NWETGQR=0 +INTEGER :: NDRYGQR=0 +INTEGER :: NGMLTQR=0 +INTEGER :: NSEDIQR=0 +INTEGER :: NNEUTQR=0 +! +! Allowed processes for the budget of electric charge carried by ice crystals +INTEGER :: NAGGSQI=0 +INTEGER :: NAUTSQI=0 +INTEGER :: NCFRZQI=0 +INTEGER :: NWETGQI=0 +INTEGER :: NDRYGQI=0 +INTEGER :: NIMLTQI=0 +INTEGER :: NBERFIQI=0 +INTEGER :: NDEPIQI=0 +INTEGER :: NNIISQI=0 ! non-inductive I-S +INTEGER :: NSEDIQI=0 +INTEGER :: NNEUTQI=0 +! +! Allowed processes for the budget of electric charge carried by snow +INTEGER :: NDEPSQS=0 +INTEGER :: NAGGSQS=0 +INTEGER :: NAUTSQS=0 +INTEGER :: NRIMQS=0 +INTEGER :: NACCQS=0 +INTEGER :: NCMELQS=0 +INTEGER :: NWETGQS=0 +INTEGER :: NDRYGQS=0 +INTEGER :: NNIISQS=0 ! non-inductive I-S +INTEGER :: NSEDIQS=0 +INTEGER :: NNEUTQS=0 +! +! Allowed processes for the budget of electric charge carried by graupel +INTEGER :: NDEPGQG=0 +INTEGER :: NRIMQG=0 +INTEGER :: NACCQG=0 +INTEGER :: NCMELQG=0 +INTEGER :: NCFRZQG=0 +INTEGER :: NWETGQG=0 +INTEGER :: NDRYGQG=0 +INTEGER :: NGMLTQG=0 +INTEGER :: NINDQG=0 ! inductive process +INTEGER :: NSEDIQG=0 +INTEGER :: NNEUTQG=0 +! +! must add processes for electric charge carried by hail +! +! +REAL :: XTIME_BU=0. ! budget time in this time-step +REAL :: XTIME_BU_PROCESS=0. ! budget time per process for this time-step +! +LOGICAL :: LBUDGET_U=.FALSE. ! flag to compute budget of RhoJu and/or LES budgets with u +LOGICAL :: LBUDGET_V=.FALSE. ! flag to compute budget of RhoJv and/or LES budgets with u +LOGICAL :: LBUDGET_W=.FALSE. ! flag to compute budget of RhoJw and/or LES budgets with u +LOGICAL :: LBUDGET_TH=.FALSE. ! flag to compute budget of RhoJTh and/or LES budgets with th +LOGICAL :: LBUDGET_TKE=.FALSE.! flag to compute budget of RhoJTke and/or LES budgets with Tke +LOGICAL :: LBUDGET_RV=.FALSE. ! flag to compute budget of RhoJrv and/or LES budgets with rv +LOGICAL :: LBUDGET_RC=.FALSE. ! flag to compute budget of RhoJrc and/or LES budgets with rc +LOGICAL :: LBUDGET_RR=.FALSE. ! flag to compute budget of RhoJrr and/or LES budgets with rr +LOGICAL :: LBUDGET_RI=.FALSE. ! flag to compute budget of RhoJri and/or LES budgets with ri +LOGICAL :: LBUDGET_RS=.FALSE. ! flag to compute budget of RhoJrs and/or LES budgets with rs +LOGICAL :: LBUDGET_RG=.FALSE. ! flag to compute budget of RhoJrg and/or LES budgets with rg +LOGICAL :: LBUDGET_RH=.FALSE. ! flag to compute budget of RhoJrh and/or LES budgets with rh +LOGICAL :: LBUDGET_SV=.FALSE. ! flag to compute budget of RhoJsv and/or LES budgets with sv +! +END MODULE MODD_BUDGET diff --git a/src/arome/aux/modd_field.F90 b/src/common/aux/modd_field.F90 similarity index 100% rename from src/arome/aux/modd_field.F90 rename to src/common/aux/modd_field.F90 diff --git a/src/arome/aux/modd_frc.F90 b/src/common/aux/modd_frc.F90 similarity index 100% rename from src/arome/aux/modd_frc.F90 rename to src/common/aux/modd_frc.F90 diff --git a/src/arome/aux/modd_ibm_paramn.f90 b/src/common/aux/modd_ibm_paramn.F90 similarity index 100% rename from src/arome/aux/modd_ibm_paramn.f90 rename to src/common/aux/modd_ibm_paramn.F90 diff --git a/src/arome/aux/modd_io.F90 b/src/common/aux/modd_io.F90 similarity index 100% rename from src/arome/aux/modd_io.F90 rename to src/common/aux/modd_io.F90 diff --git a/src/arome/aux/modd_oceanh.F90 b/src/common/aux/modd_oceanh.F90 similarity index 100% rename from src/arome/aux/modd_oceanh.F90 rename to src/common/aux/modd_oceanh.F90 diff --git a/src/arome/aux/modd_parameters.F90 b/src/common/aux/modd_parameters.F90 similarity index 100% rename from src/arome/aux/modd_parameters.F90 rename to src/common/aux/modd_parameters.F90 diff --git a/src/arome/aux/modd_precision.F90 b/src/common/aux/modd_precision.F90 similarity index 100% rename from src/arome/aux/modd_precision.F90 rename to src/common/aux/modd_precision.F90 diff --git a/src/arome/aux/modd_ref.F90 b/src/common/aux/modd_ref.F90 similarity index 100% rename from src/arome/aux/modd_ref.F90 rename to src/common/aux/modd_ref.F90 diff --git a/src/arome/aux/mode_argslist_ll.F90 b/src/common/aux/mode_argslist_ll.F90 similarity index 100% rename from src/arome/aux/mode_argslist_ll.F90 rename to src/common/aux/mode_argslist_ll.F90 diff --git a/src/common/aux/mode_budget.F90 b/src/common/aux/mode_budget.F90 new file mode 100644 index 0000000000000000000000000000000000000000..dc469b1952d3ae4f206f9f6e3bf074248849cd0e --- /dev/null +++ b/src/common/aux/mode_budget.F90 @@ -0,0 +1,24 @@ +MODULE MODE_BUDGET +USE MODD_BUDGET, ONLY: TBUDGETDATA +IMPLICIT NONE +CONTAINS + +SUBROUTINE BUDGET_STORE_INIT(TPBUDGET, HSOURCE, PVARS) + TYPE(TBUDGETDATA), INTENT(INOUT) :: TPBUDGET ! Budget datastructure + CHARACTER(LEN=*), INTENT(IN) :: HSOURCE ! Name of the source term + REAL, DIMENSION(:,:,:), INTENT(IN) :: PVARS ! Current value to be stored +END SUBROUTINE BUDGET_STORE_INIT + +SUBROUTINE BUDGET_STORE_END(TPBUDGET, HSOURCE, PVARS) + TYPE(TBUDGETDATA), INTENT(INOUT) :: TPBUDGET ! Budget datastructure + CHARACTER(LEN=*), INTENT(IN) :: HSOURCE ! Name of the source term + REAL, DIMENSION(:,:,:), INTENT(IN) :: PVARS ! Current value to be stored +END SUBROUTINE BUDGET_STORE_END + +SUBROUTINE BUDGET_STORE_ADD(TPBUDGET, HSOURCE, PVARS) + TYPE(TBUDGETDATA), INTENT(INOUT) :: TPBUDGET ! Budget datastructure + CHARACTER(LEN=*), INTENT(IN) :: HSOURCE ! Name of the source term + REAL, DIMENSION(:,:,:), INTENT(IN) :: PVARS ! Current value to be stored + REAL, DIMENSION(SIZE(PVARS, 1), SIZE(PVARS, 2), SIZE(PVARS, 3)) :: ZVARS +END SUBROUTINE BUDGET_STORE_ADD +END MODULE MODE_BUDGET diff --git a/src/arome/aux/mode_gather_ll.F90 b/src/common/aux/mode_gather_ll.F90 similarity index 100% rename from src/arome/aux/mode_gather_ll.F90 rename to src/common/aux/mode_gather_ll.F90 diff --git a/src/arome/aux/mode_io_field_write.F90 b/src/common/aux/mode_io_field_write.F90 similarity index 100% rename from src/arome/aux/mode_io_field_write.F90 rename to src/common/aux/mode_io_field_write.F90 diff --git a/src/arome/aux/mode_ll.F90 b/src/common/aux/mode_ll.F90 similarity index 100% rename from src/arome/aux/mode_ll.F90 rename to src/common/aux/mode_ll.F90 diff --git a/src/arome/aux/mode_mppdb.F90 b/src/common/aux/mode_mppdb.F90 similarity index 100% rename from src/arome/aux/mode_mppdb.F90 rename to src/common/aux/mode_mppdb.F90 diff --git a/src/common/aux/mode_msg.F90 b/src/common/aux/mode_msg.F90 new file mode 100644 index 0000000000000000000000000000000000000000..7a3bdbf75392d6a18c1480c384a172ca5b00eaed --- /dev/null +++ b/src/common/aux/mode_msg.F90 @@ -0,0 +1,115 @@ +! Author(s) +! S. Riette (18 Nov 2021), adapted from the Meso-NH version +! Modifications: +!----------------------------------------------------------------- +MODULE MODE_MSG + +USE MODD_IO, ONLY: NVERB_FATAL, NVERB_ERROR, NVERB_WARNING, & + &NVERB_INFO, NVERB_DEBUG, N_ABORT_LEVEL + +IMPLICIT NONE + +INTEGER, PARAMETER :: NMSGLGTMAX = 100 ! Maximum length for a message +INTEGER, PARAMETER :: NMSGLLINEMAX = 10 ! Maximum number of lines for a message +CHARACTER(LEN=NMSGLGTMAX), DIMENSION(NMSGLLINEMAX) :: CMNHMSG='' + +#include "abor1.intfb.h" + +INTERFACE PRINT_MSG + MODULE PROCEDURE PRINT_MSG_1LINE, PRINT_MSG_MULTI_CMNHMSG, PRINT_MSG_MULTI +ENDINTERFACE PRINT_MSG + +CONTAINS + +SUBROUTINE PRINT_MSG_1LINE(KVERB, HDOMAIN, HSUBR, HMSG) + INTEGER, INTENT(IN) :: KVERB !Verbosity level + CHARACTER(LEN=*), INTENT(IN) :: HDOMAIN !Domain/category of message + CHARACTER(LEN=*), INTENT(IN) :: HSUBR !Subroutine/function name + CHARACTER(LEN=*), INTENT(IN) :: HMSG !Message + + CALL PRINT_MSG_MULTI(KVERB, HDOMAIN, HSUBR, [HMSG]) + +ENDSUBROUTINE PRINT_MSG_1LINE + +SUBROUTINE PRINT_MSG_MULTI_CMNHMSG(KVERB, HDOMAIN, HSUBR) + INTEGER, INTENT(IN) :: KVERB !Verbosity level + CHARACTER(LEN=*), INTENT(IN) :: HDOMAIN !Domain/category of message + CHARACTER(LEN=*), INTENT(IN) :: HSUBR !Subroutine/function name + + INTEGER :: ILINES + + !Find the last non empty line + ILINES=SIZE(CMNHMSG) + DO WHILE (LEN_TRIM(CMNHMSG(ILINES))==0) + ILINES=ILINES - 1 + ENDDO + + CALL PRINT_MSG_MULTI(KVERB, HDOMAIN, HSUBR, CMNHMSG(1:ILINES)) + + !Empty the message buffer + !This is necessary especially if the next call contain a shorter message + CMNHMSG(1:ILINES)='' + +ENDSUBROUTINE PRINT_MSG_MULTI_CMNHMSG + +SUBROUTINE PRINT_MSG_MULTI(KVERB, HDOMAIN, HSUBR, HMSG) +! +USE EC_LUN, ONLY : NULOUT +! +! +INTEGER, INTENT(IN) :: KVERB !Verbosity level +CHARACTER(LEN=*), INTENT(IN) :: HDOMAIN !Domain/category of message +CHARACTER(LEN=*), INTENT(IN) :: HSUBR !Subroutine/function name +CHARACTER(LEN=*), dimension(:), INTENT(IN) :: HMSG !Message +! +CHARACTER(LEN=2) :: YSZ +CHARACTER(LEN=9) :: YPRE +CHARACTER(LEN=30) :: YSUBR +CHARACTER(LEN=:), ALLOCATABLE :: YFORMAT +INTEGER :: JI +INTEGER :: ILINES +! +ILINES=SIZE(HMSG) + +SELECT CASE(KVERB) + CASE(NVERB_FATAL) + YPRE='FATAL: ' + CASE(NVERB_ERROR) + YPRE='ERROR: ' + CASE(NVERB_WARNING) + YPRE='WARNING: ' + CASE(NVERB_INFO) + YPRE='INFO: ' + CASE(NVERB_DEBUG) + YPRE='DEBUG: ' + CASE DEFAULT + WRITE(UNIT=NULOUT, FMT=*) 'ERROR: PRINT_MSG: wrong verbosity level' +END SELECT +! +YSUBR=TRIM(HSUBR)//':' + +IF (ILINES==1) THEN + WRITE(UNIT=NULOUT, FMT="(A9,A30,A)") YPRE, YSUBR, TRIM(HMSG(1)) +ELSE + IF (ILINES<10) THEN + YSZ = 'I1' + ELSEIF (ILINES<100) THEN + YSZ = 'I2' + ELSEIF (ILINES<1000) THEN + YSZ = 'I3' + ELSE + YSZ = 'I4' + ENDIF + YFORMAT='(A9,A30,' // YSZ // ',''/'',' // YSZ // ','': '',A)' + DO JI=1, ILINES + WRITE(UNIT=NULOUT, FMT=YFORMAT) YPRE, YSUBR, JI, ILINES, TRIM(HMSG(JI)) + ENDDO +ENDIF +! +IF (KVERB<=N_ABORT_LEVEL) THEN + CALL ABOR1(TRIM(HMSG(ILINES))) !Last line repeated +END IF +! +ENDSUBROUTINE PRINT_MSG_MULTI + +ENDMODULE MODE_MSG diff --git a/src/arome/aux/mode_sources_neg_correct.F90 b/src/common/aux/mode_sources_neg_correct.F90 similarity index 100% rename from src/arome/aux/mode_sources_neg_correct.F90 rename to src/common/aux/mode_sources_neg_correct.F90 diff --git a/src/arome/aux/mode_thermo.F90 b/src/common/aux/mode_thermo.F90 similarity index 100% rename from src/arome/aux/mode_thermo.F90 rename to src/common/aux/mode_thermo.F90 diff --git a/src/arome/aux/modi_gradient_m.F90 b/src/common/aux/modi_gradient_m.F90 similarity index 72% rename from src/arome/aux/modi_gradient_m.F90 rename to src/common/aux/modi_gradient_m.F90 index ed35df93ab224912e60c3afd8ec7797b009ebc99..1d910444bc033eae87a8d551358dd15884c27781 100644 --- a/src/arome/aux/modi_gradient_m.F90 +++ b/src/common/aux/modi_gradient_m.F90 @@ -1,48 +1,55 @@ -! ######spl +!MNH_LIC Copyright 1994-2020 CNRS, Meteo-France and Universite Paul Sabatier +!MNH_LIC This is part of the Meso-NH software governed by the CeCILL-C licence +!MNH_LIC version 1. See LICENSE, CeCILL-C_V1-en.txt and CeCILL-C_V1-fr.txt +!MNH_LIC for details. version 1. +!----------------------------------------------------------------- +! ###################### MODULE MODI_GRADIENT_M ! ###################### ! INTERFACE ! ! -FUNCTION GX_M_M(PA,PDXX,PDZZ,PDZX, KKA, KKU, KL) RESULT(PGX_M_M) -INTEGER, INTENT(IN),OPTIONAL :: KKA, KKU ! near ground and uppest atmosphere array indexes -INTEGER, INTENT(IN),OPTIONAL :: KL ! +1 if grid goes from ground to atmosphere top, -1 otherwise +FUNCTION GX_M_M(PA,PDXX,PDZZ,PDZX,KKA,KKU,KL) RESULT(PGX_M_M) +! REAL, DIMENSION(:,:,:), INTENT(IN) :: PA ! variable at the mass point REAL, DIMENSION(:,:,:), INTENT(IN) :: PDXX ! metric coefficient dxx REAL, DIMENSION(:,:,:), INTENT(IN) :: PDZZ ! metric coefficient dzz REAL, DIMENSION(:,:,:), INTENT(IN) :: PDZX ! metric coefficient dzx +INTEGER, INTENT(IN),OPTIONAL :: KKA, KKU ! near ground and uppest atmosphere array indexes (AROME) +INTEGER, INTENT(IN),OPTIONAL :: KL ! +1 if grid goes from ground to atmosphere top, -1 otherwise (AROME) ! REAL, DIMENSION(SIZE(PA,1),SIZE(PA,2),SIZE(PA,3)) :: PGX_M_M ! result mass point ! END FUNCTION GX_M_M ! ! -FUNCTION GY_M_M(PA,PDYY,PDZZ,PDZY, KKA, KKU, KL) RESULT(PGY_M_M) -INTEGER, INTENT(IN),OPTIONAL :: KKA, KKU ! near ground and uppest atmosphere array indexes -INTEGER, INTENT(IN),OPTIONAL :: KL ! +1 if grid goes from ground to atmosphere top, -1 otherwise +FUNCTION GY_M_M(PA,PDYY,PDZZ,PDZY,KKA,KKU,KL) RESULT(PGY_M_M) +! REAL, DIMENSION(:,:,:), INTENT(IN) :: PA ! variable at the mass point REAL, DIMENSION(:,:,:), INTENT(IN) :: PDYY ! metric coefficient dyy REAL, DIMENSION(:,:,:), INTENT(IN) :: PDZZ ! metric coefficient dzz REAL, DIMENSION(:,:,:), INTENT(IN) :: PDZY ! metric coefficient dzy ! +INTEGER, INTENT(IN),OPTIONAL :: KKA, KKU ! near ground and uppest atmosphere array indexes (AROME) +INTEGER, INTENT(IN),OPTIONAL :: KL ! +1 if grid goes from ground to atmosphere top, -1 otherwise (AROME) REAL, DIMENSION(SIZE(PA,1),SIZE(PA,2),SIZE(PA,3)) :: PGY_M_M ! result mass point ! END FUNCTION GY_M_M ! ! -FUNCTION GZ_M_M(PA,PDZZ, KKA, KKU, KL) RESULT(PGZ_M_M) +FUNCTION GZ_M_M(PA,PDZZ,KKA,KKU,KL) RESULT(PGZ_M_M) ! -INTEGER, INTENT(IN),OPTIONAL :: KKA, KKU ! near ground and uppest atmosphere array indexes -INTEGER, INTENT(IN),OPTIONAL :: KL ! +1 if grid goes from ground to atmosphere top, -1 otherwise REAL, DIMENSION(:,:,:), INTENT(IN) :: PA ! variable at the mass point REAL, DIMENSION(:,:,:), INTENT(IN) :: PDZZ ! metric coefficient dzz ! +INTEGER, INTENT(IN),OPTIONAL :: KKA, KKU ! near ground and uppest atmosphere array indexes (AROME) +INTEGER, INTENT(IN),OPTIONAL :: KL ! +1 if grid goes from ground to atmosphere top, -1 otherwise (AROME) REAL, DIMENSION(SIZE(PA,1),SIZE(PA,2),SIZE(PA,3)) :: PGZ_M_M ! result mass point ! END FUNCTION GZ_M_M ! - FUNCTION GX_M_U(KKA, KKU, KL,PY,PDXX,PDZZ,PDZX) RESULT(PGX_M_U) + FUNCTION GX_M_U(KKA,KKU,KL,PY,PDXX,PDZZ,PDZX) RESULT(PGX_M_U) ! IMPLICIT NONE ! @@ -59,7 +66,7 @@ REAL, DIMENSION(SIZE(PY,1),SIZE(PY,2),SIZE(PY,3)) :: PGX_M_U ! result at flux END FUNCTION GX_M_U ! ! - FUNCTION GY_M_V(KKA, KKU, KL,PY,PDYY,PDZZ,PDZY) RESULT(PGY_M_V) + FUNCTION GY_M_V(KKA,KKU,KL,PY,PDYY,PDZZ,PDZY) RESULT(PGY_M_V) ! IMPLICIT NONE ! diff --git a/src/arome/aux/modi_gradient_u.F90 b/src/common/aux/modi_gradient_u.F90 similarity index 85% rename from src/arome/aux/modi_gradient_u.F90 rename to src/common/aux/modi_gradient_u.F90 index 519e5cc8138a439f0c7be20a45bae5fc1b89201b..14de7c2623bc70f52b55b78f400e6a07e190f312 100644 --- a/src/arome/aux/modi_gradient_u.F90 +++ b/src/common/aux/modi_gradient_u.F90 @@ -1,4 +1,9 @@ -! ######spl +!MNH_LIC Copyright 1994-2020 CNRS, Meteo-France and Universite Paul Sabatier +!MNH_LIC This is part of the Meso-NH software governed by the CeCILL-C licence +!MNH_LIC version 1. See LICENSE, CeCILL-C_V1-en.txt and CeCILL-C_V1-fr.txt +!MNH_LIC for details. version 1. +!----------------------------------------------------------------- +! ###################### MODULE MODI_GRADIENT_U ! ###################### ! diff --git a/src/arome/aux/modi_gradient_v.F90 b/src/common/aux/modi_gradient_v.F90 similarity index 85% rename from src/arome/aux/modi_gradient_v.F90 rename to src/common/aux/modi_gradient_v.F90 index d1ff4a08da2f36ef0eb877d26c167bbbcfdd93a1..406ff5450e3b23da921a0bf128899818bb6fc3d4 100644 --- a/src/arome/aux/modi_gradient_v.F90 +++ b/src/common/aux/modi_gradient_v.F90 @@ -1,4 +1,9 @@ -! ######spl +!MNH_LIC Copyright 1994-2020 CNRS, Meteo-France and Universite Paul Sabatier +!MNH_LIC This is part of the Meso-NH software governed by the CeCILL-C licence +!MNH_LIC version 1. See LICENSE, CeCILL-C_V1-en.txt and CeCILL-C_V1-fr.txt +!MNH_LIC for details. version 1. +!----------------------------------------------------------------- +! ###################### MODULE MODI_GRADIENT_V ! ###################### ! diff --git a/src/arome/aux/modi_gradient_w.F90 b/src/common/aux/modi_gradient_w.F90 similarity index 76% rename from src/arome/aux/modi_gradient_w.F90 rename to src/common/aux/modi_gradient_w.F90 index 48d924d53850049ebfcf080437dc0371f3cc1c76..a277d269440d717c9eca7a8971c24627fbfc016a 100644 --- a/src/arome/aux/modi_gradient_w.F90 +++ b/src/common/aux/modi_gradient_w.F90 @@ -1,4 +1,9 @@ -! ######spl +!MNH_LIC Copyright 1994-2020 CNRS, Meteo-France and Universite Paul Sabatier +!MNH_LIC This is part of the Meso-NH software governed by the CeCILL-C licence +!MNH_LIC version 1. See LICENSE, CeCILL-C_V1-en.txt and CeCILL-C_V1-fr.txt +!MNH_LIC for details. version 1. +!----------------------------------------------------------------- +! ###################### MODULE MODI_GRADIENT_W ! ###################### ! @@ -30,14 +35,14 @@ REAL, DIMENSION(SIZE(PA,1),SIZE(PA,2),SIZE(PA,3)) :: PGX_W_UW ! result UW point END FUNCTION GX_W_UW ! ! -FUNCTION GY_W_VW(PA,PDXX,PDZZ,PDZX, KKA, KKU, KL) RESULT(PGY_W_VW) +FUNCTION GY_W_VW(PA,PDYY,PDZZ,PDZY, KKA, KKU, KL) RESULT(PGY_W_VW) ! INTEGER, INTENT(IN),OPTIONAL :: KKA, KKU ! near ground and uppest atmosphere array indexes INTEGER, INTENT(IN),OPTIONAL :: KL ! +1 if grid goes from ground to atmosphere top, -1 otherwise REAL, DIMENSION(:,:,:), INTENT(IN) :: PA ! variable at the W point -REAL, DIMENSION(:,:,:), INTENT(IN) :: PDXX ! metric coefficient dxx +REAL, DIMENSION(:,:,:), INTENT(IN) :: PDYY ! metric coefficient dyy REAL, DIMENSION(:,:,:), INTENT(IN) :: PDZZ ! metric coefficient dzz -REAL, DIMENSION(:,:,:), INTENT(IN) :: PDZX ! metric coefficient dzx +REAL, DIMENSION(:,:,:), INTENT(IN) :: PDZY ! metric coefficient dzy ! REAL, DIMENSION(SIZE(PA,1),SIZE(PA,2),SIZE(PA,3)) :: PGY_W_VW ! result VW point ! diff --git a/src/arome/aux/modi_second_mnh.F90 b/src/common/aux/modi_second_mnh.F90 similarity index 100% rename from src/arome/aux/modi_second_mnh.F90 rename to src/common/aux/modi_second_mnh.F90 diff --git a/src/arome/aux/modi_shuman.F90 b/src/common/aux/modi_shuman.F90 similarity index 100% rename from src/arome/aux/modi_shuman.F90 rename to src/common/aux/modi_shuman.F90 diff --git a/src/common/aux/second_mnh.F90 b/src/common/aux/second_mnh.F90 new file mode 100644 index 0000000000000000000000000000000000000000..3b810feb5d42003c465ae08fe1dd2ef0c6949598 --- /dev/null +++ b/src/common/aux/second_mnh.F90 @@ -0,0 +1,2 @@ +SUBROUTINE SECOND_MNH +END SUBROUTINE SECOND_MNH diff --git a/src/arome/aux/shuman.F90 b/src/common/aux/shuman.F90 similarity index 100% rename from src/arome/aux/shuman.F90 rename to src/common/aux/shuman.F90 diff --git a/src/arome/aux/shuman_phy.F90 b/src/common/aux/shuman_phy.F90 similarity index 100% rename from src/arome/aux/shuman_phy.F90 rename to src/common/aux/shuman_phy.F90 diff --git a/src/arome/micro/modd_param_ice.F90 b/src/common/micro/modd_param_ice.F90 similarity index 100% rename from src/arome/micro/modd_param_ice.F90 rename to src/common/micro/modd_param_ice.F90 diff --git a/src/common/micro/mode_ice4_tendencies.F90 b/src/common/micro/mode_ice4_tendencies.F90 index 5cdcfcba54cf8d5c0b1814f8467ae2f10e71826c..97a727cc04b0149c149f2cfd1d60f315ec43b979 100644 --- a/src/common/micro/mode_ice4_tendencies.F90 +++ b/src/common/micro/mode_ice4_tendencies.F90 @@ -333,9 +333,12 @@ IF (LLRFR) THEN DO JL=1,KSIZE ZRHT3D (K1(JL), K2(JL), K3(JL)) = ZVART(JL,IRH) ENDDO + CALL ICE4_RAINFR_VERT(D, ICED, PRAINFR(:,:,:), & + &ZRRT3D(:,:,:), ZRST3D(:,:,:), ZRGT3D(:,:,:), ZRHT3D(:,:,:)) + ELSE + CALL ICE4_RAINFR_VERT(D, ICED, PRAINFR(:,:,:), & + &ZRRT3D(:,:,:), ZRST3D(:,:,:), ZRGT3D(:,:,:)) ENDIF - CALL ICE4_RAINFR_VERT(D, ICED, PRAINFR(:,:,:), & - &ZRRT3D(:,:,:), ZRST3D(:,:,:), ZRGT3D(:,:,:), ZRHT3D(:,:,:)) DO JL=1,KSIZE ZRAINFR(JL)=PRAINFR(K1(JL), K2(JL), K3(JL)) END DO diff --git a/src/common/micro/rain_ice.F90 b/src/common/micro/rain_ice.F90 index 821abc317f32c639bc67eb746dc28ad7b218195f..3e4f608a375fc61b3197ab391677a2822fde66e4 100644 --- a/src/common/micro/rain_ice.F90 +++ b/src/common/micro/rain_ice.F90 @@ -621,7 +621,11 @@ DO JK = D%NKTB,D%NKTE PEVAP3D(:,:,JK)=0. ENDIF PRAINFR(:,:,JK)=0. - ZCITOUT(:,:,JK)=0. +#ifdef REPRO55 + ZCITOUT(:,:,JK)=PCIT(:,:,JK) +#else + ZCITOUT(:,:,JK)=0. !We want 0 outside of IMICRO points +#endif ENDDO IF(BUCONF%LBU_ENABLE) THEN @@ -1003,7 +1007,11 @@ IF (KSIZE > 0) THEN ENDDO ENDDO DO JL=1, IMICRO - IF (ZVART(JL,IRI)==0.) ZCIT(JL) = 0. +#ifdef REPRO55 + ZCIT(JL)=ZCIT(JL) * MAX(0., -SIGN(1., -ZVART(JL,IRI))) +#else + IF (ZVART(JL,IRI)<=0.) ZCIT(JL) = 0. +#endif ZTIME(JL)=ZTIME(JL)+ZMAXTIME(JL) ENDDO diff --git a/src/common/turb/les_mean_subgrid_3d.F90 b/src/common/turb/les_mean_subgrid_3d.F90 new file mode 100644 index 0000000000000000000000000000000000000000..d091f03c8f28c7d5b059832229c353c631275c15 --- /dev/null +++ b/src/common/turb/les_mean_subgrid_3d.F90 @@ -0,0 +1,2 @@ +SUBROUTINE LES_MEAN_SUBGRID_3D +END SUBROUTINE LES_MEAN_SUBGRID_3D diff --git a/src/common/turb/les_mean_subgrid_surf.F90 b/src/common/turb/les_mean_subgrid_surf.F90 new file mode 100644 index 0000000000000000000000000000000000000000..407cb7f5130ecd9ab9b64d99bcb2c61965dd9ee0 --- /dev/null +++ b/src/common/turb/les_mean_subgrid_surf.F90 @@ -0,0 +1,2 @@ +SUBROUTINE LES_MEAN_SUBGRID_SURF +END SUBROUTINE LES_MEAN_SUBGRID_SURF diff --git a/src/mesonh/turb/modd_diag_in_run.f90 b/src/common/turb/modd_diag_in_run.F90 similarity index 100% rename from src/mesonh/turb/modd_diag_in_run.f90 rename to src/common/turb/modd_diag_in_run.F90 diff --git a/src/common/turb/mode_tridiag_w.F90 b/src/common/turb/mode_tridiag_w.F90 new file mode 100644 index 0000000000000000000000000000000000000000..8c976336add7c73953d62bf9bb0bc3c67c2260dc --- /dev/null +++ b/src/common/turb/mode_tridiag_w.F90 @@ -0,0 +1,283 @@ +!MNH_LIC Copyright 2011-2020 CNRS, Meteo-France and Universite Paul Sabatier +!MNH_LIC This is part of the Meso-NH software governed by the CeCILL-C licence +!MNH_LIC version 1. See LICENSE, CeCILL-C_V1-en.txt and CeCILL-C_V1-fr.txt +!MNH_LIC for details. version 1. +!----------------------------------------------------------------- +! ################### + MODULE MODE_TRIDIAG_W +! ################### +IMPLICIT NONE +CONTAINS +! +! +! + +! ################################################# + SUBROUTINE TRIDIAG_W(PVARM,PF,PDFDDWDZ,PTSTEP, & + PMZF_DZZ,PRHODJ,PVARP) +! ################################################# +! +! +!!**** *TRIDIAG_W* - routine to solve a time implicit scheme +!! +!! +!! PURPOSE +!! ------- +! The purpose of this routine is to give a field PVARP at t+1, by +! solving an implicit TRIDIAGonal system obtained by the +! discretization of the vertical turbulent diffusion. +! The function of F(dT/dz) must have been linearized. +! PVARP is localized at a flux point. +! +!!** METHOD +!! ------ +!! +!! [W(+) - W(-)]/Dt = -d{ F + dF/d(dW/dz) * [dW/dz(+)-dW/dz(-)] }/dz +!! +!! It is discretized as follows: +!! +!! (PRHODJ(k)+PRHODJ(k-1))/2.*PVARP(k)/PTSTEP +!! = +!! (PRHODJ(k)+PRHODJ(k-1))/2.*PVARM(k)/PTSTEP +!! - PRHODJ(k) * PF(k )/PMZF_PDZZ(k ) +!! + PRHODJ(k-1) * PF(k-1)/PMZF_PDZZ(k-1) +!! - PRHODJ(k) * PDFDDWDZ(k) * PVARP(k+1)/PMZF_DZZ(k)**2 +!! + PRHODJ(k) * PDFDDWDZ(k) * PVARP(k) /PMZF_DZZ(k)**2 +!! + PRHODJ(k-1) * PDFDDWDZ(k-1) * PVARP(k) /PMZF_DZZ(k-1)**2 +!! - PRHODJ(k-1) * PDFDDWDZ(k-1) * PVARP(k-1)/PMZF_DZZ(k-1)**2 +!! + PRHODJ(k) * PDFDDWDZ(k) * PVARM(k+1)/PMZF_DZZ(k)**2 +!! - PRHODJ(k) * PDFDDWDZ(k) * PVARM(k) /PMZF_DZZ(k)**2 +!! - PRHODJ(k-1) * PDFDDWDZ(k-1) * PVARM(k) /PMZF_DZZ(k-1)**2 +!! + PRHODJ(k-1) * PDFDDWDZ(k-1) * PVARM(k-1)/PMZF_DZZ(k-1)**2 +!! +!! +!! The system to solve is: +!! +!! A*PVARP(k-1) + B*PVARP(k) + C*PVARP(k+1) = Y(k) +!! +!! +!! The RHS of the linear system in PVARP writes: +!! +!! y(k) = (PRHODJ(k)+PRHODJ(k-1))/2.*PVARM(k)/PTSTEP +!! - PRHODJ(k) * PF(k )/PMZF_PDZZ(k ) +!! + PRHODJ(k-1) * PF(k-1)/PMZF_PDZZ(k-1) +!! + PRHODJ(k) * PDFDDWDZ(k) * PVARM(k+1)/PMZF_DZZ(k)**2 +!! - PRHODJ(k) * PDFDDWDZ(k) * PVARM(k) /PMZF_DZZ(k)**2 +!! - PRHODJ(k-1) * PDFDDWDZ(k-1) * PVARM(k) /PMZF_DZZ(k-1)**2 +!! + PRHODJ(k-1) * PDFDDWDZ(k-1) * PVARM(k-1)/PMZF_DZZ(k-1)**2 +!! +!! +!! Then, the classical TRIDIAGonal algorithm is used to invert the +!! implicit operator. Its matrix is given by: +!! +!! ( b(ikb) c(ikb) 0 0 0 0 0 0 ) +!! ( 0 a(ikb+1) b(ikb+1) c(ikb+1) 0 ... 0 0 0 ) +!! ( 0 0 a(ikb+2) b(ikb+2) c(ikb+2). 0 0 0 ) +!! ....................................................................... +!! ( 0 ... 0 a(k) b(k) c(k) 0 ... 0 0 ) +!! ....................................................................... +!! ( 0 0 0 0 0 ...a(ike-1) b(ike-1) c(ike-1)) +!! ( 0 0 0 0 0 ... 0 a(ike) b(ike) ) +!! +!! ikb and ike represent the first and the last inner mass levels of the +!! model. The coefficients are: +!! +!! a(k) = + PRHODJ(k-1) * PDFDDWDZ(k-1)/PMZF_DZZ(k-1)**2 +!! b(k) = (PRHODJ(k)+PRHODJ(k-1))/2. / PTSTEP +!! - PRHODJ(k) * PDFDDWDZ(k) /PMZF_DZZ(k)**2 +!! - PRHODJ(k-1) * PDFDDWDZ(k-1)/PMZF_DZZ(k-1)**2 +!! c(k) = + PRHODJ(k) * PDFDDWDZ(k)/PMZF_DZZ(k)**2 +!! +!! for all k /= ikb or ike +!! +!! with the boundary conditions: +!! PVARP(ikb-1) = PVARP(ikb) +!! PVARP(ike+1) = 0. +!! +!! This induces: +!! +!! b(ikb) = (PRHODJ(ikb)+PRHODJ(ikb-1))/2. / PTSTEP +!! - PRHODJ(ikb) * PDFDDWDZ(ikb) /PMZF_DZZ(ikb)**2 +!! c(ikb) = + PRHODJ(ikb) * PDFDDWDZ(ikb)/PMZF_DZZ(ikb)**2 +!! +!! b(ike) = (PRHODJ(ike)+PRHODJ(ike-1))/2. / PTSTEP +!! - PRHODJ(ike-1) * PDFDDWDZ(ike-1)/PMZF_DZZ(ike-1)**2 +!! - PRHODJ(ike ) * PDFDDWDZ(ike )/PMZF_DZZ(ike )**2 +!! a(ike) = + PRHODJ(ike-1) * PDFDDWDZ(ike-1)/PMZF_DZZ(ike-1)**2 +!! +!! +!! EXTERNAL +!! -------- +!! +!! NONE +!! +!! IMPLICIT ARGUMENTS +!! ------------------ +!! +!! REFERENCE +!! --------- +!! Press et al: Numerical recipes (1986) Cambridge Univ. Press +!! +!! AUTHOR +!! ------ +!! V. Masson * Meteo-France * +!! +!! MODIFICATIONS +!! ------------- +!! Original 04/2011 (from tridiag_thermo.f90) +!! 03/2014 modification of upper boundary condition +!! --------------------------------------------------------------------- +! +!* 0. DECLARATIONS +! +USE MODD_PARAMETERS, ONLY : JPVEXT +! +USE MODI_SHUMAN +! +IMPLICIT NONE +! +! +!* 0.1 declarations of arguments +! +REAL, DIMENSION(:,:,:), INTENT(IN) :: PVARM ! variable at t-1 at flux point +REAL, DIMENSION(:,:,:), INTENT(IN) :: PF ! flux in dT/dt=-dF/dz at mass point +REAL, DIMENSION(:,:,:), INTENT(IN) :: PDFDDWDZ! dF/d(dW/dz) at mass point +REAL, INTENT(IN) :: PTSTEP ! Double time step +REAL, DIMENSION(:,:,:), INTENT(IN) :: PMZF_DZZ! Dz at mass point +REAL, DIMENSION(:,:,:), INTENT(IN) :: PRHODJ ! (dry rho)*J at mass point +! +REAL, DIMENSION(:,:,:), INTENT(OUT):: PVARP ! variable at t+1 at flux point +! +! +!* 0.2 declarations of local variables +! +REAL, DIMENSION(SIZE(PVARM,1),SIZE(PVARM,2),SIZE(PVARM,3)) :: ZRHODJ_DFDDWDZ_O_DZ2 +REAL, DIMENSION(SIZE(PVARM,1),SIZE(PVARM,2),SIZE(PVARM,3)) :: ZMZM_RHODJ +REAL, DIMENSION(SIZE(PVARM,1),SIZE(PVARM,2),SIZE(PVARM,3)) :: ZA, ZB, ZC +REAL, DIMENSION(SIZE(PVARM,1),SIZE(PVARM,2),SIZE(PVARM,3)) :: ZY ,ZGAM + ! RHS of the equation, 3D work array +REAL, DIMENSION(SIZE(PVARM,1),SIZE(PVARM,2)) :: ZBET + ! 2D work array +INTEGER :: JK ! loop counter +INTEGER :: IKB,IKE ! inner vertical limits +! +! --------------------------------------------------------------------------- +! +!* 1. Preliminaries +! ------------- +! +IKB=1+JPVEXT +IKE=SIZE(PVARM,3)-JPVEXT +! +ZMZM_RHODJ = MZM(PRHODJ) +ZRHODJ_DFDDWDZ_O_DZ2 = PRHODJ*PDFDDWDZ/PMZF_DZZ**2 +! +ZA=0. +ZB=0. +ZC=0. +ZY=0. +! +! +!* 2. COMPUTE THE RIGHT HAND SIDE +! --------------------------- +! +!! y(k) = (PRHODJ(k)+PRHODJ(k-1))/2.*PVARM(k)/PTSTEP +!! - PRHODJ(k) * PF(k )/PMZF_PDZZ(k ) +!! + PRHODJ(k-1) * PF(k-1)/PMZF_PDZZ(k-1) +!! + PRHODJ(k) * PDFDDWDZ(k) * PVARM(k+1)/PMZF_DZZ(k)**2 +!! - PRHODJ(k) * PDFDDWDZ(k) * PVARM(k) /PMZF_DZZ(k)**2 +!! - PRHODJ(k-1) * PDFDDWDZ(k-1) * PVARM(k) /PMZF_DZZ(k-1)**2 +!! + PRHODJ(k-1) * PDFDDWDZ(k-1) * PVARM(k-1)/PMZF_DZZ(k-1)**2 +! +ZY(:,:,IKB) = ZMZM_RHODJ(:,:,IKB)*PVARM(:,:,IKB)/PTSTEP & + - PRHODJ(:,:,IKB ) * PF(:,:,IKB )/PMZF_DZZ(:,:,IKB ) & + + PRHODJ(:,:,IKB-1) * PF(:,:,IKB-1)/PMZF_DZZ(:,:,IKB-1) & + + ZRHODJ_DFDDWDZ_O_DZ2(:,:,IKB) * PVARM(:,:,IKB+1)& + - ZRHODJ_DFDDWDZ_O_DZ2(:,:,IKB) * PVARM(:,:,IKB ) +! + ZY(:,:,IKB+1:IKE-1) = ZMZM_RHODJ(:,:,IKB+1:IKE-1)*PVARM(:,:,IKB+1:IKE-1)/PTSTEP & + - PRHODJ(:,:,IKB+1:IKE-1 ) * PF(:,:,IKB+1:IKE-1 )/PMZF_DZZ(:,:,IKB+1:IKE-1 ) & + + PRHODJ(:,:,IKB:IKE-2) * PF(:,:,IKB:IKE-2)/PMZF_DZZ(:,:,IKB:IKE-2) & + + ZRHODJ_DFDDWDZ_O_DZ2(:,:,IKB+1:IKE-1 ) * PVARM(:,:,IKB+2:IKE) & + - ZRHODJ_DFDDWDZ_O_DZ2(:,:,IKB+1:IKE-1 ) * PVARM(:,:,IKB+1:IKE-1 ) & + - ZRHODJ_DFDDWDZ_O_DZ2(:,:,IKB:IKE-2) * PVARM(:,:,IKB+1:IKE-1 ) & + + ZRHODJ_DFDDWDZ_O_DZ2(:,:,IKB:IKE-2) * PVARM(:,:,IKB:IKE-2) +! +ZY(:,:,IKE) = ZMZM_RHODJ(:,:,IKE)*PVARM(:,:,IKE)/PTSTEP & + - PRHODJ(:,:,IKE ) * PF(:,:,IKE )/PMZF_DZZ(:,:,IKE ) & + + PRHODJ(:,:,IKE-1) * PF(:,:,IKE-1)/PMZF_DZZ(:,:,IKE-1) & + - ZRHODJ_DFDDWDZ_O_DZ2(:,:,IKE ) * PVARM(:,:,IKE ) & + - ZRHODJ_DFDDWDZ_O_DZ2(:,:,IKE-1) * PVARM(:,:,IKE ) & + + ZRHODJ_DFDDWDZ_O_DZ2(:,:,IKE-1) * PVARM(:,:,IKE-1) +! +! +!* 3. INVERSION OF THE TRIDIAGONAL SYSTEM +! ----------------------------------- +! +! +!* 3.1 arrays A, B, C +! -------------- +! +!! a(k) = + PRHODJ(k-1) * PDFDDWDZ(k-1)/PMZF_DZZ(k-1)**2 +!! b(k) = (PRHODJ(k)+PRHODJ(k-1))/2. / PTSTEP +!! - PRHODJ(k) * PDFDDWDZ(k) /PMZF_DZZ(k)**2 +!! - PRHODJ(k-1) * PDFDDWDZ(k-1)/PMZF_DZZ(k-1)**2 +!! c(k) = + PRHODJ(k) * PDFDDWDZ(k)/PMZF_DZZ(k)**2 +! + ZB(:,:,IKB) = ZMZM_RHODJ(:,:,IKB)/PTSTEP & + - ZRHODJ_DFDDWDZ_O_DZ2(:,:,IKB) + ZC(:,:,IKB) = ZRHODJ_DFDDWDZ_O_DZ2(:,:,IKB) + + ZA(:,:,IKB+1:IKE-1) = ZRHODJ_DFDDWDZ_O_DZ2(:,:,IKB:IKE-2) + ZB(:,:,IKB+1:IKE-1) = ZMZM_RHODJ(:,:,IKB+1:IKE-1)/PTSTEP & + - ZRHODJ_DFDDWDZ_O_DZ2(:,:,IKB+1:IKE-1 ) & + - ZRHODJ_DFDDWDZ_O_DZ2(:,:,IKB:IKE-2) + ZC(:,:,IKB+1:IKE-1) = ZRHODJ_DFDDWDZ_O_DZ2(:,:,IKB+1:IKE-1 ) + + ZA(:,:,IKE) = ZRHODJ_DFDDWDZ_O_DZ2(:,:,IKE-1) + ZB(:,:,IKE) = ZMZM_RHODJ(:,:,IKE)/PTSTEP & + - ZRHODJ_DFDDWDZ_O_DZ2(:,:,IKE ) & + - ZRHODJ_DFDDWDZ_O_DZ2(:,:,IKE-1) +! +!* 3.2 going up +! -------- +! + ZBET(:,:) = ZB(:,:,IKB) ! bet = b(ikb) + PVARP(:,:,IKB) = ZY(:,:,IKB) / ZBET(:,:) + + ! + DO JK = IKB+1,IKE-1 + ZGAM(:,:,JK) = ZC(:,:,JK-1) / ZBET(:,:) + ! gam(k) = c(k-1) / bet + ZBET(:,:) = ZB(:,:,JK) - ZA(:,:,JK) * ZGAM(:,:,JK) + ! bet = b(k) - a(k)* gam(k) + PVARP(:,:,JK)= ( ZY(:,:,JK) - ZA(:,:,JK) * PVARP(:,:,JK-1) ) / ZBET(:,:) + ! res(k) = (y(k) -a(k)*res(k-1))/ bet + END DO + ! special treatment for the last level + ZGAM(:,:,IKE) = ZC(:,:,IKE-1) / ZBET(:,:) + ! gam(k) = c(k-1) / bet + ZBET(:,:) = ZB(:,:,IKE) - ZA(:,:,IKE) * ZGAM(:,:,IKE) + ! bet = b(k) - a(k)* gam(k) + PVARP(:,:,IKE)= ( ZY(:,:,IKE) - ZA(:,:,IKE) * PVARP(:,:,IKE-1) ) / ZBET(:,:) + ! res(k) = (y(k) -a(k)*res(k-1))/ bet +! +!* 3.3 going down +! ---------- +! + DO JK = IKE-1,IKB,-1 + PVARP(:,:,JK) = PVARP(:,:,JK) - ZGAM(:,:,JK+1) * PVARP(:,:,JK+1) + END DO +! +! +!* 4. FILL THE UPPER AND LOWER EXTERNAL VALUES +! ---------------------------------------- +! +PVARP(:,:,IKB-1)=PVARP(:,:,IKB) +PVARP(:,:,IKE+1)=0. +! +!------------------------------------------------------------------------------- +! +END SUBROUTINE TRIDIAG_W +! +END MODULE MODE_TRIDIAG_W diff --git a/src/common/turb/mode_turb_hor_dyn_corr.F90 b/src/common/turb/mode_turb_hor_dyn_corr.F90 index f652951dceaa4210f222fa08c0c99b2e925c72d7..aebed3a09af306ea458ed994f7e6d3add597588b 100644 --- a/src/common/turb/mode_turb_hor_dyn_corr.F90 +++ b/src/common/turb/mode_turb_hor_dyn_corr.F90 @@ -90,7 +90,7 @@ USE MODI_GRADIENT_W USE MODI_SHUMAN USE MODE_COEFJ, ONLY: COEFJ USE MODI_LES_MEAN_SUBGRID -USE MODI_TRIDIAG_W +USE MODE_TRIDIAG_W, ONLY: TRIDIAG_W ! USE MODI_SECOND_MNH USE MODE_MPPDB diff --git a/src/mesonh/aux/gradient_m.f90 b/src/mesonh/aux/gradient_m.f90 index 60e7ffa577571ed62fb3f0c88ed9d63cb843b42a..feb4c58f3910be0ba2ca717db206a06efcde2316 100644 --- a/src/mesonh/aux/gradient_m.f90 +++ b/src/mesonh/aux/gradient_m.f90 @@ -163,7 +163,7 @@ END MODULE MODI_GRADIENT_M !* 0. DECLARATIONS ! ! -USE MODI_SHUMAN +USE MODI_SHUMAN, ONLY: DXF, MZF, DZM, MXF, MXM USE MODD_CONF, ONLY:LFLAT ! IMPLICIT NONE @@ -419,17 +419,17 @@ END FUNCTION GZ_M_M !! a variable at a mass localization !! FUNCTION MXM: compute an average in the x direction for a variable !! at a mass localization -!! FUNCTION MZF: compute an average in the z direction for a variable +!! FUNCTION MZF: compute an average in the z direction for a variable !! at a flux side !! !! IMPLICIT ARGUMENTS -!! ------------------ +!! ------------------ !! MODD_CONF : LFLAT !! !! REFERENCE !! --------- !! Book2 of documentation (function GX_M_U) -!! +!! !! !! AUTHOR !! ------ @@ -437,7 +437,7 @@ END FUNCTION GZ_M_M !! !! MODIFICATIONS !! ------------- -!! Original 05/07/94 +!! Original 05/07/94 !! Modification 16/03/95 change the order of the arguments !! 19/07/00 add the LFLAT switch + inlining(J. Stein) !! 20/08/00 optimization (J. Escobar) @@ -458,7 +458,7 @@ IMPLICIT NONE INTEGER, INTENT(IN) :: KKA, KKU ! near ground and uppest atmosphere array indexes INTEGER, INTENT(IN) :: KL ! +1 if grid goes from ground to atmosphere top, -1 otherwise REAL, DIMENSION(:,:,:), INTENT(IN) :: PDXX ! d*xx -REAL, DIMENSION(:,:,:), INTENT(IN) :: PDZX ! d*zx +REAL, DIMENSION(:,:,:), INTENT(IN) :: PDZX ! d*zx REAL, DIMENSION(:,:,:), INTENT(IN) :: PDZZ ! d*zz ! REAL, DIMENSION(:,:,:), INTENT(IN) :: PY ! variable at mass @@ -469,7 +469,7 @@ INTEGER IIU,IKU,JI,JK ! INTEGER :: JJK,IJU INTEGER :: JIJK,JIJKOR,JIJKEND -INTEGER :: JI_1JK, JIJK_1, JI_1JK_1, JIJKP1, JI_1JKP1 +INTEGER :: JI_1JK, JIJK_1, JI_1JK_1, JIJKP1, JI_1JKP1 ! ! !------------------------------------------------------------------------------- @@ -480,7 +480,7 @@ INTEGER :: JI_1JK, JIJK_1, JI_1JK_1, JIJKP1, JI_1JKP1 IIU=SIZE(PY,1) IJU=SIZE(PY,2) IKU=SIZE(PY,3) -IF (.NOT. LFLAT) THEN +IF (.NOT. LFLAT) THEN ! PGX_M_U = ( DXM(PY) - MZF ( MXM( DZM(PY) /PDZZ ) * PDZX ) )/PDXX !! DO JK=1+JPVEXT_TURB,IKU-JPVEXT_TURB !! DO JI=1+JPHEXT,IIU @@ -520,7 +520,7 @@ IF (.NOT. LFLAT) THEN ! DO JI=1+JPHEXT,IIU - PGX_M_U(JI,:,KKU)= ( PY(JI,:,KKU)-PY(JI-1,:,KKU) ) / PDXX(JI,:,KKU) + PGX_M_U(JI,:,KKU)= ( PY(JI,:,KKU)-PY(JI-1,:,KKU) ) / PDXX(JI,:,KKU) PGX_M_U(JI,:,KKA)= PGX_M_U(JI,:,KKU) ! -999. END DO ELSE diff --git a/src/mesonh/aux/modd_io.f90 b/src/mesonh/aux/modd_io.f90 deleted file mode 100644 index c8457cc2d32624a020d122c41cb318faa86a1d4c..0000000000000000000000000000000000000000 --- a/src/mesonh/aux/modd_io.f90 +++ /dev/null @@ -1,159 +0,0 @@ -!MNH_LIC Copyright 1994-2021 CNRS, Meteo-France and Universite Paul Sabatier -!MNH_LIC This is part of the Meso-NH software governed by the CeCILL-C licence -!MNH_LIC version 1. See LICENSE, CeCILL-C_V1-en.txt and CeCILL-C_V1-fr.txt -!MNH_LIC for details. version 1. -!----------------------------------------------------------------- -! Modifications: -! P. Wautelet 05/2016-04/2018: new data structures and calls for I/O -! P. Wautelet 10/01/2019: use NEWUNIT argument of OPEN (removed ISTDOUT, ISTDERR, added NNULLUNIT, CNULLFILE) -! P. Wautelet 21/01/2019: add LIO_ALLOW_NO_BACKUP and LIO_NO_WRITE to modd_io_ll to allow to disable writes (for bench purposes) -! P. Wautelet 07/02/2019: force TYPE to a known value for IO_File_add2list -! P. Wautelet 12/03/2019: add TMAINFILE field in TFILEDATA -! P. Wautelet 17/01/2020: add 'BUD' category for Print_msg + corresponding namelist variables -! P. Wautelet 22/09/2020: add ldimreduced in tfiledata -! P. Wautelet 10/11/2020: new data structures for netCDF dimensions -!----------------------------------------------------------------- - -#define MNH_REDUCE_DIMENSIONS_IN_FILES 1 - -MODULE MODD_IO -! -use modd_netcdf, only: tdimsnc -USE MODD_PARAMETERS, ONLY: NDIRNAMELGTMAX, NFILENAMELGTMAX -use modd_precision, only: CDFINT, LFIINT -! -IMPLICIT NONE -! -! -INTEGER, PARAMETER :: NVERB_NO=0, NVERB_FATAL=1, NVERB_ERROR=2, NVERB_WARNING=3, NVERB_INFO=4, NVERB_DEBUG=5 - -INTEGER :: NNULLUNIT = -1 ! /dev/null fortran unit, value set in IO_Init -CHARACTER(LEN=*), PARAMETER :: CNULLFILE = "/dev/null" - -INTEGER, SAVE :: NIO_RANK ! Rank of IO process -INTEGER, SAVE :: ISP !! Actual proc number -INTEGER, SAVE :: ISNPROC !! Total number of allocated processes -LOGICAL, SAVE :: GSMONOPROC = .FALSE. !! True if sequential execution (ISNPROC = 1) - -LOGICAL, SAVE :: L1D = .FALSE. ! TRUE if 1D model version -LOGICAL, SAVE :: L2D = .FALSE. ! TRUE if 2D model version -LOGICAL, SAVE :: LPACK = .FALSE. ! TRUE if FM compression occurs in 1D or 2D model version - -LOGICAL, SAVE :: LIOCDF4 = .FALSE. ! TRUE will enable full NetCDF4 (HDF5) I/O support -LOGICAL, SAVE :: LLFIOUT = .FALSE. ! TRUE will also force LFI output when LIOCDF4 is on (debug only) -LOGICAL, SAVE :: LLFIREAD = .FALSE. ! TRUE will force LFI read (instead of NetCDF) when LIOCDF4 is on (debug only) - -LOGICAL, SAVE :: LVERB_OUTLST = .TRUE. ! TRUE will PRINT_MSG in OUTPUT_LISTINGn files -LOGICAL, SAVE :: LVERB_STDOUT = .FALSE. ! TRUE will also PRINT_MSG on standard output -LOGICAL, SAVE :: LVERB_ALLPRC = .FALSE. ! FALSE: only process 0 do PRINT_MSG, TRUE: all processes -INTEGER, SAVE :: NBUD_VERB = NVERB_INFO ! Verbosity level for budgets -INTEGER, SAVE :: NBUD_ABORT_LEVEL = NVERB_ERROR ! Level of budget error necessary to force stop of application -INTEGER, SAVE :: NIO_VERB = NVERB_INFO ! Verbosity level for IO -INTEGER, SAVE :: NIO_ABORT_LEVEL = NVERB_ERROR ! Level of IO error necessary to force stop of application - -INTEGER, SAVE :: NGEN_VERB = NVERB_INFO ! Verbosity level for 'GEN' (generic) messages -INTEGER, SAVE :: NGEN_ABORT_LEVEL = NVERB_ERROR ! Level of 'GEN' error necessary to force stop of application - -CHARACTER(LEN=NDIRNAMELGTMAX) :: CIO_DIR = '' ! Directory for IO - -logical, save :: LIO_ALLOW_NO_BACKUP = .false. ! Allow to have no valid backup time (useful for some tests) -logical, save :: LIO_NO_WRITE = .false. ! Disable file writes (useful for benchs) - -!Structure containing one pointer to a file -!Useful to create arrays of pointers to files -TYPE TFILE_ELT - TYPE(TFILEDATA),POINTER :: TFILE => NULL() -END TYPE TFILE_ELT - -!Structure describing the characteristics of an output or a backup -TYPE TOUTBAK - INTEGER :: NID = -1 !Backup number - INTEGER :: NSTEP !Timestep number - REAL :: XTIME !Time from start of the segment (in seconds and rounded to a timestep) - INTEGER :: NOUTDAD = -1 !Index of the corresponding dad file (file with same time) - TYPE(TFILEDATA),POINTER :: TFILE => NULL() !Corresponding file - TYPE(TFILE_ELT),DIMENSION(:),ALLOCATABLE :: TFILE_IOZ !Corresponding Z-split files - INTEGER,DIMENSION(:),POINTER :: NFIELDLIST => NULL() !List of the fields to read or write -END TYPE TOUTBAK - -!Structure describing the characteristics of a file -TYPE TFILEDATA - CHARACTER(LEN=NFILENAMELGTMAX) :: CNAME = '' !Filename - CHARACTER(LEN=:),ALLOCATABLE :: CDIRNAME !Directory name - CHARACTER(LEN=13) :: CTYPE = "UNKNOWN" !Filetype (PGD, MNH, DES, NML...) - CHARACTER(LEN=7) :: CFORMAT = "UNKNOWN" !Fileformat (NETCDF4, LFI, LFICDF4...) - CHARACTER(LEN=7) :: CMODE = "UNKNOWN" !Opening mode (read, write...) - LOGICAL :: LOPENED = .FALSE. !Is the file opened - INTEGER :: NOPEN_CURRENT = 0 !Number of times the file is currently opened (several opens without close are allowed) - INTEGER :: NOPEN = 0 !Number of times the file has been opened (during the current execution) - INTEGER :: NCLOSE = 0 !Number of times the file has been closed (during the current execution) - ! - INTEGER :: NMASTER_RANK = -1 !Rank of the master process (no meaning if LMULTIMASTERS=.T.) - INTEGER :: NMPICOMM = -1 !MPI communicator used for IO on this file - LOGICAL :: LMASTER = .FALSE. !True if process is master of the file (process that open/read/write/close) - LOGICAL :: LMULTIMASTERS = .FALSE. !True if several processes may access the file -#if ( MNH_REDUCE_DIMENSIONS_IN_FILES == 1 ) - logical :: ldimreduced = .true. !True if number of dimensions of fields can be reduced (for 2D simulations) -#else - logical :: ldimreduced = .false. !True if number of dimensions of fields can be reduced (for 2D simulations) -#endif - ! - INTEGER :: NSUBFILES_IOZ = 0 !Number of sub-files (Z-split files based on this file) - !For example if 2 sub-files and this file is abcd, - !the 2 sub-files are abcd.Z001 and abcd.Z002 - TYPE(TFILE_ELT),DIMENSION(:),ALLOCATABLE :: TFILES_IOZ !Corresponding Z-split files - ! - INTEGER :: NMODEL = 0 !Model number corresponding to the file (field not always set) - INTEGER,DIMENSION(3) :: NMNHVERSION = (/0,0,0/) !MesoNH version used to create the file - ! -#ifdef MNH_IOLFI - ! Fields for LFI files - INTEGER(KIND=LFIINT) :: NLFININAR = 0 !Number of articles of the LFI file (only accurate if file opened in read mode) - INTEGER(KIND=LFIINT) :: NLFINPRAR = 0 !Number of predicted articles of the LFI file (non crucial) - INTEGER :: NLFITYPE = -1 !Type of the file (used to generate list of files to transfers) - INTEGER :: NLFIVERB = 1 !LFI verbosity level - INTEGER(KIND=LFIINT) :: NLFIFLU = -1 !File identifier -#endif - ! -#ifdef MNH_IOCDF4 - ! Fields for netCDF files - INTEGER(KIND=CDFINT) :: NNCID = -1 !File identifier (corresponding to the actual group) - INTEGER(KIND=CDFINT) :: NNCNAR = 0 !Number of articles of the netCDF file (only accurate if file opened in read mode) - LOGICAL :: LNCREDUCE_FLOAT_PRECISION = .FALSE. ! Reduce the precision of floats to single precision - ! instead of double precision - LOGICAL :: LNCCOMPRESS = .FALSE. ! Do compression on fields - INTEGER(KIND=CDFINT) :: NNCCOMPRESS_LEVEL = 0 ! Compression level - type(tdimsnc), pointer :: tncdims => Null() ! Dimensions of netCDF file -#endif - ! - !Fields for other files - INTEGER :: NLU = -1 !Logical unit number - INTEGER :: NRECL = -1 !Fortran RECL (record length) - CHARACTER(LEN=11) :: CFORM = "UNKNOWN" !Fortran FORM (FORMATTED/UNFORMATTED) - CHARACTER(LEN=10) :: CACCESS = "UNKNOWN" !Fortran ACCESS (DIRECT/SEQUENTIAL/STREAM) - ! - TYPE(TFILEDATA),POINTER :: TDADFILE => NULL() !Corresponding dad file - TYPE(TFILEDATA),POINTER :: TDESFILE => NULL() !Corresponding .des file - TYPE(TFILEDATA),POINTER :: TDATAFILE => NULL() !Corresponding data file (if .des file) - TYPE(TFILEDATA),POINTER :: TMAINFILE => NULL() !Corresponding main file if the file is an sub-file - ! - TYPE(TFILEDATA),POINTER :: TFILE_PREV => NULL() - TYPE(TFILEDATA),POINTER :: TFILE_NEXT => NULL() -END TYPE TFILEDATA - -!Structure containing a pointer to a file (useful to create arrays of pointers to files) -TYPE TPTR2FILE - TYPE(TFILEDATA),POINTER :: TZFILE => NULL() -END TYPE - -TYPE(TFILEDATA),POINTER,SAVE :: TFILE_FIRST => NULL() -TYPE(TFILEDATA),POINTER,SAVE :: TFILE_LAST => NULL() - -TYPE(TFILEDATA),POINTER,SAVE :: TFILE_SURFEX => NULL() !Pointer used to find the file used when writing SURFEX fields in write_surf_mnh.f90 - -TYPE(TFILEDATA),POINTER,SAVE :: TFILE_OUTPUTLISTING => NULL() !Pointer used to point to the file used when writing to OUTPUT_LISTINGn file - -!Non existing file which can be used as a dummy target -TYPE(TFILEDATA),TARGET, SAVE :: TFILE_DUMMY = TFILEDATA(CNAME="dummy",CDIRNAME=NULL(),TFILES_IOZ=NULL()) - -END MODULE MODD_IO diff --git a/src/mesonh/aux/modd_parameters.f90 b/src/mesonh/aux/modd_parameters.f90 deleted file mode 100644 index 1fffa21efafab090585b757bec9603d4abf40d21..0000000000000000000000000000000000000000 --- a/src/mesonh/aux/modd_parameters.f90 +++ /dev/null @@ -1,98 +0,0 @@ -!MNH_LIC Copyright 1994-2020 CNRS, Meteo-France and Universite Paul Sabatier -!MNH_LIC This is part of the Meso-NH software governed by the CeCILL-C licence -!MNH_LIC version 1. See LICENSE, CeCILL-C_V1-en.txt and CeCILL-C_V1-fr.txt -!MNH_LIC for details. version 1. -!----------------------------------------------------------------- -! ###################### - MODULE MODD_PARAMETERS -! ###################### -! -!!**** *MODD_PARAMETERS* - declaration of parameter variables -!! -!! PURPOSE -!! ------- -! The purpose of this declarative module is to specify the variables -! which have the PARAMETER attribute -! -!! -!!** IMPLICIT ARGUMENTS -!! ------------------ -!! None -!! -!! REFERENCE -!! --------- -!! Book2 of documentation of Meso-NH (module MODD_PARAMETER) -!! -!! AUTHOR -!! ------ -!! V. Ducrocq *Meteo France* -!! -!! MODIFICATIONS -!! ------------- -!! Original 4/07/94 -!! Modification 10/03/95 (I.Mallet) add the coupling files maximum number -!! Modification 10/04/95 (Ph. Hereil) add the budget related informations -!! Modification 15/03/99 (V. Masson) add default value -!! Modification 17/11/00 (P.Jabouille) add the dummy array size -!! Modification 22/01/01 (D.Gazen) change JPSVMAX from 100 to 200 -!! and JPBUMAX from 120 to 250 -!! Modification 17/05/04 (P.Jabouille) add JPOUTMAX -!! J.Escobar : 15/09/2015 : WENO5 & JPHEXT <> 1 -!! B.VIE 2016 LIMA -! P. Wautelet: 05/2016-04/2018: new data structures and calls for I/O -! Q. Rodier 29/03/2019: increase maximum number of outputs to 999 -! P. Wautelet 17/01/2020: add NBUNAMELGTMAX and NCOMMENTLGTMAX parameters -! P. Wautelet 13/03/2020: remove JPBUMAX and JPBUPROMAX -!------------------------------------------------------------------------------- -! -!* 0. DECLARATIONS -! ------------ -! -IMPLICIT NONE -! -!JUAN CYCLK -!INTEGER, PARAMETER :: JPHEXT = 3 ! Horizontal External points number -INTEGER,SAVE :: JPHEXT = 1 ! Horizontal External points number -! -!JUAN CYCLK -INTEGER, PARAMETER :: JPVEXT = 1 ! Vertical External points number -INTEGER, PARAMETER :: JPVEXT_TURB = 1 ! Vertical External points number -INTEGER, PARAMETER :: JPMODELMAX = 8 ! Maximum allowed number of nested models -INTEGER, PARAMETER :: JPCPLFILEMAX = 24 ! Maximum allowed number of CouPLing FILEs -INTEGER, PARAMETER :: JPRIMMAX = 6 ! Maximum number of points for the - ! horizontal relaxation for the outermost verticals -INTEGER, PARAMETER :: JPSVMAX = 200 ! Maximum number of scalar variables -INTEGER, PARAMETER :: JPSVNAMELGTMAX = 10 ! Maximum length of a scalar variable name (do not set to less than 10) -! -! -REAL, PARAMETER :: XUNDEF = 999. ! default value for undefined or unused -! ! field. -REAL, PARAMETER :: XNEGUNDEF = -999. ! default value for undefined or unused -! ! field (negative value guaranteed) -INTEGER, PARAMETER :: NUNDEF = 999 ! default value for undefined or unused -! ! field. -INTEGER, PARAMETER :: NNEGUNDEF = -999 ! default value for undefined or unused -! ! field (negative value guaranteed) -INTEGER, PARAMETER :: JPDUMMY = 20 ! Size of dummy array -! -INTEGER, PARAMETER :: JPOUTMAX = 999 ! Maximum allowed number of OUTput files -INTEGER, PARAMETER :: JPOUTVARMAX = 192 ! Maximum allowed number of variables in an output file -! -INTEGER, PARAMETER :: NBUNAMELGTMAX = 32 ! Maximum length of a budget name -INTEGER, PARAMETER :: NCOMMENTLGTMAX = 100 ! Maximum length of a comment -INTEGER, PARAMETER :: NMNHNAMELGTMAX = 32 ! Maximum length of a MNH variable name -INTEGER, PARAMETER :: NSTDNAMELGTMAX = 64 ! Maximum length of the standard name of a variable (CF convention) -! -INTEGER, PARAMETER :: NDIRNAMELGTMAX = 512 ! Maximum length of a directory name -INTEGER, PARAMETER :: NFILENAMELGTMAX = 32 ! Maximum length of a file name (must be at least NFILENAMELGTMAXLFI) -INTEGER, PARAMETER :: NFILENAMELGTMAXLFI = 28 ! Maximum length of a file name in LFI file (this is necessary - ! to keep backward compatibility), MUST BE 28 -! -INTEGER, PARAMETER :: NLFIMAXCOMMENTLENGTH = 100 ! Length of comments in LFI files -! -INTEGER, PARAMETER :: JPLIMACCNMAX = 10 ! Maximum allowed number of CCN modes in LIMA -INTEGER, PARAMETER :: JPLIMAIFNMAX = 10 ! Maximum allowed number of IFN modes in LIMA -! -INTEGER, PARAMETER :: NGRIDUNKNOWN = -1 ! Unknown Arakawa grid number -! -END MODULE MODD_PARAMETERS diff --git a/src/mesonh/filesToSuppress.txt b/src/mesonh/filesToSuppress.txt new file mode 100644 index 0000000000000000000000000000000000000000..547d2de21002c8549b9e2b060884dcd8468b4d0e --- /dev/null +++ b/src/mesonh/filesToSuppress.txt @@ -0,0 +1,35 @@ +#This file contains the source codes that must not be included +#for the model compilation. These codes already exist in the Meso-NH model +#and are used outside of the physics + +aux/mode_msg.f90 +aux/modd_io.f90 +aux/modd_field.f90 +aux/modd_argslist_ll.f90 +aux/modd_frc.f90 +aux/modd_ibm_paramn.f90 +aux/modd_oceanh.f90 +aux/modd_parameters.f90 +aux/modd_precision.f90 +aux/modd_ref.f90 +aux/mode_gather_ll.f90 +aux/mode_io_field_write.f90 +aux/mode_ll.f90 +aux/mode_argslist_ll.f90 +aux/mode_mppdb.f90 +aux/mode_sources_neg_correct.f90 +aux/get_halo.f90 +aux/ibm_mixinglength.f90 +aux/modi_shuman.f90 +aux/mode_budget.f90 +aux/modi_second_mnh.f90 +aux/second_mnh.f90 +aux/modi_gradient_m.f90 + +#To be un-commented when the PHYEX version will be merged into the Meso-NH code +#aux/mode_thermo.f90 +#aux/shuman.f90 +#aux/gradient_m.f90 +#aux/gradient_u.f90 +#aux/gradient_v.f90 +#aux/gradient_w.f90