Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
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();
Copy link
Member

Choose a reason for hiding this comment

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

If you need such a boolean, it would be better to make is coupling_implicit. Usually we assume that implicit coupling is the special case that requires special treatment. You could then still write if (!coupling_implicit).

But I think you don't need this check in the first place, it should be enough to call what you want always.

Copy link
Contributor Author

@nkr0 nkr0 Nov 28, 2019

Choose a reason for hiding this comment

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

sure, !coupling_implicit or coupling_explicit is no problem. But a check is needed. Because the call I want to happen always is only in the case of explicit coupling. For implicit coupling it should follow Precice_IsWriteCheckpointRequired() (only at the ends of coupling iterations).


}

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)
Copy link
Member

Choose a reason for hiding this comment

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

This would then almost always be true, right? I understnad that you always want checkpoints to be stored (to trigger some internal update).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For explicit coupling, yes.

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

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