224 class(GwfHfbType) :: this
225 integer(I4B) :: kiter
226 class(MatrixBaseType),
pointer :: matrix_sln
227 integer(I4B),
intent(in),
dimension(:) :: idxglo
228 real(DP),
intent(inout),
dimension(:) :: rhs
229 real(DP),
intent(inout),
dimension(:) :: hnew
231 integer(I4B) :: nodes, nja
232 integer(I4B) :: ihfb, n, m
234 integer(I4B) :: idiag, isymcon
235 integer(I4B) :: ixt3d
236 real(DP) :: cond, condhfb, aterm
237 real(DP) :: fawidth, faheight
238 real(DP) :: topn, topm, botn, botm
239 real(DP) :: viscratio
243 nodes = this%dis%nodes
244 nja = this%dis%con%nja
245 if (
associated(this%xt3d%ixt3d))
then
246 ixt3d = this%xt3d%ixt3d
253 do ihfb = 1, this%nhfb
254 n = min(this%noden(ihfb), this%nodem(ihfb))
255 m = max(this%noden(ihfb), this%nodem(ihfb))
257 if (this%ibound(n) == 0 .or. this%ibound(m) == 0) cycle
259 if (this%ivsc /= 0)
then
260 call this%vsc%get_visc_ratio(n, m, hnew(n), hnew(m), viscratio)
263 if (this%hydchr(ihfb) >
dzero)
then
264 if (this%inewton == 0)
then
265 ipos = this%idxloc(ihfb)
270 if (this%icelltype(n) == 1)
then
271 if (hnew(n) < topn) topn = hnew(n)
273 if (this%icelltype(m) == 1)
then
274 if (hnew(m) < topm) topm = hnew(m)
276 if (this%ihc(this%jas(ipos)) == 2)
then
277 faheight = min(topn, topm) - max(botn, botm)
279 faheight =
dhalf * ((topn - botn) + (topm - botm))
281 fawidth = this%hwva(this%jas(ipos))
282 condhfb = this%hydchr(ihfb) * viscratio * &
285 condhfb = this%hydchr(ihfb) * viscratio
288 condhfb = this%hydchr(ihfb)
291 call this%xt3d%xt3d_fhfb(kiter, nodes, nja, matrix_sln, idxglo, &
292 rhs, hnew, n, m, condhfb)
298 if (this%inewton == 0)
then
299 do ihfb = 1, this%nhfb
300 ipos = this%idxloc(ihfb)
301 aterm = matrix_sln%get_value_pos(idxglo(ipos))
304 if (this%ibound(n) == 0 .or. this%ibound(m) == 0) cycle
306 if (this%ivsc /= 0)
then
307 call this%vsc%get_visc_ratio(n, m, hnew(n), hnew(m), viscratio)
310 if (this%icelltype(n) == 1 .or. this%icelltype(m) == 1 .or. &
318 if (this%icelltype(n) == 1)
then
319 if (hnew(n) < topn) topn = hnew(n)
321 if (this%icelltype(m) == 1)
then
322 if (hnew(m) < topm) topm = hnew(m)
324 if (this%ihc(this%jas(ipos)) == 2)
then
325 faheight = min(topn, topm) - max(botn, botm)
327 faheight =
dhalf * ((topn - botn) + (topm - botm))
329 if (this%hydchr(ihfb) >
dzero)
then
330 fawidth = this%hwva(this%jas(ipos))
331 condhfb = this%hydchr(ihfb) * viscratio * &
333 cond = aterm * condhfb / (aterm + condhfb)
335 cond = -aterm * this%hydchr(ihfb)
339 this%condsav(ihfb) = cond
343 call matrix_sln%add_value_pos(idxglo(idiag), aterm - cond)
344 call matrix_sln%set_value_pos(idxglo(ipos), cond)
347 isymcon = this%isym(ipos)
349 call matrix_sln%add_value_pos(idxglo(idiag), aterm - cond)
350 call matrix_sln%set_value_pos(idxglo(isymcon), cond)