[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [ff3d-users] Code to solve Fick's law, what's wrong??!!
From: |
Arun Viswanathan |
Subject: |
Re: [ff3d-users] Code to solve Fick's law, what's wrong??!! |
Date: |
Tue, 18 May 2004 09:48:29 -0700 (PDT) |
Hi Stephane and others,
thanks Stephane for your previous mail, it certainly
did help me understand the expression you wrote
better. I now have a code running, based on your
suggestions, but I still have some questions to ask
(code and output at the end of the mail):
1. C0 is declared as a function C0 = x*y*z (and
assigned to C in every iteration), does this mean that
I am solving for C in 3 dimensions?
2. Since I don't have a specific scene, I have created
an empty file called 'void.pov' and assigned that to
the scene. Is this necessary at all?
3. Where is my result, solution? How do I get to see
what the concentration (C) is? I tried printing out C
at every iteration, but it seems like 'printf' is not
accepted in fem3d!!
4. Finally, in the output, what is 'pcg', 'gcg', etc?
Also, how do I open the 'p1.dat' file?
Please find code and output below....
**************CODE*****************
function D = 10;
function J = 20;
function C0 = x*y*z;
double dt = 0.1;
double i;
vector n = (10,10,10);
vector a = (0,0,0);
vector b = (4,4,4);
mesh M = structured(n,a,b);
scene S = pov("void.pov");
//domain O = domain(S);
for (i=0; i<5; i++)
{ solve(C) in M
{
pde(C)
C - div(D*dt*grad(C)) = C0; /*
Equation: dC/dt = D * d/dx(dC/dx) */
// dt(C) = D * div(grad(C));
// -D * dx(C) = J;
};
// printf("C = %d \n", C);
C0 = C;
}
save(opendx, "p1.dat", M);
************OUTPUT*******************
Parsing the file
................................................................................................................................................
done
Treating data
Building Mesh ... done
Building Scene ... done
Parsing void.pov done
Scene is composed of 0 objects:
Solving Problem:
unknowns: List of unknowns
Problem:
pde(C):
1*C - div((10*0.1)*grad(C)) =
((x*y)*z)
Problem:
PDE
Solving ...
reserve
Discretizing the PDE Problem ... Assembling matrix
done
Assembling cost: Time: 0s CPU Time: 0.09s
Assembling Second Member
done
Discretizing Boundary Conditions
Second Member Modification
Matrix Modification
done
Matrix copy: Time: 0s CPU Time: 0.02s
Solving
Solving the linear system
pcg: iteration 1 gcg= 1
pcg: iteration 2 gcg= 0.31577
pcg: iteration 3 gcg= 0.134969
pcg: iteration 4 gcg= 0.0706419
pcg: iteration 5 gcg= 0.0314673
pcg: iteration 6 gcg= 0.0162685
pcg: iteration 7 gcg= 0.0082871
pcg: iteration 8 gcg= 0.00401432
pcg: iteration 9 gcg= 0.00212644
pcg: iteration 10 gcg= 0.000724504
pcg: iteration 11 gcg= 0.000500899
pcg: iteration 12 gcg= 0.000174529
pcg: iteration 13 gcg= 8.2077e-05
pcg: iteration 14 gcg= 3.06721e-05
pcg: iteration 15 gcg= 9.85341e-06
Krylov solver:
Time: 0s CPU Time: 0.02s
solver finished
Solving Problem:
unknowns: List of unknowns
Problem:
pde(C):
1*C - div((10*0.1)*grad(C)) = FEM
Function
Problem:
PDE
Solving ...
reserve
Discretizing the PDE Problem ... Assembling matrix
done
Assembling cost: Time: 0s CPU Time: 0.1s
Assembling Second Member
done
Discretizing Boundary Conditions
Second Member Modification
Matrix Modification
done
Matrix copy: Time: 0s CPU Time: 0.02s
Solving
Solving the linear system
pcg: iteration 1 gcg= 1
pcg: iteration 2 gcg= 0.229552
pcg: iteration 3 gcg= 0.0893832
pcg: iteration 4 gcg= 0.0419195
pcg: iteration 5 gcg= 0.013098
pcg: iteration 6 gcg= 0.00630373
pcg: iteration 7 gcg= 0.00240239
pcg: iteration 8 gcg= 0.00103132
pcg: iteration 9 gcg= 0.000384273
pcg: iteration 10 gcg= 0.000125812
pcg: iteration 11 gcg= 7.08929e-05
pcg: iteration 12 gcg= 2.92619e-05
pcg: iteration 13 gcg= 1.22704e-05
pcg: iteration 14 gcg= 4.13478e-06
Krylov solver:
Time: 0s CPU Time: 0.02s
solver finished
Solving Problem:
unknowns: List of unknowns
Problem:
pde(C):
1*C - div((10*0.1)*grad(C)) = FEM
Function
Problem:
PDE
Solving ...
reserve
Discretizing the PDE Problem ... Assembling matrix
done
Assembling cost: Time: 1s CPU Time: 0.1s
Assembling Second Member
done
Discretizing Boundary Conditions
Second Member Modification
Matrix Modification
done
Matrix copy: Time: 0s CPU Time: 0.02s
Solving
Solving the linear system
pcg: iteration 1 gcg= 1
pcg: iteration 2 gcg= 0.310228
pcg: iteration 3 gcg= 0.118975
pcg: iteration 4 gcg= 0.0525687
pcg: iteration 5 gcg= 0.0182167
pcg: iteration 6 gcg= 0.00692998
pcg: iteration 7 gcg= 0.00296397
pcg: iteration 8 gcg= 0.00139042
pcg: iteration 9 gcg= 0.000410333
pcg: iteration 10 gcg= 0.000121943
pcg: iteration 11 gcg= 7.97746e-05
pcg: iteration 12 gcg= 2.35352e-05
pcg: iteration 13 gcg= 1.04769e-05
pcg: iteration 14 gcg= 4.89327e-06
Krylov solver:
Time: 0s CPU Time: 0.03s
solver finished
Solving Problem:
unknowns: List of unknowns
Problem:
pde(C):
1*C - div((10*0.1)*grad(C)) = FEM
Function
Problem:
PDE
Solving ...
reserve
Discretizing the PDE Problem ... Assembling matrix
done
Assembling cost: Time: 0s CPU Time: 0.1s
Assembling Second Member
done
Discretizing Boundary Conditions
Second Member Modification
Matrix Modification
done
Matrix copy: Time: 0s CPU Time: 0.02s
Solving
Solving the linear system
pcg: iteration 1 gcg= 1
pcg: iteration 2 gcg= 0.331441
pcg: iteration 3 gcg= 0.129038
pcg: iteration 4 gcg= 0.0545735
pcg: iteration 5 gcg= 0.0194651
pcg: iteration 6 gcg= 0.00731261
pcg: iteration 7 gcg= 0.00276858
pcg: iteration 8 gcg= 0.00138134
pcg: iteration 9 gcg= 0.000393934
pcg: iteration 10 gcg= 9.96742e-05
pcg: iteration 11 gcg= 6.69511e-05
pcg: iteration 12 gcg= 1.68012e-05
pcg: iteration 13 gcg= 7.5123e-06
Krylov solver:
Time: 0s CPU Time: 0.03s
solver finished
Solving Problem:
unknowns: List of unknowns
Problem:
pde(C):
1*C - div((10*0.1)*grad(C)) = FEM
Function
Problem:
PDE
Solving ...
reserve
Discretizing the PDE Problem ... Assembling matrix
done
Assembling cost: Time: 0s CPU Time: 0.1s
Assembling Second Member
done
Discretizing Boundary Conditions
Second Member Modification
Matrix Modification
done
Matrix copy: Time: 0s CPU Time: 0.02s
Solving
Solving the linear system
pcg: iteration 1 gcg= 1
pcg: iteration 2 gcg= 0.336253
pcg: iteration 3 gcg= 0.130657
pcg: iteration 4 gcg= 0.0545202
pcg: iteration 5 gcg= 0.0195706
pcg: iteration 6 gcg= 0.007416
pcg: iteration 7 gcg= 0.00253382
pcg: iteration 8 gcg= 0.00131268
pcg: iteration 9 gcg= 0.000370237
pcg: iteration 10 gcg= 8.28599e-05
pcg: iteration 11 gcg= 5.61065e-05
pcg: iteration 12 gcg= 1.16369e-05
pcg: iteration 13 gcg= 5.16786e-06
Krylov solver:
Time: 0s CPU Time: 0.03s
solver finished
Structured3DMesh.cpp:33: Not implemented
Thanks a lot, regards,
Arun.
--- Stephane Del Pino <address@hidden> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hello Arun.
>
> Le samedi 15 Mai 2004 17:24, Arun Viswanathan a
> écrit :
> > Hey Stephane,
> >
> > I am so sorry to be bothering you so often, the
> whole
> > thing is new to me, that's why I have too many
> > doubts....here's yet another...:)...
> >
> > In the example of the Euler's equation that you
> sent
> > me, 'dt' is simply declared as any other variable.
> In
> > my equation of Fick's law, I don't think I can do
> > that. The equation I am trying to solve goes this
> way:
> No. This example does not deal with Euler's
> equations but is an implicit Euler
> *scheme* wrote to solve your problem.
>
> As it is the case in every freefem version,
> functions do not depend on time,
> only on space. But this is not a problem.
>
> > d/dt [C(x,t)] = D * d^2/dx [C(x,t)]
> In ff3d, to solve this problem the spacial
> discretization is done
> independently. So, to solve
> d/dt(u)-div(D*grad(u)) = 0,
> an implicit Euler scheme consists in writing
> (u(n+1)-u(n))/delta_t - div(D*grad(u(n+1))) = 0,
> where n is the time step.
> For convenience, this can be written:
> u(n+1)-div(D*delta_t*grad(u(n+1)))=u(n).
>
> This is exactly what solves the programm that I sent
> to you.
>
> I hope that it is now more clear.
> Best regards,
> Stephane.
>
> PS : please do not cross post your requests. This is
> not related with the -dev
> mailing list and I read more often the -users
> mailing list that this
> personnal address (address@hidden).
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.2.4 (GNU/Linux)
>
>
iD8DBQFApknHbZyhKhZwdc0RAsreAJ4qxgRJXQsfyCDaI6dCP05csRJaHQCgjQLG
> TGMxaWbcVG4pi8q0iOEVySg=
> =bOXW
> -----END PGP SIGNATURE-----
>
>
> _______________________________________________
> ff3d-users mailing list
> address@hidden
> http://mail.nongnu.org/mailman/listinfo/ff3d-users
__________________________________
Do you Yahoo!?
SBC Yahoo! - Internet access at a great low price.
http://promo.yahoo.com/sbc/
- Re: [ff3d-users] Code to solve Fick's law, what's wrong??!!, Arun Viswanathan, 2004/05/15
- Re: [ff3d-users] Code to solve Fick's law, what's wrong??!!, Stephane Del Pino, 2004/05/15
- Re: [ff3d-users] Code to solve Fick's law, what's wrong??!!,
Arun Viswanathan <=
- Re: [ff3d-users] Code to solve Fick's law, what's wrong??!!, Arun Viswanathan, 2004/05/18
- Re: [ff3d-users] Code to solve Fick's law, what's wrong??!!, Stephane Del Pino, 2004/05/19
- Re: [ff3d-users] Code to solve Fick's law, what's wrong??!!, Arun Viswanathan, 2004/05/20
- Re: [ff3d-users] Code to solve Fick's law, what's wrong??!!, Stephane Del Pino, 2004/05/21