-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add interpolation support for Helmholtz RHS
This commit enables support of primal piecewise linear and primal piecewise constant RHSs TODO: Probably, either an extension or a rewrite of DofInterpolate is advisable for the LagrangeBasis (for example, also dealing with higher-order functions and dual functions)
- Loading branch information
Showing
3 changed files
with
94 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
using BEAST | ||
using CompScienceMeshes | ||
using Test | ||
|
||
Γ = meshrectangle(1.0, 1.0, 0.4) | ||
|
||
XN = lagrangecxd0(Γ) # lagrangec0d1(Γₑ₁; dirichlet=true) # Dirichlet=true -> no boundary function | ||
XD = lagrangec0d1(Γ) | ||
|
||
mp = Helmholtz3D.monopole(position=SVector(0.0, 0.0, 3.0)) | ||
gradmp = grad(mp) | ||
|
||
φ = DofInterpolate(XD, mp) | ||
|
||
@test eltype(φ) == Float64 | ||
|
||
for i in eachindex(φ) | ||
@test mp(XD.pos[i]) == φ[i] | ||
end | ||
|
||
σ = DofInterpolate(XN, gradmp) | ||
|
||
@test eltype(σ) == Float64 | ||
|
||
for i in eachindex(σ) | ||
# Orientation of meshrectangle is in -z direction | ||
@test dot(SVector(0.0, 0.0, -1.0), gradmp(XN.pos[i])) == σ[i] | ||
end |