Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RFLU_ModNSCBC.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: Collection of routines for NCSBC boundary treatment
26 !
27 ! Description: None.
28 !
29 ! Notes: None.
30 !
31 ! ******************************************************************************
32 !
33 ! $Id: RFLU_ModNSCBC.F90,v 1.7 2008/12/06 08:44:22 mtcampbe Exp $
34 !
35 ! Copyright: (c) 2006 by the University of Illinois
36 !
37 ! ******************************************************************************
38 
40 
41  USE modparameters
42  USE moddatatypes
43  USE modglobal, ONLY: t_global
44  USE modbndpatch, ONLY: t_patch
45  USE moddatastruct, ONLY: t_region
46  USE modmixture, ONLY: t_mixt_input
47  USE moderror
48  USE modmpi
49 
57 
58  USE modinterfaces, ONLY: bcondfarfieldperf, &
61  mixtperf_c_dgp, &
63  mixtperf_d_prt, &
69  mixtperf_r_cpg, &
70  mixtperf_r_m, &
71  mixtperf_t_dpr, &
75 
76  IMPLICIT NONE
77 
78 ! ******************************************************************************
79 ! Declarations and definitions
80 ! ******************************************************************************
81 
82 ! ==============================================================================
83 ! Private data
84 ! ==============================================================================
85 
86  CHARACTER(CHRLEN), PRIVATE :: &
87  RCSIdentString = '$RCSfile: RFLU_ModNSCBC.F90,v $ $Revision: 1.7 $'
88 
89 ! ==============================================================================
90 ! Public functions
91 ! ==============================================================================
92 
106 
107 ! ==============================================================================
108 ! Private functions
109 ! ==============================================================================
110 
111  PRIVATE :: rflu_nscbc_comprhsff, &
119 
120 ! ******************************************************************************
121 ! Routines
122 ! ******************************************************************************
123 
124  CONTAINS
125 
126 
127 
128 
129 
130 
131 
132 ! ******************************************************************************
133 !
134 ! Purpose: Compute patch flux with first-order accuracy.
135 !
136 ! Description: None.
137 !
138 ! Input:
139 ! pRegion Pointer to region
140 ! pPatch Pointer to patch
141 !
142 ! Output: None.
143 !
144 ! Notes: None.
145 !
146 ! ******************************************************************************
147 
148 SUBROUTINE rflu_nscbc_compfirstpatchflux(pRegion,pPatch)
149 
150  IMPLICIT NONE
151 
152 ! ******************************************************************************
153 ! Definitions and declarations
154 ! ******************************************************************************
155 
156 ! ==============================================================================
157 ! Arguments
158 ! ==============================================================================
159 
160  TYPE(t_patch), POINTER :: ppatch
161  TYPE(t_region), POINTER :: pregion
162 
163 ! ==============================================================================
164 ! Locals
165 ! ==============================================================================
166 
167  LOGICAL :: decideprintflag
168  CHARACTER(CHRLEN) :: rcsidentstring
169  INTEGER, PARAMETER :: max_inoutflow_locs = 10
170  INTEGER :: c1,ifl,indgs,nlocs,loc(max_inoutflow_locs,min_val:max_val)
171  REAL(RFREAL) :: ah,cpgas,de,dissfact,dp,dq,dr,du,dv1,dv2,dv5,dw,efc,epsentr, &
172  fs,ggas,hh,hl,hr,icmassref,icpref,irl,irr,l1,l2,l5,nm,nx,ny, &
173  nz,pl,pr,pref,qh,ql,qr,rgas,rh,rl,rr,rref,sh,tl,tr,t1,t2,t3, &
174  t5,uh,ul,ur,vh,vl,vr,vref,wh,wl,wr,wt,xc,yc,zc
175  REAL(RFREAL) :: flxconv(5),flxdiss(5),flx(5)
176  REAL(RFREAL), DIMENSION(:), POINTER :: mfmixt
177  REAL(RFREAL), DIMENSION(:,:), POINTER :: cv,dv,gv,rhs,vals,sd
178  TYPE(t_global), POINTER :: global
179 
180 ! ******************************************************************************
181 ! Start
182 ! ******************************************************************************
183 
184  global => pregion%global
185 
186  CALL registerfunction(global,'RFLU_NSCBC_CompFirstPatchFlux',&
187  'RFLU_ModNSCBC.F90')
188 
189 ! ******************************************************************************
190 ! Set pointers and variables
191 ! ******************************************************************************
192 
193  indgs = pregion%grid%indGs
194  epsentr = pregion%mixtInput%epsentr
195  dissfact = pregion%mixtInput%dissFact
196 
197  cv => pregion%mixt%cv
198  dv => pregion%mixt%dv
199  gv => pregion%mixt%gv
200  rhs => pregion%mixt%rhs
201  sd => pregion%mixt%sd
202 
203  nlocs = 0
204 
205  decideprintflag = rflu_decideprint(global)
206 
207  pref = global%refPressure
208  rref = global%refDensity
209  vref = global%refVelocity
210 
211  icpref = 2.0_rfreal/(rref*vref*vref)
212  icmassref = 1.0_rfreal/(rref*vref)
213 
214 ! ******************************************************************************
215 ! Define constants
216 ! ******************************************************************************
217 
218  cpgas = global%refCp
219  ggas = global%refGamma
220  rgas = mixtperf_r_cpg(cpgas,ggas)
221 
222 ! ******************************************************************************
223 ! Main Body
224 ! ******************************************************************************
225 
226  DO ifl = 1,ppatch%nBFaces
227  c1 = ppatch%bf2c(ifl)
228 
229  nx = ppatch%fn(xcoord,ifl)
230  ny = ppatch%fn(ycoord,ifl)
231  nz = ppatch%fn(zcoord,ifl)
232  nm = ppatch%fn(xyzmag,ifl)
233 
234  xc = ppatch%fc(xcoord,ifl)
235  yc = ppatch%fc(ycoord,ifl)
236  zc = ppatch%fc(zcoord,ifl)
237 
238  fs = ppatch%gs(indgs*ifl)
239 
240 ! ==============================================================================
241 ! Compute left and right states
242 ! ==============================================================================
243 
244 ! ------------------------------------------------------------------------------
245 ! Left state
246 ! ------------------------------------------------------------------------------
247 
248  rl = cv(cv_mixt_dens,c1)
249  irl = 1.0_rfreal/rl
250 
251  ul = cv(cv_mixt_xmom,c1)*irl
252  vl = cv(cv_mixt_ymom,c1)*irl
253  wl = cv(cv_mixt_zmom,c1)*irl
254  pl = dv(dv_mixt_pres,c1)
255 
256  tl = mixtperf_t_dpr(rl,pl,rgas)
257  hl = mixtperf_ho_cptuvw(cpgas,tl,ul,vl,wl)
258 
259  ql = ul*nx + vl*ny + wl*nz - fs
260 
261 ! ------------------------------------------------------------------------------
262 ! Right state : get right values from boundary arrays cv and dv
263 ! ------------------------------------------------------------------------------
264 
265  rr = ppatch%mixt%cv(cv_mixt_dens,ifl)
266  irr = 1.0_rfreal/rr
267 
268  ur = ppatch%mixt%cv(cv_mixt_xmom,ifl)*irr
269  vr = ppatch%mixt%cv(cv_mixt_ymom,ifl)*irr
270  wr = ppatch%mixt%cv(cv_mixt_zmom,ifl)*irr
271  pr = ppatch%mixt%dv(dv_mixt_pres,ifl)
272 
273  tr = mixtperf_t_dpr(rr,pr,rgas)
274  hr = mixtperf_ho_cptuvw(cpgas,tr,ur,vr,wr)
275 
276  qr = ur*nx + vr*ny + wr*nz - fs
277 
278 ! ==============================================================================
279 ! Compute Roe-averaged face variables (h for hat)
280 ! ==============================================================================
281 
282  rh = sqrt(rl*rr)
283  wt = rl/(rl + rh)
284 
285  uh = wt*ul + (1.0_rfreal-wt)*ur
286  vh = wt*vl + (1.0_rfreal-wt)*vr
287  wh = wt*wl + (1.0_rfreal-wt)*wr
288  hh = wt*hl + (1.0_rfreal-wt)*hr
289 
290  qh = uh*nx + vh*ny + wh*nz - fs
291  sh = 0.5_rfreal*(uh*uh + vh*vh + wh*wh)
292 
293  ah = mixtperf_c_ghovm2(ggas,hh,2.0_rfreal*sh) ! NOTE factor of 2
294 
295 ! ==============================================================================
296 ! Compute eigenvalues
297 ! ==============================================================================
298 
299  l1 = abs(qh - ah)
300  l2 = abs(qh )
301  l5 = abs(qh + ah)
302 
303 ! ==============================================================================
304 ! Compute entropy fix
305 ! ==============================================================================
306 
307  efc = epsentr*l5
308  l1 = entropyfixhartenhyman(l1,efc)
309  l2 = entropyfixhartenhyman(l2,efc)
310  l5 = entropyfixhartenhyman(l5,efc)
311 
312 ! ==============================================================================
313 ! Compute wavestrengths
314 ! ==============================================================================
315 
316  dr = rr - rl
317  du = ur - ul
318  de = vr - vl ! use de to denote dv because dv is already used
319  dw = wr - wl
320  dp = pr - pl
321  dq = du*nx + de*ny + dw*nz ! Note: no gs contribution
322 
323  dv1 = (dp - rh*ah*dq)/(2.0_rfreal*ah*ah)
324  dv5 = (dp + rh*ah*dq)/(2.0_rfreal*ah*ah)
325  dv2 = dr - dp/(ah*ah)
326 
327  t1 = l1*dv1
328  t2 = l2*dv2
329  t3 = l2*rh
330  t5 = l5*dv5
331 
332 ! =============================================================================
333 ! Compute fluxes
334 ! =============================================================================
335 
336 ! ------------------------------------------------------------------------------
337 ! Central part
338 ! ------------------------------------------------------------------------------
339 
340  flxconv(1) = 0.5_rfreal*(ql*rl + qr*rr )*nm
341  flxconv(2) = 0.5_rfreal*(ql*rl*ul + pl*nx + qr*rr*ur + pr*nx)*nm
342  flxconv(3) = 0.5_rfreal*(ql*rl*vl + pl*ny + qr*rr*vr + pr*ny)*nm
343  flxconv(4) = 0.5_rfreal*(ql*rl*wl + pl*nz + qr*rr*wr + pr*nz)*nm
344  flxconv(5) = 0.5_rfreal*(ql*rl*hl + pl*fs + qr*rr*hr + pr*fs)*nm
345 
346 ! ------------------------------------------------------------------------------
347 ! Dissipative part
348 ! ------------------------------------------------------------------------------
349 
350  flxdiss(1) = 0.5_rfreal*dissfact*(t1 + t2 + t5 )*nm
351  flxdiss(2) = 0.5_rfreal*dissfact*(t1*(uh-nx*ah) + t2*uh + t3*(du-nx*dq) + t5*(uh+nx*ah))*nm
352  flxdiss(3) = 0.5_rfreal*dissfact*(t1*(vh-ny*ah) + t2*vh + t3*(de-ny*dq) + t5*(vh+ny*ah))*nm
353  flxdiss(4) = 0.5_rfreal*dissfact*(t1*(wh-nz*ah) + t2*wh + t3*(dw-nz*dq) + t5*(wh+nz*ah))*nm
354  flxdiss(5) = 0.5_rfreal*dissfact*(t1*(hh-qh*ah) + t2*sh + t3*(uh*du+vh*de+wh*dw-qh*dq) + t5*(hh+qh*ah))*nm
355 
356 ! ==============================================================================
357 ! Accumulate into residual
358 ! ==============================================================================
359 
360  rhs(cv_mixt_dens,c1) = rhs(cv_mixt_dens,c1) + (flxconv(1) - flxdiss(1))
361  rhs(cv_mixt_xmom,c1) = rhs(cv_mixt_xmom,c1) + (flxconv(2) - flxdiss(2))
362  rhs(cv_mixt_ymom,c1) = rhs(cv_mixt_ymom,c1) + (flxconv(3) - flxdiss(3))
363  rhs(cv_mixt_zmom,c1) = rhs(cv_mixt_zmom,c1) + (flxconv(4) - flxdiss(4))
364  rhs(cv_mixt_ener,c1) = rhs(cv_mixt_ener,c1) + (flxconv(5) - flxdiss(5))
365 
366  flx(1) = flxconv(1) - flxdiss(1)
367  flx(2) = flxconv(2) - flxdiss(2)
368  flx(3) = flxconv(3) - flxdiss(3)
369  flx(4) = flxconv(4) - flxdiss(4)
370  flx(5) = flxconv(5) - flxdiss(5)
371 
372  ppatch%cp(ifl) = icpref*(0.5_rfreal*(pl + pr) - pref)
373  ppatch%cmass(ifl) = icmassref*flx(1)/nm
374  ppatch%cmom(xcoord,ifl) = icpref*0.5_rfreal*(ul+ur)*flx(1)/nm
375  ppatch%cmom(ycoord,ifl) = icpref*0.5_rfreal*(vl+vr)*flx(1)/nm
376  ppatch%cmom(zcoord,ifl) = icpref*0.5_rfreal*(wl+wr)*flx(1)/nm
377 
378  IF ( pregion%irkStep == 1 ) THEN
379  global%massIn = global%massIn - min(flx(1),0.0_rfreal)
380  global%massOut = global%massOut + max(flx(1),0.0_rfreal)
381  END IF ! pRegion
382 
383  IF ( (global%checkLevel == check_high) .AND. &
384  (global%verbLevel >= verbose_high) .AND. &
385  (global%myProcid == masterproc) .AND. &
386  (decideprintflag .EQV. .true.) ) THEN
387  IF ( ppatch%bcType == bc_outflow ) THEN
388  IF ( flx(1) < 0.0_rfreal ) THEN
389  nlocs = nlocs + 1
390 
391  IF ( nlocs == 1 ) THEN
392  global%warnCounter = global%warnCounter + 1
393 
394  WRITE(stdout,'(A,1X,A,1X,I9)') solver_name, &
395  '*** WARNING *** Inflow detected at outflow boundary!'
396  WRITE(stdout,'(A,3X,A,1X,I5.5)') solver_name,'Global region:', &
397  pregion%iRegionGlobal
398  IF ( global%flowType == flow_unsteady ) THEN
399  WRITE(stdout,'(A,3X,A,1X,1PE11.5)') solver_name, &
400  'Current time:', &
401  global%currentTime
402  ELSE
403  WRITE(stdout,'(A,3X,A,1X,I6.6)') solver_name, &
404  'Current iteration number:', &
405  global%currentIter
406  END IF ! global%flowType
407 
408  WRITE(stdout,'(A,3X,A,1X,I1)') solver_name, &
409  'Runge-Kutta stage:', &
410  pregion%irkStep
411  END IF ! nLocs
412 
413  IF ( nlocs <= max_inoutflow_locs ) THEN
414  loc(nlocs,min_val:max_val) = c1
415  END IF ! nLocs
416  END IF ! flx(1)
417  END IF ! pPatch%bcType
418  END IF ! global%checkLevel
419  END DO ! ifl
420 
421 ! ------------------------------------------------------------------------------
422 ! Write info on inflow at outflow boundary
423 ! ------------------------------------------------------------------------------
424 
425  IF ( (global%checkLevel == check_high) .AND. &
426  (global%verbLevel >= verbose_high) .AND. &
427  (global%myProcid == masterproc) .AND. &
428  (decideprintflag .EQV. .true.) .AND. &
429  (nlocs > 0) ) THEN
430  IF ( ppatch%bcType == bc_outflow ) THEN
431  IF ( nlocs > max_inoutflow_locs ) THEN
432  WRITE(stdout,'(A,3X,A,1X,I3,1X,A,1X,I9,1X,A)') solver_name, &
433  'Only wrote the first',max_inoutflow_locs,'of',nlocs, &
434  'outflow faces with inflow.'
435  CALL rflu_printlocinfo(pregion,loc,max_inoutflow_locs, &
436  locinfo_mode_silent,output_mode_anybody)
437  ELSE
438  CALL rflu_printlocinfo(pregion,loc(1:nlocs,min_val:max_val),nlocs, &
439  locinfo_mode_silent,output_mode_anybody)
440  END IF ! nLocs
441  END IF ! pPatch%bcType
442  END IF ! nLocs
443 
444 ! ******************************************************************************
445 ! End
446 ! ******************************************************************************
447 
448  CALL deregisterfunction(global)
449 
450 END SUBROUTINE rflu_nscbc_compfirstpatchflux
451 
452 
453 
454 
455 
456 
457 
458 
459 
460 
461 
462 ! ******************************************************************************
463 !
464 ! Purpose: Compute patch flux.
465 !
466 ! Description: None.
467 !
468 ! Input:
469 ! pRegion Pointer to region
470 ! pPatch Pointer to patch
471 !
472 ! Output: None.
473 !
474 ! Notes: None.
475 !
476 ! ******************************************************************************
477 
478 SUBROUTINE rflu_nscbc_comppatchflux(pRegion,pPatch)
479 
480  IMPLICIT NONE
481 
482 ! ******************************************************************************
483 ! Definitions and declarations
484 ! ******************************************************************************
485 
486 ! ==============================================================================
487 ! Arguments
488 ! ==============================================================================
489 
490  TYPE(t_patch), POINTER :: ppatch
491  TYPE(t_region), POINTER :: pregion
492 
493 ! ==============================================================================
494 ! Locals
495 ! ==============================================================================
496 
497  LOGICAL :: decideprintflag
498  CHARACTER(CHRLEN) :: rcsidentstring
499  INTEGER, PARAMETER :: max_inoutflow_locs = 10
500  INTEGER :: c1,ifl,indgs,nlocs,loc(max_inoutflow_locs,min_val:max_val)
501  REAL(RFREAL) :: ah,cpgas,de,dissfact,dp,dq,dr,du,dv1,dv2,dv5,dw,efc,epsentr, &
502  fs,ggas,hh,hl,hr,icmassref,icpref,irl,irr,l1,l2,l5,nm,nx,ny, &
503  nz,pl,pr,pref,qh,ql,qr,rgas,rh,rl,rr,rref,sh,tl,tr,t1,t2,t3, &
504  t5,uh,ul,ur,vh,vl,vr,vref,wh,wl,wr,wt,xc,yc,zc
505  REAL(RFREAL) :: flxconv(5),flxdiss(5),flx(5)
506  REAL(RFREAL), DIMENSION(:), POINTER :: mfmixt
507  REAL(RFREAL), DIMENSION(:,:), POINTER :: cv,dv,gv,rhs,vals,sd
508  TYPE(t_global), POINTER :: global
509 
510 ! ******************************************************************************
511 ! Start
512 ! ******************************************************************************
513 
514  global => pregion%global
515 
516  CALL registerfunction(global,'RFLU_NSCBC_CompPatchFlux',&
517  'RFLU_ModNSCBC.F90')
518 
519 ! ******************************************************************************
520 ! Set pointers and variables
521 ! ******************************************************************************
522 
523  indgs = pregion%grid%indGs
524  epsentr = pregion%mixtInput%epsentr
525  dissfact = pregion%mixtInput%dissFact
526 
527  cv => pregion%mixt%cv
528  dv => pregion%mixt%dv
529  gv => pregion%mixt%gv
530  rhs => pregion%mixt%rhs
531  sd => pregion%mixt%sd
532 
533  nlocs = 0
534 
535  decideprintflag = rflu_decideprint(global)
536 
537  pref = global%refPressure
538  rref = global%refDensity
539  vref = global%refVelocity
540 
541  icpref = 2.0_rfreal/(rref*vref*vref)
542  icmassref = 1.0_rfreal/(rref*vref)
543 
544 ! ******************************************************************************
545 ! Define constants
546 ! ******************************************************************************
547 
548  cpgas = global%refCp
549  ggas = global%refGamma
550  rgas = mixtperf_r_cpg(cpgas,ggas)
551 
552 ! ******************************************************************************
553 ! Main Body
554 ! ******************************************************************************
555 
556  DO ifl = 1,ppatch%nBFaces
557  c1 = ppatch%bf2c(ifl)
558 
559  nx = ppatch%fn(xcoord,ifl)
560  ny = ppatch%fn(ycoord,ifl)
561  nz = ppatch%fn(zcoord,ifl)
562  nm = ppatch%fn(xyzmag,ifl)
563 
564  xc = ppatch%fc(xcoord,ifl)
565  yc = ppatch%fc(ycoord,ifl)
566  zc = ppatch%fc(zcoord,ifl)
567 
568  fs = ppatch%gs(indgs*ifl)
569 
570 ! ==============================================================================
571 ! Compute left and right states
572 ! ==============================================================================
573 
574 ! ------------------------------------------------------------------------------
575 ! get right values from boundary arrays cv and dv
576 ! ------------------------------------------------------------------------------
577 
578  rr = ppatch%mixt%cv(cv_mixt_dens,ifl)
579  irr = 1.0_rfreal/rr
580 
581  ur = ppatch%mixt%cv(cv_mixt_xmom,ifl)*irr
582  vr = ppatch%mixt%cv(cv_mixt_ymom,ifl)*irr
583  wr = ppatch%mixt%cv(cv_mixt_zmom,ifl)*irr
584  pr = ppatch%mixt%dv(dv_mixt_pres,ifl)
585 
586  tr = mixtperf_t_dpr(rr,pr,rgas)
587  hr = mixtperf_ho_cptuvw(cpgas,tr,ur,vr,wr)
588 
589  qr = ur*nx + vr*ny + wr*nz - fs
590 
591 ! ------------------------------------------------------------------------------
592 ! get Left state also from boundary arrays cv and dv
593 ! ------------------------------------------------------------------------------
594 
595  rl = rr
596 
597  ul = ur
598  vl = vr
599  wl = wr
600  pl = pr
601 
602  tl = tr
603  hl = hr
604 
605  ql = qr
606 
607 ! ==============================================================================
608 ! Compute Roe-averaged face variables (h for hat)
609 ! ==============================================================================
610 
611  rh = sqrt(rl*rr)
612  wt = rl/(rl + rh)
613 
614  uh = wt*ul + (1.0_rfreal-wt)*ur
615  vh = wt*vl + (1.0_rfreal-wt)*vr
616  wh = wt*wl + (1.0_rfreal-wt)*wr
617  hh = wt*hl + (1.0_rfreal-wt)*hr
618 
619  qh = uh*nx + vh*ny + wh*nz - fs
620  sh = 0.5_rfreal*(uh*uh + vh*vh + wh*wh)
621 
622  ah = mixtperf_c_ghovm2(ggas,hh,2.0_rfreal*sh) ! NOTE factor of 2
623 
624 ! ==============================================================================
625 ! Compute eigenvalues
626 ! ==============================================================================
627 
628  l1 = abs(qh - ah)
629  l2 = abs(qh )
630  l5 = abs(qh + ah)
631 
632 ! ==============================================================================
633 ! Compute entropy fix
634 ! ==============================================================================
635 
636  efc = epsentr*l5
637  l1 = entropyfixhartenhyman(l1,efc)
638  l2 = entropyfixhartenhyman(l2,efc)
639  l5 = entropyfixhartenhyman(l5,efc)
640 
641 ! ==============================================================================
642 ! Compute wavestrengths
643 ! ==============================================================================
644 
645  dr = rr - rl
646  du = ur - ul
647  de = vr - vl ! use de to denote dv because dv is already used
648  dw = wr - wl
649  dp = pr - pl
650  dq = du*nx + de*ny + dw*nz ! Note: no gs contribution
651 
652  dv1 = (dp - rh*ah*dq)/(2.0_rfreal*ah*ah)
653  dv5 = (dp + rh*ah*dq)/(2.0_rfreal*ah*ah)
654  dv2 = dr - dp/(ah*ah)
655 
656  t1 = l1*dv1
657  t2 = l2*dv2
658  t3 = l2*rh
659  t5 = l5*dv5
660 
661 ! =============================================================================
662 ! Compute fluxes
663 ! =============================================================================
664 
665 ! ------------------------------------------------------------------------------
666 ! Central part
667 ! ------------------------------------------------------------------------------
668 
669  flxconv(1) = 0.5_rfreal*(ql*rl + qr*rr )*nm
670  flxconv(2) = 0.5_rfreal*(ql*rl*ul + pl*nx + qr*rr*ur + pr*nx)*nm
671  flxconv(3) = 0.5_rfreal*(ql*rl*vl + pl*ny + qr*rr*vr + pr*ny)*nm
672  flxconv(4) = 0.5_rfreal*(ql*rl*wl + pl*nz + qr*rr*wr + pr*nz)*nm
673  flxconv(5) = 0.5_rfreal*(ql*rl*hl + pl*fs + qr*rr*hr + pr*fs)*nm
674 
675 ! ------------------------------------------------------------------------------
676 ! Dissipative part
677 ! ------------------------------------------------------------------------------
678 
679  flxdiss(1) = 0.5_rfreal*dissfact*(t1 + t2 + t5 )*nm
680  flxdiss(2) = 0.5_rfreal*dissfact*(t1*(uh-nx*ah) + t2*uh + t3*(du-nx*dq) + t5*(uh+nx*ah))*nm
681  flxdiss(3) = 0.5_rfreal*dissfact*(t1*(vh-ny*ah) + t2*vh + t3*(de-ny*dq) + t5*(vh+ny*ah))*nm
682  flxdiss(4) = 0.5_rfreal*dissfact*(t1*(wh-nz*ah) + t2*wh + t3*(dw-nz*dq) + t5*(wh+nz*ah))*nm
683  flxdiss(5) = 0.5_rfreal*dissfact*(t1*(hh-qh*ah) + t2*sh + t3*(uh*du+vh*de+wh*dw-qh*dq) + t5*(hh+qh*ah))*nm
684 
685 ! ==============================================================================
686 ! Accumulate into residual
687 ! ==============================================================================
688 
689  rhs(cv_mixt_dens,c1) = rhs(cv_mixt_dens,c1) + (flxconv(1) - flxdiss(1))
690  rhs(cv_mixt_xmom,c1) = rhs(cv_mixt_xmom,c1) + (flxconv(2) - flxdiss(2))
691  rhs(cv_mixt_ymom,c1) = rhs(cv_mixt_ymom,c1) + (flxconv(3) - flxdiss(3))
692  rhs(cv_mixt_zmom,c1) = rhs(cv_mixt_zmom,c1) + (flxconv(4) - flxdiss(4))
693  rhs(cv_mixt_ener,c1) = rhs(cv_mixt_ener,c1) + (flxconv(5) - flxdiss(5))
694 
695  flx(1) = flxconv(1) - flxdiss(1)
696  flx(2) = flxconv(2) - flxdiss(2)
697  flx(3) = flxconv(3) - flxdiss(3)
698  flx(4) = flxconv(4) - flxdiss(4)
699  flx(5) = flxconv(5) - flxdiss(5)
700 
701  ppatch%cp(ifl) = icpref*(0.5_rfreal*(pl + pr) - pref)
702  ppatch%cmass(ifl) = icmassref*flx(1)/nm
703  ppatch%cmom(xcoord,ifl) = icpref*0.5_rfreal*(ul+ur)*flx(1)/nm
704  ppatch%cmom(ycoord,ifl) = icpref*0.5_rfreal*(vl+vr)*flx(1)/nm
705  ppatch%cmom(zcoord,ifl) = icpref*0.5_rfreal*(wl+wr)*flx(1)/nm
706 
707  IF ( pregion%irkStep == 1 ) THEN
708  global%massIn = global%massIn - min(flx(1),0.0_rfreal)
709  global%massOut = global%massOut + max(flx(1),0.0_rfreal)
710  END IF ! pRegion
711 
712  IF ( (global%checkLevel == check_high) .AND. &
713  (global%verbLevel >= verbose_high) .AND. &
714  (global%myProcid == masterproc) .AND. &
715  (decideprintflag .EQV. .true.) ) THEN
716  IF ( ppatch%bcType == bc_outflow ) THEN
717  IF ( flx(1) < 0.0_rfreal ) THEN
718  nlocs = nlocs + 1
719 
720  IF ( nlocs == 1 ) THEN
721  global%warnCounter = global%warnCounter + 1
722 
723  WRITE(stdout,'(A,1X,A,1X,I9)') solver_name, &
724  '*** WARNING *** Inflow detected at outflow boundary!'
725  WRITE(stdout,'(A,3X,A,1X,I5.5)') solver_name,'Global region:', &
726  pregion%iRegionGlobal
727 
728  IF ( global%flowType == flow_unsteady ) THEN
729  WRITE(stdout,'(A,3X,A,1X,1PE11.5)') solver_name, &
730  'Current time:', &
731  global%currentTime
732  ELSE
733  WRITE(stdout,'(A,3X,A,1X,I6.6)') solver_name, &
734  'Current iteration number:', &
735  global%currentIter
736  END IF ! global%flowType
737 
738  WRITE(stdout,'(A,3X,A,1X,I1)') solver_name, &
739  'Runge-Kutta stage:', &
740  pregion%irkStep
741  END IF ! nLocs
742 
743  IF ( nlocs <= max_inoutflow_locs ) THEN
744  loc(nlocs,min_val:max_val) = c1
745  END IF ! nLocs
746  END IF ! flx(1)
747  END IF ! pPatch%bcType
748  END IF ! global%checkLevel
749  END DO ! ifl
750 
751 ! ------------------------------------------------------------------------------
752 ! Write info on inflow at outflow boundary
753 ! ------------------------------------------------------------------------------
754 
755  IF ( (global%checkLevel == check_high) .AND. &
756  (global%verbLevel >= verbose_high) .AND. &
757  (global%myProcid == masterproc) .AND. &
758  (decideprintflag .EQV. .true.) .AND. &
759  (nlocs > 0) ) THEN
760  IF ( ppatch%bcType == bc_outflow ) THEN
761  IF ( nlocs > max_inoutflow_locs ) THEN
762  WRITE(stdout,'(A,3X,A,1X,I3,1X,A,1X,I9,1X,A)') solver_name, &
763  'Only wrote the first',max_inoutflow_locs,'of',nlocs, &
764  'outflow faces with inflow.'
765  CALL rflu_printlocinfo(pregion,loc,max_inoutflow_locs, &
766  locinfo_mode_silent,output_mode_anybody)
767  ELSE
768  CALL rflu_printlocinfo(pregion,loc(1:nlocs,min_val:max_val),nlocs, &
769  locinfo_mode_silent,output_mode_anybody)
770  END IF ! nLocs
771  END IF ! pPatch%bcType
772  END IF ! nLocs
773 
774 ! ******************************************************************************
775 ! End
776 ! ******************************************************************************
777 
778  CALL deregisterfunction(global)
779 
780 END SUBROUTINE rflu_nscbc_comppatchflux
781 
782 
783 
784 
785 
786 
787 
788 
789 ! ******************************************************************************
790 !
791 ! Purpose: Compute patch fluxes with second-order accuracy.
792 !
793 ! Description: None.
794 !
795 ! Input:
796 ! pRegion Pointer to region
797 ! pPatch Pointer to patch
798 !
799 ! Output: None.
800 !
801 ! Notes: None.
802 !
803 ! ******************************************************************************
804 
805 SUBROUTINE rflu_nscbc_compsecondpatchflux(pRegion,pPatch)
806 
807  IMPLICIT NONE
808 
809 ! ******************************************************************************
810 ! Definitions and declarations
811 ! ******************************************************************************
812 
813 ! ==============================================================================
814 ! Arguments
815 ! ==============================================================================
816 
817  TYPE(t_patch), POINTER :: ppatch
818  TYPE(t_region), POINTER :: pregion
819 
820 ! ==============================================================================
821 ! Locals
822 ! ==============================================================================
823 
824  LOGICAL :: decideprintflag
825  CHARACTER(CHRLEN) :: rcsidentstring
826  INTEGER, PARAMETER :: max_inoutflow_locs = 10
827  INTEGER :: c1,ifl,indgs,nlocs,loc(max_inoutflow_locs,min_val:max_val)
828  REAL(RFREAL) :: ah,cpgas,de,dissfact,dp,dq,dr,dx,dy,dz,du,dv1,dv2,dv5,dw,efc, &
829  epsentr,fs,ggas,hh,hl,hr,icmassref,icpref,irl,irr,l1,l2,l5, &
830  nm,nx,ny,nz,pl,pr,pref,qh,ql,qr,rgas,rh,rl,rr,rref,sh,tl,tr, &
831  t1,t2,t3,t5,uh,ul,ur,vh,vl,vr,vref,wh,wl,wr,wt,xc,yc,zc
832  REAL(RFREAL) :: flxconv(5),flxdiss(5),flx(5)
833  REAL(RFREAL), DIMENSION(:), POINTER :: mfmixt
834  REAL(RFREAL), DIMENSION(:,:), POINTER :: cv,dv,gv,rhs,vals,sd
835  REAL(RFREAL), DIMENSION(:,:,:), POINTER :: grad
836  TYPE(t_global), POINTER :: global
837 
838 ! ******************************************************************************
839 ! Start
840 ! ******************************************************************************
841 
842  global => pregion%global
843 
844  CALL registerfunction(global,'RFLU_NSCBC_CompSecondPatchFlux',&
845  'RFLU_ModNSCBC.F90')
846 
847 ! ******************************************************************************
848 ! Set pointers and variables
849 ! ******************************************************************************
850 
851  indgs = pregion%grid%indGs
852  epsentr = pregion%mixtInput%epsentr
853  dissfact = pregion%mixtInput%dissFact
854 
855  cv => pregion%mixt%cv
856  dv => pregion%mixt%dv
857  gv => pregion%mixt%gv
858  grad => pregion%mixt%gradCell
859  rhs => pregion%mixt%rhs
860  sd => pregion%mixt%sd
861 
862  nlocs = 0
863 
864  decideprintflag = rflu_decideprint(global)
865 
866  pref = global%refPressure
867  rref = global%refDensity
868  vref = global%refVelocity
869 
870  icpref = 2.0_rfreal/(rref*vref*vref)
871  icmassref = 1.0_rfreal/(rref*vref)
872 
873 ! ******************************************************************************
874 ! Define constants
875 ! ******************************************************************************
876 
877  cpgas = global%refCp
878  ggas = global%refGamma
879  rgas = mixtperf_r_cpg(cpgas,ggas)
880 
881 ! ******************************************************************************
882 ! Main Body
883 ! ******************************************************************************
884 
885  DO ifl = 1,ppatch%nBFaces
886  c1 = ppatch%bf2c(ifl)
887 
888  nx = ppatch%fn(xcoord,ifl)
889  ny = ppatch%fn(ycoord,ifl)
890  nz = ppatch%fn(zcoord,ifl)
891  nm = ppatch%fn(xyzmag,ifl)
892 
893  xc = ppatch%fc(xcoord,ifl)
894  yc = ppatch%fc(ycoord,ifl)
895  zc = ppatch%fc(zcoord,ifl)
896 
897  fs = ppatch%gs(indgs*ifl)
898 
899 ! ==============================================================================
900 ! Compute left and right states
901 ! ==============================================================================
902 
903 ! ------------------------------------------------------------------------------
904 ! Left state
905 ! ------------------------------------------------------------------------------
906 
907  rl = cv(cv_mixt_dens,c1)
908  irl = 1.0_rfreal/rl
909 
910  ul = cv(cv_mixt_xmom,c1)*irl
911  vl = cv(cv_mixt_ymom,c1)*irl
912  wl = cv(cv_mixt_zmom,c1)*irl
913  pl = dv(dv_mixt_pres,c1)
914 
915  dx = xc - pregion%grid%cofg(xcoord,c1)
916  dy = yc - pregion%grid%cofg(ycoord,c1)
917  dz = zc - pregion%grid%cofg(zcoord,c1)
918 
919  rl = rl + grad(xcoord,grc_mixt_dens,c1)*dx &
920  + grad(ycoord,grc_mixt_dens,c1)*dy &
921  + grad(zcoord,grc_mixt_dens,c1)*dz
922  ul = ul + grad(xcoord,grc_mixt_xvel,c1)*dx &
923  + grad(ycoord,grc_mixt_xvel,c1)*dy &
924  + grad(zcoord,grc_mixt_xvel,c1)*dz
925  vl = vl + grad(xcoord,grc_mixt_yvel,c1)*dx &
926  + grad(ycoord,grc_mixt_yvel,c1)*dy &
927  + grad(zcoord,grc_mixt_yvel,c1)*dz
928  wl = wl + grad(xcoord,grc_mixt_zvel,c1)*dx &
929  + grad(ycoord,grc_mixt_zvel,c1)*dy &
930  + grad(zcoord,grc_mixt_zvel,c1)*dz
931  pl = pl + grad(xcoord,grc_mixt_pres,c1)*dx &
932  + grad(ycoord,grc_mixt_pres,c1)*dy &
933  + grad(zcoord,grc_mixt_pres,c1)*dz
934 
935  tl = mixtperf_t_dpr(rl,pl,rgas)
936  hl = mixtperf_ho_cptuvw(cpgas,tl,ul,vl,wl)
937 
938  ql = ul*nx + vl*ny + wl*nz - fs
939 
940 ! ------------------------------------------------------------------------------
941 ! Get right values from boundary arrays cv and dv
942 ! ------------------------------------------------------------------------------
943 
944  rr = ppatch%mixt%cv(cv_mixt_dens,ifl)
945  irr = 1.0_rfreal/rr
946 
947  ur = ppatch%mixt%cv(cv_mixt_xmom,ifl)*irr
948  vr = ppatch%mixt%cv(cv_mixt_ymom,ifl)*irr
949  wr = ppatch%mixt%cv(cv_mixt_zmom,ifl)*irr
950  pr = ppatch%mixt%dv(dv_mixt_pres,ifl)
951 
952  tr = mixtperf_t_dpr(rr,pr,rgas)
953  hr = mixtperf_ho_cptuvw(cpgas,tr,ur,vr,wr)
954 
955  qr = ur*nx + vr*ny + wr*nz - fs
956 
957 ! ==============================================================================
958 ! Compute Roe-averaged face variables (h for hat)
959 ! ==============================================================================
960 
961  rh = sqrt(rl*rr)
962  wt = rl/(rl + rh)
963 
964  uh = wt*ul + (1.0_rfreal-wt)*ur
965  vh = wt*vl + (1.0_rfreal-wt)*vr
966  wh = wt*wl + (1.0_rfreal-wt)*wr
967  hh = wt*hl + (1.0_rfreal-wt)*hr
968 
969  qh = uh*nx + vh*ny + wh*nz - fs
970  sh = 0.5_rfreal*(uh*uh + vh*vh + wh*wh)
971 
972  ah = mixtperf_c_ghovm2(ggas,hh,2.0_rfreal*sh) ! NOTE factor of 2
973 
974 ! ==============================================================================
975 ! Compute eigenvalues
976 ! ==============================================================================
977 
978  l1 = abs(qh - ah)
979  l2 = abs(qh )
980  l5 = abs(qh + ah)
981 
982 ! ==============================================================================
983 ! Compute entropy fix
984 ! ==============================================================================
985 
986  efc = epsentr*l5
987  l1 = entropyfixhartenhyman(l1,efc)
988  l2 = entropyfixhartenhyman(l2,efc)
989  l5 = entropyfixhartenhyman(l5,efc)
990 
991 ! ==============================================================================
992 ! Compute wavestrengths
993 ! ==============================================================================
994 
995  dr = rr - rl
996  du = ur - ul
997  de = vr - vl ! use de to denote dv because dv is already used
998  dw = wr - wl
999  dp = pr - pl
1000  dq = du*nx + de*ny + dw*nz ! Note: no gs contribution
1001 
1002  dv1 = (dp - rh*ah*dq)/(2.0_rfreal*ah*ah)
1003  dv5 = (dp + rh*ah*dq)/(2.0_rfreal*ah*ah)
1004  dv2 = dr - dp/(ah*ah)
1005 
1006  t1 = l1*dv1
1007  t2 = l2*dv2
1008  t3 = l2*rh
1009  t5 = l5*dv5
1010 
1011 ! =============================================================================
1012 ! Compute fluxes
1013 ! =============================================================================
1014 
1015 ! ------------------------------------------------------------------------------
1016 ! Central part
1017 ! ------------------------------------------------------------------------------
1018 
1019  flxconv(1) = 0.5_rfreal*(ql*rl + qr*rr )*nm
1020  flxconv(2) = 0.5_rfreal*(ql*rl*ul + pl*nx + qr*rr*ur + pr*nx)*nm
1021  flxconv(3) = 0.5_rfreal*(ql*rl*vl + pl*ny + qr*rr*vr + pr*ny)*nm
1022  flxconv(4) = 0.5_rfreal*(ql*rl*wl + pl*nz + qr*rr*wr + pr*nz)*nm
1023  flxconv(5) = 0.5_rfreal*(ql*rl*hl + pl*fs + qr*rr*hr + pr*fs)*nm
1024 
1025 ! ------------------------------------------------------------------------------
1026 ! Dissipative part
1027 ! ------------------------------------------------------------------------------
1028 
1029  flxdiss(1) = 0.5_rfreal*dissfact*(t1 + t2 + t5 )*nm
1030  flxdiss(2) = 0.5_rfreal*dissfact*(t1*(uh-nx*ah) + t2*uh + t3*(du-nx*dq) + t5*(uh+nx*ah))*nm
1031  flxdiss(3) = 0.5_rfreal*dissfact*(t1*(vh-ny*ah) + t2*vh + t3*(de-ny*dq) + t5*(vh+ny*ah))*nm
1032  flxdiss(4) = 0.5_rfreal*dissfact*(t1*(wh-nz*ah) + t2*wh + t3*(dw-nz*dq) + t5*(wh+nz*ah))*nm
1033  flxdiss(5) = 0.5_rfreal*dissfact*(t1*(hh-qh*ah) + t2*sh + t3*(uh*du+vh*de+wh*dw-qh*dq) + t5*(hh+qh*ah))*nm
1034 
1035 ! ==============================================================================
1036 ! Accumulate into residual
1037 ! ==============================================================================
1038 
1039  rhs(cv_mixt_dens,c1) = rhs(cv_mixt_dens,c1) + (flxconv(1) - flxdiss(1))
1040  rhs(cv_mixt_xmom,c1) = rhs(cv_mixt_xmom,c1) + (flxconv(2) - flxdiss(2))
1041  rhs(cv_mixt_ymom,c1) = rhs(cv_mixt_ymom,c1) + (flxconv(3) - flxdiss(3))
1042  rhs(cv_mixt_zmom,c1) = rhs(cv_mixt_zmom,c1) + (flxconv(4) - flxdiss(4))
1043  rhs(cv_mixt_ener,c1) = rhs(cv_mixt_ener,c1) + (flxconv(5) - flxdiss(5))
1044 
1045  flx(1) = flxconv(1) - flxdiss(1)
1046  flx(2) = flxconv(2) - flxdiss(2)
1047  flx(3) = flxconv(3) - flxdiss(3)
1048  flx(4) = flxconv(4) - flxdiss(4)
1049  flx(5) = flxconv(5) - flxdiss(5)
1050 
1051  ppatch%cp(ifl) = icpref*(0.5_rfreal*(pl + pr) - pref)
1052  ppatch%cmass(ifl) = icmassref*flx(1)/nm
1053  ppatch%cmom(xcoord,ifl) = icpref*0.5_rfreal*(ul+ur)*flx(1)/nm
1054  ppatch%cmom(ycoord,ifl) = icpref*0.5_rfreal*(vl+vr)*flx(1)/nm
1055  ppatch%cmom(zcoord,ifl) = icpref*0.5_rfreal*(wl+wr)*flx(1)/nm
1056 
1057  IF ( pregion%irkStep == 1 ) THEN
1058  global%massIn = global%massIn - min(flx(1),0.0_rfreal)
1059  global%massOut = global%massOut + max(flx(1),0.0_rfreal)
1060  END IF ! pRegion
1061 
1062  IF ( (global%checkLevel == check_high) .AND. &
1063  (global%verbLevel >= verbose_high) .AND. &
1064  (global%myProcid == masterproc) .AND. &
1065  (decideprintflag .EQV. .true.) ) THEN
1066  IF ( ppatch%bcType == bc_outflow ) THEN
1067  IF ( flx(1) < 0.0_rfreal ) THEN
1068  nlocs = nlocs + 1
1069 
1070  IF ( nlocs == 1 ) THEN
1071  global%warnCounter = global%warnCounter + 1
1072 
1073  WRITE(stdout,'(A,1X,A,1X,I9)') solver_name, &
1074  '*** WARNING *** Reverse flow detected at global patch', &
1075  ppatch%iPatchGlobal
1076  WRITE(stdout,'(A,3X,A,1X,I5.5)') solver_name,'Global region:', &
1077  pregion%iRegionGlobal
1078  IF ( global%flowType == flow_unsteady ) THEN
1079  WRITE(stdout,'(A,3X,A,1X,1PE11.5)') solver_name, &
1080  'Current time:', &
1081  global%currentTime
1082  ELSE
1083  WRITE(stdout,'(A,3X,A,1X,I6.6)') solver_name, &
1084  'Current iteration number:', &
1085  global%currentIter
1086  END IF ! global%flowType
1087 
1088  WRITE(stdout,'(A,3X,A,1X,I1)') solver_name, &
1089  'Runge-Kutta stage:', &
1090  pregion%irkStep
1091  END IF ! nLocs
1092 
1093  IF ( nlocs <= max_inoutflow_locs ) THEN
1094  loc(nlocs,min_val:max_val) = c1
1095  END IF ! nLocs
1096  END IF ! flx(1)
1097  END IF ! pPatch%bcType
1098  END IF ! global%checkLevel
1099  END DO ! ifl
1100 
1101 ! ------------------------------------------------------------------------------
1102 ! Write info on inflow at outflow boundary
1103 ! ------------------------------------------------------------------------------
1104 
1105  IF ( (global%checkLevel == check_high) .AND. &
1106  (global%verbLevel >= verbose_high) .AND. &
1107  (global%myProcid == masterproc) .AND. &
1108  (decideprintflag .EQV. .true.) .AND. &
1109  (nlocs > 0) ) THEN
1110  IF ( ppatch%bcType == bc_outflow ) THEN
1111  IF ( nlocs > max_inoutflow_locs ) THEN
1112  WRITE(stdout,'(A,3X,A,1X,I3,1X,A,1X,I9,1X,A)') solver_name, &
1113  'Only wrote the first',max_inoutflow_locs,'of',nlocs, &
1114  'outflow faces with inflow.'
1115  CALL rflu_printlocinfo(pregion,loc,max_inoutflow_locs, &
1116  locinfo_mode_silent,output_mode_anybody)
1117  ELSE
1118  CALL rflu_printlocinfo(pregion,loc(1:nlocs,min_val:max_val),nlocs, &
1119  locinfo_mode_silent,output_mode_anybody)
1120  END IF ! nLocs
1121  END IF ! pPatch%bcType
1122  END IF ! nLocs
1123 
1124 ! ******************************************************************************
1125 ! End
1126 ! ******************************************************************************
1127 
1128  CALL deregisterfunction(global)
1129 
1130 END SUBROUTINE rflu_nscbc_compsecondpatchflux
1131 
1132 
1133 
1134 
1135 
1136 
1137 
1138 
1139 ! ******************************************************************************
1140 !
1141 ! Purpose: Wrapper for computing RHS.
1142 !
1143 ! Description: None.
1144 !
1145 ! Input:
1146 ! pRegion Region pointer
1147 !
1148 ! Output: None.
1149 !
1150 ! Notes: None.
1151 !
1152 ! ******************************************************************************
1153 
1154 SUBROUTINE rflu_nscbc_comprhs(pRegion)
1155 
1156  IMPLICIT NONE
1157 
1158 ! ******************************************************************************
1159 ! Definitions and declarations
1160 ! ******************************************************************************
1161 
1162 ! ==============================================================================
1163 ! Arguments
1164 ! ==============================================================================
1165 
1166  TYPE(t_region), POINTER :: pregion
1167 
1168 ! ==============================================================================
1169 ! Locals
1170 ! ==============================================================================
1171 
1172  INTEGER :: errorflag,ipatch
1173  INTEGER :: varinfo(cv_mixt_xvel:cv_mixt_temp)
1174  TYPE(t_patch), POINTER :: ppatch
1175  TYPE(t_global), POINTER :: global
1176 
1177 ! ******************************************************************************
1178 ! Start
1179 ! ******************************************************************************
1180 
1181  global => pregion%global
1182 
1183  CALL registerfunction(global,'RFLU_NSCBC_CompRhs',&
1184  'RFLU_ModNSCBC.F90')
1185 
1186 ! ******************************************************************************
1187 ! Compute gradients at boundary faces
1188 ! ******************************************************************************
1189 
1190  CALL rflu_convertcvcons2prim(pregion,cv_mixt_state_duvwp)
1191 
1192  DO ipatch = 1,pregion%grid%nPatches
1193  ppatch => pregion%patches(ipatch)
1194 
1195  IF ( rflu_decideneedbgradface(pregion,ppatch) .EQV. .true. ) THEN
1196  CALL rflu_bxv_convertcvcons2prim(pregion,ppatch,cv_mixt_state_duvwp)
1197 
1198  CALL rflu_computegradbfaceswrapper(pregion,ppatch,cv_mixt_dens,cv_mixt_pres, &
1199  grbf_mixt_dens,grbf_mixt_pres, &
1200  pregion%mixt%cv,ppatch%mixt%gradFace)
1201 
1202  CALL rflu_bxv_convertcvprim2cons(pregion,ppatch,cv_mixt_state_cons)
1203  END IF ! RFLU_DecideNeedBGradFace
1204  END DO ! iPatch
1205 
1206  CALL rflu_convertcvprim2cons(pregion,cv_mixt_state_cons)
1207 
1208 ! ******************************************************************************
1209 ! Loop over patches and call Rhs computation routine based on type of BC
1210 ! ******************************************************************************
1211 
1212  DO ipatch = 1,pregion%grid%nPatches
1213  ppatch => pregion%patches(ipatch)
1214 
1215  IF ( ppatch%bcKind == bc_kind_nscbc ) THEN
1216  SELECT CASE( ppatch%bcType )
1217  CASE (bc_slipwall)
1218  CALL rflu_nscbc_comprhssw(pregion,ppatch)
1219  CASE (bc_noslipwall_hflux)
1220  CALL rflu_nscbc_comprhsnswheat(pregion,ppatch)
1221  CASE (bc_noslipwall_temp)
1222  CALL rflu_nscbc_comprhsnswtemp(pregion,ppatch)
1223  CASE (bc_inflow_totang)
1224  CALL rflu_nscbc_comprhsiftotang(pregion,ppatch)
1225  CASE (bc_inflow_veltemp)
1226  CALL rflu_nscbc_comprhsifveltemp(pregion,ppatch)
1227  CASE (bc_outflow)
1228  CALL rflu_nscbc_comprhsof(pregion,ppatch)
1229  CASE (bc_farfield)
1230  CALL rflu_nscbc_comprhsff(pregion,ppatch)
1231  CASE (bc_injection)
1232  CALL rflu_nscbc_comprhsij(pregion,ppatch)
1233  CASE default
1234  CALL errorstop(global,err_reached_default,__line__)
1235  END SELECT ! pPatch%bcType
1236  END IF ! pPatch%bcKind
1237  END DO ! iPatch
1238 
1239 ! ******************************************************************************
1240 ! End
1241 ! ******************************************************************************
1242 
1243  CALL deregisterfunction(global)
1244 
1245 END SUBROUTINE rflu_nscbc_comprhs
1246 
1247 
1248 
1249 
1250 
1251 
1252 
1253 
1254 
1255 
1256 
1257 ! ******************************************************************************
1258 !
1259 ! Purpose: Compute RHS for farfield.
1260 !
1261 ! Description: None.
1262 !
1263 ! Input:
1264 ! pRegion Pointer to region
1265 ! pPatch Pointer to patch
1266 !
1267 ! Output: None.
1268 !
1269 ! Notes: None.
1270 !
1271 ! ******************************************************************************
1272 
1273 SUBROUTINE rflu_nscbc_comprhsff(pRegion,pPatch)
1274 
1275  IMPLICIT NONE
1276 
1277 ! ******************************************************************************
1278 ! Definitions and declarations
1279 ! ******************************************************************************
1280 
1281 ! ==============================================================================
1282 ! Arguments
1283 ! ==============================================================================
1284 
1285  TYPE(t_patch), POINTER :: ppatch
1286  TYPE(t_region), POINTER :: pregion
1287 
1288 ! ==============================================================================
1289 ! Locals
1290 ! ==============================================================================
1291 
1292  LOGICAL :: farfieldinflow,farfieldsupersonic
1293  INTEGER :: c1,distrib,errorflag,ifl,indcp,indmol
1294  REAL(RFREAL) :: a,aoa,aos,cp,d1,d2,d3,d4,d5,dotproduct,dndx,dndy,dndz,dpdn, &
1295  dpds,dpdt,dpdx,dpdy,dpdz,drdn,drds,drdt,drdx,drdy,drdz,dsdx, &
1296  dsdy,dsdz,dtdx,dtdy,dtdz,dudn,duds,dudt,dudx,dudy,dudz,dundn, &
1297  dunds,dundt,dusdn,dusds,dusdt,dutdn,dutds,dutdt,dvdn,dvds, &
1298  dvdt,dvdx,dvdy,dvdz,dwdn,dwds,dwdt,dwdx,dwdy,dwdz,dxdn,dxds, &
1299  dxdt,dydn,dyds,dydt,dzdn,dzds,dzdt,g,l1,l2,l3,l4,l5,lambda1, &
1300  lambda2,lambda3,lambda4,lambda5,mm,mf,mfnormal,nx,ny,nz,p,r, &
1301  rgas,rhs1,rhs2,rhs3,rhs4,rhs5,ru,rv,rw,sx,sy,sz,tx,ty,tz,u, &
1302  un,us,ut,v,w
1303  REAL(RFREAL), POINTER, DIMENSION(:,:) :: pcv,pdv,prhs,pgv,vals
1304  REAL(RFREAL), DIMENSION(:,:,:), POINTER :: pgradface
1305  TYPE(t_global), POINTER :: global
1306 
1307 ! ******************************************************************************
1308 ! Start
1309 ! ******************************************************************************
1310 
1311  global => pregion%global
1312 
1313  CALL registerfunction(global,'RFLU_NSCBC_CompRhsFF',&
1314  'RFLU_ModNSCBC.F90')
1315 
1316 ! ******************************************************************************
1317 ! Main Body - loop over all boundary faces
1318 ! ******************************************************************************
1319 
1320  vals => ppatch%mixt%vals
1321 
1322  distrib = ppatch%mixt%distrib
1323 
1324  indcp = pregion%mixtInput%indCp
1325  indmol = pregion%mixtInput%indMol
1326 
1327  pcv => ppatch%mixt%cv
1328  pdv => ppatch%mixt%dv
1329  pgv => pregion%mixt%gv ! NOTE get gv from volume
1330  prhs => ppatch%mixt%rhs
1331 
1332  pgradface => ppatch%mixt%gradFace
1333 
1334  DO ifl = 1,ppatch%nBFaces
1335  c1 = ppatch%bf2c(ifl)
1336 
1337  cp = pgv(gv_mixt_cp ,indcp *c1)
1338  mm = pgv(gv_mixt_mol,indmol*c1)
1339  rgas = mixtperf_r_m(mm)
1340  g = mixtperf_g_cpr(cp,rgas)
1341 
1342  r = pcv(cv_mixt_dens,ifl)
1343  ru = pcv(cv_mixt_xmom,ifl)
1344  rv = pcv(cv_mixt_ymom,ifl)
1345  rw = pcv(cv_mixt_zmom,ifl)
1346  p = pdv(dv_mixt_pres,ifl)
1347  a = pdv(dv_mixt_soun,ifl)
1348 
1349  u = ru/r
1350  v = rv/r
1351  w = rw/r
1352 
1353  drdx = pgradface(xcoord,grbf_mixt_dens,ifl)
1354  drdy = pgradface(ycoord,grbf_mixt_dens,ifl)
1355  drdz = pgradface(zcoord,grbf_mixt_dens,ifl)
1356 
1357  dudx = pgradface(xcoord,grbf_mixt_xvel,ifl)
1358  dudy = pgradface(ycoord,grbf_mixt_xvel,ifl)
1359  dudz = pgradface(zcoord,grbf_mixt_xvel,ifl)
1360 
1361  dvdx = pgradface(xcoord,grbf_mixt_yvel,ifl)
1362  dvdy = pgradface(ycoord,grbf_mixt_yvel,ifl)
1363  dvdz = pgradface(zcoord,grbf_mixt_yvel,ifl)
1364 
1365  dwdx = pgradface(xcoord,grbf_mixt_zvel,ifl)
1366  dwdy = pgradface(ycoord,grbf_mixt_zvel,ifl)
1367  dwdz = pgradface(zcoord,grbf_mixt_zvel,ifl)
1368 
1369  dpdx = pgradface(xcoord,grbf_mixt_pres,ifl)
1370  dpdy = pgradface(ycoord,grbf_mixt_pres,ifl)
1371  dpdz = pgradface(zcoord,grbf_mixt_pres,ifl)
1372 
1373 ! ==============================================================================
1374 ! Computation of normal and tangential vectors
1375 ! ==============================================================================
1376 
1377  nx = ppatch%fn(xcoord,ifl)
1378  ny = ppatch%fn(ycoord,ifl)
1379  nz = ppatch%fn(zcoord,ifl)
1380 
1381  SELECT CASE ( pregion%mixtInput%dimens )
1382  CASE ( 2 )
1383  sx = -ny
1384  sy = nx
1385  sz = nz
1386 
1387  tx = 0.0_rfreal
1388  ty = 0.0_rfreal
1389  tz = 1.0_rfreal
1390  CASE ( 3 )
1391  sx = -ny
1392  sy = nx
1393  sz = nz
1394 
1395  tx = 0.0_rfreal
1396  ty = 0.0_rfreal
1397  tz = 1.0_rfreal
1398  CASE default
1399  CALL errorstop(global,err_reached_default,__line__)
1400  END SELECT ! pRegion%mixtInput%dimens
1401 
1402  dxdn = nx
1403  dydn = ny
1404  dzdn = nz
1405 
1406  dxds = sx
1407  dyds = sy
1408  dzds = sz
1409 
1410  dxdt = tx
1411  dydt = ty
1412  dzdt = tz
1413 
1414  dndx = dxdn
1415  dndy = dydn
1416  dndz = dzdn
1417 
1418  dsdx = dxds
1419  dsdy = dyds
1420  dsdz = dzds
1421 
1422  dtdx = dxdt
1423  dtdy = dydt
1424  dtdz = dzdt
1425 
1426 ! ==============================================================================
1427 ! Determine if current face is inflow or outflow AND if supersonic in normal
1428 ! face direction
1429 ! ==============================================================================
1430 
1431  aoa = vals(bcdat_farf_attack,distrib*ifl)
1432  aos = vals(bcdat_farf_slip ,distrib*ifl)
1433 
1434  dotproduct = nx*(cos(aoa)*cos(aos)) + ny*(sin(aoa)*cos(aos)) + nz*sin(aos)
1435 
1436  IF ( dotproduct < 0.0_rfreal ) THEN
1437  farfieldinflow = .true.
1438  ELSE
1439  farfieldinflow = .false.
1440  END IF ! dotProduct
1441 
1442  mf = vals(bcdat_farf_mach ,distrib*ifl)
1443  mfnormal = mf*abs(dotproduct)
1444 
1445  IF ( mfnormal > 1.0_rfreal ) THEN
1446  farfieldsupersonic = .true.
1447  ELSE
1448  farfieldsupersonic = .false.
1449  END IF ! dotProduct
1450 
1451 ! ==============================================================================
1452 ! Computation of normal and tangential derivatives
1453 ! ==============================================================================
1454 
1455  drdn = drdx*dxdn + drdy*dydn + drdz*dzdn
1456  drds = drdx*dxds + drdy*dyds + drdz*dzds
1457  drdt = drdx*dxdt + drdy*dydt + drdz*dzdt
1458 
1459  dudn = dudx*dxdn + dudy*dydn + dudz*dzdn
1460  duds = dudx*dxds + dudy*dyds + dudz*dzds
1461  dudt = dudx*dxdt + dudy*dydt + dudz*dzdt
1462 
1463  dvdn = dvdx*dxdn + dvdy*dydn + dvdz*dzdn
1464  dvds = dvdx*dxds + dvdy*dyds + dvdz*dzds
1465  dvdt = dvdx*dxdt + dvdy*dydt + dvdz*dzdt
1466 
1467  dwdn = dwdx*dxdn + dwdy*dydn + dwdz*dzdn
1468  dwds = dwdx*dxds + dwdy*dyds + dwdz*dzds
1469  dwdt = dwdx*dxdt + dwdy*dydt + dwdz*dzdt
1470 
1471  dpdn = dpdx*dxdn + dpdy*dydn + dpdz*dzdn
1472  dpds = dpdx*dxds + dpdy*dyds + dpdz*dzds
1473  dpdt = dpdx*dxdt + dpdy*dydt + dpdz*dzdt
1474 
1475 ! ==============================================================================
1476 ! Computation of normal and tangential vector components
1477 ! ==============================================================================
1478 
1479  un = u*dndx + v*dndy + w*dndz
1480  us = u*dsdx + v*dsdy + w*dsdz
1481  ut = u*dtdx + v*dtdy + w*dtdz
1482 
1483 ! ==============================================================================
1484 ! Computation of normal and tangential derivatives
1485 ! ==============================================================================
1486 
1487  dundn = dudn*dndx + dvdn*dndy + dwdn*dndz
1488  dunds = duds*dndx + dvds*dndy + dwds*dndz
1489  dundt = dudt*dndx + dvdt*dndy + dwdt*dndz
1490 
1491  dusdn = dudn*dsdx + dvdn*dsdy + dwdn*dsdz
1492  dusds = duds*dsdx + dvds*dsdy + dwds*dsdz
1493  dusdt = dudt*dsdx + dvdt*dsdy + dwdt*dsdz
1494 
1495  dutdn = dudn*dtdx + dvdn*dtdy + dwdn*dtdz
1496  dutds = duds*dtdx + dvds*dtdy + dwds*dtdz
1497  dutdt = dudt*dtdx + dvdt*dtdy + dwdt*dtdz
1498 
1499 ! ==============================================================================
1500 ! Computation of eigenvalues
1501 ! ==============================================================================
1502 
1503  lambda1 = un - a
1504  lambda2 = un
1505  lambda3 = un
1506  lambda4 = un
1507  lambda5 = un + a
1508 
1509 ! ==============================================================================
1510 ! Computations of L
1511 ! ==============================================================================
1512 
1513  IF ( farfieldinflow .EQV. .true. ) THEN
1514  IF ( farfieldsupersonic .EQV. .true. ) THEN
1515  l1 = 0.0_rfreal
1516  l2 = 0.0_rfreal
1517  l3 = 0.0_rfreal
1518  l4 = 0.0_rfreal
1519  l5 = 0.0_rfreal
1520  ELSE
1521  l5 = lambda5*(dpdn + r*a*dundn)
1522  l1 = 0.0_rfreal
1523  l2 = 0.0_rfreal
1524  l3 = 0.0_rfreal
1525  l4 = 0.0_rfreal
1526  END IF ! farFieldSupersonic
1527  ELSE
1528  IF ( farfieldsupersonic .EQV. .true. ) THEN
1529  l2 = lambda2*(a*a*drdn - dpdn)
1530  l3 = lambda3*dusdn
1531  l4 = lambda4*dutdn
1532  l5 = lambda5*(dpdn + r*a*dundn)
1533  l1 = lambda1*(dpdn - r*a*dundn)
1534  ELSE
1535  l2 = lambda2*(a*a*drdn - dpdn)
1536  l3 = lambda3*dusdn
1537  l4 = lambda4*dutdn
1538  l5 = lambda5*(dpdn + r*a*dundn)
1539  l1 = 0.0_rfreal
1540  END IF ! farFieldSupersonic
1541  END IF ! farFieldInflow
1542 
1543 ! ==============================================================================
1544 ! Computations of d
1545 ! ==============================================================================
1546 
1547  d1 = (l2 + 0.5_rfreal*(l1+l5))/(a*a)
1548  d2 = 0.5_rfreal*(l1+l5)
1549  d3 = (l5-l1)/(2.0_rfreal*r*a)
1550  d4 = l3
1551  d5 = l4
1552 
1553 ! ==============================================================================
1554 ! Computations of Rhs
1555 ! ==============================================================================
1556 
1557  rhs1 = d1 + r*dusds + us*drds + r*dutdt + ut*drdt
1558  rhs2 = un*d1 + r*d3 + r*un*dusds + r*us*dunds + un*us*drds &
1559  + r*un*dutdt + r*ut*dundt + un*ut*drdt
1560  rhs3 = us*d1 + r*d4 + dpds &
1561  + 2.0_rfreal*r*us*dusds + us*us*drds &
1562  + r*us*dutdt + r*ut*dusdt + us*ut*drdt
1563  rhs4 = ut*d1 + r*d5 + dpdt &
1564  + r*ut*dusds + r*us*dutds + ut*us*drds &
1565  + 2.0_rfreal*r*ut*dutdt + ut*ut*drdt
1566  rhs5 = 0.5_rfreal*(un*un+us*us+ut*ut)*d1 + d2/(g-1.0_rfreal) &
1567  + r*un*d3 + r*us*d4 + r*ut*d5 &
1568  + us*( 0.5_rfreal*(un*un+us*us+ut*ut)*drds &
1569  + r*(un*dunds+us*dusds+ut*dutds) &
1570  + g*dpds/(g-1.0_rfreal) ) &
1571  + (0.5_rfreal*r*(un*un+us*us+ut*ut) &
1572  + g*p/(g-1.0_rfreal))*dusds &
1573  + ut*( 0.5_rfreal*(un*un+us*us+ut*ut)*drdt &
1574  + r*(un*dundt+us*dusdt+ut*dutdt) &
1575  + g*dpdt/(g-1.0_rfreal) ) &
1576  + (0.5_rfreal*r*(un*un+us*us+ut*ut) &
1577  + g*p/(g-1.0_rfreal))*dutdt
1578 
1579  prhs(cv_mixt_dens,ifl) = rhs1
1580  prhs(cv_mixt_xmom,ifl) = rhs2*dxdn + rhs3*dxds + rhs4*dxdt
1581  prhs(cv_mixt_ymom,ifl) = rhs2*dydn + rhs3*dyds + rhs4*dydt
1582  prhs(cv_mixt_zmom,ifl) = rhs2*dzdn + rhs3*dzds + rhs4*dzdt
1583  prhs(cv_mixt_ener,ifl) = rhs5
1584  END DO ! ifl
1585 
1586 ! ******************************************************************************
1587 ! End
1588 ! ******************************************************************************
1589 
1590  CALL deregisterfunction(global)
1591 
1592 END SUBROUTINE rflu_nscbc_comprhsff
1593 
1594 
1595 
1596 
1597 
1598 
1599 
1600 ! ******************************************************************************
1601 !
1602 ! Purpose: Compute RHS for inflow with imposed total quantities.
1603 !
1604 ! Description: None.
1605 !
1606 ! Input:
1607 ! pRegion Pointer to region
1608 ! pPatch Pointer to patch
1609 !
1610 ! Output: None.
1611 !
1612 ! Notes: None.
1613 !
1614 ! ******************************************************************************
1615 
1616 SUBROUTINE rflu_nscbc_comprhsiftotang(pRegion,pPatch)
1617 
1618  IMPLICIT NONE
1619 
1620 ! ******************************************************************************
1621 ! Definitions and declarations
1622 ! ******************************************************************************
1623 
1624 ! ==============================================================================
1625 ! Arguments
1626 ! ==============================================================================
1627 
1628  TYPE(t_patch), POINTER :: ppatch
1629  TYPE(t_region), POINTER :: pregion
1630 
1631 ! ==============================================================================
1632 ! Locals
1633 ! ==============================================================================
1634 
1635  TYPE(t_global), POINTER :: global
1636 
1637 ! ******************************************************************************
1638 ! Start
1639 ! ******************************************************************************
1640 
1641  global => pregion%global
1642 
1643  CALL registerfunction(global,'RFLU_NSCBC_CompRhsIFTotAng',&
1644  'RFLU_ModNSCBC.F90')
1645 
1646 ! ******************************************************************************
1647 ! Main body
1648 ! ******************************************************************************
1649 
1650  ppatch%mixt%rhs = 0.0_rfreal
1651 
1652 ! ******************************************************************************
1653 ! End
1654 ! ******************************************************************************
1655 
1656  CALL deregisterfunction(global)
1657 
1658 END SUBROUTINE rflu_nscbc_comprhsiftotang
1659 
1660 
1661 
1662 
1663 
1664 
1665 
1666 
1667 
1668 ! ******************************************************************************
1669 !
1670 ! Purpose: Compute RHS for inflow with imposed velocity and temperature.
1671 !
1672 ! Description: None.
1673 !
1674 ! Input:
1675 ! pRegion Pointer to region
1676 ! pPatch Pointer to patch
1677 !
1678 ! Output: None.
1679 !
1680 ! Notes: None.
1681 !
1682 ! ******************************************************************************
1683 
1684 SUBROUTINE rflu_nscbc_comprhsifveltemp(pRegion,pPatch)
1685 
1686  IMPLICIT NONE
1687 
1688 ! ******************************************************************************
1689 ! Definitions and declarations
1690 ! ******************************************************************************
1691 
1692 ! ==============================================================================
1693 ! Arguments
1694 ! ==============================================================================
1695 
1696  TYPE(t_patch), POINTER :: ppatch
1697  TYPE(t_region), POINTER :: pregion
1698 
1699 ! ==============================================================================
1700 ! Locals
1701 ! ==============================================================================
1702 
1703  INTEGER :: c1,distrib,errorflag,ifl,indcp,indmol
1704  REAL(RFREAL) :: a,aoa,aos,bc_dudt,bc_dvdt,bc_dwdt,bc_dtdt,bc_dundt,bc_dusdt, &
1705  bc_dutdt,cp,d1,d2,d3,d4,d5,dotproduct,dndx,dndy,dndz,dpdn, &
1706  dpds,dpdt,dpdx,dpdy,dpdz,drdn,drds,drdt,drdx,drdy,drdz,dsdx, &
1707  dsdy,dsdz,dtdx,dtdy,dtdz,dudn,duds,dudt,dudx,dudy,dudz,dundn, &
1708  dunds,dundt,dusdn,dusds,dusdt,dutdn,dutds,dutdt,dvdn,dvds, &
1709  dvdt,dvdx,dvdy,dvdz,dwdn,dwds,dwdt,dwdx,dwdy,dwdz,dxdn,dxds, &
1710  dxdt,dydn,dyds,dydt,dzdn,dzds,dzdt,g,l1,l2,l3,l4,l5,lambda1, &
1711  lambda2,lambda3,lambda4,lambda5,mm,mf,mfnormal,nx,ny,nz,p,r, &
1712  rgas,rhs1,rhs2,rhs3,rhs4,rhs5,ru,rv,rw,sx,sy,sz,t,tx,ty,tz, &
1713  u,un,us,ut,v,w
1714  REAL(RFREAL), POINTER, DIMENSION(:,:) :: pcv,pdv,prhs,pgv
1715  REAL(RFREAL), DIMENSION(:,:,:), POINTER :: pgradface
1716  TYPE(t_global), POINTER :: global
1717 
1718 ! ******************************************************************************
1719 ! Start
1720 ! ******************************************************************************
1721 
1722  global => pregion%global
1723 
1724  CALL registerfunction(global,'RFLU_NSCBC_CompRhsIFVelTemp',&
1725  'RFLU_ModNSCBC.F90')
1726 
1727 ! ******************************************************************************
1728 ! Main body - loop over all boundary faces
1729 ! ******************************************************************************
1730 
1731  indcp = pregion%mixtInput%indCp
1732  indmol = pregion%mixtInput%indMol
1733 
1734  pcv => ppatch%mixt%cv
1735  pdv => ppatch%mixt%dv
1736  pgv => pregion%mixt%gv ! NOTE get gv from volume
1737  prhs => ppatch%mixt%rhs
1738 
1739  pgradface => ppatch%mixt%gradFace
1740 
1741  DO ifl = 1,ppatch%nBFaces
1742  c1 = ppatch%bf2c(ifl)
1743 
1744  cp = pgv(gv_mixt_cp ,indcp *c1)
1745  mm = pgv(gv_mixt_mol,indmol*c1)
1746  rgas = mixtperf_r_m(mm)
1747  g = mixtperf_g_cpr(cp,rgas)
1748 
1749  r = pcv(cv_mixt_dens,ifl)
1750  ru = pcv(cv_mixt_xmom,ifl)
1751  rv = pcv(cv_mixt_ymom,ifl)
1752  rw = pcv(cv_mixt_zmom,ifl)
1753  p = pdv(dv_mixt_pres,ifl)
1754  t = pdv(dv_mixt_temp,ifl)
1755  a = pdv(dv_mixt_soun,ifl)
1756 
1757  u = ru/r
1758  v = rv/r
1759  w = rw/r
1760 
1761  drdx = pgradface(xcoord,grbf_mixt_dens,ifl)
1762  drdy = pgradface(ycoord,grbf_mixt_dens,ifl)
1763  drdz = pgradface(zcoord,grbf_mixt_dens,ifl)
1764 
1765  dudx = pgradface(xcoord,grbf_mixt_xvel,ifl)
1766  dudy = pgradface(ycoord,grbf_mixt_xvel,ifl)
1767  dudz = pgradface(zcoord,grbf_mixt_xvel,ifl)
1768 
1769  dvdx = pgradface(xcoord,grbf_mixt_yvel,ifl)
1770  dvdy = pgradface(ycoord,grbf_mixt_yvel,ifl)
1771  dvdz = pgradface(zcoord,grbf_mixt_yvel,ifl)
1772 
1773  dwdx = pgradface(xcoord,grbf_mixt_zvel,ifl)
1774  dwdy = pgradface(ycoord,grbf_mixt_zvel,ifl)
1775  dwdz = pgradface(zcoord,grbf_mixt_zvel,ifl)
1776 
1777  dpdx = pgradface(xcoord,grbf_mixt_pres,ifl)
1778  dpdy = pgradface(ycoord,grbf_mixt_pres,ifl)
1779  dpdz = pgradface(zcoord,grbf_mixt_pres,ifl)
1780 
1781 ! ==============================================================================
1782 ! Computation of boundary condition at inflow
1783 ! ==============================================================================
1784 
1785  bc_dudt = 0.0_rfreal
1786  bc_dvdt = 0.0_rfreal
1787  bc_dwdt = 0.0_rfreal
1788  bc_dtdt = 0.0_rfreal
1789 
1790 ! ==============================================================================
1791 ! Computation of normal and tangential vectors
1792 ! ==============================================================================
1793 
1794  nx = ppatch%fn(xcoord,ifl)
1795  ny = ppatch%fn(ycoord,ifl)
1796  nz = ppatch%fn(zcoord,ifl)
1797 
1798  SELECT CASE ( pregion%mixtInput%dimens )
1799  CASE ( 2 )
1800  sx = -ny
1801  sy = nx
1802  sz = nz
1803 
1804  tx = 0.0_rfreal
1805  ty = 0.0_rfreal
1806  tz = 1.0_rfreal
1807  CASE ( 3 )
1808  sx = -ny
1809  sy = nx
1810  sz = nz
1811 
1812  tx = 0.0_rfreal
1813  ty = 0.0_rfreal
1814  tz = 1.0_rfreal
1815  CASE default
1816  CALL errorstop(global,err_reached_default,__line__)
1817  END SELECT ! pRegion%mixtInput%dimens
1818 
1819  dxdn = nx
1820  dydn = ny
1821  dzdn = nz
1822 
1823  dxds = sx
1824  dyds = sy
1825  dzds = sz
1826 
1827  dxdt = tx
1828  dydt = ty
1829  dzdt = tz
1830 
1831  dndx = dxdn
1832  dndy = dydn
1833  dndz = dzdn
1834 
1835  dsdx = dxds
1836  dsdy = dyds
1837  dsdz = dzds
1838 
1839  dtdx = dxdt
1840  dtdy = dydt
1841  dtdz = dzdt
1842 
1843 ! ==============================================================================
1844 ! Computation of normal and tangential derivatives
1845 ! ==============================================================================
1846 
1847  drdn = drdx*dxdn + drdy*dydn + drdz*dzdn
1848  drds = drdx*dxds + drdy*dyds + drdz*dzds
1849  drdt = drdx*dxdt + drdy*dydt + drdz*dzdt
1850 
1851  dudn = dudx*dxdn + dudy*dydn + dudz*dzdn
1852  duds = dudx*dxds + dudy*dyds + dudz*dzds
1853  dudt = dudx*dxdt + dudy*dydt + dudz*dzdt
1854 
1855  dvdn = dvdx*dxdn + dvdy*dydn + dvdz*dzdn
1856  dvds = dvdx*dxds + dvdy*dyds + dvdz*dzds
1857  dvdt = dvdx*dxdt + dvdy*dydt + dvdz*dzdt
1858 
1859  dwdn = dwdx*dxdn + dwdy*dydn + dwdz*dzdn
1860  dwds = dwdx*dxds + dwdy*dyds + dwdz*dzds
1861  dwdt = dwdx*dxdt + dwdy*dydt + dwdz*dzdt
1862 
1863  dpdn = dpdx*dxdn + dpdy*dydn + dpdz*dzdn
1864  dpds = dpdx*dxds + dpdy*dyds + dpdz*dzds
1865  dpdt = dpdx*dxdt + dpdy*dydt + dpdz*dzdt
1866 
1867 ! ==============================================================================
1868 ! Computation of normal and tangential vector components
1869 ! ==============================================================================
1870 
1871  un = u*dndx + v*dndy + w*dndz
1872  us = u*dsdx + v*dsdy + w*dsdz
1873  ut = u*dtdx + v*dtdy + w*dtdz
1874 
1875 ! ==============================================================================
1876 ! Computation of normal and tangential derivatives
1877 ! ==============================================================================
1878 
1879  dundn = dudn*dndx + dvdn*dndy + dwdn*dndz
1880  dunds = duds*dndx + dvds*dndy + dwds*dndz
1881  dundt = dudt*dndx + dvdt*dndy + dwdt*dndz
1882 
1883  dusdn = dudn*dsdx + dvdn*dsdy + dwdn*dsdz
1884  dusds = duds*dsdx + dvds*dsdy + dwds*dsdz
1885  dusdt = dudt*dsdx + dvdt*dsdy + dwdt*dsdz
1886 
1887  dutdn = dudn*dtdx + dvdn*dtdy + dwdn*dtdz
1888  dutds = duds*dtdx + dvds*dtdy + dwds*dtdz
1889  dutdt = dudt*dtdx + dvdt*dtdy + dwdt*dtdz
1890 
1891 ! ==============================================================================
1892 ! Computation of boundary condition at inflow in normal and tangential direc.
1893 ! ==============================================================================
1894 
1895  bc_dundt = bc_dudt*dndx + bc_dvdt*dndy + bc_dwdt*dndz
1896  bc_dusdt = bc_dudt*dsdx + bc_dvdt*dsdy + bc_dwdt*dsdz
1897  bc_dutdt = bc_dudt*dtdx + bc_dvdt*dtdy + bc_dwdt*dtdz
1898 
1899 ! ==============================================================================
1900 ! Computation of eigenvalues
1901 ! ==============================================================================
1902 
1903  lambda1 = un - a
1904  lambda2 = un
1905  lambda3 = un
1906  lambda4 = un
1907  lambda5 = un + a
1908 
1909 ! ==============================================================================
1910 ! Computations of L
1911 ! ==============================================================================
1912 
1913  IF ( ppatch%mixt%switches(bcswi_inflow_type) /= bcopt_supersonic ) THEN
1914  IF ( ppatch%reflect == bc_reflecting ) THEN
1915  l5 = lambda5*(dpdn + r*a*dundn)
1916  l1 = l5 + 2.0_rfreal*r*a*bc_dundt
1917  l2 = 0.5_rfreal*(g-1.0_rfreal)*(l1+l5) + (r*a*a/t)*bc_dtdt
1918  l3 = -bc_dusdt
1919  l4 = -bc_dutdt
1920  ELSE
1921  l5 = lambda5*(dpdn + r*a*dundn)
1922  l1 = 0.0_rfreal
1923  l2 = 0.0_rfreal
1924  l3 = 0.0_rfreal
1925  l4 = 0.0_rfreal
1926  END IF ! pPatch%reflect
1927  ELSE
1928  l1 = 0.0_rfreal
1929  l2 = 0.0_rfreal
1930  l3 = 0.0_rfreal
1931  l4 = 0.0_rfreal
1932  l5 = 0.0_rfreal
1933  END IF ! pPatch%mixt%switches
1934 
1935 ! ==============================================================================
1936 ! Computations of d
1937 ! ==============================================================================
1938 
1939  d1 = (l2 + 0.5_rfreal*(l1+l5))/(a*a)
1940  d2 = 0.5_rfreal*(l1+l5)
1941  d3 = (l5-l1)/(2.0_rfreal*r*a)
1942  d4 = l3
1943  d5 = l4
1944 
1945 ! ==============================================================================
1946 ! Computations of Rhs
1947 ! ==============================================================================
1948 
1949  rhs1 = d1 + r*dusds + us*drds + r*dutdt + ut*drdt
1950  rhs2 = un*d1 + r*d3 + r*un*dusds + r*us*dunds + un*us*drds &
1951  + r*un*dutdt + r*ut*dundt + un*ut*drdt
1952  rhs3 = us*d1 + r*d4 + dpds &
1953  + 2.0_rfreal*r*us*dusds + us*us*drds &
1954  + r*us*dutdt + r*ut*dusdt + us*ut*drdt
1955  rhs4 = ut*d1 + r*d5 + dpdt &
1956  + r*ut*dusds + r*us*dutds + ut*us*drds &
1957  + 2.0_rfreal*r*ut*dutdt + ut*ut*drdt
1958  rhs5 = 0.5_rfreal*(un*un+us*us+ut*ut)*d1 + d2/(g-1.0_rfreal) &
1959  + r*un*d3 + r*us*d4 + r*ut*d5 &
1960  + us*( 0.5_rfreal*(un*un+us*us+ut*ut)*drds &
1961  + r*(un*dunds+us*dusds+ut*dutds) &
1962  + g*dpds/(g-1.0_rfreal) ) &
1963  + (0.5_rfreal*r*(un*un+us*us+ut*ut) &
1964  + g*p/(g-1.0_rfreal))*dusds &
1965  + ut*( 0.5_rfreal*(un*un+us*us+ut*ut)*drdt &
1966  + r*(un*dundt+us*dusdt+ut*dutdt) &
1967  + g*dpdt/(g-1.0_rfreal) ) &
1968  + (0.5_rfreal*r*(un*un+us*us+ut*ut) &
1969  + g*p/(g-1.0_rfreal))*dutdt
1970 
1971  prhs(cv_mixt_dens,ifl) = rhs1
1972  prhs(cv_mixt_xmom,ifl) = rhs2*dxdn + rhs3*dxds + rhs4*dxdt
1973  prhs(cv_mixt_ymom,ifl) = rhs2*dydn + rhs3*dyds + rhs4*dydt
1974  prhs(cv_mixt_zmom,ifl) = rhs2*dzdn + rhs3*dzds + rhs4*dzdt
1975  prhs(cv_mixt_ener,ifl) = rhs5
1976 
1977  IF ( ppatch%mixt%switches(bcswi_inflow_type) /= bcopt_supersonic ) THEN
1978  IF ( ppatch%reflect == bc_reflecting ) THEN
1979  prhs(cv_mixt_xmom,ifl) = 0.0_rfreal
1980  prhs(cv_mixt_ymom,ifl) = 0.0_rfreal
1981  prhs(cv_mixt_zmom,ifl) = 0.0_rfreal
1982  prhs(cv_mixt_ener,ifl) = 0.0_rfreal
1983  END IF ! pPatch%reflect
1984  END IF ! pPatch%mixt%switches
1985  END DO ! ifl
1986 
1987 ! ******************************************************************************
1988 ! End
1989 ! ******************************************************************************
1990 
1991  CALL deregisterfunction(global)
1992 
1993 END SUBROUTINE rflu_nscbc_comprhsifveltemp
1994 
1995 
1996 
1997 
1998 
1999 
2000 
2001 
2002 ! ******************************************************************************
2003 !
2004 ! Purpose: Compute RHS for injection boundary.
2005 !
2006 ! Description: None.
2007 !
2008 ! Input:
2009 ! pRegion Pointer to region
2010 ! pPatch Pointer to patch
2011 !
2012 ! Output: None.
2013 !
2014 ! Notes: None.
2015 !
2016 ! ******************************************************************************
2017 
2018 SUBROUTINE rflu_nscbc_comprhsij(pRegion,pPatch)
2019 
2020  IMPLICIT NONE
2021 
2022 ! ******************************************************************************
2023 ! Definitions and declarations
2024 ! ******************************************************************************
2025 
2026 ! ==============================================================================
2027 ! Arguments
2028 ! ==============================================================================
2029 
2030  TYPE(t_patch), POINTER :: ppatch
2031  TYPE(t_region), POINTER :: pregion
2032 
2033 ! ==============================================================================
2034 ! Locals
2035 ! ==============================================================================
2036 
2037  TYPE(t_global), POINTER :: global
2038 
2039 ! ******************************************************************************
2040 ! Start
2041 ! ******************************************************************************
2042 
2043  global => pregion%global
2044 
2045  CALL registerfunction(global,'RFLU_NSCBC_CompRhsIJ',&
2046  'RFLU_ModNSCBC.F90')
2047 
2048 ! ******************************************************************************
2049 ! Main body
2050 ! ******************************************************************************
2051 
2052  ppatch%mixt%rhs = 0.0_rfreal
2053 
2054 ! ******************************************************************************
2055 ! End
2056 ! ******************************************************************************
2057 
2058  CALL deregisterfunction(global)
2059 
2060 END SUBROUTINE rflu_nscbc_comprhsij
2061 
2062 
2063 
2064 
2065 
2066 
2067 
2068 ! ******************************************************************************
2069 !
2070 ! Purpose: Compute RHS for no-slip wall with imposed heat flux.
2071 !
2072 ! Description: None.
2073 !
2074 ! Input:
2075 ! pRegion Pointer to region
2076 ! pPatch Pointer to patch
2077 !
2078 ! Output: None.
2079 !
2080 ! Notes: None.
2081 !
2082 ! ******************************************************************************
2083 
2084 SUBROUTINE rflu_nscbc_comprhsnswheat(pRegion,pPatch)
2085 
2086  IMPLICIT NONE
2087 
2088 ! ******************************************************************************
2089 ! Definitions and declarations
2090 ! ******************************************************************************
2091 
2092 ! ==============================================================================
2093 ! Arguments
2094 ! ==============================================================================
2095 
2096  TYPE(t_patch), POINTER :: ppatch
2097  TYPE(t_region), POINTER :: pregion
2098 
2099 ! ==============================================================================
2100 ! Locals
2101 ! ==============================================================================
2102 
2103  TYPE(t_global), POINTER :: global
2104 
2105 ! ******************************************************************************
2106 ! Start
2107 ! ******************************************************************************
2108 
2109  global => pregion%global
2110 
2111  CALL registerfunction(global,'RFLU_NSCBC_CompRhsNSWHeat',&
2112  'RFLU_ModNSCBC.F90')
2113 
2114 ! ******************************************************************************
2115 ! Main body
2116 ! ******************************************************************************
2117 
2118  ppatch%mixt%rhs = 0.0_rfreal
2119 
2120 ! ******************************************************************************
2121 ! End
2122 ! ******************************************************************************
2123 
2124  CALL deregisterfunction(global)
2125 
2126 END SUBROUTINE rflu_nscbc_comprhsnswheat
2127 
2128 
2129 
2130 
2131 
2132 
2133 
2134 ! ******************************************************************************
2135 !
2136 ! Purpose: Compute RHS for no-slip wall with imposed temperature.
2137 !
2138 ! Description: None.
2139 !
2140 ! Input:
2141 ! pRegion Pointer to region
2142 ! pPatch Pointer to patch
2143 !
2144 ! Output: None.
2145 !
2146 ! Notes: None.
2147 !
2148 ! ******************************************************************************
2149 
2150 SUBROUTINE rflu_nscbc_comprhsnswtemp(pRegion,pPatch)
2151 
2152  IMPLICIT NONE
2153 
2154 ! ******************************************************************************
2155 ! Definitions and declarations
2156 ! ******************************************************************************
2157 
2158 ! ==============================================================================
2159 ! Arguments
2160 ! ==============================================================================
2161 
2162  TYPE(t_patch), POINTER :: ppatch
2163  TYPE(t_region), POINTER :: pregion
2164 
2165 ! ==============================================================================
2166 ! Locals
2167 ! ==============================================================================
2168 
2169  TYPE(t_global), POINTER :: global
2170 
2171 ! ******************************************************************************
2172 ! Start
2173 ! ******************************************************************************
2174 
2175  global => pregion%global
2176 
2177  CALL registerfunction(global,'RFLU_NSCBC_CompRhsNSWTemp',&
2178  'RFLU_ModNSCBC.F90')
2179 
2180 ! ******************************************************************************
2181 ! Main body
2182 ! ******************************************************************************
2183 
2184  ppatch%mixt%rhs = 0.0_rfreal
2185 
2186 ! ******************************************************************************
2187 ! End
2188 ! ******************************************************************************
2189 
2190  CALL deregisterfunction(global)
2191 
2192 END SUBROUTINE rflu_nscbc_comprhsnswtemp
2193 
2194 
2195 
2196 
2197 
2198 
2199 
2200 ! ******************************************************************************
2201 !
2202 ! Purpose: Compute RHS for outflow.
2203 !
2204 ! Description: None.
2205 !
2206 ! Input:
2207 ! pRegion Pointer to region
2208 ! pPatch Pointer to patch
2209 !
2210 ! Output: None.
2211 !
2212 ! Notes: None.
2213 !
2214 ! ******************************************************************************
2215 
2216 SUBROUTINE rflu_nscbc_comprhsof(pRegion,pPatch)
2217 
2218  IMPLICIT NONE
2219 
2220 ! ******************************************************************************
2221 ! Definitions and declarations
2222 ! ******************************************************************************
2223 
2224 ! ==============================================================================
2225 ! Arguments
2226 ! ==============================================================================
2227 
2228  TYPE(t_patch), POINTER :: ppatch
2229  TYPE(t_region), POINTER :: pregion
2230 
2231 ! ==============================================================================
2232 ! Locals
2233 ! ==============================================================================
2234 
2235  INTEGER :: bcopttype,c1,distrib,errorflag,ifl,indcp,indmol
2236  REAL(RFREAL) :: a,aoa,aos,cp,d1,d2,d3,d4,d5,dotproduct,dndx,dndy,dndz,dpdn, &
2237  dpds,dpdt,dpdx,dpdy,dpdz,drdn,drds,drdt,drdx,drdy,drdz,dsdx, &
2238  dsdy,dsdz,dtdx,dtdy,dtdz,dudn,duds,dudt,dudx,dudy,dudz,dundn, &
2239  dunds,dundt,dusdn,dusds,dusdt,dutdn,dutds,dutdt,dvdn,dvds, &
2240  dvdt,dvdx,dvdy,dvdz,dwdn,dwds,dwdt,dwdx,dwdy,dwdz,dxdn,dxds, &
2241  dxdt,dydn,dyds,dydt,dzdn,dzds,dzdt,g,l1,l2,l3,l4,l5,lambda1, &
2242  lambda2,lambda3,lambda4,lambda5,mm,mf,mfnormal,nscbck,nx,ny, &
2243  nz,p,pinf,r,rgas,rhs1,rhs2,rhs3,rhs4,rhs5,ru,rv,rw,sx,sy,sz, &
2244  t,tx,ty,tz,u,un,us,ut,v,w
2245  REAL(RFREAL), POINTER, DIMENSION(:,:) :: pcv,pdv,prhs,pgv,vals
2246  REAL(RFREAL), DIMENSION(:,:,:), POINTER :: pgradface
2247  TYPE(t_global), POINTER :: global
2248 
2249 ! ******************************************************************************
2250 ! Start
2251 ! ******************************************************************************
2252 
2253  global => pregion%global
2254 
2255  CALL registerfunction(global,'RFLU_NSCBC_CompRhsOF',&
2256  'RFLU_ModNSCBC.F90')
2257 
2258 ! ******************************************************************************
2259 ! Main Body - loop over all boundary faces
2260 ! ******************************************************************************
2261 
2262  distrib = ppatch%mixt%distrib
2263  bcopttype = ppatch%mixt%switches(bcswi_outflow_type)
2264 
2265  IF ( bcopttype /= bcopt_supersonic ) THEN
2266  vals => ppatch%mixt%vals
2267  END IF ! bcOptType
2268 
2269  indcp = pregion%mixtInput%indCp
2270  indmol = pregion%mixtInput%indMol
2271 
2272  pcv => ppatch%mixt%cv
2273  pdv => ppatch%mixt%dv
2274  pgv => pregion%mixt%gv ! NOTE get gv from volume
2275  prhs => ppatch%mixt%rhs
2276 
2277  pgradface => ppatch%mixt%gradFace
2278 
2279  DO ifl = 1,ppatch%nBFaces
2280  c1 = ppatch%bf2c(ifl)
2281 
2282  cp = pgv(gv_mixt_cp ,indcp *c1)
2283  mm = pgv(gv_mixt_mol,indmol*c1)
2284  rgas = mixtperf_r_m(mm)
2285  g = mixtperf_g_cpr(cp,rgas)
2286 
2287  r = pcv(cv_mixt_dens,ifl)
2288  ru = pcv(cv_mixt_xmom,ifl)
2289  rv = pcv(cv_mixt_ymom,ifl)
2290  rw = pcv(cv_mixt_zmom,ifl)
2291  p = pdv(dv_mixt_pres,ifl)
2292  a = pdv(dv_mixt_soun,ifl)
2293 
2294  u = ru/r
2295  v = rv/r
2296  w = rw/r
2297 
2298  drdx = pgradface(xcoord,grbf_mixt_dens,ifl)
2299  drdy = pgradface(ycoord,grbf_mixt_dens,ifl)
2300  drdz = pgradface(zcoord,grbf_mixt_dens,ifl)
2301 
2302  dudx = pgradface(xcoord,grbf_mixt_xvel,ifl)
2303  dudy = pgradface(ycoord,grbf_mixt_xvel,ifl)
2304  dudz = pgradface(zcoord,grbf_mixt_xvel,ifl)
2305 
2306  dvdx = pgradface(xcoord,grbf_mixt_yvel,ifl)
2307  dvdy = pgradface(ycoord,grbf_mixt_yvel,ifl)
2308  dvdz = pgradface(zcoord,grbf_mixt_yvel,ifl)
2309 
2310  dwdx = pgradface(xcoord,grbf_mixt_zvel,ifl)
2311  dwdy = pgradface(ycoord,grbf_mixt_zvel,ifl)
2312  dwdz = pgradface(zcoord,grbf_mixt_zvel,ifl)
2313 
2314  dpdx = pgradface(xcoord,grbf_mixt_pres,ifl)
2315  dpdy = pgradface(ycoord,grbf_mixt_pres,ifl)
2316  dpdz = pgradface(zcoord,grbf_mixt_pres,ifl)
2317 
2318 ! ==============================================================================
2319 ! Computation of normal and tangential vectors
2320 ! ==============================================================================
2321 
2322  nx = ppatch%fn(xcoord,ifl)
2323  ny = ppatch%fn(ycoord,ifl)
2324  nz = ppatch%fn(zcoord,ifl)
2325 
2326  SELECT CASE ( pregion%mixtInput%dimens )
2327  CASE ( 2 )
2328  sx = -ny
2329  sy = nx
2330  sz = nz
2331 
2332  tx = 0.0_rfreal
2333  ty = 0.0_rfreal
2334  tz = 1.0_rfreal
2335  CASE ( 3 )
2336  sx = -ny
2337  sy = nx
2338  sz = nz
2339 
2340  tx = 0.0_rfreal
2341  ty = 0.0_rfreal
2342  tz = 1.0_rfreal
2343  CASE default
2344  CALL errorstop(global,err_reached_default,__line__)
2345  END SELECT ! pRegion%mixtInput%dimens
2346 
2347  dxdn = nx
2348  dydn = ny
2349  dzdn = nz
2350 
2351  dxds = sx
2352  dyds = sy
2353  dzds = sz
2354 
2355  dxdt = tx
2356  dydt = ty
2357  dzdt = tz
2358 
2359  dndx = dxdn
2360  dndy = dydn
2361  dndz = dzdn
2362 
2363  dsdx = dxds
2364  dsdy = dyds
2365  dsdz = dzds
2366 
2367  dtdx = dxdt
2368  dtdy = dydt
2369  dtdz = dzdt
2370 
2371 ! ==============================================================================
2372 ! Computation of normal and tangential derivatives
2373 ! ==============================================================================
2374 
2375  drdn = drdx*dxdn + drdy*dydn + drdz*dzdn
2376  drds = drdx*dxds + drdy*dyds + drdz*dzds
2377  drdt = drdx*dxdt + drdy*dydt + drdz*dzdt
2378 
2379  dudn = dudx*dxdn + dudy*dydn + dudz*dzdn
2380  duds = dudx*dxds + dudy*dyds + dudz*dzds
2381  dudt = dudx*dxdt + dudy*dydt + dudz*dzdt
2382 
2383  dvdn = dvdx*dxdn + dvdy*dydn + dvdz*dzdn
2384  dvds = dvdx*dxds + dvdy*dyds + dvdz*dzds
2385  dvdt = dvdx*dxdt + dvdy*dydt + dvdz*dzdt
2386 
2387  dwdn = dwdx*dxdn + dwdy*dydn + dwdz*dzdn
2388  dwds = dwdx*dxds + dwdy*dyds + dwdz*dzds
2389  dwdt = dwdx*dxdt + dwdy*dydt + dwdz*dzdt
2390 
2391  dpdn = dpdx*dxdn + dpdy*dydn + dpdz*dzdn
2392  dpds = dpdx*dxds + dpdy*dyds + dpdz*dzds
2393  dpdt = dpdx*dxdt + dpdy*dydt + dpdz*dzdt
2394 
2395 ! ==============================================================================
2396 ! Computation of normal and tangential vector components
2397 ! ==============================================================================
2398 
2399  un = u*dndx + v*dndy + w*dndz
2400  us = u*dsdx + v*dsdy + w*dsdz
2401  ut = u*dtdx + v*dtdy + w*dtdz
2402 
2403 ! ==============================================================================
2404 ! Computation of normal and tangential derivatives
2405 ! ==============================================================================
2406 
2407  dundn = dudn*dndx + dvdn*dndy + dwdn*dndz
2408  dunds = duds*dndx + dvds*dndy + dwds*dndz
2409  dundt = dudt*dndx + dvdt*dndy + dwdt*dndz
2410 
2411  dusdn = dudn*dsdx + dvdn*dsdy + dwdn*dsdz
2412  dusds = duds*dsdx + dvds*dsdy + dwds*dsdz
2413  dusdt = dudt*dsdx + dvdt*dsdy + dwdt*dsdz
2414 
2415  dutdn = dudn*dtdx + dvdn*dtdy + dwdn*dtdz
2416  dutds = duds*dtdx + dvds*dtdy + dwds*dtdz
2417  dutdt = dudt*dtdx + dvdt*dtdy + dwdt*dtdz
2418 
2419 ! ==============================================================================
2420 ! Computation of eigenvalues
2421 ! ==============================================================================
2422 
2423  nscbck = ppatch%nscbcK
2424 
2425  IF ( bcopttype /= bcopt_supersonic ) THEN
2426  pinf = vals(bcdat_outflow_press,distrib*ifl)
2427  ELSE
2428  pinf = p
2429  END IF ! bcOptType
2430 
2431  lambda1 = un - a
2432  lambda2 = un
2433  lambda3 = un
2434  lambda4 = un
2435  lambda5 = un + a
2436 
2437 ! ==============================================================================
2438 ! Computations of L
2439 ! ==============================================================================
2440 
2441  IF ( ppatch%mixt%switches(bcswi_outflow_type) == bcopt_supersonic ) THEN
2442  l2 = lambda2*(a*a*drdn - dpdn)
2443  l3 = lambda3*dusdn
2444  l4 = lambda4*dutdn
2445  l5 = lambda5*(dpdn + r*a*dundn)
2446  l1 = lambda1*(dpdn - r*a*dundn)
2447  ELSE
2448  IF ( ppatch%reflect == bc_reflecting ) THEN
2449  l2 = lambda2*(a*a*drdn - dpdn)
2450  l3 = lambda3*dusdn
2451  l4 = lambda4*dutdn
2452  l5 = lambda5*(dpdn + r*a*dundn)
2453  l1 = -l5
2454  ELSE ! non reflecting BC
2455  l2 = lambda2*(a*a*drdn - dpdn)
2456  l3 = lambda3*dusdn
2457  l4 = lambda4*dutdn
2458  l5 = lambda5*(dpdn + r*a*dundn)
2459  l1 = nscbck*(p-pinf)
2460  END IF ! pPatch%reflect
2461  END IF ! pPatch%mixt%switches
2462 
2463 ! ==============================================================================
2464 ! Computations of d
2465 ! ==============================================================================
2466 
2467  d1 = (l2 + 0.5_rfreal*(l1+l5))/(a*a)
2468  d2 = 0.5_rfreal*(l1+l5)
2469  d3 = (l5-l1)/(2.0_rfreal*r*a)
2470  d4 = l3
2471  d5 = l4
2472 
2473 ! ==============================================================================
2474 ! Computations of Rhs
2475 ! ==============================================================================
2476 
2477  rhs1 = d1 + r*dusds + us*drds + r*dutdt + ut*drdt
2478  rhs2 = un*d1 + r*d3 + r*un*dusds + r*us*dunds + un*us*drds &
2479  + r*un*dutdt + r*ut*dundt + un*ut*drdt
2480  rhs3 = us*d1 + r*d4 + dpds &
2481  + 2.0_rfreal*r*us*dusds + us*us*drds &
2482  + r*us*dutdt + r*ut*dusdt + us*ut*drdt
2483  rhs4 = ut*d1 + r*d5 + dpdt &
2484  + r*ut*dusds + r*us*dutds + ut*us*drds &
2485  + 2.0_rfreal*r*ut*dutdt + ut*ut*drdt
2486  rhs5 = 0.5_rfreal*(un*un+us*us+ut*ut)*d1 + d2/(g-1.0_rfreal) &
2487  + r*un*d3 + r*us*d4 + r*ut*d5 &
2488  + us*( 0.5_rfreal*(un*un+us*us+ut*ut)*drds &
2489  + r*(un*dunds+us*dusds+ut*dutds) &
2490  + g*dpds/(g-1.0_rfreal) ) &
2491  + (0.5_rfreal*r*(un*un+us*us+ut*ut) &
2492  + g*p/(g-1.0_rfreal))*dusds &
2493  + ut*( 0.5_rfreal*(un*un+us*us+ut*ut)*drdt &
2494  + r*(un*dundt+us*dusdt+ut*dutdt) &
2495  + g*dpdt/(g-1.0_rfreal) ) &
2496  + (0.5_rfreal*r*(un*un+us*us+ut*ut) &
2497  + g*p/(g-1.0_rfreal))*dutdt
2498 
2499  prhs(cv_mixt_dens,ifl) = rhs1
2500  prhs(cv_mixt_xmom,ifl) = rhs2*dxdn + rhs3*dxds + rhs4*dxdt
2501  prhs(cv_mixt_ymom,ifl) = rhs2*dydn + rhs3*dyds + rhs4*dydt
2502  prhs(cv_mixt_zmom,ifl) = rhs2*dzdn + rhs3*dzds + rhs4*dzdt
2503 
2504  IF ( ppatch%mixt%switches(bcswi_outflow_type) == bcopt_supersonic ) THEN
2505  prhs(cv_mixt_ener,ifl) = rhs5
2506  ELSE IF ( ppatch%mixt%switches(bcswi_outflow_type) == bcopt_subsonic ) THEN
2507  IF ( ppatch%reflect == bc_reflecting ) THEN
2508  prhs(cv_mixt_ener,ifl) = 0.0_rfreal
2509  ELSE ! non reflecting BC
2510  prhs(cv_mixt_ener,ifl) = rhs5
2511  END IF ! pPatch%reflect
2512  END IF ! pPatch%mixt%switches
2513  END DO ! ifl
2514 
2515 ! ******************************************************************************
2516 ! End
2517 ! ******************************************************************************
2518 
2519  CALL deregisterfunction(global)
2520 
2521 END SUBROUTINE rflu_nscbc_comprhsof
2522 
2523 
2524 
2525 
2526 
2527 
2528 
2529 
2530 
2531 
2532 
2533 ! ******************************************************************************
2534 !
2535 ! Purpose: Compute RHS for slip wall.
2536 !
2537 ! Description: None.
2538 !
2539 ! Input:
2540 ! pRegion Pointer to region
2541 ! pPatch Pointer to patch
2542 !
2543 ! Output: None.
2544 !
2545 ! Notes: None.
2546 !
2547 ! ******************************************************************************
2548 
2549 SUBROUTINE rflu_nscbc_comprhssw(pRegion,pPatch)
2550 
2551  IMPLICIT NONE
2552 
2553 ! ******************************************************************************
2554 ! Definitions and declarations
2555 ! ******************************************************************************
2556 
2557 ! ==============================================================================
2558 ! Arguments
2559 ! ==============================================================================
2560 
2561  TYPE(t_patch), POINTER :: ppatch
2562  TYPE(t_region), POINTER :: pregion
2563 
2564 ! ==============================================================================
2565 ! Locals
2566 ! ==============================================================================
2567 
2568  INTEGER :: bcopttype,c1,distrib,errorflag,ifl,indcp,indmol
2569  REAL(RFREAL) :: a,aoa,aos,cp,d1,d2,d3,d4,d5,dotproduct,dndx,dndy,dndz,dpdn, &
2570  dpds,dpdt,dpdx,dpdy,dpdz,drdn,drds,drdt,drdx,drdy,drdz,dsdx, &
2571  dsdy,dsdz,dtdx,dtdy,dtdz,dudn,duds,dudt,dudx,dudy,dudz,dundn, &
2572  dunds,dundt,dusdn,dusds,dusdt,dutdn,dutds,dutdt,dvdn,dvds, &
2573  dvdt,dvdx,dvdy,dvdz,dwdn,dwds,dwdt,dwdx,dwdy,dwdz,dxdn,dxds, &
2574  dxdt,dydn,dyds,dydt,dzdn,dzds,dzdt,g,l1,l2,l3,l4,l5,lambda1, &
2575  lambda2,lambda3,lambda4,lambda5,mm,mf,mfnormal,nscbck,nx,ny, &
2576  nz,p,pinf,r,rgas,rhs1,rhs2,rhs3,rhs4,rhs5,ru,rv,rw,sx,sy,sz, &
2577  t,tx,ty,tz,u,un,us,ut,v,w
2578  REAL(RFREAL), POINTER, DIMENSION(:,:) :: pcv,pdv,prhs,pgv,vals
2579  REAL(RFREAL), DIMENSION(:,:,:), POINTER :: pgradface
2580  TYPE(t_global), POINTER :: global
2581 
2582 ! ******************************************************************************
2583 ! Start
2584 ! ******************************************************************************
2585 
2586  global => pregion%global
2587 
2588  CALL registerfunction(global,'RFLU_NSCBC_CompRhsSW',&
2589  'RFLU_ModNSCBC.F90')
2590 
2591 ! ******************************************************************************
2592 ! Main Body - loop over all boundary faces
2593 ! ******************************************************************************
2594 
2595  indcp = pregion%mixtInput%indCp
2596  indmol = pregion%mixtInput%indMol
2597 
2598  pcv => ppatch%mixt%cv
2599  pdv => ppatch%mixt%dv
2600  pgv => pregion%mixt%gv ! NOTE get gv from volume
2601  prhs => ppatch%mixt%rhs
2602 
2603  pgradface => ppatch%mixt%gradFace
2604 
2605  DO ifl = 1,ppatch%nBFaces
2606  c1 = ppatch%bf2c(ifl)
2607 
2608  cp = pgv(gv_mixt_cp ,indcp *c1)
2609  mm = pgv(gv_mixt_mol,indmol*c1)
2610  rgas = mixtperf_r_m(mm)
2611  g = mixtperf_g_cpr(cp,rgas)
2612 
2613  nx = ppatch%fn(xcoord,ifl)
2614  ny = ppatch%fn(ycoord,ifl)
2615  nz = ppatch%fn(zcoord,ifl)
2616 
2617  r = pcv(cv_mixt_dens,ifl)
2618  ru = pcv(cv_mixt_xmom,ifl)
2619  rv = pcv(cv_mixt_ymom,ifl)
2620  rw = pcv(cv_mixt_zmom,ifl)
2621  p = pdv(dv_mixt_pres,ifl)
2622  a = pdv(dv_mixt_soun,ifl)
2623 
2624  u = ru/r
2625  v = rv/r
2626  w = rw/r
2627 
2628  drdx = pgradface(xcoord,grbf_mixt_dens,ifl)
2629  drdy = pgradface(ycoord,grbf_mixt_dens,ifl)
2630  drdz = pgradface(zcoord,grbf_mixt_dens,ifl)
2631 
2632  dudx = pgradface(xcoord,grbf_mixt_xvel,ifl)
2633  dudy = pgradface(ycoord,grbf_mixt_xvel,ifl)
2634  dudz = pgradface(zcoord,grbf_mixt_xvel,ifl)
2635 
2636  dvdx = pgradface(xcoord,grbf_mixt_yvel,ifl)
2637  dvdy = pgradface(ycoord,grbf_mixt_yvel,ifl)
2638  dvdz = pgradface(zcoord,grbf_mixt_yvel,ifl)
2639 
2640  dwdx = pgradface(xcoord,grbf_mixt_zvel,ifl)
2641  dwdy = pgradface(ycoord,grbf_mixt_zvel,ifl)
2642  dwdz = pgradface(zcoord,grbf_mixt_zvel,ifl)
2643 
2644  dpdx = pgradface(xcoord,grbf_mixt_pres,ifl)
2645  dpdy = pgradface(ycoord,grbf_mixt_pres,ifl)
2646  dpdz = pgradface(zcoord,grbf_mixt_pres,ifl)
2647 
2648 ! ASSUMPTION : only horizontal slip walls are there
2649 ! slip wall : normal component of velocity is zero
2650 ! TEMPORARY : make sure this is the case
2651  v = 0.0_rfreal
2652 
2653  lambda1 = v - a
2654  lambda2 = v
2655  lambda3 = v
2656  lambda4 = v
2657  lambda5 = v + a
2658 
2659 ! ==============================================================================
2660 ! Computations of L
2661 ! ==============================================================================
2662 
2663  l2 = lambda2*(a*a*drdy - dpdy)
2664  l3 = lambda3*dudy
2665  l4 = lambda4*dwdy
2666 
2667 ! reflecting slip wall
2668 ! IF ( ny > 0.0_RFREAL ) THEN ! upper wall
2669  l5 = lambda5*(dpdy + r*a*dvdy)
2670  l1 = l5
2671 ! ELSE ! lower wall
2672  l1 = lambda1*(dpdy - r*a*dvdy)
2673  l5 = l1
2674 ! ENF IF
2675 
2676 ! ==============================================================================
2677 ! Computations of d
2678 ! ==============================================================================
2679 
2680  d1 = (l2 + 0.5_rfreal*(l1+l5))/(a*a)
2681  d2 = 0.5_rfreal*(l1+l5)
2682  d3 = l3
2683  d4 = (l5-l1)/(2.0_rfreal*r*a)
2684  d5 = l4
2685 
2686 ! ==============================================================================
2687 ! Computations of Rhs
2688 ! ==============================================================================
2689 
2690  prhs(cv_mixt_dens,ifl) = r*dudx + u*drdx + d1 + r*dwdz + w*drdz
2691  prhs(cv_mixt_xmom,ifl) = u*d1 + r*d3 + dpdx &
2692  + 2.0_rfreal*r*u*dudx + u*u*drdx &
2693  + r*u*dwdz + r*w*dudz + u*w*drdz
2694 
2695 ! No need to solve y-momentum equation
2696 ! y momentum = 0, always
2697  prhs(cv_mixt_ymom,ifl) = 0.0_rfreal
2698 
2699  prhs(cv_mixt_zmom,ifl) = w*d1 + r*d5 + dpdz &
2700  + r*w*dudx + r*u*dwdx + w*u*drdx &
2701  + 2.0_rfreal*r*w*dwdz + w*w*drdz
2702 
2703  prhs(cv_mixt_ener,ifl) = 0.5_rfreal*(u*u+v*v+w*w)*d1 + d2/(g-1.0_rfreal) &
2704  + r*u*d3 + r*v*d4 + r*w*d5 &
2705  + u*( 0.5_rfreal*(u*u+v*v+w*w)*drdx &
2706  + r*(u*dudx+v*dvdx+w*dwdx) &
2707  + g*dpdx/(g-1.0_rfreal) ) &
2708  + (0.5_rfreal*r*(u*u+v*v+w*w)+g*p/(g-1.0_rfreal))*dudx &
2709  + w*( 0.5_rfreal*(u*u+v*v+w*w)*drdz &
2710  + r*(u*dudz+v*dvdz+w*dwdz) &
2711  + g*dpdz/(g-1.0_rfreal) ) &
2712  + (0.5_rfreal*r*(u*u+v*v+w*w)+g*p/(g-1.0_rfreal))*dwdz
2713 
2714  END DO ! ifl
2715 
2716 ! ******************************************************************************
2717 ! End
2718 ! ******************************************************************************
2719 
2720  CALL deregisterfunction(global)
2721 
2722 END SUBROUTINE rflu_nscbc_comprhssw
2723 
2724 
2725 
2726 
2727 
2728 
2729 
2730 
2731 
2732 ! ******************************************************************************
2733 !
2734 ! Purpose: Determine whether need boundary face gradients and related functions.
2735 !
2736 ! Description: None.
2737 !
2738 ! Input:
2739 ! pRegion Pointer to region data
2740 !
2741 ! Output: None.
2742 !
2743 ! Notes: None.
2744 !
2745 ! ******************************************************************************
2746 
2747 LOGICAL FUNCTION rflu_nscbc_decidehavenscbc(pRegion)
2748 
2749  IMPLICIT NONE
2750 
2751 ! *****************************************************************************
2752 ! Declarations and definitions
2753 ! *****************************************************************************
2754 
2755 ! =============================================================================
2756 ! Arguments
2757 ! =============================================================================
2758 
2759  TYPE(t_region), POINTER :: pregion
2760 
2761 ! =============================================================================
2762 ! Locals
2763 ! =============================================================================
2764 
2765  INTEGER :: ipatch
2766  TYPE(t_patch), POINTER :: ppatch
2767  TYPE(t_global), POINTER :: global
2768 
2769 ! *****************************************************************************
2770 ! Start
2771 ! *****************************************************************************
2772 
2773  global => pregion%global
2774 
2775  CALL registerfunction(global,'RFLU_NSCBC_DecideHaveNSCBC',&
2776  'RFLU_ModNSCBC.F90')
2777 
2778 ! *****************************************************************************
2779 ! Initialize
2780 ! *****************************************************************************
2781 
2782  rflu_nscbc_decidehavenscbc = .false.
2783 
2784 ! *****************************************************************************
2785 ! Determine whether need boundary face gradients
2786 ! *****************************************************************************
2787 
2788  patchloop: DO ipatch = 1,pregion%grid%nPatches
2789  ppatch => pregion%patches(ipatch)
2790 
2791  IF ( ppatch%bcKind == bc_kind_nscbc ) THEN
2793 
2794  EXIT patchloop
2795  END IF ! pPatch%bcKind
2796  END DO patchloop
2797 
2798 ! *****************************************************************************
2799 ! End
2800 ! *****************************************************************************
2801 
2802  CALL deregisterfunction(global)
2803 
2804 END FUNCTION rflu_nscbc_decidehavenscbc
2805 
2806 
2807 
2808 
2809 
2810 
2811 
2812 ! ******************************************************************************
2813 !
2814 ! Purpose: Initialize farfield boundary.
2815 !
2816 ! Description: None.
2817 !
2818 ! Input:
2819 ! pRegion Pointer to region
2820 ! pPatch Pointer to patch
2821 !
2822 ! Output: None.
2823 !
2824 ! Notes: None.
2825 !
2826 ! ******************************************************************************
2827 
2828 SUBROUTINE rflu_nscbc_initff(pRegion,pPatch)
2829 
2830  IMPLICIT NONE
2831 
2832 ! ******************************************************************************
2833 ! Definitions and declarations
2834 ! ******************************************************************************
2835 
2836 ! ==============================================================================
2837 ! Arguments
2838 ! ==============================================================================
2839 
2840  TYPE(t_patch), POINTER :: ppatch
2841  TYPE(t_region), POINTER :: pregion
2842 
2843 ! ==============================================================================
2844 ! Locals
2845 ! ==============================================================================
2846 
2847  LOGICAL :: corrflag
2848  INTEGER :: errorflag,ifl,c1,bcopttype,distrib,gasmodel,indcp,indgs,indmol
2849  REAL(RFREAL) :: aoa,aos,corr,cp,irl,eo,g,gc,liftcoef,mf,mw,nm,nx,ny,nz,pf, &
2850  pl,pr,rel,rer,rl,rr,rul,rur,rvl,rvr,rwl,rwr,tf,ul,vl,wl,xc, &
2851  yc,zc
2852  REAL(RFREAL), DIMENSION(:,:), POINTER :: cv,dv,gv,vals
2853  TYPE(t_global), POINTER :: global
2854 
2855 ! ******************************************************************************
2856 ! Start
2857 ! ******************************************************************************
2858 
2859  global => pregion%global
2860 
2861  CALL registerfunction(global,'RFLU_NSCBC_InitFF',&
2862  'RFLU_ModNSCBC.F90')
2863 
2864 ! ******************************************************************************
2865 ! Main Body
2866 ! ******************************************************************************
2867 
2868  corr = ppatch%mixt%switches(bcswi_farf_corr)
2869 
2870  vals => ppatch%mixt%vals
2871 
2872  IF ( corr == bcopt_corr_yes ) THEN
2873  corrflag = .true.
2874  ELSE
2875  corrflag = .false.
2876  liftcoef = 0.0_rfreal
2877  END IF ! corr
2878 
2879  indcp = pregion%mixtInput%indCp
2880  indmol = pregion%mixtInput%indMol
2881  gasmodel = pregion%mixtInput%gasModel
2882 
2883  distrib = ppatch%mixt%distrib
2884 
2885  ppatch%mixt%cvState = cv_mixt_state_cons
2886 
2887  IF (pregion%mixt%cvState /= cv_mixt_state_cons ) THEN
2888  CALL errorstop(global,err_cv_state_invalid,__line__, &
2889  'region mixt cvState is incompatible...')
2890  END IF ! pRegion%mixt%cvState
2891 
2892  DO ifl = 1,ppatch%nBFaces
2893  c1 = ppatch%bf2c(ifl)
2894 
2895  nx = ppatch%fn(xcoord,ifl)
2896  ny = ppatch%fn(ycoord,ifl)
2897  nz = ppatch%fn(zcoord,ifl)
2898  nm = ppatch%fn(xyzmag,ifl)
2899 
2900  xc = ppatch%fc(xcoord,ifl)
2901  yc = ppatch%fc(ycoord,ifl)
2902  zc = ppatch%fc(zcoord,ifl)
2903 
2904  rl = pregion%mixt%cv(cv_mixt_dens,c1)
2905  irl = 1.0_rfreal/rl
2906  rul = pregion%mixt%cv(cv_mixt_xmom,c1)*irl
2907  rvl = pregion%mixt%cv(cv_mixt_ymom,c1)*irl
2908  rwl = pregion%mixt%cv(cv_mixt_zmom,c1)*irl
2909  rel = pregion%mixt%cv(cv_mixt_ener,c1)*irl
2910 
2911  pl = pregion%mixt%dv(dv_mixt_pres,c1)
2912 
2913  mf = vals(bcdat_farf_mach ,distrib*ifl)
2914  aoa = vals(bcdat_farf_attack,distrib*ifl)
2915  aos = vals(bcdat_farf_slip ,distrib*ifl)
2916  pf = vals(bcdat_farf_press ,distrib*ifl)
2917  tf = vals(bcdat_farf_temp ,distrib*ifl)
2918 
2919  IF ( gasmodel == gas_model_tcperf ) THEN
2920 
2921  mw = pregion%mixt%gv(gv_mixt_mol,indmol*c1)
2922  cp = pregion%mixt%gv(gv_mixt_cp ,indcp *c1)
2923  gc = mixtperf_r_m(mw)
2924  g = mixtperf_g_cpr(cp,gc)
2925 
2926  rel = rl*mixtperf_eo_dgpuvw(rl,g,pl,ul,vl,wl)
2927 
2928  CALL rflu_setrindstatefarfieldperf(global,cp,mw,nx,ny,nz,mf,pf,tf, &
2929  aoa,aos,corrflag,liftcoef,xc,yc, &
2930  zc,rl,rul,rvl,rwl,rel,rr,rur, &
2931  rvr,rwr,rer,pr)
2932  ELSE
2933  CALL errorstop(global,err_reached_default,__line__)
2934  END IF ! gasModel
2935 
2936  ppatch%mixt%cv(cv_mixt_dens,ifl) = rr
2937  ppatch%mixt%cv(cv_mixt_xmom,ifl) = rur
2938  ppatch%mixt%cv(cv_mixt_ymom,ifl) = rvr
2939  ppatch%mixt%cv(cv_mixt_zmom,ifl) = rwr
2940  ppatch%mixt%cv(cv_mixt_ener,ifl) = rer
2941 
2942 ! TEMPORARY : overwriting above computation of farfield BC data by cell data
2943 ! this is done to avoid waves at farfield just in begining of run
2944  ppatch%mixt%cv(cv_mixt_dens,ifl) = pregion%mixt%cv(cv_mixt_dens,c1)
2945  ppatch%mixt%cv(cv_mixt_xmom,ifl) = pregion%mixt%cv(cv_mixt_xmom,c1)
2946  ppatch%mixt%cv(cv_mixt_ymom,ifl) = pregion%mixt%cv(cv_mixt_ymom,c1)
2947  ppatch%mixt%cv(cv_mixt_zmom,ifl) = pregion%mixt%cv(cv_mixt_zmom,c1)
2948  ppatch%mixt%cv(cv_mixt_ener,ifl) = pregion%mixt%cv(cv_mixt_ener,c1)
2949 ! END TEMPORARY
2950  END DO ! ifl
2951 
2952 ! ******************************************************************************
2953 ! End
2954 ! ******************************************************************************
2955 
2956  CALL deregisterfunction(global)
2957 
2958 END SUBROUTINE rflu_nscbc_initff
2959 
2960 
2961 
2962 
2963 
2964 
2965 
2966 ! ******************************************************************************
2967 !
2968 ! Purpose: Initialize inflow boundary with imposed total quantities.
2969 !
2970 ! Description: None.
2971 !
2972 ! Input:
2973 ! pRegion Pointer to region
2974 ! pPatch Pointer to patch
2975 !
2976 ! Output: None.
2977 !
2978 ! Notes: None.
2979 !
2980 ! ******************************************************************************
2981 
2982 SUBROUTINE rflu_nscbc_initiftotang(pRegion,pPatch)
2983 
2984  IMPLICIT NONE
2985 
2986 ! ******************************************************************************
2987 ! Definitions and declarations
2988 ! ******************************************************************************
2989 
2990 ! ==============================================================================
2991 ! Arguments
2992 ! ==============================================================================
2993 
2994  TYPE(t_patch), POINTER :: ppatch
2995  TYPE(t_region), POINTER :: pregion
2996 
2997 ! ==============================================================================
2998 ! Locals
2999 ! ==============================================================================
3000 
3001  INTEGER :: errorflag,ifl,c1
3002  INTEGER :: bcoptfixed,bcopttype,distrib,gasmodel,indcp,indgs,indmol
3003  REAL(RFREAL) :: cp,betah,betav,g,gc,mach,mw,nx,ny,nz,nm,pr,ptot,rer,rl,rr, &
3004  rul,rvl,rwl,rur,rvr,rwr,ttot
3005  REAL(RFREAL), DIMENSION(:,:), POINTER :: cv,dv,gv,vals
3006  TYPE(t_global), POINTER :: global
3007 
3008 ! ******************************************************************************
3009 ! Start
3010 ! ******************************************************************************
3011 
3012  global => pregion%global
3013 
3014  CALL registerfunction(global,'RFLU_NSCBC_InitIFTotAng',&
3015  'RFLU_ModNSCBC.F90')
3016 
3017 ! ******************************************************************************
3018 ! Main Body
3019 ! ******************************************************************************
3020 
3021  indcp = pregion%mixtInput%indCp
3022  indmol = pregion%mixtInput%indMol
3023 
3024  distrib = ppatch%mixt%distrib
3025  bcopttype = ppatch%mixt%switches(bcswi_inflow_type)
3026  bcoptfixed = ppatch%mixt%switches(bcswi_inflow_fixed)
3027 
3028  vals => ppatch%mixt%vals
3029 
3030  ppatch%mixt%cvState = cv_mixt_state_cons
3031 
3032  IF (pregion%mixt%cvState /= cv_mixt_state_cons ) THEN
3033  CALL errorstop(global,err_cv_state_invalid,__line__, &
3034  'region mixt cvState is incompatible...')
3035  END IF ! pRegion%mixt%cvState
3036 
3037  DO ifl = 1,ppatch%nBFaces
3038  c1 = ppatch%bf2c(ifl)
3039 
3040  mw = pregion%mixt%gv(gv_mixt_mol,indmol*c1)
3041  cp = pregion%mixt%gv(gv_mixt_cp ,indcp *c1)
3042 
3043  gc = mixtperf_r_m(mw)
3044  g = mixtperf_g_cpr(cp,gc)
3045 
3046  nx = ppatch%fn(xcoord,ifl)
3047  ny = ppatch%fn(ycoord,ifl)
3048  nz = ppatch%fn(zcoord,ifl)
3049  nm = ppatch%fn(xyzmag,ifl)
3050 
3051  rl = pregion%mixt%cv(cv_mixt_dens,c1)
3052  rul = pregion%mixt%cv(cv_mixt_xmom,c1)
3053  rvl = pregion%mixt%cv(cv_mixt_ymom,c1)
3054  rwl = pregion%mixt%cv(cv_mixt_zmom,c1)
3055 
3056  ptot = vals(bcdat_inflow_ptot, distrib*ifl)
3057  ttot = vals(bcdat_inflow_ttot, distrib*ifl)
3058  betah = vals(bcdat_inflow_betah,distrib*ifl)
3059  betav = vals(bcdat_inflow_betav,distrib*ifl)
3060 
3061  IF ( bcopttype == bcopt_supersonic ) THEN
3062  mach = vals(bcdat_inflow_mach,distrib*ifl)
3063  ELSE
3064  mach = 0.0_rfreal
3065  END IF ! bcOptType
3066 
3067  CALL bcondinflowperf(bcopttype,bcoptfixed,ptot,ttot,betah,betav, &
3068  mach,nx,ny,nz,cp,mw,rl,rul,rvl,rwl,rr,rur, &
3069  rvr,rwr,rer,pr)
3070 
3071  ppatch%mixt%cv(cv_mixt_dens,ifl) = rr
3072  ppatch%mixt%cv(cv_mixt_xmom,ifl) = rur
3073  ppatch%mixt%cv(cv_mixt_ymom,ifl) = rvr
3074  ppatch%mixt%cv(cv_mixt_zmom,ifl) = rwr
3075  ppatch%mixt%cv(cv_mixt_ener,ifl) = rer
3076  END DO ! ifl
3077 
3078 ! ******************************************************************************
3079 ! End
3080 ! ******************************************************************************
3081 
3082  CALL deregisterfunction(global)
3083 
3084 END SUBROUTINE rflu_nscbc_initiftotang
3085 
3086 
3087 
3088 
3089 
3090 ! ******************************************************************************
3091 !
3092 ! Purpose: Initialize inflow with imposed velocity and temperature.
3093 !
3094 ! Description: None.
3095 !
3096 ! Input:
3097 ! pRegion Pointer to region
3098 ! pPatch Pointer to patch
3099 !
3100 ! Output: None.
3101 !
3102 ! Notes: None.
3103 !
3104 ! ******************************************************************************
3105 
3106 SUBROUTINE rflu_nscbc_initifveltemp(pRegion,pPatch)
3107 
3108  IMPLICIT NONE
3109 
3110 ! ******************************************************************************
3111 ! Definitions and declarations
3112 ! ******************************************************************************
3113 
3114 ! ==============================================================================
3115 ! Arguments
3116 ! ==============================================================================
3117 
3118  TYPE(t_patch), POINTER :: ppatch
3119  TYPE(t_region), POINTER :: pregion
3120 
3121 ! ==============================================================================
3122 ! Locals
3123 ! ==============================================================================
3124 
3125  INTEGER :: errorflag,ifl,c1,bcopttype,distrib,gasmodel,indcp,indgs,indmol
3126  REAL(RFREAL) :: cp,eo,g,gc,mw,pr,rl,rr,rur,rvr,rwr,tr,ur,vr,wr
3127  REAL(RFREAL), DIMENSION(:,:), POINTER :: cv,dv,gv,vals
3128  TYPE(t_global), POINTER :: global
3129 
3130 ! ******************************************************************************
3131 ! Start
3132 ! ******************************************************************************
3133 
3134  global => pregion%global
3135 
3136  CALL registerfunction(global,'RFLU_NSCBC_InitIFVelTemp',&
3137  'RFLU_ModNSCBC.F90')
3138 
3139 ! ******************************************************************************
3140 ! Main body
3141 ! ******************************************************************************
3142 
3143  indcp = pregion%mixtInput%indCp
3144  indmol = pregion%mixtInput%indMol
3145 
3146  distrib = ppatch%mixt%distrib
3147  bcopttype = ppatch%mixt%switches(bcswi_inflow_type)
3148 
3149  vals => ppatch%mixt%vals
3150 
3151  ppatch%mixt%cvState = cv_mixt_state_cons
3152 
3153  IF (pregion%mixt%cvState /= cv_mixt_state_cons ) THEN
3154  CALL errorstop(global,err_cv_state_invalid,__line__, &
3155  'region mixt cvState is incompatible...')
3156  END IF ! pRegion%mixt%cvState
3157 
3158  DO ifl = 1,ppatch%nBFaces
3159  c1 = ppatch%bf2c(ifl)
3160 
3161  mw = pregion%mixt%gv(gv_mixt_mol,indmol*c1)
3162  cp = pregion%mixt%gv(gv_mixt_cp ,indcp *c1)
3163 
3164  gc = mixtperf_r_m(mw)
3165  g = mixtperf_g_cpr(cp,gc)
3166 
3167  rl = pregion%mixt%cv(cv_mixt_dens,c1)
3168 
3169  ur = vals(bcdat_inflow_u,distrib*ifl)
3170  vr = vals(bcdat_inflow_v,distrib*ifl)
3171  wr = vals(bcdat_inflow_w,distrib*ifl)
3172  tr = vals(bcdat_inflow_t,distrib*ifl)
3173 
3174  IF ( bcopttype == bcopt_supersonic ) THEN
3175  pr = vals(bcdat_inflow_p,distrib*ifl)
3176  rr = mixtperf_d_prt(pr,gc,tr)
3177  ELSE
3178  rr = rl
3179  pr = mixtperf_p_drt(rr,gc,tr)
3180  END IF ! bcOptType
3181 
3182  rur = rr*ur
3183  rvr = rr*vr
3184  rwr = rr*wr
3185 
3186  ppatch%mixt%cv(cv_mixt_dens,ifl) = rr
3187  ppatch%mixt%cv(cv_mixt_xmom,ifl) = rur
3188  ppatch%mixt%cv(cv_mixt_ymom,ifl) = rvr
3189  ppatch%mixt%cv(cv_mixt_zmom,ifl) = rwr
3190 
3191  eo = mixtperf_eo_dgpuvw(rr,g,pr,ur,vr,wr)
3192 
3193  ppatch%mixt%cv(cv_mixt_ener,ifl) = rr*eo
3194  END DO ! ifl
3195 
3196 ! ******************************************************************************
3197 ! End
3198 ! ******************************************************************************
3199 
3200  CALL deregisterfunction(global)
3201 
3202 END SUBROUTINE rflu_nscbc_initifveltemp
3203 
3204 
3205 
3206 
3207 
3208 
3209 
3210 ! ******************************************************************************
3211 !
3212 ! Purpose: Initialize injection boundary.
3213 !
3214 ! Description: None.
3215 !
3216 ! Input:
3217 ! pRegion Pointer to region
3218 ! pPatch Pointer to patch
3219 !
3220 ! Output: None.
3221 !
3222 ! Notes: None.
3223 !
3224 ! ******************************************************************************
3225 
3226 SUBROUTINE rflu_nscbc_initij(pRegion,pPatch)
3227 
3228  IMPLICIT NONE
3229 
3230 ! ******************************************************************************
3231 ! Definitions and declarations
3232 ! ******************************************************************************
3233 
3234 ! ==============================================================================
3235 ! Arguments
3236 ! ==============================================================================
3237 
3238  TYPE(t_patch), POINTER :: ppatch
3239  TYPE(t_region), POINTER :: pregion
3240 
3241 ! ==============================================================================
3242 ! Locals
3243 ! ==============================================================================
3244 
3245  TYPE(t_global), POINTER :: global
3246 
3247 ! ******************************************************************************
3248 ! Start
3249 ! ******************************************************************************
3250 
3251  global => pregion%global
3252 
3253  CALL registerfunction(global,'RFLU_NSCBC_InitIJ',&
3254  'RFLU_ModNSCBC.F90')
3255 
3256 ! ******************************************************************************
3257 ! Main body
3258 ! ******************************************************************************
3259 
3260  ppatch%mixt%cv = 0.0_rfreal
3261 
3262  ppatch%mixt%cvState = cv_mixt_state_cons
3263 
3264 ! ******************************************************************************
3265 ! End
3266 ! ******************************************************************************
3267 
3268  CALL deregisterfunction(global)
3269 
3270 END SUBROUTINE rflu_nscbc_initij
3271 
3272 
3273 
3274 
3275 
3276 
3277 
3278 ! ******************************************************************************
3279 !
3280 ! Purpose: Initialize no-slip wall with imposed heat flux.
3281 !
3282 ! Description: None.
3283 !
3284 ! Input:
3285 ! pRegion Pointer to region
3286 ! pPatch Pointer to patch
3287 !
3288 ! Output: None.
3289 !
3290 ! Notes: None.
3291 !
3292 ! ******************************************************************************
3293 
3294 SUBROUTINE rflu_nscbc_initnswheat(pRegion,pPatch)
3295 
3296  IMPLICIT NONE
3297 
3298 ! ******************************************************************************
3299 ! Definitions and declarations
3300 ! ******************************************************************************
3301 
3302 ! ==============================================================================
3303 ! Arguments
3304 ! ==============================================================================
3305 
3306  TYPE(t_patch), POINTER :: ppatch
3307  TYPE(t_region), POINTER :: pregion
3308 
3309 ! ==============================================================================
3310 ! Locals
3311 ! ==============================================================================
3312 
3313  TYPE(t_global), POINTER :: global
3314 
3315 ! ******************************************************************************
3316 ! Start
3317 ! ******************************************************************************
3318 
3319  global => pregion%global
3320 
3321  CALL registerfunction(global,'RFLU_NSCBC_InitNSWHeat',&
3322  'RFLU_ModNSCBC.F90')
3323 
3324 ! ******************************************************************************
3325 ! Main body
3326 ! ******************************************************************************
3327 
3328  ppatch%mixt%cv = 0.0_rfreal
3329 
3330  ppatch%mixt%cvState = cv_mixt_state_cons
3331 
3332 ! ******************************************************************************
3333 ! End
3334 ! ******************************************************************************
3335 
3336  CALL deregisterfunction(global)
3337 
3338 END SUBROUTINE rflu_nscbc_initnswheat
3339 
3340 
3341 
3342 
3343 
3344 
3345 ! ******************************************************************************
3346 !
3347 ! Purpose: Initialize no-slip wall with imposed temperature.
3348 !
3349 ! Description: None.
3350 !
3351 ! Input:
3352 ! pRegion Pointer to region
3353 ! pPatch Pointer to patch
3354 !
3355 ! Output: None.
3356 !
3357 ! Notes: None.
3358 !
3359 ! ******************************************************************************
3360 
3361 SUBROUTINE rflu_nscbc_initnswtemp(pRegion,pPatch)
3362 
3363  IMPLICIT NONE
3364 
3365 ! ******************************************************************************
3366 ! Definitions and declarations
3367 ! ******************************************************************************
3368 
3369 ! ==============================================================================
3370 ! Arguments
3371 ! ==============================================================================
3372 
3373  TYPE(t_patch), POINTER :: ppatch
3374  TYPE(t_region), POINTER :: pregion
3375 
3376 ! ==============================================================================
3377 ! Locals
3378 ! ==============================================================================
3379 
3380  TYPE(t_global), POINTER :: global
3381 
3382 ! ******************************************************************************
3383 ! Start
3384 ! ******************************************************************************
3385 
3386  global => pregion%global
3387 
3388  CALL registerfunction(global,'RFLU_NSCBC_InitNSWTemp',&
3389  'RFLU_ModNSCBC.F90')
3390 
3391 ! ******************************************************************************
3392 ! Main body
3393 ! ******************************************************************************
3394 
3395  ppatch%mixt%cv = 0.0_rfreal
3396 
3397  ppatch%mixt%cvState = cv_mixt_state_cons
3398 
3399 ! ******************************************************************************
3400 ! End
3401 ! ******************************************************************************
3402 
3403  CALL deregisterfunction(global)
3404 
3405 END SUBROUTINE rflu_nscbc_initnswtemp
3406 
3407 
3408 
3409 
3410 
3411 
3412 ! ******************************************************************************
3413 !
3414 ! Purpose: Initialize outflow.
3415 !
3416 ! Description: None.
3417 !
3418 ! Input:
3419 ! pRegion Pointer to region
3420 ! pPatch Pointer to patch
3421 !
3422 ! Output: None.
3423 !
3424 ! Notes: None.
3425 !
3426 ! ******************************************************************************
3427 
3428 SUBROUTINE rflu_nscbc_initof(pRegion,pPatch)
3429 
3430  IMPLICIT NONE
3431 
3432 ! ******************************************************************************
3433 ! Definitions and declarations
3434 ! ******************************************************************************
3435 
3436 ! ==============================================================================
3437 ! Arguments
3438 ! ==============================================================================
3439 
3440  TYPE(t_patch), POINTER :: ppatch
3441  TYPE(t_region), POINTER :: pregion
3442 
3443 ! ==============================================================================
3444 ! Locals
3445 ! ==============================================================================
3446 
3447  INTEGER :: errorflag,ifl,c1,bcopttype,distrib,gasmodel,indcp,indgs,indmol
3448  REAL(RFREAL) :: cp,eo,g,gc,mw,pl,pr,rl,rul,rvl,rwl,rel,ul,vl,wl
3449  REAL(RFREAL), DIMENSION(:,:), POINTER :: cv,dv,gv,vals
3450  TYPE(t_global), POINTER :: global
3451 
3452 ! ******************************************************************************
3453 ! Start
3454 ! ******************************************************************************
3455 
3456  global => pregion%global
3457 
3458  CALL registerfunction(global,'RFLU_NSCBC_InitOF',&
3459  'RFLU_ModNSCBC.F90')
3460 
3461 ! ******************************************************************************
3462 ! Main Body
3463 ! ******************************************************************************
3464 
3465  indcp = pregion%mixtInput%indCp
3466  indmol = pregion%mixtInput%indMol
3467 
3468  distrib = ppatch%mixt%distrib
3469  bcopttype = ppatch%mixt%switches(bcswi_outflow_type)
3470 
3471  IF ( bcopttype /= bcopt_supersonic ) THEN
3472  vals => ppatch%mixt%vals
3473  END IF ! bcOptType
3474 
3475  ppatch%mixt%cvState = cv_mixt_state_cons
3476 
3477  IF (pregion%mixt%cvState /= cv_mixt_state_cons ) THEN
3478  CALL errorstop(global,err_cv_state_invalid,__line__, &
3479  'region mixt cvState is incompatible...')
3480  END IF ! pRegion%mixt%cvState
3481 
3482  DO ifl = 1,ppatch%nBFaces
3483  c1 = ppatch%bf2c(ifl)
3484 
3485  mw = pregion%mixt%gv(gv_mixt_mol,indmol*c1)
3486  cp = pregion%mixt%gv(gv_mixt_cp ,indcp *c1)
3487 
3488  gc = mixtperf_r_m(mw)
3489  g = mixtperf_g_cpr(cp,gc)
3490 
3491  rl = pregion%mixt%cv(cv_mixt_dens,c1)
3492  rul = pregion%mixt%cv(cv_mixt_xmom,c1)
3493  rvl = pregion%mixt%cv(cv_mixt_ymom,c1)
3494  rwl = pregion%mixt%cv(cv_mixt_zmom,c1)
3495  rel = pregion%mixt%cv(cv_mixt_ener,c1)
3496 
3497  ul = rul/rl
3498  vl = rvl/rl
3499  wl = rwl/rl
3500 
3501  pl = pregion%mixt%dv(dv_mixt_pres,c1)
3502 
3503  IF ( bcopttype /= bcopt_supersonic ) THEN
3504  pr = vals(bcdat_outflow_press,distrib*ifl)
3505  ELSE
3506  pr = pl
3507  END IF ! bcOptType
3508 
3509  ppatch%mixt%cv(cv_mixt_dens,ifl) = rl
3510  ppatch%mixt%cv(cv_mixt_xmom,ifl) = rul
3511  ppatch%mixt%cv(cv_mixt_ymom,ifl) = rvl
3512  ppatch%mixt%cv(cv_mixt_zmom,ifl) = rwl
3513 
3514  eo = mixtperf_eo_dgpuvw(rl,g,pr,ul,vl,wl)
3515 
3516  ppatch%mixt%cv(cv_mixt_ener,ifl) = rl*eo
3517  END DO ! ifl
3518 
3519 ! ******************************************************************************
3520 ! End
3521 ! ******************************************************************************
3522 
3523  CALL deregisterfunction(global)
3524 
3525 END SUBROUTINE rflu_nscbc_initof
3526 
3527 
3528 
3529 
3530 
3531 
3532 
3533 ! ******************************************************************************
3534 !
3535 ! Purpose: Initialize slip wall.
3536 !
3537 ! Description: None.
3538 !
3539 ! Input:
3540 ! pRegion Pointer to region
3541 ! pPatch Pointer to patch
3542 !
3543 ! Output: None.
3544 !
3545 ! Notes: None.
3546 !
3547 ! ******************************************************************************
3548 
3549 SUBROUTINE rflu_nscbc_initsw(pRegion,pPatch)
3550 
3551  IMPLICIT NONE
3552 
3553 ! ******************************************************************************
3554 ! Definitions and declarations
3555 ! ******************************************************************************
3556 
3557 ! ==============================================================================
3558 ! Arguments
3559 ! ==============================================================================
3560 
3561  TYPE(t_patch), POINTER :: ppatch
3562  TYPE(t_region), POINTER :: pregion
3563 
3564 ! ==============================================================================
3565 ! Locals
3566 ! ==============================================================================
3567 
3568  INTEGER :: errorflag,ifl,c1,bcopttype,distrib,gasmodel,indcp,indgs,indmol
3569  REAL(RFREAL) :: cp,eo,g,gc,mw,rl,rr,rul,rvl,rwl,rel,pl,pr,ul,ur,vl,vr,wl,wr
3570  REAL(RFREAL), DIMENSION(:,:), POINTER :: cv,dv,gv,vals
3571  TYPE(t_global), POINTER :: global
3572 
3573 ! ******************************************************************************
3574 ! Start
3575 ! ******************************************************************************
3576 
3577  global => pregion%global
3578 
3579  CALL registerfunction(global,'RFLU_NSCBC_InitSW',&
3580  'RFLU_ModNSCBC.F90')
3581 
3582 ! ******************************************************************************
3583 ! Main Body
3584 ! ******************************************************************************
3585 
3586 ! ASSUMPTION : slip wall is horizontal
3587 ! => v=0
3588 
3589  indcp = pregion%mixtInput%indCp
3590  indmol = pregion%mixtInput%indMol
3591 
3592  distrib = ppatch%mixt%distrib
3593 
3594  ppatch%mixt%cvState = cv_mixt_state_cons
3595 
3596  IF (pregion%mixt%cvState /= cv_mixt_state_cons ) THEN
3597  CALL errorstop(global,err_cv_state_invalid,__line__, &
3598  'region mixt cvState is incompatible...')
3599  END IF ! pRegion%mixt%cvState
3600 
3601  DO ifl = 1,ppatch%nBFaces
3602  c1 = ppatch%bf2c(ifl)
3603 
3604  mw = pregion%mixt%gv(gv_mixt_mol,indmol*c1)
3605  cp = pregion%mixt%gv(gv_mixt_cp ,indcp *c1)
3606 
3607  gc = mixtperf_r_m(mw)
3608  g = mixtperf_g_cpr(cp,gc)
3609 
3610  rl = pregion%mixt%cv(cv_mixt_dens,c1)
3611  rul = pregion%mixt%cv(cv_mixt_xmom,c1)
3612  rvl = pregion%mixt%cv(cv_mixt_ymom,c1)
3613  rwl = pregion%mixt%cv(cv_mixt_zmom,c1)
3614  rel = pregion%mixt%cv(cv_mixt_ener,c1)
3615 
3616  ul = rul/rl
3617  vl = rvl/rl
3618  wl = rwl/rl
3619 
3620  pl = pregion%mixt%dv(dv_mixt_pres,c1)
3621 
3622  rr = rl
3623  ur = ul
3624  vr = 0.0_rfreal
3625  wr = wl
3626  pr = pl
3627 ! TEMPORARY : pressure at wall should be computed using rind states
3628 ! but for now, copying from cell
3629 
3630  ppatch%mixt%cv(cv_mixt_dens,ifl) = rr
3631  ppatch%mixt%cv(cv_mixt_xmom,ifl) = rr*ur
3632  ppatch%mixt%cv(cv_mixt_ymom,ifl) = rr*vr
3633  ppatch%mixt%cv(cv_mixt_zmom,ifl) = rr*wr
3634 
3635  eo = mixtperf_eo_dgpuvw(rr,g,pr,ur,vr,wr)
3636 
3637  ppatch%mixt%cv(cv_mixt_ener,ifl) = rr*eo
3638  END DO ! ifl
3639 
3640 ! ******************************************************************************
3641 ! End
3642 ! ******************************************************************************
3643 
3644  CALL deregisterfunction(global)
3645 
3646 END SUBROUTINE rflu_nscbc_initsw
3647 
3648 
3649 
3650 
3651 
3652 
3653 
3654 END MODULE rflu_modnscbc
3655 
3656 ! ******************************************************************************
3657 !
3658 ! RCS Revision history:
3659 !
3660 ! $Log: RFLU_ModNSCBC.F90,v $
3661 ! Revision 1.7 2008/12/06 08:44:22 mtcampbe
3662 ! Updated license.
3663 !
3664 ! Revision 1.6 2008/11/19 22:17:33 mtcampbe
3665 ! Added Illinois Open Source License/Copyright
3666 !
3667 ! Revision 1.5 2007/02/27 13:05:23 haselbac
3668 ! Cosmetics only
3669 !
3670 ! Revision 1.4 2006/10/20 21:18:45 mparmar
3671 ! Added mass/momentum coeffs in flux routines and cosmetic clean-up
3672 !
3673 ! Revision 1.3 2006/08/21 16:11:19 haselbac
3674 ! Clean-up: comments, order of routines, missing headers, indentation, etc
3675 !
3676 ! Revision 1.2 2006/08/19 19:44:08 haselbac
3677 ! Significant clean-up and cosmetic changes
3678 !
3679 ! Revision 1.1 2006/08/19 15:37:46 mparmar
3680 ! Initial revision
3681 !
3682 ! ******************************************************************************
3683 
3684 
3685 
3686 
3687 
3688 
3689 
3690 
3691 
3692 
3693 
3694 
3695 
3696 
3697 
3698 
3699 
3700 
3701 
3702 
3703 
3704 
3705 
3706 
3707 
3708 
3709 
subroutine, private rflu_nscbc_comprhsifveltemp(pRegion, pPatch)
unsigned char r() const
Definition: Color.h:68
subroutine, private rflu_nscbc_comprhsnswheat(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, private rflu_nscbc_comprhsij(pRegion, pPatch)
subroutine, private rflu_nscbc_comprhsnswtemp(pRegion, pPatch)
subroutine bcondfarfieldperf(machInf, alphaInf, betaInf, pInf, tInf, sxn, syn, szn, cpgas, mol, rho, rhou, rhov, rhow, rhoe, press, rhob, rhoub, rhovb, rhowb, rhoeb, pb)
subroutine, public rflu_nscbc_initsw(pRegion, pPatch)
subroutine, public rflu_nscbc_initiftotang(pRegion, pPatch)
NT dx
NT rhs
LOGICAL function rflu_decideneedbgradface(pRegion, pPatch)
Vector_n max(const Array_n_const &v1, const Array_n_const &v2)
Definition: Vector_n.h:354
subroutine, private rflu_nscbc_comprhsff(pRegion, pPatch)
real(rfreal) function mixtperf_c_dgp(D, G, P)
Definition: MixtPerf_C.F90:56
subroutine registerfunction(global, funName, fileName)
Definition: ModError.F90:449
subroutine, public rflu_nscbc_comprhs(pRegion)
real(rfreal) function mixtperf_d_prt(P, R, T)
Definition: MixtPerf_D.F90:71
double sqrt(double d)
Definition: double.h:73
subroutine, public rflu_nscbc_initff(pRegion, pPatch)
real(rfreal) function mixtperf_c_ghovm2(G, Ho, Vm2)
Definition: MixtPerf_C.F90:71
real(rfreal) function mixtperf_r_cpg(Cp, G)
Definition: MixtPerf_R.F90:39
subroutine, public rflu_nscbc_initifveltemp(pRegion, pPatch)
real(rfreal) function, public entropyfixhartenhyman(l, d)
*********************************************************************Illinois Open Source License ****University of Illinois NCSA **Open Source License University of Illinois All rights reserved ****Developed free of to any person **obtaining a copy of this software and associated documentation to deal with the Software without including without limitation the rights to and or **sell copies of the and to permit persons to whom the **Software is furnished to do subject to the following this list of conditions and the following disclaimers ****Redistributions in binary form must reproduce the above **copyright this list of conditions and the following **disclaimers in the documentation and or other materials **provided with the distribution ****Neither the names of the Center for Simulation of Advanced the University of nor the names of its **contributors may be used to endorse or promote products derived **from this Software without specific prior written permission ****THE SOFTWARE IS PROVIDED AS WITHOUT WARRANTY OF ANY **EXPRESS OR INCLUDING BUT NOT LIMITED TO THE WARRANTIES **OF FITNESS FOR A PARTICULAR PURPOSE AND **NONINFRINGEMENT IN NO EVENT SHALL THE CONTRIBUTORS OR **COPYRIGHT HOLDERS BE LIABLE FOR ANY DAMAGES OR OTHER WHETHER IN AN ACTION OF TORT OR **ARISING OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE **USE OR OTHER DEALINGS WITH THE SOFTWARE v
Definition: roccomf90.h:20
subroutine, public rflu_computegradbfaceswrapper(pRegion, pPatch, iBegVar, iEndVar, iBegGrad, iEndGrad, var, grad)
subroutine, public rflu_convertcvcons2prim(pRegion, cvStateFuture)
subroutine, public rflu_nscbc_initnswtemp(pRegion, pPatch)
LOGICAL function, public rflu_nscbc_decidehavenscbc(pRegion)
subroutine bcondoutflowperf(bcOpt, pout, sxn, syn, szn, cpgas, mol, rho, rhou, rhov, rhow, rhoe, press, rhob, rhoub, rhovb, rhowb, rhoeb)
real(rfreal) function mixtperf_ho_cptuvw(Cp, T, U, V, W)
Definition: MixtPerf_H.F90:39
NT & sin
subroutine, private rflu_nscbc_comprhssw(pRegion, pPatch)
subroutine, public rflu_convertcvprim2cons(pRegion, cvStateFuture)
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, private rflu_nscbc_comprhsiftotang(pRegion, pPatch)
real(rfreal) function mixtperf_t_dpr(D, P, R)
Definition: MixtPerf_T.F90:85
subroutine, public rflu_nscbc_compsecondpatchflux(pRegion, pPatch)
subroutine bcondinflowperf(bcOptType, bcOptFixed, ptot, ttot, betah, betav, mach, sxn, syn, szn, cpgas, mm, rl, rul, rvl, rwl, rr, rur, rvr, rwr, rer, pr)
subroutine, public rflu_nscbc_comppatchflux(pRegion, pPatch)
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)
subroutine, public rflu_nscbc_initof(pRegion, pPatch)
NT dy
subroutine, public rflu_bxv_convertcvcons2prim(pRegion, pPatch, cvStateFuture)
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, public rflu_nscbc_initij(pRegion, pPatch)
subroutine, private rflu_nscbc_comprhsof(pRegion, pPatch)
subroutine deregisterfunction(global)
Definition: ModError.F90:469
subroutine, public rflu_nscbc_compfirstpatchflux(pRegion, pPatch)
real(rfreal) function mixtperf_g_cpr(Cp, R)
Definition: MixtPerf_G.F90:39
NT & cos
subroutine, public rflu_nscbc_initnswheat(pRegion, pPatch)
real(rfreal) function mixtperf_p_drt(D, R, T)
Definition: MixtPerf_P.F90:54
RT a() const
Definition: Line_2.h:140
unsigned char g() const
Definition: Color.h:69
subroutine, public rflu_bxv_convertcvprim2cons(pRegion, pPatch, cvStateFuture)