[Coupling] Add log output

parent 81bc2ae9
......@@ -18,11 +18,13 @@ RichardsTransportCouplingSimulation<Traits>::RichardsTransportCouplingSimulation
, _inifile_richards(inifile_richards)
, _inifile_transport(inifile_transport)
{
this->_log->trace("Setting up Richards model");
// create richards simulations
_richards = std::make_unique<RichardsSimulation>(_inifile_richards,grid_creator,helper);
auto time_begin = _richards->begin_time();
this->_log->trace("Setting up Transport model");
// set initial water state into the transport simulation
auto igf_water_content = std::make_shared<GFWaterContentContainer>();
auto igf_water_flux = std::make_shared<GFWaterFluxContainer>();
......@@ -37,6 +39,8 @@ RichardsTransportCouplingSimulation<Traits>::RichardsTransportCouplingSimulation
_transport = std::make_unique<TransportSimulation>(
_inifile_transport,grid_creator,helper,
igf_water_flux,igf_water_content);
this->_log->info("Setup complete");
}
template<typename Traits>
......@@ -61,7 +65,9 @@ void RichardsTransportCouplingSimulation<Traits>::step()
igf_water_flux->push(gf_water_flux_begin,time_begin);
// always do an step of richards
this->_log->trace(" Start Richards step");
_richards->step();
this->_log->trace(" End Richards step");
TimeField time_end = _richards->current_time();
......@@ -83,6 +89,7 @@ void RichardsTransportCouplingSimulation<Traits>::step()
}
// set instatonary grid functions to the transport solver
this->_log->trace(" Transfer data from Richards to Transport");
_transport->set_water_flux(igf_water_flux);
_transport->set_water_content(igf_water_content);
......@@ -91,7 +98,9 @@ void RichardsTransportCouplingSimulation<Traits>::step()
{
_time_transport = _transport->current_time();
_transport->suggest_timestep(_time_richards - _time_transport);
this->_log->trace(" Start Transport step");
_transport->step();
this->_log->trace(" End Transport step");
// intermediate adapt if policy targets solute
if (adaptivity_policy() == AdaptivityPolicy::SoluteFlux and
Dune::FloatCmp::lt(_transport->current_time(),_transport->end_time()))
......@@ -115,6 +124,10 @@ void RichardsTransportCouplingSimulation<Traits>::step()
template<typename Traits>
void RichardsTransportCouplingSimulation<Traits>::adapt_grid()
{
this->_log->debug("Adapting grid");
Dune::Timer timer;
if (!_grid)
DUNE_THROW(Dune::InvalidStateException,"Dune grid is in invalid state!");
......@@ -125,19 +138,22 @@ void RichardsTransportCouplingSimulation<Traits>::adapt_grid()
<< "flux reconstruction!");
}
int add_int_order = 2;
const int add_int_order = 2;
const int quadrature_factor = 2;
const int richards_order = RichardsSimulationTraits::order;
const int transport_order = TransportSimulationTraits::order;
auto richards_int_order = quadrature_factor*richards_order + add_int_order;
auto transport_int_order = quadrature_factor*transport_order + add_int_order;
// get current state of both models
auto richards_state = _richards->current_state();
auto transport_state = _transport->current_state();
// get gfs and DOF vector of richards
auto richards_int_order = RichardsSimulationTraits::order + add_int_order;
auto& richards_gfs = *(richards_state.grid_function_space);
auto& richards_coeff = *(richards_state.coefficients);
// get gfs and DOF vector of transport
auto transport_int_order = TransportSimulationTraits::order + add_int_order;
auto& transport_gfs = *(transport_state.grid_function_space);
auto& transport_coeff = *(transport_state.coefficients);
......@@ -160,11 +176,15 @@ void RichardsTransportCouplingSimulation<Traits>::adapt_grid()
// adapt grid and packs
Dune::PDELab::adaptGrid(*_grid,richards_pack,transport_pack);
}
const auto t_adapt = timer.elapsed();
this->_log->trace(" Grid adaptation: {:.2e}s", t_adapt);
}
template<typename Traits>
void RichardsTransportCouplingSimulation<Traits>::post_adapt_grid()
{
this->_log->debug("Post-adapt grid");
// if water state was adapted, containers have to be reset
if (adaptivity_policy() == AdaptivityPolicy::SoluteFlux)
{
......
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