Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RFLU_ModPETScAdmin.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: Suite of routines to handle interaction with PETSc.
26 !
27 ! Description: None.
28 !
29 ! Notes: None.
30 !
31 ! ******************************************************************************
32 !
33 ! $Id: RFLU_ModPETScAdmin.F90,v 1.4 2008/12/06 08:44:23 mtcampbe Exp $
34 !
35 ! Copyright: (c) 2004 by the University of Illinois
36 !
37 ! ******************************************************************************
38 
40 
41  USE modglobal, ONLY: t_global
42  USE modparameters
43  USE moddatatypes
44  USE moderror
45  USE modbndpatch, ONLY: t_patch
46  USE moddatastruct, ONLY: t_region
47  USE modgrid, ONLY: t_grid
48  USE modmpi
49 
50  IMPLICIT NONE
51 
52  PRIVATE
53  PUBLIC :: rflu_petsc_finalize, &
55 
56 #include "include/finclude/petsc.h"
57 
58 ! ******************************************************************************
59 ! Declarations and definitions
60 ! ******************************************************************************
61 
62  CHARACTER(CHRLEN) :: &
63  RCSIdentString = '$RCSfile: RFLU_ModPETScAdmin.F90,v $ $Revision: 1.4 $'
64 
65 ! ******************************************************************************
66 ! Routines
67 ! ******************************************************************************
68 
69  CONTAINS
70 
71 
72 
73 
74 
75 ! ******************************************************************************
76 !
77 ! Purpose: Finalize PETSc.
78 !
79 ! Description: None.
80 !
81 ! Input:
82 ! global Pointer to global data
83 !
84 ! Output: None.
85 !
86 ! Notes: None.
87 !
88 ! ******************************************************************************
89 
90  SUBROUTINE rflu_petsc_finalize(global)
91 
92  IMPLICIT NONE
93 
94 ! ******************************************************************************
95 ! Declarations and definitions
96 ! ******************************************************************************
97 
98 ! ==============================================================================
99 ! Parameters
100 ! ==============================================================================
101 
102  TYPE(t_global), POINTER :: global
103 
104 ! ==============================================================================
105 ! Locals
106 ! ==============================================================================
107 
108  INTEGER :: errorflag
109 
110 ! ******************************************************************************
111 ! Start
112 ! ******************************************************************************
113 
114  CALL registerfunction(global,'RFLU_PETSC_Finalize',&
115  'RFLU_ModPETScAdmin.F90')
116 
117  IF ( global%myProcid == masterproc .AND. &
118  global%verbLevel > verbose_low ) THEN
119  WRITE(stdout,'(A,1X,A)') solver_name,'Finalizing PETSc...'
120  END IF ! global%verbLevel
121 
122 ! ******************************************************************************
123 ! Initialize PETSc
124 ! ******************************************************************************
125 
126  CALL petscfinalize(errorflag)
127  global%error = errorflag
128  IF ( global%error /= err_none ) THEN
129  CALL errorstop(global,err_petsc_output,__line__)
130  END IF ! global%error
131 
132 ! ******************************************************************************
133 ! End
134 ! ******************************************************************************
135 
136  IF ( global%myProcid == masterproc .AND. &
137  global%verbLevel > verbose_low ) THEN
138  WRITE(stdout,'(A,1X,A)') solver_name,'Finalizing PETSc done.'
139  END IF ! global%verbLevel
140 
141  CALL deregisterfunction(global)
142 
143  END SUBROUTINE rflu_petsc_finalize
144 
145 
146 
147 
148 
149 
150 ! ******************************************************************************
151 !
152 ! Purpose: Initialize PETSc.
153 !
154 ! Description: None.
155 !
156 ! Input:
157 ! global Pointer to global data
158 !
159 ! Output: None.
160 !
161 ! Notes: None.
162 !
163 ! ******************************************************************************
164 
165  SUBROUTINE rflu_petsc_init(global)
166 
167  IMPLICIT NONE
168 
169 ! ******************************************************************************
170 ! Declarations and definitions
171 ! ******************************************************************************
172 
173 ! ==============================================================================
174 ! Parameters
175 ! ==============================================================================
176 
177  TYPE(t_global), POINTER :: global
178 
179 ! ==============================================================================
180 ! Locals
181 ! ==============================================================================
182 
183  INTEGER :: errorflag
184 
185 ! ******************************************************************************
186 ! Start
187 ! ******************************************************************************
188 
189  CALL registerfunction(global,'RFLU_PETSC_Init',&
190  'RFLU_ModPETScAdmin.F90')
191 
192  IF ( global%myProcid == masterproc .AND. &
193  global%verbLevel > verbose_low ) THEN
194  WRITE(stdout,'(A,1X,A)') solver_name,'Initializing PETSc...'
195  END IF ! global%verbLevel
196 
197 ! ******************************************************************************
198 ! Initialize PETSc
199 ! ******************************************************************************
200 
201  CALL petscinitialize(petsc_null_character,errorflag)
202  global%error = errorflag
203  IF ( global%error /= err_none ) THEN
204  CALL errorstop(global,err_petsc_output,__line__)
205  END IF ! global%error
206 
207 ! ******************************************************************************
208 ! End
209 ! ******************************************************************************
210 
211  IF ( global%myProcid == masterproc .AND. &
212  global%verbLevel > verbose_low ) THEN
213  WRITE(stdout,'(A,1X,A)') solver_name,'Initializing PETSc done.'
214  END IF ! global%verbLevel
215 
216  CALL deregisterfunction(global)
217 
218  END SUBROUTINE rflu_petsc_init
219 
220 
221 
222 
223 ! ******************************************************************************
224 ! End
225 ! ******************************************************************************
226 
227 END MODULE rflu_modpetscadmin
228 
229 
230 ! ******************************************************************************
231 !
232 ! RCS Revision history:
233 !
234 ! $Log: RFLU_ModPETScAdmin.F90,v $
235 ! Revision 1.4 2008/12/06 08:44:23 mtcampbe
236 ! Updated license.
237 !
238 ! Revision 1.3 2008/11/19 22:17:34 mtcampbe
239 ! Added Illinois Open Source License/Copyright
240 !
241 ! Revision 1.2 2006/04/07 15:19:20 haselbac
242 ! Removed tabs
243 !
244 ! Revision 1.1 2004/12/19 15:40:45 haselbac
245 ! Initial revision
246 !
247 ! ******************************************************************************
248 
249 
250 
251 
252 
253 
254 
255 
subroutine registerfunction(global, funName, fileName)
Definition: ModError.F90:449
subroutine, public rflu_petsc_finalize(global)
subroutine, public rflu_petsc_init(global)
subroutine errorstop(global, errorCode, errorLine, addMessage)
Definition: ModError.F90:483
subroutine deregisterfunction(global)
Definition: ModError.F90:469