Skip to content
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

Update couple-your-code-porting-v2-3.md #335

Merged
merged 3 commits into from
Feb 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 14 additions & 12 deletions pages/docs/couple-your-code/couple-your-code-porting-v2-3.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ Missing:
- Remove `mapWriteDataFrom()` and `mapReadDataTo()` as custom timings were removed.
- Remove `hasMesh()` and `hasData()` as there is no real usecase for them. All errors are unrecoverable.
- Remove `hasToEvaluateSurrogateModel()` and `hasToEvaluateFineModel()` as they were stubs of a long-removed feature.
- Remove `getMeshVertices()` and `getMeshVertexIDsFromPositions()`. This information is already known by the adapter. We docummented [strategies on how to handle this](couple-your-code-defining-mesh-connectivity.html) in adpters.
- Remove `getMeshVertices()` and `getMeshVertexIDsFromPositions()`. This information is already known by the adapter. We docummented [strategies on how to handle this](couple-your-code-defining-mesh-connectivity.html) in adapters.
- Remove `isReadDataAvailable()` and `isWriteDataRequired()`. Due to time interpolation, writing generates samples in time, and reading is always possible between the current time and the end of the current time window.

### Add `relativeReadTime` for all read data calls
Expand All @@ -152,17 +152,17 @@ The previously optional argument `relativeReadTime` is now mandatory for read da

```diff
- couplingInterface.readBlockVectorData(meshName, dataReadName, numberOfVertices, vertexIDs.data(), readData.data());
+ preciceDt = couplingInterface.getMaxTimeStepSize();
+ couplingInterface.readBlockVectorData(meshName, dataReadName, numberOfVertices, vertexIDs.data(), preciceDt, readData.data())
+ preciceDt = participant.getMaxTimeStepSize();
+ participant.readData(meshName, dataReadName, vertexIDs, preciceDt, readData)
```

If you use subcycling, please do the following:

```diff
- couplingInterface.readBlockVectorData(meshName, dataReadName, numberOfVertices, vertexIDs.data(), readData.data());
+ preciceDt = couplingInterface.getMaxTimeStepSize();
+ preciceDt = participant.getMaxTimeStepSize();
double dt = min(preciceDt, solverDt);
+ couplingInterface.readBlockVectorData(meshName, dataReadName, numberOfVertices, vertexIDs.data(), dt, readData.data())
+ participant.readData(meshName, dataReadName, vertexIDs, dt, readData)
```

### Remove `initializeData()` calls
Expand All @@ -175,23 +175,25 @@ The API function `initializeData()` has been removed in [#1350](https://github.c
std::vector<double> writeData(dimensions, writeValue);

// Write initial data before calling initialize()
const std::string & cowid = actionWriteInitialData();
if (couplingInterface.isActionRequired(cowid)) {
couplingInterface.writeVectorData(writeDataID, vertexID, writeData.data());
couplingInterface.markActionFulfilled(cowid);
- const std::string & cowid = actionWriteInitialData();
- if (couplingInterface.isActionRequired(cowid)) {
- couplingInterface.writeVectorData(writeDataID, vertexIDs, writeData.data());
- couplingInterface.markActionFulfilled(cowid);
+ if (participant.requiresInitialData()) {
+ participant.writeData(meshName, dataWriteName, vertexIDs, writeData);
}

// Move initialize to the place where you called initializeData() previously.
- couplingInterface.initializeData();
+ couplingInterface.initialize();
+ double dt = couplingInterface.getMaxTimeWindowSize();
+ participant.initialize();
+ double dt = participant.getMaxTimeWindowSize();
```

Typical error message that should lead you here:

```bash
error: ‘class precice::Participant’ has no member named ‘initializeData’; did you mean ‘initialize’?
63 | precice.initializeData();
63 | participant.initializeData();
| ^~~~~~~~~~~~~~
| initialize
```
Expand Down
Loading