347 class(MethodCellTernaryType),
intent(inout) :: this
352 real(DP),
allocatable,
dimension(:) :: xvals
353 real(DP),
allocatable,
dimension(:) :: yvals
360 real(DP),
allocatable,
dimension(:) :: wk1
361 real(DP),
allocatable,
dimension(:) :: wk2
362 real(DP),
allocatable,
dimension(:) :: unextxnext
363 real(DP),
allocatable,
dimension(:) :: unextynext
364 real(DP),
allocatable,
dimension(:) :: le
365 real(DP),
allocatable,
dimension(:) :: unextx
366 real(DP),
allocatable,
dimension(:) :: unexty
368 real(DP),
allocatable,
dimension(:) :: areasub
370 real(DP),
allocatable,
dimension(:) :: li
371 real(DP),
allocatable,
dimension(:) :: unintx
372 real(DP),
allocatable,
dimension(:) :: uninty
373 real(DP),
allocatable,
dimension(:) :: xmid
374 real(DP),
allocatable,
dimension(:) :: ymid
375 real(DP),
allocatable,
dimension(:) :: lm
376 real(DP),
allocatable,
dimension(:) :: umx
377 real(DP),
allocatable,
dimension(:) :: umy
378 real(DP),
allocatable,
dimension(:) :: kappax
379 real(DP),
allocatable,
dimension(:) :: kappay
380 real(DP),
allocatable,
dimension(:) :: vm0x
381 real(DP),
allocatable,
dimension(:) :: vm0y
382 real(DP),
allocatable,
dimension(:) :: vm1x
383 real(DP),
allocatable,
dimension(:) :: vm1y
385 integer(I4B) :: nvert
387 select type (cell => this%cell)
388 type is (cellpolytype)
391 allocate (le(this%nverts))
392 allocate (unextx(this%nverts))
393 allocate (unexty(this%nverts))
394 allocate (areasub(this%nverts))
395 allocate (li(this%nverts))
396 allocate (unintx(this%nverts))
397 allocate (uninty(this%nverts))
398 allocate (xmid(this%nverts))
399 allocate (ymid(this%nverts))
400 allocate (lm(this%nverts))
401 allocate (umx(this%nverts))
402 allocate (umy(this%nverts))
403 allocate (kappax(this%nverts))
404 allocate (kappay(this%nverts))
405 allocate (vm0x(this%nverts))
406 allocate (vm0y(this%nverts))
407 allocate (vm1x(this%nverts))
408 allocate (vm1y(this%nverts))
409 allocate (unextxnext(this%nverts))
410 allocate (unextynext(this%nverts))
411 allocate (wk1(this%nverts))
412 allocate (wk2(this%nverts))
417 wk1 = this%xvertnext - this%xvert
418 wk2 = this%yvertnext - this%yvert
419 le = dsqrt(wk1 * wk1 + wk2 * wk2)
424 areacell = area(this%xvert, this%yvert)
425 sixa = areacell * dsix
426 wk1 = -(this%xvert * this%yvertnext - this%xvertnext * this%yvert)
427 nvert =
size(this%xvert)
428 this%xctr = sum((this%xvert + this%xvertnext) * wk1) / sixa
429 this%yctr = sum((this%yvert + this%yvertnext) * wk1) / sixa
435 do i = 1, this%nverts
436 xvals(1) = this%xvert(i)
437 xvals(2) = this%xvertnext(i)
439 yvals(1) = this%yvert(i)
440 yvals(2) = this%yvertnext(i)
442 areasub(i) = area(xvals, yvals)
446 term =
done / (cell%defn%porosity * cell%defn%retfactor * this%dz)
447 do i = 1, this%nverts
448 this%vne(i) = -cell%defn%faceflow(i) * term / le(i)
452 divcell = sum(le * this%vne) / areacell
455 wk1 = this%xvert - this%xctr
456 wk2 = this%yvert - this%yctr
457 li = dsqrt(wk1 * wk1 + wk2 * wk2)
461 unextxnext = cshift(unintx, 1)
462 unextynext = cshift(uninty, 1)
465 xmid = 5.d-1 * (this%xvert + this%xctr)
466 ymid = 5.d-1 * (this%yvert + this%yctr)
469 wk1 = cshift(xmid, 1) - xmid
470 wk2 = cshift(ymid, 1) - ymid
471 lm = dsqrt(wk1 * wk1 + wk2 * wk2)
488 call this%calc_thru_hcsum(vm0i0, divcell, le, li, lm, areasub, areacell, &
489 unintx, uninty, unextx, unexty, &
490 unextxnext, unextynext, &
491 kappax, kappay, vm0x, vm0y, vm1x, vm1y, hcsum0)
493 vm0ival = vm0i0 + perturb
494 call this%calc_thru_hcsum(vm0ival, divcell, le, li, lm, areasub, areacell, &
495 unintx, uninty, unextx, unexty, &
496 unextxnext, unextynext, &
497 kappax, kappay, vm0x, vm0y, vm1x, vm1y, hcsum)
499 jac = (hcsum - hcsum0) / perturb
500 vm0ival = vm0i0 - hcsum0 / jac
501 call this%calc_thru_hcsum(vm0ival, divcell, le, li, lm, areasub, areacell, &
502 unintx, uninty, unextx, unexty, &
503 unextxnext, unextynext, &
504 kappax, kappay, vm0x, vm0y, vm1x, vm1y, hcsum)
509 this%vv0x = 2.d0 * vm0x - this%vctrx
510 this%vv0y = 2.d0 * vm0y - this%vctry
511 this%vv1x = 2.d0 * vm1x - this%vctrx
512 this%vv1y = 2.d0 * vm1y - this%vctry
515 term =
done / (cell%defn%retfactor * cell%defn%porosity * areacell)
516 this%vzbot = cell%defn%faceflow(this%nverts + 2) * term
517 this%vztop = -cell%defn%faceflow(this%nverts + 3) * term
538 deallocate (unextxnext)
539 deallocate (unextynext)