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

[BREAKING] Embedded elements #651

Merged
merged 32 commits into from
May 19, 2023
Merged
Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
68757c1
Fix scalar-valued embedded elements with hotfixed everywhere else.
Mar 28, 2023
c76816f
Fix Landau example.
Mar 29, 2023
4d16276
Fix postprocessing example.
Mar 29, 2023
a19508a
Add some patchwork to separate the different dimensions in CellValues.
termi-official Apr 12, 2023
56a8052
Merge branch 'master' into do/fix-surface-elements
termi-official Apr 12, 2023
4fed410
Roll back section reordering.
termi-official Apr 12, 2023
32a459e
Add changelog notes.
termi-official Apr 12, 2023
e576fed
Fix CI.
termi-official Apr 12, 2023
1ea47c3
Fix performance regression.
termi-official Apr 12, 2023
c939271
Fix interface regression.
termi-official Apr 12, 2023
14f12d0
Update tests to intermediate interface.
termi-official Apr 12, 2023
8532cf5
Merge and document reinits for embedded elements.
termi-official Apr 12, 2023
de9947c
Some extra docs.
termi-official Apr 12, 2023
534b513
Move vdim to the front for CellVectorValues and reorder docstrings to…
termi-official Apr 13, 2023
2d52d22
Merge branch 'master' into do/fix-surface-elements
termi-official May 9, 2023
24d159f
Merge branch 'master' into do/fix-surface-elements
termi-official May 9, 2023
f16d27b
Clarify breaking change.
termi-official May 9, 2023
9e9fce3
Merge branch 'master' into do/fix-surface-elements
termi-official May 16, 2023
f96b001
Fix merge.
termi-official May 16, 2023
2c8e988
Move inner constructors out of FEValues.
termi-official May 17, 2023
2a3516c
Merge branch 'master' into do/fix-surface-elements
termi-official May 17, 2023
835bf5b
Fix test.
termi-official May 17, 2023
8b68108
Update new cell values interface to new shape interface.
termi-official May 17, 2023
bc0b850
Update docstrings.
termi-official May 17, 2023
0c4899e
Partial update of shell example
termi-official May 17, 2023
291fafb
Fix embedded vectorized interpolations.
fredrikekre May 19, 2023
3bc1225
Minor cleanups, always use S(Vector|Matrix) when possible
fredrikekre May 19, 2023
36cd099
Some more cleanup
fredrikekre May 19, 2023
c4c0d29
Use vectorized geometric interpolation to specify embedding dimension
fredrikekre May 19, 2023
ff81ee5
enable more vdims
fredrikekre May 19, 2023
137cd6c
test fixes
fredrikekre May 19, 2023
26c0048
fix
fredrikekre May 19, 2023
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
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
### Added
- `DofHandler` now supports fields on subdomains and mixed grids. ([#667][github-667])
- Support for embedded elements in `CellValues`. ([#651][github-651])
- Support for vectorized interpolations with dimension different from the spatial
dimension in `CellValues`. ([#651][github-651])
- All keyword arguments supported by `WriteVTK.jl` can be given to `vtk_grid` (only `compress` earlier) ([#687][github-687])

### Removed
- **BREAKING**: `MixedDofHandler` has been renamed to `DofHandler`. Update by replacing
`MixedDofHandler` to `DofHandler`. ([#667][github-667])

### Other improvements
- **BREAKING**: All `CellValues` have a finer granularity on the different types of
dimensions used. Custom `CellValues` and dispatches on their type parameters must be
updated to respect the new type. ([#651][github-651])

## [0.3.14] - 2023-04-03
### Added
Expand Down Expand Up @@ -416,6 +423,7 @@ poking into Ferrite internals:
[github-645]: https://github.com/Ferrite-FEM/Ferrite.jl/pull/645
[github-647]: https://github.com/Ferrite-FEM/Ferrite.jl/pull/647
[github-650]: https://github.com/Ferrite-FEM/Ferrite.jl/pull/650
[github-651]: https://github.com/Ferrite-FEM/Ferrite.jl/pull/651
[github-653]: https://github.com/Ferrite-FEM/Ferrite.jl/pull/653
[github-656]: https://github.com/Ferrite-FEM/Ferrite.jl/pull/656
[github-658]: https://github.com/Ferrite-FEM/Ferrite.jl/pull/658
Expand Down
1 change: 1 addition & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ NearestNeighbors = "b8a86587-4115-5ab1-83bc-aa920d37bbce"
Preferences = "21216c6a-2e73-6563-6e65-726566657250"
Reexport = "189a3867-3050-52da-a836-e630ba90ab69"
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
Tensors = "48a634ad-e948-5137-8d70-aa71f2a747f4"
WriteVTK = "64499a7a-5c06-52f2-abe2-ccb03c286192"

Expand Down
2 changes: 1 addition & 1 deletion docs/Manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ uuid = "29a986be-02c6-4525-aec4-84b980013641"
version = "1.2.9"

[[deps.Ferrite]]
deps = ["EnumX", "LinearAlgebra", "NearestNeighbors", "Preferences", "Reexport", "SparseArrays", "Tensors", "WriteVTK"]
deps = ["EnumX", "LinearAlgebra", "NearestNeighbors", "Preferences", "Reexport", "SparseArrays", "StaticArrays", "Tensors", "WriteVTK"]
path = ".."
uuid = "c061ca5d-56c9-439f-9c0e-210fe06d3992"
version = "0.3.14"
Expand Down
30 changes: 12 additions & 18 deletions docs/src/literate/linear_shell.jl
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ grid = generate_shell_grid(nels, size)
ip = Lagrange{RefQuadrilateral,1}()
qr_inplane = QuadratureRule{2,RefQuadrilateral}(1)
qr_ooplane = QuadratureRule{1,RefLine}(2)
cv = CellValues(qr_inplane, ip)
cv = CellValues(3, qr_inplane, ip)

# Next we distribute displacement dofs,`:u = (x,y,z)` and rotational dofs, `:θ = (θ₁, θ₂)`.
#+
Expand Down Expand Up @@ -94,11 +94,12 @@ celldofs = zeros(Int, ndofs_shell)
cellcoords = zeros(Vec{3,Float64}, nnodes)

assembler = start_assemble(K, f)
for cellid in 1:getncells(grid)
for cell in CellIterator(grid)
fill!(ke, 0.0)
reinit!(cv, cell)

celldofs!(celldofs, dh, cellid)
getcoordinates!(cellcoords, grid, cellid)
celldofs!(celldofs, dh, cellid(cell))
getcoordinates!(cellcoords, grid, cellid(cell))

#Call the element routine
integrate_shell!(ke, cv, qr_ooplane, cellcoords, data)
Expand All @@ -124,9 +125,8 @@ end; #end main functions
function generate_shell_grid(nels, size)
_grid = generate_grid(Quadrilateral, nels, Vec((0.0,0.0)), Vec(size))
nodes = [(n.x[1], n.x[2], 0.0) |> Vec{3} |> Node for n in _grid.nodes]
cells = [Quadrilateral3D(cell.nodes) for cell in _grid.cells]

grid = Grid(cells, nodes)
grid = Grid(_grid.cells, nodes)

return grid
end;
Expand Down Expand Up @@ -215,7 +215,6 @@ end;
# J_{ij} = \frac{\partial x_i}{\partial \xi_j},
# ```
function getjacobian(q, N, dNdξ, ζ, X, p, h)

J = zeros(3,3)
for a in 1:length(N)
for i in 1:3, j in 1:3
Expand Down Expand Up @@ -261,7 +260,6 @@ function strain(dofvec::Vector{T}, N, dNdx, ζ, dζdx, q, ef1, ef2, h) where T
dudx = q*dudx
ε = [dudx[1,1], dudx[2,2], dudx[1,2]+dudx[2,1], dudx[2,3]+dudx[3,2], dudx[1,3]+dudx[3,1]]
return ε

end;

# ##### Main element routine
Expand All @@ -280,31 +278,27 @@ function integrate_shell!(ke, cv, qr_ooplane, X, data)
a = Vec{3}((0.0, 0.0, 1.0))
p[i] = a/norm(a)
end

ef1, ef2, ef3 = fiber_coordsys(p)

for iqp in 1:getnquadpoints(cv)

dNdξ = cv.dNdξ[:,iqp]
N = cv.N[:,iqp]
dNdξ = cv.dNdξ[:,iqp]
dNdx = cv.dNdx[:,iqp]

for oqp in 1:length(qr_ooplane.weights)

ζ = qr_ooplane.points[oqp][1]

q = lamina_coordsys(dNdξ, ζ, X, p, h)

J = getjacobian(q, N, dNdξ, ζ, X, p, h)
Jinv = inv(J)

Jinv = inv(J)
dζdx = Vec{3}((0.0, 0.0, 1.0)) ⋅ Jinv
dNdx = [Vec{3}((dNdξ[i][1], dNdξ[i][2], 0.0)) ⋅ Jinv for i in 1:nnodes]


#For simplicity, use automatic differentiation to construct the B-matrix from the strain.
B = ForwardDiff.jacobian(
(a) -> strain(a, N, dNdx, ζ, dζdx, q, ef1, ef2, h), zeros(Float64, ndofs) )

dV = det(J) * cv.qr.weights[iqp] * qr_ooplane.weights[oqp]
dV = qr_ooplane.weights[oqp] * getdetJdV(cv, iqp)
ke .+= B'*data.C*B * dV
end
end
Expand Down
2 changes: 1 addition & 1 deletion docs/src/literate/postprocessing.jl
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ include("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, dh::DofHandler, a::AbstractVector{T}) where T
function compute_heat_fluxes(cellvalues::CellValues{<:ScalarInterpolation}, dh::DofHandler, a::AbstractVector{T}) where T

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