40 integer(I4B) :: limiter_id = 2
54 result(interpolation_scheme)
60 class(
igradienttype),
allocatable,
target,
intent(in) :: gradient
62 interpolation_scheme%dis => dis
63 interpolation_scheme%fmi => fmi
64 interpolation_scheme%gradient => gradient
68 function compute(this, n, m, iposnm, phi)
result(phi_face)
73 integer(I4B),
intent(in) :: n
74 integer(I4B),
intent(in) :: m
75 integer(I4B),
intent(in) :: iposnm
76 real(dp),
intent(in),
dimension(:) :: phi
78 integer(I4B) :: iup, idn, isympos
80 real(dp),
pointer :: coef_up, coef_dn
81 real(dp),
dimension(3) :: grad_c
82 real(dp),
dimension(3) :: dnm
86 real(dp) :: relative_distance
88 real(dp) :: min_phi, max_phi
90 isympos = this%dis%con%jas(iposnm)
91 qnm = this%fmi%gwfflowja(iposnm)
99 cl1 = this%dis%con%cl2(isympos)
100 cl2 = this%dis%con%cl1(isympos)
102 coef_up => phi_face%c_m
103 coef_dn => phi_face%c_n
108 cl1 = this%dis%con%cl1(isympos)
109 cl2 = this%dis%con%cl2(isympos)
111 coef_up => phi_face%c_n
112 coef_dn => phi_face%c_m
121 if (abs(phi(idn) - phi(iup)) <
dsame)
return
124 grad_c = this%gradient%get(iup, phi)
128 c_virtual = phi(idn) - 2.0_dp * (dot_product(grad_c, dnm))
135 if (c_virtual > max_phi)
then
139 if (c_virtual < max(min_phi,
dzero))
then
140 c_virtual = max(min_phi,
dzero)
144 smooth = (phi(iup) - c_virtual) / (phi(idn) - phi(iup))
147 alimiter = this%limiter(smooth)
150 relative_distance = cl1 / (cl1 + cl2)
151 phi_face%rhs = -relative_distance * alimiter * (phi(idn) - phi(iup))
165 integer(I4B),
intent(in) :: n
166 real(DP),
intent(in),
dimension(:) :: phi
167 real(DP),
intent(out) :: min_phi, max_phi
169 integer(I4B) :: ipos, m
173 do ipos = this%dis%con%ia(n) + 1, this%dis%con%ia(n + 1) - 1
174 m = this%dis%con%ja(ipos)
175 min_phi = min(min_phi, phi(m))
176 max_phi = max(max_phi, phi(m))
187 select case (this%limiter_id)
189 theta = max(0.0_dp, min((r + dabs(r)) / (1.0_dp + dabs(r)), 2.0_dp))
191 theta = max(0.0_dp, min(2.0_dp * r, &
192 1.0_dp / 3.0_dp + 2.0_dp / 3.0_dp * r, 2.0_dp))
194 theta = max(0.0_dp, min(2.0_dp * r, 1.0_dp), min(r, 2.0_dp))
196 theta = max(0.0_dp, (r * r + r) / (r * r + 1.0_dp))
198 theta = max(0.0_dp, min(4.0_dp * r * r + r, &
199 1.0_dp / 3.0_dp + 2.0_dp / 3.0_dp * r, 2.0_dp))
This module contains simulation constants.
real(dp), parameter dsame
real constant for values that are considered the same based on machine precision
real(dp), parameter dhalf
real constant 1/2
real(dp), parameter dzero
real constant zero
real(dp), parameter done
real constant 1
real(dp) function, dimension(3), public node_distance(dis, n, m)
Returns the vector distance from cell n to cell m.
This module defines variable data types.
type(coefficientstype) function, target compute(this, n, m, iposnm, phi)
subroutine find_local_extrema(this, n, phi, min_phi, max_phi)
type(utvdschemetype) function constructor(dis, fmi, gradient)
real(dp) function limiter(this, r)
Abstract interface for cell-based gradient computation.
Total Variation Diminishing (TVD) interpolation scheme.