I need to do the coupling of two programs, in the transient calculation, I need to calculate the steady state to convergence, and then do the transient calculation on the basis of the steady state. I try to set up a preCICE process in the steady state part and close the process after several iterations. Then another preCICE process is started to calculate the transient, but the program reports an error. Can’t we start two processes? The error message is as follows:
(0) 10:33:35 [impl::ParticipantImpl]:1561 in closeCommunicationChannels: Close communication channels
*** The MPI_Comm_rank() function was called after MPI_FINALIZE was invoked.
*** This is disallowed by the MPI standard.
*** Your MPI job will now abort.
[rose-virtual-machine:47178] Local abort after MPI_FINALIZE started completed successfully, but am not able to aggregate error messages, and not able to guarantee that all other processes were killed!
preCICE currently doesn’t support two simultaneously active instances in the same process.
It does support multiple instances as long as only one is active at a time, which seems to fit your case. So, this should work.
Assuming the above, you need to manage the MPI environment yourself as described here:
In your case, it may also be possible to use compositional coupling by combining an implicit and an explicit scheme.
The implicit scheme uses max-time-windows of 1 and computes the steady state.
The explicit scheme compute the rest of the simulation.
If these two phases can clearly be separated, then it may also be a good idea to separate both. Compute the steady state first and save the results. Then run the rest of the simulation as a separate task. This should allow you to use more compute resources for the first phase.
Thank you very much for your reply, but I have a question about some of the commands mentioned in this page, such as:
MPI_Init(NULL, NULL);
int world_rank, world_size;
MPI_Comm_rank(MPI_COMM_WORLD, &world_rank);
MPI_Comm_size(MPI_COMM_WORLD, &world_size);
These commands are not provided in the precice.f90 file, how do I use MPI_COMM_WORLD?
In addition, if I can do it, is my computation framework as follows?
MPI_INIT()
precice.creat() ! The first precice process to do steady calculation
precice.initialize()
precice.finalize()
precice.creat() ! The second precice process to do transient calculation
precice.initialize()
precice.finalize()
MPI_Finalize()