New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
fait_config in branches/CMIP5_IPSL/UTIL – NEMO

source: branches/CMIP5_IPSL/UTIL/fait_config @ 3439

Last change on this file since 3439 was 3405, checked in by cetlod, 12 years ago

CMIP5 branch : Add new configs IPSLCM5CHT_v5 IPSLCM5CHS_v5

  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 5.9 KB
RevLine 
[210]1#!/bin/ksh
2######################################################
3# Author : Rachid benshila for ESOPA
4# Contact : opatlod@lodyc.jussieu.fr
5#
[346]6# This script aims to create the OPA/WORK directory
7# with links to target directories for the sources
[210]8# and to link in the WORK the BB_make and BB_make.ldef
9# associated  to a chosen configuration
10#
11######################################################
12
[212]13###################################
14#                                 #
15# Beginning of user modifications #
16#                                 #
17###################################
[210]18#- Config name ---
[212]19# To add a new configuration called NAME you have to change this script
20# 1. Add your configuration in LIST
21# 2. Add the directories needed for this config : set -A DIR_NAME DIR1 DIR2 ...
22# 3. Run fait_config NAME
23# If there is no directory config/NAME/scripts, and in this no BB_make.ldef,
[240]24# the config/ORCA2_LIM directory is copied under NAME
[212]25#
[346]26# Example 1 : in order to create a GYRE_TRC configuration :
[240]27# 1. In this script, change LIST to LIST="ORCA2_LIM \nGYRE \nGYRE_TRC"
[833]28# 2. In this script, add set -A DIR_GYRE_TRC OPA_SRC LIM_SRC_3 TOP_SRC C1D_SRC, take care of the syntax
[212]29# 3. Run fait_config GYRE_TRC
[346]30# Example 2 : in order to create an OFFLINE_TRC configuration :
31# 1. In this script, change LIST to LIST="ORCA2_LIM \nGYRE \nOFFLINE_TRC"
32# 2. In this script, add set -A DIR_OFFLINE_TRC OFF_SRC TOP_SRC, take care of the syntax
33# 3. Run fait_config OFFLINE_TRC
[1159]34# Example 2 : in order to use LIM3, just change LIM_SRC_2 in LIM_SRC_3
[212]35
[3405]36LIST="ORCA2_LIM \nGYRE \nGYRE_LOBSTER \nORCA2_LIM_PISCES \nORCA2_OFF_PISCES \nPOMME \nIPSLCM5 \nIPSLCM5A \nIPSLCM5_v3 \nIPSLCM5_LOOP \nIPSLCM5B \nIPSLCM5A_C \nIPSLCM5_v5 \nIPSLCM5CHT_v5  \nIPSLCM5CHS_v5"
[967]37set -A DIR_ORCA2_LIM OPA_SRC LIM_SRC_2 C1D_SRC NST_SRC
38set -A DIR_GYRE OPA_SRC LIM_SRC_2 C1D_SRC
39set -A DIR_GYRE_LOBSTER OPA_SRC LIM_SRC_2 C1D_SRC TOP_SRC
[1272]40set -A DIR_ORCA2_LIM_PISCES OPA_SRC LIM_SRC_2 C1D_SRC TOP_SRC NST_SRC
[967]41set -A DIR_ORCA2_OFF_PISCES OFF_SRC TOP_SRC
[1647]42set -A DIR_POMME OPA_SRC LIM_SRC_2 C1D_SRC
[1272]43set -A DIR_IPSLCM5 OPA_SRC LIM_SRC_2 C1D_SRC
[1845]44set -A DIR_IPSLCM5A OPA_SRC LIM_SRC_2 C1D_SRC TOP_SRC
[1807]45set -A DIR_IPSLCM5_v3 OPA_SRC LIM_SRC_2 C1D_SRC TOP_SRC
[3405]46set -A DIR_IPSLCM5_v5 OPA_SRC LIM_SRC_2 C1D_SRC TOP_SRC
47set -A DIR_IPSLCM5CHT_v5 OPA_SRC LIM_SRC_2 C1D_SRC TOP_SRC
48set -A DIR_IPSLCM5CHS_v5 OPA_SRC LIM_SRC_2 C1D_SRC TOP_SRC
[2449]49set -A DIR_IPSLCM5B OPA_SRC LIM_SRC_2 C1D_SRC TOP_SRC
[2509]50set -A DIR_IPSLCM5A_C OPA_SRC LIM_SRC_2 C1D_SRC TOP_SRC
[3405]51set -A DIR_IPSLCM5_LOOP OPA_SRC LIM_SRC_2 C1D_SRC TOP_SRC
[1440]52set -A DIR_IPSL_ESM_v2 OPA_SRC LIM_SRC_2 C1D_SRC
[210]53
[212]54###################################
55#                                 #
56#    End of user modifications    #
57#                                 #
58###################################
59
60
[210]61#- Some tests ---
62d_n=$(dirname $0); b_n=$(basename $0);
63
64if   [ ${#} -gt 1 ]; then
[212]65    echo 'Only one configuration can be specified in:' 1>&2;
66    echo $LIST 1>&2;
67    exit 3;
[210]68elif [ ${#} -eq 1 ]; then
[212]69     m_n="${1}"
[210]70elif [ ${#} -eq 0 ]; then
[212]71    echo 'You must specify one configuration in :' 1>&2;
72    echo $LIST 1>&2;
73    echo 'You can also complete fait_config to add a new one'
74    exit 3;
[210]75fi
76
[212]77#- Create the WORK --
[242]78d_m=`find ${d_n}/.. -name NEMO`  ;
[210]79[ -d ${d_m}/WORK ] || mkdir ${d_m}/WORK;
80cd ${d_m}/WORK
[212]81
82#- Clean links and librairies
[210]83[ -f Makefile ] && gmake clean
[394]84[ -n "`\ls`" ] && \rm -rf *
[210]85
[212]86#- Find the number of directories ---
87eval NDIR=\${#DIR_${m_n}[*]}
[210]88
[212]89#- Build a working array TAB containing the directories ---
90i=0
91while [ i -lt $NDIR ]
92do
93    eval  TAB[i]=\${DIR_${m_n}[i]}
94    let i=i+1
95done
[210]96
[240]97#- Creating the good links, at first on OPA_SRC ---
[212]98if [ ${#TAB[*]} -ne 0 ] ; then
[240]99    echo " Creating NEMO/WORK = ${TAB[*]} for ${m_n}"
[210]100
[212]101    i=0
102    while [ i -lt $NDIR ]
103    do
[240]104   [ ${#TAB[i]} -ne 0 ] && [ "${TAB[i]}" = "OPA_SRC" ] && ln -sf ../OPA_SRC/*.[Ffh]90 .
105   [ ${#TAB[i]} -ne 0 ] && [ "${TAB[i]}" = "OPA_SRC" ] && ln -sf ../OPA_SRC/*/*.[Ffh]90 . && break
[212]106   let i=$i+1
107    done
108
109    i=0
110    while [ i -lt $NDIR ]
111    do
[833]112      if [ "${TAB[i]}" = "LIM_SRC_3" ]; then
113     ln -sf ../LIM_SRC_3/*.[Ffh]90 . 
[214]114     
[833]115      elif [ "${TAB[i]}" = "LIM_SRC_2" ]; then
116     ln -sf ../LIM_SRC_2/*.[Ffh]90 . 
117     
[272]118      elif [ "${TAB[i]}" = "C1D_SRC" ]; then
[271]119     ln -sf ../C1D_SRC/*.[Ffh]90 . 
120     
[240]121      elif [ "${TAB[i]}" = "TOP_SRC" ]; then
122     ln -sf ../TOP_SRC/*.[Ffh]90 .       
[947]123     ln -sf ../TOP_SRC/*/*.[Ffh]90 .
[214]124     
[394]125      elif [ "${TAB[i]}" = "NST_SRC" ]; then
126     [ -f  agrif_opa_interp.F90 ] && \rm agrif_opa_interp.F90                   
127     [ -f  agrif_opa_sponge.F90 ] && \rm agrif_opa_sponge.F90                   
128     [ -f  agrif_opa_update.F90 ] && \rm agrif_opa_update.F90                   
[1272]129     [ -f  agrif_top_interp.F90 ] && \rm agrif_top_interp.F90                   
130     [ -f  agrif_top_sponge.F90 ] && \rm agrif_top_sponge.F90                   
131     [ -f  agrif_top_update.F90 ] && \rm agrif_top_update.F90                   
[394]132     ln -sf ../NST_SRC/*.[Ffh]90 .
133     
[346]134      elif [ "${TAB[i]}" = "OFF_SRC" ]; then 
135     ln -sf ../OFF_SRC/*.[Ffh]90 .
136     ln -sf ../OFF_SRC/*/*.[Ffh]90 .
[214]137      fi
138      let i=$i+1
[212]139    done
140
[240]141    [ ! -d ../../../config/${m_n} ] && \cp -R ../../../config/ORCA2_LIM ../../../config/${m_n} 
[210]142    ln -sf ../../../*/${m_n}/scripts/BB_make AA_make ;
143    ln -sf ../../../*/${m_n}/scripts/BB_make.ldef AA_make.ldef ;
144
[212]145else
146
147    echo "Configuration "${m_n}" not supported" 1>&2
148    echo 'Make your choice in :' 1>&2
149    echo $LIST 1>&2
150    echo 'You can also complete fait_config to add a new one'
151    exit 1
152
153fi 
154
155#- Building the standard list of source files ---
156cat >.patron <<"EOF" 
[210]157CVS
158SRC_PARAM
159SRC_FILE_LIST
160tmplist
161AA_make
162KEY_CPP
163Makefile
164*?.o
165 i.?*
166*?.L
167.patron
[394]168OPAFILES
[210]169EOF
[212]170ls -1 | fgrep -v -f .patron  >SRC_FILE_LIST ; cp SRC_FILE_LIST SRC_FILE_LIST.temp ;
[210]171
[212]172#- Writing KEY_CPP file ---
[394]173sed -e /^P_P/\!d -e "s/P_P = //" AA_make.ldef > KEY_CPP;   
[212]174
175#- Save new configuration an d directories names ---
176print ${m_n} ${TAB[*]} >.config
177
[210]178exit 0;
Note: See TracBrowser for help on using the repository browser.