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 @ 8809

Last change on this file since 8809 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
Line 
1#!/bin/ksh
2######################################################
3# Author : Rachid benshila for ESOPA
4# Contact : opatlod@lodyc.jussieu.fr
5#
6# This script aims to create the OPA/WORK directory
7# with links to target directories for the sources
8# and to link in the WORK the BB_make and BB_make.ldef
9# associated  to a chosen configuration
10#
11######################################################
12
13###################################
14#                                 #
15# Beginning of user modifications #
16#                                 #
17###################################
18#- Config name ---
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,
24# the config/ORCA2_LIM directory is copied under NAME
25#
26# Example 1 : in order to create a GYRE_TRC configuration :
27# 1. In this script, change LIST to LIST="ORCA2_LIM \nGYRE \nGYRE_TRC"
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
29# 3. Run fait_config GYRE_TRC
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
34# Example 2 : in order to use LIM3, just change LIM_SRC_2 in LIM_SRC_3
35
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"
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
40set -A DIR_ORCA2_LIM_PISCES OPA_SRC LIM_SRC_2 C1D_SRC TOP_SRC NST_SRC
41set -A DIR_ORCA2_OFF_PISCES OFF_SRC TOP_SRC
42set -A DIR_POMME OPA_SRC LIM_SRC_2 C1D_SRC
43set -A DIR_IPSLCM5 OPA_SRC LIM_SRC_2 C1D_SRC
44set -A DIR_IPSLCM5A OPA_SRC LIM_SRC_2 C1D_SRC TOP_SRC
45set -A DIR_IPSLCM5_v3 OPA_SRC LIM_SRC_2 C1D_SRC TOP_SRC
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
49set -A DIR_IPSLCM5B OPA_SRC LIM_SRC_2 C1D_SRC TOP_SRC
50set -A DIR_IPSLCM5A_C OPA_SRC LIM_SRC_2 C1D_SRC TOP_SRC
51set -A DIR_IPSLCM5_LOOP OPA_SRC LIM_SRC_2 C1D_SRC TOP_SRC
52set -A DIR_IPSL_ESM_v2 OPA_SRC LIM_SRC_2 C1D_SRC
53
54###################################
55#                                 #
56#    End of user modifications    #
57#                                 #
58###################################
59
60
61#- Some tests ---
62d_n=$(dirname $0); b_n=$(basename $0);
63
64if   [ ${#} -gt 1 ]; then
65    echo 'Only one configuration can be specified in:' 1>&2;
66    echo $LIST 1>&2;
67    exit 3;
68elif [ ${#} -eq 1 ]; then
69     m_n="${1}"
70elif [ ${#} -eq 0 ]; then
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;
75fi
76
77#- Create the WORK --
78d_m=`find ${d_n}/.. -name NEMO`  ;
79[ -d ${d_m}/WORK ] || mkdir ${d_m}/WORK;
80cd ${d_m}/WORK
81
82#- Clean links and librairies
83[ -f Makefile ] && gmake clean
84[ -n "`\ls`" ] && \rm -rf *
85
86#- Find the number of directories ---
87eval NDIR=\${#DIR_${m_n}[*]}
88
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
96
97#- Creating the good links, at first on OPA_SRC ---
98if [ ${#TAB[*]} -ne 0 ] ; then
99    echo " Creating NEMO/WORK = ${TAB[*]} for ${m_n}"
100
101    i=0
102    while [ i -lt $NDIR ]
103    do
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
106   let i=$i+1
107    done
108
109    i=0
110    while [ i -lt $NDIR ]
111    do
112      if [ "${TAB[i]}" = "LIM_SRC_3" ]; then
113     ln -sf ../LIM_SRC_3/*.[Ffh]90 . 
114     
115      elif [ "${TAB[i]}" = "LIM_SRC_2" ]; then
116     ln -sf ../LIM_SRC_2/*.[Ffh]90 . 
117     
118      elif [ "${TAB[i]}" = "C1D_SRC" ]; then
119     ln -sf ../C1D_SRC/*.[Ffh]90 . 
120     
121      elif [ "${TAB[i]}" = "TOP_SRC" ]; then
122     ln -sf ../TOP_SRC/*.[Ffh]90 .       
123     ln -sf ../TOP_SRC/*/*.[Ffh]90 .
124     
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                   
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                   
132     ln -sf ../NST_SRC/*.[Ffh]90 .
133     
134      elif [ "${TAB[i]}" = "OFF_SRC" ]; then 
135     ln -sf ../OFF_SRC/*.[Ffh]90 .
136     ln -sf ../OFF_SRC/*/*.[Ffh]90 .
137      fi
138      let i=$i+1
139    done
140
141    [ ! -d ../../../config/${m_n} ] && \cp -R ../../../config/ORCA2_LIM ../../../config/${m_n} 
142    ln -sf ../../../*/${m_n}/scripts/BB_make AA_make ;
143    ln -sf ../../../*/${m_n}/scripts/BB_make.ldef AA_make.ldef ;
144
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" 
157CVS
158SRC_PARAM
159SRC_FILE_LIST
160tmplist
161AA_make
162KEY_CPP
163Makefile
164*?.o
165 i.?*
166*?.L
167.patron
168OPAFILES
169EOF
170ls -1 | fgrep -v -f .patron  >SRC_FILE_LIST ; cp SRC_FILE_LIST SRC_FILE_LIST.temp ;
171
172#- Writing KEY_CPP file ---
173sed -e /^P_P/\!d -e "s/P_P = //" AA_make.ldef > KEY_CPP;   
174
175#- Save new configuration an d directories names ---
176print ${m_n} ${TAB[*]} >.config
177
178exit 0;
Note: See TracBrowser for help on using the repository browser.