Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RVAV_ComputeError.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: Computes Error Between Stream 1 and Stream 2 Data.
26 !
27 ! Description: none.
28 !
29 ! Input: Arrays evS1 and evS2 and their corresponding extents
30 !
31 ! Output: L2 and L8 Norms
32 !
33 ! Notes: none.
34 !
35 !******************************************************************************
36 !
37 ! $Id: RVAV_ComputeError.F90,v 1.3 2008/12/06 08:45:08 mtcampbe Exp $
38 !
39 ! Copyright: (c) 2002 by the University of Illinois
40 !
41 !******************************************************************************
42 
43 SUBROUTINE rvav_computeerror( global,iCompare,iNodes,jNodes,kNodes )
44 
45  USE moddatatypes
46  USE moderror
47  USE modglobal, ONLY : t_global
48  USE modparameters
49  USE rvav_modglobal
51  IMPLICIT NONE
52 
53 ! ... parameter
54  TYPE(t_global), POINTER :: global
55 
56  INTEGER :: icompare, inodes, jnodes, knodes
57 
58 ! ... loop variables
59  INTEGER :: i, j, k
60 
61 ! ... local variables
62  CHARACTER(CHRLEN) :: msg
63 
64  REAL(RFREAL) :: l2norm, l8norm
65  REAL(RFREAL) :: l2norms2, l8norms2
66 
67 !******************************************************************************
68 
69  CALL registerfunction( global, 'RVAV_ComputeError',&
70  'RVAV_ComputeError.F90' )
71 
72 ! initialize variables
73 
74  l2norm = 0.0_rfreal
75  l8norm = -1.0e+30_rfreal
76  l2norms2 = 0.0_rfreal
77  l8norms2 = -1.0e+30_rfreal
78 
79  DO k = 1, knodes
80  DO j = 1, jnodes
81  DO i = 1, inodes
82  l2norm = l2norm + (globalrvav%evS1(i,j,k) -globalrvav%evS2(i,j,k))**2
83  l8norm = max(l8norm,abs(globalrvav%evS1(i,j,k) - globalrvav%evS2(i,j,k)) )
84  l2norms2 = l2norms2 + globalrvav%evS2(i,j,k)**2
85  l8norms2 = max(l8norms2,abs(globalrvav%evS2(i,j,k)) )
86  ENDDO ! i
87  ENDDO ! j
88  ENDDO ! k
89 
90  WRITE(*,1010) icompare,sqrt(l2norm)/sqrt(l2norms2)*100.0_rfreal, &
91  l8norm/l8norms2*100.0_rfreal
92 
93  IF (global%verbLevel /= verbose_none) THEN
94  WRITE(*,1000) icompare,sqrt(l2norm)/(REAL(inodes*jnodes*knodes, kind=rfreal)),l8norm
95 
96  WRITE(200,*) 'ICompare = ',icompare
97 
98  DO k = 1, knodes
99  DO j = 1, jnodes
100  DO i = 1, inodes
101  WRITE(200,*) i,j,k,globalrvav%evS1(i,j,k),globalrvav%evS2(i,j,k), &
102  globalrvav%evS1(i,j,k) -globalrvav%evS2(i,j,k)
103  ENDDO ! i
104  ENDDO ! j
105  ENDDO ! k
106  END IF ! verbLevel
107 
108 ! finalize --------------------------------------------------------------------
109 
110  CALL deregisterfunction( global )
111 
112 1000 FORMAT(' Comparison ',i5,', L2 Norm= ',1pe15.7,', L8 Norm =',1pe15.7)
113 1010 FORMAT(/,' RocVaV passed the test for Comparison ',i5,/,&
114  ' Percentage of Normalized L2 Norm= ',1pe15.7,/,&
115  ' Percentage of Normalized L8 Norm =',1pe15.7)
116 
117 END SUBROUTINE rvav_computeerror
118 
119 !******************************************************************************
120 !
121 ! RCS Revision history:
122 !
123 ! $Log: RVAV_ComputeError.F90,v $
124 ! Revision 1.3 2008/12/06 08:45:08 mtcampbe
125 ! Updated license.
126 !
127 ! Revision 1.2 2008/11/19 22:18:18 mtcampbe
128 ! Added Illinois Open Source License/Copyright
129 !
130 ! Revision 1.1 2004/12/01 22:43:19 fnajjar
131 ! Initial revision after changing case
132 !
133 ! Revision 1.5 2003/05/15 02:57:07 jblazek
134 ! Inlined index function.
135 !
136 ! Revision 1.4 2002/09/10 00:01:45 f-najjar
137 ! Variable global moved into regions()
138 !
139 ! Revision 1.3 2002/06/19 14:40:15 f-najjar
140 ! Included verbLevel calls for cleanup
141 !
142 ! Revision 1.2 2002/06/19 13:59:56 f-najjar
143 ! Computed Normalized L2 and L8 errors
144 !
145 ! Revision 1.1.1.1 2002/06/03 21:41:29 f-najjar
146 ! Initial Import of RocVaV
147 !
148 !******************************************************************************
149 
150 
151 
152 
153 
154 
155 
j indices k indices k
Definition: Indexing.h:6
subroutine rvav_computeerror(global, iCompare, iNodes, jNodes, kNodes)
Vector_n max(const Array_n_const &v1, const Array_n_const &v2)
Definition: Vector_n.h:354
subroutine registerfunction(global, funName, fileName)
Definition: ModError.F90:449
double sqrt(double d)
Definition: double.h:73
blockLoc i
Definition: read.cpp:79
j indices j
Definition: Indexing.h:6
subroutine deregisterfunction(global)
Definition: ModError.F90:469