I wanted to evaluate Vectortool::integrate_difference to estimate my error.
but I couldn't figure out what I need to enter for the third component. (I
marked it as red)
VectorTools::integrate_difference (dof_handler,
solution,
*Solution<dim+**1**>()*,
difference_per_cell,
QGauss<dim>(3),
VectorTools::L2_norm);
I have solution vector over my domain,(by the way I am solving vector
valued problems...)
I want to compare this with continuous exact function, "May be
Solution<dim+1>" , I have generated it as follow.
However, I got a error message that
*/Users/jaekwangjk/repos/trial/sphere-deal.ii/mystokes.cc:1258:7: **error: *
*no*
* matching function for call to 'integrate_difference'*
What's might be wrong with my code......
template <int dim>
class Solution : public Function<dim>
{
public:
Solution () : Function<dim>(dim+1) {}
//const unsigned int b_id;
virtual double value (const Point<dim> &p,
const unsigned int component = 0) const;
virtual void vector_value (const Point<dim> &p,
Vector<double> &value) const;
};
template <int dim>
double
Solution<dim>::value (const Point<dim> &p,
const unsigned int component) const
{
Assert (component < this->n_components,
ExcIndexRange (component, 0, this->n_components));
double U=-1.; //inflow velocity
double obj_rad=0.2; //Object Radius
double r_sph = sqrt( pow(p[0],2) + pow(p[1],2) );
double phi = (-1) * acos(p[1]/r_sph);
double q_r_sph=U*cos(phi)*( 1+
0.5*pow(obj_rad,3)/pow(r_sph,3)-1.5*obj_rad/r_sph
);
double q_phi=(-1)* U*sin(phi)*(1 -0.25 *pow(obj_rad,3)/pow(r_sph,3)-
0.75*obj_rad/r_sph);
double q_x=q_r_sph*sin(phi)+q_phi*cos(phi);
double q_y=(-1)*q_r_sph*cos(phi)+q_phi*sin(phi);
if (component == 0)
return q_x;
if (component == 1)
return q_y;
else
return 0; //
}
template <int dim>
void
Solution<dim>::vector_value (const Point<dim> &p,
Vector<double> &values) const
{
for (unsigned int c=0; c<this->n_components; ++c)
values(c) = Solution<dim>::value (p, c);
}
--
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see
https://groups.google.com/d/forum/dealii?hl=en
---
You received this message because you are subscribed to the Google Groups
"deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to dealii+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.