Skip to content

Commit

Permalink
response to WPK comments
Browse files Browse the repository at this point in the history
  • Loading branch information
markelov208 committed Mar 6, 2025
1 parent 449ac95 commit b6d6e6c
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,9 @@ void AdaptiveTimeIncrementor::PostTimeStepExecution(const TimeStepEndState& rRes
}
if (rResultantState.time < mEndTime) {
// Up-scaling to reach end_time without small increments
constexpr auto small_increment = 1.0e-3;
if (rResultantState.time + mDeltaTime > mEndTime - small_increment * mDeltaTime) {
constexpr auto small_increment_factor = 1.0e-3;
if (auto small_time_increment = small_increment_factor * mDeltaTime;
rResultantState.time + mDeltaTime > mEndTime - small_time_increment) {
mDeltaTime = mEndTime - rResultantState.time;
}
}
Expand All @@ -97,7 +98,7 @@ void AdaptiveTimeIncrementor::PostTimeStepExecution(const TimeStepEndState& rRes
}

KRATOS_ERROR_IF(mDeltaTime < mMinAllowableDeltaTime.second)
<< "Delta time (" << mDeltaTime << ") is smaller than minimum allowable value "
<< "Delta time (" << mDeltaTime << ") is smaller than " << mMinAllowableDeltaTime.first << " minimum allowable value "
<< mMinAllowableDeltaTime.second << std::endl;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ double GetMaxDeltaTimeFactorFrom(const Parameters& rProjectParameters)
std::pair<std::string, double> GetMinAllowableDeltaTimeFrom(const Parameters& rProjectParameters)
{
if (rProjectParameters["solver_settings"]["time_stepping"].Has("minimum_allowable_value")) {
return {"set",
return {"given",
rProjectParameters["solver_settings"]["time_stepping"]["minimum_allowable_value"].GetDouble()};
} else {
constexpr auto minimum_allowable_value = 1e-10;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def _check_delta_time_size(self):
KratosMultiphysics.Logger.PrintInfo(self._GetSimulationName(), "The time step ", self.delta_time, " is smaller than a given minimum value of ", self.min_delta_time)
else:
KratosMultiphysics.Logger.PrintInfo(self._GetSimulationName(), "The time step ", self.delta_time, " is smaller than a default minimum value of ", self.min_delta_time)
KratosMultiphysics.Logger.PrintInfo(self._GetSimulationName(), "Please check the case settings.")
KratosMultiphysics.Logger.PrintInfo(self._GetSimulationName(), "Please check settings in Project Parameters and Materials Files.")
raise RuntimeError('The time step is too small!')

def RunSolutionLoop(self):
Expand Down Expand Up @@ -194,9 +194,9 @@ def ResetIfHasNodalSolutionStepVariable(self, variable):
self._GetSolver().GetComputingModelPart().Nodes, variable, zero_vector, 1)

def PrintAnalysisStageProgressInformation(self):
KratosMultiphysics.Logger.PrintInfo(self._GetSimulationName(), "STEP : ", self._GetSolver().GetComputingModelPart().ProcessInfo[KratosMultiphysics.STEP])
KratosMultiphysics.Logger.PrintInfo(self._GetSimulationName(), "DELTA_TIME : ", self._GetSolver().GetComputingModelPart().ProcessInfo[KratosMultiphysics.DELTA_TIME])
KratosMultiphysics.Logger.PrintInfo(self._GetSimulationName(), "TIME : ", self._GetSolver().GetComputingModelPart().ProcessInfo[KratosMultiphysics.TIME])
KratosMultiphysics.Logger.PrintInfo(self._GetSimulationName(), "STEP : ", self._GetSolver().GetComputingModelPart().ProcessInfo[KratosMultiphysics.STEP])
KratosMultiphysics.Logger.PrintInfo(self._GetSimulationName(), "DELTA_TIME: ", self._GetSolver().GetComputingModelPart().ProcessInfo[KratosMultiphysics.DELTA_TIME])
KratosMultiphysics.Logger.PrintInfo(self._GetSimulationName(), "TIME : ", self._GetSolver().GetComputingModelPart().ProcessInfo[KratosMultiphysics.TIME])

def _CreateSolver(self):
return geomechanics_solvers_wrapper.CreateSolver(self.model, self.project_parameters)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ struct AdaptiveTimeIncrementorSettings {
double StartTime{0.0};
double EndTime{8.0};
double StartIncrement{0.5};
std::pair<std::string, double> MinAllowableDeltaTime{"set", 1e-06};
std::pair<std::string, double> MinAllowableDeltaTime{"given", 1e-06};
std::size_t MaxNumOfCycles{8};
double ReductionFactor{0.5};
double IncreaseFactor{2.0};
Expand Down Expand Up @@ -440,13 +440,13 @@ KRATOS_TEST_CASE_IN_SUITE(ThrowExceptionWhenDeltaTimeSmallerThanTheLimit, Kratos

KRATOS_EXPECT_EXCEPTION_IS_THROWN(
time_incrementor.PostTimeStepExecution(previous_state),
"Delta time (1e-07) is smaller than minimum allowable value 1e-06");
"Delta time (1e-07) is smaller than given minimum allowable value 1e-06");

previous_state.convergence_state = TimeStepEndState::ConvergenceState::non_converged;

KRATOS_EXPECT_EXCEPTION_IS_THROWN(
time_incrementor.PostTimeStepExecution(previous_state),
"Delta time (5e-08) is smaller than minimum allowable value 1e-06");
time_incrementor.PostTimeStepExecution(previous_state),
"Delta time (5e-08) is smaller than given minimum allowable value 1e-06");
}

KRATOS_TEST_CASE_IN_SUITE(HalfTimeStepAtNonConverged, KratosGeoMechanicsFastSuiteWithoutKernel)
Expand Down

0 comments on commit b6d6e6c

Please sign in to comment.