CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

find min/max deltaT

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   September 20, 2009, 21:36
Default find min/max deltaT
  #1
Senior Member
 
Chris Sideroff
Join Date: Mar 2009
Location: Ottawa, ON, CAN
Posts: 434
Rep Power: 22
cnsidero is on a distinguished road
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.
cnsidero is offline   Reply With Quote

Old   September 21, 2009, 03:19
Default
  #2
Super Moderator
 
niklas's Avatar
 
Niklas Nordin
Join Date: Mar 2009
Location: Stockholm, Sweden
Posts: 693
Rep Power: 29
niklas will become famous soon enoughniklas will become famous soon enough
Quote:
Originally Posted by cnsidero View Post
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).
niklas is offline   Reply With Quote

Old   September 21, 2009, 09:34
Default
  #3
Senior Member
 
Chris Sideroff
Join Date: Mar 2009
Location: Ottawa, ON, CAN
Posts: 434
Rep Power: 22
cnsidero is on a distinguished road
Quote:
Originally Posted by niklas View Post
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.
cnsidero is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to find the number of particles trapped prashant FLUENT 5 January 3, 2020 04:33
Looking for SUBOFF model but i can't find it. Heewon Lee Main CFD Forum 7 March 5, 2017 14:36
Errors running allwmake in OpenFOAM141dev with WM_COMPILE_OPTION%3ddebug unoder OpenFOAM Installation 11 January 30, 2008 21:30
where can I find information on Star v4? tootoon Siemens 5 March 11, 2007 17:36
YPlus nowhere to be find Daniel CFX 3 May 1, 2006 17:22


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