[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
## [ff3d-users] Re: new problems

**From**: |
Stephane Del Pino |

**Subject**: |
[ff3d-users] Re: new problems |

**Date**: |
Thu, 22 Jan 2004 17:19:48 +0100 |

Robert Li wrote:
>* *
>* Dear Stephane Del Pino,*
>* I have new problems with ff3d.*
>* *
>* 1.In parse.ff.yy, you used abs(), because class*
>* ExpressionStdFunction needs a real function*
>* pointer,should we change it into fabs()?*
>* *
>* | ABS '(' functionexp ')'*
>* {*
>* $$ = new*
>* FunctionExpressionUnaryOperator<ExpressionStdFunction<FunctionExpression,*
>* std::abs> >($3);*
>* }*
Dear Robert,
Since the code is C++ (not C), using abs() is the right way to do it.
C++ allows polymorphism so the correct abs function will be called
depending on the parameter. Note also that you can compile ff3d using
float or double (default) using a ./configure option. If you replace abs
by fabs it will no longer work for floats which require fabsf. We could
also add a 'long double' option which requires just a few lines (look at
the utils/Types.hpp file).
>* 2.In parse.ff.yy, although I can find dx,dy,dz*
>* keywords,I can not find dt keyword. I want to solve a*
>* heat transfer PDE problem. Unknown T is a*
>* function(x,y,z,t). And I need to express*
>* deltT=T[i]-T[i-1]. Could you give me a example about*
>* how to write them in input file?*
Yes. As the manual may say, in ff3d the time discretization is let to
the user.
For instance use the following euler scheme to solve
| dt(T)-Laplace(T) = 0
| T(0) = T0;
| T(t) = 0 on d(Omega)
function Tn = T0;
double n = 0;
double dt = 0.1;
do {
solve(T) in Omega by M {
pde(T)
T-div((dt)*grad(T)) = Tn;
T = 0 on M;
}
// you can compute deltaT here
un = u;
} while (n<10);
I think that answers to your question.
Best regards,
Stephane.