Wrong mapping results on precice-exported meshes using JIT

In above picture, I’ve plotted the actual recieved values vs the precice-exported values side-by-side for ease of comparison. These sphere points are the nodes of the target patch. Weired random values seemed to be exported by precice. The mapping method is direct-mesh-access write.

To be specific, the data plotted is UWind on OpenFOAM-NearReadPatch-Mesh1:

exchange data=“UWind” mesh=“OpenFOAM-NearReadPatch-Mesh1” from=“OpenFOAM-Wind1” to=“OpenFOAM1” initialize=“0”


In another picture above, I’ve plotted the precice-exported values on a source mesh from which the just-in-time read is performed. Weired random values again. I wonder if this is a known issue for a precice-exported mesh where api-access=“true”?

The data plotted is UNear on OpenFOAM-Relaxation-Mesh1:

exchange data=“UNear” mesh=“OpenFOAM-Relaxation-Mesh1” from=“OpenFOAM1” to=“OpenFOAM-Wind1” initialize=“0”

<?xml version="1.0" encoding="UTF-8" ?>

<precice-configuration experimental="true">
  <log>
    <sink
      filter="%Severity% > debug and %Rank% = 0"
      format="---[precice] %ColorizedSeverity% %Message%"
      enabled="true" />
  </log>

<!-- ===================================================================== -->
<!-- wind<->HOS coupling data -->
  <data:scalar name="etaHOS" waveform-degree="1" />
  <data:scalar name="pWind" waveform-degree="1" />

<!-- wind<->near coupling data -->
  <data:vector name="UWind" waveform-degree="1" />
  <data:vector name="UNear" waveform-degree="1" />
  <data:scalar name="p_rgh" waveform-degree="1" />

<!-- near<->HOS coupling data -->
  <data:vector name="UHOS" waveform-degree="1" />
  <data:scalar name="etaVOF" waveform-degree="1" />
  <data:scalar name="etaShifted" waveform-degree="1" />
  <data:scalar name="wVOF" waveform-degree="1" />
  <data:scalar name="weights" waveform-degree="1" />

<!-- ===================================================================== -->
<!-- wind<->HOS coupling meshes -->
  <mesh name="Wind-Coupling-Mesh1" dimensions="3">
    <use-data name="etaHOS" />
    <use-data name="pWind" />
  </mesh>

  <mesh name="HOS-Wind-Mesh1" dimensions="3">
    <use-data name="etaHOS" />
    <use-data name="pWind" />
  </mesh>

<!-- wind<->near coupling meshes -->
<!-- wind side has no meshes since JIT-read and DMA-write -->
<!-- near side see OpenFOAM-Relaxation-Mesh1 and OpenFOAM-Central-Mesh1 below -->

<!-- near<->HOS coupling meshes -->
  <mesh name="HOS-Relaxation-Mesh1" dimensions="2">
    <use-data name="etaHOS" />
    <use-data name="UHOS" />
  </mesh>

  <mesh name="HOS-Coupling-Mesh1" dimensions="2">
    <use-data name="etaVOF" />
    <use-data name="etaShifted" />
    <use-data name="wVOF" />
    <use-data name="weights" />
  </mesh>

  <mesh name="OpenFOAM-Relaxation-Mesh1" dimensions="2">
    <use-data name="etaHOS" />
    <use-data name="UHOS" />
    <use-data name="UNear" />
    <use-data name="p_rgh" />
  </mesh>
<!--
  <mesh name="OpenFOAM-Central-Mesh1" dimensions="2">
    <use-data name="UNear" />
    <use-data name="p_rgh" />
  </mesh>
-->
  <mesh name="OpenFOAM-Coupling-Mesh1" dimensions="2">
    <use-data name="etaVOF" />
    <use-data name="etaShifted" />
    <use-data name="wVOF" />
    <use-data name="weights" />
  </mesh>

  <mesh name="OpenFOAM-NearReadPatch-Mesh1" dimensions="2">
    <use-data name="UWind" />
    <use-data name="p_rgh" />
  </mesh>

<!-- ===================================================================== -->
  <participant name="OpenFOAM-Wind1">
    <!-- wind<->HOS -->
    <provide-mesh name="Wind-Coupling-Mesh1" />
    <receive-mesh name="HOS-Wind-Mesh1" from="HOS-Coupling" />
    <read-data name="etaHOS" mesh="Wind-Coupling-Mesh1" />
    <write-data name="pWind" mesh="Wind-Coupling-Mesh1" />
    <mapping:linear-cell-interpolation direction="read" from="HOS-Wind-Mesh1" to="Wind-Coupling-Mesh1" constraint="consistent" />
    <export:vtu directory="precice-exports" every-n-time-windows="100" />

    <!-- wind<->near -->
    <receive-mesh name="OpenFOAM-Relaxation-Mesh1" from="OpenFOAM1" api-access="true" />
    <receive-mesh name="OpenFOAM-NearReadPatch-Mesh1" from="OpenFOAM1" api-access="true" />
    <read-data name="p_rgh" mesh="OpenFOAM-Relaxation-Mesh1" />
    <read-data name="UNear" mesh="OpenFOAM-Relaxation-Mesh1" />
    <write-data name="p_rgh" mesh="OpenFOAM-NearReadPatch-Mesh1" />
    <write-data name="UWind" mesh="OpenFOAM-NearReadPatch-Mesh1" />
    <mapping:nearest-neighbor direction="read" from="OpenFOAM-Relaxation-Mesh1" constraint="consistent" />
    <mapping:nearest-neighbor direction="write" to="OpenFOAM-NearReadPatch-Mesh1" constraint="conservative" />
  </participant>

  <participant name="OpenFOAM1">
    <!-- near<->HOS -->
    <provide-mesh name="OpenFOAM-Relaxation-Mesh1" />
    <provide-mesh name="OpenFOAM-Coupling-Mesh1" />
    <provide-mesh name="OpenFOAM-NearReadPatch-Mesh1" />
    <receive-mesh name="HOS-Relaxation-Mesh1" from="HOS-Coupling" />
    <read-data name="etaHOS" mesh="OpenFOAM-Relaxation-Mesh1" />
    <read-data name="UHOS" mesh="OpenFOAM-Relaxation-Mesh1" />
    <write-data name="etaVOF" mesh="OpenFOAM-Coupling-Mesh1" />
    <write-data name="etaShifted" mesh="OpenFOAM-Coupling-Mesh1" />
    <write-data name="wVOF" mesh="OpenFOAM-Coupling-Mesh1" />
    <write-data name="weights" mesh="OpenFOAM-Coupling-Mesh1" />
    <mapping:linear-cell-interpolation direction="read" from="HOS-Relaxation-Mesh1" to="OpenFOAM-Relaxation-Mesh1" constraint="consistent" />
    <export:vtu directory="precice-exports" every-n-time-windows="100" />

    <!-- near<->wind -->
    <write-data name="p_rgh" mesh="OpenFOAM-Relaxation-Mesh1" />
    <write-data name="UNear" mesh="OpenFOAM-Relaxation-Mesh1" />
    <read-data name="p_rgh" mesh="OpenFOAM-NearReadPatch-Mesh1" />
    <read-data name="UWind" mesh="OpenFOAM-NearReadPatch-Mesh1" />
  </participant>

  <participant name="HOS-Coupling">
    <!-- HOS<->wind -->
    <provide-mesh name="HOS-Wind-Mesh1" />
    <receive-mesh name="Wind-Coupling-Mesh1" from="OpenFOAM-Wind1" />
    <read-data name="pWind" mesh="HOS-Wind-Mesh1" />
    <write-data name="etaHOS" mesh="HOS-Wind-Mesh1" />
    <mapping:linear-cell-interpolation direction="read" from="Wind-Coupling-Mesh1" to="HOS-Wind-Mesh1" constraint="consistent" />

    <!-- HOS<->near -->
    <provide-mesh name="HOS-Relaxation-Mesh1" />
    <provide-mesh name="HOS-Coupling-Mesh1" />
    <receive-mesh name="OpenFOAM-Coupling-Mesh1" from="OpenFOAM1" />
    <read-data name="etaVOF" mesh="HOS-Coupling-Mesh1" />
    <read-data name="etaShifted" mesh="HOS-Coupling-Mesh1" />
    <read-data name="wVOF" mesh="HOS-Coupling-Mesh1" />
    <read-data name="weights" mesh="HOS-Coupling-Mesh1" />
    <write-data name="etaHOS" mesh="HOS-Relaxation-Mesh1" />
    <write-data name="UHOS" mesh="HOS-Relaxation-Mesh1" />
    <mapping:nearest-neighbor direction="read" from="OpenFOAM-Coupling-Mesh1" to="HOS-Coupling-Mesh1" constraint="consistent" />
  </participant>

<!-- ===================================================================== -->

  <!-- wind<->HOS -->
  <m2n:sockets acceptor="OpenFOAM-Wind1" connector="HOS-Coupling" exchange-directory=".." />
  <coupling-scheme:parallel-explicit>
    <time-window-size value="0.025" />
    <max-time value="400.0" />
    <participants first="OpenFOAM-Wind1" second="HOS-Coupling" />
    <exchange data="etaHOS" mesh="HOS-Wind-Mesh1" from="HOS-Coupling" to="OpenFOAM-Wind1" initialize="0" />
    <exchange data="pWind" mesh="Wind-Coupling-Mesh1" from="OpenFOAM-Wind1" to="HOS-Coupling" initialize="0" />
  </coupling-scheme:parallel-explicit>

  <!-- wind<->near -->
  <m2n:sockets acceptor="OpenFOAM-Wind1" connector="OpenFOAM1" exchange-directory=".." />
  <coupling-scheme:parallel-explicit>
    <time-window-size value="0.025" />
    <max-time value="400.0" />
    <participants first="OpenFOAM-Wind1" second="OpenFOAM1" />
    <!-- DMA-write -->
    <exchange data="p_rgh" mesh="OpenFOAM-NearReadPatch-Mesh1" from="OpenFOAM-Wind1" to="OpenFOAM1" initialize="0" />
    <exchange data="UWind" mesh="OpenFOAM-NearReadPatch-Mesh1" from="OpenFOAM-Wind1" to="OpenFOAM1" initialize="0" />
    <!-- JIT-read -->
    <exchange data="p_rgh" mesh="OpenFOAM-Relaxation-Mesh1" from="OpenFOAM1" to="OpenFOAM-Wind1" initialize="0" />
    <exchange data="UNear" mesh="OpenFOAM-Relaxation-Mesh1" from="OpenFOAM1" to="OpenFOAM-Wind1" initialize="0" />
  </coupling-scheme:parallel-explicit>

  <!-- near<->HOS -->
  <m2n:sockets acceptor="OpenFOAM1" connector="HOS-Coupling" exchange-directory=".." />
  <coupling-scheme:parallel-explicit>
    <time-window-size value="0.025" />
    <max-time value="400.0" />
    <participants first="OpenFOAM1" second="HOS-Coupling" />
    <exchange data="etaHOS" mesh="HOS-Relaxation-Mesh1" from="HOS-Coupling" to="OpenFOAM1" initialize="0" />
    <exchange data="UHOS" mesh="HOS-Relaxation-Mesh1" from="HOS-Coupling" to="OpenFOAM1" initialize="0" />
    <exchange data="etaVOF" mesh="OpenFOAM-Coupling-Mesh1" from="OpenFOAM1" to="HOS-Coupling" initialize="0" />
    <exchange data="etaShifted" mesh="OpenFOAM-Coupling-Mesh1" from="OpenFOAM1" to="HOS-Coupling" initialize="0" />
    <exchange data="wVOF" mesh="OpenFOAM-Coupling-Mesh1" from="OpenFOAM1" to="HOS-Coupling" initialize="0" />
    <exchange data="weights" mesh="OpenFOAM-Coupling-Mesh1" from="OpenFOAM1" to="HOS-Coupling" initialize="0" />
  </coupling-scheme:parallel-explicit>
</precice-configuration>

These nan values on the exported meshes can’t be the actual values during mapping as the simulation seems running well.

configure file attached.
precice-config.xml (8.8 KB)

Which values are you visualizing on which mesh? If you use just-in-time mapping, the mapped values cannot be in any exporter, as the coordinates are temporary locations. Only the source mesh and the source data may be in the exporter.

It could be that (especially for the write direction), there is an inconsistency for when we actually export the map-and-written data (i.e. maybe this happens internally before we complete the mapping step). Could you be more explicit about the data flow you are visualizing? Also could you post the xml file inline? I cannot download it for some reason.

Thanks for reply. Please see my original post where I have added more info.

Reasons found. Paraview v5.9.1 has issues reading the precice-exported pvtu file (displaying NaN). But in Paraview v5.13.2, the same pvtu files can be read normally and proper mapping values can be displayed.