Skip to content

Commit d1a4f5a

Browse files
author
nkr
committed
save every coupling iteration, not sub-cycle
1 parent 5c16d6e commit d1a4f5a

File tree

3 files changed

+18
-2
lines changed

3 files changed

+18
-2
lines changed

adapter/PreciceInterface.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,11 @@ bool Precice_IsWriteCheckpointRequired()
114114
return precicec_isActionRequired( "write-iteration-checkpoint" );
115115
}
116116

117+
bool Precice_IsCouplingTimestepComplete()
118+
{
119+
return precicec_isCouplingTimestepComplete();
120+
}
121+
117122
void Precice_FulfilledReadCheckpoint()
118123
{
119124
precicec_fulfilledAction( "read-iteration-checkpoint" );

adapter/PreciceInterface.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,12 @@ bool Precice_IsReadCheckpointRequired();
187187
*/
188188
bool Precice_IsWriteCheckpointRequired();
189189

190+
/**
191+
* @brief Returns true if coupling timestep is complete
192+
* @return
193+
*/
194+
bool Precice_IsCouplingTimestepComplete();
195+
190196
/**
191197
* @brief Tells preCICE that the checkpoint has been read
192198
*/

nonlingeo_precice.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1089,6 +1089,8 @@ void nonlingeo_precice(double **cop, ITG *nk, ITG **konp, ITG **ipkonp, char **l
10891089
/* Adapter: Create the interfaces and initialize the coupling */
10901090
printf("About to enter preCICE setup in Calculix with names %s and %s \n", preciceParticipantName, configFilename);
10911091
Precice_Setup( configFilename, preciceParticipantName, &simulationData );
1092+
// Initialize for the first step because Precice_IsCouplingTimestepComplete will return false until the end of the first step
1093+
if( !simulationData.coupling_implicit ) Precice_WriteIterationCheckpoint( &simulationData, vini );
10921094

10931095
/* Adapter: Give preCICE the control of the time stepping */
10941096
while( Precice_IsCouplingOngoing() ){
@@ -1114,11 +1116,14 @@ void nonlingeo_precice(double **cop, ITG *nk, ITG **konp, ITG **ipkonp, char **l
11141116

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

1117-
if( Precice_IsWriteCheckpointRequired() == simulationData.coupling_implicit)
1119+
if( Precice_IsWriteCheckpointRequired() ) // implicit coupling
11181120
{
11191121
Precice_WriteIterationCheckpoint( &simulationData, vini );
1120-
if( Precice_IsWriteCheckpointRequired() ) Precice_FulfilledWriteCheckpoint();
1122+
Precice_FulfilledWriteCheckpoint();
11211123
}
1124+
if( Precice_IsCouplingTimestepComplete() && !simulationData.coupling_implicit ) // explicit coupling
1125+
Precice_WriteIterationCheckpoint( &simulationData, vini );
1126+
11221127

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

0 commit comments

Comments
 (0)