Skip to content

Commit 0e035ea

Browse files
committed
save state after every iteration in explicit coupling
1 parent b01641e commit 0e035ea

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

adapter/PreciceInterface.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ void Precice_Setup( char * configFilename, char * participantName, SimulationDat
4747
// Initialize coupling data
4848
Precice_InitializeData( sim );
4949

50+
// find if coupling is implicit or explicit. Implicit coupling will return true at the very beginning and explicit will always return false
51+
sim->coupling_explicit = !Precice_IsWriteCheckpointRequired();
52+
5053
}
5154

5255
void Precice_InitializeData( SimulationData * sim )

adapter/PreciceInterface.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ typedef struct SimulationData {
133133
double coupling_init_dtheta;
134134
double precice_dt;
135135
double solver_dt;
136+
bool coupling_explicit;
136137

137138
} SimulationData;
138139

nonlingeo_precice.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1114,10 +1114,10 @@ void nonlingeo_precice(double **cop, ITG *nk, ITG **konp, ITG **ipkonp, char **l
11141114

11151115
memcpy(&vini[0],&vold[0],sizeof(double)*mt**nk);
11161116

1117-
if( Precice_IsWriteCheckpointRequired() )
1117+
if( Precice_IsWriteCheckpointRequired() || simulationData.coupling_explicit)
11181118
{
11191119
Precice_WriteIterationCheckpoint( &simulationData, vini );
1120-
Precice_FulfilledWriteCheckpoint();
1120+
if( Precice_IsWriteCheckpointRequired() ) Precice_FulfilledWriteCheckpoint();
11211121
}
11221122

11231123
for(k=0;k<*nboun;++k){xbounini[k]=xbounact[k];}

0 commit comments

Comments
 (0)