Questions from tutorial step-19

63 views
Skip to first unread message

Yufei Fang

unread,
Mar 29, 2024, 11:28:37 PM3/29/24
to deal.II User Group

Dear developers/users,

I'm working on tutorial step 19, and I have some exact questions as well as some related follow-up questions. I'll list them here, and I would appreciate your help.

  1. On line 313, there is the line “fe.shape_value(i, reference_location)”. The “reference_location” is defined from “particle.get_reference_location()”. “particle” is an instance of the “Particles::Particle” class, and the description of its “get_reference_location()” function says: "Return the reference location of this particle in its current cell.”

    My question is whether the reference location of the particle in its current cell refers to the real coordinates (x, y, z) or the reference coordinates (\xi_1, \xi_2, \xi_3) within the cell.

  2. On line 509, 'cell->minimum_vertex_distance()', where 'cell' is defined by 'const auto &cell : dof_handler.active_cell_iterators()'. According to the documentation, 'cell' should be of type 'active_cell_iterator', because of ‘IteratorRange< active_cell_iterator > active_cell_iterators () const’ . However, I couldn't find 'minimum_vertex_distance()' as a method of 'active_cell_iterator' in the manual. What the exact type of 'cell' is and how it's able to access 'minimum_vertex_distance()'?

  3. In the documentation, the FEValues<dim, spacedim> class template requires two template arguments, 'dim' and 'spacedim'. However, on lines 227 and 534, FEValues is instantiated with only one template argument, FEValues<dim>. Similarly, for ‘std::vector<Tensor<1, dim>> field_gradients(vertex_quadrature.size())’ on line 536, the Tensor class is used with two arguments. ‘fe_values.get_function_gradients(solution, field_gradients)’ on line 546 uses field_gradients. but the get_function_gradients in the documentaiton is ‘void FEValuesBase< dim, spacedim >::get_function_gradients ( const ReadVector< Number > & fe_function, std::vector< Tensor< 1, spacedim, Number > > & gradients ) const’ , the Tensor template appears to require three arguments.

    Why there is a discrepancy in the number of template arguments used in these instances?

  4. In the inheritance diagram, what does the dashed yellow line represent?

    Untitled.png

  5. In the 'Result' section of tutorial step-19, there's a simulation video. How can I create a similar animation, and what does the deep blue curve line in it represent?

  6. In the ”make_grid()” function, four different boundary IDs are assigned to the boundaries. Is there a way I can visualize these boundaries in ParaView or VisIt, so that I can verify if the boundaries are set correctly?

  7. When running code in deal.II, is there a way to enable a debug mode similar to MATLAB or other IDEs? I'd like to execute the code line by line starting from the main function, understand the program's logic, and check the values of parameters (e.g., vertex_quadrature.size()). This would help me gain a deeper understanding of what the program does.

Wolfgang Bangerth

unread,
Mar 31, 2024, 1:39:12 PM3/31/24
to dea...@googlegroups.com

Yufei:
that's a lot of questions :-)

> 1.
>
> On line 313, there is the line “fe.shape_value(i, reference_location)”.
> The “reference_location” is defined from
> “particle.get_reference_location()”. “particle” is an instance of the
> “Particles::Particle” class, and the description of its
> “get_reference_location()” function says: "Return the reference location
> of this particle in its current cell.”
>
> My question is whether the reference location of the particle in its
> current cell refers to the real coordinates (x, y, z) or the reference
> coordinates (\xi_1, \xi_2, \xi_3) within the cell.

I think you answered your own question: The "reference location" is in the
reference coordinate system of the reference cell.

> 2.
>
> On line 509, 'cell->minimum_vertex_distance()', where 'cell' is defined by
> 'const auto &cell : dof_handler.active_cell_iterators()'. According to the
> documentation, 'cell' should be of type 'active_cell_iterator', because of
> ‘IteratorRange< active_cell_iterator > active_cell_iterators () const’ .
> However, I couldn't find 'minimum_vertex_distance()' as a method of
> 'active_cell_iterator' in the manual. What the exact type of 'cell' is and
> how it's able to access 'minimum_vertex_distance()'?

If you go to any page of the deal.II website, for example
https://dealii.org/developer/doxygen/deal.II/step_19.html
there is a search box on the top right. If you type "minimum_vertex_distance"
there, it takes you to the class that is a function of.

For this specific case, you may also want to look at
https://dealii.org/developer/doxygen/deal.II/group__Iterators.html


> 3.
>
> In the documentation, the FEValues<dim, spacedim> class template requires
> two template arguments, 'dim' and 'spacedim'. However, on lines 227 and
> 534, FEValues is instantiated with only one template argument,
> FEValues<dim>. Similarly, for ‘std::vector<Tensor<1, dim>>
> field_gradients(vertex_quadrature.size())’ on line 536, the Tensor class
> is used with two arguments. ‘fe_values.get_function_gradients(solution,
> field_gradients)’ on line 546 uses field_gradients. but the
> get_function_gradients in the documentaiton is ‘void FEValuesBase< dim,
> spacedim >::get_function_gradients ( const ReadVector< Number > &
> fe_function, std::vector< Tensor< 1, spacedim, Number > > & gradients )
> const’ , the Tensor template appears to require three arguments.
>
> Why there is a discrepancy in the number of template arguments used in
> these instances?

Most classes in deal.II that have both dim and spacedim template arguments are
declared like
template <int dim, int spacedim=dim>
class FEValues;
That is, spacedim=dim is the default.


> 4.
>
> In the inheritance diagram, what does the dashed yellow line represent?
>
> Untitled.png

I don't actually know. Perhaps the doxygen documentation describes it? Doxygen
is the tool we use to generate these pages.


> 5.
>
> In the 'Result' section of tutorial step-19, there's a simulation video.
> How can I create a similar animation, and what does the deep blue curve
> line in it represent?

I believe that this video describes this:
https://www.math.colostate.edu/~bangerth/videos.676.11.html


> 6.
>
> In the ”make_grid()” function, four different boundary IDs are assigned to
> the boundaries. Is there a way I can visualize these boundaries in
> ParaView or VisIt, so that I can verify if the boundaries are set correctly?

Take a look at the entry for "Boundary indicator" in the glossary:
https://dealii.org/developer/doxygen/deal.II/DEALGlossary.html


> 7.
>
> When running code in deal.II, is there a way to enable a debug mode
> similar to MATLAB or other IDEs? I'd like to execute the code line by line
> starting from the main function, understand the program's logic, and check
> the values of parameters (e.g., vertex_quadrature.size()). This would help
> me gain a deeper understanding of what the program does.

This is what a "debugger" is there for:
https://www.math.colostate.edu/~bangerth/videos.676.25.html

Best
W.
--
------------------------------------------------------------------------
Wolfgang Bangerth email: bang...@colostate.edu
www: http://www.math.colostate.edu/~bangerth/


Yufei Fang

unread,
Apr 2, 2024, 3:34:05 AM4/2/24
to deal.II User Group
Dear Professor Bangerth,
Thank you for taking the time to answer my questions. Your guidance has been invaluable to my learning process. I deeply appreciate the comprehensive study resources provided by deal.II, including tutorials, videos, and documentation. They have enabled me to understand finite element methods in detail, beyond simply executing pre-defined commands. I am truly grateful for the knowledge and insights shared by you and the other contributors within the deal.II community.

Best regards,
Yufei Fang
Reply all
Reply to author
Forward
0 new messages