FSI: interface of baffle (OpenFOAM) + in-house solid solver

Dear preCICEers,
I want to modify the perpendicular-flap case from a beam to a baffle, because my flap is very thin. I used 'createBaffle` to create an internal wall which are actually two identical faces (one is master, the other is slave). How should I set the interface? I found if I set the interface with the master one, the force is transferred to solid solver correctly for the first time step, but the displacement from the solid solver cannot be transferred back to OpenFOAM, so the force for the following step does not update (keep the same). On the contrary, if the slave face is used, the force and displacement can be updated at each time step, but the force direction seems to be opposite.

I wonder if it is possible to use a baffle as an interface for OpenFOAM. If yes, how to set the interface? Do I need to set both internal faces (master and slave) as interface? Then how do I take care of the interface in solid part which I only have one face to deflect? Ideally, I hope to only handle one interface since the two faces are identical, at least, they should deform the same if I set the displacement in the solid part.

Best,
Michael



PS: If I set in preciceDict for OpenFOAM

    patches           (flapBaffle_master flapBaffle_slave);
    locations         faceCenters;

It just behaves like only flapBaffle_slave is used.

Hi Michael,
I’m doing FSI simulation with more than one interface as well. In my cases, I modified the preciceDict as follow:

interfaces
{
  Interface1
  {
    ...
    patches (core);
    ...
  }

  Interface2
  {
    ...
    patches (caisson);
    ...
  }
}

I didn’t use ‘createBaffle’. My core and caisson are defined in OpenFOAM using snappyHexMesh. The setting works for me and I hope it can help you.

Best regards

2 Likes

Hi Stan,
Thank you for your reply! Are your core and caisson are two different faces? Do you define two sets of mesh in precice-config.xml file? And do you have two solid solvers?

I want to model a thickness perpendicular beam, so it is supposed to be only one interface. Anyway, if I set up two interfaces in preciceDict:

FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    location    "system";
    object      preciceDict;
}

preciceConfig "../precice-config.xml";

participant Fluid;

modules (FSI);

interfaces
{
  Interface1
  {
    mesh              Fluid-Mesh;
    patches           (flapBaffle_master flapBaffle_slave);
    locations         faceCenters;
    
    readData
    (
      Displacement
    );
    
    writeData
    (
      Stress
	  Force
    );
  };
  
  Interface2
  {
    mesh              Fluid-Mesh;
    patches           (flapBaffle_slave);
    locations         faceCenters;
    
    readData
    (
      Displacement
    );
    
    writeData
    (
      Stress
	  Force
    );
  };
};

FSI
{
  solverType incompressible;
  rho rho [1 -3 0 0 0 0 0] 1;
}

It works the same as only slave face is set as the interface.

By the way, for each Interface, the keyword patches implies we can define multiple faces as the same interface, is that right?

Best,
Michael

Here is my configuration:

precice-config.xml <?xml version="1.0" encoding="UTF-8" ?>
<mesh name="Fluid-Mesh">
  <use-data name="Force" />
  <use-data name="Stress" />
  <use-data name="Displacement" />
</mesh>

<mesh name="Solid-Mesh">
  <use-data name="Displacement" />
  <use-data name="Force" />
  <use-data name="Stress" />
</mesh>

<participant  name="Fluid">
  <use-mesh   name="Fluid-Mesh"   provide="yes" />
  <use-mesh   name="Solid-Mesh"   from="Solid" />
  <write-data name="Force"        mesh="Fluid-Mesh" />
  <write-data name="Stress"     mesh="Fluid-Mesh" />
  <read-data  name="Displacement" mesh="Fluid-Mesh" />
  <mapping:nearest-neighbor
    direction="write"
    from="Fluid-Mesh"
    to="Solid-Mesh"
    constraint="consistent" />
  <mapping:nearest-neighbor
    direction="read"
    from="Solid-Mesh"
    to="Fluid-Mesh"
    constraint="consistent" />
</participant>

<participant   name="Solid">
  <use-mesh    name="Solid-Mesh"     provide="yes" />
  <write-data  name="Displacement"   mesh="Solid-Mesh" />
  <read-data   name="Force"          mesh="Solid-Mesh" />
  <read-data   name="Stress"       mesh="Solid-Mesh" />
  <watch-point mesh="Solid-Mesh"     name="Flap-Tip" coordinate="0.0;0.0;0.25" />
  
  <export:vtk directory="preCICE-output" />
</participant>

<m2n:sockets from="Fluid" to="Solid" exchange-directory=".." />

<coupling-scheme:serial-explicit>
  <time-window-size value="1" />
  <max-time value="5" />
  <participants first="Fluid"   second="Solid" />
  <exchange data="Force"        mesh="Solid-Mesh" from="Fluid" to="Solid" />
  <exchange data="Stress"     mesh="Solid-Mesh" from="Fluid" to="Solid" />
  <exchange data="Displacement" mesh="Solid-Mesh" from="Solid" to="Fluid" />

  <!-- <max-iterations value="50" /> -->
  <!-- <relative-convergence-measure limit="5e-3" data="Displacement" mesh="Solid-Mesh" /> -->
  <!-- <relative-convergence-measure limit="5e-3" data="Force" mesh="Solid-Mesh" /> -->
  <!-- <acceleration:IQN-ILS> -->
    <!-- <data name="Displacement" mesh="Solid-Mesh" /> -->
    <!-- <data name="Force" mesh="Solid-Mesh" /> -->
    <!-- <preconditioner type="residual-sum" /> -->
    <!-- <filter type="QR2" limit="1e-2" /> -->
    <!-- <initial-relaxation value="0.5" /> -->
    <!-- <max-used-iterations value="100" /> -->
    <!-- <time-windows-reused value="15" /> -->
  <!-- </acceleration:IQN-ILS> -->

</coupling-scheme:serial-explicit>

It seems if I want to get the pressure on the baffle correctly, I need to add (or average) the pressure of the master and slave faces together. There is a functionObject patchAverage in OpfenFOAM which can do the job for a internal patch. Here is a discussion on that Internal faces for monitoring – CFD Online Discussion Forums (cfd-online.com)

The thing is I don’t how to do that in preCICE. It seems I need to modify the code and recompile from source which makes things complicated. I hope it is already available in current preCICE, and I just need to set up correctly.

Hope someone can give more hints or comments on this topic.

Hi @Stan, can you share your precice-config.xml file here? Thank you!

Hi Michael,
Sorry for the late reply. There are so many things to handle by the end of the year…

Yes, they are two different faces. I only use one set of mesh in the configuration file. I only have one solid solver (our in-house solver) and one fluid solver (OpenFOAM).

There is a tutorial case in preCICE named multiple-perpendicular-flaps. In its preciceDict, for each Interface only one patch is adopted. You can check it out.

Of course, my configuration file is uploaded here.
precice-config.xml (2.6 KB)

Hi Stan,

Thank you so much for your help!

In the multiple-perpendicular-flaps tutorial, there are two interfaces and two solid solvers, so four fluid meshes are used. Two are for faceCenters and the other two faceNodes. I see you just use one fluid mesh and solid solver even though you have two interfaces. Are they actually connected with each other so that they can be taken care of by the same solid solver? I’m still thinking you may be able to merge them in one paches list.

I managed to set up my baffle by adding the force of the master and the slave faces together. That means, I used the two interfaces which are actually at the same location but have different normal directions. The strange thing is the forces obtained from the two faces are close but not exactly the same in the hydrostatic state!

You’re welcome.

If I remember correctly, in a previous version of preCICE tutorial only one mesh faceCenter is adopted. AFAIK, the mesh here is just a definition of where to map data from. So even though I have two interfaces, it still works (If my understanding is wrong, please point it out).

Yes, they are connected with each other. I’ll have a try and post the conclusion here later.

I don’t know if the adapter will work as expected with a baffle boundary, but I am already wondering: can we distinguish between the upstream and downstream forces and displacements of the baffle? I have not heard of anyone using the adapter with such a thin structure before.

It seems front face and back face can obtain data from OpenFOAM. They are two walls with the identical location. To differentiate the two faces, I need to use two interfaces in preciceDict for OpenFOAM like this:


  
  Interface1
  {
    mesh              Fluid-Mesh-master;
    patches           (flapBaffle_master flapBaffle_slave);  // both patches are listed, otherwise the second interface does output data to paraview
    locations         faceCenters;
    
    readData
    (
      Displacement
    );
    
    writeData
    (
      Stress_master
	  master_Force
    );
  };
  
  Interface2
  {
    mesh              Fluid-Mesh-slave;
    patches           ( flapBaffle_slave flapBaffle_master);
    locations         faceCenters;
    
    readData
    (
      Displacement
    );
    
    writeData
    (
      Stress_slave
	  Force_slave
    );
  };

And in precice-config.xml, two sets of data and meshes are defined:

    <data:vector name="master_Force"  />
	<data:vector name="Stress_master" />
	<data:vector name="Force_slave"   />
	<data:vector name="Stress_slave"  />
    <data:vector name="Displacement"  />

    <mesh name="Fluid-Mesh-master">
      <use-data name="master_Force"  />
	  <use-data name="Stress_master" />
      <use-data name="Displacement"  />
	</mesh>
	  
	<mesh name="Fluid-Mesh-slave">
      <use-data name="Force_slave"  />
	  <use-data name="Stress_slave" />
      <use-data name="Displacement" />
    </mesh>

    <mesh name="Solid-Mesh">
      <use-data name="Displacement"  />
      <use-data name="master_Force"  />
	  <use-data name="Stress_master" />
      <use-data name="Force_slave"   />
	  <use-data name="Stress_slave"  />	  
    </mesh>

In solid solver, the data from both sides are summed together to get the total value. (Stress = Stress1+ Stress2)

I still have some issues with this approach even though the data can be transferred between the solvers.

  1. I have to repeat both faces in the patches list, otherwise, only one face has the exchanged data (e.g., Force) output in Fluid part, the other is zero.

  2. The Force directions are opposite they should be. For example, the front face points to the upstream, but the normal Force is also pointing to the upstream.

If someone is interested in this case, I can pack and upload the code here. My solid solver is very simple written in Python. Its purpose is just receiving data from Fluid to test the coupling is going well.

1 Like

The second question seems resolved. The force directions of the interface in fluid and solid should be opposite, since one is force acted on the fluid, the other is acted on the solid. Since I observed the normal direction of the master face in Fluid and compared with the force in solid, my previous conclusion is wrong. I should compare both the face normal and force direction in Fluid or in Solid not one in Fluid the other in Solid. Am I understanding this right?

In general, the force in the fluid and in the solid should have opposite directions (inwards and outwards). So this sounds correct.

Hi Michael,

I am struggling with the same issue as you had. Could you please share the setup files for your case?

Thanks in advance,
Yang