322 class(MethodCellTernaryType),
intent(inout) :: this
327 real(DP),
allocatable,
dimension(:) :: xvals
328 real(DP),
allocatable,
dimension(:) :: yvals
335 real(DP),
allocatable,
dimension(:) :: wk1
336 real(DP),
allocatable,
dimension(:) :: wk2
337 real(DP),
allocatable,
dimension(:) :: unextxnext
338 real(DP),
allocatable,
dimension(:) :: unextynext
339 real(DP),
allocatable,
dimension(:) :: le
340 real(DP),
allocatable,
dimension(:) :: unextx
341 real(DP),
allocatable,
dimension(:) :: unexty
343 real(DP),
allocatable,
dimension(:) :: areasub
345 real(DP),
allocatable,
dimension(:) :: li
346 real(DP),
allocatable,
dimension(:) :: unintx
347 real(DP),
allocatable,
dimension(:) :: uninty
348 real(DP),
allocatable,
dimension(:) :: xmid
349 real(DP),
allocatable,
dimension(:) :: ymid
350 real(DP),
allocatable,
dimension(:) :: lm
351 real(DP),
allocatable,
dimension(:) :: umx
352 real(DP),
allocatable,
dimension(:) :: umy
353 real(DP),
allocatable,
dimension(:) :: kappax
354 real(DP),
allocatable,
dimension(:) :: kappay
355 real(DP),
allocatable,
dimension(:) :: vm0x
356 real(DP),
allocatable,
dimension(:) :: vm0y
357 real(DP),
allocatable,
dimension(:) :: vm1x
358 real(DP),
allocatable,
dimension(:) :: vm1y
360 select type (cell => this%cell)
361 type is (cellpolytype)
364 allocate (le(this%nverts))
365 allocate (unextx(this%nverts))
366 allocate (unexty(this%nverts))
367 allocate (areasub(this%nverts))
368 allocate (li(this%nverts))
369 allocate (unintx(this%nverts))
370 allocate (uninty(this%nverts))
371 allocate (xmid(this%nverts))
372 allocate (ymid(this%nverts))
373 allocate (lm(this%nverts))
374 allocate (umx(this%nverts))
375 allocate (umy(this%nverts))
376 allocate (kappax(this%nverts))
377 allocate (kappay(this%nverts))
378 allocate (vm0x(this%nverts))
379 allocate (vm0y(this%nverts))
380 allocate (vm1x(this%nverts))
381 allocate (vm1y(this%nverts))
382 allocate (unextxnext(this%nverts))
383 allocate (unextynext(this%nverts))
384 allocate (wk1(this%nverts))
385 allocate (wk2(this%nverts))
390 wk1 = this%xvertnext - this%xvert
391 wk2 = this%yvertnext - this%yvert
392 le = dsqrt(wk1 * wk1 + wk2 * wk2)
397 areacell = area(this%xvert, this%yvert)
400 sixa = areacell * 6.d0
401 wk1 = -(this%xvert * this%yvertnext - this%xvertnext * this%yvert)
402 this%xctr = sum((this%xvert + this%xvertnext) * wk1) / sixa
403 this%yctr = sum((this%yvert + this%yvertnext) * wk1) / sixa
406 do i = 1, this%nverts
407 xvals(1) = this%xvert(i)
408 xvals(2) = this%xvertnext(i)
410 yvals(1) = this%yvert(i)
411 yvals(2) = this%yvertnext(i)
413 areasub(i) = area(xvals, yvals)
417 term =
done / (cell%defn%porosity * cell%defn%retfactor * this%dz)
418 do i = 1, this%nverts
419 this%vne(i) = -cell%defn%faceflow(i) * term / le(i)
423 divcell = sum(le * this%vne) / areacell
426 wk1 = this%xvert - this%xctr
427 wk2 = this%yvert - this%yctr
428 li = dsqrt(wk1 * wk1 + wk2 * wk2)
432 unextxnext = cshift(unintx, 1)
433 unextynext = cshift(uninty, 1)
436 xmid = 5.d-1 * (this%xvert + this%xctr)
437 ymid = 5.d-1 * (this%yvert + this%yctr)
440 wk1 = cshift(xmid, 1) - xmid
441 wk2 = cshift(ymid, 1) - ymid
442 lm = dsqrt(wk1 * wk1 + wk2 * wk2)
459 call this%calc_thru_hcsum(vm0i0, divcell, le, li, lm, areasub, areacell, &
460 unintx, uninty, unextx, unexty, &
461 unextxnext, unextynext, &
462 kappax, kappay, vm0x, vm0y, vm1x, vm1y, hcsum0)
464 vm0ival = vm0i0 + perturb
465 call this%calc_thru_hcsum(vm0ival, divcell, le, li, lm, areasub, areacell, &
466 unintx, uninty, unextx, unexty, &
467 unextxnext, unextynext, &
468 kappax, kappay, vm0x, vm0y, vm1x, vm1y, hcsum)
470 jac = (hcsum - hcsum0) / perturb
471 vm0ival = vm0i0 - hcsum0 / jac
472 call this%calc_thru_hcsum(vm0ival, divcell, le, li, lm, areasub, areacell, &
473 unintx, uninty, unextx, unexty, &
474 unextxnext, unextynext, &
475 kappax, kappay, vm0x, vm0y, vm1x, vm1y, hcsum)
480 this%vv0x = 2.d0 * vm0x - this%vctrx
481 this%vv0y = 2.d0 * vm0y - this%vctry
482 this%vv1x = 2.d0 * vm1x - this%vctrx
483 this%vv1y = 2.d0 * vm1y - this%vctry
486 term =
done / (cell%defn%retfactor * cell%defn%porosity * areacell)
487 this%vzbot = cell%defn%faceflow(this%nverts + 2) * term
488 this%vztop = -cell%defn%faceflow(this%nverts + 3) * term
509 deallocate (unextxnext)
510 deallocate (unextynext)