Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F82451148
runner.hpp
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Wed, Sep 11, 12:10
Size
2 KB
Mime Type
text/x-c++
Expires
Fri, Sep 13, 12:10 (2 d)
Engine
blob
Format
Raw Data
Handle
20700685
Attached To
rSPECMICP SpecMiCP / ReactMiCP
runner.hpp
View Options
#ifndef SPECMICP_REACTMICP_SOLVER_RUNNER_HPP
#define SPECMICP_REACTMICP_SOLVER_RUNNER_HPP
#include "reactive_transport_solver.hpp"
#include "timestepper.hpp"
#include <string>
#include <functional>
namespace specmicp {
namespace reactmicp {
namespace solver {
//! \struct SimulationInformation
//! \brief Information about the simulation
struct SimulationInformation
{
std::string name; //!< Name of the simulation
std::string output_prefix; //!< prefix for the output files
bool print_iter_info{true}; //!< If true, print the iteration informations
scalar_t output_step; //!< output step
SimulationInformation(std::string name_simul, scalar_t outputstep):
name(name_simul),
output_prefix(name_simul+"_"),
output_step(output_step)
{}
std::string complete_filepath(std::string name, std::string suffix) const {
return output_prefix+name+"."+suffix;
}
};
using output_f = std::function<void (scalar_t time, VariablesBasePtr variables)>;
inline void dummy_output(scalar_t _, VariablesBasePtr __) {}
class ReactiveTransportRunner
{
public:
ReactiveTransportRunner(ReactiveTransportSolver& solver,
scalar_t lower_dt_bound,
scalar_t upper_dt_bound,
const SimulationInformation info):
m_solver(solver),
m_timestepper(lower_dt_bound, upper_dt_bound, 0, 2.0),
m_simulinfo(info)
{
}
void run_until(scalar_t target, VariablesBasePtr variables);
void set_output_policy(output_f output_policy) {
m_output_function = output_policy;
}
ReactiveTransportOptions& get_options() {
return m_solver.get_options();
}
TimestepperOptions& get_timestepper_options() {
return m_timestepper.get_options();
}
ReactiveTransportPerformance& get_perfs() {
return m_solver.get_perfs();
}
ReactiveTransportTimer& get_timer() {
return m_solver.get_timer();
}
private:
index_t m_cnt{0};
ReactiveTransportSolver& m_solver;
Timestepper m_timestepper;
const SimulationInformation& m_simulinfo;
output_f m_output_function{dummy_output};
scalar_t m_output_target;
};
} // end namespace solver
} // end namespace reactmicp
} // end namespace specmicp
#endif // SPECMICP_REACTMICP_SOLVER_RUNNER_HPP
Event Timeline
Log In to Comment