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

107 mixed space adj project #108

Merged
merged 6 commits into from
Feb 21, 2024
Merged

107 mixed space adj project #108

merged 6 commits into from
Feb 21, 2024

Conversation

acse-ej321
Copy link
Collaborator

fixes #107
Calls the override project function instead of the default Firedrake function to deal with mixed function spaces and adjoints.

Additionally, modifies the creation of the enriched mesh to:

  • pass inherited parameters correctly in the constructor
  • force population of self._fs variable required for mesh-to-mesh conservative transfer

Copy link
Member

@jwallwork23 jwallwork23 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this. Seems the right thing to do.

One request and then we'll need to merge #104 to get fixes that are currently holding up the test suite.

@@ -61,8 +62,12 @@ def get_enriched_mesh_seq(
get_qoi=self._get_qoi,
get_bcs=self._get_bcs,
qoi_type=self.qoi_type,
parameters=self.params,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. Partially addresses #97.

Comment on lines 68 to 69
# update self._fs variable for enriched mesh
mesh_seq_e.function_spaces
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please could you introduce a method on the MeshSeq to do this whose name says what it is doing, e.g., update_function_spaces? On it's own, this line of code looks like it's doing nothing. (My bad for writing it this way in the first place, I was probably overusing properties.)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jwallwork23
I added a function called update_function_spaces which calls function_spaces if the function space attribute dictionary is None. Hopefully, that is a bit more readable.

@jwallwork23 jwallwork23 added the bug Something isn't working label Feb 14, 2024
@jwallwork23 jwallwork23 added this to the Version 1 milestone Feb 14, 2024
@jwallwork23
Copy link
Member

@acse-ej321 Apologies for pushing to your branch but I thought it would be easier than explaining my suggestion. What do you think of these changes?

  • update_function_spaces becomes the method that actually does the update.
  • function_spaces remains a property pointing to the underlying function spaces.

Comment on lines 67 to 69

# Update function spaces for enriched mesh
mesh_seq_e.update_function_spaces
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that I prefer not to add comments that are already clear from the code / method name.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm writing some Development Practices over in the Movement wiki and I'll put this in there.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jwallwork23 - Noted. I have a tendency to over-comment and will work on it especially when the attempt is to make the method name self explanatory.

@@ -234,8 +235,10 @@ def _function_spaces_consistent(self) -> bool:
)
return consistent

@property
def function_spaces(self) -> list:
def update_function_spaces(self) -> list:
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jwallwork23 - I think your edits here make more sense than my interpretation of your suggestions and it is a better descriptive name of the method you had already implemented.

Copy link
Member

@jwallwork23 jwallwork23 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks again for this @acse-ej321!

@jwallwork23
Copy link
Member

@acse-ej321 Are you happy to merge this? It's good to go. (Usually I leave merging to the developer.)

@acse-ej321 acse-ej321 merged commit b36526e into main Feb 21, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Issue when using SWE mixed function space - checking project function source
2 participants