Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix sign error in documentation of Robin condition #968

Merged
merged 1 commit into from
Oct 16, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 17 additions & 17 deletions docs/source/USAGE.rst
Original file line number Diff line number Diff line change
Expand Up @@ -823,14 +823,14 @@ the value at the neighboring cell :math:`P` and the normal gradient at the bound
.. math::
:label: upwind1

\phi_f &\approx \phi_P - \left(\vec{d}_{fP}\cdot\nabla\phi\right)_f
\phi_f &\approx \phi_P + \left(\vec{d}_{Pf}\cdot\nabla\phi\right)_f
\\
&\approx \phi_P - \left(\hat{n}\cdot\nabla\phi\right)_f\left(\vec{d}_{fP}\cdot\hat{n}\right)_f
&\approx \phi_P + \left(\hat{n}\cdot\nabla\phi\right)_f\left(\vec{d}_{Pf}\cdot\hat{n}\right)_f

where :math:`\vec{d}_{fP}` is the distance vector from the face center to
the adjoining cell center. The approximation
:math:`\left(\vec{d}_{fP}\cdot\nabla\phi\right)_f \approx
\left(\hat{n}\cdot\nabla\phi\right)_f\left(\vec{d}_{fP}\cdot\hat{n}\right)_f`
where :math:`\vec{d}_{Pf}` is the distance vector to the center of the face
:math:`f` from the center of the adjoining cell :math:`P`. The
approximation :math:`\left(\vec{d}_{Pf}\cdot\nabla\phi\right)_f \approx
\left(\hat{n}\cdot\nabla\phi\right)_f\left(\vec{d}_{Pf}\cdot\hat{n}\right)_f`
is most valid when the mesh is orthogonal.

Substituting this expression into the Robin condition:
Expand All @@ -840,11 +840,11 @@ Substituting this expression into the Robin condition:

\hat{n}\cdot\left(\vec{a} \phi + b \nabla\phi\right)_f &= g \\
\hat{n}\cdot\left[\vec{a} \phi_P
- \vec{a} \left(\hat{n}\cdot\nabla\phi\right)_f\left(\vec{d}_{fP}\cdot\hat{n}\right)_f
+ \vec{a} \left(\hat{n}\cdot\nabla\phi\right)_f\left(\vec{d}_{Pf}\cdot\hat{n}\right)_f
+ b \nabla\phi\right]_f &\approx g \\
\left(\hat{n}\cdot\nabla\phi\right)_f
&\approx \frac{g_f - \left(\hat{n}\cdot\vec{a}\right)_f \phi_P}
{-\left(\vec{d}_{fP}\cdot\vec{a}\right)_f + b_f}
{\left(\vec{d}_{Pf}\cdot\vec{a}\right)_f + b_f}

we obtain an expression for the gradient at the boundary face in terms of
its neighboring cell. We can, in turn, substitute this back into
Expand All @@ -854,11 +854,11 @@ its neighboring cell. We can, in turn, substitute this back into
:label: upwind2

\phi_f &\approx \phi_P
- \frac{g_f - \left(\hat{n}\cdot\vec{a}\right)_f \phi_P}
{-\left(\vec{d}_{fP}\cdot\vec{a}\right)_f + b_f}
\left(\vec{d}_{fP}\cdot\hat{n}\right)_f \\
&\approx \frac{-g_f \left(\hat{n}\cdot\vec{d}_{fP}\right)_f + b_f\phi_P}
{- \left(\vec{d}_{fP}\cdot\vec{a}\right)_f + b_f}
+ \frac{g_f - \left(\hat{n}\cdot\vec{a}\right)_f \phi_P}
{\left(\vec{d}_{Pf}\cdot\vec{a}\right)_f + b_f}
\left(\vec{d}_{Pf}\cdot\hat{n}\right)_f \\
&\approx \frac{g_f \left(\hat{n}\cdot\vec{d}_{Pf}\right)_f + b_f\phi_P}
{\left(\vec{d}_{Pf}\cdot\vec{a}\right)_f + b_f}

to obtain the value on the boundary face in terms of the neighboring cell.

Expand All @@ -874,7 +874,7 @@ Substituting :eq:`Robin_facegrad` into the discretization of the
+ \sum_{f \in S_R} \Gamma_f \left(\hat{n}\cdot\nabla\phi\right)_f A_f \\
&\approx \sum_{f \notin S_R} \Gamma_f \left(\hat{n}\cdot\nabla\phi\right)_f A_f
+ \sum_{f \in S_R} \Gamma_f \frac{g_f - \left(\hat{n}\cdot\vec{a}\right)_f \phi_P}
{-\left(\vec{d}_{fP}\cdot\vec{a}\right)_f + b_f} A_f
{\left(\vec{d}_{Pf}\cdot\vec{a}\right)_f + b_f} A_f

An equation of the form

Expand All @@ -891,7 +891,7 @@ can be constrained to have a Robin condition at faces identified by
>>> a = FaceVariable(mesh=mesh, value=..., rank=1)
>>> b = FaceVariable(mesh=mesh, value=..., rank=0)
>>> g = FaceVariable(mesh=mesh, value=..., rank=0)
>>> RobinCoeff = (mask * Gamma0 * n / (-dPf.dot(a) + b)
>>> RobinCoeff = (mask * Gamma0 * n / (dPf.dot(a) + b)
>>> eqn = (TransientTerm() == DiffusionTerm(coeff=Gamma) + (RobinCoeff * g).divergence
... - ImplicitSourceTerm(coeff=(RobinCoeff * n.dot(a)).divergence)

Expand All @@ -905,8 +905,8 @@ substitute :eq:`upwind2`:
&\approx \sum_f \left(\hat{n}\cdot\vec{u}\right)_f \phi_f A_f \\
&= \sum_{f \notin S_R} \left(\hat{n}\cdot\vec{u}\right)_f \phi_f A_f
+ \sum_{f \in S_R} \left(\hat{n}\cdot\vec{u}\right)_f
\frac{-g_f \left(\hat{n}\cdot\vec{d}_{fP}\right)_f + b_f\phi_P}
{- \left(\vec{d}_{fP}\cdot\vec{a}\right)_f + b_f} A_f
\frac{g_f \left(\hat{n}\cdot\vec{d}_{Pf}\right)_f + b_f\phi_P}
{\left(\vec{d}_{Pf}\cdot\vec{a}\right)_f + b_f} A_f

.. note:: An expression like the heat flux convection boundary condition
:math:`-k\nabla T\cdot\hat{n} = h(T - T_\infty)` can be put in the form of the
Expand Down