Skip to content

Commit 2e6a49b

Browse files
committed
Added assert for g function definition in Simulation constructor.
1 parent 404ddab commit 2e6a49b

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/WaterLily.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ mutable struct Simulation <: AbstractSimulation
6969
T=Float32, mem=Array) where N
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"
72+
isa(g,Function) && @assert first(methods(g)).nargs==4 "g::Function needs to be defined as g(i,x,t)"
7273
isa(u_BC,Function) && @assert first(methods(u_BC)).nargs==4 "u_BC::Function needs to be defined as u_BC(i,x,t)"
7374
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"
7475
isnothing(uλ) && (uλ = isa(u_BC, Function) ?= (i,x)->u_BC(i,x,0) := (i,_)->u_BC[i])

0 commit comments

Comments
 (0)