CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   laplacianFoam: problem with fvc::laplacian (https://www.cfd-online.com/Forums/openfoam-programming-development/176978-laplacianfoam-problem-fvc-laplacian.html)

leroyv September 1, 2016 12:20

laplacianFoam: problem with fvc::laplacian
 
2 Attachment(s)
Dear OpenFOAM users,

I am developing a solver for a 1D application. I started with laplacianFoam as a base, and at some point, I had to introduce a source term which is a combination of laplacian(DT, T) in some cells and and some other computations in the others (impossible to use partitioning into regions because the cells concerned by the special computations change dynamically).

Since I could not mix implicit and explicit terms, I decided to go fully explicit and used fvc::laplacian(DT, T). This resulted in a crash of the solver. On the forum, I saw that people having that problem usually have it solved by simply changing the numerical scheme; however, in the case of that 1D example, it does not seem to make a difference.

I investigated using a minimal working example attached to this post. It is made of:
  • a test solver, which is simply laplacianFoam
  • a test case, 1D uniform temperature initial condition and a temperature ramp BC using groovyBC
A strange thing is that if I leave the laplacian implicit and output fvc::laplacian(DT,T), no weird things happen.

Question: Does someone have an idea of what is happening?

PS: In case that would be of any help, I should also mention that in the practical example I am dealing with (not the MWE), the source term wiggles very oddly and explodes when going in the direction of the "hot" wall. I attached a screenshot of postprocessed data: in blue is the initial source term (non-zero, but small intensity compared to the green curve) and in green is the source term after the first time step.

Tobi September 2, 2016 03:03

Dear Vincent,

first of all, thank you for investigating into your first post and providing all the necessary information that we need to help you. There is only one information missing (the version of FOAM you are using but I guess it is 2.3.1). It is very seldom that we got these informations within the first post.

Cause of your problem
I checked your solver and especially your domain. I hope you know the differences between explicit and implicit. The problem you are solving is a parabolic problem and here you have a strict criteria that has to be fulfilled. It is the Fourier Number. If you have 1D problems and you solve just the laplace equation with an explicit scheme, you are limited to Fo = 0.5.


Fo = \frac{D  \delta t}{\delta x^2}

and hence

\delta t  = \frac{Fo \delta x^2}{D} = \frac{0.5 \cdot 0.0000581^2}{0.1} = 0.00000001687805

Or if we check the Fourier Number we would get with your settings:

Fo = \frac{0.1  \cdot 0.001}{0.0000581^2} = 29624

The residual demonstrate this too. Hence, you know why explicit is always a bad choice. If you reduce your time step below 1e-7 your solver works based on the theory above. That's all.

leroyv September 2, 2016 07:34

Hi Tobias,

Thank you very much for this thorough answer. Sometimes, I get lost in the complicated stuff and even forget about the most elementary things.

Coming back to my original problem: my conservation equation is
\frac{\partial T}{\partial t} = D \Delta T + S
where S = D' \Delta T in some regions and is gotten from another solver elsewhere. How come the laplacian part of S affects the stability of the problem? Does this mean that not satisfying the stability criterion results in practice in (very) wrong values of the explicitly evaluated laplacian operator?


All times are GMT -4. The time now is 21:37.