Skip to main content
added 21 characters in body
Source Link
H. Rittich
  • 558
  • 3
  • 11

In case you can easily implement the roated grid, this is possibly the easist fix, so let me answer your question about the invariance of the convection diffusion equation under rotation of the coordinate system.

TL;DR

Your physical problem does not depend on the coordinate system that you choose. Only the definition of the Laplace operator and the gradient require that you choose a cartesian coordinate system. Thus, rotating the coordinate system will change nothing, as long as you rotate the velocities apropriately.

Derivation

Consider the convection diffusion equation $$ \underbrace{\sum_i \frac{\partial^2 u}{\partial x_i^2}}_{\text{diffusion}} + \underbrace{\sum_i \frac{\partial (v_i u)}{ \partial x_i}}_{\text{convection}} = f \,. $$ A rotation is a linear transformation. Hence, assume the new coordinates $x_i'$ are given by $$ x_i = \sum_j a_{ij} x_j', $$ which is the multiplication by a matrix $A$. Furthermore, assume that we can obtain the oldnew coordinates bygiven the old ones by $$x'_i = \sum_j b_{ij} x_j .$$ The numbers $b_{ij}$ are the entries of the matrix $B := A^{-1}$.

We denote the function $u$ in the new coordinates also by $u$: $$ u(x') = u(x(x'))\,. $$

Computation of the Diffusion Term

To compute the diffusion term, we need to use the chain rule. We start with the first partial derivative. We have that $$ \frac{\partial u}{\partial x_i} = \sum_k \frac{\partial u}{\partial x_k'} \frac{\partial x_k'}{\partial x_i} = \sum_k \frac{\partial u}{\partial x_k'} b_{ki} \,. $$ We use this equation to compute the second partial derivative. We obtain that \begin{align*} \frac{\partial}{\partial x_i} \left(\frac{\partial u}{\partial x_i} \right) &= \frac{\partial}{\partial x_i} \left( \sum_k \frac{\partial u}{\partial x_k'} b_{ki} \right) \\ &= \sum_k \frac{\partial}{\partial x_i} \left(\frac{\partial u}{\partial x_k'} b_{ki} \right) \\ &= \sum_k \sum_\ell \frac{\partial}{\partial x_\ell'} \left( \frac{\partial u}{\partial x_k'} b_{ki} \right) \frac{\partial x_\ell'}{\partial x_i} \\ &= \sum_k \sum_\ell \frac{\partial^2 u}{\partial x_k' \partial x_\ell'} b_{ki} b_{li} \,. \end{align*} The Laplace operator is the sum over all second partial derivatives. Hence, we compute \begin{align*} \sum_i \sum_k \sum_\ell \frac{\partial^2 u}{\partial x_k' \partial x_\ell'} b_{ki} b_{\ell i} &= \sum_k \sum_\ell \frac{\partial^2 u}{\partial x_k' \partial x_\ell'} \sum_i b_{ki} b_{\ell i} \\ &= \sum_k \sum_\ell \frac{\partial^2 u}{\partial x_k' \partial x_\ell'} c_{k\ell} \,, \end{align*} where $$ c_{kl} := \sum_i b_{ki} b_{\ell i} \,. $$

Computation of the Convection Term

To compute the convection term, we have to use the chain rule, again. Using this rule, \begin{align*} \frac{\partial (v_i u)}{\partial x_i} &= \frac{\partial (v_i u)}{\partial x_i} \\ &= \sum_k \frac{\partial (v_i u)}{\partial x_k'} \frac{\partial x_k'}{\partial x_i} \\ &= \sum_k \frac{\partial (v_i u)}{\partial x_k'} b_{ki} \\ \,. \end{align*} We obtain the gradient by summing over all partial derivatives. Thus, $$ \sum_i \frac{\partial (v_i u)}{\partial x_i} = \sum_i \sum_k \frac{\partial (v_i u)}{\partial x_k'} b_{ki} = \sum_k \frac{\partial (v_k' u)}{\partial x_k'} \,, $$ where $$ v_k' = \sum_i b_{ki} v_i \,. $$ The numbers $v_k'$ are just the velocities in the new coordinate system.

Rewriting the PDE

We can now give the PDE in the new coordinate system. The PDE is $$ \sum_k \sum_\ell \frac{\partial^2 u}{\partial x_k' \partial x_\ell'} c_{k\ell} + \sum_k \frac{\partial (v_k' u)}{\partial x_k'} b_{ki} = f \,. $$ However, since we have assumed that $A$ is a rotation matrix, we can simplify this equation.

Simplification

A rotation is a special linear transformation; the matrix $A$ is orthogonal, i.e., the inverse $B$ of $A$ is the matrix $A$ transposed ($b_{ij} = a_{ji}$). Thus, $$ \delta_{ij} = \sum_{\ell} b_{i\ell} a_{\ell j} = \sum_{\ell} b_{i \ell} b_{j \ell} = c_{ij} $$

Hence, the diffusion term simplifies to $$ \sum_k \sum_\ell \frac{\partial^2 u}{\partial x_k' \partial x_\ell'} c_{k\ell} = \sum_k \frac{\partial^2 u}{\partial x_k' \partial x_k'} \,. $$ And the PDE becomes $$ \sum_k \frac{\partial^2 u}{\partial {x_k'}^2} + \sum_k \frac{\partial (v_k' u)}{\partial x_k'} = f \,, $$ which is just the convection diffusion equation with rotated velocities.

In case you can easily implement the roated grid, this is possibly the easist fix, so let me answer your question about the invariance of the convection diffusion equation under rotation of the coordinate system.

TL;DR

Your physical problem does not depend on the coordinate system that you choose. Only the definition of the Laplace operator and the gradient require that you choose a cartesian coordinate system. Thus, rotating the coordinate system will change nothing, as long as you rotate the velocities apropriately.

Derivation

Consider the convection diffusion equation $$ \underbrace{\sum_i \frac{\partial^2 u}{\partial x_i^2}}_{\text{diffusion}} + \underbrace{\sum_i \frac{\partial (v_i u)}{ \partial x_i}}_{\text{convection}} = f \,. $$ A rotation is a linear transformation. Hence, assume the new coordinates $x_i'$ are given by $$ x_i = \sum_j a_{ij} x_j', $$ which is the multiplication by a matrix $A$. Furthermore, assume that we can obtain the old coordinates by $$x'_i = \sum_j b_{ij} x_j .$$ The numbers $b_{ij}$ are the entries of the matrix $B := A^{-1}$.

We denote the function $u$ in the new coordinates also by $u$: $$ u(x') = u(x(x'))\,. $$

Computation of the Diffusion Term

To compute the diffusion term, we need to use the chain rule. We start with the first partial derivative. We have that $$ \frac{\partial u}{\partial x_i} = \sum_k \frac{\partial u}{\partial x_k'} \frac{\partial x_k'}{\partial x_i} = \sum_k \frac{\partial u}{\partial x_k'} b_{ki} \,. $$ We use this equation to compute the second partial derivative. We obtain that \begin{align*} \frac{\partial}{\partial x_i} \left(\frac{\partial u}{\partial x_i} \right) &= \frac{\partial}{\partial x_i} \left( \sum_k \frac{\partial u}{\partial x_k'} b_{ki} \right) \\ &= \sum_k \frac{\partial}{\partial x_i} \left(\frac{\partial u}{\partial x_k'} b_{ki} \right) \\ &= \sum_k \sum_\ell \frac{\partial}{\partial x_\ell'} \left( \frac{\partial u}{\partial x_k'} b_{ki} \right) \frac{\partial x_\ell'}{\partial x_i} \\ &= \sum_k \sum_\ell \frac{\partial^2 u}{\partial x_k' \partial x_\ell'} b_{ki} b_{li} \,. \end{align*} The Laplace operator is the sum over all second partial derivatives. Hence, we compute \begin{align*} \sum_i \sum_k \sum_\ell \frac{\partial^2 u}{\partial x_k' \partial x_\ell'} b_{ki} b_{\ell i} &= \sum_k \sum_\ell \frac{\partial^2 u}{\partial x_k' \partial x_\ell'} \sum_i b_{ki} b_{\ell i} \\ &= \sum_k \sum_\ell \frac{\partial^2 u}{\partial x_k' \partial x_\ell'} c_{k\ell} \,, \end{align*} where $$ c_{kl} := \sum_i b_{ki} b_{\ell i} \,. $$

Computation of the Convection Term

To compute the convection term, we have to use the chain rule, again. Using this rule, \begin{align*} \frac{\partial (v_i u)}{\partial x_i} &= \frac{\partial (v_i u)}{\partial x_i} \\ &= \sum_k \frac{\partial (v_i u)}{\partial x_k'} \frac{\partial x_k'}{\partial x_i} \\ &= \sum_k \frac{\partial (v_i u)}{\partial x_k'} b_{ki} \\ \,. \end{align*} We obtain the gradient by summing over all partial derivatives. Thus, $$ \sum_i \frac{\partial (v_i u)}{\partial x_i} = \sum_i \sum_k \frac{\partial (v_i u)}{\partial x_k'} b_{ki} = \sum_k \frac{\partial (v_k' u)}{\partial x_k'} \,, $$ where $$ v_k' = \sum_i b_{ki} v_i \,. $$ The numbers $v_k'$ are just the velocities in the new coordinate system.

Rewriting the PDE

We can now give the PDE in the new coordinate system. The PDE is $$ \sum_k \sum_\ell \frac{\partial^2 u}{\partial x_k' \partial x_\ell'} c_{k\ell} + \sum_k \frac{\partial (v_k' u)}{\partial x_k'} b_{ki} = f \,. $$ However, since we have assumed that $A$ is a rotation matrix, we can simplify this equation.

Simplification

A rotation is a special linear transformation; the matrix $A$ is orthogonal, i.e., the inverse $B$ of $A$ is the matrix $A$ transposed ($b_{ij} = a_{ji}$). Thus, $$ \delta_{ij} = \sum_{\ell} b_{i\ell} a_{\ell j} = \sum_{\ell} b_{i \ell} b_{j \ell} = c_{ij} $$

Hence, the diffusion term simplifies to $$ \sum_k \sum_\ell \frac{\partial^2 u}{\partial x_k' \partial x_\ell'} c_{k\ell} = \sum_k \frac{\partial^2 u}{\partial x_k' \partial x_k'} \,. $$ And the PDE becomes $$ \sum_k \frac{\partial^2 u}{\partial {x_k'}^2} + \sum_k \frac{\partial (v_k' u)}{\partial x_k'} = f \,, $$ which is just the convection diffusion equation with rotated velocities.

In case you can easily implement the roated grid, this is possibly the easist fix, so let me answer your question about the invariance of the convection diffusion equation under rotation of the coordinate system.

TL;DR

Your physical problem does not depend on the coordinate system that you choose. Only the definition of the Laplace operator and the gradient require that you choose a cartesian coordinate system. Thus, rotating the coordinate system will change nothing, as long as you rotate the velocities apropriately.

Derivation

Consider the convection diffusion equation $$ \underbrace{\sum_i \frac{\partial^2 u}{\partial x_i^2}}_{\text{diffusion}} + \underbrace{\sum_i \frac{\partial (v_i u)}{ \partial x_i}}_{\text{convection}} = f \,. $$ A rotation is a linear transformation. Hence, assume the new coordinates $x_i'$ are given by $$ x_i = \sum_j a_{ij} x_j', $$ which is the multiplication by a matrix $A$. Furthermore, assume that we can obtain the new coordinates given the old ones by $$x'_i = \sum_j b_{ij} x_j .$$ The numbers $b_{ij}$ are the entries of the matrix $B := A^{-1}$.

We denote the function $u$ in the new coordinates also by $u$: $$ u(x') = u(x(x'))\,. $$

Computation of the Diffusion Term

To compute the diffusion term, we need to use the chain rule. We start with the first partial derivative. We have that $$ \frac{\partial u}{\partial x_i} = \sum_k \frac{\partial u}{\partial x_k'} \frac{\partial x_k'}{\partial x_i} = \sum_k \frac{\partial u}{\partial x_k'} b_{ki} \,. $$ We use this equation to compute the second partial derivative. We obtain that \begin{align*} \frac{\partial}{\partial x_i} \left(\frac{\partial u}{\partial x_i} \right) &= \frac{\partial}{\partial x_i} \left( \sum_k \frac{\partial u}{\partial x_k'} b_{ki} \right) \\ &= \sum_k \frac{\partial}{\partial x_i} \left(\frac{\partial u}{\partial x_k'} b_{ki} \right) \\ &= \sum_k \sum_\ell \frac{\partial}{\partial x_\ell'} \left( \frac{\partial u}{\partial x_k'} b_{ki} \right) \frac{\partial x_\ell'}{\partial x_i} \\ &= \sum_k \sum_\ell \frac{\partial^2 u}{\partial x_k' \partial x_\ell'} b_{ki} b_{li} \,. \end{align*} The Laplace operator is the sum over all second partial derivatives. Hence, we compute \begin{align*} \sum_i \sum_k \sum_\ell \frac{\partial^2 u}{\partial x_k' \partial x_\ell'} b_{ki} b_{\ell i} &= \sum_k \sum_\ell \frac{\partial^2 u}{\partial x_k' \partial x_\ell'} \sum_i b_{ki} b_{\ell i} \\ &= \sum_k \sum_\ell \frac{\partial^2 u}{\partial x_k' \partial x_\ell'} c_{k\ell} \,, \end{align*} where $$ c_{kl} := \sum_i b_{ki} b_{\ell i} \,. $$

Computation of the Convection Term

To compute the convection term, we have to use the chain rule, again. Using this rule, \begin{align*} \frac{\partial (v_i u)}{\partial x_i} &= \frac{\partial (v_i u)}{\partial x_i} \\ &= \sum_k \frac{\partial (v_i u)}{\partial x_k'} \frac{\partial x_k'}{\partial x_i} \\ &= \sum_k \frac{\partial (v_i u)}{\partial x_k'} b_{ki} \\ \,. \end{align*} We obtain the gradient by summing over all partial derivatives. Thus, $$ \sum_i \frac{\partial (v_i u)}{\partial x_i} = \sum_i \sum_k \frac{\partial (v_i u)}{\partial x_k'} b_{ki} = \sum_k \frac{\partial (v_k' u)}{\partial x_k'} \,, $$ where $$ v_k' = \sum_i b_{ki} v_i \,. $$ The numbers $v_k'$ are just the velocities in the new coordinate system.

Rewriting the PDE

We can now give the PDE in the new coordinate system. The PDE is $$ \sum_k \sum_\ell \frac{\partial^2 u}{\partial x_k' \partial x_\ell'} c_{k\ell} + \sum_k \frac{\partial (v_k' u)}{\partial x_k'} b_{ki} = f \,. $$ However, since we have assumed that $A$ is a rotation matrix, we can simplify this equation.

Simplification

A rotation is a special linear transformation; the matrix $A$ is orthogonal, i.e., the inverse $B$ of $A$ is the matrix $A$ transposed ($b_{ij} = a_{ji}$). Thus, $$ \delta_{ij} = \sum_{\ell} b_{i\ell} a_{\ell j} = \sum_{\ell} b_{i \ell} b_{j \ell} = c_{ij} $$

Hence, the diffusion term simplifies to $$ \sum_k \sum_\ell \frac{\partial^2 u}{\partial x_k' \partial x_\ell'} c_{k\ell} = \sum_k \frac{\partial^2 u}{\partial x_k' \partial x_k'} \,. $$ And the PDE becomes $$ \sum_k \frac{\partial^2 u}{\partial {x_k'}^2} + \sum_k \frac{\partial (v_k' u)}{\partial x_k'} = f \,, $$ which is just the convection diffusion equation with rotated velocities.

Source Link
H. Rittich
  • 558
  • 3
  • 11

In case you can easily implement the roated grid, this is possibly the easist fix, so let me answer your question about the invariance of the convection diffusion equation under rotation of the coordinate system.

TL;DR

Your physical problem does not depend on the coordinate system that you choose. Only the definition of the Laplace operator and the gradient require that you choose a cartesian coordinate system. Thus, rotating the coordinate system will change nothing, as long as you rotate the velocities apropriately.

Derivation

Consider the convection diffusion equation $$ \underbrace{\sum_i \frac{\partial^2 u}{\partial x_i^2}}_{\text{diffusion}} + \underbrace{\sum_i \frac{\partial (v_i u)}{ \partial x_i}}_{\text{convection}} = f \,. $$ A rotation is a linear transformation. Hence, assume the new coordinates $x_i'$ are given by $$ x_i = \sum_j a_{ij} x_j', $$ which is the multiplication by a matrix $A$. Furthermore, assume that we can obtain the old coordinates by $$x'_i = \sum_j b_{ij} x_j .$$ The numbers $b_{ij}$ are the entries of the matrix $B := A^{-1}$.

We denote the function $u$ in the new coordinates also by $u$: $$ u(x') = u(x(x'))\,. $$

Computation of the Diffusion Term

To compute the diffusion term, we need to use the chain rule. We start with the first partial derivative. We have that $$ \frac{\partial u}{\partial x_i} = \sum_k \frac{\partial u}{\partial x_k'} \frac{\partial x_k'}{\partial x_i} = \sum_k \frac{\partial u}{\partial x_k'} b_{ki} \,. $$ We use this equation to compute the second partial derivative. We obtain that \begin{align*} \frac{\partial}{\partial x_i} \left(\frac{\partial u}{\partial x_i} \right) &= \frac{\partial}{\partial x_i} \left( \sum_k \frac{\partial u}{\partial x_k'} b_{ki} \right) \\ &= \sum_k \frac{\partial}{\partial x_i} \left(\frac{\partial u}{\partial x_k'} b_{ki} \right) \\ &= \sum_k \sum_\ell \frac{\partial}{\partial x_\ell'} \left( \frac{\partial u}{\partial x_k'} b_{ki} \right) \frac{\partial x_\ell'}{\partial x_i} \\ &= \sum_k \sum_\ell \frac{\partial^2 u}{\partial x_k' \partial x_\ell'} b_{ki} b_{li} \,. \end{align*} The Laplace operator is the sum over all second partial derivatives. Hence, we compute \begin{align*} \sum_i \sum_k \sum_\ell \frac{\partial^2 u}{\partial x_k' \partial x_\ell'} b_{ki} b_{\ell i} &= \sum_k \sum_\ell \frac{\partial^2 u}{\partial x_k' \partial x_\ell'} \sum_i b_{ki} b_{\ell i} \\ &= \sum_k \sum_\ell \frac{\partial^2 u}{\partial x_k' \partial x_\ell'} c_{k\ell} \,, \end{align*} where $$ c_{kl} := \sum_i b_{ki} b_{\ell i} \,. $$

Computation of the Convection Term

To compute the convection term, we have to use the chain rule, again. Using this rule, \begin{align*} \frac{\partial (v_i u)}{\partial x_i} &= \frac{\partial (v_i u)}{\partial x_i} \\ &= \sum_k \frac{\partial (v_i u)}{\partial x_k'} \frac{\partial x_k'}{\partial x_i} \\ &= \sum_k \frac{\partial (v_i u)}{\partial x_k'} b_{ki} \\ \,. \end{align*} We obtain the gradient by summing over all partial derivatives. Thus, $$ \sum_i \frac{\partial (v_i u)}{\partial x_i} = \sum_i \sum_k \frac{\partial (v_i u)}{\partial x_k'} b_{ki} = \sum_k \frac{\partial (v_k' u)}{\partial x_k'} \,, $$ where $$ v_k' = \sum_i b_{ki} v_i \,. $$ The numbers $v_k'$ are just the velocities in the new coordinate system.

Rewriting the PDE

We can now give the PDE in the new coordinate system. The PDE is $$ \sum_k \sum_\ell \frac{\partial^2 u}{\partial x_k' \partial x_\ell'} c_{k\ell} + \sum_k \frac{\partial (v_k' u)}{\partial x_k'} b_{ki} = f \,. $$ However, since we have assumed that $A$ is a rotation matrix, we can simplify this equation.

Simplification

A rotation is a special linear transformation; the matrix $A$ is orthogonal, i.e., the inverse $B$ of $A$ is the matrix $A$ transposed ($b_{ij} = a_{ji}$). Thus, $$ \delta_{ij} = \sum_{\ell} b_{i\ell} a_{\ell j} = \sum_{\ell} b_{i \ell} b_{j \ell} = c_{ij} $$

Hence, the diffusion term simplifies to $$ \sum_k \sum_\ell \frac{\partial^2 u}{\partial x_k' \partial x_\ell'} c_{k\ell} = \sum_k \frac{\partial^2 u}{\partial x_k' \partial x_k'} \,. $$ And the PDE becomes $$ \sum_k \frac{\partial^2 u}{\partial {x_k'}^2} + \sum_k \frac{\partial (v_k' u)}{\partial x_k'} = f \,, $$ which is just the convection diffusion equation with rotated velocities.