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

WIP: New vector interpolations and mappings #798

Draft
wants to merge 168 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 84 commits
Commits
Show all changes
168 commits
Select commit Hold shift + click to select a range
c44c02d
Introduce FunctionValues and GeometryValues
KnutAM Jul 12, 2023
1d1f7c6
Add benchmark and temporarily support renamed old types
KnutAM Jul 12, 2023
92b9779
Fix inline annotation for julia 1.6 ?
KnutAM Jul 12, 2023
8fef34d
Move callsite inline to function definitions
KnutAM Jul 12, 2023
506a6f7
Fix shell example, used internals of cellvalues
KnutAM Jul 12, 2023
d2eda0f
Use FunctionValues in FaceValues too
KnutAM Jul 12, 2023
744ba44
Use get_x_values for facevalues
KnutAM Jul 18, 2023
5cb7052
Initial work - some ex works, not all tests
KnutAM Aug 11, 2023
bb47cdb
Fix construction of FaceValues
KnutAM Aug 12, 2023
7ae714e
Trying out to get RT working
KnutAM Aug 28, 2023
7f484eb
Add definition of positive faces and edges
KnutAM Aug 28, 2023
ec6e21a
Finish merge
KnutAM Sep 16, 2023
6daaf65
Fix show to old values
KnutAM Sep 16, 2023
2a6aee0
Seemingly working triangle and nedelec
KnutAM Sep 18, 2023
ac04724
Add notes for new iterator
KnutAM Sep 19, 2023
4994e6e
Generalize and support 2nd order Nedelec on triangle
KnutAM Sep 20, 2023
f62961c
Add citation from master
KnutAM Sep 20, 2023
eeb1245
Empty cell_values.jl
KnutAM Sep 20, 2023
d89b268
Merge master
KnutAM Sep 20, 2023
6f7f988
Use mapping requirement info in GeometryValues
KnutAM Sep 20, 2023
f1020f3
Add test for gradient and continuity of Nedelec
KnutAM Sep 21, 2023
02051ee
Basic RaviartThomas implementation, gradient mapping seems to have an…
KnutAM Sep 21, 2023
df83ae8
Fix error in ContravariantPiolaMapping gradient calculation
KnutAM Sep 22, 2023
c4e1d63
Reenable tests, setup tmp ci, add mapping desc to devdocs
KnutAM Sep 23, 2023
562041a
bijective to diffeomorphic in theory section
KnutAM Sep 25, 2023
cf44f6c
Work on maxwell eigenproblem, but doesn't give correct results
KnutAM Sep 27, 2023
bafd9ce
Remove unintended comments
KnutAM Oct 3, 2023
eed2740
Create mixed formulation, RaviartThomas example
KnutAM Oct 7, 2023
026c753
Update docs manifest
KnutAM Oct 7, 2023
25ddd17
Merge master
KnutAM Oct 7, 2023
4df280e
Instantiate new Manifest
KnutAM Oct 7, 2023
2557b3e
Correct Manifest update oopsi
KnutAM Oct 7, 2023
27a22cc
Update examples to calculate flux
KnutAM Oct 7, 2023
3facc07
Change parameterization and fix test tolerances
KnutAM Oct 7, 2023
a6e4505
Relax type-constraints in GeometryValues and FunctionValues
KnutAM Oct 8, 2023
85bf3f7
Create extra titles for heat eq modifications
KnutAM Oct 8, 2023
06a097d
Use RequiresHessian in CellValues, and comment out unused future func…
KnutAM Oct 8, 2023
bcb25d3
Fix copy for CellValues and FaceValues
KnutAM Oct 8, 2023
5c33c5b
Fix show of values
KnutAM Oct 8, 2023
8b16b97
Fix test on julia 1.6
KnutAM Oct 8, 2023
ab28d25
Relax tolerance for gradient check a bit
KnutAM Oct 8, 2023
d5f7191
Move to old files
KnutAM Oct 8, 2023
7f17ffe
Rename files
KnutAM Oct 8, 2023
fbed8e5
Move includes to top level
KnutAM Oct 8, 2023
7bbc5e4
Remove unused example files and notes
KnutAM Oct 8, 2023
d322caf
Rename back and re-add docstrings
KnutAM Oct 8, 2023
8384d01
Remove CairoMakie from docs
KnutAM Oct 8, 2023
97eebbe
Add better error message if sdim don't match during reinit
KnutAM Oct 8, 2023
0cee936
Docfixes
KnutAM Oct 8, 2023
90ccab1
Show check for triangle mesh for the heat equation
KnutAM Oct 8, 2023
3f6cd9b
Remove benchmark script
KnutAM Oct 8, 2023
3aad963
Generalize example to try with 2nd order Lagrange
KnutAM Oct 8, 2023
0668d46
Rename GeometryValues -> GeometryMapping
KnutAM Oct 13, 2023
cf5d398
Correct i to alpha in mapping documentation
KnutAM Oct 13, 2023
2c67048
Add white background to make visible in dark mode
KnutAM Oct 13, 2023
6141453
Add error if cell===nothing for non-identity mappings
KnutAM Oct 13, 2023
35e8790
Move mapping docs to topics and add walkthrough of SimpleCellValues
KnutAM Oct 13, 2023
c76c0af
Add performance annotations and rename checkface to boundscheck_face
KnutAM Oct 13, 2023
b5e4121
Improve PointValues constructor from CellValues
KnutAM Oct 13, 2023
089c42a
Use internal functions for geometric ip when testing cellvalues
KnutAM Oct 13, 2023
07e3851
Add devdocs, other docfixes, and fallback for shape value and gradien…
KnutAM Oct 13, 2023
f3e6564
Fix so that API docs for FEValues is ok again
KnutAM Oct 13, 2023
f5c662c
Rename xx_values.jl to XxValues.jl
KnutAM Oct 13, 2023
f9e9aa5
Rename at include too
KnutAM Oct 13, 2023
c418594
Merge docs/Manifest from master
KnutAM Oct 13, 2023
d47ae33
Minor formatting fixes according to review
KnutAM Oct 13, 2023
b508556
Forgot rename of type param
KnutAM Oct 13, 2023
3805c6c
Merge master
KnutAM Oct 16, 2023
4451fac
Use new functions
KnutAM Oct 16, 2023
72e4404
Update docs manifest
KnutAM Oct 16, 2023
3049dc4
Move svg to gh-pages
KnutAM Oct 21, 2023
24591b5
Use shape_x_x_and_x instead of precompute_values
KnutAM Oct 21, 2023
9dfceeb
Reintroduce precompute_values
KnutAM Oct 21, 2023
ea7e33e
Fix test of show
KnutAM Oct 21, 2023
1a7e9c9
Remove unused internal methods
KnutAM Oct 21, 2023
41ae092
Test error paths
KnutAM Oct 21, 2023
9b020da
Remove unused test-code
KnutAM Oct 21, 2023
00e2e4f
Test show(::PointValues)
KnutAM Oct 21, 2023
09cf607
Fix test of show(::PointValues)
KnutAM Oct 21, 2023
43970f3
Remove unused methods
KnutAM Oct 21, 2023
005659a
Grammar and stylistic fixes
KnutAM Oct 23, 2023
69b50b4
Add further devdoc explanations
KnutAM Oct 23, 2023
f829e88
Describe FEValues interface
KnutAM Nov 4, 2023
d4c36c2
Delete checkquadpoint method that causes illegal (at)inbounds
KnutAM Nov 4, 2023
2550a75
Fix typo in devdocs
KnutAM Nov 4, 2023
acefcde
Add type specification to shape_value and shape_gradient docstring spec
KnutAM Nov 5, 2023
94c174f
Testing it out
KnutAM Nov 10, 2023
c36ffda
Passing tests
KnutAM Nov 11, 2023
4ab9ba2
Fix performance annotations to come on par with master
KnutAM Nov 11, 2023
cc0c806
Move utils to common_values
KnutAM Nov 21, 2023
e109c9b
Remove PointValuesInternal
KnutAM Nov 21, 2023
34beb70
Fix test
KnutAM Nov 21, 2023
05fab53
Add custom values instructions to devdocs
KnutAM Nov 22, 2023
be6daf8
Add test that check instructions in devdocs for custom FEValues
KnutAM Nov 22, 2023
66bf56d
Address Dennis' comments on SimpleCellValues
KnutAM Nov 24, 2023
b31e821
Address Dennis' comments on common values
KnutAM Nov 24, 2023
0bbc09d
Simplifications
KnutAM Dec 1, 2023
ae80cfb
Fix PointValues usage in PointEvalHandler
KnutAM Dec 3, 2023
810e5d8
Merge master
KnutAM Dec 3, 2023
1d5b9f1
Fix tests after merge
KnutAM Dec 3, 2023
7ea7fbf
Merge branch 'kam/dev/FVG' into kam/FunctionValuesGeneralization
KnutAM Dec 3, 2023
76a9312
Fix missing double-comment for literate
KnutAM Dec 3, 2023
679a4ac
Improved naming/interfaces
KnutAM Dec 3, 2023
a913c9b
Fix formatting of SimpleCellValues example
KnutAM Dec 3, 2023
8b6c097
Simplify text in SimpleCellValues example
KnutAM Dec 3, 2023
96a9766
Consistent code formatting and minimize diff
KnutAM Dec 3, 2023
a807738
Removed wrong whitespace
KnutAM Dec 3, 2023
9833fe8
Use sprint(show, ...) instead of helper fun for testing
KnutAM Dec 4, 2023
c76b57f
Use (at)eval instead of eval(quote
KnutAM Dec 4, 2023
6fe3fc6
Include missed code from master merge
KnutAM Dec 4, 2023
7d497d0
Change order or args for reinit
KnutAM Dec 4, 2023
86655d9
Fix errors due to changed order
KnutAM Dec 4, 2023
8f16066
Update docstrings to new order in reinit
KnutAM Dec 4, 2023
08a67af
Change input kwargs
KnutAM Dec 4, 2023
be5d910
Simplify code for FunctionValues construction
KnutAM Dec 4, 2023
41c92c4
Fix order of args
KnutAM Dec 4, 2023
36c018e
More logic if in FunctionValues
KnutAM Dec 4, 2023
c7d7a0e
Remove use of (at)eval and be explicit instead
KnutAM Dec 5, 2023
65e916e
Remove credit from SimpleCellValues literate
KnutAM Dec 5, 2023
8faecd4
Parse the generated file and return the MD string to show it
KnutAM Dec 5, 2023
5c75770
Apply review suggestions
KnutAM Dec 6, 2023
b3ce313
Fix type instability in point eval
KnutAM Dec 6, 2023
2cbd2b9
Include cell in interface reinits
KnutAM Dec 6, 2023
8df8d52
Merge branch 'master' into kam/FunctionValuesGeneralization
KnutAM Dec 6, 2023
3da6bf0
Add 2nd order RT ip on triangle
KnutAM Dec 6, 2023
7170f49
Merge master
KnutAM Dec 6, 2023
2710cbb
Use old naming
KnutAM Dec 6, 2023
988f916
Add files forgotten to save
KnutAM Dec 6, 2023
3a62893
merge
KnutAM Dec 6, 2023
ec7b92c
Merge branch 'dev' into kam/FunctionValuesGeneralization
KnutAM Dec 6, 2023
3e57f37
Merge branch 'master' into kam/FunctionValuesGeneralization
KnutAM Dec 6, 2023
94d50f7
Merge master
KnutAM Jan 2, 2024
7e54d45
Merge branch 'master' into kam/FunctionValuesGeneralization
KnutAM Feb 28, 2024
3f5721e
Fix after merge
KnutAM Feb 28, 2024
89fe1ee
Merge branch 'master' into kam/FunctionValuesGeneralization
KnutAM Mar 21, 2024
90dbf68
Make CellCache reinit work
KnutAM Mar 21, 2024
10b2dfd
Nonworking Nedelec on Hexahedron
KnutAM Mar 21, 2024
fc38951
Fix Nedelec{3,RefHexahedron}
KnutAM Mar 22, 2024
d356a42
Add temporary visualization script and project
KnutAM Mar 22, 2024
876bea9
Disable JET testing on nightly
KnutAM Mar 22, 2024
a281994
Reenable JET, doesn't help anyways
KnutAM Mar 22, 2024
230864a
Add grid pertubations to interpolation tests
KnutAM Mar 22, 2024
f2278e0
Add tests for basic properties and fullfill them
KnutAM Mar 22, 2024
714d67c
Merge branch 'master' into kam/FunctionValuesGeneralization
KnutAM Apr 25, 2024
1bfec52
Merge master
KnutAM Aug 18, 2024
4567f0c
Fix merge errors
KnutAM Aug 19, 2024
c054b8e
Merge master
KnutAM Oct 18, 2024
bb1eea5
Merge branch 'master' into kam/FunctionValuesGeneralization
KnutAM Oct 29, 2024
d2a9699
Add some refs
KnutAM Oct 29, 2024
d26c168
Merge master
KnutAM Oct 31, 2024
35529ec
Fix formatting using pre-commit
KnutAM Oct 31, 2024
fa2a317
Started adding BrezziDouglasMarini
KnutAM Nov 1, 2024
a696fe0
Fix BrezziDouglasMarini
KnutAM Nov 12, 2024
80f5b25
Work through tutorial
KnutAM Nov 12, 2024
1ccbb56
Merge branch 'master' into kam/FunctionValuesGeneralization
KnutAM Nov 12, 2024
c60e530
Clean and run runic
KnutAM Nov 12, 2024
c26cad6
Fix link and imports
KnutAM Nov 12, 2024
e0935dd
Add nonworking maxwell eigenvalues example
KnutAM Nov 13, 2024
f0a8d1b
Reduce elements in hdiv example
KnutAM Nov 13, 2024
5140c98
Disable failing Maxwell eigenvalue solve
KnutAM Nov 13, 2024
7911cbd
Add test for correct BC indices, non-homogeneous not yet working
KnutAM Nov 14, 2024
e810a69
Merge branch 'kam/FunctionValuesGeneralization' of github.com:Ferrite…
KnutAM Nov 14, 2024
01a8306
Reenable tests
KnutAM Nov 14, 2024
508eec7
Improve tutorial formatting
KnutAM Nov 15, 2024
5ebcccf
Add link to potential test case to check for maxwell problem
KnutAM Nov 15, 2024
5c18450
WIP
KnutAM Nov 20, 2024
35eec64
Make Dirichlet for single shape fun per edge work
KnutAM Nov 22, 2024
f5f3f97
Working DBC for Nedelec/RT/BDM (triangles)
KnutAM Nov 22, 2024
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: 3 additions & 3 deletions benchmark/helper.jl
Original file line number Diff line number Diff line change
Expand Up @@ -66,17 +66,17 @@ function _generalized_ritz_galerkin_assemble_local_matrix(grid::Ferrite.Abstract
end

# Minimal Petrov-Galerkin type local assembly loop. We assume that both function spaces share the same integration rule. Test is applied from the left.
function _generalized_petrov_galerkin_assemble_local_matrix(grid::Ferrite.AbstractGrid, cellvalues_shape::CellValues{<: Ferrite.InterpolationByDim{dim}}, f_shape, cellvalues_test::CellValues{<: Ferrite.InterpolationByDim{dim}}, f_test, op) where {dim}
function _generalized_petrov_galerkin_assemble_local_matrix(grid::Ferrite.AbstractGrid, cellvalues_shape::CellValues, f_shape, cellvalues_test::CellValues, f_test, op)
n_basefuncs_shape = getnbasefunctions(cellvalues_shape)
n_basefuncs_test = getnbasefunctions(cellvalues_test)
Ke = zeros(n_basefuncs_test, n_basefuncs_shape)

#implicit assumption: Same geometry!
X_shape = zeros(Vec{dim,Float64}, Ferrite.getngeobasefunctions(cellvalues_shape))
X_shape = zeros(get_coordinate_type(grid), Ferrite.getngeobasefunctions(cellvalues_shape))
getcoordinates!(X_shape, grid, 1)
reinit!(cellvalues_shape, X_shape)

X_test = zeros(Vec{dim,Float64}, Ferrite.getngeobasefunctions(cellvalues_test))
X_test = zeros(get_coordinate_type(grid), Ferrite.getngeobasefunctions(cellvalues_test))
getcoordinates!(X_test, grid, 1)
reinit!(cellvalues_test, X_test)

Expand Down
130 changes: 73 additions & 57 deletions docs/Manifest.toml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions docs/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Optim = "429524aa-4258-5aef-a3af-852621145aeb"
OrdinaryDiffEq = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed"
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
ProgressMeter = "92933f4c-e287-5a05-a399-4b506db050ca"
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
Tensors = "48a634ad-e948-5137-8d70-aa71f2a747f4"
TimerOutputs = "a759f4b9-e2f1-59dc-863e-4aeb61b1ea8f"
UnPack = "3a884ed6-31ef-47d7-9d2a-63182c4928ed"
3 changes: 3 additions & 0 deletions docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ bibtex_plugin = CitationBibliography(
"Tutorials" => [
"Tutorials overview" => "tutorials/index.md",
"tutorials/heat_equation.md",
"tutorials/heat_equation_rt.md",
"tutorials/heat_equation_triangle.md",
"tutorials/linear_elasticity.md",
"tutorials/incompressible_elasticity.md",
"tutorials/hyperelasticity.md",
Expand All @@ -61,6 +63,7 @@ bibtex_plugin = CitationBibliography(
"Topic guides" => [
"Topic guide overview" => "topics/index.md",
"topics/fe_intro.md",
"topics/FEValues.md",
"topics/degrees_of_freedom.md",
"topics/assembly.md",
"topics/boundary_conditions.md",
Expand Down
11 changes: 10 additions & 1 deletion docs/src/assets/references.bib
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,15 @@ @article{Scroggs2022
@phdthesis{Cenanovic2017,
author={Mirza Cenanovic},
title={Finite element methods for surface problems},
school={J\o{}pk\o{}ping University, School of Engineering},
school={Jönköping University, School of Engineering},
year=2017
}
@misc{Kirby2017,
title={A general approach to transforming finite elements},
author={Robert C. Kirby},
year={2017},
eprint={1706.09017},
doi={10.48550/arXiv.1706.09017},
archivePrefix={arXiv},
primaryClass={math.NA}
}
42 changes: 42 additions & 0 deletions docs/src/devdocs/FEValues.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# [FEValues](@id devdocs-fevalues)

## Type definitions
* `AbstractValues`
* `AbstractCellValues`
* [`CellValues`](@ref)
* `AbstractFaceValues`
* [`FaceValues`](@ref)
* [`PointValues`](@ref)
* `PointValuesInternal` (Optimized version of PointValues)

## Internal types
```@docs
Ferrite.GeometryMapping
Ferrite.MappingValues
Ferrite.FunctionValues
```

## How CellValues and FaceValues works
* The function interpolation, `ip_fun`, determines how it should be mapped, by defining `get_mapping_type(ip_fun)` for its type.
* The mapping type, e.g. `IdentityMapping`, decides the requirements for `GeometryValues`, specifically if the `hessian` $\partial^2M/\partial\xi^2$,
of the geometric shape functions, $M(\xi)$, on the reference cell should be precalculated or not.
***Note:*** *This should also in the future be determined by the required order of derivatives to be mapped in `FunctionValues`*
* As the first part of `reinit!`, the `MappingValues` are calculated based on the cell's coordinates. If the `GeometricMapping` contains the hessian
on the reference cell, the `hessian` on the actual cell, $\partial^2M/\partial x^2$, is calculated and returned in `MappingValues`. Otherwise, only
the jacobian, $\partial M/\partial x$, is calculated.
* In the second part of `reinit!`, The `MappingValues`, containing sufficient information for the current quadrature point, is given to `apply_mapping!`.
This allows the shape values and gradients stored in `FunctionValues`, to be mapped to the current cell by calling `apply_mapping!`.

## Custom FEValues
Custom FEValues, `fe_v`, should normally implement the `reinit!` method.
Additionally, for normal functionality the `getnquadpoints` should be implemented.
Note that asking for the `n`th quadrature point must be inside array bounds if
`1<=n<:getnquadpoints(fe_v)`
KnutAM marked this conversation as resolved.
Show resolved Hide resolved
(`checkquadpoint` can, alternatively, be dispatched to check that `n` is inbounds.)

Supporting `function_value`, `function_gradient`, `function_symmetric_gradient`, `function_divergence`, and `function_curl`,
termi-official marked this conversation as resolved.
Show resolved Hide resolved
requires implementing `getnbasefunctions`, `shape_value`, and `shape_gradient`.
termi-official marked this conversation as resolved.
Show resolved Hide resolved
Note that asking for the `i`th shape value or gradient must be inside array bounds if `1<=i<:getnbasefunctions(fe_v)`

Supporting `spatial_coordinate` requires implementing `getngeobasefunctions` and `geometric_value`.
termi-official marked this conversation as resolved.
Show resolved Hide resolved
Note that asking for the `i`th geometric value must be inside array bounds if `1<=i<:getngeobasefunctions(fe_v)`
2 changes: 1 addition & 1 deletion docs/src/devdocs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ developing the library.

```@contents
Depth = 1
Pages = ["reference_cells.md", "interpolations.md", "elements.md", "dofhandler.md", "performance.md"]
Pages = ["reference_cells.md", "interpolations.md", "elements.md", "FEValues.md", "dofhandler.md", "performance.md"]
```
1 change: 1 addition & 0 deletions docs/src/devdocs/interpolations.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ Ferrite.reference_coordinates(::Interpolation)
Ferrite.face_to_element_transformation
Ferrite.is_discontinuous(::Interpolation)
Ferrite.adjust_dofs_during_distribution(::Interpolation)
Ferrite.get_mapping_type
```

for all entities which exist on that reference element. The dof functions default to having no
Expand Down
2 changes: 1 addition & 1 deletion docs/src/literate-howto/postprocessing.jl
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ include("../tutorials/heat_equation.jl");
# Next we define a function that computes the heat flux for each integration point in the domain.
# Fourier's law is adopted, where the conductivity tensor is assumed to be isotropic with unit
# conductivity ``\lambda = 1 ⇒ q = - \nabla u``, where ``u`` is the temperature.
function compute_heat_fluxes(cellvalues::CellValues{<:ScalarInterpolation}, dh::DofHandler, a::AbstractVector{T}) where T
function compute_heat_fluxes(cellvalues::CellValues, dh::DofHandler, a::AbstractVector{T}) where T

n = getnbasefunctions(cellvalues)
cell_dofs = zeros(Int, n)
Expand Down
Loading