Skip to content

Commit

Permalink
Merge branch 'TimeSteppingCleanup' into 'master'
Browse files Browse the repository at this point in the history
Time stepping cleanup

See merge request ogs/ogs!4672
  • Loading branch information
endJunction committed Jul 12, 2023
2 parents 1de404b + 2aebf8d commit 6b55afa
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 19 deletions.
2 changes: 0 additions & 2 deletions NumLib/TimeStepping/Algorithms/EvolutionaryPIDcontroller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,6 @@ std::tuple<bool, double> EvolutionaryPIDcontroller::next(

return std::make_tuple(timestep_current.isAccepted(), h_new);
}

return {};
}

double EvolutionaryPIDcontroller::limitStepSize(
Expand Down
2 changes: 1 addition & 1 deletion NumLib/TimeStepping/Algorithms/EvolutionaryPIDcontroller.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ class EvolutionaryPIDcontroller final : public TimeStepAlgorithm
double _e_n_minus2; ///< \f$e_{n-2}\f$.

/**
* Forced the computed time step size in the given range
* Force the computed time step size in the given range
* (see the formulas in the documentation of the class)
* or use the half of the previous time step size under some other
* constrains.
Expand Down
14 changes: 14 additions & 0 deletions ProcessLib/Output/Output.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,20 @@ std::vector<std::string> Output::getFileNamesForOutput() const
return output_names;
}

std::vector<double> calculateUniqueFixedTimesForAllOutputs(
std::vector<Output> const& outputs)
{
std::vector<double> fixed_times;
for (auto const& output : outputs)
{
auto const& output_fixed_times = output.getFixedOutputTimes();
fixed_times.insert(fixed_times.end(), output_fixed_times.begin(),
output_fixed_times.end());
}
BaseLib::makeVectorUnique(fixed_times);
return fixed_times;
}

std::ostream& operator<<(std::ostream& os, Output const& output)
{
os << "Output::_output_data_specification:\t"
Expand Down
3 changes: 3 additions & 0 deletions ProcessLib/Output/Output.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,4 +126,7 @@ class Output
_do_not_project_from_bulk_mesh_to_submeshes;
};

std::vector<double> calculateUniqueFixedTimesForAllOutputs(
std::vector<Output> const& outputs);

} // namespace ProcessLib
16 changes: 0 additions & 16 deletions ProcessLib/TimeLoop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -473,22 +473,6 @@ std::pair<double, bool> TimeLoop::computeTimeStepping(
return {dt, last_step_rejected};
}

std::vector<double> calculateUniqueFixedTimesForAllOutputs(
std::vector<Output> const& outputs)
{
std::vector<double> fixed_times;
for (auto const& output : outputs)
{
auto const& output_fixed_times = output.getFixedOutputTimes();
fixed_times.insert(fixed_times.end(), output_fixed_times.begin(),
output_fixed_times.end());
}
std::sort(fixed_times.begin(), fixed_times.end());
auto const it = std::unique(fixed_times.begin(), fixed_times.end());
fixed_times.erase(it, fixed_times.end());
return fixed_times;
}

std::vector<std::function<double(double, double)>>
TimeLoop::generateOutputTimeStepConstraints(
std::vector<double>&& fixed_times) const
Expand Down

0 comments on commit 6b55afa

Please sign in to comment.