Changeset 5271 for LMDZ6/trunk/libf/grid/dimension/makdim
- Timestamp:
- Oct 24, 2024, 4:25:39 PM (5 weeks ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
LMDZ6/trunk/libf/grid/dimension/makdim
r4554 r5271 1 1 #!/bin/bash 2 #set -xv 2 set -eu 3 3 4 4 # sanity check: do we have the required argument ? 5 if (( $# < 1 )) || (( $# > 3 )) 6 then 5 if (( $# < 1 )) || (( $# > 3 )); then 7 6 echo "Wrong number of parameters in $0 !!!" 8 7 echo " Usage:" … … 12 11 fi 13 12 14 if ( (( $1 % 8 != 0 )) && (( $# == 3 )) || (( $1 == 1 )) ) 15 then 13 if ( (( $1 % 8 != 0 )) && (( $# == 3 )) || (( $1 == 1 )) ); then 16 14 echo "The number of longitudes must be a multiple of 8." 17 15 echo "See the files dyn3d/groupe.F and dyn3dmem/groupe_loc.F." … … 20 18 21 19 # build "fichnom", the relevant 'dimensions.im.jm.lm' file name 22 for i in $* 23 do 24 list=$list.$i 25 done 20 list="" 21 for i in "$@"; do list=$list.$i; done 26 22 fichdim=dimensions${list} 27 23 28 if [ ! -f $fichdim ] 29 then 30 # echo "$fichdim does not exist" 31 24 if [[ ! -f $fichdim ]]; then 32 25 # assign values of im, jm and lm 33 if [ $# -ge 3 ] 34 then 26 if [ $# -ge 3 ]; then 35 27 im=$1 36 28 jm=$2 37 29 lm=$3 38 30 ndm=1 39 elif [ $# -ge 2 ] 40 then 31 elif [ $# -ge 2 ]; then 41 32 im=1 42 33 jm=$1 43 34 lm=$2 44 35 ndm=1 45 elif [ $# -ge 1 ] 46 then 36 elif [ $# -ge 1 ]; then 47 37 im=1 48 38 jm=1 … … 52 42 53 43 # since the file doesn't exist, we create it 54 cat << EOF > $fichdim 55 !----------------------------------------------------------------------- 56 ! INCLUDE 'dimensions.h' 57 ! 58 ! dimensions.h contient les dimensions du modele 59 ! ndm est tel que iim=2**ndm 60 !----------------------------------------------------------------------- 44 cat << EOF > "$fichdim" 45 ! This module was automatically generated during the installation of LMDZ 46 ! It contains the spatial resolution of the model 61 47 62 INTEGER iim,jjm,llm,ndm 48 MODULE dimensions_mod 49 IMPLICIT NONE; PRIVATE 50 PUBLIC iim, jjm, llm, ndm 51 ! ndm is computed such that iim=2**ndm 63 52 64 PARAMETER (iim= $im,jjm=$jm,llm=$lm,ndm=$ndm) 65 66 !----------------------------------------------------------------------- 53 INTEGER, PARAMETER :: iim = $im, jjm = $jm, llm = $lm, ndm = $ndm 54 END MODULE dimensions_mod 67 55 EOF 68 69 56 fi 70 57 71 # remove 'old' dimensions .hfile (if any) and replace it with new one72 if [ -f ../dimensions.h ]; then73 \rm ../dimensions.h58 # remove 'old' dimensions_mod.f90 file (if any) and replace it with new one 59 if [[ -f ../dimensions_mod.f90 ]]; then 60 rm ../dimensions_mod.f90 74 61 fi 75 tar cf - $fichdim | ( cd .. ; tar xf - ; mv $fichdim dimensions.h)76 # line above is a trick to preserve time of creation of dimensions .hfiles62 tar cf - "$fichdim" | ( cd .. ; tar xf - ; mv "$fichdim" dimensions_mod.f90 ) 63 # line above is a trick to preserve time of creation of dimensions_mod.f90 files
Note: See TracChangeset
for help on using the changeset viewer.