337 class(MethodCellTernaryType),
intent(inout) :: this
342 real(DP),
allocatable,
dimension(:) :: xvals
343 real(DP),
allocatable,
dimension(:) :: yvals
350 real(DP),
allocatable,
dimension(:) :: wk1
351 real(DP),
allocatable,
dimension(:) :: wk2
352 real(DP),
allocatable,
dimension(:) :: unextxnext
353 real(DP),
allocatable,
dimension(:) :: unextynext
354 real(DP),
allocatable,
dimension(:) :: le
355 real(DP),
allocatable,
dimension(:) :: unextx
356 real(DP),
allocatable,
dimension(:) :: unexty
358 real(DP),
allocatable,
dimension(:) :: areasub
360 real(DP),
allocatable,
dimension(:) :: li
361 real(DP),
allocatable,
dimension(:) :: unintx
362 real(DP),
allocatable,
dimension(:) :: uninty
363 real(DP),
allocatable,
dimension(:) :: xmid
364 real(DP),
allocatable,
dimension(:) :: ymid
365 real(DP),
allocatable,
dimension(:) :: lm
366 real(DP),
allocatable,
dimension(:) :: umx
367 real(DP),
allocatable,
dimension(:) :: umy
368 real(DP),
allocatable,
dimension(:) :: kappax
369 real(DP),
allocatable,
dimension(:) :: kappay
370 real(DP),
allocatable,
dimension(:) :: vm0x
371 real(DP),
allocatable,
dimension(:) :: vm0y
372 real(DP),
allocatable,
dimension(:) :: vm1x
373 real(DP),
allocatable,
dimension(:) :: vm1y
375 integer(I4B) :: nvert
377 select type (cell => this%cell)
378 type is (cellpolytype)
381 allocate (le(this%nverts))
382 allocate (unextx(this%nverts))
383 allocate (unexty(this%nverts))
384 allocate (areasub(this%nverts))
385 allocate (li(this%nverts))
386 allocate (unintx(this%nverts))
387 allocate (uninty(this%nverts))
388 allocate (xmid(this%nverts))
389 allocate (ymid(this%nverts))
390 allocate (lm(this%nverts))
391 allocate (umx(this%nverts))
392 allocate (umy(this%nverts))
393 allocate (kappax(this%nverts))
394 allocate (kappay(this%nverts))
395 allocate (vm0x(this%nverts))
396 allocate (vm0y(this%nverts))
397 allocate (vm1x(this%nverts))
398 allocate (vm1y(this%nverts))
399 allocate (unextxnext(this%nverts))
400 allocate (unextynext(this%nverts))
401 allocate (wk1(this%nverts))
402 allocate (wk2(this%nverts))
407 wk1 = this%xvertnext - this%xvert
408 wk2 = this%yvertnext - this%yvert
409 le = dsqrt(wk1 * wk1 + wk2 * wk2)
414 areacell = area(this%xvert, this%yvert)
415 sixa = areacell * dsix
416 wk1 = -(this%xvert * this%yvertnext - this%xvertnext * this%yvert)
417 nvert =
size(this%xvert)
418 this%xctr = sum((this%xvert + this%xvertnext) * wk1) / sixa
419 this%yctr = sum((this%yvert + this%yvertnext) * wk1) / sixa
425 do i = 1, this%nverts
426 xvals(1) = this%xvert(i)
427 xvals(2) = this%xvertnext(i)
429 yvals(1) = this%yvert(i)
430 yvals(2) = this%yvertnext(i)
432 areasub(i) = area(xvals, yvals)
436 term =
done / (cell%defn%porosity * cell%defn%retfactor * this%dz)
437 do i = 1, this%nverts
438 this%vne(i) = -cell%defn%faceflow(i) * term / le(i)
442 divcell = sum(le * this%vne) / areacell
445 wk1 = this%xvert - this%xctr
446 wk2 = this%yvert - this%yctr
447 li = dsqrt(wk1 * wk1 + wk2 * wk2)
451 unextxnext = cshift(unintx, 1)
452 unextynext = cshift(uninty, 1)
455 xmid = 5.d-1 * (this%xvert + this%xctr)
456 ymid = 5.d-1 * (this%yvert + this%yctr)
459 wk1 = cshift(xmid, 1) - xmid
460 wk2 = cshift(ymid, 1) - ymid
461 lm = dsqrt(wk1 * wk1 + wk2 * wk2)
478 call this%calc_thru_hcsum(vm0i0, divcell, le, li, lm, areasub, areacell, &
479 unintx, uninty, unextx, unexty, &
480 unextxnext, unextynext, &
481 kappax, kappay, vm0x, vm0y, vm1x, vm1y, hcsum0)
483 vm0ival = vm0i0 + perturb
484 call this%calc_thru_hcsum(vm0ival, divcell, le, li, lm, areasub, areacell, &
485 unintx, uninty, unextx, unexty, &
486 unextxnext, unextynext, &
487 kappax, kappay, vm0x, vm0y, vm1x, vm1y, hcsum)
489 jac = (hcsum - hcsum0) / perturb
490 vm0ival = vm0i0 - hcsum0 / jac
491 call this%calc_thru_hcsum(vm0ival, divcell, le, li, lm, areasub, areacell, &
492 unintx, uninty, unextx, unexty, &
493 unextxnext, unextynext, &
494 kappax, kappay, vm0x, vm0y, vm1x, vm1y, hcsum)
499 this%vv0x = 2.d0 * vm0x - this%vctrx
500 this%vv0y = 2.d0 * vm0y - this%vctry
501 this%vv1x = 2.d0 * vm1x - this%vctrx
502 this%vv1y = 2.d0 * vm1y - this%vctry
505 term =
done / (cell%defn%retfactor * cell%defn%porosity * areacell)
506 this%vzbot = cell%defn%faceflow(this%nverts + 2) * term
507 this%vztop = -cell%defn%faceflow(this%nverts + 3) * term
528 deallocate (unextxnext)
529 deallocate (unextynext)