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

chtmultiregionsimpleFoam: how to set the convergence criterion

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 14, 2015, 03:25
Default chtmultiregionsimpleFoam: how to set the convergence criterion
  #1
New Member
 
nemo
Join Date: Jan 2015
Posts: 26
Rep Power: 11
huyidao is on a distinguished road
Hello,Foamers.
I am trying to use the chtmultiregionsimpleFoam right now,I go through the cases in the tut,but in the fvSolution files ,there are no convergence criterion settings like other solvers in the residualcontrol subdict.When I run the tut cases,I found that it ended at the given end time.
Can I set the convergence criterion in the chtmultiregionSimpelFoam?How can I do it?
huyidao is offline   Reply With Quote

Old   October 15, 2015, 15:22
Default
  #2
Senior Member
 
Alex
Join Date: Oct 2013
Posts: 337
Rep Power: 22
zfaraday will become famous soon enough
Hi huyidao,

The answer is no, sadly no convergence criteria can be used to stop the solver once the criteria has been met... It always stops when the endTime is reached.

Regards,

Alex
__________________
Web site where I present my Master's Thesis: foamingtime.wordpress.com

The case I talk about in this site was solved with chtMultiRegionSimpleFoam solver and involves radiation. Some basic tutorials are also resolved step by step in the web. If you are interested in these matters, you are invited to come in!
zfaraday is offline   Reply With Quote

Old   October 16, 2015, 00:22
Default
  #3
New Member
 
nemo
Join Date: Jan 2015
Posts: 26
Rep Power: 11
huyidao is on a distinguished road
Thank you so much ,Alex.
As there is no such convergence ctriterio,then I have to add it myself.
I will post my code here when I finish,feel free to point out any of my errors.
Regards,
huyidao
huyidao is offline   Reply With Quote

Old   October 17, 2015, 09:21
Default
  #4
Senior Member
 
Alex
Join Date: Oct 2013
Posts: 337
Rep Power: 22
zfaraday will become famous soon enough
It will be a good enhancement if you finally can develop such a thing! If you do it, post it to the bug tracker also so that they can implement it to the code and all the users will be able to enjoy your work!

Regrads,

Alex
__________________
Web site where I present my Master's Thesis: foamingtime.wordpress.com

The case I talk about in this site was solved with chtMultiRegionSimpleFoam solver and involves radiation. Some basic tutorials are also resolved step by step in the web. If you are interested in these matters, you are invited to come in!
zfaraday is offline   Reply With Quote

Old   October 18, 2015, 07:41
Default
  #5
New Member
 
nemo
Join Date: Jan 2015
Posts: 26
Rep Power: 11
huyidao is on a distinguished road
Hello,Alex!
It takes me some time to do this,because I am not quite familiar with
C++.
Here is what I have done.
1:
I defined a new class named chtSimpleControl,it is almost the same as
simpleControl,but some sentences in the function loop() have been changed.
Quote:
bool Foam::chtSimpleControl::loop()
{
read();

Time& time = const_cast<Time&>(mesh_.time());

if (initialised_)
{
if (criteriaSatisfied())
{
//Info<< nl << algorithmName_ << " solution converged in "
// << time.timeName() << " iterations" << nl << endl;

// Set to finalise calculation
//time.writeAndEnd();
storePrevIterFields();
return false;
}
else
{
storePrevIterFields();
return time.loop();
}
}
else
{
initialised_ = true;
storePrevIterFields();
return time.loop();
}


//return time.loop();
}
2:
The file createChtSimpleControl.H is created.
Quote:
List<autoPtr<chtSimpleControl> > fluidConvergence(fluidRegions.size());
List<autoPtr<chtSimpleControl> > solidConvergence(solidRegions.size());

forAll(fluidConvergence,i)
{
fluidConvergence[i].set
(
new chtSimpleControl(fluidRegions[i])
);
}


forAll(solidConvergence,i)
{
solidConvergence[i].set
(
new chtSimpleControl(solidRegions[i])
);
}
3:
The createChtSimpleControl.H is included in the chtMutiRegionSimpleFoam.C,and the iteration
loop is redefined as fllowed.
Quote:
bool run=true;
while (run)
{
Info<< "Time = " << runTime.timeName() << nl << endl;

forAll(fluidRegions, i)
{
Info<< "\nSolving for fluid region "
<< fluidRegions[i].name() << endl;
#include "setRegionFluidFields.H"
#include "readFluidMultiRegionSIMPLEControls.H"
#include "solveFluid.H"
}

forAll(solidRegions, i)
{
Info<< "\nSolving for solid region "
<< solidRegions[i].name() << endl;
#include "setRegionSolidFields.H"
#include "readSolidMultiRegionSIMPLEControls.H"
#include "solveSolid.H"
}

runTime.write();

Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
<< nl << endl;

run=false;
forAll(fluidConvergence,i)
{
if(fluidConvergence[i]().loop())
{
run=true;
break;
}
}

forAll(solidConvergence,i)
{
if(solidConvergence[i]().loop())
{
run=true;
break;
}
}
}
runTime.writeAndEnd();

Info<< "End\n" << endl;

return 0;
I tested it in the tut heatExchanger,It seems that it works fine,but this may not be the best way to do this and there may be still some bugs feel free to point out any of my errors.

And I still have a question,where is the time increasment defined like runTime++ or something else?The runTime++ method is not called explicitly in this iteration loop.
huyidao is offline   Reply With Quote

Old   October 20, 2015, 09:14
Default
  #6
Senior Member
 
Alex
Join Date: Oct 2013
Posts: 337
Rep Power: 22
zfaraday will become famous soon enough
Thanks for your effort huyidao, this a very good job! I don't know if it may be done in a better way as you point out or not, my knowledge in C++ is much weaker than yours. However, I recomend you to report your work to the bug tracker so that they can put it in the repository and more people will be able to enjoy it and, in case it is necessary, they will be able to report bugs in your code in orther to improve it.

Great job! It's a pitty that nobody did it before so that I could use it during the developement of my final thesis...

Many thanks again. Best regards,

Alex
__________________
Web site where I present my Master's Thesis: foamingtime.wordpress.com

The case I talk about in this site was solved with chtMultiRegionSimpleFoam solver and involves radiation. Some basic tutorials are also resolved step by step in the web. If you are interested in these matters, you are invited to come in!
zfaraday is offline   Reply With Quote

Old   January 21, 2016, 09:20
Default
  #7
Member
 
Joćo Ferreira
Join Date: Nov 2014
Location: Braga, Portugal
Posts: 53
Rep Power: 12
jmdf is on a distinguished road
Quote:
Originally Posted by huyidao View Post
Hello,Alex!
It takes me some time to do this,because I am not quite familiar with
C++.
Here is what I have done.
1:
I defined a new class named chtSimpleControl,it is almost the same as
simpleControl,but some sentences in the function loop() have been changed.

Hi huyidao,

can you give some more information on the chtSimpleControl class? How did you create it or the files you changed?
I'm trying to implement this procedure but with no luck. I'm asking about the files because i'm not working on my machine and I can't change the source files if that is a must.

Also, do you have the files needed to compile the solver?

Regards,
Joćo
jmdf 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
problem with Min/max rho tH3f0rC3 OpenFOAM 8 July 31, 2019 10:48
In the case of convergence aja1345 FLUENT 1 July 31, 2015 04:58
correction of Grub after installing Windows XP and 8 immortality Lounge 20 January 5, 2014 18:41
default convergence criterion for energy zthdhr FLUENT 1 November 10, 2013 14:42
Help with GNUPlot Renato. Main CFD Forum 6 June 6, 2007 20:51


All times are GMT -4. The time now is 16:29.