Commit dd8873c2 authored by Lukas Riedel's avatar Lukas Riedel

Remove passing of grid functions from transport constructors

* Remove transport model constructor expecting grid functions
* Remove transport local operator constructors expecting grid functions.
  This completely removes any validity checking from the local
  operators!
* Add more verbose error message to TransportSimulation::step() if
  grid functions are not properly set.
parent a97c2b28
......@@ -100,24 +100,15 @@ public:
* @brief Constructor of TransportFVSpatialOperator
*
* @param boundary The boundary terms
* @param[in] gf_water_flux The grid function of water flux
* @param[in] gf_water_content The grid function of water content
* @param[in] diff_coeff The diffusion coefficient
*/
TransportFVSpatialOperator(
std::shared_ptr<Boundary> boundary,
std::shared_ptr<GFWaterFlux> gf_water_flux,
std::shared_ptr<GFWaterContent> gf_water_content,
double diff_coeff
) : _boundary(boundary)
, _gf_water_flux(gf_water_flux)
, _gf_water_content(gf_water_content)
, _time(0.)
, _diff_coeff(diff_coeff)
{
assert(_gf_water_flux);
assert(_gf_water_content);
}
{ }
/*---------------------------------------------------------------------*//**
* @brief Skeleton integral depending on test and ansatz functions.
......@@ -487,11 +478,9 @@ public:
public:
TransportFVTemporalOperator(
std::shared_ptr<GFWaterContent> gf_water_content
) : _gf_water_content(gf_water_content)
, _time(0.)
{}
TransportFVTemporalOperator()
: _time(0.)
{ }
/*---------------------------------------------------------------------*//**
* @brief Volume integral depending on test and ansatz functions
......
......@@ -47,9 +47,11 @@ RichardsTransportCouplingSimulation<Traits>::RichardsTransportCouplingSimulation
igf_water_flux->push(gf_water_flux,time_begin);
// create transport simulations
_transport = std::make_unique<TransportSimulation>(
_inifile_transport,grid_creator,helper,
igf_water_flux,igf_water_content);
_transport = std::make_unique<TransportSimulation>(_inifile_transport,
grid_creator,
helper);
_transport->set_water_flux(igf_water_flux);
_transport->set_water_content(igf_water_content);
this->set_policy(_transport->output_policy());
......@@ -233,4 +235,4 @@ void RichardsTransportCouplingSimulation<Traits>::post_adapt_grid()
}
} // namespace Dorie
} // namespace Dune
\ No newline at end of file
} // namespace Dune
......@@ -103,9 +103,8 @@ void TransportSimulation<Traits>::operator_setup()
// --- Local Operators ---
double diff_coeff = inifile.get<double>("parameters.effHydrDips");
slop = std::make_unique<SLOP>(
sboundary,water_flux_gf,water_content_gf,diff_coeff);
tlop = std::make_unique<TLOP>(water_content_gf);
slop = std::make_unique<SLOP>(sboundary, diff_coeff);
tlop = std::make_unique<TLOP>();
Dune::PDELab::constraints(*this->gfs,*this->cc,false);
......@@ -135,13 +134,17 @@ void TransportSimulation<Traits>::step()
if (this->_log->should_log(spdlog::level::debug)) {
this->_log->info("Time Step {}:",time_steps);
}
if (!water_flux_gf)
if (!water_flux_gf) {
this->_log->error("Water flux grid function required");
DUNE_THROW(Dune::InvalidStateException,
"Pointer to water_flux_gf is invalid!");
}
if (!water_content_gf) {
this->_log->error("Water content grid function required");
DUNE_THROW(Dune::InvalidStateException,
"Pointer to water_flux_gf is invalid!");
if (!water_content_gf)
DUNE_THROW(Dune::InvalidStateException,
"Pointer to water_content_gf is invalid!");
"Pointer to water_content_gf is invalid!");
}
// Suggest times step for explicit methods.
// This assumes that timestep is never increased on failure!
......
......@@ -317,28 +317,6 @@ public:
Dune::MPIHelper& _helper
);
/*-----------------------------------------------------------------------*//**
* @brief Construct simulation.
*
* @param _inifile Dune parameter file parser.
* @param _grid_creator Mapper for grid and volume/boundary data.
* @param _helper Dune MPI instance controller.
* @param[in] _water_flux_gf Grid function for water flux.
* @param[in] _water_content_gf Grid function for water content.
*/
TransportSimulation (
Dune::ParameterTree& _inifile,
const GridCreator& _grid_creator,
Dune::MPIHelper& _helper,
std::shared_ptr<GFWaterFlux> _water_flux_gf,
std::shared_ptr<GFWaterContent> _water_content_gf
) : TransportSimulation(_inifile,_grid_creator,_helper)
{
set_water_flux(_water_flux_gf);
set_water_content(_water_content_gf);
operator_setup();
}
~TransportSimulation() = default;
/*------------------------------------------------------------------------*//**
......
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