You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Simulation with codedFixedValueBoundary condition crashes with load balancing #37
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.
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.
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.
Activity
FoamScience commentedon May 3, 2026
Hi @MahadevP2001, great, you found a hidden OpenFOAM bug; blastAMR exposed it for you case.
#39 should have the fix (build from
codedFixedValue-segfaultto 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:
Once I get your confirmation, I will merge the PR
MahadevP2001 commentedon May 8, 2026
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!
Merge pull request #39 from STFS-TUDa/codedFixedValue-segfault
FoamScience commentedon May 10, 2026
Merged, you can go back to v2212.
fix: guard against unavailable UPstream::barrier in older openfoam ve…