CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Main CFD Forum (https://www.cfd-online.com/Forums/main/)
-   -   discretization of variable parameters (https://www.cfd-online.com/Forums/main/89757-discretization-variable-parameters.html)

 mauz June 21, 2011 17:42

discretization of variable parameters

Dear all,

in a porous layer I have a certain liquid s(x) distribution. The relative permeability is function of it: k(x) = s(x)^3. I need to determine the derivative of k, dk/dx. Should I discretize k:

dk/dx|i = (k(i+1) - k(i-1))/(2h)

or reduce the derivative as follow:

dk/dx|i = 3*s(i)^2 * ds/dx|i = 3*s(i)^2*((s(i+1) - s(i-1))/(2h)) ?

They lead to different results, and can not find a valid reason to choose one of them.

thanks and regards

Mauri

 ztdep June 25, 2011 16:44

Dear friends:
The difference come from the discretisation error.for example,
if we set s(x)=x;
x|i=0.1;
then
dk/dx|i=(x+h)^3-(x-h)^3/(2*h);

using the reduced form we have

dk/dx|i=3*x^2*ds/dx=3*x^2;

if we set h=0.1, the first one gives a value of 0.40 while the second one gives 0.030.
if we reduce the h to 0.01, then the first one gives a avalue of 0.0301;

 All times are GMT -4. The time now is 03:38.