From 00495a65e42a5881fe598d092d16c7bee7870211 Mon Sep 17 00:00:00 2001 From: Daniel Runge Date: Wed, 2 Oct 2024 15:07:55 +0200 Subject: [PATCH] started adding extension for interpolating ExtendableFEM vectors into edgevelocities --- Project.toml | 7 +++++++ ext/VoronoiFVMExtendableFEMBaseExt.jl | 11 +++++++++++ src/vfvm_formfactors.jl | 8 ++++---- 3 files changed, 22 insertions(+), 4 deletions(-) create mode 100644 ext/VoronoiFVMExtendableFEMBaseExt.jl diff --git a/Project.toml b/Project.toml index 022d5d62a..078c16550 100644 --- a/Project.toml +++ b/Project.toml @@ -28,12 +28,19 @@ StaticArrays = "90137ffa-7385-5640-81b9-e52037218182" Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2" Symbolics = "0c5d862f-8b57-4792-8d23-62f2024744c7" +[weakdeps] +ExtendableFEMBase = "12fb9182-3d4c-4424-8fd1-727a0899810c" + +[extensions] +VoronoiFVMExtendableFEMBaseExt = "ExtendableFEMBase" + [compat] BandedMatrices = "0.17,1" Colors = "0.12" CommonSolve = "0.2" DiffResults = "1" DocStringExtensions = "0.8,0.9" +ExtendableFEMBase = "0.7.0" ExtendableGrids = "1.9.2" ExtendableSparse = "1.5.1" ForwardDiff = "0.10.35" diff --git a/ext/VoronoiFVMExtendableFEMBaseExt.jl b/ext/VoronoiFVMExtendableFEMBaseExt.jl new file mode 100644 index 000000000..4c44206c0 --- /dev/null +++ b/ext/VoronoiFVMExtendableFEMBaseExt.jl @@ -0,0 +1,11 @@ +module VoronoiFVMExtendableFEMBaseExt + +using VoronoiFVM +using ExtendableFEMBase +using ExtendableGrids + +function VoronoiFVM.integrate(coord_system::Union{Cartesian2D,Cylindrical2D},p1,p2,hnormal,fevec::FEVectorBlock; interpolate_eps=1.0e-12, kwargs...) + println("Ja, hallo! Hier sind die kwargs: $(kwargs...)") +end + +end \ No newline at end of file diff --git a/src/vfvm_formfactors.jl b/src/vfvm_formfactors.jl index 9ffad92fb..c954df3ed 100644 --- a/src/vfvm_formfactors.jl +++ b/src/vfvm_formfactors.jl @@ -326,7 +326,7 @@ end # # TODO: this should be generalized for more quadrules # -function integrate(::Type{<:Cartesian2D}, coordl, coordr, hnormal, velofunc) +function integrate(::Type{<:Cartesian2D}, coordl, coordr, hnormal, velofunc; kwargs...) wl = 1.0 / 6.0 wm = 2.0 / 3.0 wr = 1.0 / 6.0 @@ -337,7 +337,7 @@ function integrate(::Type{<:Cartesian2D}, coordl, coordr, hnormal, velofunc) return (wl * vxl + wm * vxm + wr * vxr) * hnormal[1] + (wl * vyl + wm * vym + wr * vyr) * hnormal[2] end -function integrate(::Type{<:Cylindrical2D}, coordl, coordr, hnormal, velofunc) +function integrate(::Type{<:Cylindrical2D}, coordl, coordr, hnormal, velofunc; kwargs...) wl = 1.0 / 6.0 wm = 2.0 / 3.0 wr = 1.0 / 6.0 @@ -367,7 +367,7 @@ $(SIGNATURES) Project velocity onto grid edges, """ -function edgevelocities(grid, velofunc) +function edgevelocities(grid, velofunc; kwargs...) @assert dim_space(grid) < 3 cn = grid[CellNodes] @@ -404,7 +404,7 @@ function edgevelocities(grid, velofunc) p2 .= 0.5 * (coord[:, K] + coord[:, L]) end hnormal = coord[:, K] - coord[:, L] - velovec[iedge] = integrate(coord_system, p1, p2, hnormal, velofunc) + velovec[iedge] = integrate(coord_system, p1, p2, hnormal, velofunc; kwargs...) end end return velovec