CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Main CFD Forum (https://www.cfd-online.com/Forums/main/)
-   -   Issue with Helmholtz (Hodge) decomposition (https://www.cfd-online.com/Forums/main/215226-issue-helmholtz-hodge-decomposition.html)

TurbJet February 26, 2019 16:28

Issue with Helmholtz (Hodge) decomposition
 
Greetings,

I am doing decaying compressible homogeneous isotropic turbulence. I need Helmholtz decomposition to separate the solenoidal and dilatational velocity fields. This is the decomposition I am following (according to Wikipedia)
\textbf{u} = \nabla\times\textbf{A} - \nabla\Phi
where A is a vector field, and Phi is a scalar field.

I wrote my own code in MATLAB. Here is a pseudo-code for solving the Poisson equation resulting from the Helmholtz decomposition
Code:

b = \nabla\cdot\textbf{u}
\hat{b} = fft(b)
\hat{\Phi} = \frac{\hat{b}}{kx^2 + ky^2 + kz^2}
\Phi = ifft(\hat{\Phi})
\nabla\times\textbf{A} = \textbf{u} - (-\nabla\Phi)

Here, kx, ky, kz are wave numbers in each direction. Also, I use 4th-order difference for evaluating gradient and divergence: central difference for interior grid points, one-sided difference for boundary points.

I apply the code to the solution of the turbulence. The turbulence is solved with 4th-order DRP in space and 4th-order RK in time.

Apparently, the solenoidal velocity field is equal to \nabla\times\textbf{A}, and the dilatational velocity field is equal to \nabla\Phi. However, when I compute the divergence of the solenoidal velocity field in order to verify my code, it doesn't return zero divergence; instead, I have maximum divergence around 1.4, average divergence in the domain is around 1.13e-4, seems like the resulting solenoidal field is not divergence-free.

I went over my code over and over again. As far as I could, I can't find any bug. The finite difference for computing the gradient and divergence is verified, it should not be a problem. The spectral method does not look wrong to me. So I am lost. Could anyone provide some hints or suggestions? Or is there any benchmark case that I can use for verifying my code? I tried Taylor-Green vortex, but this is not challenging enough.

PS:
1. Is it possible that this error is due to the one-sided difference near the boundaries?
2. Is it possible this error is due the the mixture usage of finite difference and spectral method?

Appreciate it!

FMDenaro February 26, 2019 17:09

Quote:

Originally Posted by TurbJet (Post 726114)
Greetings,

I am doing decaying compressible homogeneous isotropic turbulence. I need Helmholtz decomposition to separate the solenoidal and dilatational velocity fields. This is the decomposition I am following (according to Wikipedia)
\textbf{u} = \nabla\times\textbf{A} - \nabla\Phi
where A is a vector field, and Phi is a scalar field.

I wrote my own code in MATLAB. Here is a pseudo-code for solving the Poisson equation resulting from the Helmholtz decomposition
Code:

b = \nabla\cdot\textbf{u}
\hat{b} = fft(b)
\hat{\Phi} = \frac{\hat{b}}{kx^2 + ky^2 + kz^2}
\Phi = ifft(\hat{\Phi})
\nabla\times\textbf{A} = \textbf{u} - (-\nabla\Phi)

Here, kx, ky, kz are wave numbers in each direction. Also, I use 4th-order difference for evaluating gradient and divergence: central difference for interior grid points, one-sided difference for boundary points.

I apply the code to the solution of the turbulence. The turbulence is solved with 4th-order DRP in space and 4th-order RK in time.

Apparently, the solenoidal velocity field is equal to \nabla\times\textbf{A}, and the dilatational velocity field is equal to \nabla\Phi. However, when I compute the divergence of the solenoidal velocity field in order to verify my code, it doesn't return zero divergence; instead, I have maximum divergence around 1.4, average divergence in the domain is around 1.13e-4, seems like the resulting solenoidal field is not divergence-free.

I went over my code over and over again. As far as I could, I can't find any bug. The finite difference for computing the gradient and divergence is verified, it should not be a problem. The spectral method does not look wrong to me. So I am lost. Could anyone provide some hints or suggestions? Or is there any benchmark case that I can use for verifying my code? I tried Taylor-Green vortex, but this is not challenging enough.

PS:
1. Is it possible that this error is due to the one-sided difference near the boundaries?
2. Is it possible this error is due the the mixture usage of finite difference and spectral method?

Appreciate it!




There are lot of hidden issues when you start from the HH decomposition in continuous form and then use it after a discretization.

The discrete operators must be congruent and a specific setting of the BCs is required.
First of all, I suggest to use standard second order derivative and write the Div Grad operator in discrete form.


More details can be found in my paper here https://www.researchgate.net/publica...ary_conditions


All times are GMT -4. The time now is 05:04.