Kyusik,
 

> 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
>
OK, then this makes sense. 

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.
>
In the end, VectorTools::project does the same thing as you do here. In 
particular, it also loops over the cells to assemble the right-hand side.
If you know that your FiniteElement is interpolating (which I assume given 
the way you compute the maximum) and that J_tor= x*solution+solution_max/y 
is in your ansatz space (probably not) or an interpolation is sufficient,
you can use something like

J_tor(local_dof_indices[i]) = 
right_hand_side.value(fe_values.quadrature_point(q_index),
sol_tmp[q_index],*max)

and hence just loop once over all the cells instead of solving a linear 
system. Of course, you have to decide if the projection is that expensive 
that you want to go with an interpolation instead.

Best,
Daniel

-- 
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].
For more options, visit https://groups.google.com/d/optout.

Reply via email to