Hi all,
in order to make a test problem, i took a smooth function u=exp(x^2+y^2) as an 
exact solution, and I defined the gradient in y direction grad=2yexp(x^2+y^2).
I implement them as in step 7 with some modification but unfortunatelly it gave 
me the following error
"
conversion from ‘double’ to non-scalar type ‘dealii::Tensor<1, 2>’ requested
in line 
  Tensor<1,dim> return_value=2*p(1)*exp(p(0)*p(0)+p(1)*p(1));
"

this is the connected part from the code

template <int dim>
class Solution : public Function<dim>
        
{
  public:
    Solution () : Function<dim>() {}
    
    virtual double value (const Point<dim>   &p,
              const unsigned int  component = 0) const;
    
    virtual Tensor<1,dim> gradient (const Point<dim>   &p,
                    const unsigned int  component = 0) const;
};
template <int dim>
double Solution<dim>::value (const Point<dim>   &p,
                 const unsigned int) const
{
  double return_value = exp(p(0)*p(0)+p(1)*p(1));
  
  
  return return_value;
}
template <int dim>
Tensor<1,dim> Solution<dim>::gradient (const Point<dim>   &p,
                       const unsigned int) const
{
  Tensor<1,dim> return_value=2*p(1)*exp(p(0)*p(0)+p(1)*p(1));

  
  
  return return_value;
}

please help me to fix the problem.

best regards,
Ahmad



_______________________________________________
dealii mailing list http://poisson.dealii.org/mailman/listinfo/dealii

Reply via email to