Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
13 changes: 13 additions & 0 deletions .github/workflows/SpellCheck.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Spell Check

on: [pull_request]

jobs:
typos-check:
name: Spell Check with Typos
runs-on: ubuntu-latest
steps:
- name: Checkout Actions Repository
uses: actions/checkout@v6
- name: Check spelling
uses: crate-ci/typos@v1.44.0
21 changes: 21 additions & 0 deletions .typos.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
[files]
extend-exclude = ["*.svg", "*.toml"]

[default.extend-words]
ue = "ue"
ba = "ba"
Comment thread
termi-official marked this conversation as resolved.
nd = "nd"

[type.qrtables]
extend-glob = ["**/gaussquad_*_table.jl", "**/generate_quadrature.jl"]

[type.qrtables.extend-words]
Methode = "Methode"
Numer = "Numer"
Secrest = "Secrest"

[type.feintro]
extend-glob = ["**/fe_intro.md"]

[type.feintro.extend-words]
Strang = "Strang"
6 changes: 3 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added
- Support for directly assembling to `SparseMatrixCSR` (from `SparseMatricesCSR.jl`). ([#864])
- Enhance `generate_grid` to support outputting line meshes embedded in two and three
spatial dimentions. ([#1122], [#1214])
spatial dimensions. ([#1122], [#1214])

### Fixes
- Fix L2 projection of tensor fields on discontinuous interpolations. ([#1197], [#1198])
Expand All @@ -38,7 +38,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Documentation updates
- Extended assembly docs with information on how to support direct assembly into new matrix
types. ([#864])
- Add a list of reserach papers where Ferrite was used for numbeir simulations. Please add
- Add a list of research papers where Ferrite was used for simulations. Please add
your paper! ([#1221])
- Add section on global and local DoF numbering. ([#1089])
- Fix some typos and grammar ([#1210], [#1224], [#1228])
Expand Down Expand Up @@ -687,7 +687,7 @@ poking into Ferrite internals:
- Fix grid coloring for cell sets with 0 or 1 cells. ([#600])
### Other improvements
- Documentation improvements:
- Simplications and clarifications to hyperelasticity example. ([#591])
- Simplifications and clarifications to hyperelasticity example. ([#591])
- Remove duplicate docstring entry for `vtk_point_data`. ([#602])
- Update documentation about initial conditions. ([#601], [#604])

Expand Down
9 changes: 9 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,14 @@ configure pre-commit to run before each commit:
pre-commit install
```

### Spell-checking
Ferrite uses [typos] for spell checking. If you have that installed,
you run it locally with by running `typos` from the top level directory.
To fix mistakes automatically, run `typos -w`, but be careful as e.g. names
and words from other languages might be incorrectly corrected (which is why
it is not included as a [pre-commit] hook). Exceptions should be added to
`.typos.toml`.

[documenter]: https://juliadocs.github.io/Documenter.jl/
[first-contributions]: https://github.com/firstcontributions/first-contributions
[gh-edit-files]: https://docs.github.com/en/repositories/working-with-files/managing-files/editing-files#editing-files-in-another-users-repository
Expand All @@ -101,3 +109,4 @@ pre-commit install
[so-mre]: https://stackoverflow.com/help/minimal-reproducible-example
[tim-doc]: https://youtu.be/ZpH1ry8qqfw
[tim-git]: https://youtu.be/cquJ9kPkwR8
[typos]: https://github.com/crate-ci/typos
2 changes: 1 addition & 1 deletion docs/src/devdocs/interpolations.md
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ Ferrite.adjust_dofs_during_distribution(::QTI) = false
```

Finally, our interpolation results in continuous function values across
cell borders, but the derivatives are discontinous. Hence, it describes
cell borders, but the derivatives are discontinuous. Hence, it describes
a $H_1$ conformity,
```@example InterpolationExample
Ferrite.conformity(::QTI) = Ferrite.H1Conformity()
Expand Down
14 changes: 7 additions & 7 deletions docs/src/literate-gallery/topology_optimization.jl
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
# \nabla \chi_p \cdot \textbf{n} = \frac{1}{\Delta h} (\chi_w - \chi_e) = 0
# ```
# from which follows $\chi_w = \chi_e$. Thus for boundary elements we can replace the value for the missing neighbor by the value of the opposite neighbor.
# In order to find the corresponding neighbor elements, we will make use of Ferrites grid topology funcionalities.
# In order to find the corresponding neighbor elements, we will make use of Ferrite's grid topology functionalities.
#
# ## Commented Program
# We now solve the problem in Ferrite. What follows is a program spliced with comments.
Expand Down Expand Up @@ -188,7 +188,7 @@ function compute_densities(states, dh)
end
#md nothing # hide

# For the Laplacian we need some neighboorhood information which is constant throughout the analysis so we compute it once and cache it.
# For the Laplacian we need some neighborhood information which is constant throughout the analysis so we compute it once and cache it.
# We iterate through each facet of each element,
# obtaining the neighboring element by using the `getneighborhood` function. For boundary facets,
# the function call will return an empty object. In that case we use the dictionary to instead find the opposite
Expand Down Expand Up @@ -218,7 +218,7 @@ function cache_neighborhood(dh, topology)
end
#md nothing # hide

# Now we calculate the Laplacian using the previously cached neighboorhood information.
# Now we calculate the Laplacian using the previously cached neighborhood information.
function approximate_laplacian(nbgs, χn, Δh)
∇²χ = zeros(length(nbgs))
for i in 1:length(nbgs)
Expand Down Expand Up @@ -290,13 +290,13 @@ end
# Finally, we put everything together to update the density. The loop ensures the stability of the
# updated solution.

function update_density(dh, states, mp, ρ, neighboorhoods, Δh)
function update_density(dh, states, mp, ρ, neighborhoods, Δh)
n_j = Int(ceil(6 * mp.β / (mp.η * Δh^2))) # iterations needed for stability
χn = compute_densities(states, dh) # old density field
χn1 = zeros(length(χn))

for j in 1:n_j
∇²χ = approximate_laplacian(neighboorhoods, χn, Δh) # Laplacian
∇²χ = approximate_laplacian(neighborhoods, χn, Δh) # Laplacian
pΨ = compute_driving_forces(states, mp, dh, χn) # driving forces
p_Ω = compute_average_driving_force(mp, pΨ, χn) # average driving force

Expand Down Expand Up @@ -442,7 +442,7 @@ function topopt(ra, ρ, n, filename; output = :false)
conv = :false

topology = ExclusiveTopology(grid)
neighboorhoods = cache_neighborhood(dh, topology)
neighborhoods = cache_neighborhood(dh, topology)

## Newton-Raphson loop
NEWTON_TOL = 1.0e-8
Expand Down Expand Up @@ -496,7 +496,7 @@ function topopt(ra, ρ, n, filename; output = :false)
end

## update density
χ = update_density(dh, states, mp, ρ, neighboorhoods, Δh)
χ = update_density(dh, states, mp, ρ, neighborhoods, Δh)

## update old displacement, density and compliance
un .= u
Expand Down
4 changes: 2 additions & 2 deletions docs/src/literate-howto/postprocessing.jl
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
# different ways. Ferrite provides several tools to facilitate these tasks:
#
# - L2 projection of (discrete) data onto FE interpolations using the `L2Projector`
# - Evalutation of fields (solutions, projections, etc) at arbitrary, user-defined, points
# - Evaluation of fields (solutions, projections, etc) at arbitrary, user-defined, points
# using the `PointEvalHandler`
# - Builtin functionality for exporting data (solutions, cell data, projections, etc) to
# the VTK format
Expand All @@ -30,7 +30,7 @@
# domain.

# !!! warning "Custom visualization"
# A common assumption is that the numbering of degrees of freedom matche the numbering
# A common assumption is that the numbering of degrees of freedom matches the numbering
# of the nodes in the grid. This is *NOT* the case in Ferrite. If the available tools
# don't suit your needs and you decide to "roll your own" visualization you need to be
# aware of this and take it into account. For the specific case of evaluating the
Expand Down
4 changes: 2 additions & 2 deletions docs/src/literate-howto/threaded_assembly.jl
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
# commutative.
# - **Assembler task**: By using a designated task for the assembling we (obviously)
# ensure that only a single task assembles. The worker tasks (the tasks computing the
# element contributions) would then hand off their results to the assemly task. This
# element contributions) would then hand off their results to the assembly task. This
# can be a useful approach if computing the element contributions is much slower than
# the assembly -- otherwise the assembler task can't keep up with the worker tasks.
# There might also be some extra overhead because of task switching in the scheduler.
Expand Down Expand Up @@ -207,7 +207,7 @@ nothing # hide
# For a different problem setup where some cells might take longer to process (perhaps
# they experience plastic deformation and we need to solve a local problem) we might
# benefit from load balancing. The `DynamicScheduler` can be used also for load
# balancing by specifiying `nchunks` or `chunksize`. However, the `DynamicScheduler`
# balancing by specifying `nchunks` or `chunksize`. However, the `DynamicScheduler`
# will always spawn `nchunks` tasks which can become costly since we are allocating
# scratch data for every task. To limit the number of tasks, while allowing for more
# than `ntasks` chunks, we can use the `GreedyScheduler` *with chunking*. For example,
Expand Down
4 changes: 2 additions & 2 deletions docs/src/literate-tutorials/computational_homogenization.jl
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@
# \bar{\boldsymbol{\varepsilon}} = \begin{pmatrix}0 & 0.5\\ 0.5 & 0\end{pmatrix}
# ```
#
# as the input to the RVE problem. When the sensitivies are solved we can compute the
# as the input to the RVE problem. When the sensitivities are solved we can compute the
# entries of the homogenized stiffness as follows
#
# ```math
Expand Down Expand Up @@ -288,7 +288,7 @@ Em = SymmetricTensor{4, 2}(
Ei = 10 * Em;

# As mentioned above, in order to compute the apparent/homogenized stiffness we will solve
# the problem repeatedly with different macroscale strain tensors to compute the sensitvity
# the problem repeatedly with different macroscale strain tensors to compute the sensitivity
# of the homogenized stress, ``\bar{\boldsymbol{\sigma}}``, w.r.t. the macroscopic strain,
# ``\bar{\boldsymbol{\varepsilon}}``. The corresponding unit strains are defined below,
# and will result in three different right-hand-sides:
Expand Down
2 changes: 1 addition & 1 deletion docs/src/literate-tutorials/plasticity.jl
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ function solve()

## Newton-Raphson loop
NEWTON_TOL = 1 # 1 N
print("\n Starting Netwon iterations:\n")
print("\n Starting Newton iterations:\n")

for timestep in 1:n_timesteps
t = timestep # actual time (used for evaluating d-bndc)
Expand Down
2 changes: 1 addition & 1 deletion docs/src/topics/assembly.md
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ insert all elements of `Ke` in one go instead of having to lookup locations rand

First we will compare the four functions above for a single assembly operation, i.e.
inserting one local matrix into the global matrix. For this we simply create a random local
matrix since we are not conserned with the actual values. We also pick the "middle" element
matrix since we are not concerned with the actual values. We also pick the "middle" element
and extract the dofs for that element. Finally, an assembler is created with
`start_assemble` to use with the fourth strategy.

Expand Down
2 changes: 1 addition & 1 deletion docs/src/topics/constraints.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ of equations:
```

The reduced system of equations can used to solve for ``\boldsymbol{a}_f``, which can then
be used to calculate the dependent DoFs. Ferrite has functionaliy for setting up the
be used to calculate the dependent DoFs. Ferrite has functionally for setting up the
``\hat{\boldsymbol{K}}`` and ``\hat{\boldsymbol{f}}`` in an efficient way.

!!! note "Limitations"
Expand Down
2 changes: 1 addition & 1 deletion src/Dofs/ConstraintHandler.jl
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ by the FE approximation on the facet, ``\Gamma^f``. The arguments to the functio
the coordinate, ``\boldsymbol{x}``, the time, ``t``, and the facet normal, ``\boldsymbol{n}``.
The quadrature rule is automatically created, but the default order, `qr_order = 2 * ip_order`
(may be refined in future releases),
where `ip_order` is the order of the interpolation, can be overrided if desired.
where `ip_order` is the order of the interpolation, can be overridden if desired.

# H(div) interpolations
For H(div), we want to prescribe the normal flux, ``q_\mathrm{n} = f(\boldsymbol{x}, t, \boldsymbol{n})``.
Expand Down
2 changes: 1 addition & 1 deletion src/FEValues/CellValues.jl
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ single function interpolation as their `FunctionValues` are aliased.
**Arguments:**
* `T`: an optional argument (default to `Float64`) to determine the type the internal data is stored as.
* `quad_rule`: an instance of a [`QuadratureRule`](@ref)
* `func_interpols`: A named tuple with entires of type `Interpolation`, used to interpolate the approximated function identified by the key in `func_interpols`
* `func_interpols`: A named tuple with entries of type `Interpolation`, used to interpolate the approximated function identified by the key in `func_interpols`
* `geom_interpol`: an optional instance of a [`Interpolation`](@ref) which is used to interpolate the geometry.
By default linear Lagrange interpolation is used. For embedded elements the geometric interpolations should
be vectorized to the spatial dimension.
Expand Down
2 changes: 1 addition & 1 deletion src/Grid/topology.jl
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ _get_facet_facet_neighborhood(t::ExclusiveTopology, #=rdim=# ::Val{1}) = t.verte
_get_facet_facet_neighborhood(t::ExclusiveTopology, #=rdim=# ::Val{2}) = t.edge_edge_neighbor
_get_facet_facet_neighborhood(t::ExclusiveTopology, #=rdim=# ::Val{3}) = t.face_face_neighbor
function _get_facet_facet_neighborhood(::ExclusiveTopology, #=rdim=# ::Val{:mixed})
throw(ArgumentError("get_facet_facet_neightborhood is only supported for grids containing cells with the same reference dimension.
throw(ArgumentError("get_facet_facet_neighborhood is only supported for grids containing cells with the same reference dimension.
Access the `vertex_vertex_neighbor`, `edge_edge_neighbor`, or `face_face_neighbor` fields explicitly instead."))
end

Expand Down
2 changes: 1 addition & 1 deletion src/Quadrature/gaussquad_tri_table.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Order 1 to 8 heights points / wheights have been suggested in
# Orders 1 to 8 have been suggested in
# Dunavant, D. A. (1985), High degree efficient symmetrical Gaussian quadrature
# rules for the triangle. Int. J. Numer. Meth. Engng., 21: 1129–1148. doi:
# 10.1002/nme.1620210612
Expand Down
6 changes: 3 additions & 3 deletions test/test_cellvalues.jl
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ end
end

# Check if the non-linear mapping is correct
# Only do this for one interpolation becuase it relise on AD on "iterative function"
# Only do this for one interpolation because it relies on AD on "iterative function"
if scalar_interpol === Lagrange{RefQuadrilateral, 2}()
coords_nl = [x + rand(x) * 0.01 for x in coords] # add some displacement to nodes
reinit!(cv, coords_nl)
Expand Down Expand Up @@ -193,7 +193,7 @@ end
ip_geo = geometric_interpolation(CT)
RefShape = Ferrite.getrefshape(ip_fun)
x_ref = Ferrite.reference_coordinates(ip_geo)
# Random cell coordinates, but small pertubation to ensure 1-1 mapping.
# Random cell coordinates, but small perturbation to ensure 1-1 mapping.
cell_coords = (1 .+ rand(length(x_ref)) / 10) .* x_ref

function calculate_value_differentiable(ξ::Vec; i = 1)
Expand Down Expand Up @@ -303,7 +303,7 @@ end
# Reinitialization
cell = Quadrilateral((1, 2, 3, 4))
ref_coords = Ferrite.reference_coordinates(Ferrite.geometric_interpolation(cmv))
x = map(xref -> xref + rand(typeof(xref)) / 5, ref_coords) # Random pertubation
x = map(xref -> xref + rand(typeof(xref)) / 5, ref_coords) # Random perturbation
reinit!.((cvu, cvp, cmv, cmv_u, cmv3), (x,))
reinit!.((cvrt, cmv_rt), (cell,), (x,))

Expand Down
2 changes: 1 addition & 1 deletion test/test_facevalues.jl
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
end

# Check if the non-linear mapping is correct
# Only do this for one interpolation becuase it relise on AD on "iterative function"
# Only do this for one interpolation because it relies on AD on "iterative function"
if scalar_interpol === Lagrange{RefQuadrilateral, 2}()
coords_nl = [x + rand(x) * 0.01 for x in coords] # add some displacement to nodes
reinit!(fv, coords_nl, facet)
Expand Down
2 changes: 1 addition & 1 deletion test/test_grid_addboundaryset.jl
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@
@test extractboundary(grid, topology) == extractboundarycheck(grid)

filter_function(x) = x[1] > 0
# Test that the sets are actually addeed to the grid's dict
# Test that the sets are actually added to the grid's dict
addboundaryvertexset!(grid, topology, "test_boundary_vertexset", filter_function)
@test getvertexset(grid, "test_boundary_vertexset") == Ferrite.create_boundaryvertexset(grid, topology, filter_function)
addboundaryfacetset!(grid, topology, "test_boundary_facetset", filter_function)
Expand Down
4 changes: 2 additions & 2 deletions test/test_interpolations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ end
RannacherTurek{RefQuadrilateral, 1}(),
RannacherTurek{RefHexahedron, 1}(),
)
# Standard test all base interpolations must fullfill
# Standard test all base interpolations must fulfill
test_interpolation_properties(interpolation)

ref_dim = Ferrite.getrefdim(interpolation)
Expand Down Expand Up @@ -580,7 +580,7 @@ end
_facet_poly_order(ip::Nedelec) = Ferrite.getorder(ip) - 1
_facet_poly_order(ip::RaviartThomas) = Ferrite.getorder(ip) - 1
_facet_poly_order(ip::BrezziDouglasMarini) = Ferrite.getorder(ip)
# Based on this order, p_facet, we expect that we should fullfill different criteria.
# Based on this order, p_facet, we expect that we should fulfill different criteria.
# * If we prescribe a polynomial function to ProjectedDirichlet with a lower or equal order
# than p_facet, we expect that the interpolation should match the provided function pointwise.
# * If we prescribe a polynomial function with higher order, but lower order than what the quadrature
Expand Down
4 changes: 2 additions & 2 deletions test/test_vtk_export.jl
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@
rm(dofhandlerfilename * ".vtu")
rm(dofhandler_views_filename * ".vtu")
end
@testset "discontinous_projection" begin
@testset "discontinuous_projection" begin
mktempdir() do tmp
grid = generate_grid(Quadrilateral, (2, 2), Vec{2}((0.0, 0.0)), Vec{2}((1.0, 1.0)))
qr = QuadratureRule{RefQuadrilateral}(2)
Expand All @@ -227,7 +227,7 @@
end
end
end
@testset "discontinous_embedded" begin
@testset "discontinuous_embedded" begin
mktempdir() do tmp
grid = generate_grid(Line, (2,), Vec((0.0, 0.0)), Vec((1.0, 0.5)))

Expand Down