Export average surface temperature#949
Open
kaelyndunnell wants to merge 87 commits intofestim-dev:fenicsxfrom
Open
Export average surface temperature#949kaelyndunnell wants to merge 87 commits intofestim-dev:fenicsxfrom
kaelyndunnell wants to merge 87 commits intofestim-dev:fenicsxfrom
Conversation
RemDelaporteMathurin
requested changes
Mar 4, 2025
jhdark
requested changes
Oct 24, 2025
Collaborator
jhdark
left a comment
There was a problem hiding this comment.
Just some small doc fixes from me, I think this class should probably inherit from AverageSurface then might be able make it simpler.
Going back to this is making me realize we need to have a more dev team encompassing discussion on how these derived are handled in general. But this one can probably still go through for now
Comment on lines
35
to
51
| def compute(self, ds): | ||
| """Computes the average temperature on the surface. | ||
|
|
||
| Args: | ||
| ds (ufl.Measure): surface measure of the model | ||
| """ | ||
| temperature_field = self.temperature_field | ||
|
|
||
| surface_integral = fem.assemble_scalar( | ||
| fem.form(temperature_field * ds(self.surface.id)) | ||
| ) # integral over surface | ||
|
|
||
| surface_area = fem.assemble_scalar(fem.form(1 * ds(self.surface.id))) | ||
|
|
||
| self.value = surface_integral / surface_area # avg temp | ||
|
|
||
| self.data.append(self.value) |
Collaborator
There was a problem hiding this comment.
This might not be needed if we inherit from AverageSurface
Contributor
Author
There was a problem hiding this comment.
I think we still do cause this will fail if field isn't of type F.Species (even setting it to None in init made things fail)
Co-authored-by: James Dark <65899899+jhdark@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Proposed changes
Adds export for average surface temperature.
Types of changes
What types of changes does your code introduce to FESTIM?
Checklist
Further comments
If this is a relatively large or complex change, kick off the discussion by explaining why you chose the solution you did and what alternatives you considered, etc...