Closed davidscn closed 3 years ago
What is the precice-config.xml
that triggered this?
Actually, the precice.initializeData()
should be outside the action: https://www.precice.org/couple-your-code-initializing-coupling-data.html#undefined
It is a step similar to advance()
. It does not really depend on what happened to the buffers, as long as the actions are fulfilled.
EDIT: Maybe something like actionReadInitialData would be useful.
You normally read data as soon as you enter the isOngoing
loop. Here you can ask isReadDataAvailable
. This makes a actionReadInitialData
unnecessary in my opinion. Do you agree?
@MakisH the config (where I faced this issue) looked like this:
<exchange data="Stress" mesh="second-part-mesh" from="second-participant" to="first-participant" initialize="true" />
where deal.II was the first participant.
Actually, the precice.initializeData() should be outside the action: https://www.precice.org/couple-your-code-initializing-coupling-data.html#undefined It is a step similar to advance(). It does not really depend on what happened to the buffers, as long as the actions are fulfilled.
Ok this makes sense. I will pull out the initializeData()
and it will appear unconditional during the initialization flow. I'm just a bit confused that we haven't seen it earlier.
You normally read data as soon as you enter the isOngoing loop. Here you can ask isReadDataAvailable. This makes a actionReadInitialData unnecessary in my opinion. Do you agree?
No, not really. In the link Makis posted, the initializeData
call is placed before isOngoing. Looking in the documentation of isReadDataAvailable()
, however, it says @pre initialize() has been called successfully.
. Hence, I guess the isOngoing
call is not a prerequisite in order to use isReadDataAvailable
(maybe I misunderstood your comment).
No, not really. In the link Makis posted, the initializeData call is placed before isOngoing. Looking in the documentation of isReadDataAvailable(), however, it says @pre initialize() has been called successfully.. Hence, I guess the isOngoing call is not a prerequisite in order to use isReadDataAvailable (maybe I misunderstood your comment).
No, that's not what I meant. The thing is that you don't need to read data after initializeData
. Normally the first read will only happen within the coupling loop. And there you already have the isReadDataAvailable
. More understandable?
More understandable. However, I don't ask for isReadDataAvailable
(in my example case) since I don't copy the data 'into' the participant but rather make use of readVectorData
where the data is actually required. So, this won't solve the problem, right?
Also, the documentation of isReadDataAvailable
says
* It is allowed to read data even if this function returns false.
* This is not recommended due to performance reasons.
* Use this function to prevent unnecessary reads.
so that reading data would be allowed.
The solution is
Actually, the precice.initializeData() should be outside the action: https://www.precice.org/couple-your-code-initializing-coupling-data.html#undefined
Or is there still another problem that I am overlooking?
No.
Done in #47
In our current implementation, the
initializeData
call is only reached in caseWriteInitialData
is required. However, in case another participants needs to initialize data and the dealii participant does not, the function call is skipped and preCICE complains:This is probably a bug, but I would like to get some other opinions. https://github.com/precice/dealii-adapter/blob/1d148462224d0148ee77ebd6d7f93612c0adcd8e/adapter/adapter.h#L327-L341
EDIT: Maybe something like
actionReadInitialData
would be useful.