77 TYPE(t_region
),
POINTER :: pregion
83 LOGICAL :: printerrornorms
84 CHARACTER(CHRLEN) :: rcsidentstring
85 INTEGER :: errorflag,ibc,icg,im,in,iq,ivar,ivarbeg,ivarend,l8normloc,ncells
86 INTEGER,
DIMENSION(:),
ALLOCATABLE :: varinfo
87 INTEGER,
DIMENSION(1,MIN_VAL:MAX_VAL) :: locdummy
88 REAL(RFREAL) :: atot,const,cpgas,dc,de,dinc,dtot,dummyreal,etaqm,ggas, &
89 gmc,gme,gxc,gxe,gyc,gye,gzc,gze,height,idc,l,l1norm, &
90 l2norm,l8norm,mi,minj,nx,ny,nz,omega,pc,pe,ptot,rgas,ri, &
91 ro,
term,ttot,uc,ue,var,vc,ve,vinj,we,
x,
y,
z
92 REAL(RFREAL),
DIMENSION(:,:),
POINTER :: pcv,pdv
93 REAL(RFREAL),
DIMENSION(:,:,:),
POINTER :: grad
95 TYPE(t_grid),
POINTER :: pgrid
103 '$RCSfile: RFLU_ComputeExactFlowError.F90,v $ $Revision: 1.19 $'
105 global => pregion%global
108 'RFLU_ComputeExactFlowError.F90')
110 IF ( global%verbLevel > verbose_none )
THEN
111 WRITE(stdout,
'(A,1X,A)') solver_name,
'Computing errors in flow solution...'
113 IF ( global%verbLevel > verbose_low )
THEN
114 WRITE(stdout,
'(A,3X,A,A)') solver_name,
'Case: ',trim(global%casename)
122 pgrid => pregion%grid
123 pcv => pregion%mixt%cv
124 pdv => pregion%mixt%dv
125 pmixtinput => pregion%mixtInput
132 ggas = global%refGamma
139 l8norm = -huge(1.0_rfreal)
141 printerrornorms = .true.
147 SELECT CASE ( global%casename )
153 CASE (
"gtlin",
"gttri" )
159 ivarbeg = cv_mixt_dens
162 ALLOCATE(grad(xcoord:zcoord,ivarbeg:ivarend,pgrid%nCellsTot), &
164 global%error = errorflag
165 IF (global%error /= err_none)
THEN
166 CALL
errorstop(global,err_allocate,__line__,
'grad')
173 ALLOCATE(varinfo(ivarbeg:ivarend),stat=errorflag)
174 global%error = errorflag
175 IF (global%error /= err_none)
THEN
176 CALL
errorstop(global,err_allocate,__line__,
'varInfo')
179 varinfo(ivarbeg:ivarend) = ivarbeg
182 ivarend,varinfo,pcv,grad)
184 DEALLOCATE(varinfo,stat=errorflag)
185 global%error = errorflag
186 IF (global%error /= err_none)
THEN
187 CALL
errorstop(global,err_deallocate,__line__,
'varInfo')
194 SELECT CASE ( global%casename)
199 SELECT CASE ( pregion%mixtInput%dimens )
201 DO icg = 1,pgrid%nCellsTot
204 x = pgrid%cofg(xcoord,icg)
205 y = pgrid%cofg(ycoord,icg)
206 z = pgrid%cofg(zcoord,icg)
208 DO ivar = ivarbeg,ivarend
211 gxc = grad(xcoord,ivar,icg)
216 term = abs(gmc/gme-1.0_rfreal)
218 l1norm = l1norm +
term
219 l2norm = l2norm +
term**2
221 IF (
term > l8norm )
THEN
228 DO icg = 1,pgrid%nCellsTot
231 x = pgrid%cofg(xcoord,icg)
232 y = pgrid%cofg(ycoord,icg)
233 z = pgrid%cofg(zcoord,icg)
235 DO ivar = ivarbeg,ivarend
238 gxc = grad(xcoord,ivar,icg)
239 gyc = grad(ycoord,ivar,icg)
241 gmc =
sqrt(gxc*gxc + gyc*gyc)
242 gme =
sqrt(gxe*gxe + gye*gye)
244 term = abs(gmc/gme-1.0_rfreal)
246 l1norm = l1norm +
term
247 l2norm = l2norm +
term**2
249 IF (
term > l8norm )
THEN
256 DO icg = 1,pgrid%nCellsTot
259 x = pgrid%cofg(xcoord,icg)
260 y = pgrid%cofg(ycoord,icg)
261 z = pgrid%cofg(zcoord,icg)
263 DO ivar = ivarbeg,ivarend
266 gxc = grad(xcoord,ivar,icg)
267 gyc = grad(ycoord,ivar,icg)
268 gzc = grad(zcoord,ivar,icg)
270 gmc =
sqrt(gxc*gxc + gyc*gyc + gzc*gzc)
271 gme =
sqrt(gxe*gxe + gye*gye + gze*gze)
273 term = abs(gmc/gme-1.0_rfreal)
275 l1norm = l1norm +
term
276 l2norm = l2norm +
term**2
278 IF (
term > l8norm )
THEN
285 CALL
errorstop(global,err_reached_default,__line__)
291 nx = pregion%mixtInput%prepRealVal1
292 ny = pregion%mixtInput%prepRealVal2
293 nz = pregion%mixtInput%prepRealVal3
295 SELECT CASE ( pregion%mixtInput%dimens )
297 DO icg = 1,pgrid%nCellsTot
300 x = pgrid%cofg(xcoord,icg)
301 y = pgrid%cofg(ycoord,icg)
302 z = pgrid%cofg(zcoord,icg)
304 DO ivar = ivarbeg,ivarend
308 gxc = grad(xcoord,ivar,icg)
309 gyc = grad(ycoord,ivar,icg)
314 term = abs(gmc/gme-1.0_rfreal)
316 l1norm = l1norm +
term
317 l2norm = l2norm +
term**2
319 IF (
term > l8norm )
THEN
326 DO icg = 1,pgrid%nCellsTot
329 x = pgrid%cofg(xcoord,icg)
330 y = pgrid%cofg(ycoord,icg)
331 z = pgrid%cofg(zcoord,icg)
333 DO ivar = ivarbeg,ivarend
337 gxc = grad(xcoord,ivar,icg)
338 gyc = grad(ycoord,ivar,icg)
340 gmc =
sqrt(gxc*gxc + gyc*gyc)
341 gme =
sqrt(gxe*gxe + gye*gye)
343 term = abs(gmc/gme-1.0_rfreal)
345 l1norm = l1norm +
term
346 l2norm = l2norm +
term**2
348 IF (
term > l8norm )
THEN
355 DO icg = 1,pgrid%nCellsTot
358 x = pgrid%cofg(xcoord,icg)
359 y = pgrid%cofg(ycoord,icg)
360 z = pgrid%cofg(zcoord,icg)
362 DO ivar = ivarbeg,ivarend
366 gxc = grad(xcoord,ivar,icg)
367 gyc = grad(ycoord,ivar,icg)
368 gzc = grad(zcoord,ivar,icg)
370 gmc =
sqrt(gxc*gxc + gyc*gyc + gzc*gzc)
371 gme =
sqrt(gxe*gxe + gye*gye + gze*gze)
373 term = abs(gmc/gme-1.0_rfreal)
375 l1norm = l1norm +
term
376 l2norm = l2norm +
term**2
378 IF (
term > l8norm )
THEN
385 CALL
errorstop(global,err_reached_default,__line__)
388 CALL
errorstop(global,err_reached_default,__line__)
395 DEALLOCATE(grad,stat=errorflag)
396 global%error = errorflag
397 IF (global%error /= err_none)
THEN
398 CALL
errorstop(global,err_deallocate,__line__,
'grad')
407 CASE (
"onera_c0",
"onera_c0_2d_100x50" )
410 height = minval(pgrid%xyz(ycoord,1:pgrid%nVertTot))
412 DO icg = 1,pgrid%nCellsTot
415 x = pgrid%cofg(xcoord,icg)
416 y = pgrid%cofg(ycoord,icg)
418 dc = pcv(cv_mixt_dens,icg)
421 uc = idc*pcv(cv_mixt_xmom,icg)
422 vc = idc*pcv(cv_mixt_ymom,icg)
427 term = abs(
sqrt(uc*uc + vc*vc)/
sqrt(ue*ue + ve*ve) - 1.0_rfreal)
428 l1norm = l1norm +
term
429 l2norm = l2norm +
term**2
431 IF (
term > l8norm )
THEN
442 CASE (
"pipeacoust" )
447 l = maxval(pgrid%xyz(xcoord,1:pgrid%nVert))
448 ro = maxval(pgrid%xyz(ycoord,1:pgrid%nVert))
450 im =
max(pmixtinput%prepIntVal1,1)
451 in =
max(pmixtinput%prepIntVal2,1)
452 iq =
max(pmixtinput%prepIntVal3,1)
453 ibc =
max(
min(pmixtinput%prepIntVal4,1),0)
455 const =
max(pmixtinput%prepRealVal1,0.0_rfreal)
457 CALL
rflu_jyzom(im,iq,dummyreal,etaqm,dummyreal,dummyreal)
459 omega = atot*
sqrt((in*global%pi/l)**2 + (etaqm/ro)**2)
461 IF ( global%verbLevel > verbose_low )
THEN
462 WRITE(stdout,
'(A,5X,A,1X,I2)' ) solver_name, &
463 'Boundary condition:',ibc
464 WRITE(stdout,
'(A,5X,A,3(1X,I2))') solver_name, &
466 WRITE(stdout,
'(A,5X,A,1X,E13.6)') solver_name, &
467 'Total density (kg/m^3): ',dtot
468 WRITE(stdout,
'(A,5X,A,1X,E13.6)') solver_name, &
469 'Total pressure (N/m^2): ',ptot
470 WRITE(stdout,
'(A,5X,A,1X,E13.6)') solver_name, &
471 'Angular frequency (rad/s):',omega
472 WRITE(stdout,
'(A,5X,A,1X,E13.6)') solver_name, &
473 'Constant (-): ',const
476 DO icg = 1,pgrid%nCellsTot
479 x = pgrid%cofg(xcoord,icg)
480 y = pgrid%cofg(ycoord,icg)
481 z = pgrid%cofg(zcoord,icg)
483 pc = pdv(dv_mixt_pres,icg)
486 l,ro,ibc,im,in,iq,etaqm,omega,dtot, &
487 ptot,atot,const,de,ue,ve,we,pe)
489 term = abs(pc/pe - 1.0_rfreal)
490 l1norm = l1norm +
term
491 l2norm = l2norm +
term**2
493 IF (
term > l8norm )
THEN
507 DO icg = 1,pgrid%nCellsTot
510 x = pgrid%cofg(xcoord,icg)
511 y = pgrid%cofg(ycoord,icg)
513 dc = pcv(cv_mixt_dens,icg)
517 term = abs(dc/de-1.0_rfreal)
518 l1norm = l1norm +
term
519 l2norm = l2norm +
term**2
521 IF (
term > l8norm )
THEN
532 CASE (
"ssvorth20x5l1" ,
"ssvortp20x5l1" , &
533 "ssvorth20x5l3" ,
"ssvortp20x5l3" , &
534 "ssvorth40x10l1" ,
"ssvortp40x10l1" , &
535 "ssvorth40x10l3" ,
"ssvortp40x10l3" , &
536 "ssvorth80x20l1" ,
"ssvortp80x20l1" , &
537 "ssvorth80x20l3" ,
"ssvortp80x20l3" , &
538 "ssvorth160x40l1" ,
"ssvortp160x40l1" , &
539 "ssvorth160x40l3" ,
"ssvortp160x40l3" , &
540 "ssvorth320x80l1" ,
"ssvortp320x80l1" , &
541 "ssvorth320x80l3" ,
"ssvortp320x80l3" , &
542 "ssvorth640x160l1",
"ssvortp640x160l1", &
543 "ssvorth640x160l3",
"ssvortp640x160l3" )
546 DO icg = 1,pgrid%nCellsTot
554 x = pgrid%cofg(xcoord,icg)
555 y = pgrid%cofg(ycoord,icg)
557 dc = pcv(cv_mixt_dens,icg)
562 term = abs(dc/de-1.0_rfreal)
563 l1norm = l1norm +
term
564 l2norm = l2norm +
term**2
566 IF (
term > l8norm )
THEN
582 printerrornorms = .false.
584 global%warnCounter = global%warnCounter + 1
586 IF ( global%verbLevel > verbose_none )
THEN
587 WRITE(stdout,
'(A,3X,A,1X,A)') solver_name,
'*** WARNING ***', &
588 'Exact solution not available. Returning to calling procedure.'
596 IF ( printerrornorms .EQV. .true. )
THEN
597 l1norm = l1norm/
REAL(ncells)
598 l2norm =
sqrt(l2norm/
REAL(ncells))
600 WRITE(stdout,
'(A,3X,A,1X,I6)') solver_name,
'Number of cells:',ncells
602 WRITE(stdout,
'(A,3X,A)') solver_name,
'Error norms:'
603 WRITE(stdout,
'(A,5X,A,1X,E13.6)') solver_name,
'L1 norm:',l1norm
604 WRITE(stdout,
'(A,5X,A,1X,E13.6)') solver_name,
'L2 norm:',l2norm
605 WRITE(stdout,
'(A,5X,A,1X,E13.6,1X,I6)') solver_name,
'L8 norm:',l8norm, &
608 locdummy(1,min_val) = l8normloc
609 locdummy(1,max_val) = l8normloc
612 output_mode_master_only)
619 IF ( global%verbLevel > verbose_none )
THEN
620 WRITE(stdout,
'(A,1X,A)') solver_name, &
621 'Computing errors in flow solution done.'
subroutine, public rflu_getparamshardcodessvortex(ri, Mi, pTot, tTot)
subroutine rflu_computeexactflowerror(pRegion)
void int int REAL REAL * y
subroutine, public rflu_computeexactflowpacoust(global, x, y, z, t, L, ro, iBc, im, in, iq, etaqm, omega, dTot, pTot, aTot, const, d, u, v, w, p)
Vector_n max(const Array_n_const &v1, const Array_n_const &v2)
subroutine registerfunction(global, funName, fileName)
subroutine, public rflu_jyzom(N, M, RJ0M, RJ1M, RY0M, RY1M)
real(rfreal) function mixtperf_r_cpg(Cp, G)
void int int int REAL REAL REAL * z
real(rfreal) function mixtperf_d_cgp(C, G, P)
subroutine, public rflu_getparamshardcoderingleb(pTot, tTot)
subroutine, public rflu_computeexactflowringleb(x, y, rGas, pTot, tTot, d, u, v, w, p)
subroutine, public rflu_computeexactflowssvortex(x, y, gGas, rGas, ri, Mi, pTot, tTot, d, u, v, w, p)
Vector_n min(const Array_n_const &v1, const Array_n_const &v2)
subroutine rflu_printlocinfo(pRegion, locUnsorted, nLocUnsorted, locInfoMode, outputMode)
LOGICAL function, public rflu_testisboundarycell(pRegion, icg)
subroutine, public rflu_getparamshardcodeproudman(dInc, mInj, vInj, pTot)
subroutine, public rflu_computegradcellswrapper(pRegion, iBegVar, iEndVar, iBegGrad, iEndGrad, varInfo, var, grad)
subroutine, public rflu_setexactflowtrig(global, nx, ny, nz, x, y, z, iVar, var, gx, gy, gz)
real(rfreal) function mixtperf_eo_dgpuvw(D, G, P, U, V, W)
subroutine errorstop(global, errorCode, errorLine, addMessage)
subroutine deregisterfunction(global)
subroutine, public rflu_getparamshardcodepacoust(pTot, aTot)
subroutine, public rflu_setexactflowlinear(x, y, z, iVar, var, gx, gy, gz)
real(rfreal) function mixtperf_p_drt(D, R, T)
subroutine, public rflu_computeexactflowproudman(global, x, y, height, dInc, vInj, pTot, d, u, v, w, p)