View Issue Details

IDProjectCategoryView StatusLast Update
0001680OpenFOAM[All Projects] Bugpublic2015-05-01 00:44
ReporterderekmAssigned Tohenry 
PriorityimmediateSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
PlatformGNU/LinuxOSOpenSuSEOS Version12.3
Product Version 
Fixed in Version 
Summary0001680: Viewfactors throws floating point error with Baffles
DescriptionA working case has baffles added to it then Viewfactorsgen throws floating point error. This was found to be data sensitive as it occured when the baffle was in proximity to a heater region and did not occur when the baffle at some distance. The error occurs in both single and parallel working three cases attached, Two where the crash occurs one where it works. Two types of baffle were tested, 3D thermo and "normal"
[code]
alculating view factors...
[1] #0 Foam::error::printStack(Foam::Ostream&) at ??:?
[1] #1 Foam::sigFpe::sigHandler(int) at ??:?
[1] #2 in "/lib64/libc.so.6"
[1] #3
[1] at ??:?
[1] #4
[1] at ??:?
[1] #5 __libc_start_main in "/lib64/libc.so.6"
[1] #6
[1] at /home/abuild/rpmbuild/BUILD/glibc-2.17/csu/../sysdeps/x86_64/start.S:126
[linux-kzcl:05159] *** Process received signal ***
[linux-kzcl:05159] Signal: Floating point exception (8)
[linux-kzcl:05159] Signal code: (-6)
[linux-kzcl:05159] Failing at address: 0x3e800001427
[linux-kzcl:05159] [ 0] /lib64/libc.so.6(+0x350e0) [0x7ff5999df0e0]
[linux-kzcl:05159] [ 1] /lib64/libc.so.6(gsignal+0x35) [0x7ff5999df065]
[linux-kzcl:05159] [ 2] /lib64/libc.so.6(+0x350e0) [0x7ff5999df0e0]
[linux-kzcl:05159] [ 3] viewFactorsGen() [0x41fa5b]
[linux-kzcl:05159] [ 4] viewFactorsGen() [0x41cab6]
[linux-kzcl:05159] [ 5] /lib64/libc.so.6(__libc_start_main+0xf5) [0x7ff5999cba15]
[linux-kzcl:05159] [ 6] viewFactorsGen() [0x41f34d]
[linux-kzcl:05159] *** End of error message ***
[/code]
Steps To ReproduceRun case as per Allrun script in case viwwfactorsgen crashes
Additional Informationcases are between 1E6 and 2E6 cells
TagsNo tags attached.

Activities

derekm

2015-04-30 14:20

reporter  

three_cases.zip (148,298 bytes)

derekm

2015-04-30 15:57

reporter   ~0004704

The severity is incorrect it is MAJOR / Severe

derekm

2015-04-30 19:55

reporter   ~0004708

Cause: Viewfactorsgen does not handle patches which are coincident e.g. baffles
the following function in viewfactors.c attempts to divide by the scalar distance between the two patches
[code]
scalar calculateViewFactorFij
(
    const vector& i,
    const vector& j,
    const vector& dAi,
    const vector& dAj
)
{
    vector r = i - j;
    scalar rMag = mag(r);
    scalar dAiMag = mag(dAi);
    scalar dAjMag = mag(dAj);

    vector ni = dAi/dAiMag;
    vector nj = dAj/dAjMag;
    scalar cosThetaJ = mag(nj & r)/rMag;
    scalar cosThetaI = mag(ni & r)/rMag;

    return
    (
        (cosThetaI*cosThetaJ*dAjMag*dAiMag)
       /(sqr(rMag)*constant::mathematical::pi)
    );
}
[/code]
FIX: This can be fixed by substituting the following
[code]
scalar calculateViewFactorFij
(
    const vector& i,
    const vector& j,
    const vector& dAi,
    const vector& dAj
)
{
    vector r = i - j;
    scalar rMag = mag(r);
   
    scalar dAiMag = mag(dAi);
    scalar dAjMag = mag(dAj);
    if ( mag(r)==0)
    { return 0; }
    else
    {
    vector ni = dAi/dAiMag;
    vector nj = dAj/dAjMag;
    scalar cosThetaJ = mag(nj & r)/rMag;
    scalar cosThetaI = mag(ni & r)/rMag;

    return
    (
        (cosThetaI*cosThetaJ*dAjMag*dAiMag)
       /(sqr(rMag)*constant::mathematical::pi)
    );
  }
}

[/code]

henry

2015-04-30 22:25

manager   ~0004709

Thanks for the report and proposed fix. I have incorporated the equivalent change in OpenFOAM-2.3.x and -dev, please reopen this report if it causes problems.

Issue History

Date Modified Username Field Change
2015-04-30 14:20 derekm New Issue
2015-04-30 14:20 derekm File Added: three_cases.zip
2015-04-30 15:57 derekm Note Added: 0004704
2015-04-30 19:55 derekm Note Added: 0004708
2015-04-30 22:25 henry Note Added: 0004709
2015-04-30 22:25 henry Status new => resolved
2015-04-30 22:25 henry Resolution open => fixed
2015-04-30 22:25 henry Assigned To => henry