|
[Sponsors] |
February 9, 2016, 09:53 |
ODE Solver of OpenFOAM-extend
|
#1 |
New Member
Sergey Lesnik
Join Date: Mar 2015
Posts: 14
Rep Power: 11 |
Hello Foamers,
I'm stuck within implementing a set of ODE in OpenFOAM-extend 3.2. The greatest problem is that the extenden version has no Test-ODE.C, at least I couldn't find it. Thus, I implemented my ODEs in OF-2.3, which is working fine, and now try to transfer it to the extend version. I'm trying to figure out what is the meaning of the "coeffs" function in ODE.H: Code:
//- Return access to coefficients virtual scalarField& coeffs() = 0; //- Return reference to coefficients virtual const scalarField& coeffs() const = 0; Code:
scalarField& y = ode_.coeffs(); for (label nStep = 0; nStep < MAXSTP; nStep++) { ode_.derivatives(x, y, dydx_); for (label i=0; i<nEqns; i++) { yScale_[i] = mag(y[i]) + mag(dydx_[i]*h) + SMALL; } if ((x + h - xEnd)*(x + h - xStart) > 0.0) { h = xEnd - x; } scalar hNext, hDid; solve(x, y, dydx_, eps, yScale_, h, hDid, hNext); Can anybody provide a simple test case for the current OpenFOAM-extend version (something like Test-ODE)? |
|
August 4, 2016, 10:06 |
|
#2 |
New Member
Giovanni Stabile
Join Date: Sep 2014
Location: Trieste (Italy) - Florence (Italy)
Posts: 14
Rep Power: 11 |
Hi I'm also havin the same issues.. did you maybe find a solution?
Regards, Giovanni |
|
August 5, 2016, 11:01 |
|
#3 |
New Member
Sergey Lesnik
Join Date: Mar 2015
Posts: 14
Rep Power: 11 |
Hey Giovanno,
I couldn't really figure out how it was meant to be done but I brought it to tun. Now I think "coeffs" function is about starting values for your ODE or at least initializing the variable "y". So a fast solution would be to put there something which intitializes your scalarfield y and returns it back. It needs only to compile, it will not affect your solution (IMHO) In my case, I needed also to change some routines in ODESolver and thus I just copied the whole ODE directory to my solver directory, changed and compiled it. Here you need to make sure that you include only your version of ODE directory for compiler under Make/options: EXE_INC = -I./ODE and also you have to mention all the .C files in the file Make/files: ODE/ODESolver.C; ODE/RK.C ... (ans so on) Hope this helps! Greets, Sergey |
|
August 8, 2016, 03:17 |
|
#4 |
New Member
Giovanni Stabile
Join Date: Sep 2014
Location: Trieste (Italy) - Florence (Italy)
Posts: 14
Rep Power: 11 |
Dear Sergey,
Thank you for the prompt answer, I had also the same idea and I compared the code with the codes from standard versions of OpenFOAM. It looks that it is not used inside the routines. I will try to do as you mentioned. Regards, Giovanni |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Using ODE in OpenFoam | skabilan | OpenFOAM Programming & Development | 22 | April 6, 2022 06:05 |
Memory protection in OpenFOAM / combinig with FORTRAN | botp | OpenFOAM Programming & Development | 2 | February 15, 2016 12:25 |
thobois class engineTopoChangerMesh error | Peter_600 | OpenFOAM | 4 | August 2, 2014 09:52 |
Two ODE objects simultaneously | JBUNSW | OpenFOAM Programming & Development | 0 | November 28, 2012 21:46 |
Working directory via command line | Luiz | CFX | 4 | March 6, 2011 20:02 |