Skip to content

Commit 8042987

Browse files
committed
config: Add abs/rel residual tolerances.
Signed-off-by: Matthew Emmett <[email protected]>
1 parent 956c7d8 commit 8042987

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

include/pfasst/config.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,9 @@ namespace pfasst
171171
options::add_option<double>("Duration", "tend", "final time of simulation");
172172
options::add_option<size_t>("Duration", "num_iters", "number of iterations");
173173

174+
options::add_option<double>("Tolerances", "abs_res_tol", "absolute residual tolerance");
175+
options::add_option<double>("Tolerances", "rel_res_tol", "relative residual tolerance");
176+
174177
options::get_instance().init();
175178
}
176179

include/pfasst/encap/encap_sweeper.hpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,13 @@ namespace pfasst
9292
}
9393
//! @}
9494

95+
//! @{
96+
virtual void set_options() override
97+
{
98+
this->abs_residual_tol = time(config::get_value<double>("abs_res_tol", this->abs_residual_tol));
99+
this->rel_residual_tol = time(config::get_value<double>("rel_res_tol", this->rel_residual_tol));
100+
}
101+
95102
virtual void setup(bool coarse) override
96103
{
97104
auto const nodes = this->quadrature->get_nodes();
@@ -113,6 +120,7 @@ namespace pfasst
113120
}
114121
}
115122
}
123+
//! @}
116124

117125
//! @{
118126
virtual void spread() override
@@ -121,7 +129,6 @@ namespace pfasst
121129
this->state[m]->copy(this->state[0]);
122130
}
123131
}
124-
//! @}
125132

126133
/**
127134
* Save current solution states.
@@ -137,6 +144,7 @@ namespace pfasst
137144
}
138145
}
139146
}
147+
//! @}
140148

141149
//! @{
142150
void set_quadrature(shared_ptr<IQuadrature<time>> quadrature)

0 commit comments

Comments
 (0)