Ignore:
Timestamp:
Aug 2, 2024, 9:58:25 PM (7 weeks ago)
Author:
abarral
Message:

Put dimensions.h and paramet.h into modules

Location:
LMDZ6/branches/Amaury_dev/libf/grid
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • LMDZ6/branches/Amaury_dev/libf/grid/dimension/makdim

    r5099 r5159  
    11#!/bin/bash
    2 #set -xv
     2set -eu
    33
    44# sanity check: do we have the required argument ?
    5 if (( $# < 1 )) || (( $# > 3 ))
    6 then
     5if (( $# < 1 )) || (( $# > 3 )); then
    76    echo "Wrong number of parameters in $0 !!!"
    87    echo " Usage:"
     
    1211fi
    1312
    14 if ( (( $1 % 8 != 0 )) && (( $# == 3 )) || (( $1 == 1 )) )
    15 then
     13if ( (( $1 % 8 != 0 )) && (( $# == 3 )) || (( $1 == 1 )) ); then
    1614    echo "The number of longitudes must be a multiple of 8."
    1715    echo "See the files dyn3d/groupe.F and dyn3dmem/groupe_loc.F."
     
    2018
    2119# build "fichnom", the relevant 'dimensions.im.jm.lm' file name
    22 for i in $*
    23 do
    24     list=$list.$i
    25 done
     20list=""
     21for i in "$@"; do list=$list.$i; done
    2622fichdim=dimensions${list}
    2723
    28 if [ ! -f $fichdim ]
    29 then
    30 #    echo "$fichdim does not exist"
    31 
     24if [[ ! -f $fichdim ]]; then
    3225    # assign values of im, jm and lm
    33     if [ $# -ge 3 ]
    34     then
     26    if [ $# -ge 3 ]; then
    3527        im=$1
    3628        jm=$2
    3729        lm=$3
    3830        ndm=1
    39     elif [ $# -ge 2 ]
    40     then
     31    elif [ $# -ge 2 ]; then
    4132        im=1
    4233        jm=$1
    4334        lm=$2
    4435        ndm=1
    45     elif [ $# -ge 1 ]
    46     then
     36    elif [ $# -ge 1 ]; then
    4737        im=1
    4838        jm=1
     
    5242
    5343# since the file doesn't exist, we create it
    54     cat << EOF > $fichdim
    55 !-----------------------------------------------------------------------
    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
    5747
    58 !   dimensions.h contient les dimensions du modele
    59 !   ndm est tel que iim=2**ndm
    60 !-----------------------------------------------------------------------
     48MODULE lmdz_dimensions
     49  IMPLICIT NONE; PRIVATE
     50  PUBLIC iim, jjm, llm, ndm
     51  ! ndm is computed such that iim=2**ndm
    6152
    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
     54END MODULE lmdz_dimensions
    6755EOF
    68 
    6956fi
    7057
    71 # remove 'old' dimensions.h file (if any) and replace it with new one
    72 if [ -f ../dimensions.h ] ; then
    73     \rm ../dimensions.h
     58# remove 'old' lmdz_dimensions.f90 file (if any) and replace it with new one
     59if [[ -f ../lmdz_dimensions.f90 ]]; then
     60    rm ../lmdz_dimensions.f90
    7461fi
    75 tar cf - $fichdim | ( cd .. ; tar xf - ; mv $fichdim dimensions.h )
    76 # line above is a trick to preserve time of creation of dimensions.h files
     62tar 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
  • LMDZ6/branches/Amaury_dev/libf/grid/lmdz_fxy_new.f90

    r5122 r5159  
    44  USE comconst_mod, ONLY: pi
    55  USE serre_mod, ONLY: pxo, pyo, alphax, alphay, transx, transy
     6  USE lmdz_dimensions, ONLY: iim, jjm, llm, ndm
     7  USE lmdz_paramet
    68  IMPLICIT NONE; PRIVATE
    79  PUBLIC fx, fxprim, fy, fyprim
    8   INCLUDE "dimensions.h"
    9   INCLUDE "paramet.h"
     10
     11
    1012CONTAINS
    1113  REAL FUNCTION ripx(ri)
  • LMDZ6/branches/Amaury_dev/libf/grid/lmdz_fxy_prim.f90

    r5123 r5159  
    33MODULE lmdz_fxy_prim
    44  USE comconst_mod, ONLY: pi
     5  USE lmdz_dimensions, ONLY: iim, jjm, llm, ndm
    56  IMPLICIT NONE; PRIVATE
    67  PUBLIC fx, fxprim, fy, fyprim
    7   INCLUDE "dimensions.h"
     8
    89CONTAINS
    910
  • LMDZ6/branches/Amaury_dev/libf/grid/lmdz_fxy_reg.f90

    r5122 r5159  
    33MODULE lmdz_fxy_reg
    44  USE comconst_mod, ONLY: pi
     5  USE lmdz_dimensions, ONLY: iim, jjm, llm, ndm
    56  IMPLICIT NONE; PRIVATE
    67  PUBLIC fx, fxprim, fy, fyprim
    7   INCLUDE "dimensions.h"
     8
    89CONTAINS
    910
  • LMDZ6/branches/Amaury_dev/libf/grid/lmdz_fxy_sin.f90

    r5123 r5159  
    33MODULE lmdz_fxy_sin
    44  USE comconst_mod, ONLY: pi
     5  USE lmdz_dimensions, ONLY: iim, jjm, llm, ndm
    56  IMPLICIT NONE; PRIVATE
    67  PUBLIC fx, fxprim, fy, fyprim
    7   INCLUDE "dimensions.h"
     8
    89CONTAINS
    910
Note: See TracChangeset for help on using the changeset viewer.