Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RFLU_CentralSecondPatch.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: Compute central convective fluxes using second-order accurate
26 ! approximation through a patch by using an average of variables.
27 !
28 ! Description: None.
29 !
30 ! Input:
31 ! pRegion Pointer to region
32 ! pPatch Pointer to patch
33 !
34 ! Output: None.
35 !
36 ! Notes: None.
37 !
38 ! ******************************************************************************
39 !
40 ! $Id: RFLU_CentralSecondPatch.F90,v 1.25 2008/12/06 08:44:29 mtcampbe Exp $
41 !
42 ! Copyright: (c) 2003-2005 by the University of Illinois
43 !
44 ! ******************************************************************************
45 
46 SUBROUTINE rflu_centralsecondpatch(pRegion,pPatch)
47 
48  USE modglobal, ONLY: t_global
49  USE moddatatypes
50  USE modbndpatch, ONLY: t_patch
51  USE moddatastruct, ONLY: t_region
52  USE moderror
53  USE modparameters
54  USE modmpi
55 
61 
62  USE modinterfaces, ONLY: bcondfarfieldperf, &
70  mixtperf_r_m, &
73 
74  IMPLICIT NONE
75 
76 ! ******************************************************************************
77 ! Definitions and declarations
78 ! ******************************************************************************
79 
80 ! ==============================================================================
81 ! Arguments
82 ! ==============================================================================
83 
84  TYPE(t_patch), POINTER :: ppatch
85  TYPE(t_region), POINTER :: pregion
86 
87 ! ==============================================================================
88 ! Locals
89 ! ==============================================================================
90 
91  LOGICAL :: corrflag,decideprintflag
92  CHARACTER(CHRLEN) :: rcsidentstring
93  INTEGER, PARAMETER :: max_inoutflow_locs = 10
94  INTEGER :: c1,bcoptfixed,bcopttype,distrib,gasmodel,ifl,indcp,indgs,indmf, &
95  indsd,indmol,nlocs
96  INTEGER :: loc(max_inoutflow_locs,min_val:max_val)
97  REAL(RFREAL) :: aoa,aos,betah,betav,corr,cp,cx,cy,dx,dy,dz,er,fs,fsu,g,hl, &
98  icmassref,icpref,irl,irr,liftcoef,mach,mf,minj,mm,nm,nx,ny, &
99  nz,pa,pl,pf,pr,pref,ptot,ql,qr,rgas,rhoa,rhoea,rhoua,rhova, &
100  rhowa,rl,rel,rer,rul,rur,rvl,rvr,rwl,rwr,rr,rref,tf,tinj, &
101  tr,ttot,uinj,ul,ur,vcont,vinj,vl,vm2,vr,vref,winj,wl,wr,xc, &
102  yc,zc
103  REAL(RFREAL) :: flx(5)
104  REAL(RFREAL), DIMENSION(:), POINTER :: mfmixt
105  REAL(RFREAL), DIMENSION(:,:), POINTER :: cv,dv,gv,rhs,vals,sd
106  REAL(RFREAL), DIMENSION(:,:,:), POINTER :: grad
107  TYPE(t_global), POINTER :: global
108 
109 ! ******************************************************************************
110 ! Start
111 ! ******************************************************************************
112 
113  rcsidentstring = '$RCSfile: RFLU_CentralSecondPatch.F90,v $ $Revision: 1.25 $'
114 
115  global => pregion%global
116 
117  CALL registerfunction(global,'RFLU_CentralSecondPatch',&
118  'RFLU_CentralSecondPatch.F90')
119 
120 ! ******************************************************************************
121 ! Set pointers and variables
122 ! ******************************************************************************
123 
124  indcp = pregion%mixtInput%indCp
125  indmf = pregion%mixtInput%indMfMixt
126  indsd = pregion%mixtInput%indSd
127  indmol = pregion%mixtInput%indMol
128  gasmodel = pregion%mixtInput%gasModel
129 
130  indgs = pregion%grid%indGs
131 
132  distrib = ppatch%mixt%distrib
133 
134  cv => pregion%mixt%cv
135  dv => pregion%mixt%dv
136  gv => pregion%mixt%gv
137  grad => pregion%mixt%gradCell
138  rhs => pregion%mixt%rhs
139  sd => pregion%mixt%sd
140 
141  mfmixt => ppatch%mfMixt
142 
143  nlocs = 0
144 
145  decideprintflag = rflu_decideprint(global)
146 
147  pref = global%refPressure
148  rref = global%refDensity
149  vref = global%refVelocity
150 
151  icpref = 2.0_rfreal/(rref*vref*vref)
152  icmassref = 1.0_rfreal/(rref*vref)
153 
154 ! ******************************************************************************
155 ! Select boundary type
156 ! ******************************************************************************
157 
158  SELECT CASE ( ppatch%bcType )
159 
160 ! ==============================================================================
161 ! Inflow (based on total quantities and flow angles)
162 ! ==============================================================================
163 
164  CASE ( bc_inflow_totang )
165  vals => ppatch%mixt%vals
166  bcopttype = ppatch%mixt%switches(bcswi_inflow_type)
167  bcoptfixed = ppatch%mixt%switches(bcswi_inflow_fixed)
168 
169  DO ifl = 1,ppatch%nBFaces
170  c1 = ppatch%bf2c(ifl)
171 
172  nx = ppatch%fn(xcoord,ifl)
173  ny = ppatch%fn(ycoord,ifl)
174  nz = ppatch%fn(zcoord,ifl)
175  nm = ppatch%fn(xyzmag,ifl)
176 
177  xc = ppatch%fc(xcoord,ifl)
178  yc = ppatch%fc(ycoord,ifl)
179  zc = ppatch%fc(zcoord,ifl)
180 
181  fs = ppatch%gs(indgs*ifl)
182 
183  rl = cv(cv_mixt_dens,c1)
184  irl = 1.0_rfreal/rl
185 
186  ul = cv(cv_mixt_xmom,c1)*irl
187  vl = cv(cv_mixt_ymom,c1)*irl
188  wl = cv(cv_mixt_zmom,c1)*irl
189  pl = dv(dv_mixt_pres,c1)
190 
191  dx = xc - pregion%grid%cofg(xcoord,c1)
192  dy = yc - pregion%grid%cofg(ycoord,c1)
193  dz = zc - pregion%grid%cofg(zcoord,c1)
194 
195  rl = rl + grad(xcoord,grc_mixt_dens,c1)*dx &
196  + grad(ycoord,grc_mixt_dens,c1)*dy &
197  + grad(zcoord,grc_mixt_dens,c1)*dz
198  ul = ul + grad(xcoord,grc_mixt_xvel,c1)*dx &
199  + grad(ycoord,grc_mixt_xvel,c1)*dy &
200  + grad(zcoord,grc_mixt_xvel,c1)*dz
201  vl = vl + grad(xcoord,grc_mixt_yvel,c1)*dx &
202  + grad(ycoord,grc_mixt_yvel,c1)*dy &
203  + grad(zcoord,grc_mixt_yvel,c1)*dz
204  wl = wl + grad(xcoord,grc_mixt_zvel,c1)*dx &
205  + grad(ycoord,grc_mixt_zvel,c1)*dy &
206  + grad(zcoord,grc_mixt_zvel,c1)*dz
207  pl = pl + grad(xcoord,grc_mixt_pres,c1)*dx &
208  + grad(ycoord,grc_mixt_pres,c1)*dy &
209  + grad(zcoord,grc_mixt_pres,c1)*dz
210 
211  rul = rl*ul
212  rvl = rl*vl
213  rwl = rl*wl
214 
215  ptot = vals(bcdat_inflow_ptot, distrib*ifl)
216  ttot = vals(bcdat_inflow_ttot, distrib*ifl)
217  betah = vals(bcdat_inflow_betah,distrib*ifl)
218  betav = vals(bcdat_inflow_betav,distrib*ifl)
219 
220  IF ( bcopttype /= bcopt_subsonic ) THEN
221  mach = vals(bcdat_inflow_mach,distrib*ifl)
222  ELSE
223  mach = 0.0_rfreal
224  END IF ! bcOptType
225 
226  IF ( gasmodel == gas_model_tcperf ) THEN
227  cp = gv(gv_mixt_cp ,indcp *c1)
228  mm = gv(gv_mixt_mol,indmol*c1)
229  rgas = mixtperf_r_m(mm)
230  g = mixtperf_g_cpr(cp,rgas)
231 
232  rel = rl*mixtperf_eo_dgpuvw(rl,g,pl,ul,vl,wl)
233 
234  CALL bcondinflowperf(bcopttype,bcoptfixed,ptot,ttot,betah,betav, &
235  mach,nx,ny,nz,cp,mm,rl,rul,rvl,rwl,rr,rur, &
236  rvr,rwr,rer,pr)
237  ELSE
238  CALL errorstop(global,err_reached_default,__line__)
239  END IF ! gasModel
240 
241  ql = (rul*nx + rvl*ny + rwl*nz)/rl - fs
242  qr = (rur*nx + rvr*ny + rwr*nz)/rr - fs
243 
244  ul = rul/rl
245  vl = rvl/rl
246  wl = rwl/rl
247  ur = rur/rr
248  vr = rvr/rr
249  wr = rwr/rr
250 
251  flx(1) = 0.5_rfreal*(ql* rl + qr* rr )*nm
252  flx(2) = 0.5_rfreal*(ql* rul + pl*nx + qr* rur + pr*nx)*nm
253  flx(3) = 0.5_rfreal*(ql* rvl + pl*ny + qr* rvr + pr*ny)*nm
254  flx(4) = 0.5_rfreal*(ql* rwl + pl*nz + qr* rwr + pr*nz)*nm
255  flx(5) = 0.5_rfreal*(ql*(rel + pl) + pl*fs + qr*(rer + pr) + pr*fs)*nm
256 
257  mfmixt(indmf*ifl) = flx(1)
258 
259  ppatch%cp(ifl) = icpref*(0.5_rfreal*(pl + pr) - pref)
260  ppatch%cmass(ifl) = icmassref*flx(1)/nm
261  ppatch%cmom(xcoord,ifl) = icpref*0.5_rfreal*(ul+ur)*flx(1)/nm
262  ppatch%cmom(ycoord,ifl) = icpref*0.5_rfreal*(vl+vr)*flx(1)/nm
263  ppatch%cmom(zcoord,ifl) = icpref*0.5_rfreal*(wl+wr)*flx(1)/nm
264 
265  rhs(cv_mixt_dens,c1) = rhs(cv_mixt_dens,c1) + flx(1)
266  rhs(cv_mixt_xmom,c1) = rhs(cv_mixt_xmom,c1) + flx(2)
267  rhs(cv_mixt_ymom,c1) = rhs(cv_mixt_ymom,c1) + flx(3)
268  rhs(cv_mixt_zmom,c1) = rhs(cv_mixt_zmom,c1) + flx(4)
269  rhs(cv_mixt_ener,c1) = rhs(cv_mixt_ener,c1) + flx(5)
270 
271  sd(sd_xmom,c1*indsd) = sd(sd_xmom,c1*indsd) + 0.5_rfreal*(rul/rl + rur/rr)*flx(1)
272  sd(sd_ymom,c1*indsd) = sd(sd_ymom,c1*indsd) + 0.5_rfreal*(rvl/rl + rvr/rr)*flx(1)
273  sd(sd_zmom,c1*indsd) = sd(sd_zmom,c1*indsd) + 0.5_rfreal*(rwl/rl + rwr/rr)*flx(1)
274 
275  IF ( pregion%irkStep == 1 ) THEN
276  global%massIn = global%massIn - min(flx(1),0.0_rfreal)
277  global%massOut = global%massOut + max(flx(1),0.0_rfreal)
278  END IF ! pRegion
279 
280 
281  IF ( (global%checkLevel == check_high) .AND. &
282  (global%verbLevel >= verbose_high) .AND. &
283  (global%myProcid == masterproc) .AND. &
284  (decideprintflag .EQV. .true.) ) THEN
285  IF ( flx(1) > 0.0_rfreal ) THEN
286  nlocs = nlocs + 1
287 
288  IF ( nlocs == 1 ) THEN
289  global%warnCounter = global%warnCounter + 1
290 
291  WRITE(stdout,'(A,1X,A,1X,I9)') solver_name, &
292  '*** WARNING *** Outflow detected at inflow boundary!'
293  WRITE(stdout,'(A,3X,A,1X,I5.5)') solver_name,'Global region:', &
294  pregion%iRegionGlobal
295  IF ( global%flowType == flow_unsteady ) THEN
296  WRITE(stdout,'(A,3X,A,1X,1PE11.5)') solver_name, &
297  'Current time:', &
298  global%currentTime
299  ELSE
300  WRITE(stdout,'(A,3X,A,1X,I6.6)') solver_name, &
301  'Current iteration number:', &
302  global%currentIter
303  END IF ! global%flowType
304 
305  WRITE(stdout,'(A,3X,A,1X,I1)') solver_name, &
306  'Runge-Kutta stage:', &
307  pregion%irkStep
308  END IF ! nLocs
309 
310  IF ( nlocs <= max_inoutflow_locs ) THEN
311  loc(nlocs,min_val:max_val) = c1
312  END IF ! nLocs
313  END IF ! flx(1)
314  END IF ! global%checkLevel
315  END DO ! ifl
316 
317 ! ------------------------------------------------------------------------------
318 ! Write info on outflow at inflow boundary
319 ! ------------------------------------------------------------------------------
320 
321  IF ( (global%checkLevel == check_high) .AND. &
322  (global%verbLevel >= verbose_high) .AND. &
323  (global%myProcid == masterproc) .AND. &
324  (decideprintflag .EQV. .true.) .AND. &
325  (nlocs > 0) ) THEN
326  IF ( nlocs > max_inoutflow_locs ) THEN
327  WRITE(stdout,'(A,3X,A,1X,I3,1X,A,1X,I9,1X,A)') solver_name, &
328  'Only wrote the first',max_inoutflow_locs,'of',nlocs, &
329  'inflow faces with outflow.'
330  CALL rflu_printlocinfo(pregion,loc,max_inoutflow_locs, &
331  locinfo_mode_silent,output_mode_anybody)
332  ELSE
333  CALL rflu_printlocinfo(pregion,loc(1:nlocs,min_val:max_val),nlocs, &
334  locinfo_mode_silent,output_mode_anybody)
335  END IF ! nLocs
336  END IF ! global%checkLevel
337 
338 ! ==============================================================================
339 ! Inflow (based on velocities and temperature)
340 ! ==============================================================================
341 
342  CASE ( bc_inflow_veltemp )
343  vals => ppatch%mixt%vals
344  bcopttype = ppatch%mixt%switches(bcswi_inflow_type)
345 
346  DO ifl = 1,ppatch%nBFaces
347  c1 = ppatch%bf2c(ifl)
348 
349  nx = ppatch%fn(xcoord,ifl)
350  ny = ppatch%fn(ycoord,ifl)
351  nz = ppatch%fn(zcoord,ifl)
352  nm = ppatch%fn(xyzmag,ifl)
353 
354  xc = ppatch%fc(xcoord,ifl)
355  yc = ppatch%fc(ycoord,ifl)
356  zc = ppatch%fc(zcoord,ifl)
357 
358  fs = ppatch%gs(indgs*ifl)
359 
360  rl = cv(cv_mixt_dens,c1)
361  irl = 1.0_rfreal/rl
362 
363  ul = cv(cv_mixt_xmom,c1)*irl
364  vl = cv(cv_mixt_ymom,c1)*irl
365  wl = cv(cv_mixt_zmom,c1)*irl
366  pl = dv(dv_mixt_pres,c1)
367 
368  dx = xc - pregion%grid%cofg(xcoord,c1)
369  dy = yc - pregion%grid%cofg(ycoord,c1)
370  dz = zc - pregion%grid%cofg(zcoord,c1)
371 
372  rl = rl + grad(xcoord,grc_mixt_dens,c1)*dx &
373  + grad(ycoord,grc_mixt_dens,c1)*dy &
374  + grad(zcoord,grc_mixt_dens,c1)*dz
375  ul = ul + grad(xcoord,grc_mixt_xvel,c1)*dx &
376  + grad(ycoord,grc_mixt_xvel,c1)*dy &
377  + grad(zcoord,grc_mixt_xvel,c1)*dz
378  vl = vl + grad(xcoord,grc_mixt_yvel,c1)*dx &
379  + grad(ycoord,grc_mixt_yvel,c1)*dy &
380  + grad(zcoord,grc_mixt_yvel,c1)*dz
381  wl = wl + grad(xcoord,grc_mixt_zvel,c1)*dx &
382  + grad(ycoord,grc_mixt_zvel,c1)*dy &
383  + grad(zcoord,grc_mixt_zvel,c1)*dz
384  pl = pl + grad(xcoord,grc_mixt_pres,c1)*dx &
385  + grad(ycoord,grc_mixt_pres,c1)*dy &
386  + grad(zcoord,grc_mixt_pres,c1)*dz
387 
388  rul = rl*ul
389  rvl = rl*vl
390  rwl = rl*wl
391 
392  ur = vals(bcdat_inflow_u,distrib*ifl)
393  vr = vals(bcdat_inflow_v,distrib*ifl)
394  wr = vals(bcdat_inflow_w,distrib*ifl)
395  tr = vals(bcdat_inflow_t,distrib*ifl)
396 
397  IF ( gasmodel == gas_model_tcperf ) THEN
398  cp = gv(gv_mixt_cp ,indcp *c1)
399  mm = gv(gv_mixt_mol,indmol*c1)
400  rgas = mixtperf_r_m(mm)
401  g = mixtperf_g_cpr(cp,rgas)
402 
403  IF ( bcopttype /= bcopt_subsonic ) THEN
404  pr = vals(bcdat_inflow_p,distrib*ifl)
405  rr = mixtperf_d_prt(pr,rgas,tr)
406  ELSE
407  rr = rl
408  pr = mixtperf_p_drt(rr,rgas,tr)
409  END IF ! bcOptType
410 
411  rel = rl*mixtperf_eo_dgpuvw(rl,g,pl,ul,vl,wl)
412  rer = rr*mixtperf_eo_dgpuvw(rr,g,pr,ur,vr,wr)
413  ELSE
414  CALL errorstop(global,err_reached_default,__line__)
415  END IF ! gasModel
416 
417  rur = rr*ur
418  rvr = rr*vr
419  rwr = rr*wr
420 
421  ql = (rul*nx + rvl*ny + rwl*nz)/rl - fs
422  qr = (rur*nx + rvr*ny + rwr*nz)/rr - fs
423 
424  ul = rul/rl
425  vl = rvl/rl
426  wl = rwl/rl
427 
428  flx(1) = 0.5_rfreal*(ql* rl + qr* rr )*nm
429  flx(2) = 0.5_rfreal*(ql* rul + pl*nx + qr* rur + pr*nx)*nm
430  flx(3) = 0.5_rfreal*(ql* rvl + pl*ny + qr* rvr + pr*ny)*nm
431  flx(4) = 0.5_rfreal*(ql* rwl + pl*nz + qr* rwr + pr*nz)*nm
432  flx(5) = 0.5_rfreal*(ql*(rel + pl) + pl*fs + qr*(rer + pr) + pr*fs)*nm
433 
434  mfmixt(indmf*ifl) = flx(1)
435 
436  ppatch%cp(ifl) = icpref*(0.5_rfreal*(pl + pr) - pref)
437  ppatch%cmass(ifl) = icmassref*flx(1)/nm
438  ppatch%cmom(xcoord,ifl) = icpref*0.5_rfreal*(ul+ur)*flx(1)/nm
439  ppatch%cmom(ycoord,ifl) = icpref*0.5_rfreal*(vl+vr)*flx(1)/nm
440  ppatch%cmom(zcoord,ifl) = icpref*0.5_rfreal*(wl+wr)*flx(1)/nm
441 
442  rhs(cv_mixt_dens,c1) = rhs(cv_mixt_dens,c1) + flx(1)
443  rhs(cv_mixt_xmom,c1) = rhs(cv_mixt_xmom,c1) + flx(2)
444  rhs(cv_mixt_ymom,c1) = rhs(cv_mixt_ymom,c1) + flx(3)
445  rhs(cv_mixt_zmom,c1) = rhs(cv_mixt_zmom,c1) + flx(4)
446  rhs(cv_mixt_ener,c1) = rhs(cv_mixt_ener,c1) + flx(5)
447 
448  sd(sd_xmom,c1*indsd) = sd(sd_xmom,c1*indsd) + 0.5_rfreal*(rul/rl + rur/rr)*flx(1)
449  sd(sd_ymom,c1*indsd) = sd(sd_ymom,c1*indsd) + 0.5_rfreal*(rvl/rl + rvr/rr)*flx(1)
450  sd(sd_zmom,c1*indsd) = sd(sd_zmom,c1*indsd) + 0.5_rfreal*(rwl/rl + rwr/rr)*flx(1)
451 
452  IF ( pregion%irkStep == 1 ) THEN
453  global%massIn = global%massIn - min(flx(1),0.0_rfreal)
454  global%massOut = global%massOut + max(flx(1),0.0_rfreal)
455  END IF ! pRegion
456 
457 
458  IF ( (global%checkLevel == check_high) .AND. &
459  (global%verbLevel >= verbose_high) .AND. &
460  (global%myProcid == masterproc) .AND. &
461  (decideprintflag .EQV. .true.) ) THEN
462  IF ( flx(1) > 0.0_rfreal ) THEN
463  nlocs = nlocs + 1
464 
465  IF ( nlocs == 1 ) THEN
466  global%warnCounter = global%warnCounter + 1
467 
468  WRITE(stdout,'(A,1X,A,1X,I9)') solver_name, &
469  '*** WARNING *** Outflow detected at inflow boundary!'
470  WRITE(stdout,'(A,3X,A,1X,I5.5)') solver_name,'Global region:', &
471  pregion%iRegionGlobal
472  IF ( global%flowType == flow_unsteady ) THEN
473  WRITE(stdout,'(A,3X,A,1X,1PE11.5)') solver_name, &
474  'Current time:', &
475  global%currentTime
476  ELSE
477  WRITE(stdout,'(A,3X,A,1X,I6.6)') solver_name, &
478  'Current iteration number:', &
479  global%currentIter
480  END IF ! global%flowType
481 
482  WRITE(stdout,'(A,3X,A,1X,I1)') solver_name, &
483  'Runge-Kutta stage:', &
484  pregion%irkStep
485  END IF ! nLocs
486 
487  IF ( nlocs <= max_inoutflow_locs ) THEN
488  loc(nlocs,min_val:max_val) = c1
489  END IF ! nLocs
490  END IF ! flx(1)
491  END IF ! global%checkLevel
492  END DO ! ifl
493 
494 ! ------------------------------------------------------------------------------
495 ! Write info on outflow at inflow boundary
496 ! ------------------------------------------------------------------------------
497 
498  IF ( (global%checkLevel == check_high) .AND. &
499  (global%verbLevel >= verbose_high) .AND. &
500  (global%myProcid == masterproc) .AND. &
501  (decideprintflag .EQV. .true.) .AND. &
502  (nlocs > 0) ) THEN
503  IF ( nlocs > max_inoutflow_locs ) THEN
504  WRITE(stdout,'(A,3X,A,1X,I3,1X,A,1X,I9,1X,A)') solver_name, &
505  'Only wrote the first',max_inoutflow_locs,'of',nlocs, &
506  'inflow faces with outflow.'
507  CALL rflu_printlocinfo(pregion,loc,max_inoutflow_locs, &
508  locinfo_mode_silent,output_mode_anybody)
509  ELSE
510  CALL rflu_printlocinfo(pregion,loc(1:nlocs,min_val:max_val),nlocs, &
511  locinfo_mode_silent,output_mode_anybody)
512  END IF ! nLocs
513  END IF ! global%checkLevel
514 
515 ! ==============================================================================
516 ! Outflow
517 ! ==============================================================================
518 
519  CASE ( bc_outflow )
520  bcopttype = ppatch%mixt%switches(bcswi_outflow_type)
521 
522  IF ( bcopttype /= bcopt_supersonic ) THEN
523  vals => ppatch%mixt%vals
524  END IF ! bcOptType
525 
526  DO ifl = 1,ppatch%nBFaces
527  c1 = ppatch%bf2c(ifl)
528 
529  nx = ppatch%fn(xcoord,ifl)
530  ny = ppatch%fn(ycoord,ifl)
531  nz = ppatch%fn(zcoord,ifl)
532  nm = ppatch%fn(xyzmag,ifl)
533 
534  xc = ppatch%fc(xcoord,ifl)
535  yc = ppatch%fc(ycoord,ifl)
536  zc = ppatch%fc(zcoord,ifl)
537 
538  fs = ppatch%gs(indgs*ifl)
539 
540  rl = cv(cv_mixt_dens,c1)
541  irl = 1.0_rfreal/rl
542 
543  ul = cv(cv_mixt_xmom,c1)*irl
544  vl = cv(cv_mixt_ymom,c1)*irl
545  wl = cv(cv_mixt_zmom,c1)*irl
546  pl = dv(dv_mixt_pres,c1)
547 
548  dx = xc - pregion%grid%cofg(xcoord,c1)
549  dy = yc - pregion%grid%cofg(ycoord,c1)
550  dz = zc - pregion%grid%cofg(zcoord,c1)
551 
552  rl = rl + grad(xcoord,grc_mixt_dens,c1)*dx &
553  + grad(ycoord,grc_mixt_dens,c1)*dy &
554  + grad(zcoord,grc_mixt_dens,c1)*dz
555  ul = ul + grad(xcoord,grc_mixt_xvel,c1)*dx &
556  + grad(ycoord,grc_mixt_xvel,c1)*dy &
557  + grad(zcoord,grc_mixt_xvel,c1)*dz
558  vl = vl + grad(xcoord,grc_mixt_yvel,c1)*dx &
559  + grad(ycoord,grc_mixt_yvel,c1)*dy &
560  + grad(zcoord,grc_mixt_yvel,c1)*dz
561  wl = wl + grad(xcoord,grc_mixt_zvel,c1)*dx &
562  + grad(ycoord,grc_mixt_zvel,c1)*dy &
563  + grad(zcoord,grc_mixt_zvel,c1)*dz
564  pl = pl + grad(xcoord,grc_mixt_pres,c1)*dx &
565  + grad(ycoord,grc_mixt_pres,c1)*dy &
566  + grad(zcoord,grc_mixt_pres,c1)*dz
567 
568  rul = rl*ul
569  rvl = rl*vl
570  rwl = rl*wl
571 
572  IF ( bcopttype /= bcopt_supersonic ) THEN
573  pr = vals(bcdat_outflow_press,distrib*ifl)
574  ELSE
575  pr = pl
576  END IF ! bcOptType
577 
578  IF ( gasmodel == gas_model_tcperf ) THEN
579  cp = gv(gv_mixt_cp ,indcp *c1)
580  mm = gv(gv_mixt_mol,indmol*c1)
581  rgas = mixtperf_r_m(mm)
582  g = mixtperf_g_cpr(cp,rgas)
583 
584  rel = rl*mixtperf_eo_dgpuvw(rl,g,pl,ul,vl,wl)
585 
586  CALL bcondoutflowperf(bcopttype,pr,nx,ny,nz,cp,mm,rl,rul,rvl,rwl, &
587  rel,pl,rr,rur,rvr,rwr,rer)
588  ELSE
589  CALL errorstop(global,err_reached_default,__line__)
590  END IF ! gasModel
591 
592  ql = (rul*nx + rvl*ny + rwl*nz)/rl - fs
593  qr = (rur*nx + rvr*ny + rwr*nz)/rr - fs
594 
595  ul = rul/rl
596  vl = rvl/rl
597  wl = rwl/rl
598  ur = rur/rr
599  vr = rvr/rr
600  wr = rwr/rr
601 
602  flx(1) = 0.5_rfreal*(ql* rl + qr* rr )*nm
603  flx(2) = 0.5_rfreal*(ql* rul + pl*nx + qr* rur + pr*nx)*nm
604  flx(3) = 0.5_rfreal*(ql* rvl + pl*ny + qr* rvr + pr*ny)*nm
605  flx(4) = 0.5_rfreal*(ql* rwl + pl*nz + qr* rwr + pr*nz)*nm
606  flx(5) = 0.5_rfreal*(ql*(rel + pl) + pl*fs + qr*(rer + pr) + pr*fs)*nm
607 
608  mfmixt(indmf*ifl) = flx(1)
609 
610  ppatch%cp(ifl) = icpref*(0.5_rfreal*(pl + pr) - pref)
611  ppatch%cmass(ifl) = icmassref*flx(1)/nm
612  ppatch%cmom(xcoord,ifl) = icpref*0.5_rfreal*(ul+ur)*flx(1)/nm
613  ppatch%cmom(ycoord,ifl) = icpref*0.5_rfreal*(vl+vr)*flx(1)/nm
614  ppatch%cmom(zcoord,ifl) = icpref*0.5_rfreal*(wl+wr)*flx(1)/nm
615 
616  rhs(cv_mixt_dens,c1) = rhs(cv_mixt_dens,c1) + flx(1)
617  rhs(cv_mixt_xmom,c1) = rhs(cv_mixt_xmom,c1) + flx(2)
618  rhs(cv_mixt_ymom,c1) = rhs(cv_mixt_ymom,c1) + flx(3)
619  rhs(cv_mixt_zmom,c1) = rhs(cv_mixt_zmom,c1) + flx(4)
620  rhs(cv_mixt_ener,c1) = rhs(cv_mixt_ener,c1) + flx(5)
621 
622  sd(sd_xmom,c1*indsd) = sd(sd_xmom,c1*indsd) + 0.5_rfreal*(rul/rl + rur/rr)*flx(1)
623  sd(sd_ymom,c1*indsd) = sd(sd_ymom,c1*indsd) + 0.5_rfreal*(rvl/rl + rvr/rr)*flx(1)
624  sd(sd_zmom,c1*indsd) = sd(sd_zmom,c1*indsd) + 0.5_rfreal*(rwl/rl + rwr/rr)*flx(1)
625 
626 
627  IF ( pregion%irkStep == 1 ) THEN
628  global%massIn = global%massIn - min(flx(1),0.0_rfreal)
629  global%massOut = global%massOut + max(flx(1),0.0_rfreal)
630  END IF ! pRegion
631 
632  IF ( (global%checkLevel == check_high) .AND. &
633  (global%verbLevel >= verbose_high) .AND. &
634  (global%myProcid == masterproc) .AND. &
635  (decideprintflag .EQV. .true.) ) THEN
636  IF ( flx(1) < 0.0_rfreal ) THEN
637  nlocs = nlocs + 1
638 
639  IF ( nlocs == 1 ) THEN
640  global%warnCounter = global%warnCounter + 1
641 
642  WRITE(stdout,'(A,1X,A,1X,I9)') solver_name, &
643  '*** WARNING *** Inflow detected at outflow boundary!'
644  WRITE(stdout,'(A,3X,A,1X,I5.5)') solver_name,'Global region:', &
645  pregion%iRegionGlobal
646  IF ( global%flowType == flow_unsteady ) THEN
647  WRITE(stdout,'(A,3X,A,1X,1PE11.5)') solver_name, &
648  'Current time:', &
649  global%currentTime
650  ELSE
651  WRITE(stdout,'(A,3X,A,1X,I6.6)') solver_name, &
652  'Current iteration number:', &
653  global%currentIter
654  END IF ! global%flowType
655 
656  WRITE(stdout,'(A,3X,A,1X,I1)') solver_name, &
657  'Runge-Kutta stage:', &
658  pregion%irkStep
659  END IF ! nLocs
660 
661  IF ( nlocs <= max_inoutflow_locs ) THEN
662  loc(nlocs,min_val:max_val) = c1
663  END IF ! nLocs
664  END IF ! flx(1)
665  END IF ! global%checkLevel
666  END DO ! ifl
667 
668 ! ------------------------------------------------------------------------------
669 ! Write info on inflow at outflow boundary
670 ! ------------------------------------------------------------------------------
671 
672  IF ( (global%checkLevel == check_high) .AND. &
673  (global%verbLevel >= verbose_high) .AND. &
674  (global%myProcid == masterproc) .AND. &
675  (decideprintflag .EQV. .true.) .AND. &
676  (nlocs > 0) ) THEN
677  IF ( nlocs > max_inoutflow_locs ) THEN
678  WRITE(stdout,'(A,3X,A,1X,I3,1X,A,1X,I9,1X,A)') solver_name, &
679  'Only wrote the first',max_inoutflow_locs,'of',nlocs, &
680  'outflow faces with inflow.'
681  CALL rflu_printlocinfo(pregion,loc,max_inoutflow_locs, &
682  locinfo_mode_silent,output_mode_anybody)
683  ELSE
684  CALL rflu_printlocinfo(pregion,loc(1:nlocs,min_val:max_val),nlocs, &
685  locinfo_mode_silent,output_mode_anybody)
686  END IF ! nLocs
687  END IF ! nLocs
688 
689 ! ==============================================================================
690 ! Slip wall (weak imposition)
691 ! ==============================================================================
692 
693  CASE ( bc_slipwall )
694  DO ifl = 1,ppatch%nBFaces
695  c1 = ppatch%bf2c(ifl)
696 
697  nx = ppatch%fn(xcoord,ifl)
698  ny = ppatch%fn(ycoord,ifl)
699  nz = ppatch%fn(zcoord,ifl)
700  nm = ppatch%fn(xyzmag,ifl)
701 
702  xc = ppatch%fc(xcoord,ifl)
703  yc = ppatch%fc(ycoord,ifl)
704  zc = ppatch%fc(zcoord,ifl)
705 
706  fs = ppatch%gs(indgs*ifl)
707  fsu = rflu_descalegridspeed(pregion,fs)
708 
709  rl = cv(cv_mixt_dens,c1)
710  irl = 1.0_rfreal/rl
711 
712  ul = cv(cv_mixt_xmom,c1)*irl
713  vl = cv(cv_mixt_ymom,c1)*irl
714  wl = cv(cv_mixt_zmom,c1)*irl
715  pl = dv(dv_mixt_pres,c1)
716 
717  dx = xc - pregion%grid%cofg(xcoord,c1)
718  dy = yc - pregion%grid%cofg(ycoord,c1)
719  dz = zc - pregion%grid%cofg(zcoord,c1)
720 
721  rl = rl + grad(xcoord,grc_mixt_dens,c1)*dx &
722  + grad(ycoord,grc_mixt_dens,c1)*dy &
723  + grad(zcoord,grc_mixt_dens,c1)*dz
724  ul = ul + grad(xcoord,grc_mixt_xvel,c1)*dx &
725  + grad(ycoord,grc_mixt_xvel,c1)*dy &
726  + grad(zcoord,grc_mixt_xvel,c1)*dz
727  vl = vl + grad(xcoord,grc_mixt_yvel,c1)*dx &
728  + grad(ycoord,grc_mixt_yvel,c1)*dy &
729  + grad(zcoord,grc_mixt_yvel,c1)*dz
730  wl = wl + grad(xcoord,grc_mixt_zvel,c1)*dx &
731  + grad(ycoord,grc_mixt_zvel,c1)*dy &
732  + grad(zcoord,grc_mixt_zvel,c1)*dz
733  pl = pl + grad(xcoord,grc_mixt_pres,c1)*dx &
734  + grad(ycoord,grc_mixt_pres,c1)*dy &
735  + grad(zcoord,grc_mixt_pres,c1)*dz
736 
737  rul = rl*ul
738  rvl = rl*vl
739  rwl = rl*wl
740 
741  SELECT CASE ( pregion%mixtInput%gasModel )
742  CASE ( gas_model_tcperf, &
743  gas_model_mixt_tcperf, &
744  gas_model_mixt_pseudo )
745  cp = gv(gv_mixt_cp ,indcp *c1)
746  mm = gv(gv_mixt_mol,indmol*c1)
747 
748  CALL rflu_setrindstateslipwallperf(cp,mm,nx,ny,nz,rl,rul,rvl,rwl, &
749  fsu,pl)
750  CASE default
751  CALL errorstop(global,err_reached_default,__line__)
752  END SELECT ! pRegion%mixtInput%gasModel
753 
754  flx(2) = pl*nx*nm
755  flx(3) = pl*ny*nm
756  flx(4) = pl*nz*nm
757  flx(5) = pl*fs*nm
758 
759  mfmixt(indmf*ifl) = 0.0_rfreal
760 
761  ppatch%cp(ifl) = icpref*(pl - pref)
762  ppatch%cmass(ifl) = 0.0_rfreal
763  ppatch%cmom(xcoord,ifl) = 0.0_rfreal
764  ppatch%cmom(ycoord,ifl) = 0.0_rfreal
765  ppatch%cmom(zcoord,ifl) = 0.0_rfreal
766 
767  rhs(cv_mixt_xmom,c1) = rhs(cv_mixt_xmom,c1) + flx(2)
768  rhs(cv_mixt_ymom,c1) = rhs(cv_mixt_ymom,c1) + flx(3)
769  rhs(cv_mixt_zmom,c1) = rhs(cv_mixt_zmom,c1) + flx(4)
770  rhs(cv_mixt_ener,c1) = rhs(cv_mixt_ener,c1) + flx(5)
771 
772  END DO ! ifl
773 
774 ! ==============================================================================
775 ! No-slip wall
776 ! ==============================================================================
777 
778  CASE ( bc_noslipwall_hflux,bc_noslipwall_temp )
779 
780  DO ifl = 1,ppatch%nBFaces
781  c1 = ppatch%bf2c(ifl)
782 
783  nx = ppatch%fn(xcoord,ifl)
784  ny = ppatch%fn(ycoord,ifl)
785  nz = ppatch%fn(zcoord,ifl)
786  nm = ppatch%fn(xyzmag,ifl)
787 
788  xc = ppatch%fc(xcoord,ifl)
789  yc = ppatch%fc(ycoord,ifl)
790  zc = ppatch%fc(zcoord,ifl)
791 
792  fs = ppatch%gs(indgs*ifl)
793 
794  pl = dv(dv_mixt_pres,c1)
795 
796  dx = xc - pregion%grid%cofg(xcoord,c1)
797  dy = yc - pregion%grid%cofg(ycoord,c1)
798  dz = zc - pregion%grid%cofg(zcoord,c1)
799 
800  pl = pl + grad(xcoord,grc_mixt_pres,c1)*dx &
801  + grad(ycoord,grc_mixt_pres,c1)*dy &
802  + grad(zcoord,grc_mixt_pres,c1)*dz
803 
804  flx(2) = pl*nx*nm
805  flx(3) = pl*ny*nm
806  flx(4) = pl*nz*nm
807  flx(5) = pl*fs*nm
808 
809  mfmixt(indmf*ifl) = 0.0_rfreal
810 
811  ppatch%cp(ifl) = icpref*(pl - pref)
812  ppatch%cmass(ifl) = 0.0_rfreal
813  ppatch%cmom(xcoord,ifl) = 0.0_rfreal
814  ppatch%cmom(ycoord,ifl) = 0.0_rfreal
815  ppatch%cmom(zcoord,ifl) = 0.0_rfreal
816 
817  rhs(cv_mixt_xmom,c1) = rhs(cv_mixt_xmom,c1) + flx(2)
818  rhs(cv_mixt_ymom,c1) = rhs(cv_mixt_ymom,c1) + flx(3)
819  rhs(cv_mixt_zmom,c1) = rhs(cv_mixt_zmom,c1) + flx(4)
820  rhs(cv_mixt_ener,c1) = rhs(cv_mixt_ener,c1) + flx(5)
821  END DO ! ifl
822 
823 ! ==============================================================================
824 ! Farfield
825 ! ==============================================================================
826 
827  CASE ( bc_farfield )
828  corr = ppatch%mixt%switches(bcswi_farf_corr)
829 
830  vals => ppatch%mixt%vals
831 
832  IF ( corr == bcopt_corr_yes ) THEN
833  corrflag = .true.
834 
835 ! TEMPORARY - Hardcoded for NACA0012
836  aoa = vals(bcdat_farf_attack,0)
837 
838  cx = pregion%forceCoeffsGlobal(xcoord,comp_pres,2)
839  cy = pregion%forceCoeffsGlobal(ycoord,comp_pres,2)
840 
841  liftcoef = cy*cos(aoa) - cx*sin(aoa)
842 ! END TEMPORARY
843  ELSE
844  corrflag = .false.
845  liftcoef = 0.0_rfreal
846  END IF ! corr
847 
848  DO ifl = 1,ppatch%nBFaces
849  c1 = ppatch%bf2c(ifl)
850 
851  nx = ppatch%fn(xcoord,ifl)
852  ny = ppatch%fn(ycoord,ifl)
853  nz = ppatch%fn(zcoord,ifl)
854  nm = ppatch%fn(xyzmag,ifl)
855 
856  xc = ppatch%fc(xcoord,ifl)
857  yc = ppatch%fc(ycoord,ifl)
858  zc = ppatch%fc(zcoord,ifl)
859 
860  fs = ppatch%gs(indgs*ifl)
861 
862  rl = cv(cv_mixt_dens,c1)
863  irl = 1.0_rfreal/rl
864 
865  ul = cv(cv_mixt_xmom,c1)*irl
866  vl = cv(cv_mixt_ymom,c1)*irl
867  wl = cv(cv_mixt_zmom,c1)*irl
868  pl = dv(dv_mixt_pres,c1)
869 
870  dx = xc - pregion%grid%cofg(xcoord,c1)
871  dy = yc - pregion%grid%cofg(ycoord,c1)
872  dz = zc - pregion%grid%cofg(zcoord,c1)
873 
874  rl = rl + grad(xcoord,grc_mixt_dens,c1)*dx &
875  + grad(ycoord,grc_mixt_dens,c1)*dy &
876  + grad(zcoord,grc_mixt_dens,c1)*dz
877  ul = ul + grad(xcoord,grc_mixt_xvel,c1)*dx &
878  + grad(ycoord,grc_mixt_xvel,c1)*dy &
879  + grad(zcoord,grc_mixt_xvel,c1)*dz
880  vl = vl + grad(xcoord,grc_mixt_yvel,c1)*dx &
881  + grad(ycoord,grc_mixt_yvel,c1)*dy &
882  + grad(zcoord,grc_mixt_yvel,c1)*dz
883  wl = wl + grad(xcoord,grc_mixt_zvel,c1)*dx &
884  + grad(ycoord,grc_mixt_zvel,c1)*dy &
885  + grad(zcoord,grc_mixt_zvel,c1)*dz
886  pl = pl + grad(xcoord,grc_mixt_pres,c1)*dx &
887  + grad(ycoord,grc_mixt_pres,c1)*dy &
888  + grad(zcoord,grc_mixt_pres,c1)*dz
889 
890  rul = rl*ul
891  rvl = rl*vl
892  rwl = rl*wl
893 
894  mf = vals(bcdat_farf_mach ,distrib*ifl)
895  aoa = vals(bcdat_farf_attack,distrib*ifl)
896  aos = vals(bcdat_farf_slip ,distrib*ifl)
897  pf = vals(bcdat_farf_press ,distrib*ifl)
898  tf = vals(bcdat_farf_temp ,distrib*ifl)
899 
900  IF ( gasmodel == gas_model_tcperf ) THEN
901  cp = gv(gv_mixt_cp ,indcp *c1)
902  mm = gv(gv_mixt_mol,indmol*c1)
903  rgas = mixtperf_r_m(mm)
904  g = mixtperf_g_cpr(cp,rgas)
905 
906  rel = rl*mixtperf_eo_dgpuvw(rl,g,pl,ul,vl,wl)
907 
908  CALL rflu_setrindstatefarfieldperf(global,cp,mm,nx,ny,nz,mf,pf,tf, &
909  aoa,aos,corrflag,liftcoef,xc,yc, &
910  zc,rl,rul,rvl,rwl,rel,rr,rur, &
911  rvr,rwr,rer,pr)
912  ELSE
913  CALL errorstop(global,err_reached_default,__line__)
914  END IF ! gasModel
915 
916  ql = (rul*nx + rvl*ny + rwl*nz)/rl - fs
917  qr = (rur*nx + rvr*ny + rwr*nz)/rr - fs
918 
919  ul = rul/rl
920  vl = rvl/rl
921  wl = rwl/rl
922  ur = rur/rr
923  vr = rvr/rr
924  wr = rwr/rr
925 
926  flx(1) = 0.5_rfreal*(ql* rl + qr* rr )*nm
927  flx(2) = 0.5_rfreal*(ql* rul + pl*nx + qr* rur + pr*nx)*nm
928  flx(3) = 0.5_rfreal*(ql* rvl + pl*ny + qr* rvr + pr*ny)*nm
929  flx(4) = 0.5_rfreal*(ql* rwl + pl*nz + qr* rwr + pr*nz)*nm
930  flx(5) = 0.5_rfreal*(ql*(rel + pl) + pl*fs + qr*(rer + pr) + pr*fs)*nm
931 
932  mfmixt(indmf*ifl) = flx(1)
933 
934  ppatch%cp(ifl) = icpref*(0.5_rfreal*(pl + pr) - pref)
935  ppatch%cmass(ifl) = icmassref*flx(1)/nm
936  ppatch%cmom(xcoord,ifl) = icpref*0.5_rfreal*(ul+ur)*flx(1)/nm
937  ppatch%cmom(ycoord,ifl) = icpref*0.5_rfreal*(vl+vr)*flx(1)/nm
938  ppatch%cmom(zcoord,ifl) = icpref*0.5_rfreal*(wl+wr)*flx(1)/nm
939 
940  rhs(cv_mixt_dens,c1) = rhs(cv_mixt_dens,c1) + flx(1)
941  rhs(cv_mixt_xmom,c1) = rhs(cv_mixt_xmom,c1) + flx(2)
942  rhs(cv_mixt_ymom,c1) = rhs(cv_mixt_ymom,c1) + flx(3)
943  rhs(cv_mixt_zmom,c1) = rhs(cv_mixt_zmom,c1) + flx(4)
944  rhs(cv_mixt_ener,c1) = rhs(cv_mixt_ener,c1) + flx(5)
945 
946  sd(sd_xmom,c1*indsd) = sd(sd_xmom,c1*indsd) + 0.5_rfreal*(rul/rl + rur/rr)*flx(1)
947  sd(sd_ymom,c1*indsd) = sd(sd_ymom,c1*indsd) + 0.5_rfreal*(rvl/rl + rvr/rr)*flx(1)
948  sd(sd_zmom,c1*indsd) = sd(sd_zmom,c1*indsd) + 0.5_rfreal*(rwl/rl + rwr/rr)*flx(1)
949 
950  IF ( pregion%irkStep == 1 ) THEN
951  global%massIn = global%massIn - min(flx(1),0.0_rfreal)
952  global%massOut = global%massOut + max(flx(1),0.0_rfreal)
953  END IF ! pRegion
954  END DO ! ifl
955 
956 ! ==============================================================================
957 ! Injection
958 ! ==============================================================================
959 
960  CASE ( bc_injection )
961  vals => ppatch%mixt%vals
962 
963  DO ifl = 1,ppatch%nBFaces
964  c1 = ppatch%bf2c(ifl)
965 
966  nx = ppatch%fn(xcoord,ifl)
967  ny = ppatch%fn(ycoord,ifl)
968  nz = ppatch%fn(zcoord,ifl)
969  nm = ppatch%fn(xyzmag,ifl)
970 
971  xc = ppatch%fc(xcoord,ifl)
972  yc = ppatch%fc(ycoord,ifl)
973  zc = ppatch%fc(zcoord,ifl)
974 
975  fs = ppatch%gs(indgs*ifl)
976  fsu = rflu_descalegridspeed(pregion,fs)
977 
978  rl = cv(cv_mixt_dens,c1)
979  irl = 1.0_rfreal/rl
980 
981  ul = cv(cv_mixt_xmom,c1)*irl
982  vl = cv(cv_mixt_ymom,c1)*irl
983  wl = cv(cv_mixt_zmom,c1)*irl
984  pl = dv(dv_mixt_pres,c1)
985 
986  dx = xc - pregion%grid%cofg(xcoord,c1)
987  dy = yc - pregion%grid%cofg(ycoord,c1)
988  dz = zc - pregion%grid%cofg(zcoord,c1)
989 
990  rl = rl + grad(xcoord,grc_mixt_dens,c1)*dx &
991  + grad(ycoord,grc_mixt_dens,c1)*dy &
992  + grad(zcoord,grc_mixt_dens,c1)*dz
993  ul = ul + grad(xcoord,grc_mixt_xvel,c1)*dx &
994  + grad(ycoord,grc_mixt_xvel,c1)*dy &
995  + grad(zcoord,grc_mixt_xvel,c1)*dz
996  vl = vl + grad(xcoord,grc_mixt_yvel,c1)*dx &
997  + grad(ycoord,grc_mixt_yvel,c1)*dy &
998  + grad(zcoord,grc_mixt_yvel,c1)*dz
999  wl = wl + grad(xcoord,grc_mixt_zvel,c1)*dx &
1000  + grad(ycoord,grc_mixt_zvel,c1)*dy &
1001  + grad(zcoord,grc_mixt_zvel,c1)*dz
1002  pl = pl + grad(xcoord,grc_mixt_pres,c1)*dx &
1003  + grad(ycoord,grc_mixt_pres,c1)*dy &
1004  + grad(zcoord,grc_mixt_pres,c1)*dz
1005 
1006  rul = rl*ul
1007  rvl = rl*vl
1008  rwl = rl*wl
1009 
1010  IF ( gasmodel == gas_model_tcperf ) THEN
1011  cp = gv(gv_mixt_cp ,indcp *c1)
1012  mm = gv(gv_mixt_mol,indmol*c1)
1013 
1014  minj = vals(bcdat_inject_mfrate,distrib*ifl)
1015 
1016  IF ( minj > 0.0_rfreal ) THEN ! Surface burning
1017  tinj = vals(bcdat_inject_temp,distrib*ifl)
1018 
1019  CALL rflu_setrindstateinjectperf(cp,mm,nx,ny,nz,minj,tinj,pl, &
1020  fsu,rl,ul,vl,wl,hl)
1021 
1022  flx(1) = -minj *nm
1023  flx(2) = (-minj*ul + pl*nx)*nm
1024  flx(3) = (-minj*vl + pl*ny)*nm
1025  flx(4) = (-minj*wl + pl*nz)*nm
1026  flx(5) = (-minj*hl + pl*fs)*nm
1027  ELSE ! Surface NOT burning
1028  CALL rflu_setrindstateslipwallperf(cp,mm,nx,ny,nz,rl,rul,rvl,rwl, &
1029  fsu,pl)
1030 
1031  ul = 0.0_rfreal
1032  vl = 0.0_rfreal
1033  wl = 0.0_rfreal
1034 
1035  flx(1) = 0.0_rfreal
1036  flx(2) = pl*nx*nm
1037  flx(3) = pl*ny*nm
1038  flx(4) = pl*nz*nm
1039  flx(5) = pl*fs*nm
1040  END IF ! minj
1041  ELSE
1042  CALL errorstop(global,err_reached_default,__line__)
1043  END IF ! gasModel
1044 
1045  mfmixt(indmf*ifl) = flx(1)
1046 
1047  ppatch%cp(ifl) = icpref*(pl - pref)
1048  ppatch%cmass(ifl) = icmassref*flx(1)/nm
1049  ppatch%cmom(xcoord,ifl) = icpref*0.5_rfreal*(ul+ur)*flx(1)/nm
1050  ppatch%cmom(ycoord,ifl) = icpref*0.5_rfreal*(vl+vr)*flx(1)/nm
1051  ppatch%cmom(zcoord,ifl) = icpref*0.5_rfreal*(wl+wr)*flx(1)/nm
1052 
1053  rhs(cv_mixt_dens,c1) = rhs(cv_mixt_dens,c1) + flx(1)
1054  rhs(cv_mixt_xmom,c1) = rhs(cv_mixt_xmom,c1) + flx(2)
1055  rhs(cv_mixt_ymom,c1) = rhs(cv_mixt_ymom,c1) + flx(3)
1056  rhs(cv_mixt_zmom,c1) = rhs(cv_mixt_zmom,c1) + flx(4)
1057  rhs(cv_mixt_ener,c1) = rhs(cv_mixt_ener,c1) + flx(5)
1058 
1059  sd(sd_xmom,c1*indsd) = sd(sd_xmom,c1*indsd) + ul*flx(1)
1060  sd(sd_ymom,c1*indsd) = sd(sd_ymom,c1*indsd) + vl*flx(1)
1061  sd(sd_zmom,c1*indsd) = sd(sd_zmom,c1*indsd) + wl*flx(1)
1062 
1063  IF ( pregion%irkStep == 1 ) THEN
1064  global%massIn = global%massIn - min(flx(1),0.0_rfreal)
1065  global%massOut = global%massOut + max(flx(1),0.0_rfreal)
1066  END IF ! pRegion
1067  END DO ! ifl
1068 
1069 ! ==============================================================================
1070 ! Boundaries for which fluxes must not or need not be computed
1071 ! ==============================================================================
1072 
1073  CASE ( bc_periodic, &
1074  bc_symmetry, &
1075  bc_virtual )
1076 
1077 ! ==============================================================================
1078 ! Default
1079 ! ==============================================================================
1080 
1081  CASE default
1082  CALL errorstop(global,err_reached_default,__line__)
1083  END SELECT ! pPatch%bcType
1084 
1085 ! ******************************************************************************
1086 ! End
1087 ! ******************************************************************************
1088 
1089  CALL deregisterfunction(global)
1090 
1091 END SUBROUTINE rflu_centralsecondpatch
1092 
1093 ! ******************************************************************************
1094 !
1095 ! RCS Revision history:
1096 !
1097 ! $Log: RFLU_CentralSecondPatch.F90,v $
1098 ! Revision 1.25 2008/12/06 08:44:29 mtcampbe
1099 ! Updated license.
1100 !
1101 ! Revision 1.24 2008/11/19 22:17:41 mtcampbe
1102 ! Added Illinois Open Source License/Copyright
1103 !
1104 ! Revision 1.23 2006/10/20 21:31:53 mparmar
1105 ! Added computation of mass and moment coeffs
1106 !
1107 ! Revision 1.22 2006/08/19 15:39:54 mparmar
1108 ! Renamed patch variables
1109 !
1110 ! Revision 1.21 2006/04/07 15:19:22 haselbac
1111 ! Removed tabs
1112 !
1113 ! Revision 1.20 2006/03/25 22:00:43 haselbac
1114 ! Added CASEs for sype patches
1115 !
1116 ! Revision 1.19 2005/11/14 17:00:29 haselbac
1117 ! Added support for pseudo-gas model
1118 !
1119 ! Revision 1.18 2005/11/10 02:31:05 haselbac
1120 ! Added support for mixture of tcperf gases
1121 !
1122 ! Revision 1.17 2005/10/31 21:09:37 haselbac
1123 ! Changed specModel and SPEC_MODEL_NONE
1124 !
1125 ! Revision 1.16 2005/10/05 14:17:48 haselbac
1126 ! Adapted to changes in no-slip wall bc defs
1127 !
1128 ! Revision 1.15 2005/05/16 20:44:09 haselbac
1129 ! Converted to pRegion and pPatch, cosmetics
1130 !
1131 ! Revision 1.14 2005/04/27 02:12:24 haselbac
1132 ! Added treatment for velocity-temperature inlet
1133 !
1134 ! Revision 1.13 2005/04/20 14:43:12 haselbac
1135 ! Removed CHECK_UNIFLOW code section
1136 !
1137 ! Revision 1.12 2005/03/31 17:05:06 haselbac
1138 ! Changed computation of sd
1139 !
1140 ! Revision 1.11 2005/03/09 15:08:11 haselbac
1141 ! Added virtual boundary
1142 !
1143 ! Revision 1.10 2004/12/28 15:22:48 haselbac
1144 ! Added setting of lift coef - hardcoded for now
1145 !
1146 ! Revision 1.8 2004/10/19 19:29:10 haselbac
1147 ! Modified fluxes for injecting boundaries, clean-up
1148 !
1149 ! Revision 1.7 2004/07/30 22:47:36 jferry
1150 ! Implemented Equilibrium Eulerian method for Rocflu
1151 !
1152 ! Revision 1.6 2004/06/16 20:01:06 haselbac
1153 ! Added setting of cp, cosmetics
1154 !
1155 ! Revision 1.5 2004/04/14 02:09:07 haselbac
1156 ! Added proper setting of rind state for slip walls
1157 !
1158 ! Revision 1.4 2004/02/13 03:00:37 haselbac
1159 ! Fixed comment
1160 !
1161 ! Revision 1.3 2004/01/31 03:58:36 haselbac
1162 ! Improved printing of reverse flow messages
1163 !
1164 ! Revision 1.2 2004/01/29 22:59:17 haselbac
1165 ! Removed hardcode, improved mfMixt use, adapted bcondInflowPerf call
1166 !
1167 ! Revision 1.1 2003/12/04 03:29:48 haselbac
1168 ! Initial revision
1169 !
1170 ! ******************************************************************************
1171 
1172 
1173 
1174 
1175 
1176 
1177 
subroutine, public rflu_setrindstateinjectperf(cpGas, mmGas, nx, ny, nz, mInj, tInj, pl, fs, rl, ul, vl, wl, Hl)
subroutine rflu_centralsecondpatch(pRegion, pPatch)
real(rfreal) function mixtperf_p_deogvm2(D, Eo, G, Vm2)
Definition: MixtPerf_P.F90:39
real(rfreal) function mixtperf_r_m(M)
Definition: MixtPerf_R.F90:54
subroutine bcondfarfieldperf(machInf, alphaInf, betaInf, pInf, tInf, sxn, syn, szn, cpgas, mol, rho, rhou, rhov, rhow, rhoe, press, rhob, rhoub, rhovb, rhowb, rhoeb, pb)
NT dx
NT rhs
subroutine, public rflu_setrindstateslipwallperf(cpGas, mmGas, nx, ny, nz, rl, rul, rvl, rwl, fs, pl)
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
real(rfreal) function mixtperf_d_prt(P, R, T)
Definition: MixtPerf_D.F90:71
real(rfreal) function, public rflu_descalegridspeed(pRegion, fs)
subroutine bcondoutflowperf(bcOpt, pout, sxn, syn, szn, cpgas, mol, rho, rhou, rhov, rhow, rhoe, press, rhob, rhoub, rhovb, rhowb, rhoeb)
NT & sin
subroutine, public rflu_setrindstatefarfieldperf(global, cpGas, mmGas, nx, ny, nz, machInf, pInf, tInf, alphaInf, betaInf, corrFlag, liftCoef, xc, yc, zc, rl, rul, rvl, rwl, rel, rr, rur, rvr, rwr, rer, pr)
subroutine bcondinflowperf(bcOptType, bcOptFixed, ptot, ttot, betah, betav, mach, sxn, syn, szn, cpgas, mm, rl, rul, rvl, rwl, rr, rur, rvr, rwr, rer, pr)
RT dz() const
Definition: Direction_3.h:133
Vector_n min(const Array_n_const &v1, const Array_n_const &v2)
Definition: Vector_n.h:346
subroutine rflu_printlocinfo(pRegion, locUnsorted, nLocUnsorted, locInfoMode, outputMode)
NT dy
LOGICAL function rflu_decideprint(global)
real(rfreal) function mixtperf_eo_dgpuvw(D, G, P, U, V, W)
Definition: MixtPerf_E.F90:40
subroutine errorstop(global, errorCode, errorLine, addMessage)
Definition: ModError.F90:483
subroutine deregisterfunction(global)
Definition: ModError.F90:469
real(rfreal) function mixtperf_g_cpr(Cp, R)
Definition: MixtPerf_G.F90:39
NT & cos
real(rfreal) function mixtperf_p_drt(D, R, T)
Definition: MixtPerf_P.F90:54
unsigned char g() const
Definition: Color.h:69