Skip to content

Simulation with codedFixedValueBoundary condition crashes with load balancing #37

Closed

Description

@MahadevP2001

When I use the codedFixedValue boundary condition to provide a power law velocity profile at the inlet, the simulation crashes after the first load balance. The error is a SIGSEGV error. This simulation runs successfully when normal fixedValue boundary condition is used.

This is the code I used for the codedFixedValue

  inlet
{
    type            codedFixedValue;
    value           uniform (690 0 0);

    name            boundaryLayerProfile;

code
#{
    const vectorField& Cf = patch().Cf();
    vectorField& field = *this;

    scalar Umax = 690;
    scalar D = 0.00102 ;//1mm
    scalar delta = 10.0*D;
    scalar powerbl = 1.0/7.0;

    forAll(Cf, i)
    {
        scalar z = Cf[i].z();

        scalar Ux;
    scalar eta = z/delta;

        eta = min(max(eta, 0.0), 1.0);

        Ux = Umax * pow(eta,powerbl );


        

        field[i] = vector(Ux, 0, 0);
    }
#};
  }

I have also attached the error lines from my log file. I would be grateful if you could help me with this error and perhaps suggest an alternative for codedFixedValue to provide the inlet profile.

codedFixedValue_errorLog.txt

Activity

  1. self-assigned this
    on May 3, 2026
  2. FoamScience commented on May 3, 2026

    @FoamScience
    Collaborator

    Hi @MahadevP2001, great, you found a hidden OpenFOAM bug; blastAMR exposed it for you case.

    #39 should have the fix (build from codedFixedValue-segfault to test it). We roll with this until it gets fixed upstream (we need a fix here for current OpenFOAM versions anyway)

    Since I didn't have a minimal case where this could be reproduced, I made sure the segfault goes away. Would be great if you can confirm:

    • No more segfaulting in your case
    • alpha and U values seem reasonable (a comparison with a static mesh is best, but you can also rely on just intuition for now). This makes sure the fix doesn't map values to the wrong boundary faces.

    Once I get your confirmation, I will merge the PR

  3. MahadevP2001 commented on May 8, 2026

    @MahadevP2001
    Author

    I tested the update on a 2d version of my case that also used to crash on load balancing and can confirm that :

    The solver no longer crashes with segfault on balancing.

    The velocity and volume fraction are indeed reasonable. I had written a custom power-law boundary condition when codedFixedValue was not working before, and the volume fraction contours with the custom BC and codedFixedValue BC after the fix are the same so I do think it is working correctly.

    Thanks a lot for looking into this!

  4. added a commit that references this issue on May 10, 2026
  5. FoamScience commented on May 10, 2026

    @FoamScience
    Collaborator

    Merged, you can go back to v2212.

  6. added a commit that references this issue on May 10, 2026
    f4c5c6f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions