Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
utilities/rocflu/cells/RFLU_AllocateMemoryWrapper.F90
Go to the documentation of this file.
1 ! *********************************************************************
2 ! * Rocstar Simulation Suite *
3 ! * Copyright@2015, Illinois Rocstar LLC. All rights reserved. *
4 ! * *
5 ! * Illinois Rocstar LLC *
6 ! * Champaign, IL *
7 ! * www.illinoisrocstar.com *
8 ! * sales@illinoisrocstar.com *
9 ! * *
10 ! * License: See LICENSE file in top level of distribution package or *
11 ! * http://opensource.org/licenses/NCSA *
12 ! *********************************************************************
13 ! *********************************************************************
14 ! * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, *
15 ! * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES *
16 ! * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND *
17 ! * NONINFRINGEMENT. IN NO EVENT SHALL THE CONTRIBUTORS OR *
18 ! * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
19 ! * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, *
20 ! * Arising FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE *
21 ! * USE OR OTHER DEALINGS WITH THE SOFTWARE. *
22 ! *********************************************************************
23 !******************************************************************************
24 !
25 ! Purpose: Allocate memory wrapper.
26 !
27 ! Description: None.
28 !
29 ! Input:
30 ! pRegion Region pointer
31 ! allocMode Allocation mode
32 !
33 ! Output: None.
34 !
35 ! Notes:
36 ! 1. At present, do not use allocMode.
37 !
38 !******************************************************************************
39 !
40 ! $Id: RFLU_AllocateMemoryWrapper.F90,v 1.4 2008/12/06 08:44:54 mtcampbe Exp $
41 !
42 ! Copyright: (c) 2003 by the University of Illinois
43 !
44 !******************************************************************************
45 
46 SUBROUTINE rflu_allocatememorywrapper(pRegion,allocMode)
47 
48  USE moddatatypes
49  USE moderror
50  USE modglobal, ONLY: t_global
51  USE modbndpatch, ONLY: t_patch
52  USE moddatastruct, ONLY: t_region
53  USE modgrid, ONLY: t_grid
54  USE modmixture, ONLY: t_mixt_input
55  USE modparameters
56  USE modmpi
57 
60 
62 
63  IMPLICIT NONE
64 
65 ! ******************************************************************************
66 ! Definitions and declarations
67 ! ******************************************************************************
68 
69 ! ==============================================================================
70 ! Arguments
71 ! ==============================================================================
72 
73  INTEGER, INTENT(IN) :: allocmode
74  TYPE(t_region), POINTER :: pregion
75 
76 ! ==============================================================================
77 ! Locals
78 ! ==============================================================================
79 
80  CHARACTER(CHRLEN) :: rcsidentstring
81  INTEGER :: errorflag,ipatch
82  TYPE(t_global), POINTER :: global
83  TYPE(t_grid), POINTER :: pgrid
84  TYPE(t_mixt_input), POINTER :: pmixtinput
85  TYPE(t_patch), POINTER :: ppatch
86 
87 ! *****************************************************************************
88 ! Start
89 ! *****************************************************************************
90 
91  rcsidentstring = '$RCSfile: RFLU_AllocateMemoryWrapper.F90,v $ $Revision: 1.4 $'
92 
93  global => pregion%global
94 
95  CALL registerfunction(global,'RFLU_AllocateMemoryWrapper', &
96  'RFLU_AllocateMemoryWrapper.F90')
97 
98  IF ( global%myProcid == masterproc .AND. &
99  global%verbLevel > verbose_none ) THEN
100  WRITE(stdout,'(A,1X,A)') solver_name,'Allocating memory...'
101  END IF ! global%verbLevel
102 
103 ! ******************************************************************************
104 ! Allocate memory for grid and data structures
105 ! ******************************************************************************
106 
107  CALL rflu_creategrid(pregion)
108  CALL rflu_createcellmapping(pregion)
109  CALL rflu_createfacelist(pregion)
110 
111 ! ==============================================================================
112 ! Grid speeds
113 ! ==============================================================================
114 
115  pgrid => pregion%grid
116  pmixtinput => pregion%mixtInput
117 
118  IF ( pmixtinput%moveGrid .EQV. .true. ) THEN
119  IF ( pgrid%nFaces > 0 ) THEN
120  ALLOCATE(pgrid%gs(pgrid%nFaces),stat=errorflag)
121  global%error = errorflag
122  IF (global%error /= err_none) THEN
123  CALL errorstop(global,err_allocate,__line__,'pRegion%grid%gs')
124  END IF ! global%error
125 
126  pgrid%gs(:) = 0.0_rfreal
127  ELSE
128  nullify(pgrid%gs)
129  END IF ! pGrid%nFaces
130 
131  IF ( pregion%grid%nPatches > 0 ) THEN
132  DO ipatch = 1,pregion%grid%nPatches
133  ppatch => pregion%patches(ipatch)
134 
135  IF ( ppatch%nBFaces > 0 ) THEN
136  ALLOCATE(ppatch%gs(ppatch%nBFaces),stat=errorflag)
137  global%error = errorflag
138  IF (global%error /= 0) THEN
139  CALL errorstop(global,err_allocate,__line__,'pPatch%gs')
140  END IF ! global%error
141 
142  ppatch%gs(:) = 0.0_rfreal
143  ELSE
144  nullify(ppatch%gs)
145  END IF ! pPatch%nBFaces
146  END DO ! iPatch
147  END IF ! pRegion%grid%nPatches
148  END IF ! pRegion%mixtInput%moveGrid
149 
150 ! *****************************************************************************
151 ! End
152 ! *****************************************************************************
153 
154  IF ( global%myProcid == masterproc .AND. &
155  global%verbLevel > verbose_none ) THEN
156  WRITE(stdout,'(A,1X,A)') solver_name,'Allocating memory done.'
157  END IF ! global%verbLevel
158 
159  CALL deregisterfunction(global)
160 
161 END SUBROUTINE rflu_allocatememorywrapper
162 
163 !******************************************************************************
164 !
165 ! RCS Revision history:
166 !
167 ! $Log: RFLU_AllocateMemoryWrapper.F90,v $
168 ! Revision 1.4 2008/12/06 08:44:54 mtcampbe
169 ! Updated license.
170 !
171 ! Revision 1.3 2008/11/19 22:18:04 mtcampbe
172 ! Added Illinois Open Source License/Copyright
173 !
174 ! Revision 1.2 2003/04/12 22:20:51 haselbac
175 ! Added allocation for grid speeds
176 !
177 ! Revision 1.1 2003/04/01 17:02:46 haselbac
178 ! Initial revision
179 !
180 !******************************************************************************
181 
182 
183 
184 
185 
186 
187 
subroutine rflu_creategrid(pRegion)
subroutine rflu_allocatememory(pRegion)
subroutine rflu_allocatememorywrapper(pRegion)
subroutine registerfunction(global, funName, fileName)
Definition: ModError.F90:449
subroutine, public rflu_createfacelist(pRegion)
subroutine errorstop(global, errorCode, errorLine, addMessage)
Definition: ModError.F90:483
subroutine, public rflu_createcellmapping(pRegion)
subroutine deregisterfunction(global)
Definition: ModError.F90:469