Changeset 5159 for LMDZ6/branches/Amaury_dev/libf/grid/dimension
- Timestamp:
- Aug 2, 2024, 9:58:25 PM (6 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
LMDZ6/branches/Amaury_dev/libf/grid/dimension/makdim
r5099 r5159 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 > $fichdim55 ! -----------------------------------------------------------------------56 ! INCLUDE 'dimensions.h'44 cat << EOF > "$fichdim" 45 ! This module was automatically generated during the installation of LMDZ 46 ! It contains the spatial resolution of the model 57 47 58 ! dimensions.h contient les dimensions du modele 59 ! ndm est tel que iim=2**ndm 60 !----------------------------------------------------------------------- 48 MODULE lmdz_dimensions 49 IMPLICIT NONE; PRIVATE 50 PUBLIC iim, jjm, llm, ndm 51 ! ndm is computed such that iim=2**ndm 61 52 62 INTEGER iim,jjm,llm,ndm 63 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 lmdz_dimensions 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' lmdz_dimensions.f90 file (if any) and replace it with new one 59 if [[ -f ../lmdz_dimensions.f90 ]]; then 60 rm ../lmdz_dimensions.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" lmdz_dimensions.f90 ) 63 # line above is a trick to preserve time of creation of lmdz_dimensions.f90 files
Note: See TracChangeset
for help on using the changeset viewer.