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.
modinit.F in trunk/AGRIF/AGRIF_FILES – NEMO

source: trunk/AGRIF/AGRIF_FILES/modinit.F @ 396

Last change on this file since 396 was 396, checked in by opalod, 18 years ago

Initial revision

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 7.3 KB
Line 
1C     AGRIF (Adaptive Grid Refinement In Fortran)
2C
3C     Copyright (C) 2003 Laurent Debreu (Laurent.Debreu@imag.fr)
4C                        Christophe Vouland (Christophe.Vouland@imag.fr)   
5C
6C     This program is free software; you can redistribute it and/or modify
7C     it under the terms of the GNU General Public License as published by
8C     the Free Software Foundation; either version 2 of the License, or
9C     (at your option) any later version.
10C
11C     This program is distributed in the hope that it will be useful,
12C     but WITHOUT ANY WARRANTY; without even the implied warranty of
13C     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14C     GNU General Public License for more details.
15C
16C     You should have received a copy of the GNU General Public License
17C     along with this program; if not, write to the Free Software
18C     Foundation, Inc., 59 Temple Place-  Suite 330, Boston, MA 02111-1307, USA.
19C
20C
21C
22CCC   Module Agrif_Init
23C
24      Module Agrif_Init 
25C
26CCC   Description:
27CCC   Several operations on the variables of the current grid (creation,
28CCC   instanciation, ...) used during the creation of the grid hierarchy and
29CCC   during the time integration.
30C
31C     Modules used: 
32C
33      Use Agrif_Types 
34      Use Agrif_link
35C   
36      IMPLICIT NONE
37C
38      Contains
39C     Defininition of the procedures contained in this module
40C
41C     **************************************************************************
42CCC   Subroutine Agrif_Allocation 
43C     **************************************************************************
44C 
45      Subroutine Agrif_Allocation(Agrif_Gr)
46C
47CCC   Description:
48CCC   Subroutine to allocate the arrays containing the values of the variables 
49CCC   of the current grd.
50C
51CC    Method:
52CC    Use of the allocate function. 
53C
54C     Declarations:
55C     
56C     Pointer argument:
57      TYPE(AGRIF_grid), Pointer :: Agrif_Gr  ! Pointer on the current grid
58C 
59C     Allocation of the arrays of the variables 
60C     We cut this in several files to avoid long compilation timings
61C
62      Call Agrif_Allocationcalls(Agrif_Gr)
63C
64      if ( Agrif_USE_ONLY_FIXED_GRIDS .EQ. 0 ) then
65C
66         if ( Agrif_Probdim .EQ. 1 ) 
67     &      Allocate(Agrif_Gr%tabpoint1D(Agrif_Gr%nb(1)+1))
68         if ( Agrif_Probdim .EQ. 2 ) 
69     &      Allocate(Agrif_Gr%tabpoint2D(Agrif_Gr%nb(1)+1,
70     &       Agrif_Gr%nb(2)+1))     
71         if ( Agrif_Probdim .EQ. 3 ) 
72     &      Allocate(Agrif_Gr%tabpoint3D(Agrif_Gr%nb(1)+1,
73     &       Agrif_Gr%nb(2)+1,Agrif_Gr%nb(3)+1))     
74C
75      endif
76C 
77      End Subroutine Agrif_Allocation
78C
79C     **************************************************************************
80CCC   Subroutine Agrif_Instance 
81C     **************************************************************************
82C 
83      Subroutine Agrif_Instance(Agrif_Gr)
84C
85CCC   Description:
86CCC   Subroutine to do an instance of the common variables to the variables of 
87CCC   the current grid.
88C
89CC    Method:
90CC    Pointing the common variables on these of the current grid. 
91C
92C     Declarations:
93C       
94
95C
96C
97
98C
99C     Pointer argument: 
100      Type(Agrif_Grid), Pointer :: Agrif_Gr   ! Pointer on the current grid 
101C 
102C
103      Agrif_Curgrid => Agrif_Gr
104      Agrif_tabvars => Agrif_Curgrid % tabvars
105C
106      Call Agrif_Get_numberofcells(Agrif_Gr)
107C
108C
109C     Calculation of isf,jsf,nzsf and of the index of the output file 
110      Call Agrif_InitWorkSpace() 
111C
112C 
113      End Subroutine Agrif_Instance
114C
115C
116C     **************************************************************************
117CCC   Subroutine Agrif_initialisations 
118C     **************************************************************************
119      Subroutine Agrif_initialisations(Agrif_Gr)
120C
121CCC   Description:
122C
123CC    Method:
124C
125C     Declarations:
126C       
127      INTEGER :: i
128C
129C     Pointer argument: 
130      Type(Agrif_Grid), Pointer  :: Agrif_Gr
131C
132      do i = 1 , Agrif_NbVariables
133C 
134         Agrif_Gr % tabvars(i) % var % nbdim = 0
135C
136         if (associated(Agrif_Gr%tabvars(i)%var%array1)) then
137             Agrif_Gr % tabvars(i) % var % nbdim = 1
138         endif
139         if (associated(Agrif_Gr%tabvars(i)%var%array2)) then
140             Agrif_Gr % tabvars(i) % var % nbdim = 2
141         endif
142         if (associated(Agrif_Gr%tabvars(i)%var%array3)) then
143             Agrif_Gr % tabvars(i) % var % nbdim = 3
144         endif
145         if (associated(Agrif_Gr%tabvars(i)%var%array4)) then
146             Agrif_Gr % tabvars(i) % var % nbdim = 4
147         endif
148         if (associated(Agrif_Gr%tabvars(i)%var%array5)) then
149             Agrif_Gr % tabvars(i) % var % nbdim = 5
150         endif
151         if (associated(Agrif_Gr%tabvars(i)%var%array6)) then
152             Agrif_Gr % tabvars(i) % var % nbdim = 6
153         endif
154C
155         if (associated(Agrif_Gr%tabvars(i)%var%darray1)) then
156             Agrif_Gr % tabvars(i) % var % nbdim = 1
157         endif
158         if (associated(Agrif_Gr%tabvars(i)%var%darray2)) then
159             Agrif_Gr % tabvars(i) % var % nbdim = 2
160         endif
161         if (associated(Agrif_Gr%tabvars(i)%var%darray3)) then
162             Agrif_Gr % tabvars(i) % var % nbdim = 3
163         endif
164         if (associated(Agrif_Gr%tabvars(i)%var%darray4)) then
165             Agrif_Gr % tabvars(i) % var % nbdim = 4
166         endif
167         if (associated(Agrif_Gr%tabvars(i)%var%darray5)) then
168             Agrif_Gr % tabvars(i) % var % nbdim = 5
169         endif
170         if (associated(Agrif_Gr%tabvars(i)%var%darray6)) then
171             Agrif_Gr % tabvars(i) % var % nbdim = 6
172         endif
173C
174         if (associated(Agrif_Gr%tabvars(i)%var%larray1)) then
175             Agrif_Gr % tabvars(i) % var % nbdim = 1
176         endif
177         if (associated(Agrif_Gr%tabvars(i)%var%larray2)) then
178             Agrif_Gr % tabvars(i) % var % nbdim = 2
179         endif
180         if (associated(Agrif_Gr%tabvars(i)%var%larray3)) then
181             Agrif_Gr % tabvars(i) % var % nbdim = 3
182         endif
183         if (associated(Agrif_Gr%tabvars(i)%var%larray4)) then
184             Agrif_Gr % tabvars(i) % var % nbdim = 4
185         endif
186         if (associated(Agrif_Gr%tabvars(i)%var%larray5)) then
187             Agrif_Gr % tabvars(i) % var % nbdim = 5
188         endif
189         if (associated(Agrif_Gr%tabvars(i)%var%larray6)) then
190             Agrif_Gr % tabvars(i) % var % nbdim = 6
191         endif
192C
193         if (associated(Agrif_Gr%tabvars(i)%var%iarray1)) then
194             Agrif_Gr % tabvars(i) % var % nbdim = 1
195         endif
196         if (associated(Agrif_Gr%tabvars(i)%var%iarray2)) then
197             Agrif_Gr % tabvars(i) % var % nbdim = 2
198         endif
199         if (associated(Agrif_Gr%tabvars(i)%var%iarray3)) then
200             Agrif_Gr % tabvars(i) % var % nbdim = 3
201         endif
202         if (associated(Agrif_Gr%tabvars(i)%var%iarray4)) then
203             Agrif_Gr % tabvars(i) % var % nbdim = 4
204         endif
205         if (associated(Agrif_Gr%tabvars(i)%var%iarray5)) then
206             Agrif_Gr % tabvars(i) % var % nbdim = 5
207         endif
208         if (associated(Agrif_Gr%tabvars(i)%var%iarray6)) then
209             Agrif_Gr % tabvars(i) % var % nbdim = 6
210         endif
211C
212         if (associated(Agrif_Gr%tabvars(i)%var%carray1)) then
213             Agrif_Gr % tabvars(i) % var % nbdim = 1
214         endif
215         if (associated(Agrif_Gr%tabvars(i)%var%carray2)) then
216             Agrif_Gr % tabvars(i) % var % nbdim = 2
217         endif
218C 
219      enddo
220C
221      Return
222C 
223C
224      End Subroutine Agrif_initialisations
225C 
226C
227      End Module AGRIF_Init 
Note: See TracBrowser for help on using the repository browser.