ladybug-tools / butterfly

:butterfly: A light python API for creating and running OpenFoam cases for CFD simulation.
http://ladybug-tools.github.io/butterfly.html
GNU General Public License v3.0
249 stars 71 forks source link

1st and 2nd order schemes fails for heat transfer recipe #286

Open gamemakerh opened 7 years ago

gamemakerh commented 7 years ago

I'm trying to implement

**- Check mesh

the problem is that I'm getting error.

First from Check mesh block I'm getting MAX non-orthonogality of 38.93709. This number is converted to integer and feeded into Generate fvSchemes based on mesh non-orthogonalities block. This block generates this output

 /*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  v1706+                                |
|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
/* Butterfly 0.0.4                https://github.com/ladybug-tools/butterfly *\
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     4.0;
    format      ascii;
    class       dictionary;
    location    "system";
    object      fvSchemes;
}

ddtSchemes
{

    default     steadyState;

}

gradSchemes
{

    grad(U)     cellMDLimited Gauss linear 0.333;

    default     cellMDLimited Gauss linear 0.333;

}

divSchemes
{

    default     none;

    div(phi,epsilon)        bounded Gauss linearUpwind grad(epsilon);

    div(phi,U)      bounded Gauss linearUpwind grad(U);

    div((nuEff*dev2(T(grad(U)))))       Gauss linear;

    div(phi,k)      bounded Gauss linearUpwind default;

    div(phi,omega)      bounded Gauss linearUpwind default;

}

laplacianSchemes
{

    default     Gauss linear orthogonal;

}

interpolationSchemes
{

    default     linear;

}

snGradSchemes
{

    default     orthogonal;

}

fluxRequired
{

    default     no;

}

NOW STRANGE PART !!!! -------------

This block output is not compatible with Heat transfer recipe fvSchemes_ input This block can only be connected with fvSolution input. this is strange... But... in other hand, all setup files seems to be geenrated correctly in the OF case directory.

So using additional blocks for genDivSchemes I created 2 cases. first order and second order (from @mostaphaRoudsari and @TheodoreGalanos post about fvSchemes)

first order scheme generated this output

// first order
divSchemes
{
    default     none;
    div(phi,epsilon)       bounded Gauss upwind default;
    div(phi,U)      bounded Gauss upwind grad(U);
    div((nuEff*dev2(T(grad(U)))))   Gauss linear;
    div(phi,k)      bounded Gauss upwind grad(k);
}

Second order scheme generated this output:

// second order
divSchemes
{
    default     none;
    div(phi,epsilon)    bounded Gauss linearUpwind grad(epsilon);
    div(phi,U)      bounded Gauss linearUpwind grad(U);
    div((nuEff*dev2(T(grad(U)))))       Gauss linear;
    div(phi,k)      bounded Gauss linearUpwind grad(k);
}

So... I tried to launch this simulation, but I got error message.

**> --> FOAM FATAL IO ERROR:

keyword div(phi,T) is undefined in dictionary "/home/ofuser/workingDir/butterfly/Duct_Simulation430oclock_3/system/fvSchemes.divSchemes"

file: /home/ofuser/workingDir/butterfly/Duct_Simulation430oclock_3/system/fvSchemes.divSchemes from line 38 to line 48.

From function const Foam::entry& Foam::dictionary::lookupEntry(const Foam::word&, bool, bool) const
in file db/dictionary/dictionary.C at line 551.

FOAM exiting**

Can someone explain what just happened ? is this a bug or again I'm making mess ?

P.S. on top of that I tried to implement different solver for fvSolution Using solutionParam block I've modified code from this

solvers
{
U
{
relTol 0.1;
tolerance 1e-8;
nSweeps 1;
smoother GaussSeidel;
solver smoothSolver;
}
k
{
relTol 0.1;
tolerance 1e-8;
nSweeps 1;
smoother GaussSeidel;
solver smoothSolver;
}
epsilon
{
relTol 0.1;
tolerance 1e-8;
nSweeps 1;
smoother GaussSeidel;
solver smoothSolver;
}
p_rgh
{
relTol 0.01;
solver PCG;
preconditioner DIC;
tolerance 1e-08;
}
T
{
relTol 0.1;
tolerance 1e-8;
nSweeps 1;
smoother GaussSeidel;
solver smoothSolver;
}
}

to this:

solvers
{
U
{
relTol 0.1;
tolerance 1e-8;
nSweeps 1;
smoother GaussSeidel;
solver smoothSolver;
}
k
{
relTol 0.1;
tolerance 1e-8;
nSweeps 1;
smoother GaussSeidel;
solver smoothSolver;
}
epsilon
{
relTol 0.1;
tolerance 1e-8;
nSweeps 1;
smoother GaussSeidel;
solver smoothSolver;
}
p_rgh
{
solver GAMG;
tolerance 1e-8;
relTol 0.001;
smoother GaussSeidel;
cacheAgglomeration true;
nCellsInCoarsestLevel 20;
agglomerator faceAreaPair;
mergeLevels 1;
}
T
{
relTol 0.1;
tolerance 1e-8;
nSweeps 1;
smoother GaussSeidel;
solver smoothSolver;
}
}

But because div schemes spiting the error I cant evaluate this part. (But in general GAMG solver is working for my case (just without div schemes))

Maybe someone can guide (again lol) with this problem ?

I hope I'm not starting to annoy you guys (developers) with my often issues, but, to be honest, I'm very like what you did and I want to master this tool of yours and, if possible, help to develop even better version of BF.

Sincerrely, S.

check mesh divschemesupdate fvsolution_update

@mostaphaRoudsari picture 7982ffba-8b26-11e6-8d03-35c51f565c56

TheodoreGalanos commented 7 years ago

Hi @gamemakerh thanks for reporting!

This is actually on us I believe. The component generating the 1st and 2nd order schemes seems to be only set up for incompressible cases.

I would suggest that you go on passing your own fvSchemes/fvSolution for these until we update the component, or leave it at the default state.

Regards, Theodore.

gamemakerh commented 7 years ago

Ok. Thanks for info. I'll make my own enchanted div scheme for heat transfer problems then.

TheodoreGalanos commented 7 years ago

Yeah you can use the one the component is generating, and copy/paste it to the additionalparams, adding the value missing for temperature. You can use the same scheme as the rest (either 1st or 2nd) in the file for T.

gamemakerh commented 7 years ago

I will try to implement this. Thanks for info.

mostaphaRoudsari commented 6 years ago

@TheodoreGalanos what is the fix for this? Do we need to have them for each recipe?

TheodoreGalanos commented 6 years ago

@mostaphaRoudsari Yes we need to have one for each recipe given the different parameters that they are solving. I think the default we have for heat transfer can be the base, where we change the schemes as we do in the incompressible (from upwind to linearUpwind).