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

Last change on this file since 1807 was 1807, checked in by mafoipsl, 14 years ago

PC+MAF : add IPSLCM5_v3 config for IPSLCM5_v2+PISCES

  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 5.5 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 \nIPSLCM5_v3 \nIPSLCM5_LOOP"
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_IPSLCM5_v3 OPA_SRC LIM_SRC_2 C1D_SRC TOP_SRC
45set -A DIR_IPSLCM5_LOOP OPA_SRC LIM_SRC_2 C1D_SRC TOP_SRC
46set -A DIR_IPSL_ESM_v2 OPA_SRC LIM_SRC_2 C1D_SRC
47
48###################################
49#                                 #
50#    End of user modifications    #
51#                                 #
52###################################
53
54
55#- Some tests ---
56d_n=$(dirname $0); b_n=$(basename $0);
57
58if   [ ${#} -gt 1 ]; then
59    echo 'Only one configuration can be specified in:' 1>&2;
60    echo $LIST 1>&2;
61    exit 3;
62elif [ ${#} -eq 1 ]; then
63     m_n="${1}"
64elif [ ${#} -eq 0 ]; then
65    echo 'You must specify one configuration in :' 1>&2;
66    echo $LIST 1>&2;
67    echo 'You can also complete fait_config to add a new one'
68    exit 3;
69fi
70
71#- Create the WORK --
72d_m=`find ${d_n}/.. -name NEMO`  ;
73[ -d ${d_m}/WORK ] || mkdir ${d_m}/WORK;
74cd ${d_m}/WORK
75
76#- Clean links and librairies
77[ -f Makefile ] && gmake clean
78[ -n "`\ls`" ] && \rm -rf *
79
80#- Find the number of directories ---
81eval NDIR=\${#DIR_${m_n}[*]}
82
83#- Build a working array TAB containing the directories ---
84i=0
85while [ i -lt $NDIR ]
86do
87    eval  TAB[i]=\${DIR_${m_n}[i]}
88    let i=i+1
89done
90
91#- Creating the good links, at first on OPA_SRC ---
92if [ ${#TAB[*]} -ne 0 ] ; then
93    echo " Creating NEMO/WORK = ${TAB[*]} for ${m_n}"
94
95    i=0
96    while [ i -lt $NDIR ]
97    do
98   [ ${#TAB[i]} -ne 0 ] && [ "${TAB[i]}" = "OPA_SRC" ] && ln -sf ../OPA_SRC/*.[Ffh]90 .
99   [ ${#TAB[i]} -ne 0 ] && [ "${TAB[i]}" = "OPA_SRC" ] && ln -sf ../OPA_SRC/*/*.[Ffh]90 . && break
100   let i=$i+1
101    done
102
103    i=0
104    while [ i -lt $NDIR ]
105    do
106      if [ "${TAB[i]}" = "LIM_SRC_3" ]; then
107     ln -sf ../LIM_SRC_3/*.[Ffh]90 . 
108     
109      elif [ "${TAB[i]}" = "LIM_SRC_2" ]; then
110     ln -sf ../LIM_SRC_2/*.[Ffh]90 . 
111     
112      elif [ "${TAB[i]}" = "C1D_SRC" ]; then
113     ln -sf ../C1D_SRC/*.[Ffh]90 . 
114     
115      elif [ "${TAB[i]}" = "TOP_SRC" ]; then
116     ln -sf ../TOP_SRC/*.[Ffh]90 .       
117     ln -sf ../TOP_SRC/*/*.[Ffh]90 .
118     
119      elif [ "${TAB[i]}" = "NST_SRC" ]; then
120     [ -f  agrif_opa_interp.F90 ] && \rm agrif_opa_interp.F90                   
121     [ -f  agrif_opa_sponge.F90 ] && \rm agrif_opa_sponge.F90                   
122     [ -f  agrif_opa_update.F90 ] && \rm agrif_opa_update.F90                   
123     [ -f  agrif_top_interp.F90 ] && \rm agrif_top_interp.F90                   
124     [ -f  agrif_top_sponge.F90 ] && \rm agrif_top_sponge.F90                   
125     [ -f  agrif_top_update.F90 ] && \rm agrif_top_update.F90                   
126     ln -sf ../NST_SRC/*.[Ffh]90 .
127     
128      elif [ "${TAB[i]}" = "OFF_SRC" ]; then 
129     ln -sf ../OFF_SRC/*.[Ffh]90 .
130     ln -sf ../OFF_SRC/*/*.[Ffh]90 .
131      fi
132      let i=$i+1
133    done
134
135    [ ! -d ../../../config/${m_n} ] && \cp -R ../../../config/ORCA2_LIM ../../../config/${m_n} 
136    ln -sf ../../../*/${m_n}/scripts/BB_make AA_make ;
137    ln -sf ../../../*/${m_n}/scripts/BB_make.ldef AA_make.ldef ;
138
139else
140
141    echo "Configuration "${m_n}" not supported" 1>&2
142    echo 'Make your choice in :' 1>&2
143    echo $LIST 1>&2
144    echo 'You can also complete fait_config to add a new one'
145    exit 1
146
147fi 
148
149#- Building the standard list of source files ---
150cat >.patron <<"EOF" 
151CVS
152SRC_PARAM
153SRC_FILE_LIST
154tmplist
155AA_make
156KEY_CPP
157Makefile
158*?.o
159 i.?*
160*?.L
161.patron
162OPAFILES
163EOF
164ls -1 | fgrep -v -f .patron  >SRC_FILE_LIST ; cp SRC_FILE_LIST SRC_FILE_LIST.temp ;
165
166#- Writing KEY_CPP file ---
167sed -e /^P_P/\!d -e "s/P_P = //" AA_make.ldef > KEY_CPP;   
168
169#- Save new configuration an d directories names ---
170print ${m_n} ${TAB[*]} >.config
171
172exit 0;
Note: See TracBrowser for help on using the repository browser.