#include <boris_sweeper.hpp>
Public Types | |
typedef ParticleCloud< scalar > | encap_type |
typedef ParticleCloudComponent< scalar > | position_type |
typedef ParticleCloudComponent< scalar > | velocity_type |
typedef ParticleCloudComponent< scalar > | acceleration_type |
Public Member Functions | |
BorisSweeper (shared_ptr< bindings::WrapperInterface< scalar, time >> &impl_solver, const string &data_file) | |
BorisSweeper (const BorisSweeper< scalar, time > &other)=delete | |
BorisSweeper (BorisSweeper< scalar, time > &&other)=delete | |
virtual | ~BorisSweeper () |
virtual void | set_state (shared_ptr< const encap_type > u0, size_t m) |
virtual void | set_start_state (shared_ptr< const encap_type > u0) |
virtual shared_ptr< Encapsulation< time > > | get_state (size_t m) const override |
Retrieve solution values of current iteration at time node index m . More... | |
virtual shared_ptr< Encapsulation< time > > | get_start_state () const |
virtual shared_ptr< acceleration_type > | get_tau_q_as_force (size_t m) const |
virtual shared_ptr< acceleration_type > | get_tau_qq_as_force (size_t m) const |
virtual shared_ptr< Encapsulation< time > > | get_saved_state (size_t m) const override |
Retrieve solution values of previous iteration at time node index m . More... | |
virtual void | set_initial_energy () |
virtual void | exact (shared_ptr< Encapsulation< time >> q, time t) |
virtual void | exact (shared_ptr< encap_type > q, const time t) |
virtual void | exact (encap_type &q, const time t) |
virtual void | echo_error (const time t, bool predict=false) |
virtual error_map< scalar > | get_errors () const |
virtual void | setup (bool coarse=false) override |
Setup (allocate etc) the sweeper. More... | |
virtual void | integrate (time dt, vector< shared_ptr< Encapsulation< time >>> dst) const override |
Integrates values of right hand side at all time nodes \( t \in [0,M-1] \) simultaneously. More... | |
virtual void | integrate (time dt, vector< shared_ptr< acceleration_type >> dst_q, vector< shared_ptr< acceleration_type >> dst_qq) const |
virtual void | residual (time dt, vector< shared_ptr< Encapsulation< time >>> dst) const override |
Compute residual at each SDC node (including FAS corrections). More... | |
virtual void | advance () override |
Advance from one time step to the next. More... | |
virtual void | evaluate (size_t m) |
virtual void | predict (bool initial) override |
Perform a predictor sweep. More... | |
virtual void | sweep () override |
Perform one SDC sweep/iteration. More... | |
virtual void | save (bool initial_only=false) override |
Save states (and/or function values) at all nodes. More... | |
virtual void | spread () override |
Initialize solution values at all time nodes with meaningful values. More... | |
virtual void | post_sweep () override |
Hook automatically run after each completed sweep. More... | |
virtual void | post_predict () override |
Hook automatically run after each completed predict. More... | |
virtual void | post_step () override |
Hook automatically run after each completed time step. More... | |
virtual void | post (ICommunicator *comm, int tag) override |
virtual void | send (ICommunicator *comm, int tag, bool blocking) override |
virtual void | recv (ICommunicator *comm, int tag, bool blocking) override |
virtual void | broadcast (ICommunicator *comm) override |
virtual void | boris_solve (const time tm, const time t_next, const time ds, const size_t m, const velocity_type &c_k_term) |
![]() | |
EncapSweeper () | |
virtual shared_ptr< Encapsulation< time > > | get_tau (size_t m) const |
Retrieve FAS correction of current iteration at time node index m . More... | |
virtual void | set_options () override |
Set options from command line etc. More... | |
virtual void | set_quadrature (shared_ptr< IQuadrature< time >> quadrature) |
virtual shared_ptr< const IQuadrature< time > > | get_quadrature () const |
virtual const vector< time > | get_nodes () const |
virtual void | set_factory (shared_ptr< EncapFactory< time >> factory) |
virtual shared_ptr< EncapFactory< time > > | get_factory () const |
virtual shared_ptr< Encapsulation< time > > | get_end_state () |
virtual void | reevaluate (bool initial_only=false) |
Re-evaluate function values. More... | |
void | set_residual_tolerances (time abs_residual_tol, time rel_residual_tol, int order=0) |
Set residual tolerances for convergence checking. More... | |
virtual bool | converged () override |
Return convergence status. More... | |
![]() | |
ISweeper () | |
virtual | ~ISweeper () |
virtual void | set_controller (Controller< time > *ctrl) |
Set the sweepers controller. More... | |
virtual Controller< time > * | get_controller () |
Accessor to the controller managing this sweeper. More... | |
Protected Member Functions | |
acceleration_type | build_rhs (const size_t m, const bool previous=false) const |
scalar | compute_residual_max () |
void | write_center_to_file (const size_t iter, const size_t sweep, const ParticleComponent< scalar > ¢er, const scalar energy, const scalar drift, const scalar residual) |
void | write_particle_cloud_to_file (const size_t iter, const size_t sweep, const shared_ptr< encap_type > &cloud, const scalar energy, const scalar drift, const scalar residual, const bool with_center=true) |
void | update_position (const size_t m, const time dt, const time ds) |
void | update_velocity (const size_t m, const time ds, const vector< time > &nodes) |
Protected Attributes | |
vector< shared_ptr< encap_type > > | particles |
vector< shared_ptr< encap_type > > | saved_particles |
shared_ptr< encap_type > | start_particles |
shared_ptr< encap_type > | end_particles |
vector< shared_ptr< acceleration_type > > | tau_q_corrections |
vector< shared_ptr< acceleration_type > > | tau_qq_corrections |
vector< acceleration_type > | forces |
vector< acceleration_type > | saved_forces |
vector< acceleration_type > | b_vecs |
vector< acceleration_type > | saved_b_vecs |
scalar | initial_energy |
vector< scalar > | energy_evals |
size_t | f_evals |
bool | coarse |
vector< velocity_type > | s_integrals |
vector< position_type > | ss_integrals |
vector< time > | delta_nodes |
delta_nodes[m] = nodes[m] - nodes[m-1] More... | |
Matrix< time > | s_mat |
Matrix< time > | ss_mat |
Matrix< time > | sx_mat |
Matrix< time > | st_mat |
Matrix< time > | q_mat |
Matrix< time > | qq_mat |
Matrix< time > | qx_mat |
Matrix< time > | qt_mat |
ofstream | data_stream |
boost::format | log_fmt |
string | DATA_STREAM_FORMAT_STR |
boost::format | data_stream_fmt |
![]() | |
string | FORMAT_STR |
shared_ptr< IQuadrature< time > > | quadrature |
shared_ptr< EncapFactory< time > > | factory |
Encapsulation data structure factory. More... | |
shared_ptr< Encapsulation< time > > | start_state |
Separate start state, i.e. initial condition for the sweeper's current time step. More... | |
shared_ptr< Encapsulation< time > > | end_state |
Current solution at \( T_{end} \). More... | |
vector< shared_ptr< Encapsulation< time > > > | residuals |
Place for the residuals at the different time nodes. More... | |
vector< shared_ptr< Encapsulation< time > > > | state |
Solution values \( U \) at all time nodes of the current iteration. More... | |
vector< shared_ptr< Encapsulation< time > > > | saved_state |
Solution values \( U \) at all time nodes of the previous iteration. More... | |
vector< shared_ptr< Encapsulation< time > > > | fas_corrections |
FAS corrections \( \tau \) at all time nodes of the current iteration. More... | |
int | residual_norm_order |
time | abs_residual_tol |
Tolerance for absolute residual. More... | |
time | rel_residual_tol |
Tolerance for relative residual. More... | |
![]() | |
Controller< time > * | controller |
Backreference to the controller managing the sweeper instance. More... | |
Private Attributes | |
shared_ptr< bindings::WrapperInterface< scalar, time > > | impl_solver |
error_map< scalar > | errors |
bool | exact_updated |
shared_ptr< encap_type > | exact_cache |
shared_ptr< LogIndent > | log_indent |
Definition at line 123 of file boris_sweeper.hpp.
typedef ParticleCloudComponent<scalar> pfasst::examples::boris::BorisSweeper< scalar, time >::acceleration_type |
Definition at line 130 of file boris_sweeper.hpp.
typedef ParticleCloud<scalar> pfasst::examples::boris::BorisSweeper< scalar, time >::encap_type |
Definition at line 127 of file boris_sweeper.hpp.
typedef ParticleCloudComponent<scalar> pfasst::examples::boris::BorisSweeper< scalar, time >::position_type |
Definition at line 128 of file boris_sweeper.hpp.
typedef ParticleCloudComponent<scalar> pfasst::examples::boris::BorisSweeper< scalar, time >::velocity_type |
Definition at line 129 of file boris_sweeper.hpp.
pfasst::examples::boris::BorisSweeper< scalar, time >::BorisSweeper | ( | shared_ptr< bindings::WrapperInterface< scalar, time >> & | impl_solver, |
const string & | data_file | ||
) |
|
delete |
|
delete |
|
virtual |
Definition at line 257 of file boris_sweeper_impl.hpp.
|
overridevirtual |
Advance from one time step to the next.
NotImplementedYet | This function is required by EncapSweeper |
Reimplemented from pfasst::encap::EncapSweeper< time >.
Definition at line 615 of file boris_sweeper_impl.hpp.
References BCVLOG.
|
virtual |
Definition at line 871 of file boris_sweeper_impl.hpp.
References BCVLOG, pfasst::examples::boris::cmp_wise_div(), pfasst::examples::boris::cross_prod(), pfasst::examples::boris::kronecker(), pfasst::examples::boris::norm_sq_npart(), and UNUSED.
|
overridevirtual |
Reimplemented from pfasst::encap::EncapSweeper< time >.
Definition at line 862 of file boris_sweeper_impl.hpp.
References pfasst::ICommunicator::rank(), and pfasst::ICommunicator::size().
|
protected |
Definition at line 103 of file boris_sweeper_impl.hpp.
References BCVLOG, and simple_physics_solver::internal::cross_prod().
|
protected |
Definition at line 123 of file boris_sweeper_impl.hpp.
References BCVLOG, and pfasst::examples::boris::max().
|
virtual |
Definition at line 393 of file boris_sweeper_impl.hpp.
References BCVLOG, pfasst::examples::boris::ErrorTuple< scalar >::e_drift, pfasst::examples::boris::ErrorTuple< scalar >::p_err, pfasst::examples::boris::ErrorTuple< scalar >::res, and pfasst::encap::solution.
|
virtual |
Definition at line 633 of file boris_sweeper_impl.hpp.
|
virtual |
Definition at line 323 of file boris_sweeper_impl.hpp.
|
virtual |
Definition at line 331 of file boris_sweeper_impl.hpp.
|
virtual |
Definition at line 337 of file boris_sweeper_impl.hpp.
References BCVLOG, plot::dt, pfasst::examples::boris::ParticleCloud< precision >::positions(), plot::t, UNUSED, and pfasst::examples::boris::ParticleCloud< precision >::velocities().
|
virtual |
Definition at line 428 of file boris_sweeper_impl.hpp.
|
overridevirtual |
Retrieve solution values of previous iteration at time node index m
.
[in] | m | 0-based index of time node |
Reimplemented from pfasst::encap::EncapSweeper< time >.
Definition at line 302 of file boris_sweeper_impl.hpp.
|
virtual |
Reimplemented from pfasst::encap::EncapSweeper< time >.
Definition at line 282 of file boris_sweeper_impl.hpp.
|
overridevirtual |
Retrieve solution values of current iteration at time node index m
.
[in] | m | 0-based index of time node |
Reimplemented from pfasst::encap::EncapSweeper< time >.
Definition at line 276 of file boris_sweeper_impl.hpp.
|
virtual |
Definition at line 289 of file boris_sweeper_impl.hpp.
|
virtual |
Definition at line 296 of file boris_sweeper_impl.hpp.
|
overridevirtual |
Integrates values of right hand side at all time nodes \( t \in [0,M-1] \) simultaneously.
[in] | dt | width of the time interval to integrate |
[in,out] | dst | integrated values |
NotImplementedYet | This function is required by EncapSweeper |
Reimplemented from pfasst::encap::EncapSweeper< time >.
Definition at line 537 of file boris_sweeper_impl.hpp.
|
virtual |
Definition at line 543 of file boris_sweeper_impl.hpp.
References BCVLOG, plot::dt, and pfasst::examples::boris::zero().
|
overridevirtual |
Reimplemented from pfasst::encap::EncapSweeper< time >.
Definition at line 841 of file boris_sweeper_impl.hpp.
|
overridevirtual |
Hook automatically run after each completed predict.
Reimplemented from pfasst::ISweeper< time >.
Definition at line 829 of file boris_sweeper_impl.hpp.
|
overridevirtual |
Hook automatically run after each completed time step.
Reimplemented from pfasst::ISweeper< time >.
Definition at line 837 of file boris_sweeper_impl.hpp.
|
overridevirtual |
Hook automatically run after each completed sweep.
Reimplemented from pfasst::ISweeper< time >.
Definition at line 821 of file boris_sweeper_impl.hpp.
|
overridevirtual |
Perform a predictor sweep.
Compute a provisional solution from the initial condition. This is typically very similar to a regular SDC sweep, except that integral terms based on previous iterations don't exist yet.
[in] | initial | true if function values at the first node need to be computed. false if functions values at the first node already exist (usually this is the case when advancing from one time step to the next). |
Implements pfasst::ISweeper< time >.
Definition at line 662 of file boris_sweeper_impl.hpp.
References BCVLOG.
|
overridevirtual |
Reimplemented from pfasst::encap::EncapSweeper< time >.
Definition at line 853 of file boris_sweeper_impl.hpp.
|
overridevirtual |
Compute residual at each SDC node (including FAS corrections).
[in] | dt | width of the time interval to compute the residual for |
[in,out] | dst | place to store the residuals at time nodes |
NotImplementedYet | This function is required by EncapSweeper for residual computation |
Reimplemented from pfasst::encap::EncapSweeper< time >.
Definition at line 572 of file boris_sweeper_impl.hpp.
References BCVLOG, and pfasst::examples::boris::zero().
|
overridevirtual |
Save states (and/or function values) at all nodes.
Reimplemented from pfasst::encap::EncapSweeper< time >.
Definition at line 787 of file boris_sweeper_impl.hpp.
References BCVLOG.
|
overridevirtual |
Reimplemented from pfasst::encap::EncapSweeper< time >.
Definition at line 847 of file boris_sweeper_impl.hpp.
|
virtual |
Definition at line 308 of file boris_sweeper_impl.hpp.
References BCVLOG.
|
virtual |
Definition at line 270 of file boris_sweeper_impl.hpp.
|
virtual |
Definition at line 264 of file boris_sweeper_impl.hpp.
|
overridevirtual |
Setup (allocate etc) the sweeper.
Reimplemented from pfasst::encap::EncapSweeper< time >.
Definition at line 434 of file boris_sweeper_impl.hpp.
References BCVLOG, pfasst::encap::EncapSweeper< time >::setup(), pfasst::encap::solution, and UNUSED.
|
overridevirtual |
Initialize solution values at all time nodes with meaningful values.
This implementation simply copies the initial value (see EncapSweeper::get_start_state()) to all time nodes.
Reimplemented from pfasst::encap::EncapSweeper< time >.
Definition at line 813 of file boris_sweeper_impl.hpp.
|
overridevirtual |
Perform one SDC sweep/iteration.
Compute a correction and update solution values. Note that this function can assume that valid function values exist from a previous pfasst::ISweeper::sweep() or pfasst::ISweeper::predict().
Implements pfasst::ISweeper< time >.
Definition at line 682 of file boris_sweeper_impl.hpp.
References BCVLOG, plot::dt, plot::t, and pfasst::examples::boris::zero().
|
protected |
Definition at line 180 of file boris_sweeper_impl.hpp.
References BCVLOG.
|
protected |
Definition at line 207 of file boris_sweeper_impl.hpp.
References BCVLOG, and pfasst::examples::boris::zero().
|
protected |
Definition at line 143 of file boris_sweeper_impl.hpp.
References BCVLOG.
|
protected |
Definition at line 157 of file boris_sweeper_impl.hpp.
References BCVLOG.
|
protected |
Definition at line 149 of file boris_sweeper.hpp.
|
protected |
Definition at line 156 of file boris_sweeper.hpp.
|
protected |
Definition at line 173 of file boris_sweeper.hpp.
Referenced by pfasst::examples::boris::BorisSweeper< scalar, time >::BorisSweeper().
|
protected |
Definition at line 177 of file boris_sweeper.hpp.
Referenced by pfasst::examples::boris::BorisSweeper< scalar, time >::BorisSweeper().
|
protected |
Definition at line 176 of file boris_sweeper.hpp.
Referenced by pfasst::examples::boris::BorisSweeper< scalar, time >::BorisSweeper().
|
protected |
delta_nodes[m] = nodes[m] - nodes[m-1]
Definition at line 162 of file boris_sweeper.hpp.
|
protected |
Definition at line 143 of file boris_sweeper.hpp.
|
protected |
Definition at line 153 of file boris_sweeper.hpp.
|
private |
Definition at line 134 of file boris_sweeper.hpp.
|
private |
Definition at line 136 of file boris_sweeper.hpp.
|
private |
Definition at line 135 of file boris_sweeper.hpp.
|
protected |
Definition at line 154 of file boris_sweeper.hpp.
|
protected |
Definition at line 147 of file boris_sweeper.hpp.
|
private |
Definition at line 133 of file boris_sweeper.hpp.
|
protected |
Definition at line 152 of file boris_sweeper.hpp.
|
protected |
Definition at line 175 of file boris_sweeper.hpp.
|
private |
Definition at line 137 of file boris_sweeper.hpp.
|
protected |
Definition at line 140 of file boris_sweeper.hpp.
|
protected |
Definition at line 168 of file boris_sweeper.hpp.
|
protected |
Definition at line 169 of file boris_sweeper.hpp.
|
protected |
Definition at line 171 of file boris_sweeper.hpp.
|
protected |
Definition at line 170 of file boris_sweeper.hpp.
|
protected |
Definition at line 158 of file boris_sweeper.hpp.
|
protected |
Definition at line 164 of file boris_sweeper.hpp.
|
protected |
Definition at line 150 of file boris_sweeper.hpp.
|
protected |
Definition at line 148 of file boris_sweeper.hpp.
|
protected |
Definition at line 141 of file boris_sweeper.hpp.
|
protected |
Definition at line 159 of file boris_sweeper.hpp.
|
protected |
Definition at line 165 of file boris_sweeper.hpp.
|
protected |
Definition at line 167 of file boris_sweeper.hpp.
|
protected |
Definition at line 142 of file boris_sweeper.hpp.
|
protected |
Definition at line 166 of file boris_sweeper.hpp.
|
protected |
Definition at line 145 of file boris_sweeper.hpp.
|
protected |
Definition at line 146 of file boris_sweeper.hpp.