Skip to content

Commit 202deb0

Browse files
committed
Use more consistent English naming for RHS.
1 parent c6da803 commit 202deb0

File tree

7 files changed

+150
-154
lines changed

7 files changed

+150
-154
lines changed

docs/theory/cfbase.tex

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -941,7 +941,7 @@ \subsection*{Arbre d'appel simplifié}
941941
à \fort{cfbsc2} et non pas à \fort{cs\_balance}.
942942
Il diffère de \fort{cs\_equation\_iterative\_solve} par quelques autres détails qui ne sont pas
943943
gênants dans l'immédiat~:
944-
initialisation de PVARA et de SMBINI,
944+
initialisation de PVARA et de RHSINI,
945945
%nombre d'itérations pour le second membre (NSWRSM-1 au lieu de NSWRSM),
946946
%mode de détermination du solveur (IRESLP),
947947
%test de convergence sur RNORM (comparé à 0.D0 au lieu de EPZERO),
@@ -968,11 +968,11 @@ \section*{Points à traiter}
968968
\begin{itemize}
969969
\item \fort{cfcdts} et \fort{cs\_equation\_iterative\_solve},
970970
%(actuellement pour PVARA et
971-
% SMBINI, mais à plus long terme pour éviter que les
971+
% RHSINI, mais à plus long terme pour éviter que les
972972
% deux sous-programmes ne divergent),
973973
% propose en patch 1.2.1
974974
% \item \fort{cfcdts} et \fort{cs\_equation\_iterative\_solve}
975-
% (au moins pour PVARA, SMBINI, NSWRSM,
975+
% (au moins pour PVARA, RHSINI, NSWRSM,
976976
% IRESLP, RNORM),
977977
\item \fort{cfbsc2} et \fort{cs\_balance},
978978
\item \fort{cfbsc3} et \fort{cs\_balance}.

docs/theory/cs_equation_iterative_solve.tex

Lines changed: 28 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -178,16 +178,12 @@ \section*{Implementation}
178178
- determination of the properties of the $\tens{EM}_{n}$ matrix (symmetric
179179
if there is no convection, asymmetric otherwise)\\
180180
- automatic selection of the solution method for its inversion if the user has not already
181-
specified one for the variable being treated. The Jacobi method is used by default for every convected scalar variable $a$. The methods available are the conjugate gradient method, Jacobi's and the
182-
bi-conjugate gradient stabilised method ($BICGStab$) for asymmetric matrices. Diagonal pre-conditioning can be implemented and is used by default for all of these solvers except for Jacobi.\\
183-
- consideration of the periodicity (translation or rotation of a scalar, vector or tensor),\\
184-
- construction of the $\tens{EM}_{n}$ matrix corresponding to the linear operator $\mathcal{EM}_{n}$ through a call to the subroutine
185-
\fort{matrix}\footnote{ Remember that in \fort{matrix}, regardless of the user's choice, a first-order in space upwind scheme is always used to treat the convection and there is no reconstruction for
181+
specified one for the variable being treated. By default, a hybrid Gauss-Seidel or Jacobi method is used by default for every convected scalar variable $a$, as these methods are usually the fastest when diagonal dominance is high (which is the case when the time step is small).\\
182+
- construction of the $\tens{EM}_{n}$ matrix corresponding to the linear operator $\mathcal{EM}_{n}$ through a call to the
183+
\fort{cs\_matrix\_compute\_coeffs} function\footnote{Remember that in \fort{cs\_matrix\_compute\_coeffs}, regardless of the user's choice, a first-order in space upwind scheme is always used to treat the convection and there is no reconstruction for
186184
the diffusive flux. The user's choice of numerical scheme for the convection is only applied for the integration
187185
of the convection terms of $\mathcal{E}_{n}$, on the right-hand side of
188-
(\ref{Base_Codits_Eq_Codits}), which computed in the subroutine \fort{cs\_balance}.}. The implicit terms corresponding to the diagonal part of the matrix and hence to the zeroth-order linear differential contributions in $a^{n+1}$,({\it i.e.} $f_s^{imp}$), are stored in the array \var{ROVSDT} (realized before the subroutine calls \fort{cs\_equation\_iterative\_solve}).\\
189-
- creation of the grid hierarchy if the multigrid algorithm is used
190-
($ \var{IMGRP}\,>0 $).\\
186+
(\ref{Base_Codits_Eq_Codits}), which are computed in the \fort{cs\_balance} functions.}. The implicit terms corresponding to the diagonal part of the matrix and hence to the zeroth-order linear differential contributions in $a^{n+1}$,({\it i.e.} $f_s^{imp}$), are stored in the array \var{ROVSDT} (realized before the subroutine calls \fort{cs\_equation\_iterative\_solve}).\\
191187
- call to \fort{cs\_balance} to take the explicit convection-diffusion into account should
192188
$\theta \ne 0$.\\
193189
- loop over the number of iterations from 1 to $\var{NSWRSM}$ (which is called $\var{NSWRSP}$ in \fort{cs\_equation\_iterative\_solve}).
@@ -207,40 +203,40 @@ \section*{Implementation}
207203
The loop in $k$ is then the following:
208204
\begin{itemize}
209205
\item Computation of the right-hand side of the equation, without the contribution of
210-
the explicit convection-diffusion terms $\var{SMBINI}$; as for the whole right-hand side corresponding
211-
to $\mathcal{E}_{n}(a^{n+1,\,k-1})$, it is stored in the array $\var{SMBRP}$,
212-
initialised by $\var{SMBINI}$ and completed with the reconstructed
206+
the explicit convection-diffusion terms $\var{RHSINI}$; as for the whole right-hand side corresponding
207+
to $\mathcal{E}_{n}(a^{n+1,\,k-1})$, it is stored in the array $\var{RHS}$,
208+
initialised by $\var{RHSINI}$ and completed with the reconstructed
213209
convection-diffusion terms by a call to the subroutine \fort{cs\_balance}.\\
214-
At iteration $k$, $\var{SMBINI}$ noted $\var{SMBINI}^{\,k}$ is equal to:\\
210+
At iteration $k$, $\var{RHSINI}$ noted $\var{RHSINI}^{\,k}$ is equal to:\\
215211
\begin{equation}\notag
216-
\var{SMBINI}^{\,k}\ = f_s^{\,exp}-(1-\theta)\,\left[\,\dive((\rho \underline{u})\,a^n) - \dive(\mu_{\,tot}\,\grad a^n)\,\right]-\,f_s^{\,imp}(\,a^{n+1,\,k-1} - a^n\,) \\
212+
\var{RHSINI}^{\,k}\ = f_s^{\,exp}-(1-\theta)\,\left[\,\dive((\rho \underline{u})\,a^n) - \dive(\mu_{\,tot}\,\grad a^n)\,\right]-\,f_s^{\,imp}(\,a^{n+1,\,k-1} - a^n\,) \\
217213
\end{equation}
218214
\\
219215
$\bullet$ Before starting the loop over $k$, a first call to the subroutine \fort{cs\_balance} with $\var{THETAP}=1-\theta$ serves to take the explicit part (from the time advancement scheme) of the convection-diffusion terms into account.
220216
\begin{equation}\notag
221217
\displaystyle
222-
\var{SMBRP}^{\,0} = f_s^{\,exp} -(1-\theta)\,[\,\dive((\rho \underline{u})\,a^n) - \dive(\mu_{\,tot}\,\grad a^n)\,]\\
218+
\var{RHS}^{\,0} = f_s^{\,exp} -(1-\theta)\,[\,\dive((\rho \underline{u})\,a^n) - \dive(\mu_{\,tot}\,\grad a^n)\,]\\
223219
\end{equation}
224-
Similarly, before looping on $k$, the right-hand side $\var{SMBRP}^{\,0}$ is stored in the array $\var{SMBINI}^{\,0}$ and serves to initialize the computation.
220+
Similarly, before looping on $k$, the right-hand side $\var{RHS}^{\,0}$ is stored in the array $\var{RHSINI}^{\,0}$ and serves to initialize the computation.
225221
\begin{equation}\notag
226-
\var{SMBINI}^{\,0} =\var{SMBRP}^{\,0}
222+
\var{RHSINI}^{\,0} =\var{RHS}^{\,0}
227223
\end{equation}
228224
\\
229225
$\bullet$ for $k = 1$,
230226
\begin{equation}\notag
231227
\begin{array}{ll}
232-
\var{SMBINI}^{\,1}\ &=f_s^{\,exp}-(1-\theta)\,\left[\,\dive((\rho \underline{u})\,a^n) - \dive(\mu_{\,tot}\,\grad a^n)\,\right]-\,f_s^{\,imp}\,(\,a^{n+1,\,0} - a^n\,)\\
228+
\var{RHSINI}^{\,1}\ &=f_s^{\,exp}-(1-\theta)\,\left[\,\dive((\rho \underline{u})\,a^n) - \dive(\mu_{\,tot}\,\grad a^n)\,\right]-\,f_s^{\,imp}\,(\,a^{n+1,\,0} - a^n\,)\\
233229
&=f_s^{\,exp}- (1-\theta)\,\left[\,\dive((\rho \underline{u})\,a^{n+1,\,0}) - \dive(\mu_{\,tot}\,\grad a^{n+1,\,0})\,\right]-f_s^{\,imp}\,\delta a^{n+1,\,0} \\
234230
\end{array}
235231
\end{equation}
236232
This calculation is thus represented by a corresponding sequence of operations on the arrays:
237233
\begin{equation}\notag
238-
\var{SMBINI}^{\,1}\ =\ \var{SMBINI}^{\,0} - \var{ROVSDT}\,*(\,\var{PVAR}-\,\var{PVARA})
234+
\var{RHSINI}^{\,1}\ =\ \var{RHSINI}^{\,0} - \var{ROVSDT}\,*(\,\var{PVAR}-\,\var{PVARA})
239235
\end{equation}
240-
and $\var{SMBRP}^{\,1}$ is completed by a second call to the subroutine \fort{cs\_balance} with $\var{THETAP}=\theta$, so that the implicit part of the convection-diffusion computation is added to the right-hand side.
236+
and $\var{RHS}^{\,1}$ is completed by a second call to the subroutine \fort{cs\_balance} with $\var{THETAP}=\theta$, so that the implicit part of the convection-diffusion computation is added to the right-hand side.
241237
\begin{equation}\notag
242238
\begin{array}{ll}
243-
\var{SMBRP}^{\,1} & = \var{SMBINI}^{\,1} -\theta\,\left[\,\dive((\rho \underline{u})\,a^{n+1,\,0}) - \dive(\mu_{\,tot}\,\grad a^{n+1,\,0})\,\right]\\
239+
\var{RHS}^{\,1} & = \var{RHSINI}^{\,1} -\theta\,\left[\,\dive((\rho \underline{u})\,a^{n+1,\,0}) - \dive(\mu_{\,tot}\,\grad a^{n+1,\,0})\,\right]\\
244240
& = f_s^{\,exp}\ - (1-\theta)\,\left[\,\dive((\rho \underline{u})\,a^{n}) - \dive(\mu_{\,tot}\,\grad a^{n})\,\right]- f_s^{\,imp}\,(a^{n+1,\,0} -a^{n}) \\
245241
& -\theta\,\left[\,\dive((\rho \underline{u})\,a^{n+1,\,0}) - \dive(\mu_{\,tot}\,\grad a^{n+1,\,0})\,\right]\\
246242
\end{array}
@@ -249,32 +245,32 @@ \section*{Implementation}
249245
In a similar fashion, we obtain:
250246
\begin{equation}\notag
251247
\begin{array}{ll}
252-
\var{SMBINI}^{\,2}\ &=f_s^{\,exp}-(1-\theta)\,\left[\,\dive((\rho \underline{u})\,a^n) - \dive(\mu_{\,tot}\,\grad a^n)\,\right]-\,f_s^{\,imp}\,(\,a^{n+1,\,1} - a^n\,)\\
248+
\var{RHSINI}^{\,2}\ &=f_s^{\,exp}-(1-\theta)\,\left[\,\dive((\rho \underline{u})\,a^n) - \dive(\mu_{\,tot}\,\grad a^n)\,\right]-\,f_s^{\,imp}\,(\,a^{n+1,\,1} - a^n\,)\\
253249
\end{array}
254250
\end{equation}
255251

256252
Hence, the equivalent array formula:
257253
\begin{equation}\notag
258-
\var{SMBINI}^{\,2}\ =\ \var{SMBINI}^{\,1} - \var{ROVSDT}\,*\,\var{DPVAR}^{\,1}
254+
\var{RHSINI}^{\,2}\ =\ \var{RHSINI}^{\,1} - \var{ROVSDT}\,*\,\var{DPVAR}^{\,1}
259255
\end{equation}
260256
the call to the subroutine \fort{cs\_balance} being systematically made thereafter with $\var{THETAP}=\theta$, we likewise obtain:
261257
\begin{equation}\notag
262258
\begin{array}{ll}
263-
\var{SMBRP}^{\,2}\ &=\ \var{SMBINI}^{\,2}-\theta\left[\dive\left((\rho \underline{u})\,a^{n+1,\,1}\right)- \dive\left(\mu_{\,tot}\,\grad \,a^{n+1,\,1}\right)\right]\\
259+
\var{RHS}^{\,2}\ &=\ \var{RHSINI}^{\,2}-\theta\left[\dive\left((\rho \underline{u})\,a^{n+1,\,1}\right)- \dive\left(\mu_{\,tot}\,\grad \,a^{n+1,\,1}\right)\right]\\
264260
\end{array}
265261
\end{equation}
266262
where
267263
\begin{equation}\notag
268264
a^{n+1,\,1}=\var{PVAR}^{\,1}=\var{PVAR}^{\,0}+\var{DPVAR}^{\,1}=a^{n+1,\,0}+\delta a^{n+1,\,1}
269265
\end{equation}
270266
$\bullet$ for iteration $k+1$,\\
271-
The array $\var{SMBINI}^{\,k+1}$ initialises the entire right side
272-
$\var{SMBRP}^{\,k+1}$ to which will be added the convective and diffusive contributions
267+
The array $\var{RHSINI}^{\,k+1}$ initialises the entire right side
268+
$\var{RHS}^{\,k+1}$ to which will be added the convective and diffusive contributions
273269
{\it via} the subroutine \fort{cs\_balance}.\\
274270
The array formula is given by:
275271
\begin{equation}\notag
276272
\begin{array}{ll}
277-
\var{SMBINI}^{\,k+1}\ &= \var{SMBINI}^{\,k} - \var{ROVSDT}\,*\,\var{DPVAR}^{\,k}\\
273+
\var{RHSINI}^{\,k+1}\ &= \var{RHSINI}^{\,k} - \var{ROVSDT}\,*\,\var{DPVAR}^{\,k}\\
278274
\end{array}
279275
\end{equation}
280276
Then follows the computation and the addition of the reconstructed convection-diffusion terms of
@@ -283,10 +279,10 @@ \section*{Implementation}
283279
(first-order accurate in space upwind scheme, centred scheme with second-order spatial discretisation, second-order
284280
linear upwind "SOLU" scheme or a weighted average (blending) of one of the second-order schemes (either centred or SOLU) and the first-order upwind scheme, with potential use of a slope test).\\
285281
This contribution (convection-diffusion) is then added in to the right side of the
286-
equation $\var{SMBRP}^{\,k+1}$ (initialised by $\var{SMBINI}^{\,k+1}$).
282+
equation $\var{RHS}^{\,k+1}$ (initialised by $\var{RHSINI}^{\,k+1}$).
287283
\begin{equation}\notag
288284
\begin{array}{ll}
289-
\var{SMBRP}^{\,k+1}\ &= \var{SMBINI}^{\,k+1} - \theta\,\left[\,\dive\left((\rho \underline{u})\,a^{n+1,\,k}\right)- \dive\left(\mu_{\,tot}\,\grad a^{n+1,\,k}\right)\right]\\
285+
\var{RHS}^{\,k+1}\ &= \var{RHSINI}^{\,k+1} - \theta\,\left[\,\dive\left((\rho \underline{u})\,a^{n+1,\,k}\right)- \dive\left(\mu_{\,tot}\,\grad a^{n+1,\,k}\right)\right]\\
290286
& = f_s^{\,exp}-(1-\theta)\,\left[\,\dive((\rho \underline{u})\,a^n) - \dive(\mu_{\,tot}\,\grad a^n)\,\right]- f_s^{\,imp}\,(a^{n+1,\,k} -a^{n}) \\
291287
&-\theta\,\left[\,\dive((\rho \underline{u})\,a^{n+1,k}) - \dive(\mu_{\,tot}\,\grad a^{n+1,k})\,\right]\\
292288
\end{array}
@@ -305,21 +301,21 @@ \section*{Implementation}
305301

306302
\item Treatment of parallelism and of the periodicity.
307303
\item Test of convergence:\\
308-
The test involves the quantity $||\var{SMBRP}^{\,k+1}|| < \varepsilon
309-
||\tens{EM}_{n}(a^{n}) + \var{SMBRP}^{\,1}|| $, where $||\,.\,||$ denotes the
304+
The test involves the quantity $||\var{RHS}^{\,k+1}|| < \varepsilon
305+
||\tens{EM}_{n}(a^{n}) + \var{RHS}^{\,1}|| $, where $||\,.\,||$ denotes the
310306
Euclidean norm. The solution sought is $a^{\,n+1} = a^{n+1,\,k+1}$. If the test is satisfied, then convergence has been reached and we exit the iteration loop. \\
311307
If not, we continue to iterate until the upper limit of iterations imposed by $\var{NSWRSM}$ in \fort{usini1} is reached.\\
312308
The condition for convergence is also written, in continuous form, as:
313309
\begin{equation}\notag
314310
\begin{array}{ll}
315-
||\var{SMBRP}^{\,k+1}||& < \varepsilon ||f_s^{\,exp}\ - \dive((\rho \underline{u})\,a^{n}) + \dive(\mu_{\,tot}\,\grad a^{n}) \\
311+
||\var{RHS}^{\,k+1}||& < \varepsilon ||f_s^{\,exp}\ - \dive((\rho \underline{u})\,a^{n}) + \dive(\mu_{\,tot}\,\grad a^{n}) \\
316312
& +[\dive((\rho \underline{u})\,a^{n})]^{\textit{amont}} + [\dive(\mu_{\,tot}\,\grad a^{n})]^{\textit{N Rec}}||\\
317313
\end{array}
318314
\end{equation}
319315
As a consequence, on orthogonal mesh with an upwind convection scheme and in the absence of source terms, the sequence converges in theory in a single iteration because, by construction:
320316
\begin{equation}\notag
321317
\begin{array}{ll}
322-
||\var{SMBRP}^{\,2}||=\,0\,& < \varepsilon ||f_s^{\,exp}||
318+
||\var{RHS}^{\,2}||=\,0\,& < \varepsilon ||f_s^{\,exp}||
323319
\end{array}
324320
\end{equation}
325321
\end{itemize}

0 commit comments

Comments
 (0)