Hello all,
I am trying to code up a simple backward euler solver for a time-dependent
advection DG solver (built upon step 12). Following step-37, i defined a
templated matrix free class that implements vmult as follows:
template <typename number, int dim>
class MatrixFree : public Subscriptor
{
private:
DGMethod<dim>* dg;
public:
MatrixFree (DGMethod<dim>* dg_method) {
dg = dg_method;
}
virtual ~MatrixFree () {}
template <typename number2>
void vmult (Vector<number2> &dst,
const Vector<number2> &src) const;
};
template <typename number, int dim>
template <typename number2>
void MatrixFree<number,dim>::vmult (Vector<number2> &dst, const Vector<number2>
&src) const
{
//compute matrix-vector product here
...
}
The class DGMethod<dim> got modified as follows:
template <int dim>
class DGMethod
{
public:
DGMethod ();
~DGMethod ();
void run ();
private:
....
template <typename number, int dimension> friend class MatrixFree;
MatrixFree<double,dim> back_euler_matrix;
};
template <int dim>
DGMethod<dim>::DGMethod ()
:
....
back_euler_matrix (this)
{
// other stuff, initializations, etc
}
Then in the DGMethod<dim>::implicit_euler( ) method, I do the following:
template <int dim>
void DGMethod<dim>::implicit_euler()
{
SolverControl solver_control (1000, 1e-14, false, false);
SolverRichardson<> solver (solver_control);
Vector<double> rhs_back_euler( solution.size() );
Vector<double> solution_tmp ( solution.size() );
// matrix assemblies & other stuff...
solver.solve (back_euler_matrix, solution_tmp, rhs_back_euler);
solution = solution_tmp;
}
When i compile my code, i get the following error:
error: no matching function for call to
‘dealii::SolverRichardson<dealii::Vector<double> >::solve(MatrixFree<double,
2>&, dealii::Vector<double>&, dealii::Vector<double>&)’
make: *** [time_dependent_advection_2_implicit.g.o] Error 1
Seems solve() does not accept the MatrixFree class. Any advice on how I can
make this work? It seems I am using the same approach as in step-37...
Thank you very much!
-- Mihai
__________________________________________________
Do You Yahoo!?
Sie sind Spam leid? Yahoo! Mail verfügt über einen herausragenden Schutz gegen
Massenmails.
http://mail.yahoo.com _______________________________________________
dealii mailing list http://poisson.dealii.org/mailman/listinfo/dealii