Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RFLU_PrintWriteConvergence.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: Print and write convergence history.
26 !
27 ! Description: None.
28 !
29 ! Input:
30 ! global Pointer to global data
31 !
32 ! Output: None.
33 !
34 ! Notes: None.
35 !
36 ! ******************************************************************************
37 !
38 ! $Id: RFLU_PrintWriteConvergence.F90,v 1.4 2008/12/06 08:44:30 mtcampbe Exp $
39 !
40 ! Copyright: (c) 2005 by the University of Illinois
41 !
42 ! ******************************************************************************
43 
44 SUBROUTINE rflu_printwriteconvergence(global)
45 
46  USE modparameters
47  USE moddatatypes
48  USE modglobal, ONLY: t_global
49  USE moderror
50  USE modmpi
51 
52  USE modtools, ONLY: makenonzero
53 
54  IMPLICIT NONE
55 
56 ! ******************************************************************************
57 ! Definitions and declarations
58 ! ******************************************************************************
59 
60 ! ==============================================================================
61 ! Arguments
62 ! ==============================================================================
63 
64  TYPE(t_global), POINTER :: global
65 
66 ! ==============================================================================
67 ! Locals
68 ! ==============================================================================
69 
70  INTEGER :: errorflag
71  REAL(RFREAL) :: resnorm
72  REAL(RFREAL), DIMENSION(6) :: localvals,globalvals
73 
74 ! ******************************************************************************
75 ! Start
76 ! ******************************************************************************
77 
78  CALL registerfunction(global,'RFLU_PrintWriteConvergence',&
79  'RFLU_PrintWriteConvergence.F90')
80 
81 ! ******************************************************************************
82 ! Reduce data
83 ! ******************************************************************************
84 
85  localvals(1) = global%forceX
86  localvals(2) = global%forceY
87  localvals(3) = global%forceZ
88  localvals(4) = global%massIn
89  localvals(5) = global%massOut
90  localvals(6) = global%stopRun
91 
92  CALL mpi_allreduce(localvals,globalvals,6,mpi_rfreal,mpi_sum,global%mpiComm, &
93  errorflag)
94  global%error = errorflag
95  IF ( global%error /= err_none ) THEN
96  CALL errorstop(global,err_mpi_trouble,__line__)
97  END IF ! global%errorFlag
98 
99  global%forceX = globalvals(1)
100  global%forceY = globalvals(2)
101  global%forceZ = globalvals(3)
102  global%massIn = globalvals(4)
103  global%massOut = globalvals(5)
104  global%stopRun = globalvals(6)
105 
106 ! ******************************************************************************
107 ! Print and write global data
108 ! ******************************************************************************
109 
110 ! ==============================================================================
111 ! Steady flow
112 ! ==============================================================================
113 
114  IF ( (global%flowType == flow_steady) .AND. &
115  (global%myProcid == masterproc) ) THEN
116  IF ( global%currentIter == 1 ) THEN
117  resnorm = 1.0_rfreal
118  ELSE
119  resnorm = global%residual/makenonzero(global%resInit)
120  resnorm = makenonzero(resnorm)
121  END IF ! global%currentIter
122 
123  IF ( global%verbLevel /= verbose_none ) THEN
124  WRITE(stdout,'(A,1X,I6,1PE13.4,5E13.4)') solver_name, &
125  global%currentIter,log10(resnorm), &
126  global%forceX,global%forceY,global%forceZ, &
127  global%massIn,global%massOut
128  END IF ! global%verbLevel
129 
130  WRITE(if_conver,'(I6,1PE13.4,5E13.4)') &
131  global%currentIter,log10(resnorm), &
132  global%forceX,global%forceY,global%forceZ, &
133  global%massIn,global%massOut
134 
135 ! ==============================================================================
136 ! Unsteady flow
137 ! ==============================================================================
138 
139  ELSE IF ( (global%flowType == flow_unsteady) .AND. &
140  (global%myProcid==masterproc) ) THEN
141  IF ( global%verbLevel /= verbose_none ) THEN
142  WRITE(stdout,'(A,1X,1PE12.5,6E13.4)') solver_name, &
143  global%currentTime,global%dtMin, &
144  global%forceX,global%forceY,global%forceZ, &
145  global%massIn,global%massOut
146  END IF ! global%verbLevel
147 
148  WRITE(if_conver,'(1PE12.5,6E13.4)') &
149  global%currentTime,global%dtMin, &
150  global%forceX,global%forceY,global%forceZ, &
151  global%massIn,global%massOut
152  END IF ! global%flowType
153 
154 ! ******************************************************************************
155 ! Start
156 ! ******************************************************************************
157 
158  CALL deregisterfunction(global)
159 
160 END SUBROUTINE rflu_printwriteconvergence
161 
162 ! ******************************************************************************
163 !
164 ! RCS Revision history:
165 !
166 ! $Log: RFLU_PrintWriteConvergence.F90,v $
167 ! Revision 1.4 2008/12/06 08:44:30 mtcampbe
168 ! Updated license.
169 !
170 ! Revision 1.3 2008/11/19 22:17:43 mtcampbe
171 ! Added Illinois Open Source License/Copyright
172 !
173 ! Revision 1.2 2006/04/07 15:19:22 haselbac
174 ! Removed tabs
175 !
176 ! Revision 1.1 2005/04/15 15:07:10 haselbac
177 ! Initial revision
178 !
179 ! ******************************************************************************
180 
181 
182 
183 
184 
185 
186 
subroutine rflu_printwriteconvergence(global)
subroutine registerfunction(global, funName, fileName)
Definition: ModError.F90:449
subroutine errorstop(global, errorCode, errorLine, addMessage)
Definition: ModError.F90:483
subroutine deregisterfunction(global)
Definition: ModError.F90:469
real(rfreal) function makenonzero(x)
Definition: ModTools.F90:85