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
Implement watch integral #881
Conversation
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.
Looks good 👍 Thanks for the clean code!
I still have to look at the tests.
One general thing: I thought again a bit about the use cases and I think we have to alter what we want. Let's say we want to compute the total force on a geometry. Then, even with mesh connectivity, we don't want to scale the values.
What I would suggest:
- Let's introduce a boolean config option
scale-with-connectivity
without a default value. - If false: we just sum up. If true: we scale. If then no connectivity is given, we sum up again, but print a warning (similar to how we treat NP mapping)
OK?
Github action says there is a formatting problem but do not say where it is:
All right, then. Keep your secrets |
@oguzziya I fixed the bug on develop. |
…lement-watch-integral
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.
Great code and great test coverage 👍
The warning still needs fixing, otherwise only minor improvements, see below.
I also tested with Alya in parallel and multiple watch integrals (but no connectivity): the values there make sense.
Co-authored-by: Benjamin Uekermann <benjamin.uekermann@gmail.com>
Co-authored-by: Benjamin Uekermann <benjamin.uekermann@gmail.com>
…plement-watch-integral
src/precice/impl/WatchIntegral.cpp
Outdated
if ((not _isScalingOn) and (_mesh->edges().empty() or _mesh->triangles().empty())) { | ||
PRECICE_WARN("Watch-integral is configured with scaling option on; however, mesh " << _mesh->getName() << " does not contain connectivity information. Therefore, the integral will be calculated without scaling."); | ||
} |
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.
if ((not _isScalingOn) and (_mesh->edges().empty() or _mesh->triangles().empty())) { | |
PRECICE_WARN("Watch-integral is configured with scaling option on; however, mesh " << _mesh->getName() << " does not contain connectivity information. Therefore, the integral will be calculated without scaling."); | |
} | |
if ((_isScalingOn) and (_mesh->edges().empty() or _mesh->triangles().empty())) { | |
PRECICE_WARN("Watch-integral is configured with scaling option on; however, mesh " << _mesh->getName() << " does not contain connectivity information. Therefore, the integral will be calculated without scaling."); | |
} |
Another problem I see is that in 2D the set of triangles is always empty, right?
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.
Right. So basically, I think we can directly say if edge container is empty, there is no connectivity.
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.
yes, that solves the second problem. but the not
is also still wrong, right?
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.
Oh, I missed it sorry
@oguzziya Could you also please write some documentation in the new docs. You can add a note "Only available for preCICE version >= v2.2.0" or similar. |
Tested on the Linux cluster with deal.II - OF: Attribute "scale-with-connectivity" is required, but was not defined. I guess a default would be nice. I haven't defined connectivity anyway so that the value should be clear. However, it works also with the option I'm not sure, whether a watchi-integral option makes sense for |
I think the default could be also nice but I am not sure whether we can get connectivity information in the configuration phase. Maybe we raise an error not in the configuration phase but in the watch-integral. Without any connectivity, the so-called area is simply the summation of all the vertices on the given interface The points are that you made are pretty important, however, I am not sure how they can be implemented in this framework because it should be somewhat application-independent, then it makes it a little bit user responsibility maybe. However, in either case, more detailed documentation would be useful for specific use cases from the user side, at least as an initial step. |
@davidscn: good points, thanks for the feedback!
The no default option I suggested on purpose to make this difference really explicit to the user. There is no way around that the user should understand what is happening here. Moreover, as @oguzziya pointed out mesh connectivity is not yet available during configuration.
That's a good point and I also have second thoughts here. I would suggest to simply remove the column completely if there is no scaling used.
That this true, but not available on data level. preCICE only distinguishes between consistent and conservative mappings. Not whether data is consistent or conservative. But these are important points for the documentation.
Good point again. Should also go into the documentation. |
Currently, |
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.
All looks good now 👍
This pull request has been mentioned on preCICE Forum on Discourse. There might be relevant details there: https://precice.discourse.group/t/highlights-of-the-new-precice-release-v2-2/429/1 |
This PR implements watch integral functionality which was discussed in #342
getArea()
andgetLength()
member functions are defined forTriangle
andEdge
classes respectively.