From 148056ca76d51a04edb8a492952ef5b15ec801ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Riette?= <sebastien.riette@meteo.fr> Date: Thu, 30 Jun 2022 12:15:31 +0200 Subject: [PATCH] Add rain_ice testprogs, some cleaning --- .gitignore | 6 ++- INSTALL | 4 ++ INSTALL_testprogs | 12 +++--- README.md | 21 +++++---- TODO | 4 -- Tools/Frame.pm | 68 ------------------------------ check_commit_testprogs.sh | 4 +- conf_tests/small_3D/aro48t1.sh | 1 + diffNODE.001_01 | 63 ++++++++++++++++++++++++++- testprogs_data/ice_adjust/.gitkeep | 0 testprogs_data/rain_ice/.gitkeep | 0 testprogs_data/shallow_mf/.gitkeep | 0 testprogs_data/turb/.gitkeep | 0 update_from_sxphynh.sh | 9 ---- 14 files changed, 91 insertions(+), 101 deletions(-) delete mode 100644 TODO delete mode 100644 Tools/Frame.pm create mode 100644 testprogs_data/ice_adjust/.gitkeep create mode 100644 testprogs_data/rain_ice/.gitkeep create mode 100644 testprogs_data/shallow_mf/.gitkeep create mode 100644 testprogs_data/turb/.gitkeep delete mode 100755 update_from_sxphynh.sh diff --git a/.gitignore b/.gitignore index 5c4526868..2d965cb2b 100644 --- a/.gitignore +++ b/.gitignore @@ -7,8 +7,10 @@ !/mnh_expand/.gitkeep # Ignore the content of testprogs_data but not the directory itself -/testprogs_data/** -!/testprogs_data/.gitkeep +/testprogs_data/ice_adjust/** +/testprogs_data/rain_ice/** +!/testprogs_data/ice_adjust/.gitkeep +!/testprogs_data/rain_ice/.gitkeep # Ignore vim swapp files .*.swp diff --git a/INSTALL b/INSTALL index 3b21b97b7..8e988c4f2 100644 --- a/INSTALL +++ b/INSTALL @@ -12,3 +12,7 @@ Some installations are needed: 3) MNH_EXPAND This tool is composed of two parts: the filepp software, and the MNH_Expand_Array package. Installation is described in ** INSTALL_mnh_expand ** + +4) TESTPROGS REFERENCE DATA + The script check\_commit\_testprogs.sh needs reference data. + The data generation is explained in ** INSTALL_testprogs ** diff --git a/INSTALL_testprogs b/INSTALL_testprogs index bbeb43f46..7d63812c1 100644 --- a/INSTALL_testprogs +++ b/INSTALL_testprogs @@ -1,8 +1,6 @@ -Testprogs data on sxphynh +The testprogs_data directory must be filled by reference data. +These data are generated according to the description provided in the Offline documentation. -cd testprogs_data -mkdir ice_adjust -cd ice_adjust -git clone git@github.com:pmarguinaud/ice_adjust.git -mv ice_adjust/data/* . -rm -rf ice_adjust/ +The check_commit_testprogs.sh script will run offline simulations in the directory given +by the environment variable TESTPROGSDIR ($HOME/TESTPROGS will be used if the variable is not set). +This directory must exist. diff --git a/README.md b/README.md index b9629700f..55c75db89 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,16 @@ -# PHYEX_tools +# PHYEX\_tools This package contains tools related to the PHYEX package (https://github.com/QuentinRodier/PHYEX). -Specifically, the prep_code.sh scripts prepare the source code for inclusion in the compilation machinery +Specifically, the prep\_code.sh scripts prepare the source code for inclusion in the compilation machinery of the different models. -And, the check_commit_ial.sh script compiles, executes IAL test cases and compares the results againts a reference simulation. +And, the check\_commit\_ial.sh script compiles, executes IAL test cases and compares the results againts a reference simulation. -Moreover, the check_commit_mesonh.sh script compiles, executes a test case and compares the results againts a reference simulation. +Moreover, the check\_commit\_mesonh.sh script compiles, executes a test case and compares the results againts a reference simulation. + +The check\_commit\_testprogs.sh does the same for the offline test programs. + +verify\_mnh\_expand.py checks the conformace of the code regarding mnh\_expand directives. ## Installation @@ -14,9 +18,10 @@ Instructions can be found in INSTALL file. ## Usage -Help on check_commit_ial.sh, check_commit_mesonh.sh and prep_code.sh can be printed with the '-h' option. +Help on check\_commit\_ial.sh, check\_commit\_mesonh.sh, check\_commit\_testprogs.sh, +verify\_mnh\_expand.py and prep\_code.sh can be printed with the '-h' option. -For check_commit_mesonh.sh the following environment variables can be set: +For check\_commit\_mesonh.sh the following environment variables can be set: * MNHPACK: directory in which MNH pack will be created (default is $HOME/MesoNH/PHYEX) -* REFDIR: directory in which reference pack can be found (default is the pack directory near the check_commit_mesonh.sh file) -* TARGZDIR: directory in which the tar.gz file can be found (default is the pack directory near the check_commit_mesonh.sh file) +* REFDIR: directory in which reference pack can be found (default is the pack directory near the check\_commit\_mesonh.sh file) +* TARGZDIR: directory in which the tar.gz file can be found (default is the pack directory near the check\_commit\_mesonh.sh file) diff --git a/TODO b/TODO deleted file mode 100644 index 3e2e3c2bd..000000000 --- a/TODO +++ /dev/null @@ -1,4 +0,0 @@ -Supprimer répertoire Tools en modifiant le script diffNODE.001_01 -Déplacer les scripts dans un répertoire -Activer le cas ARMCU -Rendre le cas big_3D utilisable sur taranis diff --git a/Tools/Frame.pm b/Tools/Frame.pm deleted file mode 100644 index 22e34c840..000000000 --- a/Tools/Frame.pm +++ /dev/null @@ -1,68 +0,0 @@ -package Tools::Frame; - -use strict; -use base qw (Exporter); -our @EXPORT = qw (frame); - -sub frame -{ - my ($t, $width, $border) = @_; - my $len = length ($t); - - $border = 1 unless (defined ($border)); - - my $S = ' '; - - my ($C, $V, $H) = ('*', '|', '-'); - - ($C, $V, $H) = (' ', ' ', ' ') - unless ($border); - - my $df = 3; - $width ||= $len + 2 * $df; - - my $line1 = $C . ($H x ($width-2)) . $C; - my $line2 = $V . ($S x ($width-2)) . $V; - - - my $TEXT = ''; - - $TEXT .= "$line1\n"; - for (1 .. ($df-1)/2) - { - $TEXT .= "$line2\n"; - } - - die ("Cannot frame text: `$t'\n") - if ($width - 2 * $df <= 0); - - while ($t) - { - my $s = substr ($t, 0, $width - 2 * $df, ''); - - my $i = 0; - while (length ($s) < $width - 2 * $df) - { - if ($i % 2) - { - $s = " $s"; - } - else - { - $s = "$s "; - } - $i++; - } - my $linet = $V . ($S x ($df-1)) . $s . ($S x ($df-1)) . $V; - $TEXT .= "$linet\n"; - } - - for (1 .. ($df-1)/2) - { - $TEXT .= "$line2\n"; - } - $TEXT .= "$line1\n"; -} - - -1; diff --git a/check_commit_testprogs.sh b/check_commit_testprogs.sh index ec7c0c100..46cca3aad 100755 --- a/check_commit_testprogs.sh +++ b/check_commit_testprogs.sh @@ -10,7 +10,7 @@ set -e #ice_adjust: the ice adjust test case specialName="ref" -availTests="ice_adjust" +availTests="ice_adjust,rain_ice" defaultTest='ALL' separator='_' #- seprator must be in sync with prep_code.sh separator @@ -82,7 +82,7 @@ while [ -n "$1" ]; do shift done -TESTDIR=${TESTDIR:=$HOME/TESTPROGS} +TESTDIR=${TESTPROGSDIR:=$HOME/TESTPROGS} function exescript () { #usage: exescript <output file> <script> [arg [arg ...]] diff --git a/conf_tests/small_3D/aro48t1.sh b/conf_tests/small_3D/aro48t1.sh index c459620a2..e4dee94ab 100755 --- a/conf_tests/small_3D/aro48t1.sh +++ b/conf_tests/small_3D/aro48t1.sh @@ -1189,6 +1189,7 @@ ls # cp PFFPOS000+0000 $WAIT_QUEUE/PFFPOS000+0000.$PBS_JOBID #fi cp lola NODE.001_01 ICMSHFPOS+00* DHFDLFPOS+00* $OUTPUTDIR/ +mv *.dat $OUTPUTDIR/ /bin/rm fort.4 EXSEG1.nam lola ICMSHFPOS+0000* PFFPOSFRANGP0025+0000* ICMSHFPOS+0001* /bin/rm PFFPOSFRANGP0025+0001* ICMSHFPOS+0002* ECHIS PFFPOSFRANGP0025+0002* DHFDLFPOS+00* /bin/rm ECHFP NODE.001_01 ifs.stat $(tar tfz $rekchemin/data/rtm/radiation_params.47r1_light.tgz) diff --git a/diffNODE.001_01 b/diffNODE.001_01 index 83c6fa6be..d33640104 100755 --- a/diffNODE.001_01 +++ b/diffNODE.001_01 @@ -4,7 +4,8 @@ use strict; use FindBin qw ($Bin); use lib $Bin; use FileHandle; -use Tools::Frame; +#Frame was inlined in this script +#use Tools::Frame; use Data::Dumper; use POSIX qw (floor); use Getopt::Long; @@ -16,6 +17,66 @@ my %opts = ( 'jo-max-diff' => .030000, ); +sub frame +{ + my ($t, $width, $border) = @_; + my $len = length ($t); + + $border = 1 unless (defined ($border)); + + my $S = ' '; + + my ($C, $V, $H) = ('*', '|', '-'); + + ($C, $V, $H) = (' ', ' ', ' ') + unless ($border); + + my $df = 3; + $width ||= $len + 2 * $df; + + my $line1 = $C . ($H x ($width-2)) . $C; + my $line2 = $V . ($S x ($width-2)) . $V; + + + my $TEXT = ''; + + $TEXT .= "$line1\n"; + for (1 .. ($df-1)/2) + { + $TEXT .= "$line2\n"; + } + + die ("Cannot frame text: `$t'\n") + if ($width - 2 * $df <= 0); + + while ($t) + { + my $s = substr ($t, 0, $width - 2 * $df, ''); + + my $i = 0; + while (length ($s) < $width - 2 * $df) + { + if ($i % 2) + { + $s = " $s"; + } + else + { + $s = "$s "; + } + $i++; + } + my $linet = $V . ($S x ($df-1)) . $s . ($S x ($df-1)) . $V; + $TEXT .= "$linet\n"; + } + + for (1 .. ($df-1)/2) + { + $TEXT .= "$line2\n"; + } + $TEXT .= "$line1\n"; +} + sub xave { diff --git a/testprogs_data/ice_adjust/.gitkeep b/testprogs_data/ice_adjust/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/testprogs_data/rain_ice/.gitkeep b/testprogs_data/rain_ice/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/testprogs_data/shallow_mf/.gitkeep b/testprogs_data/shallow_mf/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/testprogs_data/turb/.gitkeep b/testprogs_data/turb/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/update_from_sxphynh.sh b/update_from_sxphynh.sh deleted file mode 100755 index cc1d53de0..000000000 --- a/update_from_sxphynh.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash - -touch /scratch/work/riette/202005_externalisation_physique/update_from_sxphynh.sh - -for file in check_commit_ial.sh comp_DDH.py diffNODE.001_01 Tools prep_code.sh conf_tests update_from_sxphynh.sh env.sh; do - rsync -rltp --delete --timeout=30 \ - sxphynh.cnrm.meteo.fr:/cnrm/phynh/data1/riette/DATA/202005_externalisation_physique/$file \ - /scratch/work/riette/202005_externalisation_physique/ -done -- GitLab