Skip to content

Commit 0c9953f

Browse files
authored
docs(prt): improve docstrings, use LENBOUNDNAME in mf6io (#1840)
* add optional tol dummy arg to nudge() routine in MethodSubcellTernary, better dummy arg naming, improve docstring * use LENBOUNDNAME instead of hardcoded 40 in mf6io document * clarify docstring for shared_face() routine in GeomUtil
1 parent 6fca5e6 commit 0c9953f

File tree

4 files changed

+50
-37
lines changed

4 files changed

+50
-37
lines changed

doc/mf6io/framework/binaryoutput.tex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -771,7 +771,7 @@ \subsection{Particle Track File}
771771
\noindent Field 12: \texttt{`X'} {\color{red} \footnotesize{DOUBLE}} \\
772772
\noindent Field 13: \texttt{`Y'} {\color{red} \footnotesize{DOUBLE}} \\
773773
\noindent Field 14: \texttt{`Z'} {\color{red} \footnotesize{DOUBLE}} \\
774-
\noindent Field 15: \texttt{`NAME'} {\color{red} \footnotesize{CHARACTER(LEN=40)}} \\
774+
\noindent Field 15: \texttt{`NAME'} {\color{red} \footnotesize{CHARACTER(LEN=LENBOUNDNAME)}} \\
775775
776776
\vspace{4mm}
777777
\noindent The ``NAME'' field may be empty.

doc/mf6io/prt/prt.tex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ \subsection{Particle Track Output}
4141
\noindent Column 12: \texttt{`X'} {\color{red} \footnotesize{DOUBLE}} \\
4242
\noindent Column 13: \texttt{`Y'} {\color{red} \footnotesize{DOUBLE}} \\
4343
\noindent Column 14: \texttt{`Z'} {\color{red} \footnotesize{DOUBLE}} \\
44-
\noindent Column 15: \texttt{`NAME'} {\color{red} \footnotesize{CHARACTER(LEN=40)}} \\
44+
\noindent Column 15: \texttt{`NAME'} {\color{red} \footnotesize{CHARACTER(LEN=LENBOUNDNAME)}} \\
4545

4646
\vspace{2mm}
4747
\noindent where

src/Solution/ParticleTracker/MethodSubcellTernary.f90

Lines changed: 47 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module MethodSubcellTernaryModule
22
use KindModule, only: DP, I4B, LGP
3-
use ConstantsModule, only: DZERO, DSAME, DHALF, DONE, DTWO
3+
use ConstantsModule, only: DZERO, DSAME, DHALF, DONE, DTWO, DONETHIRD
44
use ErrorUtilModule, only: pstop
55
use GeomUtilModule, only: skew
66
use MethodModule, only: MethodType
@@ -61,91 +61,104 @@ subroutine apply_mst(this, particle, tmax)
6161
end select
6262
end subroutine apply_mst
6363

64-
!> @brief Nudge barycentric coordinates such that none is less
65-
!! than distance DSAME from any edge of the canonical subcell.
64+
!> @brief Nudge barycentric coordinates into the interior of
65+
!! the canonical subcell such that the point is at least the
66+
!! minimal distance tol from any face.
6667
!!
6768
!! Assumes 1 = alpha + beta + gamma, and 0 <= alpha <= 1 (and
6869
!! likewise for beta and gamma). The latter is not strictly
6970
!! required but it should be established that a particle is
70-
!! _roughly_ in a given subcell before calling this routine.
71+
!! roughly in a given subcell before calling this routine.
7172
!<
72-
subroutine nudge(alpi, beti, gami)
73+
subroutine nudge(alpha, beta, gamma, tol)
7374
! dummy
74-
real(DP), intent(inout) :: alpi
75-
real(DP), intent(inout) :: beti
76-
real(DP), intent(out) :: gami
75+
real(DP), intent(inout) :: alpha
76+
real(DP), intent(inout) :: beta
77+
real(DP), intent(out) :: gamma
78+
real(DP), intent(in), optional :: tol
7779
! local
7880
real(DP) :: lolimit
7981
real(DP) :: hilimit
8082
real(DP) :: delta
83+
real(DP) :: ltol
8184

82-
gami = DONE - alpi - beti
83-
lolimit = DSAME
84-
hilimit = DONE - DTWO * DSAME
85+
if (present(tol)) then
86+
ltol = tol
87+
if (tol < DZERO .or. tol > DONETHIRD) then
88+
print *, "error -- tolerance must be between 0 and 1/3, inclusive"
89+
call pstop(1)
90+
end if
91+
else
92+
ltol = DSAME
93+
end if
94+
95+
gamma = DONE - alpha - beta
96+
lolimit = ltol
97+
hilimit = DONE - DTWO * ltol
8598
! Check alpha coordinate against lower limit
86-
if (alpi < lolimit) then
99+
if (alpha < lolimit) then
87100
! Alpha is too low, so nudge alpha to lower limit; this is a move
88101
! parallel to the "alpha axis," which also changes gamma
89-
alpi = lolimit
90-
gami = DONE - alpi - beti
102+
alpha = lolimit
103+
gamma = DONE - alpha - beta
91104
! Check beta coordinate against lower limit (which in this
92105
! case is equivalent to checking gamma coordinate against
93106
! upper limit)
94-
if (beti < lolimit) then
107+
if (beta < lolimit) then
95108
! Beta is too low (gamma is too high), so nudge beta to lower limit;
96109
! this is a move parallel to the "beta axis," which also changes gamma
97-
beti = lolimit
98-
gami = hilimit
110+
beta = lolimit
111+
gamma = hilimit
99112
! Check beta coordinate against upper limit (which in this
100113
! case is equivalent to checking gamma coordinate against
101114
! lower limit)
102-
else if (beti > hilimit) then
115+
else if (beta > hilimit) then
103116
! Beta is too high (gamma is too low), so nudge beta to lower limit;
104117
! this is a move parallel to the "beta axis," which also changes gamma
105-
beti = hilimit
106-
gami = lolimit
118+
beta = hilimit
119+
gamma = lolimit
107120
end if
108121
end if
109122
! Check beta coordinate against lower limit. (If alpha coordinate
110123
! was nudged to lower limit, beta and gamma coordinates have also
111124
! been adjusted as necessary to place particle within subcell, and
112125
! subsequent checks on beta and gamma will evaluate to false, and
113126
! no further adjustments will be made.)
114-
if (beti < lolimit) then
127+
if (beta < lolimit) then
115128
! Beta is too low, so nudge beta to lower limit; this is a move
116129
! parallel to the "beta axis," which also changes gamma
117-
beti = lolimit
118-
gami = DONE - alpi - beti
130+
beta = lolimit
131+
gamma = DONE - alpha - beta
119132
! Check alpha coordinate against lower limit (which in this
120133
! case is equivalent to checking gamma coordinate against
121134
! upper limit)
122-
if (alpi < lolimit) then
135+
if (alpha < lolimit) then
123136
! Alpha is too low (gamma is too high), so nudge alpha to lower limit;
124137
! this is a move parallel to the "alpha axis," which also changes gamma
125-
alpi = lolimit
126-
gami = hilimit
138+
alpha = lolimit
139+
gamma = hilimit
127140
! Check alpha coordinate against upper limit (which in this
128141
! case is equivalent to checking gamma coordinate against
129142
! lower limit)
130-
else if (alpi > hilimit) then
143+
else if (alpha > hilimit) then
131144
! Alpha is too high (gamma is too low), so nudge alpha to lower limit;
132145
! this is a move parallel to the "alpha axis," which also changes gamma
133-
alpi = hilimit
134-
gami = lolimit
146+
alpha = hilimit
147+
gamma = lolimit
135148
end if
136149
end if
137150
! Check gamma coordinate against lower limit.(If alpha and/or beta
138151
! coordinate was nudged to lower limit, gamma coordinate has also
139152
! been adjusted as necessary to place particle within subcell, and
140153
! subsequent check on gamma will evaluate to false, and no further
141154
! adjustment will be made.)
142-
if (gami < lolimit) then
155+
if (gamma < lolimit) then
143156
! Gamma is too low, so nudge gamma to lower limit; this is a move
144157
! parallel to the "gamma axis," which also changes alpha and beta
145-
delta = DHALF * (lolimit - gami)
146-
gami = DSAME
147-
alpi = alpi - delta
148-
beti = beti - delta
158+
delta = DHALF * (lolimit - gamma)
159+
gamma = ltol
160+
alpha = alpha - delta
161+
beta = beta - delta
149162
end if
150163
end subroutine nudge
151164

src/Utilities/GeomUtil.f90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ end function area
389389

390390
!> @brief Find the lateral face shared by two cells.
391391
!!
392-
!! Find the lateral (horizontal) face shared by the given cells.
392+
!! Find the lateral (x-y plane) face shared by the given cells.
393393
!! The iface return argument will be 0 if they share no such face,
394394
!! otherwise the index of the shared face in cell 1's vertex array,
395395
!! where face N connects vertex N to vertex N + 1 going clockwise.

0 commit comments

Comments
 (0)