[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[ff3d-users] Multiple if-statements...an issue?!
From: |
Arun Viswanathan |
Subject: |
[ff3d-users] Multiple if-statements...an issue?! |
Date: |
Mon, 16 Aug 2004 05:54:12 -0700 (PDT) |
Hey Stephane, thanks again for your response. You are
right, it does work when I declare 'C' earlier :) (I
wasn't aware that 'solve(C)' is a kind of implicit
declaration as well). But I have still not been able
to get multiple if-statements working the way I wanted
it.
I am running the solver for about 80 iterations
(within a for-loop). Within the for-loop I have 2
if-statements, 1 for iterations below a particular
concentration 'C' and the other for concentrations
over 'C'. I have a solver in the first if-loop
defining a PDE within 2 boundary conditions (Dirichlet
and Robin's). My second if-loop defines the same PDE,
but this time bounded by Dirchlet's condition alone.
When I run this code, I find that the solver ignores
the if-conditions and runs the solvers in both
if-loops in every single iteration. I was just
wondering if it is ff3d which is having trouble
understanding multiple if's OR if it is I who has to
make suitable changes to make ff3d recognize the
different if-loops.....Please find solver attached
below (for your reference).
Thanks, best regards,
Arun.
--------------Solver attached below------------------
for (i=0; i<10; i++)
{
cout << "\nIteration no. " << i+1 << "\n";
if (C(0.902,1.26,0.819) < 0.32)
{
solve(C) in O2 by M
{
pde(C)
C - div(D*dt*grad(C)) = C0; /* Equation: dC/dt
= D
* d/dx(dC/dx) */
dnu(C) = 0 on M;
/*al*C + */dnu(C) = 0.5 on Sphere;
};
}
if (C(0.902,1.26,0.819) >= 0.32)
{
solve(C) in O2 by M
{
pde(C)
C - div(D*dt*grad(C))
= C0; /* Equation: dC/dt = D * d/dx(dC/dx) */
dnu(C) = 0 on M;
};
}
cout << C(0.902,1.26,0.819);
cout << C(0.984,1.26,0.819);
C0 = C;
}
----------------Solver ends here---------------------
--- Stephane Del Pino <address@hidden> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hello.
>
> It is simple, you cannot use C values before it is
> declared. There are two
> ways to declare a function:
> - - using the solve block : solve(C) ...
> - - using an explicit declaration:
> - function C; // C default value is 0
> - function C = C0; // C0 is a given function or
> constant
> - femfunction C(M); // M is a given mesh
> - femfunction C(M) = C0;
>
> Add one of the above declarations before your first
> "if", it should work
> better.
>
> Best regards,
> Stephane.
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.2.5 (GNU/Linux)
>
>
iD8DBQFBHfrbbZyhKhZwdc0RAn2fAJ9kh9HqLys4ITp0xqj6CuiEGu/x5QCgnEx8
> VpqdxWYj1B8arx1Fy4Umkck=
> =mi+a
> -----END PGP SIGNATURE-----
>
>
> _______________________________________________
> ff3d-users mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/ff3d-users
>
__________________________________
Do you Yahoo!?
Yahoo! Mail - 50x more storage than other providers!
http://promotions.yahoo.com/new_mail