Thank you very much for your help, Wolfgang.
Following your advice, I have changed the definition of DispRightHandSide
from Function to TensorFunction and the subsequent lines and the code have
compiled successfully.
Again, thanks for your help.
Best,
Teresa.
On Thursday, March 12, 2020 at 6:17:41 PM UTC+1, Wolfgang Bangerth wrote:
>
> On 3/12/20 11:07 AM, Teresa Sanchez Rúa wrote:
> > line 545:37: error: no match for ‘operator*’ (operand types are
> > ‘*__gnu_cxx::__alloc_traits<std::allocator<dealii::Vector<double> >
> > >::value_type {aka dealii::Vector<double>}*’ and ‘*const
> > dealii::Tensor<1, 2>*’)
> >
> > (disp_rhs_values[q] * phi_i_u - pres_rhs_values[q] *
> > phi_i_p) * fe_values.JxW(q);
>
> Teresa,
> the error actually lists quite clearly what is happening:
> * You are invoking operator*, i.e., you are multiplying two objects
> * The left argument is a Vector<double>
> * The right argument is a Tensor<1,2>
> * There is no operator that multiplies these two.
>
> Further down, it lists the line where that is happening:
>
> > (disp_rhs_values[q] * phi_i_u - pres_rhs_values[q] *
> > phi_i_p) * fe_values.JxW(q);
> >
> > * ^*
>
> So apparently, disp_rhs_values[q] is the Vector and phi_i_u is the
> Tensor<1,2>. Indeed, that's what I see in your code.
>
> So how to fix this:
> * You could spell the product of these two objects out element-by-element.
> * You could convert disp_rhs_values into a std::vector<Tensor<1,dim>>
> instead of std::vector<Vector<double>> because there is an operator* for
> Tensor<1,dim> objects on the lhs and rhs of the operation.
>
> The latter would be what I would do. Of course, there is the place where
> you fill that vector<Tensor> object:
>
>
> disp_right_hand_side.vector_value_list(fe_values.get_quadrature_points(),
> disp_rhs_values);
>
> This would no longer compile if you change the type of disp_rhs_values,
> but the easiest approach to this would be if you derived
> DispRightHandSide from TensorFunction instead of Function. This seems
> reasonable anyway because it is not a function with some arbitrary
> number of components, but it is in fact a function whose dim components
> represent a physical vector with exactly dim components.
>
> Best
> W.
>
>
> --
> ------------------------------------------------------------------------
> Wolfgang Bangerth email: [email protected]
> <javascript:>
> www: http://www.math.colostate.edu/~bangerth/
>
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/dealii/68a4fe90-3902-4d06-9085-ee80738180e2%40googlegroups.com.