CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (http://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   find min/max deltaT (http://www.cfd-online.com/Forums/openfoam-programming-development/68448-find-min-max-deltat.html)

cnsidero September 20, 2009 20:36

find min/max deltaT
 
I'm trying to implement the CoEuler (local timestepping) scheme in my solver but I don't think its working. As a simple check to confirm, I want to print the min/max timestep to stdout. I've included the following in main source file of my solver:

Code:

dimensionedScalar maxDt = 0.0;
dimensionedScalar minDt = 0.0;

maxDt = max(runTime.deltaT()).value();

minDt = min(runTime.deltaT()).value();

Info<< "Max and min time steps = "
<< maxDt << " " << minDt << endl;

When I recompile it with wmake, I get an error beginning with the following:

Code:

mySolverFoam.C: In function ‘int main(int, char**)’:
mySolverFoam.C:229: error: no matching function for call to ‘max(Foam::dimensionedScalar)’

So I understand the Foam min and max functions don't accept dimensionScalar types. The rest of the compilation error messages says the min and max functions take basic data types as input, i.e. chars, ints, floats.

I guess, the general questions is how do I find min/max timestep? Also, am I right in assuming the timestep is stored as a scalar field array, i.e. a deltaT for each cell?

I'm a noob at C++ so I think this a simple question for someone in the know.

niklas September 21, 2009 02:19

Quote:

Originally Posted by cnsidero (Post 229969)
Also, am I right in assuming the timestep is stored as a scalar field array, i.e. a deltaT for each cell?

nope, its just a singe scalar..that's what the compiler is telling you. It is a dimensionedScalar.

So what you are trying to do is calculate something like max(1).

cnsidero September 21, 2009 08:34

Quote:

Originally Posted by niklas (Post 229980)
nope, its just a singe scalar..that's what the compiler is telling you. It is a dimensionedScalar.

So what you are trying to do is calculate something like max(1).

Ouch! Now I really feel dumb.


All times are GMT -4. The time now is 20:23.