349 class(MethodCellTernaryType),
intent(inout) :: this
354 real(DP),
allocatable,
dimension(:) :: xvals
355 real(DP),
allocatable,
dimension(:) :: yvals
362 real(DP),
allocatable,
dimension(:) :: wk1
363 real(DP),
allocatable,
dimension(:) :: wk2
364 real(DP),
allocatable,
dimension(:) :: unextxnext
365 real(DP),
allocatable,
dimension(:) :: unextynext
366 real(DP),
allocatable,
dimension(:) :: le
367 real(DP),
allocatable,
dimension(:) :: unextx
368 real(DP),
allocatable,
dimension(:) :: unexty
370 real(DP),
allocatable,
dimension(:) :: areasub
372 real(DP),
allocatable,
dimension(:) :: li
373 real(DP),
allocatable,
dimension(:) :: unintx
374 real(DP),
allocatable,
dimension(:) :: uninty
375 real(DP),
allocatable,
dimension(:) :: xmid
376 real(DP),
allocatable,
dimension(:) :: ymid
377 real(DP),
allocatable,
dimension(:) :: lm
378 real(DP),
allocatable,
dimension(:) :: umx
379 real(DP),
allocatable,
dimension(:) :: umy
380 real(DP),
allocatable,
dimension(:) :: kappax
381 real(DP),
allocatable,
dimension(:) :: kappay
382 real(DP),
allocatable,
dimension(:) :: vm0x
383 real(DP),
allocatable,
dimension(:) :: vm0y
384 real(DP),
allocatable,
dimension(:) :: vm1x
385 real(DP),
allocatable,
dimension(:) :: vm1y
387 integer(I4B) :: nvert
389 select type (cell => this%cell)
390 type is (cellpolytype)
393 allocate (le(this%nverts))
394 allocate (unextx(this%nverts))
395 allocate (unexty(this%nverts))
396 allocate (areasub(this%nverts))
397 allocate (li(this%nverts))
398 allocate (unintx(this%nverts))
399 allocate (uninty(this%nverts))
400 allocate (xmid(this%nverts))
401 allocate (ymid(this%nverts))
402 allocate (lm(this%nverts))
403 allocate (umx(this%nverts))
404 allocate (umy(this%nverts))
405 allocate (kappax(this%nverts))
406 allocate (kappay(this%nverts))
407 allocate (vm0x(this%nverts))
408 allocate (vm0y(this%nverts))
409 allocate (vm1x(this%nverts))
410 allocate (vm1y(this%nverts))
411 allocate (unextxnext(this%nverts))
412 allocate (unextynext(this%nverts))
413 allocate (wk1(this%nverts))
414 allocate (wk2(this%nverts))
419 wk1 = this%xvertnext - this%xvert
420 wk2 = this%yvertnext - this%yvert
421 le = dsqrt(wk1 * wk1 + wk2 * wk2)
426 areacell = area(this%xvert, this%yvert)
427 sixa = areacell * dsix
428 wk1 = -(this%xvert * this%yvertnext - this%xvertnext * this%yvert)
429 nvert =
size(this%xvert)
430 this%xctr = sum((this%xvert + this%xvertnext) * wk1) / sixa
431 this%yctr = sum((this%yvert + this%yvertnext) * wk1) / sixa
446 do i = 1, this%nverts
447 xvals(1) = this%xvert(i)
448 xvals(2) = this%xvertnext(i)
450 yvals(1) = this%yvert(i)
451 yvals(2) = this%yvertnext(i)
453 areasub(i) = area(xvals, yvals)
457 term =
done / (cell%defn%porosity * cell%defn%retfactor * this%dz)
458 do i = 1, this%nverts
459 this%vne(i) = -cell%defn%faceflow(i) * term / le(i)
463 divcell = sum(le * this%vne) / areacell
466 wk1 = this%xvert - this%xctr
467 wk2 = this%yvert - this%yctr
468 li = dsqrt(wk1 * wk1 + wk2 * wk2)
472 unextxnext = cshift(unintx, 1)
473 unextynext = cshift(uninty, 1)
476 xmid = 5.d-1 * (this%xvert + this%xctr)
477 ymid = 5.d-1 * (this%yvert + this%yctr)
480 wk1 = cshift(xmid, 1) - xmid
481 wk2 = cshift(ymid, 1) - ymid
482 lm = dsqrt(wk1 * wk1 + wk2 * wk2)
499 call this%calc_thru_hcsum(vm0i0, divcell, le, li, lm, areasub, areacell, &
500 unintx, uninty, unextx, unexty, &
501 unextxnext, unextynext, &
502 kappax, kappay, vm0x, vm0y, vm1x, vm1y, hcsum0)
504 vm0ival = vm0i0 + perturb
505 call this%calc_thru_hcsum(vm0ival, divcell, le, li, lm, areasub, areacell, &
506 unintx, uninty, unextx, unexty, &
507 unextxnext, unextynext, &
508 kappax, kappay, vm0x, vm0y, vm1x, vm1y, hcsum)
510 jac = (hcsum - hcsum0) / perturb
511 vm0ival = vm0i0 - hcsum0 / jac
512 call this%calc_thru_hcsum(vm0ival, divcell, le, li, lm, areasub, areacell, &
513 unintx, uninty, unextx, unexty, &
514 unextxnext, unextynext, &
515 kappax, kappay, vm0x, vm0y, vm1x, vm1y, hcsum)
520 this%vv0x = 2.d0 * vm0x - this%vctrx
521 this%vv0y = 2.d0 * vm0y - this%vctry
522 this%vv1x = 2.d0 * vm1x - this%vctrx
523 this%vv1y = 2.d0 * vm1y - this%vctry
526 term =
done / (cell%defn%retfactor * cell%defn%porosity * areacell)
527 this%vzbot = cell%defn%faceflow(this%nverts + 2) * term
528 this%vztop = -cell%defn%faceflow(this%nverts + 3) * term
549 deallocate (unextxnext)
550 deallocate (unextynext)