CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Running, Solving & CFD

codedMixed runs well on serial but crashes in parallel

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 23, 2024, 15:12
Default codedMixed runs well on serial but crashes in parallel
  #1
New Member
 
Matias Alberto Aguirre
Join Date: Mar 2023
Posts: 12
Rep Power: 3
maguirre is on a distinguished road
Hi foamers!

During a parallel simulation, I encounter an issue with a custom boundary condition in OpenFOAM. The boundary condition is applied to a patch (plasmaSurf) and works fine in serial runs. However, in parallel, the simulation crashes with errors related to field sizes and bad memory allocation.

Key Details:
  • The plasmaSurf patch has zero faces on some processors after decomposition.
  • Errors include messages like:
    • size 0 is not equal to the given value of X (on processors with nFaces = 0)
    • bad size -Y (on processors with nFaces != 0)

What I've Tried:
  • Verified the mesh with checkMesh -parallel (result is OK).
  • Checked plasmaSurf in the processorX directories—confirmed it has zero faces on some processors.
  • Simplified the boundary condition logic only to set value or gradient, but the issue persists in parallel runs.
  • Switched to a simpler boundary condition (e.g., fixedValue) as a temporary fix, which works fine in parallel.
  • Ensured decomposePar produces an evenly balanced decomposition and checked for mesh consistency.

Suspected Cause: The problem seems related to how the codedMixed boundary condition handles patches with zero faces in parallel. This might be a bug in my implementation or an inconsistency in how OpenFOAM distributes the patch data.

Question: How can I ensure the codedMixed boundary condition is robust to parallel runs where a patch might have zero faces on some processors? Are there best practices for handling such scenarios, or modifications needed to the codedMixed code to avoid these issues?

Code Implemented:

Code:
plasmaSurf
{
  type            codedMixed;
  namedummy_code;
  refValue        uniform 300;
  refGradient     uniform 0;
  valueFraction   uniform 0;
  
  code
  #{
    if (this->patch().size() == 0) // No faces on this processor
    {
      return;
    }
    scalarField& refGrad = this->refGrad();
    scalarField& refVal = this->refValue();
    scalarField& valueFraction = this->valueFraction();

    // Initialize to zero or default values
    refGrad = scalarField(patch().size(), 0.0);
    refVal = scalarField(patch().size(), 300.0);
    valueFraction = scalarField(patch().size(), 0.0);
  #};
}
(that code does not work even if the code block is empty)

Typical Error:

Code:
[1]
[1]
[1] --> FOAM FATAL IO ERROR:
[1] size 0 is not equal to the given value of -1871300200
[1]
[1] file: IStringStream.sourceFile from line 0 to line 4.
[1]
[1]     From function Foam::Field<Type>::Field(const Foam::word&, const Foam::dictionary&, Foam::label) [with Type = double; Foam::label = int]
[1]     in file /home/ubuntu/OpenFOAM/OpenFOAM-11/src/OpenFOAM/lnInclude/Field.C at line 208.
[1]
FOAM parallel run exiting
[1]
[0]
[0]
[0] --> FOAM FATAL ERROR:
[0] bad size -534376040
[0]
[0]     From function void Foam::List<T>::setSize(Foam::label) [with T = double; Foam::label = int]
[0]     in file /home/ubuntu/OpenFOAM/OpenFOAM-11/src/OpenFOAM/lnInclude/List.C at line 285.
[0]
FOAM parallel run aborting
[0]
--------------------------------------------------------------------------
MPI_ABORT was invoked on rank 1 in communicator MPI COMMUNICATOR 3 SPLIT FROM 0
with errorcode 1.

NOTE: invoking MPI_ABORT causes Open MPI to kill all MPI processes.
You may or may not see output from other processes, depending on
exactly when Open MPI kills them.
--------------------------------------------------------------------------
[0] #0  Foam::error::printStack(Foam::Ostream&)
Any insights or suggestions would be greatly appreciated!
maguirre is offline   Reply With Quote

Reply

Tags
codedmixed, foamrun, parallel


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
type limitTemperature problem AdamRM OpenFOAM Running, Solving & CFD 6 November 16, 2023 06:55
chtMultiRegionFoam is slower in parallel than serial froberto OpenFOAM Running, Solving & CFD 2 September 12, 2023 14:55
To continue from latestTime of a previous serial run in parallel redbullah OpenFOAM 2 July 26, 2018 15:01
Different results between parallel and serial processing Sarah_Fluent FLUENT 5 March 6, 2018 12:42
Moving mesh crashes in parallel (1.5-dev) jploz OpenFOAM Programming & Development 8 October 21, 2009 18:22


All times are GMT -4. The time now is 03:29.