328 class(MethodCellTernaryType),
intent(inout) :: this
333 real(DP),
allocatable,
dimension(:) :: xvals
334 real(DP),
allocatable,
dimension(:) :: yvals
341 real(DP),
allocatable,
dimension(:) :: wk1
342 real(DP),
allocatable,
dimension(:) :: wk2
343 real(DP),
allocatable,
dimension(:) :: unextxnext
344 real(DP),
allocatable,
dimension(:) :: unextynext
345 real(DP),
allocatable,
dimension(:) :: le
346 real(DP),
allocatable,
dimension(:) :: unextx
347 real(DP),
allocatable,
dimension(:) :: unexty
349 real(DP),
allocatable,
dimension(:) :: areasub
351 real(DP),
allocatable,
dimension(:) :: li
352 real(DP),
allocatable,
dimension(:) :: unintx
353 real(DP),
allocatable,
dimension(:) :: uninty
354 real(DP),
allocatable,
dimension(:) :: xmid
355 real(DP),
allocatable,
dimension(:) :: ymid
356 real(DP),
allocatable,
dimension(:) :: lm
357 real(DP),
allocatable,
dimension(:) :: umx
358 real(DP),
allocatable,
dimension(:) :: umy
359 real(DP),
allocatable,
dimension(:) :: kappax
360 real(DP),
allocatable,
dimension(:) :: kappay
361 real(DP),
allocatable,
dimension(:) :: vm0x
362 real(DP),
allocatable,
dimension(:) :: vm0y
363 real(DP),
allocatable,
dimension(:) :: vm1x
364 real(DP),
allocatable,
dimension(:) :: vm1y
366 integer(I4B) :: nvert
368 select type (cell => this%cell)
369 type is (cellpolytype)
372 allocate (le(this%nverts))
373 allocate (unextx(this%nverts))
374 allocate (unexty(this%nverts))
375 allocate (areasub(this%nverts))
376 allocate (li(this%nverts))
377 allocate (unintx(this%nverts))
378 allocate (uninty(this%nverts))
379 allocate (xmid(this%nverts))
380 allocate (ymid(this%nverts))
381 allocate (lm(this%nverts))
382 allocate (umx(this%nverts))
383 allocate (umy(this%nverts))
384 allocate (kappax(this%nverts))
385 allocate (kappay(this%nverts))
386 allocate (vm0x(this%nverts))
387 allocate (vm0y(this%nverts))
388 allocate (vm1x(this%nverts))
389 allocate (vm1y(this%nverts))
390 allocate (unextxnext(this%nverts))
391 allocate (unextynext(this%nverts))
392 allocate (wk1(this%nverts))
393 allocate (wk2(this%nverts))
398 wk1 = this%xvertnext - this%xvert
399 wk2 = this%yvertnext - this%yvert
400 le = dsqrt(wk1 * wk1 + wk2 * wk2)
405 areacell = area(this%xvert, this%yvert)
406 sixa = areacell * dsix
407 wk1 = -(this%xvert * this%yvertnext - this%xvertnext * this%yvert)
408 nvert =
size(this%xvert)
409 this%xctr = sum((this%xvert + this%xvertnext) * wk1) / sixa
410 this%yctr = sum((this%yvert + this%yvertnext) * wk1) / sixa
416 do i = 1, this%nverts
417 xvals(1) = this%xvert(i)
418 xvals(2) = this%xvertnext(i)
420 yvals(1) = this%yvert(i)
421 yvals(2) = this%yvertnext(i)
423 areasub(i) = area(xvals, yvals)
427 term =
done / (cell%defn%porosity * cell%defn%retfactor * this%dz)
428 do i = 1, this%nverts
429 this%vne(i) = -cell%defn%faceflow(i) * term / le(i)
433 divcell = sum(le * this%vne) / areacell
436 wk1 = this%xvert - this%xctr
437 wk2 = this%yvert - this%yctr
438 li = dsqrt(wk1 * wk1 + wk2 * wk2)
442 unextxnext = cshift(unintx, 1)
443 unextynext = cshift(uninty, 1)
446 xmid = 5.d-1 * (this%xvert + this%xctr)
447 ymid = 5.d-1 * (this%yvert + this%yctr)
450 wk1 = cshift(xmid, 1) - xmid
451 wk2 = cshift(ymid, 1) - ymid
452 lm = dsqrt(wk1 * wk1 + wk2 * wk2)
469 call this%calc_thru_hcsum(vm0i0, divcell, le, li, lm, areasub, areacell, &
470 unintx, uninty, unextx, unexty, &
471 unextxnext, unextynext, &
472 kappax, kappay, vm0x, vm0y, vm1x, vm1y, hcsum0)
474 vm0ival = vm0i0 + perturb
475 call this%calc_thru_hcsum(vm0ival, divcell, le, li, lm, areasub, areacell, &
476 unintx, uninty, unextx, unexty, &
477 unextxnext, unextynext, &
478 kappax, kappay, vm0x, vm0y, vm1x, vm1y, hcsum)
480 jac = (hcsum - hcsum0) / perturb
481 vm0ival = vm0i0 - hcsum0 / jac
482 call this%calc_thru_hcsum(vm0ival, divcell, le, li, lm, areasub, areacell, &
483 unintx, uninty, unextx, unexty, &
484 unextxnext, unextynext, &
485 kappax, kappay, vm0x, vm0y, vm1x, vm1y, hcsum)
490 this%vv0x = 2.d0 * vm0x - this%vctrx
491 this%vv0y = 2.d0 * vm0y - this%vctry
492 this%vv1x = 2.d0 * vm1x - this%vctrx
493 this%vv1y = 2.d0 * vm1y - this%vctry
496 term =
done / (cell%defn%retfactor * cell%defn%porosity * areacell)
497 this%vzbot = cell%defn%faceflow(this%nverts + 2) * term
498 this%vztop = -cell%defn%faceflow(this%nverts + 3) * term
519 deallocate (unextxnext)
520 deallocate (unextynext)