# Problem coupling my code with OpenFOAM using preCICE

Hello,

I’m trying to couple OpenFOAM with my structural code using preCICE. I used the perpendicular-flap example as the benchmark. I set up the OpenFOAM as 3D problem, which is identical to the fluid participant in corresponding OpenFOAM-CalculiX example. On the solid part, I set up my code as 2D problem and perform coupling with force (read) and displacement (write). I think this set-up is sensible if the “dimensions” in precice-config.xml is 2.

When i run the simulation, OpenFOAM can run for 2 steps before failing, probably diverges:

``````PIMPLE: iteration 1
smoothSolver:  Solving for cellDisplacementx, Initial residual = 1, Final residual = 2.47636e-17, No Iterations 2
smoothSolver:  Solving for cellDisplacementy, Initial residual = 1, Final residual = 2.56708e-17, No Iterations 2
DICPCG:  Solving for pcorr, Initial residual = 1, Final residual = 0.000990229, No Iterations 71
DICPCG:  Solving for pcorr, Initial residual = 0.594785, Final residual = 7.88115e-09, No Iterations 92
time step continuity errors : sum local = 3.85436e-08, global = 9.07536e-09, cumulative = 2.94411e+08
#0  Foam::error::printStack(Foam::Ostream&) at ??:?
#1  Foam::sigFpe::sigHandler(int) at ??:?
#3  Foam::symGaussSeidelSmoother::smooth(Foam::word const&, Foam::Field<double>&, Foam::lduMatrix const&, Foam::Field<double> const&, Foam::FieldField<Foam::Field, double> const&, Foam::UPtrList<Foam::lduInterfaceField const> const&, unsigned char, int) at ??:?
#4  Foam::symGaussSeidelSmoother::smooth(Foam::Field<double>&, Foam::Field<double> const&, unsigned char, int) const at ??:?
#5  Foam::smoothSolver::solve(Foam::Field<double>&, Foam::Field<double> const&, unsigned char) const at ??:?
#6  Foam::fvMatrix<Foam::Vector<double> >::solveSegregated(Foam::dictionary const&) at ??:?
#7  Foam::fvMatrix<Foam::Vector<double> >::solveSegregatedOrCoupled(Foam::dictionary const&) at ??:?
#8  Foam::fvMesh::solve(Foam::fvMatrix<Foam::Vector<double> >&, Foam::dictionary const&) const at ??:?
#9  ? in ~/sw2/openfoam-OpenFOAM-v2012/platforms/linux64GccDPInt32Opt/bin/pimpleFoam
#10  __libc_start_main in /lib/x86_64-linux-gnu/libc.so.6
#11  ? in ~/sw2/openfoam-OpenFOAM-v2012/platforms/linux64GccDPInt32Opt/bin/pimpleFoam
Floating point exception (core dumped)
Looking for any time directories without results (e.g. stray functionObjectProperties files, see openfoam-adapter issue #26 on GitHub)...
``````

I think there may be the problem with the mapping but do not know how to track it. In the CalculiX adapter, the quasis2D3D mapping is used because CalculiX is a 3D code. In my case, I prefer to use 2D code specifically for this problem. Does it have any implication? Is it possible to dump the mapping description out from preCICE for the sake of check and comparison?

This is a problem we are currently working on. Could you try to use the `develop` version of the OpenFOAM adapter?
So, you copied the OpenFOAM case from the (`develop` version) of the tutorials and replaced CalculiX with your code? And OpenFOAM-CalculiX worked for you? Did you change anything on OpenFOAM side?