Skip to content

Commit 69d08ee

Browse files
committed
Breaking revision
Cleaning up a few pain points. - Get rid of PlotsExt - Wrong sign on steadyforce - Don't allow directsolve(FSPanelSystem)
1 parent a472c83 commit 69d08ee

File tree

6 files changed

+11
-85
lines changed

6 files changed

+11
-85
lines changed

Project.toml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "NeumannKelvin"
22
uuid = "7f078b06-e5c4-4cf8-bb56-b92882a0ad03"
33
authors = ["Gabriel Weymouth"]
4-
version = "0.8.2"
4+
version = "0.9.0"
55

66
[deps]
77
AcceleratedKernels = "6a4ca0a5-0e36-4168-a932-d9be78d558f1"
@@ -25,13 +25,11 @@ TypedTables = "9d95f2ec-7b3d-5a63-8d20-e2491e220bb9"
2525
[weakdeps]
2626
Makie = "ee78f7c6-11fb-53f2-987a-cfe4a2b5a57a"
2727
NURBS = "dde13934-061e-461b-aa91-2c0fad390a0d"
28-
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
2928
GeometryBasics = "5c1252a2-5f33-56bf-86c9-59e7332b4326"
3029

3130
[extensions]
3231
NeumannKelvinMakieExt = "Makie"
3332
NeumannKelvinNURBSExt = "NURBS"
34-
NeumannKelvinPlotsExt = "Plots"
3533
NeumannKelvinGeometryBasicsExt = "GeometryBasics"
3634

3735
[compat]

ext/NeumannKelvinPlotsExt.jl

Lines changed: 0 additions & 67 deletions
This file was deleted.

src/panel_method.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ the body panel area. Computation is accelerated when Threads.nthreads()>1.
7777
7878
See also: [`cₚ`](@ref)
7979
"""
80-
steadyforce(sys;S=bodyarea(sys)) = surface_integral(cₚ,sys)/S
80+
steadyforce(sys;S=bodyarea(sys)) = -surface_integral(cₚ,sys)/S
8181
@inline function surface_integral(f,sys)
8282
init = neutral = zero(eltype(sys.body.n))
8383
AK.mapreduce(+, sys.body, AK.get_backend(sys.body.q); init, neutral) do p

src/panels.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ This function throws an error if the adaptive routine gives more than `N_max` pa
1212
function panelize(surface,u₀=0.,u₁=1.,v₀=0.,v₁=1.;hᵤ=1.,hᵥ=hᵤ,devlimit=0.05,
1313
transpose=false,flip=false,N_max=1000,verbose=false,submerge=false,T=Float64,kwargs...)
1414
# Transpose arguments u,v -> v,u
15-
transpose && return panelize((v,u)->surface(u,v),v₀,v₁,u₀,u₁,;hᵤ,hᵥ,devlimit,
15+
transpose && return panelize((v,u)->surface(u,v),v₀,v₁,u₀,u₁,;hᵤ=hᵥ,hᵥ=hᵤ,devlimit,
1616
transpose=false,flip=!flip,submerge,N_max,verbose,T,kwargs...)
1717

1818
# Check inputs and get output type

src/solvers.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,9 @@ end
4646
4747
Solve a panel system using a direct construction and solve such that the normal
4848
velocity boundary condition `∂ₙϕ(pᵢ,pⱼ)*qⱼ = -U⋅nᵢ` is satisfied on body panels.
49+
This function can not be used to solve an `FSPanelSystem`.
4950
50-
**Note**: This function does not apply the FSBC and ignores free surface panels.
51-
52-
*Note*: This function is memory (and therefore time) intensive for large number of
51+
**Note**: This function is memory (and therefore time) intensive for large number of
5352
panels N because it constructs the full N² matrix elements. It is *not* accelerated
5453
with a PanelTree, but *is* accelerated when Threads.nthreads()>1.
5554
@@ -68,8 +67,9 @@ extrema(cₚ(sys)) # measure
6867
```
6968
"""
7069
function directsolve!(sys;verbose=true)
70+
typeof(sys)<:FSPanelSystem && throw(ArgumentError("Cannot directsolve! an FSPanelSystem"))
7171
q = if verbose
72-
@warn "This routine ignores free surface panels and is memory intensive. See help?>directsolve!."
72+
@warn "This routine is memory intensive. See help?>directsolve!."
7373
@time influence(sys)\rhs(sys.body,sys.U)
7474
else
7575
influence(sys)\rhs(sys.body,sys.U)

test/runtests.jl

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -209,11 +209,6 @@ end
209209
badsurf = measure.((u,v)->SA[u,v,0],-4:1:2,(1/2:1:2)',1,1,flip=true)
210210
@test_throws ArgumentError FSPanelSystem(body,badsurf;ℓ)
211211

212-
# Direct solve ignores freesurf
213-
directsolve!(sys,verbose=false)
214-
sys2 = directsolve!(BodyPanelSystem(body,sym_axes=2),verbose=false)
215-
@test sys.body.q == sys2.body.q
216-
217212
# Setting ℓ=0 turns freesurf into reflection wall
218213
gmressolve!(sys)
219214
sys2 = gmressolve!(BodyPanelSystem(body,sym_axes=(2,3),wrap=PanelTree))
@@ -223,7 +218,7 @@ end
223218
# Setting ℓ>0 turns on freesurf, but it's slow to converge
224219
sys = FSPanelSystem(body,freesurf;sym_axes=2,ℓ,θ²=16)
225220
gmressolve!(sys,itmax=160) # should converge...
226-
@test 2steadyforce(sys,S=1)[1] 6.2e-3 rtol=0.066 # Analytic Linear FSBC solution
221+
@test -2steadyforce(sys,S=1)[1] 6.2e-3 rtol=0.066 # Analytic Linear FSBC solution
227222
mn,mx = extrema(ζ(sys))
228223
@test -2mn > mx # trough is much bigger than crest
229224
end
@@ -268,15 +263,15 @@ wigley(hᵤ;B=0.125,D=0.05,hᵥ=0.25) = measure.(
268263
sys = NKPanelSystem(spheroid(0.04),sym_axes=2,ℓ=0.5^2) |> directsolve!
269264
@test @ballocations(Φ($sys.body.x[1],$sys)) TEST_ALLOCS
270265
@test @ballocations(cₚ($sys.body.x[1],$sys)) TEST_ALLOCS
271-
@test steadyforce(sys,S=1/2)[1] 6e-3 rtol=0.02
266+
@test -steadyforce(sys,S=1/2)[1] 6e-3 rtol=0.02
272267

273268
# Compare elliptical prism drag to Guevel/Baar (no WL contour)
274269
sys = NKPanelSystem(prism(0.1),sym_axes=2,ℓ=0.55^2) |> directsolve!
275-
@test steadyforce(sys,S=1/2)[1] 0.062 rtol=0.03
270+
@test -steadyforce(sys,S=1/2)[1] 0.062 rtol=0.03
276271

277272
# Compare thin-ship wigley to Tuck 2008 (no WL contour)
278273
sys = NKPanelSystem(wigley(0.05),sym_axes=2,ℓ=0.51^2) |> directsolve!
279-
@test steadyforce(sys)[1] 0.0088-0.003 rtol=0.03 # Remove ITTC Cf
274+
@test -steadyforce(sys)[1] 0.0088-0.003 rtol=0.03 # Remove ITTC Cf
280275
end
281276

282277
using NURBS,FileIO # or whatever triggers the extension

0 commit comments

Comments
 (0)