Thank you very much for your answer.

So for the first function  
VectorTools::point_value(dof_handler,solution,point,values); 

I can specify the observed point in real coordiante, solution vector and 
dof_handler to get the values, right?

For the second one, assuming that I am using QGauss for solving the system, 
does it mean that if the point is on the edge of the cell then I cannot get 
the solution at that point?
I am using the codes like this:

const std::pair<typename DoFHandler<dim>::active_cell_iterator, Point<dim>>
        cell_point = GridTools::find_active_cell_around_point(mapping, 
dof_handler, point);

const double delta = 1e-20;
Assert(GeometryInfo<dim>::distance_to_unit_cell(cell_point.second) < delta,
       ExcInternalError());

const Quadrature<dim> 
quadrature(GeometryInfo<dim>::project_to_unit_cell(cell_point.second));
FEValues<dim> fe_values(mapping, dof_handler.get_fe(), quadrature,
                        update_values | update_gradients | 
update_quadrature_points);
fe_values.reinit(cell_point.first);

const FEValuesExtractors::Vector vector_re(0);
const FEValuesExtractors::Vector vector_im(dim);

std::vector<Tensor<1, dim>> temp_e_field_re(1);
std::vector<Tensor<1, dim>> temp_e_field_im(1);

//Get e_field at point
fe_values[vector_re].get_function_values(solution, temp_solution_re);
fe_values[vector_im].get_function_values(solution, temp_solution_im);


With this function, I see that it returns 9 components: 3 components for 
each parameters: temp_solution_re[0], temp_solution_re[1], temp_solution_re[
2] 
when I print them out by:

std::cout<<"result with get_function_values real: \t"<< temp_solution_re[0] << 
", "<<temp_solution_re[1] << ", "<<temp_solution_re[2] <<"\n";
std::cout<<"result with get_function_values imag: \t"<< temp_solution_im[0] << 
", "<<temp_solution_im[1] << ", "<<temp_solution_im[2] <<"\n";


I really want to know which one is the solution for my vector in x,y,z 
direction?

Best regards,
Pham Ngoc Kien

Vào 14:08:11 UTC+9 Thứ Năm, ngày 14 tháng 3 năm 2019, Wolfgang Bangerth đã 
viết:
>
> On 3/13/19 8:21 PM, Phạm Ngọc Kiên wrote: 
> > I am testing my codes for output the solution at a point in my numerical 
> model. 
> > I saw in the library 2 ways to do this task. The first one is to use 
> > VectorTools::point_value() function and the second one is 
> > fe_values.get_function_values(). 
>
> These functions are really used in very different contexts. The first of 
> these 
> is when you want to evaluate a solution vector at some arbitrary point in 
> the 
> domain. As a consequence, you have to specify this point when you call the 
> function. 
>
> The second function is used when you want to evaluate the function at very 
> specific points, namely the quadrature points of the current cell. You can 
> of 
> course only use this if the point at which you want to evaluate the 
> solution 
> happens to be a quadrature point of the current cell, and not just any 
> point 
> anywhere. In return the second function is then vastly more efficient than 
> the 
> first. 
>
> Does this help? 
>
> Best 
>   W. 
>
> -- 
> ------------------------------------------------------------------------ 
> Wolfgang Bangerth          email:                 bang...@colostate.edu 
> <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 dealii+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to