Commit c01c5ee6 authored by Lukas Riedel's avatar Lukas Riedel

Base parameterization test completely on Simulation routine.

The old parameterization structures are cleared once `Simulation::run`
is called.
parent 775c1d73
......@@ -28,7 +28,6 @@ Simulation<Traits>::Simulation (Dune::MPIHelper& _helper, std::shared_ptr<Grid>
// --- Create the new parameter class
fparam = std::make_shared<FlowParameters>(inifile, grid);
fparam->copy_from_old_parameters(*param);
// param.reset(); // NOTE: NEEDS TO BE COMMENTED FOR TESTING
// --- Operator Helper Classes ---
fboundary = std::make_unique<FlowBoundary>(inifile);
......@@ -184,6 +183,7 @@ bool Simulation<Traits>::compute_time_step ()
template<typename Traits>
void Simulation<Traits>::run ()
{
param.clear();
const auto t_start = controller->getTime();
output->write_vtk_output(t_start);
while(controller->doStep()) {
......
......@@ -13,6 +13,12 @@
namespace Dune {
namespace Dorie {
/// A test for comparing the new paramter data structure with the old one.
/** The test relies on the data being read in by the old parameterization
* structures, and transferred to the new ones. This currently happens in the
* Simulation. The test compares queries the paramterization at random points
* on the grid and compares the result.
*/
template <typename Traits>
class ParameterizationTest :
public Simulation<Traits>
......@@ -24,8 +30,6 @@ private:
using FlowParameters = Dune::Dorie::FlowParameters<Traits>;
FlowParameters _param_new;
public:
/// Construct this simulation instance.
/** \todo Give error limits here
......@@ -35,15 +39,9 @@ public:
std::shared_ptr<Grid> _grid,
Dune::ParameterTree &_inifile
):
Simulation<Traits>(_helper, _grid, _inifile),
_param_new(_inifile, _grid)
Simulation<Traits>(_helper, _grid, _inifile)
{ }
void build_new_parameters ()
{
_param_new.copy_from_old_parameters(*this->param);
}
void test_new_parameters ()
{
// error tolerance
......@@ -68,10 +66,10 @@ public:
// bind parameters
t_bind.start();
_param_new.bind(element);
auto sat_f = _param_new.saturation_f();
auto cond_f = _param_new.conductivity_f();
auto wc_f = _param_new.water_content_f();
this->fparam->bind(element);
auto sat_f = this->fparam->saturation_f();
auto cond_f = this->fparam->conductivity_f();
auto wc_f = this->fparam->water_content_f();
t_bind.stop();
for (int i = 0; i < repeats; ++i) {
......@@ -140,7 +138,7 @@ public:
void test_parameter_manipulation ()
{
using RP = Dorie::RichardsParameterization<Traits>;
auto par = std::get<std::shared_ptr<RP>>(_param_new.cache().second);
auto par = std::get<std::shared_ptr<RP>>(this->fparam->cache().second);
auto parameters = par->parameters();
parameters.at("theta_r") = 0.0;
assert(par->_theta_r.value == 0.0);
......
......@@ -56,7 +56,6 @@ int main (int argc, char** argv)
using TestSim = Dune::Dorie::ParameterizationTest<CubeAdaptive<2, 1>>;
auto grid = Dune::Dorie::build_grid_cube<Dune::UGGrid<2>>(inifile, helper);
TestSim sim(helper, grid, inifile);
sim.build_new_parameters();
sim.test_new_parameters();
sim.test_parameter_manipulation();
}
......@@ -64,7 +63,6 @@ int main (int argc, char** argv)
using TestSim = Dune::Dorie::ParameterizationTest<Cube<2, 1>>;
auto grid = Dune::Dorie::build_grid_cube<Dune::YaspGrid<2>>(inifile, helper);
TestSim sim(helper, grid, inifile);
sim.build_new_parameters();
sim.test_new_parameters();
sim.test_parameter_manipulation();
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment