8 real(8),
pointer :: coeffs(:,:)
9 real(8),
pointer :: coeffsorig(:,:)
11 real(8),
pointer :: cmod(:,:)
12 real(8),
pointer :: ch(:,:)
13 real(8),
pointer :: cp(:,:)
20 numDim,bufferSizes,numPointsBuffer,patchNormalDir,patchSizes, &
21 numPointsPatch,numPatchPointsOp,patchPointsOp,gridType,gridMetric,&
22 jacobianDeterminant,bcParams,gasParams,rhoBuffer,rhoVBuffer, &
23 rhoEBuffer,viscousFluxBuffer,numscalar,scalarBuffer, &
24 rhoRHS,rhoVRHS,rhoERHS,scalarRHS, &
25 rhoTarget,rhoVTarget,rhoETarget,scalarTarget)
29 INTEGER(KIND=4) :: numdim,numscalar,patchnormaldir,gridtype
30 INTEGER(KIND=8) :: numpointsbuffer,buffersizes(numdim)
31 INTEGER(KIND=8) :: patchsizes(numdim),numpointspatch
32 INTEGER(KIND=8) :: numpatchpointsop
33 INTEGER(KIND=8) :: patchpointsop(numpatchpointsop)
34 REAL(KIND=8) :: gridmetric(numdim*numdim*numpointsbuffer)
35 REAL(KIND=8) :: jacobiandeterminant(numpointsbuffer)
36 REAL(KIND=8) :: bcparams(3),gasparams(5)
37 REAL(KIND=8) :: rhobuffer(numpointsbuffer)
38 REAL(KIND=8) :: rhovbuffer(numdim*numpointsbuffer)
39 REAL(KIND=8) :: rhoebuffer(numpointsbuffer)
40 REAL(KIND=8) :: viscousfluxbuffer((numdim+2)*numpointsbuffer)
41 REAL(KIND=8) :: scalarbuffer(numscalar*numpointsbuffer)
42 REAL(KIND=8) :: rhorhs(numpointsbuffer)
43 REAL(KIND=8) :: rhovrhs(numdim*numpointsbuffer)
44 REAL(KIND=8) :: rhoerhs(numpointsbuffer)
45 REAL(KIND=8) :: scalarrhs(numscalar*numpointsbuffer)
46 REAL(KIND=8) :: rhotarget(numpointsbuffer)
47 REAL(KIND=8) :: rhovtarget(numdim*numpointsbuffer)
48 REAL(KIND=8) :: rhoetarget(numpointsbuffer)
49 REAL(KIND=8) :: scalartarget(numscalar*numpointsbuffer)
55 INTEGER(4) :: nd, nauxvars, jj, idim, idir
56 INTEGER(8) :: nc, l0, ipoint, pointindex, metricoffset
57 INTEGER(4) :: normdir, sgn
58 REAL(8) :: dsgn, sndspdref2, invtempref, tempref, gamref, spcgasconst
59 REAL(8) :: xi_x, xi_y, xi_z, xi_t, bndry_h,sbpboundaryweight
60 REAL(8) :: xi_x_tilde, xi_y_tilde, xi_z_tilde, gridjacobian
61 REAL(8) :: rhofac, penaltyfac, scalarpenaltyfac, scalardiff
63 REAL(8),
POINTER :: xix(:)
64 REAL(8) :: metricdata(9)
66 REAL(8),
POINTER :: pnorm_vec(:)
67 REAL(8),
POINTER :: lambda(:,:), gi1(:), ub(:), tinv(:,:), tmat(:,:)
68 REAL(8),
POINTER :: aprime(:,:), gi2(:), matx(:,:), penalty(:) ,correction(:)
69 REAL(8) :: norm_vec(3), gamma, ucon, ubaux,xh
70 REAL(8) :: sigmai1, sigmai2, sigmaaux, sfactor, ibfac_local
71 REAL(8) :: spd_snd, re, reinv, sat_sigmai2_ff, sat_sigmai1_ff
88 normdir = abs(patchnormaldir)
89 sgn = normdir / patchnormaldir
101 gamref = gasparams(2)
102 spcgasconst= gasparams(3)
103 sndspdref2 = gasparams(5)*gasparams(5)
104 tempref = gasparams(4)
108 IF(re .gt. 0) reinv = 1.0_8/re
113 sat_sigmai1_ff = bcparams(1)
114 sat_sigmai2_ff = bcparams(2)
115 sbpboundaryweight = bcparams(3)
131 ALLOCATE(gi1(nd+2), ub(nd+2), tmat(nd+2,nd+2), tinv(nd+2,nd+2), penalty(nd+2),correction(nd+2))
132 ALLOCATE(gi2(nd+2), aprime(nd+2,nd+2), lambda(nd+2,nd+2), matx(nd+2,nd+2), pnorm_vec(nd))
138 xix(normdir) = gridmetric(normdir)
140 gridjacobian = jacobiandeterminant(1)
142 metricoffset = (normdir-1)*numpointsbuffer
144 metricoffset = (normdir-1)*numdim*numpointsbuffer
150 DO ipoint = 1, numpatchpointsop
151 l0 = patchpointsop(ipoint) + 1
162 xix(idir) = gridmetric(metricoffset + (idir-1)*numpointsbuffer +l0)
164 gridjacobian = jacobiandeterminant(l0)
166 xix(normdir) = gridmetric(metricoffset + l0)
167 gridjacobian = jacobiandeterminant(l0)
177 metricdata(1) = xix(1)
178 metricdata(2) = xix(2)
179 metricdata(3) = xix(3)
181 metricdata(4:9) = 0.0_8
185 IF(idir > 3) idir = idir - 3
186 metricdata(4+(idir-1)) = gridmetric(idir)
188 IF(idir > 3) idir = idir - 3
189 metricdata(7+(idir-1)) = gridmetric(idir)
192 IF(idir > 3) idir = idir - 3
193 metricdata(4+(idir-1)) = gridmetric((idir-1)*numpointsbuffer+l0)
195 IF(idir > 3) idir = idir - 3
196 metricdata(7+(idir-1)) = gridmetric((idir-1)*numpointsbuffer+l0)
199 IF(idir > 3) idir = idir - 3
200 metricoffset = (idir-1)*numdim*numpointsbuffer
201 metricdata(4) = gridmetric(metricoffset+l0)
202 metricdata(5) = gridmetric(metricoffset+numpointsbuffer+l0)
203 metricdata(6) = gridmetric(metricoffset+2*numpointsbuffer+l0)
205 IF(idir > 3) idir = idir - 3
206 metricoffset = (idir-1)*numdim*numpointsbuffer
207 metricdata(7) = gridmetric(metricoffset+l0)
208 metricdata(8) = gridmetric(metricoffset+numpointsbuffer+l0)
209 metricdata(9) = gridmetric(metricoffset+2*numpointsbuffer+l0)
220 xi_x = xi_x * gridjacobian
221 xi_y = xi_y * gridjacobian
222 xi_z = xi_z * gridjacobian
223 xi_t = xi_t * gridjacobian
226 xh = sqrt((xi_x*xi_x)+(xi_y*xi_y)+(xi_z*xi_z))
228 xi_x_tilde = xi_x * bndry_h
229 xi_y_tilde = xi_y * bndry_h
230 xi_z_tilde = xi_z * bndry_h
234 sigmai1 = -sat_sigmai1_ff * dsgn
238 ub(1) = rhobuffer(l0)
240 ub(1+idim) = rhovbuffer(l0+(idim-1)*numpointsbuffer)
242 ub(numdim+2) = rhoebuffer(l0)
246 gi1(1) = rhotarget(l0)
248 gi1(1+idim) = rhovtarget(l0+(idim-1)*numpointsbuffer)
250 gi1(numdim+2) = rhoetarget(l0)
253 norm_vec(1:3) = (/ xi_x_tilde, xi_y_tilde, xi_z_tilde /)
254 pnorm_vec(:) = norm_vec(1:nd) * xh
286 spd_snd = lambda(nd+1,nd+1) - ucon
291 lambda(jj,jj) = max(lambda(jj,jj),0.0_8)
295 lambda(jj,jj) = min(lambda(jj,jj),0.0_8)
302 ucon < 0.0_8 .and. ucon + spd_snd > 0.0_8)
then 303 lambda(nd+2,nd+1) = lambda(nd+2,nd+1) - ucon - spd_snd
305 else if (sgn == -1 .and. &
306 ucon > 0.0_8 .and. ucon - spd_snd < 0.0_8)
then 307 lambda(nd+1,nd+2) = lambda(nd+1,nd+2) - ucon + spd_snd
311 matx = matmul(lambda,tinv)
314 aprime = matmul(tmat,matx)
317 ub(1:nd+2) = ub(1:nd+2) - gi1(1:nd+2)
320 gi2(1:nd+2) = matmul(aprime,ub)
322 penaltyfac = sbpboundaryweight*sigmai1
323 correction(:) = penaltyfac*gi2(:)
328 rhorhs(l0) = rhorhs(l0) + correction(1)
330 pointindex = l0 + (idim-1)*numpointsbuffer
331 rhovrhs(pointindex) = rhovrhs(pointindex) + correction(1+idim)
333 rhoerhs(l0) = rhoerhs(l0) + correction(numdim+2)
342 IF(numscalar > 0)
THEN 343 If (dsgn * ucon > 0)
Then 344 sfactor = ucon * ibfac_local * penaltyfac
345 rhofac = rhobuffer(l0)/rhotarget(l0)
346 scalarpenaltyfac = sfactor*rhofac
348 pointindex = (jj-1)*numpointsbuffer + l0
349 scalardiff = (scalarbuffer(pointindex) - scalartarget(pointindex))
350 scalarrhs(pointindex) = scalarrhs(pointindex) + scalarpenaltyfac * scalardiff
361 sigmai2 = dsgn * sat_sigmai2_ff*sbpboundaryweight/bndry_h
369 ub(:) = viscousfluxbuffer(l0) * xi_x_tilde
371 ub(:) = ub(:) + viscousfluxbuffer(l0) * xi_y_tilde
373 ub(:) = ub(:) + viscousfluxbuffer(l0) * xi_z_tilde
376 penalty(:) = sigmai2 * (ub(:) - gi2(:))
379 rhorhs(l0) = rhorhs(l0) + ibfac_local * penalty(1)
381 pointindex = l0 + (idim-1)*numpointsbuffer
382 rhovrhs(pointindex) = rhovrhs(pointindex) + ibfac_local*penalty(1+idim)
384 rhoerhs(l0) = rhoerhs(l0) + ibfac_local * penalty(numdim+2)
397 DEALLOCATE(correction)
398 DEALLOCATE(gi1, ub, tmat, tinv, penalty)
399 DEALLOCATE(gi2, aprime, lambda, matx, pnorm_vec)
406 numDim,bufferSizes,numPointsBuffer,patchNormalDir,patchSizes, &
407 numPointsPatch,numPatchPointsOp,patchPointsOp,gridType, &
408 gridMetric,jacobianDeterminant,bcParams,gasParams, &
409 rhoBuffer,rhoVBuffer,rhoEBuffer,numscalar,scalarBuffer, &
410 rhoRHS,rhoVRHS,rhoERHS, scalarRHS,rhoTarget,rhoVTarget, &
411 rhoETarget,scalarTarget)
415 INTEGER(KIND=4) :: numdim,numscalar,patchnormaldir,gridtype
416 INTEGER(KIND=8) :: numpointsbuffer,buffersizes(numdim)
417 INTEGER(KIND=8) :: patchsizes(numdim),numpointspatch
418 INTEGER(KIND=8) :: numpatchpointsop
419 INTEGER(KIND=8) :: patchpointsop(numpatchpointsop)
420 REAL(KIND=8) :: gridmetric(numdim*numdim*numpointsbuffer)
421 REAL(KIND=8) :: jacobiandeterminant(numpointsbuffer)
422 REAL(KIND=8) :: bcparams(3),gasparams(5)
423 REAL(KIND=8) :: rhobuffer(numpointsbuffer)
424 REAL(KIND=8) :: rhovbuffer(numdim*numpointsbuffer)
425 REAL(KIND=8) :: rhoebuffer(numpointsbuffer)
426 REAL(KIND=8) :: scalarbuffer(numscalar*numpointsbuffer)
427 REAL(KIND=8) :: rhorhs(numpointsbuffer)
428 REAL(KIND=8) :: rhovrhs(numdim*numpointsbuffer)
429 REAL(KIND=8) :: rhoerhs(numpointsbuffer)
430 REAL(KIND=8) :: scalarrhs(numscalar*numpointsbuffer)
431 REAL(KIND=8) :: rhotarget(numpointsbuffer)
432 REAL(KIND=8) :: rhovtarget(numdim*numpointsbuffer)
433 REAL(KIND=8) :: rhoetarget(numpointsbuffer)
434 REAL(KIND=8) :: scalartarget(numscalar*numpointsbuffer)
438 INTEGER(4) :: nd, nauxvars, jj, idim, idir
439 INTEGER(8) :: nc, l0, ipoint, pointindex,metricoffset
440 INTEGER(4) :: normdir, sgn
447 REAL(8) :: dsgn, sndspdref2, invtempref, tempref, gamref, spcgasconst
448 REAL(8) :: xi_x, xi_y, xi_z, xi_t, bndry_h,sbpboundaryweight
449 REAL(8) :: xi_x_tilde, xi_y_tilde, xi_z_tilde, gridjacobian
450 REAL(8) :: rhofac, penaltyfac, scalarpenaltyfac, scalardiff
452 REAL(8),
POINTER :: xix(:), bvelocity(:), vwall(:), vwalltarget(:), vtarget(:)
453 REAL(8) :: metricdata(9)
455 REAL(8),
POINTER :: pnorm_vec(:)
460 REAL(8),
POINTER :: lambda(:,:), gi1(:), ub(:), tinv(:,:), tmat(:,:)
462 REAL(8),
POINTER :: aprime(:,:), gi2(:), matx(:,:), penalty(:) ,correction(:)
465 REAL(8) :: norm_vec(3), gamma, ucon, ubaux, specrad, vdotxi, xh
466 REAL(8) :: sigmai1, sigmai2, sigmaaux, sfactor, ibfac_local
467 REAL(8) :: spd_snd, re, reinv, sat_sigmai1,pressuretarget
507 normdir = abs(patchnormaldir)
508 sgn = normdir / patchnormaldir
521 gamref = gasparams(2)
522 spcgasconst= gasparams(3)
523 sndspdref2 = gasparams(5)*gasparams(5)
524 tempref = gasparams(4)
531 sat_sigmai1 = bcparams(1)
532 sbpboundaryweight = bcparams(2)
537 ALLOCATE(xix(4),vwall(nd),bvelocity(nd),vwalltarget(nd),vtarget(nd))
538 ALLOCATE(gi1(nd+2), ub(nd+2), tmat(nd+2,nd+2), tinv(nd+2,nd+2), penalty(nd+2),correction(nd+2))
539 ALLOCATE(gi2(nd+2), aprime(nd+2,nd+2), lambda(nd+2,nd+2), matx(nd+2,nd+2), pnorm_vec(nd))
543 xix(normdir) = gridmetric(normdir)
545 gridjacobian = jacobiandeterminant(1)
547 metricoffset = (normdir-1)*numpointsbuffer
549 metricoffset = (normdir-1)*numdim*numpointsbuffer
568 DO ipoint = 1, numpatchpointsop
570 l0 = patchpointsop(ipoint) + 1
589 xix(idir) = gridmetric(metricoffset + (idir-1)*numpointsbuffer +l0)
591 gridjacobian = jacobiandeterminant(l0)
593 xix(normdir) = gridmetric(metricoffset + l0)
594 gridjacobian = jacobiandeterminant(l0)
598 xi_x = xix(1) * gridjacobian
599 xi_y = xix(2) * gridjacobian
600 xi_z = xix(3) * gridjacobian
601 xi_t = xix(4) * gridjacobian
605 metricdata(1) = xix(1)
606 metricdata(2) = xix(2)
607 metricdata(3) = xix(3)
608 metricdata(4:9) = 0.0_8
612 IF(idir > 3) idir = idir - 3
613 metricdata(4+(idir-1)) = gridmetric(idir)
615 IF(idir > 3) idir = idir - 3
616 metricdata(7+(idir-1)) = gridmetric(idir)
619 IF(idir > 3) idir = idir - 3
620 metricdata(4+(idir-1)) = gridmetric((idir-1)*numpointsbuffer+l0)
622 IF(idir > 3) idir = idir - 3
623 metricdata(7+(idir-1)) = gridmetric((idir-1)*numpointsbuffer+l0)
626 IF(idir > 3) idir = idir - 3
627 metricoffset = (idir-1)*numdim*numpointsbuffer
628 metricdata(4) = gridmetric(metricoffset+l0)
629 metricdata(5) = gridmetric(metricoffset+numpointsbuffer+l0)
630 metricdata(6) = gridmetric(metricoffset+2*numpointsbuffer+l0)
632 IF(idir > 3) idir = idir - 3
633 metricoffset = (idir-1)*numdim*numpointsbuffer
634 metricdata(7) = gridmetric(metricoffset+l0)
635 metricdata(8) = gridmetric(metricoffset+numpointsbuffer+l0)
636 metricdata(9) = gridmetric(metricoffset+2*numpointsbuffer+l0)
641 xh = sqrt( (xi_x * xi_x) + (xi_y * xi_y) + (xi_z * xi_z) )
643 xi_x_tilde = xi_x * bndry_h
644 xi_y_tilde = xi_y * bndry_h
645 xi_z_tilde = xi_z * bndry_h
649 norm_vec(1:3) = (/ xi_x_tilde, xi_y_tilde, xi_z_tilde /)
650 pnorm_vec(:) = norm_vec(1:nd) * xh
654 sigmai1 = -sat_sigmai1 * dsgn
661 ub(1) = rhobuffer(l0)
664 ub(1+idim) = rhovbuffer(l0+(idim-1)*numpointsbuffer)
665 bvelocity(idim) = rhovbuffer(l0+(idim-1)*numpointsbuffer)/rhobuffer(l0)
666 vdotxi = vdotxi + bvelocity(idim)*xix(idim)*gridjacobian*bndry_h
668 ub(numdim+2) = rhoebuffer(l0)
670 vwall(1:numdim) = vdotxi*norm_vec(1:numdim)
672 vwalltarget(1:numdim) = 0.0_8
677 vtarget(idim) = bvelocity(idim) - ( vwall(idim) - vwalltarget(idim) )
684 gi1(numdim+2) = ub(numdim+2)
686 gi1(1+idim) = gi1(1) * vtarget(idim)
687 gi1(numdim+2) = gi1(numdim+2) + 0.5_8*gi1(1)*(vtarget(idim)**2 - bvelocity(idim)**2)
717 lambda(jj,jj) = max(lambda(jj,jj),0.0_8)
718 specrad = max(abs(lambda(jj,jj)),abs(specrad))
722 lambda(jj,jj) = min(lambda(jj,jj),0.0_8)
723 specrad = max(abs(lambda(jj,jj)),abs(specrad))
742 matx = matmul(lambda,tinv)
745 aprime = matmul(tmat,matx)
748 ub(1:nd+2) = ub(1:nd+2) - gi1(1:nd+2)
751 gi2(1:nd+2) = matmul(aprime,ub)
753 penaltyfac = sbpboundaryweight*sigmai1
754 correction(:) = penaltyfac*gi2(:)
757 rhorhs(l0) = rhorhs(l0) + ibfac_local * correction(1)
759 pointindex = l0 + (idim-1)*numpointsbuffer
760 rhovrhs(pointindex) = rhovrhs(pointindex) + ibfac_local*correction(1+idim)
762 rhoerhs(l0) = rhoerhs(l0) + ibfac_local * correction(numdim+2)
770 IF(numscalar > 0)
THEN 771 If (dsgn * ucon > 0)
Then 772 sfactor = -ucon * dsgn * ibfac_local * sbpboundaryweight
774 pointindex = (jj-1)*numpointsbuffer + l0
775 scalarrhs(pointindex) = scalarrhs(pointindex) + sfactor*scalarbuffer(pointindex)
802 DEALLOCATE(xix,vwall,bvelocity,vwalltarget,vtarget)
803 DEALLOCATE(gi1, ub, tmat, tinv, penalty, correction)
804 DEALLOCATE(gi2, aprime, lambda, matx, pnorm_vec)
811 numDim,bufferSizes,numPointsBuffer,patchNormalDir,patchSizes, &
812 numPointsPatch,numPatchPointsOp,patchPointsOp,gridType, &
813 gridMetric,jacobianDeterminant,bcParams,gasParams, &
814 rhoBuffer,rhoVBuffer,rhoEBuffer,numscalar,scalarBuffer, &
815 rhoRHS,rhoVRHS,rhoERHS, scalarRHS,rhoTarget,rhoVTarget, &
816 rhoETarget,scalarTarget,muBuffer,lambdaBuffer)
820 INTEGER(KIND=4) :: numdim,numscalar,patchnormaldir,gridtype
821 INTEGER(KIND=8) :: numpointsbuffer,buffersizes(numdim)
822 INTEGER(KIND=8) :: patchsizes(numdim),numpointspatch
823 INTEGER(KIND=8) :: numpatchpointsop
824 INTEGER(KIND=8) :: patchpointsop(numpatchpointsop)
825 REAL(KIND=8) :: gridmetric(numdim*numdim*numpointsbuffer)
826 REAL(KIND=8) :: jacobiandeterminant(numpointsbuffer)
827 REAL(KIND=8) :: bcparams(4),gasparams(6)
828 REAL(KIND=8) :: rhobuffer(numpointsbuffer)
829 REAL(KIND=8) :: rhovbuffer(numdim*numpointsbuffer)
830 REAL(KIND=8) :: rhoebuffer(numpointsbuffer)
831 REAL(KIND=8) :: scalarbuffer(numscalar*numpointsbuffer)
832 REAL(KIND=8) :: rhorhs(numpointsbuffer)
833 REAL(KIND=8) :: rhovrhs(numdim*numpointsbuffer)
834 REAL(KIND=8) :: rhoerhs(numpointsbuffer)
835 REAL(KIND=8) :: scalarrhs(numscalar*numpointsbuffer)
836 REAL(KIND=8) :: rhotarget(numpointsbuffer)
837 REAL(KIND=8) :: rhovtarget(numdim*numpointsbuffer)
838 REAL(KIND=8) :: rhoetarget(numpointsbuffer)
839 REAL(KIND=8) :: scalartarget(numscalar*numpointsbuffer)
840 REAL(KIND=8) :: mubuffer(numpointsbuffer)
841 REAL(KIND=8) :: lambdabuffer(numpointsbuffer)
845 INTEGER(4) :: nd, nauxvars, jj, idim, idir
846 INTEGER(8) :: nc, l0, ipoint, pointindex, metricoffset
847 INTEGER(4) :: normdir, sgn
848 INTEGER(4) :: numdebugpoints, idebugpoint,debugpoints(6)
855 REAL(8) :: dsgn, sndspdref2, invtempref, tempref, gamref, spcgasconst
856 REAL(8) :: xi_x, xi_y, xi_z, xi_t, bndry_h,sbpboundaryweight, bcwalltemp
857 REAL(8) :: xi_x_tilde, xi_y_tilde, xi_z_tilde, gridjacobian
858 REAL(8) :: rhofac, penaltyfac, scalarpenaltyfac, scalardiff
860 REAL(8),
POINTER :: xix(:), bvelocity(:), vwall(:), vwalltarget(:), vtarget(:)
861 REAL(8) :: metricdata(9)
863 REAL(8),
POINTER :: pnorm_vec(:)
868 REAL(8),
POINTER :: lambda(:,:), gi1(:), ub(:), tinv(:,:), tmat(:,:)
870 REAL(8),
POINTER :: aprime(:,:), gi2(:), matx(:,:), penalty(:) ,correction(:)
873 REAL(8) :: norm_vec(3), gamma, ucon, ubaux, specrad, vdotxi, xh
874 REAL(8) :: sigmai1, sigmai2, sigmaaux, sfactor, ibfac_local, t_wall
875 REAL(8) :: spd_snd, re, reinv, sat_sigmai1, sat_sigmai2, pressuretarget
876 REAL(8) :: viscouspenaltyscale
916 normdir = abs(patchnormaldir)
917 sgn = normdir / patchnormaldir
930 gamref = gasparams(2)
931 spcgasconst= gasparams(3)
932 sndspdref2 = gasparams(5)*gasparams(5)
933 tempref = gasparams(4)
937 viscouspenaltyscale = gasparams(6)
941 sat_sigmai1 = bcparams(1)
942 sat_sigmai2 = bcparams(2)
943 bcwalltemp = bcparams(3)
944 sbpboundaryweight = bcparams(4)
952 ALLOCATE(xix(4),vwall(nd),bvelocity(nd),vwalltarget(nd),vtarget(nd))
953 ALLOCATE(gi1(nd+2), ub(nd+2), tmat(nd+2,nd+2), tinv(nd+2,nd+2), penalty(nd+2),correction(nd+2))
954 ALLOCATE(gi2(nd+2), aprime(nd+2,nd+2), lambda(nd+2,nd+2), matx(nd+2,nd+2), pnorm_vec(nd))
958 xix(normdir) = gridmetric(normdir)
960 gridjacobian = jacobiandeterminant(1)
962 metricoffset = (normdir-1)*numpointsbuffer
964 metricoffset = (normdir-1)*numdim*numpointsbuffer
980 debugpoints(1) = 91427
981 debugpoints(2) = 91428
982 debugpoints(3) = 91678
983 debugpoints(4) = 114268
984 debugpoints(5) = 114269
985 debugpoints(6) = 114018
988 DO ipoint = 1, numpatchpointsop
990 l0 = patchpointsop(ipoint) + 1
1008 xix(idir) = gridmetric(metricoffset + (idir-1)*numpointsbuffer +l0)
1010 gridjacobian = jacobiandeterminant(l0)
1012 xix(normdir) = gridmetric(metricoffset + l0)
1013 gridjacobian = jacobiandeterminant(l0)
1017 IF(numdim == 3)
THEN 1019 metricdata(1) = xix(1)
1020 metricdata(2) = xix(2)
1021 metricdata(3) = xix(3)
1022 metricdata(4:9) = 0.0_8
1026 IF(idir > 3) idir = idir - 3
1027 metricdata(4+(idir-1)) = gridmetric(idir)
1029 IF(idir > 3) idir = idir - 3
1030 metricdata(7+(idir-1)) = gridmetric(idir)
1033 IF(idir > 3) idir = idir - 3
1034 metricdata(4+(idir-1)) = gridmetric((idir-1)*numpointsbuffer+l0)
1036 IF(idir > 3) idir = idir - 3
1037 metricdata(7+(idir-1)) = gridmetric((idir-1)*numpointsbuffer+l0)
1040 IF(idir > 3) idir = idir - 3
1041 metricoffset = (idir-1)*numdim*numpointsbuffer
1042 metricdata(4) = gridmetric(metricoffset+l0)
1043 metricdata(5) = gridmetric(metricoffset+numpointsbuffer+l0)
1044 metricdata(6) = gridmetric(metricoffset+2*numpointsbuffer+l0)
1046 IF(idir > 3) idir = idir - 3
1047 metricoffset = (idir-1)*numdim*numpointsbuffer
1048 metricdata(7) = gridmetric(metricoffset+l0)
1049 metricdata(8) = gridmetric(metricoffset+numpointsbuffer+l0)
1050 metricdata(9) = gridmetric(metricoffset+2*numpointsbuffer+l0)
1054 xi_x = xix(1) * gridjacobian
1055 xi_y = xix(2) * gridjacobian
1056 xi_z = xix(3) * gridjacobian
1057 xi_t = xix(4) * gridjacobian
1060 xh = sqrt( (xi_x * xi_x) + (xi_y * xi_y) + (xi_z * xi_z) )
1061 bndry_h = 1.0_8 / xh
1062 xi_x_tilde = xi_x * bndry_h
1063 xi_y_tilde = xi_y * bndry_h
1064 xi_z_tilde = xi_z * bndry_h
1068 norm_vec(1:3) = (/ xi_x_tilde, xi_y_tilde, xi_z_tilde /)
1069 pnorm_vec(:) = norm_vec(1:nd) * xh
1072 sigmai1 = -sat_sigmai1 * dsgn
1079 ub(1) = rhobuffer(l0)
1082 ub(1+idim) = rhovbuffer(l0+(idim-1)*numpointsbuffer)
1083 bvelocity(idim) = rhovbuffer(l0+(idim-1)*numpointsbuffer)/rhobuffer(l0)
1085 vdotxi = vdotxi + bvelocity(idim)*norm_vec(idim)
1087 ub(numdim+2) = rhoebuffer(l0)
1089 vwall(1:numdim) = vdotxi*norm_vec(1:numdim)
1091 vwalltarget(1:numdim) = 0.0_8
1096 vtarget(idim) = bvelocity(idim) - ( vwall(idim) - vwalltarget(idim) )
1104 gi1(numdim+2) = ub(numdim+2)
1106 gi1(1+idim) = gi1(1) * vtarget(idim)
1107 gi1(numdim+2) = gi1(numdim+2) + 0.5_8*gi1(1)*(vtarget(idim)**2 - bvelocity(idim)**2)
1151 If ( sgn == 1 )
Then 1153 lambda(jj,jj) = max(lambda(jj,jj),0.0_8)
1154 specrad = max(abs(lambda(jj,jj)),abs(specrad))
1158 lambda(jj,jj) = min(lambda(jj,jj),0.0_8)
1159 specrad = max(abs(lambda(jj,jj)),abs(specrad))
1179 matx = matmul(lambda,tinv)
1182 aprime = matmul(tmat,matx)
1185 ub(1:nd+2) = ub(1:nd+2) - gi1(1:nd+2)
1188 gi2(1:nd+2) = matmul(aprime,ub)
1190 penaltyfac = sbpboundaryweight*sigmai1
1191 correction(:) = penaltyfac*gi2(:)
1210 rhorhs(l0) = rhorhs(l0) + ibfac_local * correction(1)
1212 pointindex = l0 + (idim-1)*numpointsbuffer
1213 rhovrhs(pointindex) = rhovrhs(pointindex) + ibfac_local*correction(1+idim)
1215 rhoerhs(l0) = rhoerhs(l0) + ibfac_local * correction(numdim+2)
1223 IF(numscalar > 0)
THEN 1224 If (dsgn * ucon > 0)
Then 1225 sfactor = -ucon * dsgn * ibfac_local * sbpboundaryweight
1226 Do jj = 1, numscalar
1227 pointindex = (jj-1)*numpointsbuffer + l0
1228 scalarrhs(pointindex) = scalarrhs(pointindex) + sfactor*scalarbuffer(pointindex)
1238 ub(1) = rhobuffer(l0)
1240 ub(1+idim) = rhovbuffer(l0+(idim-1)*numpointsbuffer)
1242 ub(numdim+2) = rhoebuffer(l0)
1247 t_wall = bcwalltemp / tempref
1251 gi2(1) = rhobuffer(l0)
1257 gi2(2:idim+1) = 0.0_8
1270 IF (t_wall < 0)
THEN 1271 gi2(numdim+2) = rhoetarget(l0)
1273 gi2(numdim+2) = gi2(1) * t_wall * spcgasconst / (gamref-1) &
1274 + 0.5_8 * sum(gi2(2:idim+1)**2) / gi2(1)
1280 sigmai2 = -sat_sigmai2
1284 penaltyfac = (sbpboundaryweight/bndry_h)**2*sigmai2/4.0_8 * &
1285 reinv*viscouspenaltyscale*max(mubuffer(l0),lambdabuffer(l0))/gi2(1)
1291 penalty(:) = penaltyfac * (ub(1:nd+2) - gi2(1:nd+2))
1297 rhorhs(l0) = rhorhs(l0) + ibfac_local * penalty(1)
1299 pointindex = l0 + (idim-1)*numpointsbuffer
1300 rhovrhs(pointindex) = rhovrhs(pointindex) + ibfac_local*penalty(1+idim)
1302 rhoerhs(l0) = rhoerhs(l0) + ibfac_local * penalty(numdim+2)
1330 DEALLOCATE(xix,vwall,bvelocity,vwalltarget,vtarget)
1331 DEALLOCATE(gi1, ub, tmat, tinv, penalty, correction)
1332 DEALLOCATE(gi2, aprime, lambda, matx, pnorm_vec)
1338 SUBROUTINE roe_mat(numDim,inCV,outCV, &
1339 gamma,normDir,tMat,tInv,lambda,status)
1343 INTEGER(4),
INTENT(IN) :: numdim
1344 REAL(8),
INTENT(IN) :: incv(numdim+2), outcv(numdim+2)
1345 REAL(8),
INTENT(IN) :: gamma, normdir(numdim)
1346 REAL(8),
INTENT(OUT) :: tmat((numdim+2)*(numdim+2)),tinv((numdim+2)*(numdim+2)),lambda(numdim+2)
1347 INTEGER(4),
INTENT(OUT) :: status
1349 REAL(8) :: gammam1,ucon,alpha,beta,phi2,theta,denomroe,xix,xiy,xiz
1350 REAL(8) :: xixtilde,xiytilde,xiztilde
1351 REAL(8) :: rhoin,rhov1in,rhov2in,rhov3in,rhom1in,rhoein
1352 REAL(8) :: rhoout,rhov1out,rhov2out,rhov3out,rhom1out,rhoeout
1353 REAL(8) :: inv1,inv2,inv3,outv1,outv2,outv3
1354 REAL(8) :: inke,inie,inp,inh
1355 REAL(8) :: outke,outie,outp,outh
1356 REAL(8) :: ccroe,bbroe,v1roe,v2roe,v3roe,hroe,keroe
1357 REAL(8) :: soundspeedroe
1362 IF(numdim == 1 .OR. numdim > 3)
THEN 1368 gammam1 = gamma - 1.0_8
1377 inv1 = rhom1in*rhov1in
1378 inv2 = rhom1in*rhov2in
1380 IF(numdim == 2)
THEN 1386 inv3 = rhom1in*rhov3in
1388 inke = 0.5_8 * (inv1**2 + inv2**2 + inv3**2)
1389 inie = rhom1in*rhoein - inke
1390 inp = gammam1*rhoin*inie
1391 inh = (gamma/gammam1)*inp/rhoin + inke
1398 rhom1out = 1.0/rhoout
1399 outv1 = rhom1out*rhov1out
1400 outv2 = rhom1out*rhov2out
1401 IF(numdim == 2)
THEN 1407 outv3 = rhom1out*rhov3out
1409 outke = 0.5_8 * (outv1**2 + outv2**2 + outv3**2)
1410 outie = rhom1out*rhoeout - outke
1411 outp = gammam1*rhoout*outie
1412 outh = (gamma/gammam1)*outp/rhoout + outke
1415 ccroe = sqrt(rhoout/rhoin)
1416 bbroe = 1.0_8 / (1.0_8 + ccroe)
1417 v1roe = (inv1 + outv1 * ccroe) * bbroe
1418 v2roe = (inv2 + outv2 * ccroe) * bbroe
1419 v3roe = (inv3 + outv3 * ccroe) * bbroe
1420 hroe = (inh + outh*ccroe)*bbroe
1421 keroe = 0.5_8 * (v1roe**2 + v2roe**2 + v3roe**2)
1423 IF((hroe - keroe) <= 0.0_8)
THEN 1424 write (*,
'(5(a,E20.8,1X))')
"gamma = ", gamma,
", inKE = ", inke,
", inIE = ", inie, &
1425 ", inP = ", inp,
", inH = ", inh
1430 soundspeedroe = sqrt(gammam1*(hroe - keroe))
1436 IF(numdim == 3) xiz = normdir(3)
1437 denomroe = 1.0_8 / sqrt(xix**2 + xiy**2 + xiz**2)
1438 xixtilde = xix * denomroe
1439 xiytilde = xiy * denomroe
1440 xiztilde = xiz * denomroe
1442 ucon = v1roe*xix + v2roe*xiy + v3roe*xiz
1445 alpha = 0.5_8*rhoin/soundspeedroe
1446 beta = 1.0_8/(rhoin*soundspeedroe)
1447 theta = xixtilde*v1roe + xiytilde*v2roe + xiztilde*v3roe
1448 phi2 = 0.5_8*(gammam1)*(v1roe**2 + v2roe**2 + v3roe**2)
1455 lambda(numdim+1) = ucon + soundspeedroe * sqrt(xix**2 + xiy**2 + xiz**2)
1456 lambda(numdim+2) = ucon - soundspeedroe * sqrt(xix**2 + xiy**2 + xiz**2)
1458 if (numdim == 2)
then 1463 tmat(4) = phi2/gammam1
1466 tmat(6) = xiytilde*rhoin
1467 tmat(7) = -xixtilde*rhoin
1468 tmat(8) = rhoin*(xiytilde*v1roe - xixtilde*v2roe)
1471 tmat(10) = alpha*(v1roe + xixtilde*soundspeedroe)
1472 tmat(11) = alpha*(v2roe + xiytilde*soundspeedroe)
1473 tmat(12) = alpha*((phi2 + soundspeedroe**2)/gammam1 + soundspeedroe*theta)
1476 tmat(14) = alpha*(v1roe - xixtilde*soundspeedroe)
1477 tmat(15) = alpha*(v2roe - xiytilde*soundspeedroe)
1478 tmat(16) = alpha*((phi2 + soundspeedroe**2)/gammam1 - soundspeedroe*theta)
1480 tinv(1) = 1.0_8 - phi2 / soundspeedroe**2
1481 tinv(2) = -(xiytilde * v1roe - xixtilde * v2roe) / rhoin
1482 tinv(3) = beta * (phi2 - soundspeedroe * theta)
1483 tinv(4) = beta * (phi2 + soundspeedroe * theta)
1485 tinv(5) = gammam1 * v1roe / soundspeedroe**2
1486 tinv(6) = xiytilde / rhoin
1487 tinv(7) = beta * (xixtilde * soundspeedroe - gammam1 * v1roe)
1488 tinv(8) = -beta * (xixtilde * soundspeedroe + gammam1 * v1roe)
1490 tinv(9) = gammam1 * v2roe / soundspeedroe**2
1491 tinv(10) = -xixtilde / rhoin
1492 tinv(11) = beta * (xiytilde * soundspeedroe - gammam1 * v2roe)
1493 tinv(12) = -beta * (xiytilde * soundspeedroe + gammam1 * v2roe)
1495 tinv(13) = -gammam1 / soundspeedroe**2
1497 tinv(15) = beta * gammam1
1498 tinv(16) = beta * gammam1
1500 ELSE IF (numdim == 3)
THEN 1504 tmat(2) = xixtilde * v1roe
1505 tmat(3) = xixtilde * v2roe + xiztilde * rhoin
1506 tmat(4) = xixtilde * v3roe - xiytilde * rhoin
1507 tmat(5) = xixtilde * phi2 / gammam1 + rhoin * (xiztilde * v2roe - xiytilde * v3roe)
1510 tmat(7) = xiytilde * v1roe - xiztilde * rhoin
1511 tmat(8) = xiytilde * v2roe
1512 tmat(9) = xiytilde * v3roe + xixtilde * rhoin
1513 tmat(10) = xiytilde * phi2 / gammam1 + rhoin * (xixtilde * v3roe - xiztilde * v1roe)
1516 tmat(12) = xiztilde * v1roe + xiytilde * rhoin
1517 tmat(13) = xiztilde * v2roe - xixtilde * rhoin
1518 tmat(14) = xiztilde * v3roe
1519 tmat(15) = xiztilde * phi2 / gammam1 + rhoin * (xiytilde * v1roe - xixtilde * v2roe)
1522 tmat(17) = alpha * (v1roe + xixtilde * soundspeedroe)
1523 tmat(18) = alpha * (v2roe + xiytilde * soundspeedroe)
1524 tmat(19) = alpha * (v3roe + xiztilde * soundspeedroe)
1525 tmat(20) = alpha * ((phi2 + soundspeedroe**2)/gammam1 + soundspeedroe * theta)
1528 tmat(22) = alpha * (v1roe - xixtilde * soundspeedroe)
1529 tmat(23) = alpha * (v2roe - xiytilde * soundspeedroe)
1530 tmat(24) = alpha * (v3roe - xiztilde * soundspeedroe)
1531 tmat(25) = alpha * ((phi2 + soundspeedroe**2)/gammam1 - soundspeedroe * theta)
1533 tinv(1) = xixtilde * (1.0_8 - phi2 / soundspeedroe**2) - (xiztilde * v2roe - xiytilde * v3roe) / rhoin
1534 tinv(2) = xiytilde * (1.0_8 - phi2 / soundspeedroe**2) - (xixtilde * v3roe - xiztilde * v1roe) / rhoin
1535 tinv(3) = xiztilde * (1.0_8 - phi2 / soundspeedroe**2) - (xiytilde * v1roe - xixtilde * v2roe) / rhoin
1536 tinv(4) = beta * (phi2 - soundspeedroe * theta)
1537 tinv(5) = beta * (phi2 + soundspeedroe * theta)
1539 tinv(6) = xixtilde * gammam1 * v1roe / soundspeedroe**2
1540 tinv(7) = -xiztilde / rhoin + xiytilde * gammam1 * v1roe / soundspeedroe**2
1541 tinv(8) = xiytilde / rhoin + xiztilde * gammam1 * v1roe / soundspeedroe**2
1542 tinv(9) = beta * (xixtilde * soundspeedroe - gammam1 * v1roe)
1543 tinv(10) = -beta * (xixtilde * soundspeedroe + gammam1 * v1roe)
1545 tinv(11) = xiztilde / rhoin + xixtilde * gammam1 * v2roe / soundspeedroe**2
1546 tinv(12) = xiytilde * gammam1 * v2roe / soundspeedroe**2
1547 tinv(13) = -xixtilde / rhoin + xiztilde * gammam1 * v2roe / soundspeedroe**2
1548 tinv(14) = beta * (xiytilde * soundspeedroe - gammam1 * v2roe)
1549 tinv(15) = -beta * (xiytilde * soundspeedroe + gammam1 * v2roe)
1551 tinv(16) = -xiytilde / rhoin + xixtilde * gammam1 * v3roe / soundspeedroe**2
1552 tinv(17) = xixtilde / rhoin + xiytilde * gammam1 * v3roe / soundspeedroe**2
1553 tinv(18) = xiztilde * gammam1 * v3roe / soundspeedroe**2
1554 tinv(19) = beta * (xiztilde * soundspeedroe - gammam1 * v3roe)
1555 tinv(20) = -beta * (xiztilde * soundspeedroe + gammam1 * v3roe)
1557 tinv(21) = -xixtilde * gammam1 / soundspeedroe**2
1558 tinv(22) = -xiytilde * gammam1 / soundspeedroe**2
1559 tinv(23) = -xiztilde * gammam1 / soundspeedroe**2
1560 tinv(24) = beta * gammam1
1561 tinv(25) = beta * gammam1
1577 Real(8),
Pointer :: u_in(:), u_out(:), tmat(:,:), tinv(:,:), norm(:), lambda(:,:)
1578 Real(8) :: gamma, rho_in, ux_in, uy_in, uz_in, ke_in, p_in, en_in, h_in
1579 Real(8) :: gm1, rho_out, ux_out, uy_out, uz_out, ke_out, p_out, en_out, h_out
1580 Real(8) :: cc, bb, ux_roe, uy_roe, uz_roe, h_roe, ke_roe, spd_snd_roe, t_roe, en_roe
1581 Real(8) :: xi_x_tilde, xi_y_tilde, xi_z_tilde, ucon, rho, alpha, theta, beta, phi2
1582 Real(8) :: xi_x, xi_y, xi_z, xi_t, denom, gamref, up, um
1584 Integer :: n, nd, jj, i, j, counter,ii
1585 Logical,
dimension(ND+2) :: bwork
1586 Integer,
dimension(ND+2) :: order
1589 CHARACTER(len=1) :: jobvl, jobvr
1590 INTEGER :: info, lda, ldvl, ldvr, lwork,m
1591 Real(8),
dimension(ND+2,ND+2) ::
a, vl, vr,b,lam, pmat
1592 Real(8),
dimension(ND+2) :: wi, wr
1593 Real(8),
dimension(300) :: work
1595 integer,
dimension(ND+2) :: ipiv
1625 ux_in = u_in(2) / rho_in; uy_in = 0.0_8; uz_in = 0.0_8
1626 if (nd >= 2) uy_in = u_in(3) / rho_in
1627 if (nd == 3) uz_in = u_in(4) / rho_in
1628 ke_in = 0.5_8 * (ux_in**2 + uy_in**2 + uz_in**2)
1629 en_in = u_in(nd+2)/rho_in - ke_in
1630 p_in = gm1 * rho_in * en_in
1631 h_in = (gamma / gm1) * p_in / rho_in + ke_in
1635 ux_out = u_out(2) / rho_out; uy_out = 0.0_8; uz_out = 0.0_8
1636 if (nd >= 2) uy_out = u_out(3) / rho_out
1637 if (nd == 3) uz_out = u_out(4) / rho_out
1638 ke_out = 0.5_8 * (ux_out**2 + uy_out**2 + uz_out**2)
1639 en_out = u_out(nd+2)/rho_out - ke_out
1640 p_out = gm1 * rho_out * en_out
1641 h_out = (gamma / gm1) * p_out / rho_out + ke_out
1644 cc = sqrt(rho_out / rho_in)
1645 bb = 1.0_8 / (1.0_8 + cc)
1646 ux_roe = (ux_in + ux_out * cc) * bb
1647 uy_roe = (uy_in + uy_out * cc) * bb
1648 uz_roe = (uz_in + uz_out * cc) * bb
1649 h_roe = ( h_in + h_out * cc) * bb
1650 ke_roe = 0.5_8 * (ux_roe**2 + uy_roe**2 + uz_roe**2)
1651 spd_snd_roe = sqrt(gamma/gamref * gm1*(h_roe - ke_roe))
1654 t_roe = gamma*(en_in + en_out * cc) * bb
1655 en_roe = t_roe/gamma
1658 xi_x = norm(1); xi_y = 0.0_8; xi_z = 0.0_8
1659 if (nd >= 2) xi_y = norm(2)
1660 if (nd == 3) xi_z = norm(3)
1661 denom = 1.0_8 / sqrt(xi_x**2 + xi_y**2 + xi_z**2)
1662 xi_x_tilde = xi_x * denom
1663 xi_y_tilde = xi_y * denom
1664 xi_z_tilde = xi_z * denom
1668 theta = xi_x * ux_roe + xi_y * uy_roe + xi_z * uz_roe
1669 phi2 = 0.5_8 * (gamma - 1.0_8) * (ux_roe**2 + uy_roe**2 + uz_roe**2)
1678 a(2,1) = xi_x * ( t_roe / gamref * (gamref - 1.0_8) - (gm1 * en_roe - phi2)) - theta * ux_roe
1679 a(2,2) = xi_t + theta - xi_x * (gamma - 2.0_8) * ux_roe
1680 a(2,3) = xi_y * ux_roe - gm1 * xi_x * uy_roe
1683 a(3,1) = xi_y * ( t_roe / gamref * (gamref - 1.0_8) - (gm1 * en_roe - phi2)) - theta * uy_roe
1684 a(3,2) = xi_x * uy_roe - gm1 * xi_y * ux_roe
1685 a(3,3) = xi_t + theta - xi_y * (gamma - 2.0_8) * uy_roe
1688 a(4,1) = theta * (2.0_8 * phi2 - gamma * (en_roe + ke_roe))
1689 a(4,2) = xi_x * (t_roe / gamref * (gamref - 1.0_8) + en_roe + phi2 / gm1 ) - gm1 * theta * ux_roe
1690 a(4,3) = xi_y * (t_roe / gamref * (gamref - 1.0_8) + en_roe + phi2 / gm1 ) - gm1 * theta * uy_roe
1691 a(4,4) = xi_t + gamma * theta
1693 else if (nd == 3)
then 1701 a(2,1) = xi_x * ( t_roe / gamref * (gamref - 1.0_8) - (gm1 * en_roe - phi2)) - theta * ux_roe
1702 a(2,2) = xi_t + theta - xi_x * (gamma - 2.0_8) * ux_roe
1703 a(2,3) = xi_y * ux_roe - gm1 * xi_x * uy_roe
1704 a(2,4) = xi_z * ux_roe - gm1 * xi_x * uz_roe
1707 a(3,1) = xi_y * ( t_roe / gamref * (gamref - 1.0_8) - (gm1 * en_roe - phi2)) - theta * uy_roe
1708 a(3,2) = xi_x * uy_roe - gm1 * xi_y * ux_roe
1709 a(3,3) = xi_t + theta - xi_y * (gamma - 2.0_8) * uy_roe
1710 a(3,4) = xi_z * uy_roe - gm1 * xi_y * uz_roe
1713 a(4,1) = xi_z * ( t_roe / gamref * (gamref - 1.0_8) - (gm1 * en_roe - phi2)) - theta * uz_roe
1714 a(4,2) = xi_x * uz_roe - gm1 * xi_z * ux_roe
1715 a(4,3) = xi_y * uz_roe - gm1 * xi_z * uy_roe
1716 a(4,4) = xi_t + theta - xi_z * (gamma - 2.0_8) * uz_roe
1719 a(5,1) = theta * (2.0_8 * phi2 - gamma * (en_roe + ke_roe))
1720 a(5,2) = xi_x * (t_roe / gamref * (gamref - 1.0_8) + en_roe + phi2 / gm1 ) - gm1 * theta * ux_roe
1721 a(5,3) = xi_y * (t_roe / gamref * (gamref - 1.0_8) + en_roe + phi2 / gm1 ) - gm1 * theta * uy_roe
1722 a(5,4) = xi_z * (t_roe / gamref * (gamref - 1.0_8) + en_roe + phi2 / gm1 ) - gm1 * theta * uz_roe
1723 a(5,5) = xi_t + gamma * theta
1738 ucon = ux_roe * xi_x + uy_roe * xi_y + uz_roe * xi_z
1739 up = ucon + 0.1_8 * spd_snd_roe * sqrt(xi_x**2 + xi_y**2 + xi_z**2)
1740 um = ucon - 0.1_8 * spd_snd_roe * sqrt(xi_x**2 + xi_y**2 + xi_z**2)
1746 if(wr(jj) .lt. up .and. wr(jj) .gt. um)
then 1748 counter = counter + 1
1749 lambda(counter,counter) = wr(jj)
1751 pmat(jj,counter) = 1.0_8
1752 elseif(wr(jj) .gt. ucon)
then 1753 lambda(nd+1,nd+1) = wr(jj)
1755 pmat(jj,nd+1) = 1.0_8
1756 elseif(wr(jj) .lt. ucon)
then 1757 lambda(nd+2,nd+2) = wr(jj)
1759 pmat(jj,nd+2) = 1.0_8
1763 tmat = matmul(vr,pmat)
1784 if(wi(i) .gt. tiny(wi(i)))
then 1785 tinv(i,i) = 1.0_8/wi(i)
1792 tinv = matmul(transpose(
a),tinv)
1793 tinv = matmul(tinv,transpose(vl))
1805 Real(8) :: u_in(nd+2), u_out(nd+2), tmat(nd+2,nd+2), tinv(nd+2,nd+2), norm(nd), lambda(nd+2,nd+2)
1806 Real(8) :: gamma, rho_in, ux_in, uy_in, uz_in, ke_in, p_in, en_in, h_in
1807 Real(8) :: gm1, rho_out, ux_out, uy_out, uz_out, ke_out, p_out, en_out, h_out
1808 Real(8) :: cc, bb, ux_roe, uy_roe, uz_roe, h_roe, ke_roe, spd_snd_roe
1809 Real(8) :: xi_x_tilde, xi_y_tilde, xi_z_tilde, ucon, rho, alpha, theta, beta, phi2
1810 Real(8) :: xi_x, xi_y, xi_z, denom
1811 Integer :: n, nd, jj
1821 ux_in = u_in(2) / rho_in; uy_in = 0.0_8; uz_in = 0.0_8
1822 if (nd >= 2) uy_in = u_in(3) / rho_in
1823 if (nd == 3) uz_in = u_in(4) / rho_in
1824 ke_in = 0.5_8 * (ux_in**2 + uy_in**2 + uz_in**2)
1825 en_in = u_in(nd+2)/rho_in - ke_in
1826 p_in = gm1 * rho_in * en_in
1827 h_in = (gamma / gm1) * p_in / rho_in + ke_in
1831 ux_out = u_out(2) / rho_out; uy_out = 0.0_8; uz_out = 0.0_8
1832 if (nd >= 2) uy_out = u_out(3) / rho_out
1833 if (nd == 3) uz_out = u_out(4) / rho_out
1834 ke_out = 0.5_8 * (ux_out**2 + uy_out**2 + uz_out**2)
1835 en_out = u_out(nd+2)/rho_out - ke_out
1836 p_out = gm1 * rho_out * en_out
1837 h_out = (gamma / gm1) * p_out / rho_out + ke_out
1840 cc = sqrt(rho_out / rho_in)
1841 bb = 1.0_8 / (1.0_8 + cc)
1842 ux_roe = (ux_in + ux_out * cc) * bb
1843 uy_roe = (uy_in + uy_out * cc) * bb
1844 uz_roe = (uz_in + uz_out * cc) * bb
1845 h_roe = ( h_in + h_out * cc) * bb
1846 ke_roe = 0.5_8 * (ux_roe**2 + uy_roe**2 + uz_roe**2)
1847 if (h_roe - ke_roe <= 0.0_8)
then 1849 write (*,
'(5(a,E20.8,1X))')
"SATUTIL:FORM_ROE_MATRICES: ERRONEOUS CONDITIONS: gamma = ", gamma,
", ke_in = ", &
1850 ke_in,
", en_in = ", en_in,
", p_in = ", p_in,
", h_in = ", h_in
1853 spd_snd_roe = sqrt(gm1*(h_roe - ke_roe))
1856 xi_x = norm(1); xi_y = 0.0_8; xi_z = 0.0_8
1857 if (nd >= 2) xi_y = norm(2)
1858 if (nd == 3) xi_z = norm(3)
1859 denom = 1.0_8 / sqrt(xi_x**2 + xi_y**2 + xi_z**2)
1860 xi_x_tilde = xi_x * denom
1861 xi_y_tilde = xi_y * denom
1862 xi_z_tilde = xi_z * denom
1866 ucon = ux_roe * xi_x + uy_roe * xi_y + uz_roe * xi_z
1871 alpha = 0.5_8 * rho / spd_snd_roe
1872 beta = 1.0_8 / (rho * spd_snd_roe)
1873 theta = xi_x_tilde * ux_roe + xi_y_tilde * uy_roe
1874 phi2 = 0.5_8 * (gamma - 1.0_8) * (ux_roe**2 + uy_roe**2)
1880 tmat(2,2) = xi_y_tilde * rho
1881 tmat(2,3) = alpha * (ux_roe + xi_x_tilde * spd_snd_roe)
1882 tmat(2,4) = alpha * (ux_roe - xi_x_tilde * spd_snd_roe)
1884 tmat(3,2) = -xi_x_tilde * rho
1885 tmat(3,3) = alpha * (uy_roe + xi_y_tilde * spd_snd_roe)
1886 tmat(3,4) = alpha * (uy_roe - xi_y_tilde * spd_snd_roe)
1887 tmat(4,1) = phi2 / (gamma - 1.0_8)
1888 tmat(4,2) = rho * (xi_y_tilde * ux_roe - xi_x_tilde * uy_roe)
1889 tmat(4,3) = alpha * ((phi2 + spd_snd_roe**2)/(gamma - 1.0_8) + spd_snd_roe * theta)
1890 tmat(4,4) = alpha * ((phi2 + spd_snd_roe**2)/(gamma - 1.0_8) - spd_snd_roe * theta)
1892 tinv(1,1) = 1.0_8 - phi2 / spd_snd_roe**2
1893 tinv(1,2) = (gamma - 1.0_8) * ux_roe / spd_snd_roe**2
1894 tinv(1,3) = (gamma - 1.0_8) * uy_roe / spd_snd_roe**2
1895 tinv(1,4) = -(gamma - 1.0_8) / spd_snd_roe**2
1896 tinv(2,1) = -(xi_y_tilde * ux_roe - xi_x_tilde * uy_roe) / rho
1897 tinv(2,2) = xi_y_tilde / rho
1898 tinv(2,3) = -xi_x_tilde / rho
1900 tinv(3,1) = beta * (phi2 - spd_snd_roe * theta)
1901 tinv(3,2) = beta * (xi_x_tilde * spd_snd_roe - (gamma - 1.0_8) * ux_roe)
1902 tinv(3,3) = beta * (xi_y_tilde * spd_snd_roe - (gamma - 1.0_8) * uy_roe)
1903 tinv(3,4) = beta * (gamma - 1.0_8)
1904 tinv(4,1) = beta * (phi2 + spd_snd_roe * theta)
1905 tinv(4,2) = -beta * (xi_x_tilde * spd_snd_roe + (gamma - 1.0_8) * ux_roe)
1906 tinv(4,3) = -beta * (xi_y_tilde * spd_snd_roe + (gamma - 1.0_8) * uy_roe)
1907 tinv(4,4) = beta * (gamma - 1.0_8)
1912 lambda(jj,jj) = ucon
1914 lambda(nd+1,nd+1) = ucon + spd_snd_roe * sqrt(xi_x**2 + xi_y**2)
1915 lambda(nd+2,nd+2) = ucon - spd_snd_roe * sqrt(xi_x**2 + xi_y**2)
1917 else if (nd == 3)
then 1920 alpha = 0.5_8 * rho / spd_snd_roe
1921 beta = 1.0_8 / (rho * spd_snd_roe)
1922 theta = xi_x_tilde * ux_roe + xi_y_tilde * uy_roe + xi_z_tilde * uz_roe
1923 phi2 = 0.5_8 * (gamma - 1.0_8) * (ux_roe**2 + uy_roe**2 + uz_roe**2)
1925 tmat(1,1) = xi_x_tilde
1926 tmat(1,2) = xi_y_tilde
1927 tmat(1,3) = xi_z_tilde
1930 tmat(2,1) = xi_x_tilde * ux_roe
1931 tmat(2,2) = xi_y_tilde * ux_roe - xi_z_tilde * rho
1932 tmat(2,3) = xi_z_tilde * ux_roe + xi_y_tilde * rho
1933 tmat(2,4) = alpha * (ux_roe + xi_x_tilde * spd_snd_roe)
1934 tmat(2,5) = alpha * (ux_roe - xi_x_tilde * spd_snd_roe)
1935 tmat(3,1) = xi_x_tilde * uy_roe + xi_z_tilde * rho
1936 tmat(3,2) = xi_y_tilde * uy_roe
1937 tmat(3,3) = xi_z_tilde * uy_roe - xi_x_tilde * rho
1938 tmat(3,4) = alpha * (uy_roe + xi_y_tilde * spd_snd_roe)
1939 tmat(3,5) = alpha * (uy_roe - xi_y_tilde * spd_snd_roe)
1940 tmat(4,1) = xi_x_tilde * uz_roe - xi_y_tilde * rho
1941 tmat(4,2) = xi_y_tilde * uz_roe + xi_x_tilde * rho
1942 tmat(4,3) = xi_z_tilde * uz_roe
1943 tmat(4,4) = alpha * (uz_roe + xi_z_tilde * spd_snd_roe)
1944 tmat(4,5) = alpha * (uz_roe - xi_z_tilde * spd_snd_roe)
1945 tmat(5,1) = xi_x_tilde * phi2 / (gamma - 1.0_8) + rho * (xi_z_tilde * uy_roe - xi_y_tilde * uz_roe)
1946 tmat(5,2) = xi_y_tilde * phi2 / (gamma - 1.0_8) + rho * (xi_x_tilde * uz_roe - xi_z_tilde * ux_roe)
1947 tmat(5,3) = xi_z_tilde * phi2 / (gamma - 1.0_8) + rho * (xi_y_tilde * ux_roe - xi_x_tilde * uy_roe)
1948 tmat(5,4) = alpha * ((phi2 + spd_snd_roe**2)/(gamma - 1.0_8) + spd_snd_roe * theta)
1949 tmat(5,5) = alpha * ((phi2 + spd_snd_roe**2)/(gamma - 1.0_8) - spd_snd_roe * theta)
1951 tinv(1,1) = xi_x_tilde * (1.0_8 - phi2 / spd_snd_roe**2) - (xi_z_tilde * uy_roe - xi_y_tilde * uz_roe) / rho
1952 tinv(1,2) = xi_x_tilde * (gamma - 1.0_8) * ux_roe / spd_snd_roe**2
1953 tinv(1,3) = xi_z_tilde / rho + xi_x_tilde * (gamma - 1.0_8) * uy_roe / spd_snd_roe**2
1954 tinv(1,4) = -xi_y_tilde / rho + xi_x_tilde * (gamma - 1.0_8) * uz_roe / spd_snd_roe**2
1955 tinv(1,5) = -xi_x_tilde * (gamma - 1.0_8) / spd_snd_roe**2
1956 tinv(2,1) = xi_y_tilde * (1.0_8 - phi2 / spd_snd_roe**2) - (xi_x_tilde * uz_roe - xi_z_tilde * ux_roe) / rho
1957 tinv(2,2) = -xi_z_tilde / rho + xi_y_tilde * (gamma - 1.0_8) * ux_roe / spd_snd_roe**2
1958 tinv(2,3) = xi_y_tilde * (gamma - 1.0_8) * uy_roe / spd_snd_roe**2
1959 tinv(2,4) = xi_x_tilde / rho + xi_y_tilde * (gamma - 1.0_8) * uz_roe / spd_snd_roe**2
1960 tinv(2,5) = -xi_y_tilde * (gamma - 1.0_8) / spd_snd_roe**2
1961 tinv(3,1) = xi_z_tilde * (1.0_8 - phi2 / spd_snd_roe**2) - (xi_y_tilde * ux_roe - xi_x_tilde * uy_roe) / rho
1962 tinv(3,2) = xi_y_tilde / rho + xi_z_tilde * (gamma - 1.0_8) * ux_roe / spd_snd_roe**2
1963 tinv(3,3) = -xi_x_tilde / rho + xi_z_tilde * (gamma - 1.0_8) * uy_roe / spd_snd_roe**2
1964 tinv(3,4) = xi_z_tilde * (gamma - 1.0_8) * uz_roe / spd_snd_roe**2
1965 tinv(3,5) = -xi_z_tilde * (gamma - 1.0_8) / spd_snd_roe**2
1966 tinv(4,1) = beta * (phi2 - spd_snd_roe * theta)
1967 tinv(4,2) = beta * (xi_x_tilde * spd_snd_roe - (gamma - 1.0_8) * ux_roe)
1968 tinv(4,3) = beta * (xi_y_tilde * spd_snd_roe - (gamma - 1.0_8) * uy_roe)
1969 tinv(4,4) = beta * (xi_z_tilde * spd_snd_roe - (gamma - 1.0_8) * uz_roe)
1970 tinv(4,5) = beta * (gamma - 1.0_8)
1971 tinv(5,1) = beta * (phi2 + spd_snd_roe * theta)
1972 tinv(5,2) = -beta * (xi_x_tilde * spd_snd_roe + (gamma - 1.0_8) * ux_roe)
1973 tinv(5,3) = -beta * (xi_y_tilde * spd_snd_roe + (gamma - 1.0_8) * uy_roe)
1974 tinv(5,4) = -beta * (xi_z_tilde * spd_snd_roe + (gamma - 1.0_8) * uz_roe)
1975 tinv(5,5) = beta * (gamma - 1.0_8)
1980 lambda(jj,jj) = ucon
1982 lambda(nd+1,nd+1) = ucon + spd_snd_roe * sqrt(xi_x**2 + xi_y**2 + xi_z**2)
1983 lambda(nd+2,nd+2) = ucon - spd_snd_roe * sqrt(xi_x**2 + xi_y**2 + xi_z**2)
1995 Real(8) :: u_in(nd+2), u_out(nd+2), tmat(nd+2,nd+2), norm(nd)
1996 REAL(8) :: metricData(9), tinv(nd+2,nd+2), lambda(nd+2,nd+2)
1997 Real(8) :: gamma, rho_in, ux_in, uy_in, uz_in, ke_in, p_in, en_in, h_in
1998 Real(8) :: gm1, rho_out, ux_out, uy_out, uz_out, ke_out, p_out, en_out, h_out
1999 Real(8) :: cc, bb, ux_Roe, uy_Roe, uz_Roe, h_Roe, ke_Roe, spd_snd_Roe
2000 Real(8) :: XI_X_TILDE, XI_Y_TILDE, XI_Z_TILDE, ucon, rho, alpha, theta, beta, phi2
2001 Real(8) :: XI_X, XI_Y, XI_Z, b1, b2, U2, denom
2002 Integer :: N, ND, jj, dir, i
2003 Real(8) :: uhat, vhat, what, k_x, k_y, k_z, l_x, l_y, l_z, m_x, m_y, m_z, ja
2013 ux_in = u_in(2) / rho_in; uy_in = 0.0_8; uz_in = 0.0_8
2014 if (nd >= 2) uy_in = u_in(3) / rho_in
2015 if (nd == 3) uz_in = u_in(4) / rho_in
2016 ke_in = 0.5_8 * (ux_in**2 + uy_in**2 + uz_in**2)
2017 en_in = u_in(nd+2)/rho_in - ke_in
2018 p_in = gm1 * rho_in * en_in
2019 h_in = (gamma / gm1) * p_in / rho_in + ke_in
2023 ux_out = u_out(2) / rho_out; uy_out = 0.0_8; uz_out = 0.0_8
2024 if (nd >= 2) uy_out = u_out(3) / rho_out
2025 if (nd == 3) uz_out = u_out(4) / rho_out
2026 ke_out = 0.5_8 * (ux_out**2 + uy_out**2 + uz_out**2)
2027 en_out = u_out(nd+2)/rho_out - ke_out
2028 p_out = gm1 * rho_out * en_out
2029 h_out = (gamma / gm1) * p_out / rho_out + ke_out
2032 cc = sqrt(rho_out / rho_in)
2033 bb = 1.0_8 / (1.0_8 + cc)
2034 ux_roe = (ux_in + ux_out * cc) * bb
2035 uy_roe = (uy_in + uy_out * cc) * bb
2036 uz_roe = (uz_in + uz_out * cc) * bb
2037 h_roe = ( h_in + h_out * cc) * bb
2038 ke_roe = 0.5_8 * (ux_roe**2 + uy_roe**2 + uz_roe**2)
2039 if (h_roe - ke_roe <= 0.0_8)
then 2041 write (*,
'(5(a,E20.8,1X))')
"SATUTIL:FORM_ROE_MATRICES: ERRONEOUS CONDITIONS: gamma = ", gamma,
", ke_in = ", &
2042 ke_in,
", en_in = ", en_in,
", p_in = ", p_in,
", h_in = ", h_in
2045 spd_snd_roe = sqrt(gm1*(h_roe - ke_roe))
2048 xi_x = norm(1); xi_y = 0.0_8; xi_z = 0.0_8
2049 if (nd >= 2) xi_y = norm(2)
2050 if (nd == 3) xi_z = norm(3)
2051 denom = 1.0_8 / sqrt(xi_x**2 + xi_y**2 + xi_z**2)
2052 xi_x_tilde = xi_x * denom
2053 xi_y_tilde = xi_y * denom
2054 xi_z_tilde = xi_z * denom
2058 ucon = ux_roe * xi_x + uy_roe * xi_y + uz_roe * xi_z
2063 alpha = 0.5_8 * rho / spd_snd_roe
2064 beta = 1.0_8 / (rho * spd_snd_roe)
2065 theta = xi_x_tilde * ux_roe + xi_y_tilde * uy_roe
2066 phi2 = 0.5_8 * (gamma - 1.0_8) * (ux_roe**2 + uy_roe**2)
2072 tmat(2,2) = xi_y_tilde * rho
2073 tmat(2,3) = alpha * (ux_roe + xi_x_tilde * spd_snd_roe)
2074 tmat(2,4) = alpha * (ux_roe - xi_x_tilde * spd_snd_roe)
2076 tmat(3,2) = -xi_x_tilde * rho
2077 tmat(3,3) = alpha * (uy_roe + xi_y_tilde * spd_snd_roe)
2078 tmat(3,4) = alpha * (uy_roe - xi_y_tilde * spd_snd_roe)
2079 tmat(4,1) = phi2 / (gamma - 1.0_8)
2080 tmat(4,2) = rho * (xi_y_tilde * ux_roe - xi_x_tilde * uy_roe)
2081 tmat(4,3) = alpha * ((phi2 + spd_snd_roe**2)/(gamma - 1.0_8) + spd_snd_roe * theta)
2082 tmat(4,4) = alpha * ((phi2 + spd_snd_roe**2)/(gamma - 1.0_8) - spd_snd_roe * theta)
2084 tinv(1,1) = 1.0_8 - phi2 / spd_snd_roe**2
2085 tinv(1,2) = (gamma - 1.0_8) * ux_roe / spd_snd_roe**2
2086 tinv(1,3) = (gamma - 1.0_8) * uy_roe / spd_snd_roe**2
2087 tinv(1,4) = -(gamma - 1.0_8) / spd_snd_roe**2
2088 tinv(2,1) = -(xi_y_tilde * ux_roe - xi_x_tilde * uy_roe) / rho
2089 tinv(2,2) = xi_y_tilde / rho
2090 tinv(2,3) = -xi_x_tilde / rho
2092 tinv(3,1) = beta * (phi2 - spd_snd_roe * theta)
2093 tinv(3,2) = beta * (xi_x_tilde * spd_snd_roe - (gamma - 1.0_8) * ux_roe)
2094 tinv(3,3) = beta * (xi_y_tilde * spd_snd_roe - (gamma - 1.0_8) * uy_roe)
2095 tinv(3,4) = beta * (gamma - 1.0_8)
2096 tinv(4,1) = beta * (phi2 + spd_snd_roe * theta)
2097 tinv(4,2) = -beta * (xi_x_tilde * spd_snd_roe + (gamma - 1.0_8) * ux_roe)
2098 tinv(4,3) = -beta * (xi_y_tilde * spd_snd_roe + (gamma - 1.0_8) * uy_roe)
2099 tinv(4,4) = beta * (gamma - 1.0_8)
2104 lambda(jj,jj) = ucon
2106 lambda(nd+1,nd+1) = ucon + spd_snd_roe * sqrt(xi_x**2 + xi_y**2)
2107 lambda(nd+2,nd+2) = ucon - spd_snd_roe * sqrt(xi_x**2 + xi_y**2)
2109 else if (nd == 3)
then 2117 k_x = metricdata(1); k_y= metricdata(2); k_z = metricdata(3)
2118 ja = dsqrt(k_x**2+k_y**2+k_z**2)
2119 k_x = k_x/ja; k_y = k_y/ja; k_z = k_z/ja
2121 l_x = metricdata(4); l_y= metricdata(5); l_z = metricdata(6)
2122 ja = dsqrt(l_x**2+l_y**2+l_z**2)
2123 l_x = l_x/ja; l_y = l_y/ja; l_z = l_z/ja
2125 m_x = metricdata(7); m_y= metricdata(8); m_z = metricdata(9)
2126 ja =dsqrt(m_x**2+m_y**2+m_z**2)
2127 m_x = m_x/ja; m_y = m_y/ja; m_z = m_z/ja
2129 u2 = ux_roe**2+uy_roe**2+uz_roe**2
2131 uhat = k_x * ux_roe + k_y * uy_roe + k_z * uz_roe
2132 vhat = l_x * ux_roe + l_y * uy_roe + l_z * uz_roe
2133 what = m_x * ux_roe + m_y * uy_roe + m_z * uz_roe
2135 alpha = rho / (2.0_8 * spd_snd_roe)
2143 tmat(2,2) = rho * l_x
2144 tmat(2,3) = rho * m_x
2145 tmat(2,4) = alpha * (ux_roe + spd_snd_roe * k_x)
2146 tmat(2,5) = alpha * (ux_roe - spd_snd_roe * k_x)
2148 tmat(3,2) = rho * l_y
2149 tmat(3,3) = rho * m_y
2150 tmat(3,4) = alpha * (uy_roe + spd_snd_roe * k_y)
2151 tmat(3,5) = alpha * (uy_roe - spd_snd_roe * k_y)
2153 tmat(4,2) = rho * l_z
2154 tmat(4,3) = rho * m_z
2155 tmat(4,4) = alpha * (uz_roe + spd_snd_roe * k_z)
2156 tmat(4,5) = alpha * (uz_roe - spd_snd_roe * k_z)
2157 tmat(5,1) = 0.5_8 * u2
2158 tmat(5,2) = rho * vhat
2159 tmat(5,3) = rho * what
2160 tmat(5,4) = alpha * (h_roe + spd_snd_roe * uhat)
2161 tmat(5,5) = alpha * (h_roe - spd_snd_roe * uhat)
2163 b1 = (gamma - 1.0_8) / spd_snd_roe**2
2164 b2 = 0.5_8 * (gamma - 1.0_8) * (ux_roe**2 + uy_roe**2 + uz_roe**2) / spd_snd_roe**2
2165 beta = 1.0_8 / (2.0_8 * alpha)
2166 tinv(1,1) = 1.0_8 - b2
2167 tinv(1,2) = b1 * ux_roe
2168 tinv(1,3) = b1 * uy_roe
2169 tinv(1,4) = b1 * uz_roe
2171 tinv(2,1) = -vhat/ rho
2172 tinv(2,2) = l_x/ rho
2173 tinv(2,3) = l_y/ rho
2174 tinv(2,4) = l_z/ rho
2176 tinv(3,1) = -what/ rho
2177 tinv(3,2) = m_x/ rho
2178 tinv(3,3) = m_y/ rho
2179 tinv(3,4) = m_z/ rho
2181 tinv(4,1) = beta * (b2 - uhat / spd_snd_roe)
2182 tinv(4,2) = -beta * (-k_x / spd_snd_roe + b1 * ux_roe)
2183 tinv(4,3) = -beta * (-k_y / spd_snd_roe + b1 * uy_roe)
2184 tinv(4,4) = -beta * (-k_z / spd_snd_roe + b1 * uz_roe)
2185 tinv(4,5) = beta * b1
2186 tinv(5,1) = beta * (b2 + uhat / spd_snd_roe)
2187 tinv(5,2) = -beta * (k_x / spd_snd_roe + b1 * ux_roe)
2188 tinv(5,3) = -beta * (k_y / spd_snd_roe + b1 * uy_roe)
2189 tinv(5,4) = -beta * (k_z / spd_snd_roe + b1 * uz_roe)
2190 tinv(5,5) = beta * b1
2203 lambda(jj,jj) = ucon
2205 lambda(nd+1,nd+1) = ucon + spd_snd_roe * dsqrt(xi_x**2 + xi_y**2 + xi_z**2)
2206 lambda(nd+2,nd+2) = ucon - spd_snd_roe * dsqrt(xi_x**2 + xi_y**2 + xi_z**2)
2213 sigmaDissipation,sigmaDilatation,dilatationRamp,dilatationCutoff, &
2218 INTEGER(KIND=4),
INTENT(IN) :: numDim
2219 INTEGER(KIND=8),
INTENT(IN) :: bufferSize(numdim), numPoints
2220 INTEGER(KIND=8),
INTENT(IN) :: bufferInterval(2*numdim)
2221 REAL(KIND=8),
INTENT(IN) :: sigmaDissipation,sigmaDilatation
2222 REAL(KIND=8),
INTENT(IN) :: dilatationRamp,dilatationCutoff
2223 REAL(KIND=8),
INTENT(IN) :: divV(numpoints)
2224 REAL(KIND=8),
INTENT(OUT) :: sigmaDiss(numpoints)
2226 INTEGER(KIND=8) :: I, J, K
2227 INTEGER(KIND=8) :: nPlane, zIndex, yIndex, yzIndex, bufferIndex, xSize
2228 INTEGER(KIND=8) :: iStart,iEnd,jStart,jEnd,kStart,kEnd
2230 istart = bufferinterval(1)
2231 iend = bufferinterval(2)
2232 xsize = buffersize(1)
2234 IF(numdim == 1)
THEN 2236 sigmadiss(i) = (sigmadissipation + &
2237 sigmadilatation*0.5_8*(1.0_8 + tanh(dilatationramp*(dilatationcutoff-divv(i)))))
2239 ELSE IF(numdim == 2)
THEN 2240 jstart = bufferinterval(3)
2241 jend = bufferinterval(4)
2243 yindex = (j-1)*xsize
2245 bufferindex = yindex + i
2246 sigmadiss(bufferindex) = (sigmadissipation + &
2247 sigmadilatation*0.5_8*(1.0_8 + tanh(dilatationramp*(dilatationcutoff-divv(bufferindex)))))
2250 ELSE IF(numdim == 3)
THEN 2251 jstart = bufferinterval(3)
2252 jend = bufferinterval(4)
2253 kstart = bufferinterval(5)
2254 kend = bufferinterval(6)
2255 nplane = xsize * buffersize(2)
2257 zindex = (k-1)*nplane
2259 yzindex = zindex + (j-1)*xsize
2261 bufferindex = yzindex + i
2262 sigmadiss(bufferindex) = (sigmadissipation + &
2263 sigmadilatation*0.5_8*(1.0_8 + tanh(dilatationramp*(dilatationcutoff-divv(bufferindex)))))
2278 Real(8),
Pointer :: u_in(:), u_out(:), tmat(:,:), tinv(:,:), norm(:), lambda(:,:), MT1(:)
2279 Real(8) :: gamma, rho_in, ux_in, uy_in, uz_in, ke_in, p_in, en_in, h_in
2280 Real(8) :: gm1, rho_out, ux_out, uy_out, uz_out, ke_out, p_out, en_out, h_out
2281 Real(8) :: cc, bb, ux_Roe, uy_Roe, uz_Roe, h_Roe, ke_Roe, spd_snd_Roe, rho_Roe
2282 Real(8) :: XI_X_TILDE, XI_Y_TILDE, XI_Z_TILDE, ucon, rho, alpha, theta, beta, phi2
2283 Real(8) :: XI_X, XI_Y, XI_Z, denom, b1, b2, U2
2284 Integer :: N, ND, jj, dir, i
2285 Real(8) :: uhat, vhat, what, k_x, k_y, k_z, l_x, l_y, l_z, m_x, m_y, m_z, ja
2294 ux_in = u_in(2) / rho_in
2297 if (nd >= 2) uy_in = u_in(3) / rho_in
2298 if (nd == 3) uz_in = u_in(4) / rho_in
2300 ke_in = 0.5_8 * (ux_in**2 + uy_in**2 + uz_in**2)
2301 en_in = u_in(nd+2)/rho_in - ke_in
2302 p_in = gm1 * rho_in * en_in
2303 h_in = (gamma / gm1) * p_in / rho_in + ke_in
2306 ux_out = u_out(2) / rho_out
2309 if (nd >= 2) uy_out = u_out(3) / rho_out
2310 if (nd == 3) uz_out = u_out(4) / rho_out
2312 ke_out = 0.5_8 * (ux_out**2 + uy_out**2 + uz_out**2)
2313 en_out = u_out(nd+2)/rho_out - ke_out
2314 p_out = gm1 * rho_out * en_out
2315 h_out = (gamma / gm1) * p_out / rho_out + ke_out
2318 cc = sqrt(rho_out / rho_in)
2319 bb = 1.0_8 / (1.0_8 + cc)
2320 ux_roe = (ux_in + ux_out * cc) * bb
2321 uy_roe = (uy_in + uy_out * cc) * bb
2322 uz_roe = (uz_in + uz_out * cc) * bb
2323 h_roe = ( h_in + h_out * cc) * bb
2324 ke_roe = 0.5_8 * (ux_roe**2 + uy_roe**2 + uz_roe**2)
2326 if (h_roe - ke_roe <= 0.0_8)
then 2327 write (*,
'(5(a,E20.8,1X))')
"gamma = ", gamma,
", ke_in = ", ke_in,
", en_in = ", en_in, &
2328 ", p_in = ", p_in,
", h_in = ", h_in
2332 spd_snd_roe = sqrt(gm1*(h_roe - ke_roe))
2333 rho_roe = rho_in * cc
2336 xi_x = norm(1); xi_y = 0.0_8; xi_z = 0.0_8
2337 if (nd >= 2) xi_y = norm(2)
2338 if (nd == 3) xi_z = norm(3)
2339 denom = 1.0_8 / sqrt(xi_x**2 + xi_y**2 + xi_z**2)
2340 xi_x_tilde = xi_x * denom
2341 xi_y_tilde = xi_y * denom
2342 xi_z_tilde = xi_z * denom
2346 ucon = ux_roe * xi_x + uy_roe * xi_y + uz_roe * xi_z
2352 alpha = 0.5_8 * rho / spd_snd_roe
2353 beta = 1.0_8 / (rho * spd_snd_roe)
2354 alpha = rho / (sqrt(2.0_8) * spd_snd_roe)
2355 beta = 1.0_8 / (sqrt(2.0_8) * rho * spd_snd_roe)
2356 theta = xi_x_tilde * ux_roe + xi_y_tilde * uy_roe
2357 phi2 = 0.5_8 * (gamma - 1.0_8) * (ux_roe**2 + uy_roe**2)
2364 tmat(2,2) = xi_y_tilde * rho
2365 tmat(2,3) = alpha * (ux_roe + xi_x_tilde * spd_snd_roe)
2366 tmat(2,4) = alpha * (ux_roe - xi_x_tilde * spd_snd_roe)
2368 tmat(3,2) = -xi_x_tilde * rho
2369 tmat(3,3) = alpha * (uy_roe + xi_y_tilde * spd_snd_roe)
2370 tmat(3,4) = alpha * (uy_roe - xi_y_tilde * spd_snd_roe)
2371 tmat(4,1) = phi2 / (gamma - 1.0_8)
2372 tmat(4,2) = rho * (xi_y_tilde * ux_roe - xi_x_tilde * uy_roe)
2373 tmat(4,3) = alpha * ((phi2 + spd_snd_roe**2)/(gamma - 1.0_8) + spd_snd_roe * theta)
2374 tmat(4,4) = alpha * ((phi2 + spd_snd_roe**2)/(gamma - 1.0_8) - spd_snd_roe * theta)
2376 tinv(1,1) = 1.0_8 - phi2 / spd_snd_roe**2
2377 tinv(1,2) = (gamma - 1.0_8) * ux_roe / spd_snd_roe**2
2378 tinv(1,3) = (gamma - 1.0_8) * uy_roe / spd_snd_roe**2
2379 tinv(1,4) = -(gamma - 1.0_8) / spd_snd_roe**2
2380 tinv(2,1) = -(xi_y_tilde * ux_roe - xi_x_tilde * uy_roe) / rho
2381 tinv(2,2) = xi_y_tilde / rho
2382 tinv(2,3) = -xi_x_tilde / rho
2384 tinv(3,1) = beta * (phi2 - spd_snd_roe * theta)
2385 tinv(3,2) = beta * (xi_x_tilde * spd_snd_roe - (gamma - 1.0_8) * ux_roe)
2386 tinv(3,3) = beta * (xi_y_tilde * spd_snd_roe - (gamma - 1.0_8) * uy_roe)
2387 tinv(3,4) = beta * (gamma - 1.0_8)
2388 tinv(4,1) = beta * (phi2 + spd_snd_roe * theta)
2389 tinv(4,2) = -beta * (xi_x_tilde * spd_snd_roe + (gamma - 1.0_8) * ux_roe)
2390 tinv(4,3) = -beta * (xi_y_tilde * spd_snd_roe + (gamma - 1.0_8) * uy_roe)
2391 tinv(4,4) = beta * (gamma - 1.0_8)
2396 lambda(jj,jj) = ucon
2398 lambda(nd+1,nd+1) = ucon + spd_snd_roe * sqrt(xi_x**2 + xi_y**2)
2399 lambda(nd+2,nd+2) = ucon - spd_snd_roe * sqrt(xi_x**2 + xi_y**2)
2402 else if (nd == 3)
then 2411 k_x = mt1(1); k_y= mt1(2); k_z = mt1(3)
2412 ja = dsqrt(k_x**2+k_y**2+k_z**2)
2413 k_x = k_x/ja; k_y = k_y/ja; k_z = k_z/ja
2415 l_x = mt1(4); l_y= mt1(5); l_z = mt1(6)
2416 ja = dsqrt(l_x**2+l_y**2+l_z**2)
2417 l_x = l_x/ja; l_y = l_y/ja; l_z = l_z/ja
2419 m_x = mt1(7); m_y= mt1(8); m_z = mt1(9)
2420 ja =dsqrt(m_x**2+m_y**2+m_z**2)
2421 m_x = m_x/ja; m_y = m_y/ja; m_z = m_z/ja
2453 u2 = ux_roe**2+uy_roe**2+uz_roe**2
2455 uhat = k_x * ux_roe + k_y * uy_roe + k_z * uz_roe
2456 vhat = l_x * ux_roe + l_y * uy_roe + l_z * uz_roe
2457 what = m_x * ux_roe + m_y * uy_roe + m_z * uz_roe
2459 alpha = rho / (2.0_8 * spd_snd_roe)
2467 tmat(2,2) = rho * l_x
2468 tmat(2,3) = rho * m_x
2469 tmat(2,4) = alpha * (ux_roe + spd_snd_roe * k_x)
2470 tmat(2,5) = alpha * (ux_roe - spd_snd_roe * k_x)
2472 tmat(3,2) = rho * l_y
2473 tmat(3,3) = rho * m_y
2474 tmat(3,4) = alpha * (uy_roe + spd_snd_roe * k_y)
2475 tmat(3,5) = alpha * (uy_roe - spd_snd_roe * k_y)
2477 tmat(4,2) = rho * l_z
2478 tmat(4,3) = rho * m_z
2479 tmat(4,4) = alpha * (uz_roe + spd_snd_roe * k_z)
2480 tmat(4,5) = alpha * (uz_roe - spd_snd_roe * k_z)
2481 tmat(5,1) = 0.5_8 * u2
2482 tmat(5,2) = rho * vhat
2483 tmat(5,3) = rho * what
2484 tmat(5,4) = alpha * (h_roe + spd_snd_roe * uhat)
2485 tmat(5,5) = alpha * (h_roe - spd_snd_roe * uhat)
2487 b1 = (gamma - 1.0_8) / spd_snd_roe**2
2488 b2 = 0.5_8 * (gamma - 1.0_8) * (ux_roe**2 + uy_roe**2 + uz_roe**2) / spd_snd_roe**2
2489 beta = 1.0_8 / (2.0_8 * alpha)
2490 tinv(1,1) = 1.0_8 - b2
2491 tinv(1,2) = b1 * ux_roe
2492 tinv(1,3) = b1 * uy_roe
2493 tinv(1,4) = b1 * uz_roe
2495 tinv(2,1) = -vhat/ rho
2496 tinv(2,2) = l_x/ rho
2497 tinv(2,3) = l_y/ rho
2498 tinv(2,4) = l_z/ rho
2500 tinv(3,1) = -what/ rho
2501 tinv(3,2) = m_x/ rho
2502 tinv(3,3) = m_y/ rho
2503 tinv(3,4) = m_z/ rho
2505 tinv(4,1) = beta * (b2 - uhat / spd_snd_roe)
2506 tinv(4,2) = -beta * (-k_x / spd_snd_roe + b1 * ux_roe)
2507 tinv(4,3) = -beta * (-k_y / spd_snd_roe + b1 * uy_roe)
2508 tinv(4,4) = -beta * (-k_z / spd_snd_roe + b1 * uz_roe)
2509 tinv(4,5) = beta * b1
2510 tinv(5,1) = beta * (b2 + uhat / spd_snd_roe)
2511 tinv(5,2) = -beta * (k_x / spd_snd_roe + b1 * ux_roe)
2512 tinv(5,3) = -beta * (k_y / spd_snd_roe + b1 * uy_roe)
2513 tinv(5,4) = -beta * (k_z / spd_snd_roe + b1 * uz_roe)
2514 tinv(5,5) = beta * b1
2527 lambda(jj,jj) = ucon
2529 lambda(nd+1,nd+1) = ucon + spd_snd_roe * dsqrt(xi_x**2 + xi_y**2 + xi_z**2)
2530 lambda(nd+2,nd+2) = ucon - spd_snd_roe * dsqrt(xi_x**2 + xi_y**2 + xi_z**2)
2537 nAuxVars, gamma, tmat, tinv, lambda)
2544 Real(8),
Pointer :: u_in(:), u_out(:), tmat(:,:), tinv(:,:), lambda(:,:), MT1(:)
2545 Real(8) :: gamma, rho_in, ux_in, uy_in, uz_in, ke_in, p_in, en_in, H_in, JAC
2546 Real(8) :: gm1, rho_out, ux_out, uy_out, uz_out, ke_out, p_out, en_out, H_out
2547 Real(8) :: cc, bb, ux_Roe, uy_Roe, uz_Roe, h_Roe, en_Roe, ke_Roe, spd_snd_Roe, rho_Roe
2548 Real(8) :: XI_X_TILDE, XI_Y_TILDE, XI_Z_TILDE, rho, alpha, theta, beta, phi2
2549 Real(8) :: XI_X, XI_Y, XI_Z, denom
2550 Integer :: N,ND,jj,nAuxVars,dir
2552 Real(8) :: Y_in(nauxvars),Y_out(nauxvars),ja,Residual,dp_drho_ROE,dp_de_ROE,dp_drhoY_ROE(nauxvars)
2553 Real(8) :: z_Roe(nauxvars),Y_ROE(nauxvars),u_ref,b1,b2,b3,dp_drho_bar,dp_de_bar,dp_drhoY_bar(nauxvars)
2554 Real(8) :: metric_vec(3),p_ROE,temp_ROE,junk
2555 real(8),
pointer :: pnorm_vec(:)
2556 Real(8) :: uhat, vhat, what, k_x, k_y, k_z, l_x, l_y, l_z, m_x, m_y, m_z
2559 If (nauxvars == 0)
then 2562 allocate(pnorm_vec(nd))
2563 xi_x = mt1(dir) * jac
2564 xi_y = mt1(dir+nd) * jac
2567 xi_z = mt1(dir+2*nd) *jac
2569 metric_vec = (/ xi_x, xi_y, xi_z /)
2570 pnorm_vec(:) = metric_vec(1:nd)
2574 deallocate(pnorm_vec)
2577 elseif (nauxvars > 0)
then 2580 ux_in = u_in(2) / rho_in
2581 uy_in = u_in(3) / rho_in
2583 if (nd == 3) uz_in = u_in(4) / rho_in
2584 ke_in = 0.5_8 * (ux_in**2 + uy_in**2 + uz_in**2)
2585 en_in = u_in(nd+2)/rho_in - ke_in
2586 h_in = (u_in(nd+2)+p_in) / rho_in
2589 y_in(jj) = u_in(nd+2+jj)/ rho_in
2594 ux_out = u_out(2) / rho_out
2595 uy_out = u_out(3) / rho_out
2597 if (nd == 3) uz_out = u_out(4) / rho_out
2598 ke_out = 0.5_8 * (ux_out**2 + uy_out**2 + uz_out**2)
2599 en_out = u_out(nd+2)/rho_out - ke_out
2600 h_out = (u_out(nd+2)+p_out) / rho_out
2603 y_out(jj) = u_out(nd+2+jj)/ rho_out
2607 cc = sqrt(rho_out / rho_in)
2608 bb = 1.0_8 / (1.0_8 + cc)
2609 ux_roe = (ux_in + ux_out * cc) * bb
2610 uy_roe = (uy_in + uy_out * cc) * bb
2611 uz_roe = (uz_in + uz_out * cc) * bb
2612 h_roe = ( h_in + h_out * cc) * bb
2613 en_roe = ( en_in + en_out * cc) * bb
2614 ke_roe = 0.5_8 * (ux_roe**2 + uy_roe**2 + uz_roe**2)
2615 rho_roe = rho_in * cc
2617 y_roe(jj) = (y_in(jj) + y_out(jj) * cc) * bb
2621 xi_x = mt1(dir) * jac
2622 xi_y = mt1(dir+nd) * jac
2625 xi_z = mt1(dir+2*nd) *jac
2627 denom = 1.0_8 / dsqrt(xi_x**2 + xi_y**2 + xi_z**2)
2628 xi_x_tilde = xi_x * denom
2629 xi_y_tilde = xi_y * denom
2630 xi_z_tilde = xi_z * denom
2634 CALL pderivative_roe(rho,en_roe,y_roe,u_ref,nauxvars,dp_drho_bar,dp_de_bar,dp_drhoy_bar)
2636 residual = (p_out-p_in)-(dp_drho_bar*(rho_out-rho_in)+dp_de_bar*(en_out-en_in))
2638 residual = residual - dp_drhoy_bar(jj) * (u_out(nd+2+jj)-u_in(nd+2+jj))
2641 ja = (dp_de_bar*(en_out-en_in))**2 + (dp_drho_bar*(rho_out-rho_in))**2
2643 ja = ja + (dp_drhoy_bar(jj)*(u_out(nd+2+jj)-u_in(nd+2+jj)))**2
2646 If (residual == 0.0_8.or.ja<1d-13)
then 2647 dp_de_roe = dp_de_bar
2648 dp_drho_roe = dp_drho_bar
2649 dp_drhoy_roe = dp_drhoy_bar
2651 dp_de_roe = dp_de_bar * (1.0_8+dp_de_bar*(en_out-en_in)/ja*residual)
2652 dp_drho_roe = dp_drho_bar * (1.0_8+dp_drho_bar*(rho_out-rho_in)/ja*residual)
2654 dp_drhoy_roe(jj) = dp_drhoy_bar(jj) * (1.0_8+dp_drhoy_bar(jj)*(u_out(nd+2+jj)-u_in(nd+2+jj))/ja*residual)
2659 z_roe(jj) = -rho * dp_drhoy_roe(jj)/ dp_de_roe
2662 spd_snd_roe = dp_drho_roe + dp_de_roe/ rho * (h_roe -en_roe -ke_roe)
2664 spd_snd_roe = spd_snd_roe + y_roe(jj) * dp_drhoy_roe(jj)
2666 spd_snd_roe = dsqrt(spd_snd_roe)
2668 b1 = dp_de_roe / rho / spd_snd_roe**2
2669 b2 = 1.0_8 + b1 * (ux_roe**2 + uy_roe**2 + uz_roe**2) - b1 * h_roe
2672 b3 = b3 + y_roe(jj)* z_roe(jj)
2676 theta = xi_x_tilde * ux_roe + xi_y_tilde * uy_roe + xi_z_tilde * uz_roe
2677 tmat =0.0_8; tinv = 0.0_8
2681 alpha = rho / (sqrt(2.0_8) * spd_snd_roe)
2682 beta = 1.0_8 / (sqrt(2.0_8) * rho * spd_snd_roe)
2689 tmat(2,2) = xi_y_tilde * rho
2690 tmat(2,3) = alpha * (ux_roe + xi_x_tilde * spd_snd_roe)
2691 tmat(2,4) = alpha * (ux_roe - xi_x_tilde * spd_snd_roe)
2693 tmat(3,2) = -xi_x_tilde * rho
2694 tmat(3,3) = alpha * (uy_roe + xi_y_tilde * spd_snd_roe)
2695 tmat(3,4) = alpha * (uy_roe - xi_y_tilde * spd_snd_roe)
2696 tmat(4,1) = h_roe - rho * spd_snd_roe**2 / dp_de_roe
2697 tmat(4,2) = rho * (xi_y_tilde * ux_roe - xi_x_tilde * uy_roe)
2698 tmat(4,3) = alpha * (h_roe + spd_snd_roe * theta)
2699 tmat(4,4) = alpha * (h_roe - spd_snd_roe * theta)
2702 tmat(4,4+jj) = z_roe(jj)
2703 tmat(4+jj,1) = y_roe(jj)
2704 tmat(4+jj,3) = alpha * y_roe(jj)
2705 tmat(4+jj,4) = alpha * y_roe(jj)
2706 tmat(4+jj,4+jj) = 1.0_8
2709 tinv(1,1) = 1.0_8 - b2 - b3
2710 tinv(1,2) = b1 * ux_roe
2711 tinv(1,3) = b1 * uy_roe
2713 tinv(2,1) = -(xi_y_tilde * ux_roe - xi_x_tilde * uy_roe) / rho
2714 tinv(2,2) = xi_y_tilde / rho
2715 tinv(2,3) = -xi_x_tilde / rho
2716 tinv(3,1) = beta * spd_snd_roe**2 * (b2 + b3 - theta / spd_snd_roe)
2717 tinv(3,2) = beta * spd_snd_roe * (xi_x_tilde - b1 * ux_roe * spd_snd_roe)
2718 tinv(3,3) = beta * spd_snd_roe * (xi_y_tilde - b1 * uy_roe * spd_snd_roe)
2719 tinv(3,4) = beta * b1 * spd_snd_roe**2
2720 tinv(4,1) = beta * spd_snd_roe**2 * (b2 + b3 + theta / spd_snd_roe)
2721 tinv(4,2) = -beta * spd_snd_roe * (xi_x_tilde + b1 * ux_roe * spd_snd_roe)
2722 tinv(4,3) = -beta * spd_snd_roe * (xi_y_tilde + b1 * uy_roe * spd_snd_roe)
2723 tinv(4,4) = beta * b1 * spd_snd_roe**2
2726 tinv(1,4+jj) = b1 * z_roe(jj)
2727 tinv(3,4+jj) = -beta * b1 * spd_snd_roe**2 * z_roe(jj)
2728 tinv(4,4+jj) = -beta * b1 * spd_snd_roe**2 * z_roe(jj)
2729 tinv(4+jj,1) = -y_roe(jj)
2730 tinv(4+jj,4+jj) = 1.0_8
2736 lambda(jj,jj) = theta
2738 lambda(nd+1,nd+1) = theta + spd_snd_roe * dsqrt(xi_x**2 + xi_y**2)
2739 lambda(nd+2,nd+2) = theta - spd_snd_roe * dsqrt(xi_x**2 + xi_y**2)
2741 lambda(4+jj,4+jj) = theta
2744 elseif (nd ==3)
then 2750 k_x = mt1(1)*jac; k_y= mt1(4)*jac; k_z = mt1(7)*jac
2751 ja = dsqrt(k_x**2+k_y**2+k_z**2)
2752 k_x = k_x/ja; k_y = k_y/ja; k_z = k_z/ja
2754 l_x = mt1(2)*jac; l_y= mt1(5)*jac; l_z = mt1(8)*jac
2755 ja = dsqrt(l_x**2+l_y**2+l_z**2)
2756 l_x = l_x/ja; l_y = l_y/ja; l_z = l_z/ja
2758 m_x = mt1(3)*jac; m_y= mt1(6)*jac; m_z = mt1(9)*jac
2759 ja =dsqrt(m_x**2+m_y**2+m_z**2)
2760 m_x = m_x/ja; m_y = m_y/ja; m_z = m_z/ja
2762 elseif (dir==2)
then 2763 l_x = mt1(1)*jac; l_y= mt1(4)*jac; l_z = mt1(7)*jac
2764 ja = dsqrt(l_x**2+l_y**2+l_z**2)
2765 l_x = l_x/ja; l_y = l_y/ja; l_z = l_z/ja
2767 k_x = mt1(2)*jac; k_y= mt1(5)*jac; k_z = mt1(8)*jac
2768 ja = dsqrt(k_x**2+k_y**2+k_z**2)
2769 k_x = k_x/ja; k_y = k_y/ja; k_z = k_z/ja
2771 m_x = mt1(3)*jac; m_y= mt1(6)*jac; m_z = mt1(9)*jac
2772 ja =dsqrt(m_x**2+m_y**2+m_z**2)
2773 m_x = m_x/ja; m_y = m_y/ja; m_z = m_z/ja
2775 elseif (dir==3)
then 2776 m_x = mt1(1)*jac; m_y= mt1(4)*jac; m_z = mt1(7)*jac
2777 ja = dsqrt(m_x**2+m_y**2+m_z**2)
2778 m_x = m_x/ja; m_y = m_y/ja; m_z = m_z/ja
2780 l_x = mt1(2)*jac; l_y= mt1(5)*jac; l_z = mt1(8)*jac
2781 ja = dsqrt(l_x**2+l_y**2+l_z**2)
2782 l_x = l_x/ja; l_y = l_y/ja; l_z = l_z/ja
2784 k_x = mt1(3)*jac; k_y= mt1(6)*jac; k_z = mt1(9)*jac
2785 ja =dsqrt(k_x**2+k_y**2+k_z**2)
2786 k_x = k_x/ja; k_y = k_y/ja; k_z = k_z/ja
2790 uhat = k_x * ux_roe + k_y * uy_roe + k_z * uz_roe
2791 vhat = l_x * ux_roe + l_y * uy_roe + l_z * uz_roe
2792 what = m_x * ux_roe + m_y * uy_roe + m_z * uz_roe
2794 alpha = rho / (2.0_8 * spd_snd_roe)
2802 tmat(2,2) = rho * l_x
2803 tmat(2,3) = rho * m_x
2804 tmat(2,4) = alpha * (ux_roe + spd_snd_roe * k_x)
2805 tmat(2,5) = alpha * (ux_roe - spd_snd_roe * k_x)
2807 tmat(3,2) = rho * l_y
2808 tmat(3,3) = rho * m_y
2809 tmat(3,4) = alpha * (uy_roe + spd_snd_roe * k_y)
2810 tmat(3,5) = alpha * (uy_roe - spd_snd_roe * k_y)
2812 tmat(4,2) = rho * l_z
2813 tmat(4,3) = rho * m_z
2814 tmat(4,4) = alpha * (uz_roe + spd_snd_roe * k_z)
2815 tmat(4,5) = alpha * (uz_roe - spd_snd_roe * k_z)
2816 tmat(5,1) = h_roe - 1.0_8 / b1
2817 tmat(5,2) = rho * vhat
2818 tmat(5,3) = rho * what
2819 tmat(5,4) = alpha * (h_roe + spd_snd_roe * uhat)
2820 tmat(5,5) = alpha * (h_roe - spd_snd_roe * uhat)
2823 tmat(5,5+jj) = z_roe(jj)
2824 tmat(5+jj,1) = y_roe(jj)
2825 tmat(5+jj,4) = alpha * y_roe(jj)
2826 tmat(5+jj,5) = alpha * y_roe(jj)
2827 tmat(5+jj,5+jj) = 1.0_8
2830 beta = 1.0_8 / (2.0_8 * alpha)
2831 tinv(1,1) = 1.0_8 - b2 -b3
2832 tinv(1,2) = b1 * ux_roe
2833 tinv(1,3) = b1 * uy_roe
2834 tinv(1,4) = b1 * uz_roe
2836 tinv(2,1) = -vhat/ rho
2837 tinv(2,2) = l_x/ rho
2838 tinv(2,3) = l_y/ rho
2839 tinv(2,4) = l_z/ rho
2841 tinv(3,1) = -what/ rho
2842 tinv(3,2) = m_x/ rho
2843 tinv(3,3) = m_y/ rho
2844 tinv(3,4) = m_z/ rho
2846 tinv(4,1) = beta * (b2 + b3 - uhat / spd_snd_roe)
2847 tinv(4,2) = -beta * (-k_x / spd_snd_roe + b1 * ux_roe)
2848 tinv(4,3) = -beta * (-k_y / spd_snd_roe + b1 * uy_roe)
2849 tinv(4,4) = -beta * (-k_z / spd_snd_roe + b1 * uz_roe)
2850 tinv(4,5) = beta * b1
2851 tinv(5,1) = beta * (b2 + b3 + uhat / spd_snd_roe)
2852 tinv(5,2) = -beta * (k_x / spd_snd_roe + b1 * ux_roe)
2853 tinv(5,3) = -beta * (k_y / spd_snd_roe + b1 * uy_roe)
2854 tinv(5,4) = -beta * (k_z / spd_snd_roe + b1 * uz_roe)
2855 tinv(5,5) = beta * b1
2858 tinv(1,5+jj) = b1 * z_roe(jj)
2859 tinv(4,5+jj) = -b1 * z_roe(jj) * spd_snd_roe / rho
2860 tinv(5,5+jj) = -b1 * z_roe(jj) * spd_snd_roe / rho
2861 tinv(5+jj,1) = -y_roe(jj)
2862 tinv(5+jj,5+jj) = 1.0_8
2876 lambda(jj,jj) = theta
2878 lambda(nd+1,nd+1) = theta + spd_snd_roe * dsqrt(xi_x**2 + xi_y**2 + xi_z**2)
2879 lambda(nd+2,nd+2) = theta - spd_snd_roe * dsqrt(xi_x**2 + xi_y**2 + xi_z**2)
2881 lambda(5+jj,5+jj) = theta
2888 subroutine pderivative_roe(RHO,en_ROE,Y_ROE,u_ref,nAuxVars,dp_drho_bar,dp_de_bar,dp_drhoY_bar)
2900 Real(8) :: RHO,en_ROE,dp_drho_bar,dp_de_bar
2901 Real(8) :: Y_ROE(nauxvars),dp_drhoY_bar(nauxvars),Y_ROE_2(nauxvars+1)
2906 Real(8) :: e_i(nauxvars),Cv_total,W_total,ja,Y_N2
2907 Real(8),
pointer :: W_i(:)
2908 real(8),
parameter :: R_u = 8314.4621_8
2909 real(8) :: u_ref,Residual
2911 real(8) :: dimTempFactor
2919 y_roe_2(1:nauxvars) = y_roe(:) * rho
2920 y_roe_2(nauxvars+1) = rho
2926 temp_roe = temp_roe * dimtempfactor
2929 If (temp_roe <= 1000.0_8)
then 2941 e_i(jj) = e_i(jj) + y_roe(jj) * polynasa(jj)%cMod(j,ii) * temp_roe**j
2943 e_i(jj) = e_i(jj) + y_roe(jj) * polynasa(jj)%cMod(6,ii)
2944 y_n2 = y_n2 - y_roe(jj)
2945 w_total = w_total + y_roe(jj) / w_i(jj)
2947 w_total = w_total + y_n2 / w_i(nauxvars+1)
2948 w_total = 1.0_8 / w_total
2953 cv_total = cv_total + y_roe(jj) * polynasa(jj)%coeffs(j,ii) * temp_roe**(j-1) * r_u / w_i(jj)
2955 cv_total = cv_total - y_roe(jj) * r_u / w_i(jj)
2959 cv_total = cv_total + y_n2 * polynasa(nauxvars+1)%coeffs(j,ii) * temp_roe**(j-1) * r_u / w_i(nauxvars+1)
2961 cv_total = cv_total - y_n2 * r_u / w_i(nauxvars+1)
2966 dp_drho_bar = r_u * temp_roe / w_i(nauxvars+1) / (u_ref**2)
2969 ja= ja + y_roe(jj) * e_i(jj)
2971 dp_drho_bar = dp_drho_bar+ r_u/ (w_total*cv_total)* ja
2973 dp_de_bar = rho * r_u / (w_total * cv_total)
2975 dp_drhoy_bar = 0.0_8
2977 dp_drhoy_bar(jj) = r_u * temp_roe * (1.0_8/w_i(jj)-1.0_8/w_i(nauxvars+1))/(u_ref**2) &
2978 - r_u / (w_total * cv_total) * e_i(jj)
2983 subroutine poly4temperature(rho, rhoe, Qaux, numSpecies, dimTempFactor,Tout, printVal, iterOut_out, errorOut_out, errorCode)
2989 real(8) :: Qaux(:), Tguess, hGuess, coeSum(7,2), Tout
2990 real(8) :: coe(6), Tout4, rho, rhoe, error, Tout2, Tout3
2991 real(8) :: toler, Tnext
2992 real(8) :: tLo, tHi, hLo, hHi, tTrans, hTrans, dHdT
2993 complex*16 :: sols(4)
2994 logical :: success, printMessage, useNewton
2996 integer :: errorCode(4)
2997 integer,
intent(out),
optional :: iterOut_out
2999 real(8),
intent(out),
optional :: errorOut_out
3002 integer :: n,i, k, M
3005 integer :: n2Index, numSpecies
3006 real(8) :: dimTempFactor
3008 real(8) :: m_transTemperature, m_minTemperature, m_maxTemperature
3012 ALLOCATE(poly(numspecies+1))
3016 if(
present(iterout_out)) iterout_out = iterout
3017 if(
present(errorout_out)) errorout_out = errorout
3019 if(printval > 0)
then 3020 printmessage = .true.
3022 printmessage = .false.
3032 do i = 1, numspecies+1
3034 if(i <= m .and. i /= n2index)
then 3035 coesum = coesum + poly(i)%cMod*qaux(i)
3042 coesum = coesum + poly(n2index)%cMod*rho
3050 ttrans = m_transtemperature
3053 tout = m_transtemperature
3058 htrans = sum(coe(1:6)*[tout,tout2,tout3,tout4,tout3*tout2,1d0])
3065 if (rhoe < htrans)
then 3067 tout = m_mintemperature
3072 hlo = sum(coe(1:6)*[tout,tout2,tout3,tout4,tout3*tout2,1d0])
3073 if (rhoe <= hlo)
then 3076 tout = tout/dimtempfactor
3078 if (rhoe < hlo)
then 3080 if(printmessage)
then 3081 printval = printval - 1
3082 write(*,*)
"Warning: Exceeded minimum temperature in poly4." 3085 if (errorcode(2) >= 0)
then 3086 errorcode(2) = errorcode(2) + 1
3088 errorcode(2) = errorcode(2) - 1
3096 else if (rhoe > htrans)
then 3098 tout = m_maxtemperature
3103 hhi = sum(coe(1:6)*[tout,tout2,tout3,tout4,tout3*tout2,1d0])
3104 if (rhoe >= hhi)
then 3107 tout = tout/dimtempfactor
3108 if (rhoe > hhi)
then 3110 if(printmessage)
then 3111 printval = printval - 1
3112 write(*,*)
"Warning: Exceeded maximum temperature in poly4." 3116 if (errorcode(3) >= 0)
then 3117 errorcode(3) = errorcode(3) + 1
3119 errorcode(3) = errorcode(3) - 1
3135 tguess = tlo + (rhoe-hlo)*(thi-tlo)/(hhi-hlo)
3143 hguess = sum(coe(1:6)*[tout,tout2,tout3,tout4,tout3*tout2,1d0])
3144 dhdt = sum(coe(1:5)*[1d0,2d0*tout,3d0*tout2,4d0*tout3,5d0*tout4])
3145 error = (rhoe - hguess)/dhdt
3146 tguess = tguess +
error 3149 if (tguess < tlo) tguess = tlo
3150 if (tguess > thi) tguess = thi
3152 if(abs(
error/tguess) < toler )
then 3155 errorout = abs(
error/tout)
3162 if(.not. success .or. tout < m_mintemperature .or. tout > m_maxtemperature)
then 3163 if(printmessage)
then 3164 printval = printval - 1
3165 write(*,*)
"Warning: Failed to find temperature in poly4 with Newton iteration." 3168 if (errorcode(1) >= 0)
then 3169 errorcode(1) = errorcode(1) + 1
3171 errorcode(1) = errorcode(1) - 1
3176 tout = tout / dimtempfactor
3177 if(
present(iterout_out)) iterout_out = iterout
3178 if(
present(errorout_out)) errorout_out = errorout
3186 real(8) :: rho, rhoe, Tout, Qaux(:)
3190 write(*,*)
"rho, rhoe, Tout, iter, error" 3191 write(*,*) rho, rhoe, tout, iter,
error subroutine sat_form_roe_matrices_multispecies(u_in, u_out, p_in, p_out, MT1, JAC, u_ref, ND, dir, nAuxVars, gamma, tmat, tinv, lambda)
subroutine noslip_isothermal(numDim, bufferSizes, numPointsBuffer, patchNormalDir, patchSizes, numPointsPatch, numPatchPointsOp, patchPointsOp, gridType, gridMetric, jacobianDeterminant, bcParams, gasParams, rhoBuffer, rhoVBuffer, rhoEBuffer, numscalar, scalarBuffer, rhoRHS, rhoVRHS, rhoERHS, scalarRHS, rhoTarget, rhoVTarget, rhoETarget, scalarTarget, muBuffer, lambdaBuffer)
subroutine dissipationweight(numDim, bufferSize, numPoints, bufferInterval, sigmaDissipation, sigmaDilatation, dilatationRamp, dilatationCutoff, divV, sigmaDiss)
subroutine roe_mat(numDim, inCV, outCV, gamma, normDir, tMat, tInv, lambda, status)
integer(kind=4), parameter unirect
subroutine sat_form_roe_matrices_test(ND, u_in, u_out, gamma, norm, metricData, tmat, tinv, lambda)
subroutine farfield(numDim, bufferSizes, numPointsBuffer, patchNormalDir, patchSizes, numPointsPatch, numPatchPointsOp, patchPointsOp, gridType, gridMetric, jacobianDeterminant, bcParams, gasParams, rhoBuffer, rhoVBuffer, rhoEBuffer, viscousFluxBuffer, numscalar, scalarBuffer, rhoRHS, rhoVRHS, rhoERHS, scalarRHS, rhoTarget, rhoVTarget, rhoETarget, scalarTarget)
subroutine sat_form_roe_matrices_modified(u_in, u_out, gamma, norm, MT1, dir, ND, tmat, tinv, lambda)
subroutine poly4temperature(rho, rhoe, Qaux, numSpecies, dimTempFactor, Tout, printVal, iterOut_out, errorOut_out, errorCode)
subroutine pderivative_roe(RHO, en_ROE, Y_ROE, u_ref, nAuxVars, dp_drho_bar, dp_de_bar, dp_drhoY_bar)
subroutine slip_adiabatic(numDim, bufferSizes, numPointsBuffer, patchNormalDir, patchSizes, numPointsPatch, numPatchPointsOp, patchPointsOp, gridType, gridMetric, jacobianDeterminant, bcParams, gasParams, rhoBuffer, rhoVBuffer, rhoEBuffer, numscalar, scalarBuffer, rhoRHS, rhoVRHS, rhoERHS, scalarRHS, rhoTarget, rhoVTarget, rhoETarget, scalarTarget)
integer(kind=4), parameter curvilinear
void size_t int size_t int size_t int int int int double int int double double *void size_t int size_t int int int int int double int size_t size_t size_t double double *void size_t int size_t int size_t size_t int double int double double *void size_t size_t size_t double * a
integer(kind=4), parameter rectilinear
subroutine sat_form_roe_matrices_tp(u_in, u_out, ND, gamma, gamref, norm, tmat, tinv, lambda)
subroutine sat_form_roe_matrices(ND, u_in, u_out, gamma, norm, tmat, tinv, lambda)
subroutine poly4errorprint(rho, rhoe, Qaux, Tout, error, iter)