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

Using adjustableTimeStep in pisoFoam

Register Blogs Community New Posts Updated Threads Search

Like Tree8Likes
  • 2 Post By odellar
  • 1 Post By sfmoabdu
  • 1 Post By clapointe
  • 3 Post By amuzeshi
  • 1 Post By sourav90

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 26, 2014, 03:33
Default Using adjustableTimeStep in pisoFoam
  #1
Member
 
Olie
Join Date: Oct 2013
Posts: 51
Rep Power: 12
odellar is on a distinguished road
Hi,

I've found a couple of pages online documenting where to add code in the pisoFoam solver code such that using:

Code:
adjustTimeStep  yes;

maxCo         1;

maxDeltaT    0.5;
in the controlDict file will work (as the pisoFoam doesn't originally support adjustable timestep) - but it's still not particularly clear.

For a start I don't actually know how to get to the solver.c file (which I believe is where I need to add code?)

If anyone could give me some step-by-step instructions of exactly what to do that would be much appreciated.

Thanks, Olie
amuzeshi and sourav90 like this.
odellar is offline   Reply With Quote

Old   February 26, 2014, 08:06
Default Update
  #2
Member
 
Olie
Join Date: Oct 2013
Posts: 51
Rep Power: 12
odellar is on a distinguished road
If it helps, I *think* I've put the right code in the right place within pisoFoam.C, thanks to this tutorial: http://www.idurun.com/?p=371

This involved me editing the pisoFoam.C file using
Code:
sudo gedit pisoFoam.C
as it initially told me I don't have permission for some reason. But when I try to compile it using
Code:
wmake
I get this:

Code:
mkdir: cannot create directory `linux64GccDPOpt': Permission denied
/bin/sh: 1: cannot create linux64GccDPOpt/options: Directory nonexistent
make: *** [linux64GccDPOpt/options] Error 2
/opt/openfoam221/wmake/MakefileFiles:40: linux64GccDPOpt/options: No such file or directory
make: *** No rule to make target `linux64GccDPOpt/options'. Stop.
wmake error: file 'Make/linux64GccDPOpt/objectFiles' could not be created in /opt/openfoam221/applications/solvers/incompressible/pisoFoam
Any ideas?

Thanks


odellar is offline   Reply With Quote

Old   June 1, 2014, 14:06
Default
  #3
New Member
 
Join Date: Feb 2014
Posts: 9
Rep Power: 12
sfmoabdu is on a distinguished road
it may be too late to reply but let me do it just for anyone will have the same problem.
adding adjustable time step to pisoFoam is not that big issue, just google the tutorial "adding temprature to icofoam" and instead of temprature you will add two headers in the pisoFoam.C (or whatever you will call it)

After:
# include "initContinuityErrs.H"
add this:
# include "readTimeControls.H"

and after:
# include "CourantNo.H"
add this:
# include "setDeltaT.H"

and run wmake.

in system/controlDict add these lines.

adjustTimeStep on;
maxCo 0.3;

and in fvSchemes add linear as following:

interpolationSchemes
{
default linear;
.
.
.
}

Enjoy!!
rajibroy likes this.
sfmoabdu is offline   Reply With Quote

Old   April 13, 2018, 06:48
Default
  #4
New Member
 
Ben
Join Date: Oct 2016
Posts: 25
Rep Power: 9
bentkj is on a distinguished road
Quote:
Originally Posted by sfmoabdu View Post
it may be too late to reply but let me do it just for anyone will have the same problem.
adding adjustable time step to pisoFoam is not that big issue, just google the tutorial "adding temprature to icofoam" and instead of temprature you will add two headers in the pisoFoam.C (or whatever you will call it)

After:
# include "initContinuityErrs.H"
add this:
# include "readTimeControls.H"

and after:
# include "CourantNo.H"
add this:
# include "setDeltaT.H"

and run wmake.

in system/controlDict add these lines.

adjustTimeStep on;
maxCo 0.3;

and in fvSchemes add linear as following:

interpolationSchemes
{
default linear;
.
.
.
}

Enjoy!!
Hi, sorry if this is late but after I add the 2 headers and do wmake, i get the errors:

Quote:
Making dependency list for source file my_pisoFoam.C
g++ -std=c++0x -m64 -Dlinux64 -DWM_ARCH_OPTION=64 -DWM_DP -DWM_LABEL_SIZE=32 -Wall -Wextra -Wold-style-cast -Wnon-virtual-dtor -Wno-unused-parameter -Wno-invalid-offsetof -O3 -DNoRepository -ftemplate-depth-100 -I/opt/openfoam4/src/TurbulenceModels/turbulenceModels/lnInclude -I/opt/openfoam4/src/TurbulenceModels/incompressible/lnInclude -I/opt/openfoam4/src/transportModels -I/opt/openfoam4/src/transportModels/incompressible/singlePhaseTransportModel -I/opt/openfoam4/src/finiteVolume/lnInclude -I/opt/openfoam4/src/meshTools/lnInclude -I/opt/openfoam4/src/sampling/lnInclude -IlnInclude -I. -I/opt/openfoam4/src/OpenFOAM/lnInclude -I/opt/openfoam4/src/OSspecific/POSIX/lnInclude -fPIC -c my_pisoFoam.C -o Make/linux64GccDPInt32Opt/my_pisoFoam.o
In file included from my_pisoFoam.C:57:0:
/opt/openfoam4/src/finiteVolume/lnInclude/readTimeControls.H: In function ‘int main(int, char**)’:
/opt/openfoam4/src/finiteVolume/lnInclude/readTimeControls.H:32:1: error: ‘adjustTimeStep’ was not declared in this scope
adjustTimeStep =
^
/opt/openfoam4/src/finiteVolume/lnInclude/readTimeControls.H:35:1: error: ‘maxCo’ was not declared in this scope
maxCo =
^
/opt/openfoam4/src/finiteVolume/lnInclude/readTimeControls.H:38:1: error: ‘maxDeltaT’ was not declared in this scope
maxDeltaT =
^
/opt/openfoam4/wmake/rules/General/transform:8: recipe for target 'Make/linux64GccDPInt32Opt/my_pisoFoam.o' failed
make: *** [Make/linux64GccDPInt32Opt/my_pisoFoam.o] Error 1
any idea?

*EDIT: turns out another header file was missing. this is #include "createTimeControls.H"
adding that in solved the problem. Thank you.

Source: Error trying to compile new solver.C
bentkj is offline   Reply With Quote

Old   November 13, 2018, 20:50
Default
  #5
New Member
 
caoxuxiang's Avatar
 
Xuxiang Cao
Join Date: Jun 2016
Posts: 11
Rep Power: 9
caoxuxiang is on a distinguished road
Quote:
Originally Posted by bentkj View Post
Hi, sorry if this is late but after I add the 2 headers and do wmake, i get the errors:



any idea?

*EDIT: turns out another header file was missing. this is #include "createTimeControls.H"
adding that in solved the problem. Thank you.

Source: Error trying to compile new solver.C
i have the same problem now. maybe i can give you some advices. when i found the pisoFoam.c, there no # include "readTimeControls.H" and # include "setDeltaT.H" . i just done the same steps as you, then i got wrong information too.

“the variable was not declared” is tell me that it was not declared before to use it. so i added the #include "createTimeControls.H" after #include "createControl.H", it works well.

p.s of-4.0
caoxuxiang is offline   Reply With Quote

Old   November 14, 2018, 14:20
Default
  #6
Senior Member
 
Join Date: Aug 2015
Posts: 494
Rep Power: 14
clapointe is on a distinguished road
For future reference, pimpleFoam can be run essentially as pisoFoam by setting nOuterCorrectors to 1. This alleviates any coding problem. pimpleFoam supports adjustable timestep.

Caelan
utkunun likes this.
clapointe is offline   Reply With Quote

Old   September 30, 2020, 10:14
Default
  #7
Senior Member
 
Ali Shayegh
Join Date: Oct 2015
Posts: 130
Rep Power: 10
amuzeshi is on a distinguished road
Quote:
Originally Posted by odellar View Post
Hi,

I've found a couple of pages online documenting where to add code in the pisoFoam solver code such that using:

Code:
adjustTimeStep  yes;

maxCo         1;

maxDeltaT    0.5;
in the controlDict file will work (as the pisoFoam doesn't originally support adjustable timestep) - but it's still not particularly clear.

For a start I don't actually know how to get to the solver.c file (which I believe is where I need to add code?)

If anyone could give me some step-by-step instructions of exactly what to do that would be much appreciated.

Thanks, Olie
Hi,
In order to make it possible to use adjustable time step in pisoFoam, in OpenFOAM v2006, follow these steps:
Code:
mkdir -p  $WM_PROJECT_USER_DIR/solvers/incompressible
cp -r $FOAM_SOLVERS/incompressible/pisoFoam  $WM_PROJECT_USER_DIR/solvers/incompressible/myPisoFoam
cd $WM_PROJECT_USER_DIR/solvers/incompressible/myPisoFoam
mv pisoFoam myPisoFoam
sed -i s/pisoFoam/myPisoFoam/g Make/files
Then add the red lines to myPisoFoam.C:
Code:
...
    #include "createFields.H"								   
    #include "initContinuityErrs.H"							  
    #include "CourantNo.H"							    
    #include "createTimeControls.H"						    
    #include "setInitialDeltaT.H"
...
	Info<< "Time = " << runTime.timeName() << nl << endl;				      

        #include "CourantNo.H"								        
	#include "setDeltaT.H"
...
Now execute:
Code:
wclean
wmake
Make sure that you are in myPisoFoam directory when you issue these two commands.

Ali
sxpsxp007, mm66 and sourav90 like this.
amuzeshi is offline   Reply With Quote

Old   February 23, 2021, 11:03
Smile Small correction
  #8
Member
 
Sourav Mandal
Join Date: Jul 2019
Posts: 55
Rep Power: 6
sourav90 is on a distinguished road
Quote:
Originally Posted by amuzeshi View Post
Hi,
In order to make it possible to use adjustable time step in pisoFoam, in OpenFOAM v2006, follow these steps:
Code:
mkdir -p  $WM_PROJECT_USER_DIR/solvers/incompressible
cp -r $FOAM_SOLVERS/incompressible/pisoFoam  $WM_PROJECT_USER_DIR/solvers/incompressible/myPisoFoam
cd $WM_PROJECT_USER_DIR/solvers/incompressible/myPisoFoam
mv pisoFoam.C myPisoFoam.C
sed -i s/pisoFoam/myPisoFoam/g Make/files
...

Ali
Hi Ali & others, thanks very much for adding this . I confirm this works with openFOAM version 8 also, but with the small modification of the commands shown in green.
amuzeshi likes this.
sourav90 is offline   Reply With Quote

Old   October 14, 2022, 18:19
Default
  #9
Member
 
Neilson Whit
Join Date: Aug 2011
Posts: 74
Rep Power: 14
wolfindark is on a distinguished road
It gives me following error: Any idea?

Code:
/home/kano/OpenFOAM/OpenFOAM-10/src/finiteVolume/lnInclude/setDeltaT.H: In function ‘int main(int, char**)’:
/home/kano/OpenFOAM/OpenFOAM-10/src/finiteVolume/lnInclude/setDeltaT.H:37:34: error: expected primary-expression before ‘.’ token
   37 |     deltaT = min(deltaT, fvModels.maxDeltaT());
      |                                  ^
make: *** [/home/kano/OpenFOAM/OpenFOAM-10/wmake/rules/General/transform:26: Make/linux64GccDPInt32Debug/mymhdFoam.o] Error 1
wolfindark is offline   Reply With Quote

Old   October 26, 2022, 21:00
Default
  #10
Senior Member
 
Ali Shayegh
Join Date: Oct 2015
Posts: 130
Rep Power: 10
amuzeshi is on a distinguished road
Quote:
Originally Posted by wolfindark View Post
It gives me following error: Any idea?

Code:
/home/kano/OpenFOAM/OpenFOAM-10/src/finiteVolume/lnInclude/setDeltaT.H: In function ‘int main(int, char**)’:
/home/kano/OpenFOAM/OpenFOAM-10/src/finiteVolume/lnInclude/setDeltaT.H:37:34: error: expected primary-expression before ‘.’ token
   37 |     deltaT = min(deltaT, fvModels.maxDeltaT());
      |                                  ^
make: *** [/home/kano/OpenFOAM/OpenFOAM-10/wmake/rules/General/transform:26: Make/linux64GccDPInt32Debug/mymhdFoam.o] Error 1
Which version of OF?
amuzeshi is offline   Reply With Quote

Old   October 27, 2022, 04:21
Default
  #11
Member
 
Neilson Whit
Join Date: Aug 2011
Posts: 74
Rep Power: 14
wolfindark is on a distinguished road
Quote:
Originally Posted by amuzeshi View Post
Which version of OF?
OpenFOAM-10
wolfindark is offline   Reply With Quote

Old   October 30, 2022, 16:26
Default
  #12
Senior Member
 
Ali Shayegh
Join Date: Oct 2015
Posts: 130
Rep Power: 10
amuzeshi is on a distinguished road
Quote:
Originally Posted by wolfindark View Post
OpenFOAM-10
In Make/files, change
Code:
FOAM_APPBIN
to
Code:
FOAM_USER_APPBIN
In myPisoFoam
Code:
mv pisoFoam myPisoFoam
I successfully compiled it, and the turbulent cavity (pisoFoam/RAS) is successfully run when adjustTimeStep is true.
amuzeshi is offline   Reply With Quote

Old   June 12, 2023, 17:57
Default
  #13
New Member
 
Join Date: Jun 2017
Posts: 15
Rep Power: 8
Simone81 is on a distinguished road
Hi,

I am trying to implement adjustTimeStep in the solver shallowWaterFoam in openFOAM-10, following the instruction from the previous posts. I do the following
Code:
mkdir -p  $WM_PROJECT_USER_DIR/solvers/incompressible
cp -r $FOAM_SOLVERS/incompressible/shallowWater  $WM_PROJECT_USER_DIR/solvers/incompressible/myShallowWater
cd $WM_PROJECT_USER_DIR/solvers/incompressible/myShallowWater
mv shallowWaterFoam.C myShallowWaterFoam.C
sed -i s/shallowWaterFoam/myShallowWaterFoam/g Make/files
then in the file myShallowWaterFoam.C I have included the files in red:
Code:
#include "fvCFD.H"
#include "pimpleControl.H"
#include "fvModels.H"
#include "fvConstraints.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

int main(int argc, char *argv[])
{
    #include "postProcess.H"

    #include "setRootCaseLists.H"
    #include "createTime.H"
    #include "createMesh.H"
    #include "createControl.H"
    #include "createFields.H"
							  
    #include "CourantNo.H"							    
    #include "createTimeControls.H"						    
    #include "setInitialDeltaT.H"

    // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

    Info<< "\nStarting time loop\n" << endl;

    while (pimple.loop(runTime))
    {
        Info<< "\n Time = " << runTime.timeName() << nl << endl;

        #include "CourantNo.H"
        #include "setDeltaT.H"
Then I compile
Code:
wclean
wmake
and I get the following error:
Code:
/opt/openfoam10/src/finiteVolume/lnInclude/setDeltaT.H: In function ‘int main(int, char**)’:
/opt/openfoam10/src/finiteVolume/lnInclude/setDeltaT.H:37:34: error: expected primary-expression before ‘.’ token
   37 |     deltaT = min(deltaT, fvModels.maxDeltaT());
      |                                  ^
make: *** [/opt/openfoam10/wmake/rules/General/transform:26: Make/linux64GccDPInt32Opt/myShallowWaterFoam.o] Error 1
I also replaced
Code:
FOAM_APPBIN
with
Code:
FOAM_USER_APPBIN
but I get the same error as wolfindark in the post #9. What am I doing wrong?
Thank you!

Last edited by Simone81; June 12, 2023 at 17:58. Reason: adding OF version.
Simone81 is offline   Reply With Quote

Reply

Tags
adjusttimestep, cfl, pisofoam


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
Differences in solution method for pisoFoam and buoyantBoussinesqPisoFoam mchurchf OpenFOAM 7 August 6, 2023 09:12
why pisoFoam take such a long time to converge? izna OpenFOAM Running, Solving & CFD 51 October 25, 2013 02:28
Error DURING pisoFoam execution Pj. OpenFOAM Running, Solving & CFD 0 September 14, 2013 04:28
pisoFoam, pimpleFoam - Fluent user's questions RodriguezFatz OpenFOAM Running, Solving & CFD 0 September 4, 2013 04:26
pisoFoam compiling error with OF 1.7.1 on MAC OSX Greg Givogue OpenFOAM Programming & Development 3 March 4, 2011 17:18


All times are GMT -4. The time now is 18:28.