Skip to content
Snippets Groups Projects
Commit fc4de95d authored by wenqing's avatar wenqing
Browse files

[Name] Change 'specified times' to 'fixed times'

parent 35829579
No related branches found
No related tags found
No related merge requests found
Showing
with 49 additions and 48 deletions
An option input of fixed times, at which the output of the results must be
conducted.
An option input of specified times, at which the output of the results must be
conducted.
The fixed times that must be reached in the time stepping.
The specified times that must be reached in the time stepping.
......@@ -42,14 +42,14 @@ std::unique_ptr<TimeStepAlgorithm> createEvolutionaryPIDcontroller(
//! \ogs_file_param{prj__time_loop__processes__process__time_stepping__EvolutionaryPIDcontroller__rel_dt_max}
auto const rel_h_max = config.getConfigParameter<double>("rel_dt_max");
auto specified_times =
//! \ogs_file_param{prj__time_loop__processes__process__time_stepping__EvolutionaryPIDcontroller__specified_times}
config.getConfigParameter<std::vector<double>>("specified_times",
auto fixed_output_times =
//! \ogs_file_param{prj__time_loop__processes__process__time_stepping__EvolutionaryPIDcontroller__fixed_output_times}
config.getConfigParameter<std::vector<double>>("fixed_output_times",
std::vector<double>{});
if (!specified_times.empty())
if (!fixed_output_times.empty())
{
// Remove possible duplicated elements and sort in descending order.
BaseLib::makeVectorUnique(specified_times, std::greater<double>());
BaseLib::makeVectorUnique(fixed_output_times, std::greater<double>());
}
//! \ogs_file_param{prj__time_loop__processes__process__time_stepping__EvolutionaryPIDcontroller__tol}
......@@ -57,6 +57,6 @@ std::unique_ptr<TimeStepAlgorithm> createEvolutionaryPIDcontroller(
return std::make_unique<EvolutionaryPIDcontroller>(
t0, t_end, h0, h_min, h_max, rel_h_min, rel_h_max,
std::move(specified_times), tol);
std::move(fixed_output_times), tol);
}
} // end of namespace NumLib
......@@ -143,28 +143,28 @@ double EvolutionaryPIDcontroller::limitStepSize(
double EvolutionaryPIDcontroller::checkSpecificTimeReached(const double h_new)
{
if (_specified_times.empty())
if (_fixed_output_times.empty())
return h_new;
const double specific_time = _specified_times.back();
const double specific_time = _fixed_output_times.back();
if ((specific_time > _ts_current.current()) &&
(_ts_current.current() + h_new - specific_time > 0.0))
{
_specified_times.pop_back();
_fixed_output_times.pop_back();
return specific_time - _ts_current.current();
}
return h_new;
}
void EvolutionaryPIDcontroller::addSpecifiedTimes(
std::vector<double> const& extra_specified_times)
void EvolutionaryPIDcontroller::addFixedOutputTimes(
std::vector<double> const& extra_fixed_output_times)
{
_specified_times.insert(_specified_times.end(), extra_specified_times.begin(),
extra_specified_times.end());
_fixed_output_times.insert(_fixed_output_times.end(),
extra_fixed_output_times.begin(),
extra_fixed_output_times.end());
// Remove possible duplicated elements and sort in descending order.
BaseLib::makeVectorUnique(_specified_times, std::greater<double>());
BaseLib::makeVectorUnique(_fixed_output_times, std::greater<double>());
}
} // end of namespace NumLib
......@@ -55,7 +55,7 @@ public:
const double h0, const double h_min,
const double h_max, const double rel_h_min,
const double rel_h_max,
const std::vector<double>&& specified_times,
const std::vector<double>&& fixed_output_times,
const double tol)
: TimeStepAlgorithm(t0, t_end),
_h0(h0),
......@@ -63,7 +63,7 @@ public:
_h_max(h_max),
_rel_h_min(rel_h_min),
_rel_h_max(rel_h_max),
_specified_times(std::move(specified_times)),
_fixed_output_times(std::move(fixed_output_times)),
_tol(tol),
_e_n_minus1(0.),
_e_n_minus2(0.),
......@@ -92,9 +92,9 @@ public:
/// solution error.
bool isSolutionErrorComputationNeeded() override { return true; }
/// \copydoc NumLib::TimeStepAlgorithm::addSpecifiedTimes
void addSpecifiedTimes(
std::vector<double> const& extra_specified_times) override;
/// \copydoc NumLib::TimeStepAlgorithm::addFixedOutputTimes
void addFixedOutputTimes(
std::vector<double> const& extra_fixed_output_times) override;
private:
const double _kP = 0.075; ///< Parameter. \see EvolutionaryPIDcontroller
......@@ -111,7 +111,7 @@ private:
const double _rel_h_max;
// Given times that steps have to reach.
std::vector<double> _specified_times;
std::vector<double> _fixed_output_times;
const double _tol;
......
......@@ -93,7 +93,8 @@ public:
* the specified times. The function is mainly used to accept the specified
* times from the configuration of output.
*/
virtual void addSpecifiedTimes(std::vector<double> const& /*specified_times*/)
virtual void addFixedOutputTimes(
std::vector<double> const& /*fixed_output_times*/)
{
}
......
......@@ -44,7 +44,7 @@ std::unique_ptr<Output> createOutput(const BaseLib::ConfigTree& config,
// Construction of output times
std::vector<Output::PairRepeatEachSteps> repeats_each_steps;
std::vector<double> specified_times;
std::vector<double> fixed_output_times;
//! \ogs_file_param{prj__time_loop__output__timesteps}
if (auto const timesteps = config.getConfigSubtreeOptional("timesteps"))
......@@ -74,15 +74,15 @@ std::unique_ptr<Output> createOutput(const BaseLib::ConfigTree& config,
repeats_each_steps.emplace_back(1, 1);
}
auto specified_times_ptr =
//! \ogs_file_param{prj__time_loop__output__specified_times}
auto fixed_output_times_ptr =
//! \ogs_file_param{prj__time_loop__output__fixed_output_times}
config.getConfigParameterOptional<std::vector<double>>(
"specified_times");
if (specified_times_ptr)
"fixed_output_times");
if (fixed_output_times_ptr)
{
specified_times = std::move(*specified_times_ptr);
fixed_output_times = std::move(*fixed_output_times_ptr);
// Remove possible duplicated elements and sort in descending order.
BaseLib::makeVectorUnique(specified_times, std::greater<double>());
BaseLib::makeVectorUnique(fixed_output_times, std::greater<double>());
}
bool const output_iteration_results =
......@@ -92,7 +92,7 @@ std::unique_ptr<Output> createOutput(const BaseLib::ConfigTree& config,
return std::make_unique<Output>(output_directory, prefix, compress_output,
data_mode, output_iteration_results,
std::move(repeats_each_steps),
std::move(specified_times));
std::move(fixed_output_times));
}
} // namespace ProcessLib
......@@ -67,14 +67,14 @@ bool Output::shallDoOutput(unsigned timestep, double const t)
bool make_output = timestep % each_steps == 0;
if (_specified_times.empty())
if (_fixed_output_times.empty())
return make_output;
const double specific_time = _specified_times.back();
const double specific_time = _fixed_output_times.back();
const double zero_threshold = std::numeric_limits<double>::min();
if (std::fabs(specific_time - t) < zero_threshold)
{
_specified_times.pop_back();
_fixed_output_times.pop_back();
make_output = true;
}
......@@ -85,14 +85,14 @@ Output::Output(std::string output_directory, std::string prefix,
bool const compress_output, std::string const& data_mode,
bool const output_nonlinear_iteration_results,
std::vector<PairRepeatEachSteps> repeats_each_steps,
std::vector<double>&& specified_times)
std::vector<double>&& fixed_output_times)
: _output_directory(std::move(output_directory)),
_output_file_prefix(std::move(prefix)),
_output_file_compression(compress_output),
_output_file_data_mode(convertVtkDataMode(data_mode)),
_output_nonlinear_iteration_results(output_nonlinear_iteration_results),
_repeats_each_steps(std::move(repeats_each_steps)),
_specified_times(std::move(specified_times))
_fixed_output_times(std::move(fixed_output_times))
{
}
......
......@@ -43,7 +43,7 @@ public:
bool const compress_output, std::string const& data_mode,
bool const output_nonlinear_iteration_results,
std::vector<PairRepeatEachSteps> repeats_each_steps,
std::vector<double>&& specified_times);
std::vector<double>&& fixed_output_times);
//! TODO doc. Opens a PVD file for each process.
void addProcess(ProcessLib::Process const& process, const int process_id);
......@@ -78,7 +78,7 @@ public:
GlobalVector const& x,
const unsigned iteration);
std::vector<double> getSpecifiedTimes() {return _specified_times;}
std::vector<double> getFixedOutputTimes() {return _fixed_output_times;}
private:
struct ProcessData
......@@ -104,7 +104,7 @@ private:
std::vector<PairRepeatEachSteps> _repeats_each_steps;
//! Given times that steps have to reach.
std::vector<double> _specified_times;
std::vector<double> _fixed_output_times;
std::multimap<Process const*, ProcessData> _process_to_process_data;
......
......@@ -38,7 +38,7 @@ AddTest(
DIFF_DATA
ref_t_1600.000000.vtu richards_pcs_0_ts_803_t_1600.000000.vtu pressure pressure 1e-8 1e-3
# The following three comparisons are used just to check whether the output is
# made at the specific times of 50, 100 and 500, which are given in the project
# made at the fixed times of 50, 100 and 500, which are given in the project
# file of RichardsFlow_2d_small_adaptive_dt.prj
richards_pcs_0_ts_28_spec_t_50.000000.vtu richards_pcs_0_ts_28_t_50.000000.vtu pressure pressure 1e-10 1e-10
richards_pcs_0_ts_53_spec_t_100.000000.vtu richards_pcs_0_ts_53_t_100.000000.vtu pressure pressure 1e-10 1e-10
......
......@@ -532,12 +532,12 @@ bool UncoupledProcessesTimeLoop::loop()
pcs.getMesh());
}
// Add the specific times of output to time stepper in order that
// Add the fixed times of output to time stepper in order that
// the time stepping is performed and the results are output at
// these times. Note: only the adaptive time steppers can have the
// the specific times.
// the fixed times.
auto& timestepper = process_data->timestepper;
timestepper->addSpecifiedTimes(_output->getSpecifiedTimes());
timestepper->addFixedOutputTimes(_output->getFixedOutputTimes());
++process_id;
}
......
......@@ -100,7 +100,7 @@
<rel_dt_min> 0.1 </rel_dt_min>
<rel_dt_max> 10 </rel_dt_max>
<tol> 10.0 </tol>
<specified_times>5.0e9 2.e10</specified_times>
<fixed_output_times>5.0e9 2.e10</fixed_output_times>
</time_stepping>
</process>
<process ref="ConstViscosityThermalConvection">
......@@ -128,7 +128,7 @@
<rel_dt_min> 0.1 </rel_dt_min>
<rel_dt_max> 10 </rel_dt_max>
<tol> 10.0 </tol>
<specified_times>5.0e9 2.e10</specified_times>
<fixed_output_times>5.0e9 2.e10</fixed_output_times>
</time_stepping>
</process>
</processes>
......
......@@ -109,7 +109,7 @@
<each_steps>100000000</each_steps>
</pair>
</timesteps>
<specified_times> 50.0 100.0 500.</specified_times>
<fixed_output_times> 50.0 100.0 500.</fixed_output_times>
<output_iteration_results>false</output_iteration_results>
</output>
</time_loop>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment