# Dimensions error when coupling multiple solvers

**URL:** <https://precice.discourse.group/t/dimensions-error-when-coupling-multiple-solvers/1388>\
**Category:** Official adapters and tutorials\
**Tags:** openfoam, adapters, fsi\
**Created:** [April 24, 2023, 7:10pm UTC](https://precice.discourse.group/t/dimensions-error-when-coupling-multiple-solvers/1388 "2023-04-24T19:10:04Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![yhuang](https://avatars.discourse-cdn.com/v4/letter/y/ba9def/32.png) [@yhuang](https://precice.discourse.group/u/yhuang)\
**Post date:** [April 24, 2023, 7:10pm UTC](https://precice.discourse.group/t/dimensions-error-when-coupling-multiple-solvers/1388/1 "2023-04-24T19:10:04Z")

</div>

Hi there,

I am currently attempting to solve a fluid-structure interaction problem by coupling multiple solvers using preCICE. These solvers include the single-phase flow solver pimpleDyMFoam, the two-phase flow solver olaDyMFlow, and the structural solver CalculiX. However, I have encountered some issues about the differernt dimensions, see below:

```plaintext
Different dimensions for =
     dimensions : [0 1 0 0 0 0 0] = [0 0 -1 0 0 0 0]

    From function bool Foam::dimensionSet::operator=(const Foam::dimensionSet&) const
    in file dimensionSet/dimensionSet.C at line 171.

FOAM aborting

#0 Foam::error::printStack(Foam::Ostream&) at ??:?
#1 Foam::error::abort() at ??:?
#2 Foam::dimensionSet::operator=(Foam::dimensionSet const&) const at ??:?
#3 Foam::DimensionedField<Foam::Tensor<double>, Foam::volMesh>::operator=(Foam::DimensionedField<Foam::Tensor<double>, Foam::volMesh> const&) at ??:?
#4 Foam::GeometricField<Foam::Tensor<double>, Foam::fvPatchField, Foam::volMesh>::operator==(Foam::tmp<Foam::GeometricField<Foam::Tensor<double>, Foam::fvPatchField, Foam::volMesh> > const&) at ??:?
#5 preciceAdapter::Adapter::readCheckpoint() at ??:?
#6 preciceAdapter::Adapter::execute() at ??:?
#7 Foam::functionObjects::preciceAdapterFunctionObject::execute() at ??:?
#8 Foam::functionObjectList::execute() at ??:?
#9 Foam::Time::run() const at Time.C:?
#10 ? at ??:?
#11 __libc_start_main in "/lib64/libc.so.6"
#12 ? at ??:?
MPT ERROR: Rank 0(g:0) received signal SIGABRT/SIGIOT(6).
        Process ID: 441624, Host: cirrus-login2, Program: /mnt/lustre/indy2lfs/work/ec055/ec055/yhuang94/OpenFOAM/yhuang94-4.x/platforms/linux64GccDPInt32Opt/bin/olaDyMFlow
        MPT Version: HPE MPT 2.25 08/14/21 03:17:46-root

MPT: --------stack traceback-------
MPT: sh: gdb: command not found

MPT: -----stack traceback ends-----
MPT: On host cirrus-login2, Program /mnt/lustre/indy2lfs/work/ec055/ec055/yhuang94/OpenFOAM/yhuang94-4.x/platforms/linux64GccDPInt32Opt/bin/olaDyMFlow, Rank 0, Process 441624: Dumping core on signal SIGABRT/SIGIOT(6) into directory /mnt/lustre/indy2lfs/work/ec055/ec055/yhuang94/sbm/3d/case1

```

The vesion information can be found here:  
**OpenFOAM-4.x** (pimpleDyMFoam, olaDyMFlow)  
**CalculiX-2.15**  
**preCICE-2.4.0**

The preCICE configure file can be found here:  
[precice-config.xml](https://precice.discourse.group/uploads/short-url/6Y0Xxvy0r4PRg7hjXmMZhWHD7wt.xml) (5.1 KB)

I have tried coupling pimpleDyMFoam, pimpleDyMFoam and CalculiX using preCICE, it worked well without any errors. However, when I tried to couple pimpleDyMFoam, olaDyMFlow and CalculiX for another FSI problem, I encountered the issues described above.

By the way, I have read the previous posts related to this issue. However, the turbulence model in my current case is laminar, which is different from the issue discussed in those posts.  
[https://precice.discourse.group/t/different-dimensions-for-dimensions-issue/535](https://precice.discourse.group/t/different-dimensions-for-dimensions-issue/535)

@Makis I would greatly appreciate any suggestions or ideas you may have on how to resolve this issue!

---

<div class="post-metadata">

**Author:** ![yhuang](https://avatars.discourse-cdn.com/v4/letter/y/ba9def/32.png) [@yhuang](https://precice.discourse.group/u/yhuang)\
**Post date:** [April 25, 2023, 9:59am UTC](https://precice.discourse.group/t/dimensions-error-when-coupling-multiple-solvers/1388/2 "2023-04-25T09:59:04Z")

</div>

Hi there,

Regarding the issue mentioned above, here is some additional information:

(1) The divergence issue mentioned above appeared during the second iteration process, rather than being present from the beginning;  
(2) The generated log file for the calculation is as follows:  
[solid.log](https://precice.discourse.group/uploads/short-url/q5dr5rDfFchbzVF2nm3LXba3HX7.log) (6.9 KB)  
[innerFluid.log](https://precice.discourse.group/uploads/short-url/ec1X8zS7Xph03DjRWNbWpO4cqkK.log) (8.6 KB)  
[outerFluid.log](https://precice.discourse.group/uploads/short-url/jO5maVROroAlAbt3dRZbcYgofXs.log) (14.3 KB)  
[precice-Calculix-convergence.log](https://precice.discourse.group/uploads/short-url/vx4cCJoeFIfdZgCVLJj0oIyuhnl.log) (210 Bytes)

Any comments or suggestions are greatly appreciated!

---

<div class="post-metadata">

**Author:** ![yhuang](https://avatars.discourse-cdn.com/v4/letter/y/ba9def/32.png) [@yhuang](https://precice.discourse.group/u/yhuang)\
**Post date:** [April 26, 2023, 9:51am UTC](https://precice.discourse.group/t/dimensions-error-when-coupling-multiple-solvers/1388/3 "2023-04-26T09:51:23Z")

</div>

A quick update:

I build the adapter with debug symbols and get following detailed error information:

```plaintext
--> FOAM FATAL ERROR:
Different dimensions for =
     dimensions : [0 2 0 0 0 0 0] = [0 0 -1 0 0 0 0]

    From function bool Foam::dimensionSet::operator=(const Foam::dimensionSet&) const
    in file dimensionSet/dimensionSet.C at line 171.

FOAM aborting

#0 Foam::error::printStack(Foam::Ostream&) at ??:?
#1 Foam::error::abort() at ??:?
#2 Foam::dimensionSet::operator=(Foam::dimensionSet const&) const at ??:?
#3 Foam::DimensionedField<Foam::Tensor<double>, Foam::volMesh>::operator=(Foam::DimensionedField<Foam::Tensor<double>, Foam::volMesh> const&) at ??:?
#4 Foam::GeometricField<Foam::Tensor<double>, Foam::fvPatchField, Foam::volMesh>::operator==(Foam::tmp<Foam::GeometricField<Foam::Tensor<double>, Foam::fvPatchField, Foam::volMesh> > const&) at ??:?
#5 preciceAdapter::Adapter::readCheckpoint() at /mnt/lustre/indy2lfs~/OpenFOAM/OpenFOAM-4.x/src/OpenFOAM/lnInclude/tmpI.H:232
#6 preciceAdapter::Adapter::execute() at ~/OpenFOAM/openfoam-adapter-OpenFOAM4/Adapter.C:416
#7 Foam::functionObjects::preciceAdapterFunctionObject::execute() at ~/OpenFOAM/openfoam-adapter-OpenFOAM4/preciceAdapterFunctionObject.C:86
#8 Foam::functionObjectList::execute() at ??:?
#9 Foam::Time::run() const at Time.C:?
#10 ? at ??:?
#11 __libc_start_main in "/lib64/libc.so.6"
#12 ? at ??:?
MPT ERROR: Rank 0(g:0) received signal SIGABRT/SIGIOT(6).
        Process ID: 852826, Host: cirrus-login2, Program: /mnt/lustre/indy2lfs/work/ec055/ec055/yhuang94/OpenFOAM/yhuang94-4.x/platforms/linux64GccDPInt32Opt/bin/olaDyMFlow
        MPT Version: HPE MPT 2.25 08/14/21 03:17:46-root

MPT: --------stack traceback-------
MPT: sh: gdb: command not found

MPT: -----stack traceback ends-----

```

It’s strange that a different dimensional error occurred, even though I made no changes to the case.  
[innerFluid.log](https://precice.discourse.group/uploads/short-url/ec2hkJWvdjtPJp9nR6tBOEfKf1D.log) (13.1 KB)  
[outerFluid.log](https://precice.discourse.group/uploads/short-url/mnHafg0WL9tfyOdyzQYxWB5I5qM.log) (20.0 KB)  
[solid.log](https://precice.discourse.group/uploads/short-url/bafziQEsrNVmQeaz71cQE462qvg.log) (6.9 KB)

---

<div class="post-metadata">

**Author:** ![Makis](https://yyz2.discourse-cdn.com/free1/user_avatar/precice.discourse.group/makis/32/25_2.png) [@Makis](https://precice.discourse.group/u/Makis)\
**Post date:** [April 26, 2023, 12:15pm UTC](https://precice.discourse.group/t/dimensions-error-when-coupling-multiple-solvers/1388/4 "2023-04-26T12:15:48Z")

</div>

Hi @yhuang,

while this is not related to turbulent models, it is related to reading checkpoints. I assume it is also specific to `olaDyMFlow`.

The respective issue is still open, and we still have no idea why this happens for turbulent models, but we cannot reproduce it for recent OpenFOAM com versions.

It is also interesting that in the beginning you get:

```plaintext
Different dimensions for =
     dimensions : [0 1 0 0 0 0 0] = [0 0 -1 0 0 0 0]

```

while in your third post you get:

```plaintext
Different dimensions for =
     dimensions : [0 2 0 0 0 0 0] = [0 0 -1 0 0 0 0]

```

I would assume that the `operator=` or the copy constructor of some custom (tensor) field of `olaDyMFoam` modifies the dimensions. So, every time we call it, we modify the dimensions.

Here is where we set up checkpoints in the adapter: [openfoam-adapter/Adapter.C at develop · precice/openfoam-adapter · GitHub](https://github.com/precice/openfoam-adapter/blob/develop/Adapter.C#L890-L924)

As a first debugging step, I would suggest removing the following lines, to find out which is the exact field type:

```plaintext
    doLocalCode(volSymmTensorField);
    doLocalCode(surfaceTensorField);
    doLocalCode(pointTensorField);

```

After you find the type, maybe you can find the exact field, and then add only all other fields to the list.

This is an ugly workaround, but it may help you go to the next step. I don’t know what impact it could have to not checkpoint the respective field.

---

<div class="post-metadata">

**Author:** ![yhuang](https://avatars.discourse-cdn.com/v4/letter/y/ba9def/32.png) [@yhuang](https://precice.discourse.group/u/yhuang)\
**Post date:** [April 26, 2023, 4:25pm UTC](https://precice.discourse.group/t/dimensions-error-when-coupling-multiple-solvers/1388/5 "2023-04-26T16:25:58Z")

</div>

Hi @Makis,

Thank you for your detailed instructions and valuable suggestions! I have tested the case as you suggested and found that the error was caused by volTensorField, specifically the grad(U) field.

Your help is much appreciated and has enabled me to move on to the next step.

Best regards.

---

<div class="post-metadata">

**Author:** ![Makis](https://yyz2.discourse-cdn.com/free1/user_avatar/precice.discourse.group/makis/32/25_2.png) [@Makis](https://precice.discourse.group/u/Makis)\
**Post date:** [April 26, 2023, 5:41pm UTC](https://precice.discourse.group/t/dimensions-error-when-coupling-multiple-solvers/1388/6 "2023-04-26T17:41:51Z")

</div>

Good to hear that, but keep in mind that this is only a workaround, not a solution.

It would be very helpful if you find out why this is happening for the `grad(U)` field.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/precice/original/1X/67d2a5fa6f80e597e2267ff17fa8c1673cd11caa.svg) [@system](https://precice.discourse.group/u/system)\
**Post date:** [April 29, 2023, 5:42pm UTC](https://precice.discourse.group/t/dimensions-error-when-coupling-multiple-solvers/1388/7 "2023-04-29T17:42:23Z")

</div>

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.
