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

Provide diff with all changes in step-by-step example. #262

Merged
merged 26 commits into from
Nov 14, 2023
Merged
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
cdf124e
Fix whitespace.
BenjaminRodenberg Apr 21, 2023
6f80833
Provide diff with all changes in step-by-step example.
BenjaminRodenberg Apr 22, 2023
b8d80f0
Update action config docs to v3 (#254)
uekerman Apr 24, 2023
073e8da
Merge branch 'master' into precice-v3
BenjaminRodenberg Apr 24, 2023
5b41f63
Merge branch 'master' into porting-summarize-diff
BenjaminRodenberg Apr 24, 2023
7717c88
Move getMaxTimeStepSize inside time loop.
BenjaminRodenberg Apr 24, 2023
f1156f2
Update Roadmap
MakisH Apr 24, 2023
389f167
Update fundamentals-roadmap.md
MakisH Apr 24, 2023
862ed69
Use time step, not timestep. (#259)
BenjaminRodenberg Apr 24, 2023
5f27600
Merge branch 'master' into porting-summarize-diff
BenjaminRodenberg Apr 24, 2023
517c42c
Remove language hint in diff (see #260)
BenjaminRodenberg Apr 28, 2023
792208b
Merge branch 'master' into precice-v3
BenjaminRodenberg Apr 28, 2023
d1aaf05
Merge branch 'precice-v3' into porting-summarize-diff
BenjaminRodenberg Apr 28, 2023
f6a8ced
Update pages/docs/configuration/configuration-action.md
BenjaminRodenberg Nov 11, 2023
ad2fffd
Update pages/docs/couple-your-code/couple-your-code-porting-v2-3.md
BenjaminRodenberg Nov 11, 2023
944c69d
Update pages/docs/couple-your-code/couple-your-code-porting-v2-3.md
BenjaminRodenberg Nov 11, 2023
0a43b24
Merge branch 'master' into porting-summarize-diff
BenjaminRodenberg Nov 11, 2023
93d5db8
Reduce diff.
BenjaminRodenberg Nov 11, 2023
6f740b0
Remove unrelated changes.
BenjaminRodenberg Nov 11, 2023
f7d52d1
Update w.r.t. read/writeData and std::spans.
BenjaminRodenberg Nov 11, 2023
e04a90a
Remove unrelated.
BenjaminRodenberg Nov 11, 2023
e5c6ff3
Add note.
BenjaminRodenberg Nov 11, 2023
40160f8
Update pages/docs/couple-your-code/couple-your-code-porting-v2-3.md
BenjaminRodenberg Nov 11, 2023
eef3867
Fix setMeshVertices
BenjaminRodenberg Nov 11, 2023
641414f
Merge branch 'porting-summarize-diff' of github.com:precice/precice.g…
BenjaminRodenberg Nov 11, 2023
0401a5a
Update pages/docs/couple-your-code/couple-your-code-porting-v2-3.md
BenjaminRodenberg Nov 11, 2023
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
85 changes: 85 additions & 0 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 @@ -16,6 +16,91 @@ Please add breaking changes here when merged to the `develop` branch.

## preCICE API

<!-- Split code block. See https://github.com/precice/precice.github.io/commit/74e377cece4a221e00b5c56b1db3942ec70a6272. -->
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MakisH Do you have more details on this point? If it is simple: Let's do it now. If it is more complicated: I guess it's not critical and we can just merge.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not understand what you mean. Could you please elaborate what the problem is? I vaguely remember some issue with code highlighting in diff. Normal diff should work.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to 74e377c there seems to be some issue with longer code blocks. But let's not worry about it here. I'll open an issue, because we should probably discuss this with @chlorenz and add some general information and guidelines somewhere in the documentation for the documentation.

```diff
turnOnSolver(); //e.g. setup and partition mesh

- precice::SolverInterface precice("FluidSolver","precice-config.xml",rank,size); // constructor
+ precice::Participant precice("FluidSolver","precice-config.xml",rank,size); // constructor

- const std::string& coric = precice::constants::actionReadIterationCheckpoint();
- const std::string& cowic = precice::constants::actionWriteIterationCheckpoint();
- const std::string& cowid = precice::constants::actionWriteInitialData();

- int dim = precice.getDimension();
+ int dim = precice.getMeshDimensions("FluidMesh");
- int meshID = precice.getMeshID("FluidMesh");
int vertexSize; // number of vertices at wet surface
// determine vertexSize
- double* coords = new double[vertexSize*dim]; // coords of vertices at wet surface
+ std::vector<double> coords(vertexSize*dim); // coords of vertices at wet surface
// determine coordinates
- int* vertexIDs = new int[vertexSize];
- precice.setMeshVertices(meshID, vertexSize, coords, vertexIDs);
- delete[] coords;
+ std::vector<int> vertexIDs(vertexSize);
+ precice.setMeshVertices(meshName, coords, vertexIDs);

- int displID = precice.getDataID("Displacements", meshID);
- int forceID = precice.getDataID("Forces", meshID);
- double* forces = new double[vertexSize*dim];
- double* displacements = new double[vertexSize*dim];
+ std::vector<double> forces(vertexSize*dim);
+ std::vector<double> displacements(vertexSize*dim);

double solverDt; // solver timestep size
double preciceDt; // maximum precice timestep size
double dt; // actual time step size

- preciceDt = precice.initialize();

- if(precice.isActionRequired(cowid)){
- precice.writeBlockVectorData(forceID, vertexSize, vertexIDs, forces);
- precice.markActionFulfilled(cowid);
- }
+ if(precice.requiresInitialData()){
+ precice.writeData("FluidMesh", "Forces", vertexIDs, forces);
+ }

- precice.initializeData();
+ precice.initialize();

while (precice.isCouplingOngoing()){
- if(precice.isActionRequired(cowic)){
+ if(precice.requiresWritingCheckpoint()){
saveOldState(); // save checkpoint
- precice.markActionFulfilled(cowic);
}

+ precice_dt = precice.getMaxTimeStepSize();
solverDt = beginTimeStep(); // e.g. compute adaptive dt
dt = min(preciceDt, solverDt);

- precice.readBlockVectorData(displID, vertexSize, vertexIDs, displacements);
+ precice.readData("FluidMesh", "Displacements", vertexIDs, dt, displacements);
setDisplacements(displacements);
solveTimeStep(dt);
computeForces(forces);
- precice.writeBlockVectorData(forceID, vertexSize, vertexIDs, forces);
+ precice.writeData("FluidMesh", "Forces", vertexIDs, forces);

- preciceDt = precice.advance(dt);
+ precice.advance(dt);

- if(precice.isActionRequired(coric)){ // timestep not converged
+ if(precice.requiresReadingCheckpoint()){
reloadOldState(); // set variables back to checkpoint
- precice.markActionFulfilled(coric);
}
else{ // timestep converged
endTimeStep(); // e.g. update variables, increment time
}
}
precice.finalize(); // frees data structures and closes communication channels
- delete[] vertexIDs, forces, displacements;
turnOffSolver();
```

- The main preCICE header file was renamed. This means that you need to:
- Replace `#include "precice/SolverInterface.hpp"` with `#include "precice/precice.hpp"`.
- Where declaring a preCICE object, replace the `precice::SolverInterface` type with `precice::Participant`
Expand Down
Loading