Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BackgroundField is a confusing name #3586

Open
glwagner opened this issue May 6, 2024 · 2 comments
Open

BackgroundField is a confusing name #3586

glwagner opened this issue May 6, 2024 · 2 comments
Labels

Comments

@glwagner
Copy link
Member

glwagner commented May 6, 2024

It's not a Field. The docstring for the struct admits as much:

"""
BackgroundField{F, P}
Temporary container for storing information about `BackgroundFields`.
"""
struct BackgroundField{F, P}
func:: F
parameters :: P
end

and this temporary struct is always thrown away to build a "real" field:

regularize_background_field(LX, LY, LZ, f::BackgroundField{<:Function}, grid, clock) =
FunctionField{LX, LY, LZ}(f.func, grid; clock=clock, parameters=f.parameters)

The problem is that the name leads to confusing patterns like

B_field = BackgroundField(constant_stratification, parameters=(; ĝ, N² = 1e-5))

where B_field is not a field. Indeed, later on when we need a "real" field we have to write

B∞ = model.background_fields.tracers.b

Can we think of a better name? For example BackgroundFieldInfo is one. That's sorta clumsy though. Maybe we can come up with something more concise and elegant.

cc @tomchor @hdrake @liuchihl because you are using this feature

@hdrake
Copy link
Contributor

hdrake commented May 6, 2024

Maybe just BackgroundFieldDefinition?

@glwagner
Copy link
Member Author

glwagner commented May 6, 2024

Not bad...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants