327 class(MethodCellTernaryType),
intent(inout) :: this
332 real(DP),
allocatable,
dimension(:) :: xvals
333 real(DP),
allocatable,
dimension(:) :: yvals
340 real(DP),
allocatable,
dimension(:) :: wk1
341 real(DP),
allocatable,
dimension(:) :: wk2
342 real(DP),
allocatable,
dimension(:) :: unextxnext
343 real(DP),
allocatable,
dimension(:) :: unextynext
344 real(DP),
allocatable,
dimension(:) :: le
345 real(DP),
allocatable,
dimension(:) :: unextx
346 real(DP),
allocatable,
dimension(:) :: unexty
348 real(DP),
allocatable,
dimension(:) :: areasub
350 real(DP),
allocatable,
dimension(:) :: li
351 real(DP),
allocatable,
dimension(:) :: unintx
352 real(DP),
allocatable,
dimension(:) :: uninty
353 real(DP),
allocatable,
dimension(:) :: xmid
354 real(DP),
allocatable,
dimension(:) :: ymid
355 real(DP),
allocatable,
dimension(:) :: lm
356 real(DP),
allocatable,
dimension(:) :: umx
357 real(DP),
allocatable,
dimension(:) :: umy
358 real(DP),
allocatable,
dimension(:) :: kappax
359 real(DP),
allocatable,
dimension(:) :: kappay
360 real(DP),
allocatable,
dimension(:) :: vm0x
361 real(DP),
allocatable,
dimension(:) :: vm0y
362 real(DP),
allocatable,
dimension(:) :: vm1x
363 real(DP),
allocatable,
dimension(:) :: vm1y
365 select type (cell => this%cell)
366 type is (cellpolytype)
369 allocate (le(this%nverts))
370 allocate (unextx(this%nverts))
371 allocate (unexty(this%nverts))
372 allocate (areasub(this%nverts))
373 allocate (li(this%nverts))
374 allocate (unintx(this%nverts))
375 allocate (uninty(this%nverts))
376 allocate (xmid(this%nverts))
377 allocate (ymid(this%nverts))
378 allocate (lm(this%nverts))
379 allocate (umx(this%nverts))
380 allocate (umy(this%nverts))
381 allocate (kappax(this%nverts))
382 allocate (kappay(this%nverts))
383 allocate (vm0x(this%nverts))
384 allocate (vm0y(this%nverts))
385 allocate (vm1x(this%nverts))
386 allocate (vm1y(this%nverts))
387 allocate (unextxnext(this%nverts))
388 allocate (unextynext(this%nverts))
389 allocate (wk1(this%nverts))
390 allocate (wk2(this%nverts))
395 wk1 = this%xvertnext - this%xvert
396 wk2 = this%yvertnext - this%yvert
397 le = dsqrt(wk1 * wk1 + wk2 * wk2)
402 areacell = area(this%xvert, this%yvert)
405 sixa = areacell * 6.d0
406 wk1 = -(this%xvert * this%yvertnext - this%xvertnext * this%yvert)
407 this%xctr = sum((this%xvert + this%xvertnext) * wk1) / sixa
408 this%yctr = sum((this%yvert + this%yvertnext) * wk1) / sixa
411 do i = 1, this%nverts
412 xvals(1) = this%xvert(i)
413 xvals(2) = this%xvertnext(i)
415 yvals(1) = this%yvert(i)
416 yvals(2) = this%yvertnext(i)
418 areasub(i) = area(xvals, yvals)
422 term =
done / (cell%defn%porosity * cell%defn%retfactor * this%dz)
423 do i = 1, this%nverts
424 this%vne(i) = -cell%defn%faceflow(i) * term / le(i)
428 divcell = sum(le * this%vne) / areacell
431 wk1 = this%xvert - this%xctr
432 wk2 = this%yvert - this%yctr
433 li = dsqrt(wk1 * wk1 + wk2 * wk2)
437 unextxnext = cshift(unintx, 1)
438 unextynext = cshift(uninty, 1)
441 xmid = 5.d-1 * (this%xvert + this%xctr)
442 ymid = 5.d-1 * (this%yvert + this%yctr)
445 wk1 = cshift(xmid, 1) - xmid
446 wk2 = cshift(ymid, 1) - ymid
447 lm = dsqrt(wk1 * wk1 + wk2 * wk2)
464 call this%calc_thru_hcsum(vm0i0, divcell, le, li, lm, areasub, areacell, &
465 unintx, uninty, unextx, unexty, &
466 unextxnext, unextynext, &
467 kappax, kappay, vm0x, vm0y, vm1x, vm1y, hcsum0)
469 vm0ival = vm0i0 + perturb
470 call this%calc_thru_hcsum(vm0ival, divcell, le, li, lm, areasub, areacell, &
471 unintx, uninty, unextx, unexty, &
472 unextxnext, unextynext, &
473 kappax, kappay, vm0x, vm0y, vm1x, vm1y, hcsum)
475 jac = (hcsum - hcsum0) / perturb
476 vm0ival = vm0i0 - hcsum0 / jac
477 call this%calc_thru_hcsum(vm0ival, divcell, le, li, lm, areasub, areacell, &
478 unintx, uninty, unextx, unexty, &
479 unextxnext, unextynext, &
480 kappax, kappay, vm0x, vm0y, vm1x, vm1y, hcsum)
485 this%vv0x = 2.d0 * vm0x - this%vctrx
486 this%vv0y = 2.d0 * vm0y - this%vctry
487 this%vv1x = 2.d0 * vm1x - this%vctrx
488 this%vv1y = 2.d0 * vm1y - this%vctry
491 term =
done / (cell%defn%retfactor * cell%defn%porosity * areacell)
492 this%vzbot = cell%defn%faceflow(this%nverts + 2) * term
493 this%vztop = -cell%defn%faceflow(this%nverts + 3) * term
514 deallocate (unextxnext)
515 deallocate (unextynext)