-
-
Notifications
You must be signed in to change notification settings - Fork 169
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
Handling global coupling data (not associated to a mesh) #202
Comments
Example use case: FSI in helicopters I will probably implement this eventually. |
I am currently encountering this in my work on TherMoS, too: Here, coordinates of the sun and a transform are exchanged between the solvers. Is there already any progress on this issue? Otherwise I am going to work around this by introducing an auxiliary mesh. |
No, we haven't done anything in this direction. An auxiliary mesh is
probably the best solution for the moment.
…On Thu, Apr 11, 2019, 10:33 PM Dominanz ***@***.***> wrote:
I am currently encountering this in my work on TherMoS
<https://www5.in.tum.de/wiki/index.php/SC%C2%B2S_Colloquium_-_Dec_20,_2018>,
too: Here, coordinates of the sun and a transform are exchanged between the
solvers.
Is there already any progress on this issue? Otherwise I am going to work
around this by introducing an auxiliary mesh.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#202 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ACxFiHr0BHdVFFn7aDgZ7xs8jh6SrKvTks5vf5wGgaJpZM4Yu8b->
.
|
@uekerman Really good post. Just what I was looking for. (I know WIP). I have been trying to make my volume coupling simulations faster by trying to transfer physical constants as |
To avoid misunderstandings: this feature would still communicate the global data in every |
@uekerman Yes this can be separated into a different issue (maybe an extension of the current issue). As certain physical constants don't change for the duration of the simulation. |
@Alphaoo1 Please see #1071 |
This issue has been mentioned on preCICE Forum on Discourse. There might be relevant details there: |
Some comments on the feature. ConfigurationWhy the name What about adding an attribute to the data tag instead? <data:scalar name="ClassicalMeshData"/>
<data:scalar name="GlobalData1" global="true"/>
<data:scalar name="GlobalData1" meshless="true"/> Or we simply derive the state of being meshless from the config. If no mesh uses a data, then it is meshless. This sound tedious to implement though. APIWhy the Given that there is no association to vertices, there is no reason for indexing. We tell preCICE what size we expect, hence we also what we can read/write. // Caller knows the dimensionality of the data.
void setGlobalDataSize (
int dataID,
int size);
// To avoid problems with data dimensionality, we could also return the amount of elements.
int setGlobalDataSize (
int dataID,
int size);
// expect size * getDimensions() values
void writeGlobalVectorData(
int dataID,
int size,
const double* values );
// expect size * getDimensions() values
void readGlobalVectorData(
int dataID,
int size,
double* values ); We could optionally allow an optional write/read with offset to allow extracting specific entries: void readGlobalVectorData(
int dataID,
int size,
int offset,
double* values ); What about other data types? Currently, everything has to be encoded in double. Isn't this data way more prone to be used as state flags or similar? Communication behavior
Why this additional complexity? Isn't it easier to require the Primary rank to write? Alternative would be to sum everything up on the primary rank, this way we could support partial writes at some additional overhead. Developer perspectiveDoesn't #1350 simplify this a lot? We could require global data to be written before |
I like the |
Me not 😁 🙈
In a way, this is what I had in mind. Accessible from everywhere, meaning from every rank, from every location. But maybe we find a better name, sth like A few other good points, will comment later. |
I'll be working on this issue :) |
Good points. There are indeed still a few open aspects.
Yes, possible. Maybe depends on whether we add more attributes (see
I agree
The reasoning for Maybe everything gets easier if we drop the size altogether? Not sure yet. What I mainly had in mind was really to communicate material or geometry parameters. And if there are two parameters, one could create two data fields. If we keep the size we have the additional complexity of which participant defines the size. Maybe directly doing it in the configuration is simpler: <data:scalar name="GlobalData1" global="true" size="5"/>
Seems like I didn't see this difficulty when opening the issue 4 years ago 😁
Could be true, yes, but I would argue that it is misused then. IMO it should not be used for metadata, but for physical values, same as our current data fields.
In theory, the user does not know about the primary rank. I don't see a use case for partial writes right now, is there one? I could imagine, however, that a user simply writes a material parameter on every rank for simplicity.
Yes, possibly. I would also suggest to start development by branching of from
This I don't understand. I would still communicate data always, not only during initialization (as suggested in #1071). Imagine an angle between coordinate systems that changes in every timestep / iteration. |
FYI: While discussing with @thesamriel on how to perfectly couple domains with conforming but non-orthogonal meshes, I was thinking that this feature could be useful to also exchange some parameters of the mesh. Just documenting for now, not sure how relevant this can be in practice. |
@uekerman If we know the data size before initialize, then we can deduce the common size and/or make sure that the size is consistent everywhere. Other idea: The writing participant writes data locally on each rank (or not). This would also play nicely with the partitioning philosophy of preCICE, as the receiving global data has a consistent shape, independent on how the "writing side" of the data is partitioned. |
Maybe some user experience is useful here. From my experience with CAMRAD-TAU coupling, and what I see from other multibody dynamics cases. CSM side only has one rank, i.e. no worries about writing/reading. CFD side the problem gets a bit complicated but not so much. All ranks should be able to access all data. All ranks at the CFD side should be able to write all vector data. Use case example CAMRAD has to send collocation points to TAU -> required one time at the beginning of coupling a vector data of size x Since CAMRAD is a single executable there is nothing to say about it. TAU is MPI parallel, some nodes have the surface some are not ie. not all of them have to send data. If we consider 1 collocation point and let's say rank 1 has the upper surface of a blade and rank 2 has the lower surface of the blade. The resultant force is coming from This also super simplifies CAMRAD-TAU coupling or any future Multibody CSM - CFD coupling. Actually, they don't require any mapping future of preCICE. I am in favor of setting the size in the preCICE config rather than handle with API, if we add a setter then we also need a getter on the read-side.
|
@kursatyurt Thanks for the input! I am not sure if collocation points are the best example here. The data should be space-independent. What you describes sounds a lot like https://precice.org/couple-your-code-direct-access.html, would you agree? |
Yes, this sounds better, I was not aware of this feature. Probably at the time when the adapter code was written these features were not there. Of course, there are tons of space-independent data like rotor radius, rotational speed, the number of Fourier harmonics used, etc. This still does not cover the case per vertex we might have n-dimensional data. Let's discuss this at another issue. |
Note: This comment may be discussed in #1525 Not directly related to this issue, but came across this while working on it. In the data read/write functions, we have PRECICE_CHECK(valueIndex >= -1, followed a few lines later by PRECICE_CHECK(0 <= valueIndex && valueIndex < vertexCount, And Then isn't the first check redundant? |
Regarding
|
Yes, let's discuss there Regarding
|
A new contender for the name: "arbitrary" data? (as seen in Y. Fischler's presentation in Workshop 2023) |
Creating a new |
An open point for discussion: for implicit coupling, what convergence and acceleration would mean in the context of global data. |
I think we should also allow using global data in convergence measures and acceleration. Maybe an open problem: does the preconditioner in the acceleration work sufficiently well for global data? But this could also be a follow-up issue. |
Update on this issue. In principle, the functionality is ready with #1549, however, this would introduce a lot of technical debt in areas that are currently very heavily on by @BenjaminRodenberg and me. I had an extensive look at simplifying the feature, but it would break some assumptions which lead to a lot of code duplication. Given that the current work-around using a pseudo-mesh is trivial, we decided to explain it in the documentation and put a halt on the original contribution until we figure out how to progress. |
For several applications users asked about sending global data, meaning data that is not associated to a mesh. Examples:
Note: We have previously referred to this kind of data as meta data. In the end, I am not too happy with this expression as it let to confusion (exchanging strings, integers etc.). What I had in mind are physical values, thus floating point values only.
User perspective
Configuration
API
I am not sure if we can avoid having sth like the above
setGlobalDataSize
. If we make this data structure completely dynamic, undefined behavior can appear. For instance, what happens if within one subcycled timestep two different sizes are given? Which one will be used? I currently also don't see a use-case where a completely dynamic size would be necessary (which does not mean that there isn't).Communication behavior
Developer perspective
Communication
WIP: Data structures and random thoughts
GlobalData
(in which package??mesh
would obviously lead to misunderstandings, probably a new package is needed)GlobalDataContext
? Maybe not_writeGlobalDataContexts
and_readGlobalDataContexts
(or directly_readGlobalDatas
or similar)CouplingData
? New similar data structure? This has consequences in_sendData
inBaseCouplingScheme
M2N
, compare how sending the timestep size is currently handledThe text was updated successfully, but these errors were encountered: