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

Automagically wrap AbstractOperation and Reduction in Field inside OutputWriters? #2242

Closed
glwagner opened this issue Feb 11, 2022 · 3 comments

Comments

@glwagner
Copy link
Member

This came up on #2235.

The idea is to support syntax like

outputs == ∂x(v) - ∂y(u), U = Average(u, dims=1))
output_writer = JLD2OutputWriter(model, outputs, ... )

rather than requiring things to be wrapped in Field to work.

This wasn't easy to support previously, before we consolidate all the Field implementations (we had ComputedField, Field, AveragedField...). But now we can support it and it would reduce boilerplate (eg everything is Field(this), Field(that) by quite a bit for the majority of use cases.

I think the downside is that users aren't immediately exposed to Field infrastructure. A good "Fields tutorial" in the docs might help with that though.

@tomchor
Copy link
Collaborator

tomchor commented Feb 11, 2022

This came up on #2235.

The idea is to support syntax like

outputs == ∂x(v) - ∂y(u), U = Average(u, dims=1))
output_writer = JLD2OutputWriter(model, outputs, ... )

rather than requiring things to be wrapped in Field to work.

I think this is certainly more intuitive for users!

This wasn't easy to support previously, before we consolidate all the Field implementations (we had ComputedField, Field, AveragedField...). But now we can support it and it would reduce boilerplate (eg everything is Field(this), Field(that) by quite a bit for the majority of use cases.

I think the downside is that users aren't immediately exposed to Field infrastructure. A good "Fields tutorial" in the docs might help with that though.

Pardon if this question is naive but why is it important that users to exposed to the Field infrastructure?

@glwagner
Copy link
Member Author

Pardon if this question is naive but why is it important that users to exposed to the Field infrastructure?

Because that way they are prepared to do sophisticated post-processing! But I think you're right, maybe it's not a real "downside".

@glwagner
Copy link
Member Author

Done

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

No branches or pull requests

2 participants