NREL / SOWFA-6

34 stars 35 forks source link

Problem in setting divSchemes 'Gauss localBlended linear upwind' #61

Open Simon7537 opened 1 year ago

Simon7537 commented 1 year ago

I tried to run the case tut.ABLflatTerrain.precursor in /exampleCases, but when I ran superDeliciousVanilla as split run to get to developed-flow stage, error occured:

Starting time loop Courant Number mean: 0.26680022187 max: 0.283251178581 deltaT = 1.19047619048 Time Step = 1, Time = 0 to 1.19047619048 s

Predictor

= (8 -2.58700715171e-17 0) = (8 -9.70127681891e-18 0) = (1.60014091459e-13 5.04011647232e-18 0) [0] [0] [0] --> FOAM FATAL ERROR: [0] request for surfaceScalarField UBlendingFactor from objectRegistry region0 failed available objects of type surfaceScalarField are 3 ( ghf phi buoyancyTerm ) The only modification I made was about cores and number of cells. After some tests I found that the problem is about divSchemes in system/fvSchemes. As long as the dicSchemes of U,T is set div(phi,U) Gauss localBlended linear upwind; this problem of UBlendingFactor would occur. If set to Gauss linear, this case could run normally. Is 'Gauss localBlended linear upwind' a unique divScheme of SOWFA? How to successfully use it?
rthedin commented 11 months ago

Apologies for the late response. Can you share your fvSchemes file? Maybe you don't have the table UBlendingFactor set?

Simon7537 commented 10 months ago

Apologies for the late response. Can you share your fvSchemes file? Maybe you don't have the table UBlendingFactor set?

My fvSchemes file is just copied from the exampleCases.

/--------------------------------- C++ -----------------------------------\ ========= | \ / F ield | OpenFOAM: The Open Source CFD Toolbox \ / O peration | Website: https://openfoam.org \ / A nd | Version: 6 \/ M anipulation | *---------------------------------------------------------------------------*/

FoamFile { version 2.0; format ascii; class dictionary; location "system"; object fvSchemes; }

// * //

ddtSchemes { default backward; // default CrankNicolson 1.0; }

gradSchemes { default Gauss linear; grad(U) Gauss linear; }

divSchemes { default Gauss linear; //div(phi,U) Gauss linear; //div(phi,T) Gauss linear; div(phi,U) Gauss localBlended linear upwind; div(phi,T) Gauss localBlended linear upwind; //div(phi,U) Gauss localBlended linear linearUpwind grad(U); //div(phi,T) Gauss localBlended linear linearUpwind grad(U); div(R) Gauss linear; div(U) Gauss linear; div((nuEff*dev(grad(U).T()))) Gauss linear; div(B) Gauss linear; div(phi,B) Gauss linear; div(phi,k) Gauss linear; }

laplacianSchemes { default Gauss linear corrected; laplacian(rUA,p) Gauss linear corrected; laplacian((1|A(U)),p) Gauss linear corrected; laplacian(interpolate((1|A(U))),p) Gauss linear corrected; laplacian(interpolate((1|A(U))),pd) Gauss linear corrected; laplacian(nu,U) Gauss linear corrected; laplacian(nuEff,U) Gauss linear corrected; laplacian(kappaEff,T) Gauss linear corrected; laplacian(DBEff,B) Gauss linear corrected; laplacian(nuSgs,U) Gauss linear corrected; }

interpolationSchemes { default linear; }

snGradSchemes { default corrected; }

fluxRequired { default no; p_rgh ; }

bodyForceStabilization true;

schemeBlending {

// Table of blending factors vs. cell face size.
faceSizeBlendingTable
(
// area          U        T
    (0.096      0.920  0.840 )
    (0.39       0.920  0.840 )
    (1.563      0.940  0.880 )
    (6.25       0.960  0.920 )
    (25         0.980  0.960 )
    (100        1.000  1.000 )
    (1E6        1.000  1.000 )
);

// Height above which blending factor begins to transition
// from heightBlendingFactor_z1 to heightBlendingFactor_z2.
heightBlending_z1            800.0;

// Height above which blending factor is heightBlendingFactor_z2.
heightBlending_z2            1000.0;

heightBlendingFactorU_z1     1.0;
heightBlendingFactorU_z2     0.8;

heightBlendingFactorT_z1     1.0;
heightBlendingFactorT_z2     0.8;

// In calculating height, use wall distance or absolute distance.
useWallDistZ                 false;

}

// ***** //

rthedin commented 10 months ago

What type of information is printed on your superDeliciousVanilla log right before the "Starting time loop"? Do you have the following lines?

Creating divergence scheme blending factor field, UBlendingFactor
Creating divergence scheme blending factor field, TBlendingFactor

I checked some of my runs and the commit point I was using, and I'm at an older commit where the following line still exists within superDeliciousVanilla.C: include "createDivSchemeBlendingField.H". That is where the blending used to happen. The logic has been changed by PR https://github.com/NREL/SOWFA-6/pull/52, where such a line has been removed: https://github.com/NREL/SOWFA-6/pull/52/files#diff-a95436e220f84358494bdeccdea954f9280b0dd21dffe7245f46f772a384167aL66

Hopefully that helps you with debugging.

Simon7537 commented 10 months ago

What type of information is printed on your superDeliciousVanilla log right before the "Starting time loop"? Do you have the following lines?

Creating divergence scheme blending factor field, UBlendingFactor
Creating divergence scheme blending factor field, TBlendingFactor

I checked some of my runs and the commit point I was using, and I'm at an older commit where the following line still exists within superDeliciousVanilla.C: include "createDivSchemeBlendingField.H". That is where the blending used to happen. The logic has been changed by PR #52, where such a line has been removed: https://github.com/NREL/SOWFA-6/pull/52/files#diff-a95436e220f84358494bdeccdea954f9280b0dd21dffe7245f46f772a384167aL66

Hopefully that helps you with debugging.

Oh, that's right. This line was indeed commented out in my version. So does this mean that this UBlending is not applicable in the latest version? Or can I still use it normally as long as I uncomment and recompile?Is this important for simulation?

mak-10 commented 3 months ago

"I think you need to activate the function object that creates the blending factors." Matthew Churchfield.

You can activate it in your controlDict: functions { #include "schemeBlending" }