Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TURB_CalcMetrics.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: generate metrics specific for turbulence model selected, if needed
26 !
27 ! Description: none.
28 !
29 ! Input: regions = data of all grid regions.
30 !
31 ! Output: regions = relevant metrics computed.
32 !
33 ! Notes: none.
34 !
35 !******************************************************************************
36 !
37 ! $Id: TURB_CalcMetrics.F90,v 1.11 2009/08/26 12:28:52 mtcampbe Exp $
38 !
39 ! Copyright: (c) 2003 by the University of Illinois
40 !
41 !******************************************************************************
42 
43 SUBROUTINE turb_calcmetrics( regions, isInit ) ! PUBLIC
44 
45  USE moddatatypes
46  USE moddatastruct, ONLY : t_region
47  USE modglobal, ONLY : t_global
49  USE moderror
50  USE modmpi
51  USE modparameters
53  IMPLICIT NONE
54 
55 ! ... parameters
56  TYPE(t_region), POINTER :: regions(:)
57  INTEGER :: isinit
58 
59 ! ... loop variables
60  INTEGER :: ireg
61 
62 ! ... local variables
63  TYPE(t_global), POINTER :: global
64  INTEGER :: nregions, globalwdistmethod, sndinteg, rcvinteg
65  LOGICAL :: compwdist
66 
67 !******************************************************************************
68 
69  global => regions(1)%global
70 
71  CALL registerfunction( global,'TURB_CalcMetrics',&
72  'TURB_CalcMetrics.F90' )
73 
74 ! get general parameters ------------------------------------------------------
75 
76 #ifdef RFLO
77  nregions = global%nRegions
78 #endif
79 #ifdef RFLU
80  nregions = global%nRegionsLocal
81 #endif
82 
83 ! compute RaNS/DES metrics ----------------------------------------------------
84 
85 ! first get total number of no-slip and injection wall faces
86 
87  IF (isinit == 1) THEN
88 #ifdef MPI
89  sndinteg = global%turbWallDim
90  CALL mpi_allreduce( sndinteg,rcvinteg,1,mpi_integer, mpi_sum, &
91  global%mpiComm, global%mpierr )
92  IF (global%mpierr /=0 ) CALL errorstop( global,err_mpi_trouble,__line__ )
93  global%turbWallDim = rcvinteg
94 #endif
95  ENDIF
96 
97 ! RaNS wall distances or DES length scales ------------------------------------
98 
99 ! global method of wall distance computation
100 
101  globalwdistmethod = 0
102 
103  DO ireg=1,nregions
104  globalwdistmethod = &
105  max( globalwdistmethod , regions(ireg)%turbInput%wDistMethod )
106  ENDDO
107 
108 #ifdef RFLU
109 #ifdef CHARM
110  sndinteg = globalwdistmethod
111  CALL fem_reduce( global%fieldFlagTurbInt,sndinteg,rcvinteg,fem_max )
112  globalwdistmethod = rcvinteg
113 #endif
114 #endif
115 
116 ! frequency of wall distance computation
117 
118  compwdist = .false.
119  IF (global%turbCalcWDistFreq == calcwdist_ini .AND. isinit == 1) THEN
120  compwdist = .true.
121  ENDIF
122  IF (global%turbCalcWDistFreq == calcwdist_fdt .AND. &
123  regions(1)%irkStep == global%nrkSteps) THEN
124  compwdist = .true.
125  ENDIF
126  IF (global%turbCalcWDistFreq == calcwdist_sdt .AND. &
127  regions(1)%irkStep == global%nrkSteps .AND. &
128  (global%currentTime+global%dtMin) >= global%dTimeSystem) THEN
129  compwdist = .true.
130  ENDIF
131  IF (global%turbCalcWDistFreq == calcwdist_rem) THEN
132  CALL errorstop( global,err_turb_ransinput,__line__, &
133  'remesh flag is required but still missing')
134  ENDIF
135 
136 ! compute wall distance if needed by selected model, at the right frequency
137 
138  IF ((global%turbCalcWDist .eqv. .true.) .AND. (compwdist .eqv. .true.)) THEN
139  IF (globalwdistmethod == wdist_direct) THEN
140  CALL turb_coranswalldistov( regions )
141  ELSE
142  CALL errorstop( global,err_turb_ransinput,__line__, &
143  'only direct method of wall distance is currently possible')
144  ENDIF
145  ENDIF
146 
147 ! compute LES and WLM metrics -------------------------------------------------
148 ! (to be moved from TURB_InitSolution and TURB_CoViscousFluxes)
149 
150 ! finalize --------------------------------------------------------------------
151 
152  CALL deregisterfunction( global )
153 
154 END SUBROUTINE turb_calcmetrics
155 
156 !******************************************************************************
157 !
158 ! RCS Revision history:
159 !
160 ! $Log: TURB_CalcMetrics.F90,v $
161 ! Revision 1.11 2009/08/26 12:28:52 mtcampbe
162 ! Ported to Hera. Fixed logical expression syntax errors. Replaced all
163 ! IF (logical_variable) with IF (logical_variable .eqv. .true.) as
164 ! consistent with the specification. Also changed: IF( ASSOCIATED(expr) )
165 ! to IF ( ASSOCIATED(expr) .eqv. .true. ). Intel compilers produce code
166 ! which silently fails for some mal-formed expressions, so these changes
167 ! are a net which should ensure that they are evaluated as intended.
168 !
169 ! Revision 1.10 2008/12/06 08:44:41 mtcampbe
170 ! Updated license.
171 !
172 ! Revision 1.9 2008/11/19 22:17:53 mtcampbe
173 ! Added Illinois Open Source License/Copyright
174 !
175 ! Revision 1.8 2005/12/29 19:46:05 wasistho
176 ! removed CHARM stuff
177 !
178 ! Revision 1.7 2005/04/15 15:07:34 haselbac
179 ! Removed Charm/FEM stuff
180 !
181 ! Revision 1.6 2004/04/20 20:45:46 wasistho
182 ! added user option for frequency of computing wall distance
183 !
184 ! Revision 1.5 2004/03/19 02:44:47 wasistho
185 ! prepared for RFLU
186 !
187 ! Revision 1.4 2004/03/13 04:28:32 wasistho
188 ! prepared for RFLU
189 !
190 ! Revision 1.3 2004/03/13 03:14:30 wasistho
191 ! get rid of flo/flu identifier in TURB_Co.. routines
192 !
193 ! Revision 1.2 2004/03/08 23:29:47 wasistho
194 ! changed turb nomenclature
195 !
196 ! Revision 1.1 2004/03/05 04:37:00 wasistho
197 ! changed nomenclature
198 !
199 ! Revision 1.2 2004/02/04 22:30:30 wasistho
200 ! move MPIsum of global%turbWallDim from allocateMemory to calcMetrics
201 !
202 ! Revision 1.1 2003/10/07 02:17:02 wasistho
203 ! initial installation of RaNS-SA and DES
204 !
205 !
206 !******************************************************************************
207 
208 
209 
210 
211 
212 
213 
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
subroutine turb_coranswalldistov(regions)
subroutine turb_calcmetrics(regions, isInit)
subroutine errorstop(global, errorCode, errorLine, addMessage)
Definition: ModError.F90:483
subroutine deregisterfunction(global)
Definition: ModError.F90:469