Skip to content

BackgroundField func definition with a flat dimension #3844

Answered by tomchor
wenegrat asked this question in Helpdesk
Discussion options

You must be logged in to vote

In current versions of the code Flat dimensions must be dropped from the function signature. I think that docstring you linked is out of date, but maybe someone else can confirm.

In order to define your function in a way that works for both 2D and 3D set-ups, you can define both methods. Something like:

func(y,z,t,p) = BLA
func(x,y,z,p) = func(y,z,t,p)

That way if you run your simulation in 2D, Oceananigans will try to use a signature that matches the first method, and the second method for 3D cases. You could also put your define in an if/else statement and only define the method you wanna use, but my opinion is that it's cleaner to avoid the if/else statement.

So to answer your specific…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@wenegrat
Comment options

@glwagner
Comment options

Answer selected by wenegrat
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants