Skip to content

Commit

Permalink
save every coupling iteration, not sub-cycle
Browse files Browse the repository at this point in the history
  • Loading branch information
nkr committed Nov 29, 2019
1 parent 5c16d6e commit d1a4f5a
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
5 changes: 5 additions & 0 deletions adapter/PreciceInterface.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,11 @@ bool Precice_IsWriteCheckpointRequired()
return precicec_isActionRequired( "write-iteration-checkpoint" );
}

bool Precice_IsCouplingTimestepComplete()
{
return precicec_isCouplingTimestepComplete();
}

void Precice_FulfilledReadCheckpoint()
{
precicec_fulfilledAction( "read-iteration-checkpoint" );
Expand Down
6 changes: 6 additions & 0 deletions adapter/PreciceInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,12 @@ bool Precice_IsReadCheckpointRequired();
*/
bool Precice_IsWriteCheckpointRequired();

/**
* @brief Returns true if coupling timestep is complete
* @return
*/
bool Precice_IsCouplingTimestepComplete();

/**
* @brief Tells preCICE that the checkpoint has been read
*/
Expand Down
9 changes: 7 additions & 2 deletions nonlingeo_precice.c
Original file line number Diff line number Diff line change
Expand Up @@ -1089,6 +1089,8 @@ void nonlingeo_precice(double **cop, ITG *nk, ITG **konp, ITG **ipkonp, char **l
/* Adapter: Create the interfaces and initialize the coupling */
printf("About to enter preCICE setup in Calculix with names %s and %s \n", preciceParticipantName, configFilename);
Precice_Setup( configFilename, preciceParticipantName, &simulationData );
// Initialize for the first step because Precice_IsCouplingTimestepComplete will return false until the end of the first step
if( !simulationData.coupling_implicit ) Precice_WriteIterationCheckpoint( &simulationData, vini );

/* Adapter: Give preCICE the control of the time stepping */
while( Precice_IsCouplingOngoing() ){
Expand All @@ -1114,11 +1116,14 @@ 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() == simulationData.coupling_implicit)
if( Precice_IsWriteCheckpointRequired() ) // implicit coupling
{
Precice_WriteIterationCheckpoint( &simulationData, vini );
if( Precice_IsWriteCheckpointRequired() ) Precice_FulfilledWriteCheckpoint();
Precice_FulfilledWriteCheckpoint();
}
if( Precice_IsCouplingTimestepComplete() && !simulationData.coupling_implicit ) // explicit coupling
Precice_WriteIterationCheckpoint( &simulationData, vini );


for(k=0;k<*nboun;++k){xbounini[k]=xbounact[k];}
if((*ithermal==1)||(*ithermal>=3)){
Expand Down

0 comments on commit d1a4f5a

Please sign in to comment.