Skip to content

Commit

Permalink
bugfix for bfacefactors
Browse files Browse the repository at this point in the history
Nodefactors weren't created in the right sequence.
Robin  and Neuamann boundary conditions in 3D were affected
Thanks Eduard
  • Loading branch information
j-fu committed Jan 30, 2024
1 parent b79ebda commit 68561bc
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "VoronoiFVM"
uuid = "82b139dc-5afc-11e9-35da-9b9bdfd336f3"
authors = ["Jürgen Fuhrmann <[email protected]>", "Dilara Abdel", "Jan Weidner", "Alexander Seiler", "Patricio Farrell", "Matthias Liero"]
version = "1.17.0"
version = "1.17.1"

[deps]
BandedMatrices = "aae01518-5342-5314-be14-df237901396f"
Expand Down
7 changes: 4 additions & 3 deletions examples/Example311_HeatEquation_BoundaryDiffusion.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ using ExtendableGrids
"""
We solve the following system
∂_tu - εΔu = 0 in [0,T] × Ω
∂_tu - εΔu = 0 in [0,T] × Ω>
ε∇u⋅ν = k(u-v) on [0,T] × Γ_1
ε∇u⋅ν = 0 on [0,T] × (∂Ω ∖ Γ_1)
∂_tv -ε_ΓΔ_Γ v = f(x) +k(u-v) on [0,T] × Γ_1
Expand Down Expand Up @@ -106,8 +106,9 @@ end
using Test
function runtests()
testval = 1509.8109057757858
@test isapprox(main(; assembly = :edgewise), testval; rtol = 1.0e-12) &&
isapprox(main(; assembly = :cellwise), testval; rtol = 1.0e-12)
testval = 1508.582565216869
@test isapprox(main(; assembly = :edgewise), testval; rtol = 1.0e-12)
@test isapprox(main(; assembly = :cellwise), testval; rtol = 1.0e-12)
end

end
12 changes: 8 additions & 4 deletions src/vfvm_formfactors.jl
Original file line number Diff line number Diff line change
Expand Up @@ -314,15 +314,19 @@ function bfacefactors!(T::Type{Triangle2D}, ::Type{<:Cartesian3D}, coord, bfacen

d = 1.0 / (8 * vol)


# Knoten-Flaechenanteile (ohne Abschneiden)
npar[1] = (epar[3] + epar[2]) * d * 0.25
npar[2] = (epar[1] + epar[3]) * d * 0.25
npar[3] = (epar[2] + epar[1]) * d * 0.25
npar .= 0.0
for i = 1:3
npar[en[1, i]] += epar[i] * d * 0.25
npar[en[2, i]] += epar[i] * d * 0.25
end

# Kantengewichte
# Kantengewichte
epar[1] = epar[1] * d / dd[1]
epar[2] = epar[2] * d / dd[2]
epar[3] = epar[3] * d / dd[3]

nothing
end

Expand Down
28 changes: 28 additions & 0 deletions test/test_formfactors.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
module test_formfactors
using Test
using ExtendableGrids
using VoronoiFVM: cellfactors!, bfacefactors!

randpoint=rand(-10:0.01:10,2)
function ttri(;ntest=100)
cellnodes=[1 2 3;]'
icell=1
epar2d=zeros(3)
npar2d=zeros(3)
epar3d=zeros(3)
npar3d=zeros(3)
for i=1:100
coord2d=rand(-10:0.01:10,2,3)
coord3d=vcat(coord2d,[0.0,0,0]')

cellfactors!(Triangle2D,Cartesian2D,coord2d,cellnodes,1,npar2d,epar2d)
bfacefactors!(Triangle2D,Cartesian3D,coord3d,cellnodes,1,npar3d,epar3d)

@test npar3d npar2d
@test epar3d epar2d
end
end


end

2 comments on commit 68561bc

@j-fu
Copy link
Member Author

@j-fu j-fu commented on 68561bc Jan 30, 2024

Choose a reason for hiding this comment

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

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

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

Registration pull request created: JuliaRegistries/General/99808

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v1.17.1 -m "<description of version>" 68561bc4bc9707b0d0c67ae45ca2f3d49b30bb70
git push origin v1.17.1

Please sign in to comment.