Skip to content

Commit

Permalink
save state after every iteration in explicit coupling
Browse files Browse the repository at this point in the history
  • Loading branch information
nkr0 committed Nov 27, 2019
1 parent b01641e commit 0e035ea
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
3 changes: 3 additions & 0 deletions adapter/PreciceInterface.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ void Precice_Setup( char * configFilename, char * participantName, SimulationDat
// Initialize coupling data
Precice_InitializeData( sim );

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

}

void Precice_InitializeData( SimulationData * sim )
Expand Down
1 change: 1 addition & 0 deletions adapter/PreciceInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ typedef struct SimulationData {
double coupling_init_dtheta;
double precice_dt;
double solver_dt;
bool coupling_explicit;

} SimulationData;

Expand Down
4 changes: 2 additions & 2 deletions nonlingeo_precice.c
Original file line number Diff line number Diff line change
Expand Up @@ -1114,10 +1114,10 @@ void nonlingeo_precice(double **cop, ITG *nk, ITG **konp, ITG **ipkonp, char **l

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

if( Precice_IsWriteCheckpointRequired() )
if( Precice_IsWriteCheckpointRequired() || simulationData.coupling_explicit)
{
Precice_WriteIterationCheckpoint( &simulationData, vini );
Precice_FulfilledWriteCheckpoint();
if( Precice_IsWriteCheckpointRequired() ) Precice_FulfilledWriteCheckpoint();
}

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

0 comments on commit 0e035ea

Please sign in to comment.