View Issue Details

IDProjectCategoryView StatusLast Update
0003744OpenFOAMBugpublic2021-10-27 23:50
Reportermillszg Assigned Tohenry  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
PlatformGNU/LinuxOSUbuntuOS Version15.04
Product Version9 
Fixed in Versiondev 
Summary0003744: Unable to use codedFunction2 for the binary diffusion terms in the thermophysical transport models
DescriptionWhen attempting to use a codedFunction2 for the binary diffusion terms in the thermophysical transport model, the code is unable to compile because the dictionary key which contains a dash (i.e. H2-H) is used in the name of the generated functions. I am new to using codedFunction2, so I'm not sure if it is possible to specify the name to use for the generated function, but if not, its likely not possible to use codedFunction2 in the current implementation. Currently I have implemented changes in the code to use an underscore instead of a dash in the binary diffusion term keys. This allows for codedFunction2 to be used as the generated names no longer have an illegal character in them, but I have not tested to make sure it doesn't break other parts of the code.
Steps To ReproduceI believe this will occur anytime codedFunction2 is used for a binary diffusion term in the thermophysicalTransport file. Specifically for me, using the following in thermophysicalTransport with reactingFoam produced errors relating to the function name (which contained H2-H) when the dynamic code was being compiled:

simulationType laminar;

laminar
{
    model FickianFourier;
    mixtureDiffusionCoefficients no;
   D
   {
       H2-H
        {
        type coded;

        code
        #{
            return x * sqrt(x) / y * (0.00300504 + x * (5.57725e-06 + x * (-6.00278e-09 + x * (3.45469e-12 + x * (-7.73951e-16)))));
        #};
    }
}

When I updated the code in
Additional InformationBy changing lines 116 and 117 in Fickian.C from:
const word nameij(species[i] + '-' + species[j]);
const word nameji(species[j] + '-' + species[i]);

to:
const word nameij(species[i] + '_' + species[j]);
const word nameji(species[j] + '_' + species[i]);

and updating the binary diffusion keys in thermophysicalTransport to use underscores as well, the dynamic code was able to compile and reactingFoam was able to run without issues.



TagsNo tags attached.

Activities

henry

2021-10-24 11:41

manager   ~0012258

Try this in OpenFOAM-dev:

commit ad28cb49b553efb43f036b424bd8b5d0c0022c7c (HEAD -> master, origin/master, origin/HEAD)
Author: Henry Weller <http://cfd.direct>
Date: Sun Oct 24 11:38:55 2021 +0100

    codedBase: Added support for '-' in entry names
    
    by mapping '-' to '_' in the generation of the code name.
    
    Resolves bug-report https://bugs.openfoam.org/view.php?id=3744

Issue History

Date Modified Username Field Change
2021-10-22 18:42 millszg New Issue
2021-10-24 11:41 henry Note Added: 0012258
2021-10-27 23:50 henry Assigned To => henry
2021-10-27 23:50 henry Status new => resolved
2021-10-27 23:50 henry Resolution open => fixed
2021-10-27 23:50 henry Fixed in Version => dev