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 trunk/UTIL – NEMO

source: trunk/UTIL/fait_config @ 271

Last change on this file since 271 was 271, checked in by opalod, 19 years ago

nemo_v1_config_001 : CT : taking into account the C1D, KPP and control print implementation

  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 4.2 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# and to link in the WORK the BB_make and BB_make.ldef
8# associated  to a chosen configuration
9#
10######################################################
11
12###################################
13#                                 #
14# Beginning of user modifications #
15#                                 #
16###################################
17#- Config name ---
18# To add a new configuration called NAME you have to change this script
19# 1. Add your configuration in LIST
20# 2. Add the directories needed for this config : set -A DIR_NAME DIR1 DIR2 ...
21# 3. Run fait_config NAME
22# If there is no directory config/NAME/scripts, and in this no BB_make.ldef,
23# the config/ORCA2_LIM directory is copied under NAME
24#
25# Example : in order to create a GYRE_TRC configuration :
26# 1. In this script, change LIST to LIST="ORCA2_LIM \nGYRE \nGYRE_TRC"
27# 2. In this script, add set -A DIR_GYRE_TRC OPA_SRC LIM_SRC TOP_SRC, take care of the syntax
28# 3. Run fait_config GYRE_TRC
29
30LIST="ORCA2_LIM \nGYRE"
31set -A DIR_ORCA2_LIM OPA_SRC LIM_SRC C1D_SRC
32set -A DIR_GYRE OPA_SRC LIM_SRC C1D_SRC
33
34###################################
35#                                 #
36#    End of user modifications    #
37#                                 #
38###################################
39
40
41#- Some tests ---
42d_n=$(dirname $0); b_n=$(basename $0);
43
44if   [ ${#} -gt 1 ]; then
45    echo 'Only one configuration can be specified in:' 1>&2;
46    echo $LIST 1>&2;
47    exit 3;
48elif [ ${#} -eq 1 ]; then
49     m_n="${1}"
50elif [ ${#} -eq 0 ]; then
51    echo 'You must specify one configuration in :' 1>&2;
52    echo $LIST 1>&2;
53    echo 'You can also complete fait_config to add a new one'
54    exit 3;
55fi
56
57#- Create the WORK --
58d_m=`find ${d_n}/.. -name NEMO`  ;
59[ -d ${d_m}/WORK ] || mkdir ${d_m}/WORK;
60cd ${d_m}/WORK
61
62#- Clean links and librairies
63[ -f Makefile ] && gmake clean
64[ -n "`\ls`" ] && \rm *
65
66#- Find the number of directories ---
67eval NDIR=\${#DIR_${m_n}[*]}
68
69#- Build a working array TAB containing the directories ---
70i=0
71while [ i -lt $NDIR ]
72do
73    eval  TAB[i]=\${DIR_${m_n}[i]}
74    let i=i+1
75done
76
77#- Creating the good links, at first on OPA_SRC ---
78if [ ${#TAB[*]} -ne 0 ] ; then
79    echo " Creating NEMO/WORK = ${TAB[*]} for ${m_n}"
80
81    i=0
82    while [ i -lt $NDIR ]
83    do
84   [ ${#TAB[i]} -ne 0 ] && [ "${TAB[i]}" = "OPA_SRC" ] && ln -sf ../OPA_SRC/*.[Ffh]90 .
85   [ ${#TAB[i]} -ne 0 ] && [ "${TAB[i]}" = "OPA_SRC" ] && ln -sf ../OPA_SRC/*/*.[Ffh]90 . && break
86   let i=$i+1
87    done
88
89    i=0
90    while [ i -lt $NDIR ]
91    do
92      if [ "${TAB[i]}" = "LIM_SRC" ]; then
93     ln -sf ../LIM_SRC/*.[Ffh]90 . 
94     
95      if [ "${TAB[i]}" = "C1D_SRC" ]; then
96     ln -sf ../C1D_SRC/*.[Ffh]90 . 
97     
98      elif [ "${TAB[i]}" = "TOP_SRC" ]; then
99     \rm trcstp.F90                   
100     \rm sms.F90                   
101     ln -sf ../TOP_SRC/*.[Ffh] .           
102     ln -sf ../TOP_SRC/*.[Ffh]90 .       
103     ln -sf ../TOP_SRC/SMS/*.[Ffh] .       
104     ln -sf ../TOP_SRC/SMS/*.[Ffh]90 . 
105     ln -sf ../TOP_SRC/TRP/*.[Ffh]90 .
106     
107      elif [ "${TAB[i]}" = "SRC_OFFLINE_TRC" ]; then 
108     ln -sf ../TOP_SRC/*.[Ffh] .
109     ln -sf ../TOP_SRC/SMS/*.[Ffh] .
110     ln -sf ../SRC_OFFLINE_TRC/*.[Ffh] .
111      fi
112      let i=$i+1
113    done
114
115    [ ! -d ../../../config/${m_n} ] && \cp -R ../../../config/ORCA2_LIM ../../../config/${m_n} 
116    ln -sf ../../../*/${m_n}/scripts/BB_make AA_make ;
117    ln -sf ../../../*/${m_n}/scripts/BB_make.ldef AA_make.ldef ;
118
119else
120
121    echo "Configuration "${m_n}" not supported" 1>&2
122    echo 'Make your choice in :' 1>&2
123    echo $LIST 1>&2
124    echo 'You can also complete fait_config to add a new one'
125    exit 1
126
127fi 
128
129#- Building the standard list of source files ---
130cat >.patron <<"EOF" 
131CVS
132SRC_PARAM
133SRC_FILE_LIST
134tmplist
135AA_make
136KEY_CPP
137Makefile
138*?.o
139 i.?*
140*?.L
141.patron
142bloc.com
143para.com
144defcst.f
145fontbc.f
146icdyna.f
147thersf.f
148EOF
149ls -1 | fgrep -v -f .patron  >SRC_FILE_LIST ; cp SRC_FILE_LIST SRC_FILE_LIST.temp ;
150
151#- Writing KEY_CPP file ---
152sed -e "s/#-Q- sxnec *//" -e /^P_P/\!d -e "s/P_P = //" AA_make.ldef > KEY_CPP;   
153
154#- Save new configuration an d directories names ---
155print ${m_n} ${TAB[*]} >.config
156
157exit 0;
Note: See TracBrowser for help on using the repository browser.