Hello,
I'm very new to Deal.ii and trying to understand it through modifying
step-15. However I get the following error. Although it is descriptive I'm
unable to figure out the problem:
"error: no match for ‘operator*’ (operand types are ‘const
dealii::Tensor<1, 2>’ and
‘__gnu_cxx::__alloc_traits<std::allocator<dealii::Vector<double> >
>::value_type {aka dealii::Vector<double>}’)
* old_solution_values[q] "
I am not sure if I understand it, but my initial guess is that it might be
related to the sizes of vectors and tensors (for the case of gradients). I
tried to take care of them to the best of my understanding.
My bilinear form:
((grad. phi_i, grad.u*phi_j)+(grad. phi_i, u*grad. phi_j))*del.Uj = (grad.
phi_i, u*grad.u)
I have modified/added the following lines:
std::vector<Tensor<1, dim>> old_solution_gradients(n_q_points);
std::vector<Vector<double>> old_solution_values(n_q_points,
Vector<double>(dim -1));
fe_values.get_function_gradients(present_solution, old_solution_gradients);
fe_values.get_function_values (present_solution, old_solution_values);
Assembly:
for (unsigned int q = 0; q < n_q_points; ++q)
{
for (unsigned int i = 0; i < dofs_per_cell; ++i)
{
for (unsigned int j = 0; j < dofs_per_cell; ++j)
cell_matrix(i, j) +=
(((fe_values.shape_grad(i, q)
*old_solution_gradients[q]
* fe_values.shape_value(j, q))
+
(fe_values.shape_grad(i, q)
* old_solution_values[q]
* fe_values.shape_grad(j, q)))
* fe_values.JxW(q));
cell_rhs(i) -= (fe_values.shape_grad(i, q)
* old_solution_values[q]
* old_solution_gradients[q]
* fe_values.JxW(q));
}
}
I assume old_solution_values[q] should be the correct variable for "u" but
when I use present_solution[q] instead (in assembly part, for curiosity ),
it is compiled but in the running stage I get the following error message:
"Additional information:
Iterative method reported convergence failure in step 337. The residual in
the last step was 22.0585.
This error message can indicate that you have simply not allowed a
sufficiently large number of iterations for your iterative solver to
converge. This often happens when you increase the size of your problem. In
such cases, the last residual will likely still be very small, and you can
make the error go away by increasing the allowed number of iterations when
setting up the SolverControl object that determines the maximal number of
iterations you allow.
The other situation where this error may occur is when your matrix is not
invertible (e.g., your matrix has a null-space), or if you try to apply the
wrong solver to a matrix (e.g., using CG for a matrix that is not symmetric
or not positive definite). In these cases, the residual in the last
iteration is likely going to be large."
While the second problem might not be the case could anyone offer some
suggestions or explanations on both cases?
Thank you!
Ali
--
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/bb042101-88e7-4f5c-a437-98207437d44an%40googlegroups.com.