-
Notifications
You must be signed in to change notification settings - Fork 32
Export average surface temperature #949
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
base: fenicsx
Are you sure you want to change the base?
Export average surface temperature #949
Conversation
jhdark
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
| 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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This might not be needed if we inherit from AverageSurface
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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>
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...