April 22, 2012, 11:36
|
Solving ODEs
|
#1
|
New Member
Mostafa Moghaddami
Join Date: Oct 2009
Posts: 13
Rep Power: 17
|
Dear All,
I am trying to write a new solver to solve a set of ODEs. I used the commands that are used in the ode.H and ode.C files to create an ODE solver and set of ODEs object.
I have attached the whole folder of the solver also the following is the main solver file:
Code:
#include "fvCFD.H"
#include "ODESolver.H"
#include "ODE.H"
#include "MostafaODEModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
int main(int argc, char *argv[])
{
#include "setRootCase.H"
#include "createTime.H"
#include "createMesh.H"
MostafaODEModel ode(mesh);
autoPtr<ODESolver> odeSolver_;
odeSolver_(ODESolver::New("RK", ode));
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Info<<"Create Fields"<<endl;
#include "createFields.H"
Info<< "\nStarting time loop\n" << endl;
while (runTime.loop())
{
Info<< "Time = " << runTime.timeName() << nl <<endl
<< "Time value="<<runTime.value()<<endl;
c[0]=x;c[1]=y;c[2]=z;
odesolver.solve(ode,0,10,c,0.01,0.1);
runTime.write();
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
<< nl << endl;
}
Info<< "End\n" << endl;
return 0;
}
I compiled the solver and I got the following Errors:
Quote:
ODESample.C: In function ‘int main(int, char**)’:
ODESample.C:50: error: no match for call to ‘(Foam::autoPtr<Foam::ODESolver>) (Foam::autoPtr<Foam::ODESolver>)’
/opt/openfoam201/src/OpenFOAM/lnInclude/autoPtrI.H:114: note: candidates are: T& Foam::autoPtr<T>::operator()() [with T = Foam::ODESolver]
/opt/openfoam201/src/OpenFOAM/lnInclude/autoPtrI.H:128: note: const T& Foam::autoPtr<T>::operator()() const [with T = Foam::ODESolver]
ODESample.C:67: error: ‘odesolver’ was not declared in this scope
make: *** [Make/linux64GccDPOpt/ODESample.o] Error 1
|
Any help would be appreciated.
|
|
|