View Issue Details

IDProjectCategoryView StatusLast Update
0004193OpenFOAMPatchpublic2024-12-30 11:43
Reporterwyldckat Assigned Tohenry  
PrioritynormalSeverityminorReproducibilityhave not tried
Status resolvedResolutionfixed 
PlatformGNU/LinuxOSOtherOS Version(please specify)
Product Version12 
Fixed in Versiondev 
Summary0004193: Herschel-Bulkley implementation does not allow initializing with 'k' or 'tau0' values larger than ~1
DescriptionIn the HerschelBulkley class, there is a division protection which relies on 'vSmall'.
However, when dividing by 1e-308 (am using DP build), the numerator is multiplied by 1e308, which if large enough (e.g. 10 or 20), will result in overflow for double precision float.

This overflow occurs at initialization, for example, with the following model settings:

        k 15.0;
        n 0.25;
        tau0 20.5;

Attached is the proposed fix (this time with the correct line breaking bytes), to use 'small' instead of 'vSmall':
  - HerschelBulkley.C - the modified file to update 'src/MomentumTransportModels/momentumTransportModels/laminar/generalisedNewtonian/generalisedNewtonianViscosityModels/strainRateViscosityModels/HerschelBulkley/HerschelBulkley.C' in OpenFOAM 12.

  - HerschelBulkley_small_v1.patch - shows the modification.

Attached is also a test case:
  - pitzDailySteadyHB.tar.gz

It's based in 'incompressibleFluid/pitzDailySteady', adapted to use this rheology model, in which also changed the inlet vector just to try and stress test the laminar fluid flow profile.

  - In the file 'constant/momentumTransport', it's just a matter of changing the comment prefix in lines 41 and 42 to use coefficients which work without problems ('$HerschelBulkleyLow'), vs those which crash ('$HerschelBulkleyHigh').

Steps To Reproducetar -xf pitzDailySteadyHB.tar.gz

cd pitzDailySteadyHB
./Allrun

Results in SigFPE, using unmodified OpenFOAM 12 (and dev), as in attached file 'log'.
TagsNo tags attached.

Activities

wyldckat

2024-12-23 15:28

updater  

HerschelBulkley.C (3,255 bytes)   
HerschelBulkley_small_v1.patch (1,029 bytes)   
log (4,591 bytes)   

henry

2024-12-23 15:42

manager   ~0013492

Why choose small rather than rootVSmall? What is the smallest small which ensures no overflow from the division?

wyldckat

2024-12-23 15:56

updater   ~0013493

Simple because 'small' seemed small enough and it was the one I knew without searching for all available options.

I'll test 'rootVSmall' and let you know once the build update is complete (didn't check if it needs to build several template dependencies, simply ran 'Allwmake' at the root folder).

wyldckat

2024-12-23 16:09

updater   ~0013494

Have confirmed that 'rootVSmall' is good enough.
Please find in attachment the updated files:

  - HerschelBulkley.C - the modified file to update 'src/MomentumTransportModels/momentumTransportModels/laminar/generalisedNewtonian/generalisedNewtonianViscosityModels/strainRateViscosityModels/HerschelBulkley/HerschelBulkley.C' in OpenFOAM 12.
     - Assuming that MantisBT doesn't rename the file.

  - HerschelBulkley_small_v2.patch - shows the modification.
HerschelBulkley-2.C (3,265 bytes)   
HerschelBulkley_small_v2.patch (1,039 bytes)   

henry

2024-12-30 11:43

manager   ~0013495

Resolved by commit 95047b2132b53958ab69567c7dcf260952890857

Issue History

Date Modified Username Field Change
2024-12-23 15:28 wyldckat New Issue
2024-12-23 15:28 wyldckat File Added: HerschelBulkley.C
2024-12-23 15:28 wyldckat File Added: HerschelBulkley_small_v1.patch
2024-12-23 15:28 wyldckat File Added: pitzDailySteadyHB.tar.gz
2024-12-23 15:28 wyldckat File Added: log
2024-12-23 15:42 henry Note Added: 0013492
2024-12-23 15:56 wyldckat Note Added: 0013493
2024-12-23 16:09 wyldckat Note Added: 0013494
2024-12-23 16:09 wyldckat File Added: HerschelBulkley-2.C
2024-12-23 16:09 wyldckat File Added: HerschelBulkley_small_v2.patch
2024-12-30 11:43 henry Assigned To => henry
2024-12-30 11:43 henry Status new => resolved
2024-12-30 11:43 henry Resolution open => fixed
2024-12-30 11:43 henry Fixed in Version => dev
2024-12-30 11:43 henry Note Added: 0013495