Skip to content

Commit 6aaca69

Browse files
committed
Merge branch 'add-nonuniform-BCs' into turbulence_modelling
2 parents 97afa98 + 341f046 commit 6aaca69

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

src/WaterLily.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ mutable struct Simulation <: AbstractSimulation
7070
@assert !(isa(u_BC,Function) && isa(uλ,Function)) "`u_BC` and `uλ` cannot be both specified as Function"
7171
@assert !(isnothing(U) && isa(u_BC,Function)) "`U` must be specified if `u_BC` is a Function"
7272
isa(g,Function) && @assert first(methods(g)).nargs==4 "g::Function needs to be defined as g(i,x,t)"
73+
isa(g,Function) && @assert all(typeof.(ntuple(i->g(i,zeros(SVector{N}),zero(T)),N)).==T) "`g` is not type stable"
7374
isa(u_BC,Function) && @assert first(methods(u_BC)).nargs==4 "u_BC::Function needs to be defined as u_BC(i,x,t)"
7475
isa(u_BC,Function) && @assert all(typeof.(ntuple(i->u_BC(i,zeros(SVector{N}),zero(T)),N)).==T) "`u_BC` is not type stable"
7576
isnothing(uλ) && (uλ = isa(u_BC, Function) ?= (i,x)->u_BC(i,x,0) := (i,_)->u_BC[i])

test/maintests.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ function acceleratingFlow(N;use_g=false,T=Float64,perdir=(1,),jerk=4,mem=Array)
303303
# assuming gravitational scale is 1 and Fr is 1, U scale is Fr*√gL
304304
UScale = N # this is also initial U
305305
# constant jerk in x, zero acceleration in y
306-
g(i,x,t) = i==1 ? t*jerk : 0
306+
g(i,x,t) = i==1 ? t*jerk : 0.
307307
!use_g && (g = nothing)
308308
return WaterLily.Simulation(
309309
(N,N), (UScale,0.), N; ν=0.001,g,Δt=0.001,perdir,T,mem

0 commit comments

Comments
 (0)