|
[Sponsors] |
August 3, 2016, 12:19 |
ODE & PDE model
|
#1 |
Member
anonymous
Join Date: Mar 2016
Location: Canada
Posts: 93
Rep Power: 10 |
Dear members,
I am writing a 3D solver that has one ODE and one PDE. dC/dt = -a*X, with C(0)=1 dX/dt = laplacian(DX, X) + k*X, with no slip boundary condition everywhere and X(0) = 0.05 at the bottom I am confused how to setup this model specially ODE and need help. So far I can think as follows: Code:
while (simple.loop()) { Info<< "Time = " << runTime.timeName() << nl << endl; solve(fvm::ddt(C) == -a*X); solve(fvm::ddt(X) == fvm::laplacian(DX, X) + k*X); runTime.write(); } Code:
FoamFile { version 2.0; format ascii; class volScalarField; location "0"; object C; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // dimensions [0 0 0 0 0 0 0]; internalField uniform 1; boundaryField { AllWalls { ??????? //I don't have boundary conditions } } (1) is my setup correct? (2) I don't have boundary conditions for ODE, what should I do in above code? (3) I don't want to use simple.loop() in while condition, what are other options to iterate through time-steps? (4)Plz suggest, how can I improve this setup? Thanks for reading. |
|
August 4, 2016, 19:49 |
|
#2 |
Member
anonymous
Join Date: Mar 2016
Location: Canada
Posts: 93
Rep Power: 10 |
Anyone has any suggestion.
|
|
August 11, 2016, 09:48 |
|
#3 |
Member
anonymous
Join Date: Mar 2016
Location: Canada
Posts: 93
Rep Power: 10 |
Hello everyone,
Any comment or suggestion in my case? Thanks. |
|
August 11, 2016, 10:31 |
|
#4 |
Senior Member
David Gaden
Join Date: Apr 2009
Location: Winnipeg, Canada
Posts: 437
Rep Power: 21 |
I don't think finiteVolume is set up for ODEs. OpenFOAM has an ODE solver library, src/ode. Have a look at applications/test/ODE to see how one is set up.
If you take an example from the chemistry solvers, ODEs are solved by first looping through all the cells in the mesh, then solving the ODE. That is: Code:
// given that rho is a volScalarField // given that C is a PtrList<volScalarField> of your ODE variables forAll(rho, cellI) { scalarField y(nEqns); // number of variables in your ODE forAll(y, varI) { y[varI] = C[varI][cellI]; // solve ODE here, see Test-ODE for example } }
__________________
~~~ Follow me on twitter @DavidGaden |
|
August 12, 2016, 08:24 |
|
#5 |
Member
anonymous
Join Date: Mar 2016
Location: Canada
Posts: 93
Rep Power: 10 |
Thanks marupio. I am not sure how to implement this. I am using OpenFoam for the last three months and still learning.
If I setup ODE using FVM, will it be wrong? I think that it should produce the same result, but less efficient. I need to know, how we can make it more efficient? Thanks. |
|
August 12, 2016, 10:07 |
|
#6 | |
Super Moderator
Tobias Holzmann
Join Date: Oct 2010
Location: Tussenhausen
Posts: 2,708
Blog Entries: 6
Rep Power: 51 |
Quote:
I solved something similar -> the Gray-Scott-Model <- Both equations are coupled but I also solved it segregated and without any problems. Even your equations above should be an easy task to implement.
__________________
Keep foaming, Tobias Holzmann |
||
August 12, 2016, 10:19 |
|
#7 |
Member
anonymous
Join Date: Mar 2016
Location: Canada
Posts: 93
Rep Power: 10 |
Thanks Tobi, I will look into it.
|
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
kklOmega omega boundary condition at the wall - OF3.0 | Artur | OpenFOAM Running, Solving & CFD | 1 | June 17, 2016 15:42 |
Turbulence model choice | dave13 | CFX | 3 | December 22, 2015 07:12 |
problem with solving lagrange reaction cloud | Polli | OpenFOAM Running, Solving & CFD | 0 | April 30, 2014 07:53 |
manualInjection model in sprayFoam | Mentalo | OpenFOAM Running, Solving & CFD | 1 | April 2, 2014 09:29 |
Problems bout CFD model of biomass gasification, Downdraft gasifier | wanglong | FLUENT | 2 | November 25, 2009 23:27 |