324 class(MethodCellTernaryType),
intent(inout) :: this
329 real(DP),
allocatable,
dimension(:) :: xvals
330 real(DP),
allocatable,
dimension(:) :: yvals
337 real(DP),
allocatable,
dimension(:) :: wk1
338 real(DP),
allocatable,
dimension(:) :: wk2
339 real(DP),
allocatable,
dimension(:) :: unextxnext
340 real(DP),
allocatable,
dimension(:) :: unextynext
341 real(DP),
allocatable,
dimension(:) :: le
342 real(DP),
allocatable,
dimension(:) :: unextx
343 real(DP),
allocatable,
dimension(:) :: unexty
345 real(DP),
allocatable,
dimension(:) :: areasub
347 real(DP),
allocatable,
dimension(:) :: li
348 real(DP),
allocatable,
dimension(:) :: unintx
349 real(DP),
allocatable,
dimension(:) :: uninty
350 real(DP),
allocatable,
dimension(:) :: xmid
351 real(DP),
allocatable,
dimension(:) :: ymid
352 real(DP),
allocatable,
dimension(:) :: lm
353 real(DP),
allocatable,
dimension(:) :: umx
354 real(DP),
allocatable,
dimension(:) :: umy
355 real(DP),
allocatable,
dimension(:) :: kappax
356 real(DP),
allocatable,
dimension(:) :: kappay
357 real(DP),
allocatable,
dimension(:) :: vm0x
358 real(DP),
allocatable,
dimension(:) :: vm0y
359 real(DP),
allocatable,
dimension(:) :: vm1x
360 real(DP),
allocatable,
dimension(:) :: vm1y
362 select type (cell => this%cell)
363 type is (cellpolytype)
366 allocate (le(this%nverts))
367 allocate (unextx(this%nverts))
368 allocate (unexty(this%nverts))
369 allocate (areasub(this%nverts))
370 allocate (li(this%nverts))
371 allocate (unintx(this%nverts))
372 allocate (uninty(this%nverts))
373 allocate (xmid(this%nverts))
374 allocate (ymid(this%nverts))
375 allocate (lm(this%nverts))
376 allocate (umx(this%nverts))
377 allocate (umy(this%nverts))
378 allocate (kappax(this%nverts))
379 allocate (kappay(this%nverts))
380 allocate (vm0x(this%nverts))
381 allocate (vm0y(this%nverts))
382 allocate (vm1x(this%nverts))
383 allocate (vm1y(this%nverts))
384 allocate (unextxnext(this%nverts))
385 allocate (unextynext(this%nverts))
386 allocate (wk1(this%nverts))
387 allocate (wk2(this%nverts))
392 wk1 = this%xvertnext - this%xvert
393 wk2 = this%yvertnext - this%yvert
394 le = dsqrt(wk1 * wk1 + wk2 * wk2)
399 areacell = area(this%xvert, this%yvert)
402 sixa = areacell * 6.d0
403 wk1 = -(this%xvert * this%yvertnext - this%xvertnext * this%yvert)
404 this%xctr = sum((this%xvert + this%xvertnext) * wk1) / sixa
405 this%yctr = sum((this%yvert + this%yvertnext) * wk1) / sixa
408 do i = 1, this%nverts
409 xvals(1) = this%xvert(i)
410 xvals(2) = this%xvertnext(i)
412 yvals(1) = this%yvert(i)
413 yvals(2) = this%yvertnext(i)
415 areasub(i) = area(xvals, yvals)
419 term =
done / (cell%defn%porosity * cell%defn%retfactor * this%dz)
420 do i = 1, this%nverts
421 this%vne(i) = -cell%defn%faceflow(i) * term / le(i)
425 divcell = sum(le * this%vne) / areacell
428 wk1 = this%xvert - this%xctr
429 wk2 = this%yvert - this%yctr
430 li = dsqrt(wk1 * wk1 + wk2 * wk2)
434 unextxnext = cshift(unintx, 1)
435 unextynext = cshift(uninty, 1)
438 xmid = 5.d-1 * (this%xvert + this%xctr)
439 ymid = 5.d-1 * (this%yvert + this%yctr)
442 wk1 = cshift(xmid, 1) - xmid
443 wk2 = cshift(ymid, 1) - ymid
444 lm = dsqrt(wk1 * wk1 + wk2 * wk2)
461 call this%calc_thru_hcsum(vm0i0, divcell, le, li, lm, areasub, areacell, &
462 unintx, uninty, unextx, unexty, &
463 unextxnext, unextynext, &
464 kappax, kappay, vm0x, vm0y, vm1x, vm1y, hcsum0)
466 vm0ival = vm0i0 + perturb
467 call this%calc_thru_hcsum(vm0ival, divcell, le, li, lm, areasub, areacell, &
468 unintx, uninty, unextx, unexty, &
469 unextxnext, unextynext, &
470 kappax, kappay, vm0x, vm0y, vm1x, vm1y, hcsum)
472 jac = (hcsum - hcsum0) / perturb
473 vm0ival = vm0i0 - hcsum0 / jac
474 call this%calc_thru_hcsum(vm0ival, divcell, le, li, lm, areasub, areacell, &
475 unintx, uninty, unextx, unexty, &
476 unextxnext, unextynext, &
477 kappax, kappay, vm0x, vm0y, vm1x, vm1y, hcsum)
482 this%vv0x = 2.d0 * vm0x - this%vctrx
483 this%vv0y = 2.d0 * vm0y - this%vctry
484 this%vv1x = 2.d0 * vm1x - this%vctrx
485 this%vv1y = 2.d0 * vm1y - this%vctry
488 term =
done / (cell%defn%retfactor * cell%defn%porosity * areacell)
489 this%vzbot = cell%defn%faceflow(this%nverts + 2) * term
490 this%vztop = -cell%defn%faceflow(this%nverts + 3) * term
511 deallocate (unextxnext)
512 deallocate (unextynext)