blueCFD / Core

Coordination repository for the blueCFD-Core: Issue tracking, Wiki, project webpage and miscellaneous scripts
http://bluecfd.github.io/Core
53 stars 10 forks source link

Issue with isothermal, incompressible, external CFD (simpleFoam) #191

Closed kastnerp closed 3 months ago

kastnerp commented 2 years ago

Dear Bruno,

I am the developer of Eddy3D and I was wondering if you would be able to look at an issue we are experiencing. I copied two cases of isothermal, external wind analysis for buildings with simpleFoam here: https://github.com/kastnerp/Eddy3D-BoxDomainIssue

This uses the same building geometry, one case runs fine, the other one doesn't even start. The difference between the two is the rotation of the wind tunnel.

For the crashing case we get:

Backtrace:
        ZN10StackTraceC1Ev [0x705c1465+0x25]
                 module: C:\PROGRA~1\BLUECF~1\ThirdParty-5.x\platforms\mingw_w64GccDPInt32\lib\libstack_trace.dll
        ZN4Foam5error10printStackERNS_7OstreamE [0x11c1c88+0x218]
                 module: C:\PROGRA~1\BLUECF~1\OpenFOAM-5.x\platforms\mingw_w64GccDPInt32Opt\lib\libOpenFOAM.dll
        ZN4Foam6sigFpe13sigFpeHandlerEi [0x11c2af3+0x33]
                 module: C:\PROGRA~1\BLUECF~1\OpenFOAM-5.x\platforms\mingw_w64GccDPInt32Opt\lib\libOpenFOAM.dll
        (No symbol) [0x403cad]
                 module: C:\PROGRA~1\BLUECF~1\OpenFOAM-5.x\platforms\mingw_w64GccDPInt32Opt\bin\simpleFoam.exe
        _C_specific_handler [0x7ffd296d7ff8+0x98]
                 module: C:\Windows\System32\msvcrt.dll
        0_chkstk [0x7ffd29d920cf+0x11f]
                 module: C:\Windows\SYSTEM32\ntdll.dll
        RtlRaiseException [0x7ffd29d41454+0x434]
                 module: C:\Windows\SYSTEM32\ntdll.dll
        KiUserExceptionDispatcher [0x7ffd29d90bfe+0x2e]
                 module: C:\Windows\SYSTEM32\ntdll.dll
        ZN4Foam17DICPreconditioner15calcReciprocalDERNS_5FieldIdEERKNS_9lduMatrixE [0x106b488+0xc8]
                 module: C:\PROGRA~1\BLUECF~1\OpenFOAM-5.x\platforms\mingw_w64GccDPInt32Opt\lib\libOpenFOAM.dll
        ZN4Foam17DICPreconditionerC2ERKNS_9lduMatrix6solverERKNS_10dictionaryE [0x106b502+0x52]
                 module: C:\PROGRA~1\BLUECF~1\OpenFOAM-5.x\platforms\mingw_w64GccDPInt32Opt\lib\libOpenFOAM.dll
        ZN4Foam9lduMatrix14preconditioner30addsymMatrixConstructorToTableINS_17DICPreconditionerEE3NewERKNS0_6solverERKNS_10dictionaryE [0x12d30af+0x2f]
                 module: C:\PROGRA~1\BLUECF~1\OpenFOAM-5.x\platforms\mingw_w64GccDPInt32Opt\lib\libOpenFOAM.dll
        ZN4Foam9lduMatrix14preconditioner3NewERKNS0_6solverERKNS_10dictionaryE [0x1062447+0x117]
                 module: C:\PROGRA~1\BLUECF~1\OpenFOAM-5.x\platforms\mingw_w64GccDPInt32Opt\lib\libOpenFOAM.dll
        ZNK4Foam3PCG5solveERNS_5FieldIdEERKS2_h [0x1064f3e+0x38e]
                 module: C:\PROGRA~1\BLUECF~1\OpenFOAM-5.x\platforms\mingw_w64GccDPInt32Opt\lib\libOpenFOAM.dll
        ZN4Foam8fvMatrixIdE15solveSegregatedERKNS_10dictionaryE [0x65ef1c17+0x127]
                 module: C:\PROGRA~1\BLUECF~1\OpenFOAM-5.x\platforms\mingw_w64GccDPInt32Opt\lib\libfiniteVolume.dll
        (No symbol) [0x42d551]
                 module: C:\PROGRA~1\BLUECF~1\OpenFOAM-5.x\platforms\mingw_w64GccDPInt32Opt\bin\simpleFoam.exe
        (No symbol) [0x42d84c]
                 module: C:\PROGRA~1\BLUECF~1\OpenFOAM-5.x\platforms\mingw_w64GccDPInt32Opt\bin\simpleFoam.exe
        (No symbol) [0x44e342]
                 module: C:\PROGRA~1\BLUECF~1\OpenFOAM-5.x\platforms\mingw_w64GccDPInt32Opt\bin\simpleFoam.exe
        (No symbol) [0x4013f7]
                 module: C:\PROGRA~1\BLUECF~1\OpenFOAM-5.x\platforms\mingw_w64GccDPInt32Opt\bin\simpleFoam.exe
        (No symbol) [0x40152b]
                 module: C:\PROGRA~1\BLUECF~1\OpenFOAM-5.x\platforms\mingw_w64GccDPInt32Opt\bin\simpleFoam.exe
        BaseThreadInitThunk [0x7ffd288d7034+0x14]
                 module: C:\Windows\System32\KERNEL32.DLL
        RtlUserThreadStart [0x7ffd29d42651+0x21]
                 module: C:\Windows\SYSTEM32\ntdll.dll

I know from experience the error usually refers to some boundary conditions problem or some division by 0. However, here we're using identical BCs, same geometry, really only the wind tunnel in rotated. Do you see any issue with the setup that might be an oversight?

Thank you very much for your time.

Best,

Patrick

wyldckat commented 2 years ago

Quick question: What does checkMesh -allGeometry -allTopology reveal on both cases?

kastnerp commented 2 years ago

Thanks, Bruno!

Case working: https://github.com/kastnerp/Eddy3D-BoxDomainIssue/blob/main/Eindhoven_51.44844_5.46475_dir0/0/checkMesh.log Case crashing: https://github.com/kastnerp/Eddy3D-BoxDomainIssue/blob/main/Eindhoven_51.44844_5.46475_dir100/100/checkMesh.log

Ok, I figured it would have something to do with the mesh (as it always does). Would you possibly know of any suggestions w.r.t. snappyHexMeshDict to make this more robust? The building geometries come straight from OpenStreetMaps, there is not much I can do here if I want to keep my pre-processing effort minimal.

Sidenote: Turning snapping off via

castellatedMesh true;
snap false;

does not solve the problem either. Hence, I wasn't sure if there something more fundamental going wrong.

Best,

Patrick

wyldckat commented 2 years ago

Quick answer:

Checking topology...
    Boundary definition OK.
    Cell to face addressing OK.
    Point usage OK.
    Upper triangular ordering OK.
    Face vertices OK.
    Topological cell zip-up check OK.
    Face-face connectivity OK.
  <<Writing 12 cells with zero or one non-boundary face to set oneInternalFaceCells
   *Number of regions: 13
    The mesh has multiple regions which are not connected by any face.
  <<Writing region information to "0/cellToRegion"
  <<Writing region 0 (fully disconnected) with 1 cells to cellSet region0
  <<Writing region 1 (fully disconnected) with 1 cells to cellSet region1
  <<Writing region 2 (fully disconnected) with 1 cells to cellSet region2
  <<Writing region 3 (fully disconnected) with 1 cells to cellSet region3
  <<Writing region 4 (fully disconnected) with 1 cells to cellSet region4
  <<Writing region 5 (fully disconnected) with 1 cells to cellSet region5
  <<Writing region 6 (fully disconnected) with 1 cells to cellSet region6
  <<Writing region 7 (fully disconnected) with 1 cells to cellSet region7
  <<Writing region 8 (fully disconnected) with 1 cells to cellSet region8
  <<Writing region 9 (fully disconnected) with 1 cells to cellSet region9
  <<Writing region 10 (fully disconnected) with 1 cells to cellSet region10
  <<Writing region 11 (fully disconnected) with 1 cells to cellSet region11
  <<Writing region 12 (fully disconnected) with 944059 cells to cellSet region12

Fully disconnected regions cannot be solved for, hence the crash while solving the matrix:

        ZN4Foam17DICPreconditioner15calcReciprocalDERNS_5FieldIdEERKNS_9lduMatrixE [0x106b488+0xc8]

i.e. Foam::DICPreconditioner::calcReciprocal(FieldId, lduMatrix)

Solution: Use subsetMesh to extract region12.