View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0004134 | OpenFOAM | Bug | public | 2024-08-12 11:59 | 2024-08-14 09:38 |
Reporter | cgoessni | Assigned To | henry | ||
Priority | low | Severity | minor | Reproducibility | always |
Status | resolved | Resolution | fixed | ||
Product Version | dev | ||||
Fixed in Version | dev | ||||
Summary | 0004134: functionObject startTime or endTime cause crashes when writeControl is adjustableTimeStep and adjustTimeStep is True | ||||
Description | When setting up system/controlDict to allow for an adjusted time step, startTime and endTime of a functionObject with write/executeControl = adjustableRunTime can cause either a hang or a crash due to deltaT set to zero. | ||||
Steps To Reproduce | Run the following in tutorials/incompressibleFluid/pitzDaily: foamDictionary -entry startFrom -set startTime system/controlDict # to ensure to start from 0 in sub-seqent calls to foamRun foamDictionary -entry pAvg -set '{ type volFieldValue; libs ("libfieldFunctionObjects.so"); writeFields no; operation volAverage; fields (p); select all; writeControl adjustableRunTime; writeInterval 0.0001; startTime 0.01; }' system/functions foamRun would subseqently crash due to deltaT = 0: Courant Number mean: 0.426143 max: 7.89861 deltaT = 0 Time = 0.0001s #0 Foam::error::printStack(Foam::Ostream&) at ??:? #1 Foam::sigFpe::sigHandler(int) at ??:? #2 ? in "/lib64/libc.so.6" #3 Foam::fv::EulerDdtScheme<Foam::Vector<double> >::fvmDdt(Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh> const&) at ??:? #4 Foam::tmp<Foam::fvMatrix<Foam::Vector<double> > > Foam::fvm::ddt<Foam::Vector<double> >(Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh> const&) at ??:? #5 Foam::solvers::incompressibleFluid::momentumPredictor() at ??:? #6 ? at ??:? #7 __libc_start_main in "/lib64/libc.so.6" #8 ? at ??:? Floating point exception (core dumped) The same happens when setting endTime: foamDictionary -entry pAvg -set '{ type volFieldValue; libs ("libfieldFunctionObjects.so"); writeFields no; operation volAverage; fields (p); select all; writeControl adjustableRunTime; writeInterval 0.0001; endTime 0.01; }' system/functions Courant Number mean: 0.233311 max: 1.13311 deltaT = 0 Time = 0.0101s #0 Foam::error::printStack(Foam::Ostream&) at ??:? #1 Foam::sigFpe::sigHandler(int) at ??:? #2 ? in "/lib64/libc.so.6" #3 Foam::fv::EulerDdtScheme<Foam::Vector<double> >::fvmDdt(Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh> const&) at ??:? #4 Foam::tmp<Foam::fvMatrix<Foam::Vector<double> > > Foam::fvm::ddt<Foam::Vector<double> >(Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh> const&) at ??:? #5 Foam::solvers::incompressibleFluid::momentumPredictor() at ??:? #6 ? at ??:? #7 __libc_start_main in "/lib64/libc.so.6" #8 ? at ??:? Floating point exception (core dumped) Additionally, maxCourant=5 is never reached in the latter case since timeControlFunctionObject would unconditionally return timeToNextAction() according to the user-specified interval, even when the functionObject is inactive. | ||||
Additional Information | The following patch solves the issue for our cases: diff --git a/src/OpenFOAM/db/functionObjects/timeControl/timeControlFunctionObject.C b/src/OpenFOAM/db/functionObjects/timeControl/timeControlFunctionObject.C index 6d86f3c..39ace56 100644 --- a/src/OpenFOAM/db/functionObjects/timeControl/timeControlFunctionObject.C +++ b/src/OpenFOAM/db/functionObjects/timeControl/timeControlFunctionObject.C @@ -145,11 +145,22 @@ bool Foam::functionObjects::timeControl::end() Foam::scalar Foam::functionObjects::timeControl::timeToNextAction() { - return min - ( - executeControl_.timeToNextAction(), - writeControl_.timeToNextAction() - ); + if (time_.value() < startTime_) + { + return startTime_ - time_.value(); + } + else if (active()) + { + return min + ( + executeControl_.timeToNextAction(), + writeControl_.timeToNextAction() + ); + } + else + { + return vGreat; + } } | ||||
Tags | No tags attached. | ||||
Date Modified | Username | Field | Change |
---|---|---|---|
2024-08-12 11:59 | cgoessni | New Issue | |
2024-08-14 09:38 | henry | Note Added: 0013376 | |
2024-08-14 09:38 | henry | Assigned To | => henry |
2024-08-14 09:38 | henry | Status | new => resolved |
2024-08-14 09:38 | henry | Resolution | open => fixed |
2024-08-14 09:38 | henry | Fixed in Version | => dev |
2024-08-14 09:38 | henry | Note Added: 0013377 |