Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Increase visibility on mismatch between dof ordering and node ordering #875

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions docs/src/literate-howto/postprocessing.jl
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion for the beginning of this file

# # [Post processing and visualization](@id howto-postprocessing)
# After running a simulation, we usually want to visualize the results in different ways.
# Ferrite.jl provides several tools to facilitate such tasks, and direct visualization of 
# solutions, cell data, and more by using the builtin vtk export or 
# our `Makie.jl`-based visualization tool `FerriteViz.jl`. 
# Note that if these tools don't suit your needs, and you want to create your own 
# visualization, the node numbers do not match the degrees of freedom numbering.
# You can use [`evaluate_at_grid_nodes`](@ref) to get the solution at the nodes. 
# 
# This how-to demonstrates
# * The basic vtk export functionality
# * The `L2Projector` for projecting quadrature point data to the FE interpolations 
# * The `PointEvalHandler` to evaluate this projection at user-defined points in the grid. 
# 
# The results from the heat equation tutorial are used as a basis for this demonstration.

And then skip the two first sentences after introduction.

Also update the vtk block to the new syntax, and I think we should add the primary solution as well to the output.

Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,12 @@ Plots.plot(getindex.(points,1), u_points, xlabel="x (coordinate)", ylabel="u (te
Plots.plot(getindex.(points,1), getindex.(q_points,1), xlabel="x (coordinate)", ylabel="q_x (flux in x-direction)", label=nothing)
# *Figure 4*: ``x``-component of the flux along the cut line from *Figure 2*.

#md # ## What next?
#md # For more complicated visualization workflows we recommend either using our visualization tool [FerriteViz.jl](https://github.com/Ferrite-FEM/FerriteViz.jl)
#md # or users should export the solution into vtk files and use e.g. [ParaView](https://www.paraview.org/), [Mayavi](https://docs.enthought.com/mayavi/mayavi/), ... .
#md # It should be noted that the ordering of the DofHandler and the numbering of the nodes does not match, hence we cannot directly use solution
#md # vectors to assign colors to discretizations.
KnutAM marked this conversation as resolved.
Show resolved Hide resolved

Comment on lines +132 to +137
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion at top replaces this in my opinion.

Suggested change
#md # ## What next?
#md # For more complicated visualization workflows we recommend either using our visualization tool [FerriteViz.jl](https://github.com/Ferrite-FEM/FerriteViz.jl)
#md # or users should export the solution into vtk files and use e.g. [ParaView](https://www.paraview.org/), [Mayavi](https://docs.enthought.com/mayavi/mayavi/), ... .
#md # It should be noted that the ordering of the DofHandler and the numbering of the nodes does not match, hence we cannot directly use solution
#md # vectors to assign colors to discretizations.

#md # ## [Plain program](@id postprocessing-plain-program)
#md #
#md # Here follows a version of the program without any comments.
Expand Down
2 changes: 2 additions & 0 deletions docs/src/literate-tutorials/heat_equation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ cellvalues = CellValues(qr, ip);
# our interpolation `ip` defined above.
# Lastly we `close!` the `DofHandler`, it is now that the dofs are distributed
# for all the elements.
#md # !!! note
#md # The dof numbering does not follow the node numbering of the grid.
termi-official marked this conversation as resolved.
Show resolved Hide resolved
dh = DofHandler(grid)
add!(dh, :u, ip)
close!(dh);
Expand Down
3 changes: 3 additions & 0 deletions src/Dofs/DofHandler.jl
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,9 @@ add!(dh, :u, ip_u)
add!(dh, :p, ip_p)
close!(dh)
```

!!! note
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
!!! note
!!! note "Dof numbering"

(Or DoF numbering, but we are a bit inconsistent here...)

The dof numbering does not follow the node numbering of the associated grid.
"""
function DofHandler(grid::G) where {dim, G <: AbstractGrid{dim}}
ncells = getncells(grid)
Expand Down
Loading