关于OpenFOAM里simple.loop()的咨询
- 
							
							
							
							
很多次好多人都问我一个具体函数是干什么用的,这种很难回答,因为OpenFOAM这面很多函数都是各种嵌套,要摸到底要翻个底朝天,比如这就是我对你的 simple.loop(runTime)摸底找出来的函数,你自己总结下,主要就是收敛了之后,就设定一个截止时间,返回false了。另外,你这种,不如自己写一个 while循环或者for循环更合适simpleControl.C->time.loop();bool Foam::simpleControl::loop(Time& time) { read(); if (!endIfConverged(time)) { storePrevIterFields(); } return time.loop(); }Time.C->loop();bool Foam::Time::loop() { bool running = run(); if (running) { operator++(); } return running; }Time.C->run();bool Foam::Time::run() const { bool running = this->running(); if (!subCycling_) { if (!running && timeIndex_ != startTimeIndex_) { functionObjects_.execute(); functionObjects_.end(); } } if (running) { if (!subCycling_) { const_cast<Time&>(*this).readModifiedObjects(); if (timeIndex_ == startTimeIndex_) { functionObjects_.start(); } else { functionObjects_.execute(); } } // Re-evaluate if running in case a function object has changed things running = this->running(); } return running; }Time.C->running();bool Foam::Time::running() const { return value() < (endTime_ - 0.5*deltaT_); }Time.C->setTime;void Foam::Time::setTime(const Time& t) { value() = t.value(); }convergenceControl.C->endIfConverged;bool Foam::convergenceControl::endIfConverged(Time& time) { if (converged()) { if (time.writeTime()) { time.stopAt(Time::stopAtControl::noWriteNow); time.setEndTime(time); } else { time.writeAndEnd(); } return true; } else { return false; } }
 
			

