Intra-Participant Mapping (Read Mapping From a Provided Mesh or Write Mapping From a Received Mesh)

Hello,

I am using preCICE in a one-way coupled sense to help with easily parallelizing a computationally expensive volume source-term in a flow solver - specifically acoustic forcing. I have two participants: a flow solver and an acoustic forcing calculator. The flow participant provides the volume mesh for the region to apply the source term to, and the acoustic forcing participant accesses it via setMeshAccessRegion and getMeshVertexIDsAndCoordinates.

Because it is one-way coupled, the acoustic forcer calculates continually without pausing and waiting for the fluid participant. Without preCICE, the flow solver would have to compute acoustic forcing every timestep by itself, which is very expensive (all ranks need to pause and wait for the ranks that have that source term on it to finish computing). It much cheaper to just have extra comms via preCICE in the fluid solver instead every timestep.

I have this working nicely in 2D. However, I want to perform these computations in 3D and, to keep the acoustic forcing calculator faster than the flow solver, I want to leverage the fact that the 3D fluid mesh is simply just an extrusion in the z-direction of the 2D mesh.

I would essentially like to configure preCICE with the attached config file: precice-config.xml (2.7 KB) - where the fluid participant provides both the full 3D forcing region, and a 2D slice of said forcing region. I then want to be able to have preCICE simply just complete a nearest neighbor mapping from the 2D to the 3D mesh.

However, when using precice-tools check precice-config.xml, I get the following error:


Checking precice-config.xml for syntax and basic setup issues...
precice-tools: ERROR: Participant "PC2" has a read mapping from mesh "cmgeom:geom2dM1:Forcing_Region_2D", without receiving it. Please add a receive-mesh tag with name="cmgeom:geom2dM1:Forcing_Region_2D"

Alternatively, if I have the acoustic forcing participant receive both meshes and attempt a write-mapping within it, I get this error:

Checking precice-config.xml for syntax and basic setup issues...
precice-tools: ERROR: Participant "Jabber" has a write mapping from mesh "cmgeom:geom2dM1:Forcing_Region_2D", without providing it. Please add a provided-mesh tag with name="cmgeom:geom2dM1:Forcing_Region_2D"

Is there any way I can make this work simply using preCICE?

Thank you.

If I comment out these lines in the source code, I have no issues with a simple serial-serial example with intra-participant mapping (read-mapping from a provided mesh):

Attached is a simple configuration showing this and python scripts that work after commenting out the above code.

I don’t know if this check is necessary for other more complex cases, or if it will work in parallel yet, but if this check is indeed unnecessary then it should be removed or adjusted at least to be a warning instead.

IntraParticipantCoupling.tar (10 KB)

Hi @j-signorelli :waving_hand:

Interesting setup! I agree that this could work in principle. That it does in serial is already a good sign (when removing the check). Could you easily check whether it also works in parallel?

In any case, alternatives:

  • Instead of the NN mapping, one could maybe try a Python action.
  • Or do the extrusion completely in the adapter and only tell preCICE about your “2D” mesh. How does the domain decomposition of PC2 look like? If there is no decomposition in z direction, I would try this option.