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/)
-   -   Solving Laplace equation with nonlinear diffusity/conductivity (https://www.cfd-online.com/Forums/openfoam-programming-development/143256-solving-laplace-equation-nonlinear-diffusity-conductivity.html)

chriss85 October 20, 2014 06:40

Solving Laplace equation with nonlinear diffusity/conductivity
 
I want to solve a Laplace equation, div(sigma * grad(phi)) = 0, where sigma depends nonlinearly on the solution of phi. What is the best approach for doing something like this? If I solve the equation iteratively and update sigma each time based on the current solution, what kind of conditions are required to guarantee convergence and unique solutions?
Is it possible (and beneficial) to perform this kind of iteration directly in the matrix solver?

marupio October 20, 2014 08:19

I'd use Newton-Raphson linearization. Semi-implicit. Take a phi to the power of one out of your sigma equation and put it into the matrix, and the rest goes into the source term as a derivative, I believe. Use relaxation and iterate in an inner-loop.

chriss85 October 21, 2014 03:38

Thanks for your reply!

For completeness:
Newton-Raphson is an iterative procedure for finding roots of a function. In this case this means that x_(n+1)=x_n + f(x_n) / f'(x_n) with x_n = phi_n and f(phi) = laplace(sigma(phi), phi) and semi implicit in this case means to update sigma and phi_n in an alternating sequence.

What do you mean with " Take a phi to the power of one out of your sigma equation and put it into the matrix, and the rest goes into the source term as a derivative, I believe"?

marupio October 21, 2014 13:05

I just reread my last message, and now I think I should go back and reread all the code I was working on at the time. Does not make much sense.

You want to use Newton-Raphson linearization. That uses information from one point (phi0, sigma0, and its derivative) to guess the likely sigma value at another point (phi1).

sigma*(phi1) = sigma(phi0) + derivativeOfSigmaWrtPhi(phi0) * (phi1 - phi0)

When you put this relation into the matrix equation, the diagonal and source are changed according to:

Ap -= derivativeOfSigmaWrtPhi(phi0)
Bp -= derivativeOfSigmaWrtPhi(phi0) * phi0

This is from memory... my reference material is not available to me at the moment.

chriss85 October 22, 2014 03:27

Why would I put this equation in a matrix and not calculate it directly?
From what I understand right now this is an extrapolation on the behaviour of sigma while phi changes.

Some more information maybe: This is for electric currents, and in this case sigma is the electrical conductivity, which is a function of the current density here, so sigma(j)=sigma(-grad(phi)).


All times are GMT -4. The time now is 02:57.