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.
modinitvars.F in branches/UKMO/dev_r5107_test_branch/NEMOGCM/EXTERNAL/AGRIF/AGRIF_FILES – NEMO

source: branches/UKMO/dev_r5107_test_branch/NEMOGCM/EXTERNAL/AGRIF/AGRIF_FILES/modinitvars.F @ 5274

Last change on this file since 5274 was 5274, checked in by davestorkey, 9 years ago

UKMO test branch: Remove keyword updating.

File size: 3.7 KB
Line 
1!
2! $Id: modinitvars.F 2528 2010-12-27 17:33:53Z rblod $
3!
4C     Agrif (Adaptive Grid Refinement In Fortran)
5C
6C     Copyright (C) 2003 Laurent Debreu (Laurent.Debreu@imag.fr)
7C                        Christophe Vouland (Christophe.Vouland@imag.fr)   
8C
9C     This program is free software; you can redistribute it and/or modify
10C     it under the terms of the GNU General Public License as published by
11C     the Free Software Foundation; either version 2 of the License, or
12C     (at your option) any later version.
13C
14C     This program is distributed in the hope that it will be useful,
15C     but WITHOUT ANY WARRANTY; without even the implied warranty of
16C     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17C     GNU General Public License for more details.
18C
19C     You should have received a copy of the GNU General Public License
20C     along with this program; if not, write to the Free Software
21C     Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22C
23C
24C
25CCC   Module Agrif_Init_Vars
26C
27      Module Agrif_Init_Vars
28C
29CCC   Description:
30CCC   Initialization of the variables of the current grid.
31C
32C     Modules used: 
33C     
34      Use Agrif_Types
35      Use Agrif_link
36C   
37      IMPLICIT NONE
38C
39      Contains
40C     Defininition of the procedures contained in this module
41C 
42C 
43C     **************************************************************************
44CCC   Subroutine Agrif_Create_var 
45C     **************************************************************************
46C 
47      Subroutine Agrif_Create_Var(Agrif_Gr)
48C
49CCC   Description:
50CCC   Allocation of the field "var" of the grid variables.
51CCC   Fields "root_var", "nbdim" and "parent_var" of the grid variables.
52CCC   Array "tabvars" of the current grid. 
53C
54CC    Method:                 
55C 
56C     Declarations:
57C
58     
59C
60C     Pointer argument:
61      TYPE(Agrif_Grid),pointer   :: Agrif_Gr  ! Pointer on the current grid
62      INTEGER :: nb
63C
64C     Array "tabvars" of the current grid. 
65C
66      Allocate(Agrif_Gr % tabvars(Agrif_NbVariables))
67C     
68      do nb = 1, Agrif_NbVariables
69        Allocate(Agrif_Gr % tabvars(nb) % var)
70      enddo
71
72C     Fields "root_var", "nbdim" and "parent_var" of the grid variables.     
73      if (Agrif_Gr % fixedrank .NE.0) then
74         do nb = 1, Agrif_NbVariables     
75            Agrif_Gr % tabvars(nb) % parent_var => 
76     &      Agrif_Gr % parent %tabvars(nb)
77            Agrif_Gr % tabvars(nb) % var % nbdim =
78     &      Agrif_Mygrid % tabvars(nb) % var % nbdim
79            Agrif_Gr % tabvars(nb) % var % root_var =>
80     &      Agrif_Mygrid % tabvars(nb) % var         
81         enddo
82      endif
83C           
84      End Subroutine Agrif_Create_Var
85C
86C
87C     **************************************************************************
88CCC   Subroutine Agrif_CreateVar
89C     **************************************************************************
90C 
91      Subroutine Agrif_CreateVar(Agrif_Gr)           
92C
93CCC   Description:
94CCC   This subroutine allows to make a link between Mygrid and the current grid 
95C
96C     Modules used:
97C     
98C
99C     Declarations:
100C     
101C
102C
103C     Arguments     
104C
105      TYPE(Agrif_Grid),pointer   :: Agrif_Gr    ! Pointer on the current grid
106      INTEGER                    :: i           ! Loop
107C
108      if (Agrif_Gr % fixedrank .NE. 0) then
109C 
110         do i = 1 , Agrif_NbVariables 
111            Agrif_Gr % tabvars(i) % parent_var => 
112     &      Agrif_Gr % parent % tabvars(i) 
113            Agrif_Gr % tabvars(i) % var % root_var => 
114     &      Agrif_Mygrid % tabvars(i) % var
115            Agrif_Gr % tabvars(i) % var % nbdim  = 
116     &      Agrif_Gr % parent % tabvars(i) % var % nbdim
117         enddo 
118C   
119      endif
120C       
121      End Subroutine Agrif_CreateVar
122C
123C
124C
125      End Module Agrif_Init_Vars
Note: See TracBrowser for help on using the repository browser.