> First of all, Thank you very much for your reply >
> This can only work if you know that the maximum is attained at one of the > support_points > of your FiniteElement. In general, you can use > VectorTools::integrate_difference to find a good approximation > to the maximum value of your solution. > >> >> As long as I know, std::max_element is the way to get the location of maximum value in the vector. I used this to get solution_max(maximum value of solution) > I don't quite understand this line. Does right_hand_side.value really take > three arguments? > How does this resemble x*solution+solution_max/y? > > I defined Function for right_hand_side. template <int dim> double RightHandSide<dim>::value (const Point<dim> &p, const double psi, const double psi_max, const unsigned int /*component*/) const { double rhs; rhs = p(0)*psi+psi_max/p(1); return rhs; } In this function p(0) is x, p(1) is y, psi is solution and psi_max is *max >> In principle, your approach looks good. You can have a look at the > implementation of VectorTools::project for improving this. > I also considered this Tools.... void VectorTools::project ( const Mapping <https://www.dealii.org/developer/doxygen/deal.II/classMapping.html>< dim, spacedim > & mapping, const DoFHandler <https://www.dealii.org/developer/doxygen/deal.II/classDoFHandler.html>< dim, spacedim > & dof, const ConstraintMatrix <https://www.dealii.org/developer/doxygen/deal.II/classConstraintMatrix.html> & constraints, const Quadrature <https://www.dealii.org/developer/doxygen/deal.II/classQuadrature.html>< dim > & quadrature, const Function <https://www.dealii.org/developer/doxygen/deal.II/classFunction.html>< spacedim, typename VectorType::value_type > & function, VectorType & vec, const bool enforce_zero_boundary = false, const Quadrature <https://www.dealii.org/developer/doxygen/deal.II/classQuadrature.html>< dim-1 > & q_boundary = (dim > 1?QGauss <https://www.dealii.org/developer/doxygen/deal.II/classQGauss.html> < dim-1 >(2):Quadrature <https://www.dealii.org/developer/doxygen/deal.II/classQuadrature.html> < dim-1 >(0)), const bool project_to_boundary_first = false ) But the problem is that I don't know how to input *max(maximum value of solution) and solution in const Function <https://www.dealii.org/developer/doxygen/deal.II/classFunction.html>< spacedim, typename VectorType::value_type > & function, > Why would you think that what you are doing is extremely inefficient? > > As you know, I have used sol_tmp that is local vector of solution(global vector) But I think If I can use solution(global vector) and position(x and y) directly to calculate J_tor I don't need to use setup_Jtor, assemble_Jtor and solve_Jtor.(i.e. I don't need to make linear system) I wonder if there is way to use global vector directly to calculate J_tor. Thank you. Kyusik. -- 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.