CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (https://www.cfd-online.com/Forums/openfoam-solving/)
-   -   alphat (https://www.cfd-online.com/Forums/openfoam-solving/144625-alphat.html)

Wien3 November 18, 2014 04:08

alphat
 
Good Morning,
I'm studying an OF model which consists on a cube which has a sphere inside. A fluid flows from inlet to outlet.
As it is incompressible, I think I have to assign the 4 walls like this:

type alphatWallFunction;
value uniform 0;


The problem is that it appears this error:

PHP Code:

file: /home/jstoeckl/Desktop/grav0/0/alphat.boundaryField.Back from line 26 to line 27.

    From 
function fvPatchField<Type>::New(const fvPatch&, const DimensionedField<TypevolMesh>&, const dictionary&)
    
in file /home/opencfd/OpenFOAM/OpenFOAM-2.3.0/src/finiteVolume/lnInclude/fvPatchFieldNew.C at line 143.

FOAM exiting 

I would really like to know how this parameter works. I think its value should be 0 in the solid parts (walls and sphere) and it has a different value in inlet and outlet From this I have my other doubts:
- How do I calculate this value for my incompressible fluid?
- How do I assign these 2 inputs? Should it be just with "fixedValue?


Thank you very much for your help

alexeym November 18, 2014 04:16

Hi,

you've truncated meaningful part of the error message.

About the way alphat is calculated:

Code:

alphat = turbulence->nut()/Prt;
Value of turbulent Prantl number is in general randomly chosen between 0.75 and 0.95 ;)

Wien3 November 18, 2014 04:36

Hi,
I will try to explain my doubts again:
1) Does an incompressible fluid need a Pr number?
2) With this kind of fluid, should I assign solid elements as "alphatWallFunction" or "alphatJayatillekeWallFunction"?
3) And with inlet and outlet, should I assign a "fixedValue" for them or just write "calculated"?? As they are not Walls, I cannot use the alphatFunctions I guess.

Currently my input of alphat is here:
Quote:

dimensions [0 2 -1 0 0 0 0];

internalField uniform 0;

boundaryField
{
Back
{
type alphatJayatillekeWallFunction;
Prt 0.85;
value uniform 0;
}
Bottom
{
type alphatJayatillekeWallFunction;
Prt 0.85;
value uniform 0;
}
Front
{
type alphatJayatillekeWallFunction;
Prt 0.85;
value uniform 0;
}
Icosphere
{
type alphatJayatillekeWallFunction;
Prt 0.85;
value uniform 0;
}
Inlet
{
type calculated;
value uniform 0;
}
Outlet
{
type calculated;
value uniform 0;
}
Top
{
type alphatJayatillekeWallFunction;
Prt 0.85;
value uniform 0;
}
}
I'm sorry if I didn't expose my doubts more clearly before.

Thank you again

alexeym November 18, 2014 04:47

Hi,

Quote:

Originally Posted by Wien3 (Post 519727)
1) Does an incompressible fluid need a Pr number?

It's not fluid, it's solver who needs Prandtl number.

Quote:

2) With this kind of fluid, should I assign solid elements as "alphatWallFunction" or "alphatJayatillekeWallFunction"?
As you're simulating incompressible fluid (solver uses nut field, i.e. equations are divided by density), you won't be able to use alphatWallFunction (as it will looks for mut field). So it's "alphatJayatillekeWallFunction" (the only alphat wall function in incompressible turbulence models).

Quote:

3) And with inlet and outlet, should I assign a "fixedValue" for them or just write "calculated"?? As they are not Walls, I cannot use the alphatFunctions I guess.
"calculated" should be OK.

Wien3 November 18, 2014 04:58

Ok thank you very much! So I guess my file was well!

And another question: should I assign the "epsilon, omega, k and nut" in the same way? I mean that every inlet/outlet are "calculated uniform 0" and the walls are kqRWallFunction for k, epsilonWallFunction for epsilon and omegaWallFunction for omega, and nutWallFunction (everything with uniform 0).

Thanks!

alexeym November 18, 2014 05:30

Usually I use zero gradient outlet boundary conditions for turbulence. For inlet it's turbulentIntensityKineticEnergyInlet and similar patch types (see $FOAM_SRC/finiteVolume/fields/fvPatchFields/derived, $FOAM_SRC/turbulenceModels/incompressible/RAS/derivedFvPatchFields folders for names or you can use fixedValue estimated using http://www.cfd-online.com/Wiki/Turbu...ary_conditions). And for walls - yes - wall functions.

Wien3 November 18, 2014 06:27

Hi,
your advice were really helpful! Now I understand quite better many things. I hope this post could be useful too for someone amateur in OF like me.

As it seems you control a lot this program, could you take a look to the post I wrote the last week in this same forum? The one which is called "pressure and velocity in inlet/outlet definitions".

Thank you really much

alexeym November 18, 2014 07:35

I've taken a look at your message but wasn't able to grasp what you're trying to simulate.

Wien3 November 18, 2014 07:48

Well, I'll try to explain.
Corresponding to the model I have described in this forum (a cube with a sphere inside it and a fluid which cross it from inlet to outlet) I'm just trying to analyze the evolution of temperature and pressure in the different elements.
When I imported my model from enGrids, there were only p and U file, so I decided to create T file and change simpleFoam by buoyantBoussinesqSimpleFoam (as it is an incompressible fluid).
Obviously it is not enough to add this file, I had to do it with others, for example alphat, g, p_rgh, etc.
Everything worked fine until I analyse the p and p_rgh, and I notice two things:
- The first one is that when I click play it doesn't continue until my endTime (defined in controlDict) which is 1000. It does it just until 2, which is the numbers of iterations.
- The second one is it doesn't appear any heat transference, so temperature fields stay the same that at the beginning. That's why I need to know if my p and p_rgh (I think T and U are fine) are right or not for defining my model:

PHP Code:

p_rgh

dimensions      
[0 2 -2 0 0 0 0];

internalField   uniform 0;

boundaryField
{
    
Back
    
{
        
type            fixedFluxPressure;
        
rho             rhok;
        
value           uniform 0;
    }
    
Bottom
    
{
        
type            fixedFluxPressure;
        
rho             rhok;
        
value           uniform 0;
    }
    
Front
    
{
        
type            fixedFluxPressure;
        
rho             rhok;
        
value           uniform 0;
    }
    
Icosphere
    
{
        
type            fixedFluxPressure;
        
rho             rhok;
        
value           uniform 0;
    }
    
Inlet
    
{
        
type            fixedFluxPressure;
        
rho             rhok;
        
value           uniform 0;
    }
    
Outlet
    
{
        
type            fixedFluxPressure;
        
rho             rhok;
        
value           uniform 0;
    }
    
Top
    
{
        
type            fixedFluxPressure;
        
rho             rhok;
        
value           uniform 0;
    }


PHP Code:

p
    Back
    
{
        
type zeroGradient;
    }
    
Bottom
    
{
        
type zeroGradient;
    }
    
Front
    
{
        
type zeroGradient;
    }
    
Icosphere
    
{
        
type zeroGradient;
    }
    
Inlet
    
{
        
type zeroGradient;
    }
    
Outlet
    
{
        
type  fixedValue;
        
value uniform 0;
    }
    
Top
    
{
        
type zeroGradient;
  }
    


PHP Code:

T

dimensions      
[0 0 0 1 0 0 0];

internalField   uniform 300;

boundaryField
{
    
Back
    
{
        
type            fixedValue;
        
value           uniform 300;
    }
    
Bottom
    
{
        
type            fixedValue;
        
value           uniform 300;
    }
    
Front
    
{
        
type            fixedValue;
        
value           uniform 300;
    }
    
Icosphere
    
{
        
type            fixedValue;
        
value           uniform 400;
    }
    
Inlet
    
{
        
type            fixedValue;
        
value           uniform 250;
    }
    
Outlet
    
{
        
type            zeroGradient;
    }
    
Top
    
{
        
type            fixedValue;
        
value           uniform 300;
    }


PHP Code:

U
dimensions      
[0 1 -1 0 0 0 0];

internalField   uniform (0 0 0);

boundaryField
{
    
Back
    
{
        
type  fixedValue;
        
value uniform (0 0 0);
    }
    
Bottom
    
{
        
type  fixedValue;
        
value uniform (0 0 0);
    }
    
Front
    
{
        
type  fixedValue;
        
value uniform (0 0 0);
    }
    
Icosphere
    
{
        
type  fixedValue;
        
value uniform (0 0 0);
    }
    
Inlet
    
{
        
type  fixedValue;
        
value uniform (0.535 0 0);
    }
    
Outlet
    
{
        
type zeroGradient;
    }
    
Top
    
{
        
type  fixedValue;
        
value uniform (0 0 0);
    }



I hope now my problem is better explained!

Thanks in advance

alexeym November 18, 2014 09:20

Still don't get what you're trying to do. p_rgh, U, T seem to be reasonable. Pressure (p) is calculated in the solver:

Code:

...
    volScalarField p
    (
        IOobject
        (
            "p",
            runTime.timeName(),
            mesh,
            IOobject::NO_READ,
            IOobject::AUTO_WRITE
        ),
        p_rgh + rhok*gh
    );
...

well, as your p_rhg needs reference (no BCs which fix value), so this code

Code:

    if (p_rgh.needReference())
    {
        p += dimensionedScalar
        (
            "p",
            p.dimensions(),
            pRefValue - getRefCellValue(p, pRefCell)
        );
        p_rgh = p - rhok*gh;
    }

will be also executed. But still solver won't read your p file from 0 folder.

This part is enigmatic:

Quote:

- The first one is that when I click play it doesn't continue until my endTime (defined in controlDict) which is 1000. It does it just until 2, which is the numbers of iterations.
- The second one is it doesn't appear any heat transference, so temperature fields stay the same that at the beginning.
Play? Where do you press play?

If you'd like to discuss you controlDict, fvSolution, and fvSchemes, post your files (and the output of simulation).

Wien3 November 18, 2014 09:49

Hello!
Ok, so those files are fine. You tell that p file is calculated by the programme. Does it mean can I delete it from 0 file or just I have to write every element as uniform 0?

First of all, and to make the model easier, I input a gravity=0, in order to not to be influenced by this force. With the initial conditions mentioned above, it appears this message:

PHP Code:

--> FOAM FATAL ERROR
Continuity error cannot be removed by adjusting the outflow.
Please check the velocity boundary conditions and/or run potentialFoam to initialise the outflow.
Total flux              10.4374
Specified mass inflow   
2.14
Specified mass outflow  
0
Adjustable mass outflow 
0


    From 
function adjustPhi(surfaceScalarField&, const volVectorField&,volScalarField&)
    
in file cfdTools/general/adjustPhi/adjustPhi.C at line 118.

FOAM exiting 

To solve it, I have copied the folder, I changed "SIMPLE" by "potentialFlow" in fvSolutions and run potentialFoam to have initial values for the parameters. After that I copied the 0/U file in the main folder and run again with buoyantBoussinesqSimpleFoam.

I attach the controlDict, fvSolution, and fvSchemes files and also the images with the output of the simulation.

When I said "Pressed Play" I referred to the OpenFOAM, because asi you can see in the images the simulation stops at the 2° step (which is also the number of iterations). As you can see in Temperature picture it doesn't appear any heat transference.

I don't know which file is wrong =S

Thank you in advance

alexeym November 18, 2014 10:08

Hi,

1. with this, rather relaxed convergence criterion

Code:

    residualControl
    {
        "(p|T|U|k|epsilon|omega)" 0.5; //*(7)
    }

it's possible that your simulation runs just for 2 iterations.

2. On your temperature screenshot values of BCs are shown (as you selected patches and not internalMesh). Your BCs are in fixedValue except outlet. So you get these fixed values on your screenshot. If you'd like to see temperature variations - select internalMesh, cut it with Clip filter.

Wien3 November 19, 2014 04:16

Good Morning,
1) Concerning to p file, I have understood it doesn't matter its input because the solver will calculate this value but not from 0 folder. Anyway we cannot delete p from 0 file.

2) Related to reducing the tolerance, I can easily reduce it to 0.31 (which only takes 3 iterances) but if I reduce this value more it diverges (for example with 0.3).
So I guess the responsible of this it is not the tolerance...

3) And talking about your advice related to temperature, it is really useful, but the problem is that my theory about no complete simulation is confirmed. I attach pictures. In the first one you can see the BC temperatures and in the second one how the left part seems to have some heat transference (although it seems to be stopped) and how the sphere, which is 800 K, doesn't have any heat exchange.

Thank you

alexeym November 19, 2014 04:29

Hi,

1. You can. Solver doesn't read p file in the beginning. It reads p_rgh file.

2. In general value of residuals should be below 1e-4.

3. Looking at the attached figure, it seems your simulation diverges. Maybe your posts lack some information? Can you post the case? (Surely I can reproduce it myself but it'll take more time).

Wien3 November 19, 2014 05:49

Hello,
I attach my files. I have change the times in controlDict and it improved just a littel bit. As OF forums don't accept so big folders, I am able to post just 0 and systems files. It gives continuity problems, so after importing 0/U (run with potentialFoam) to the previous folder I can attach the the following pictures. Pay attention to the given values, in the case of pressure and velocity are enormous.

I don't know if everything you need is here. In other case please let me know and I will post it.

alexeym November 19, 2014 07:58

Well, without a mesh it's rather meaningless. Surely I can construct mesh and make the case running. But it'll be my mesh and you've got problems running case on your mesh. Post case with the mesh somewhere else, there are plenty of places where you can store large files.

Wien3 November 19, 2014 09:33

Hello,
I found the way. Here I post two links: the first one is the model with the initial conditions and the second is the one which has the new 0/U file copied from the same case run with potentialFoam, as it gave continuity problems.

http://www.filedropper.com/test00

http://freakshare.com/files/th1rvk69/test01.zip.html

alexeym November 19, 2014 11:39

Hi,

not quite get why I need second archive but...

1. Get yourself new mesh. Really. The geometry is not so complicated.

2. About your configuration

2.1.

Code:

    residualControl
    {
        "(p|T|U|k|epsilon|omega)" 0.3; //*(7)
    }

should be something like

Code:

    residualControl
    {
        "(p_rgh|T|U|k|epsilon|omega)" 1e-2;
    }

2.2.

Code:

ddtSchemes
{
    default Euler;
}

should be

Code:

ddtSchemes
{
    default steadyState;
}

you're using

2.3.

Code:

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

should be

Code:

gradSchemes
{
    default        leastSquares;
}

2.4. For beginning change this

Code:

divSchemes
{
    default          none;
    div(phi,T)      Gauss linearUpwind Gauss; //*(16)
    div(phi,U)      Gauss linearUpwind Gauss;
    div(phi,k)      Gauss upwind;
    div(phi,epsilon) Gauss upwind;
    div(phi,omega)  Gauss upwind;
    div((nuEff*dev(T(grad(U))))) Gauss linear;  //*(6)
}

to

Code:

divSchemes
{
    default          none;
    div(phi,T)      bounded Gauss upwind;
    div(phi,U)      bounded Gauss upwind;
    div(phi,k)      bounded Gauss upwind;
    div(phi,epsilon) bounded Gauss upwind;
    div(phi,omega)  bounded Gauss upwind;
    div((nuEff*dev(T(grad(U))))) Gauss linear;  //*(6)
}

2.5. Set your "relTol"s to 0.01. Or 0.5 if you'd like to go with your "mesh".

2.6. Change solver for p_rgh to GAMG, this will speed up solution process.

3. How did you calculate Pr? It looks rather random.

Guess this is the time to wash my hands, you should read User guide at least.

Naresh yathuru March 6, 2015 09:27

No words to thank you Alexey. you did a great contribution. i was trying to simulate a similar case, u almost cleared most of my doubts.
Respect..!!

Regards
Naresh

Raza Javed May 20, 2019 06:15

Hello Everyone,


I am modeling a laminar fluid flow. But now I want to change my flow from Laminar to Turbulent.



I replaced my Turbulence properties and using kEpsilon Turbulence model.


But when I RUN the solver it gives the following error:


Selecting turbulence model type RAS
Selecting RAS turbulence model kEpsilon


Code:

--> FOAM FATAL IO ERROR:
cannot find file

file: /home/openfoam/raza-4.1/run/circular_fluid/0/fluid/alphat at line 0.

    From function regIOobject::readStream()
    in file db/regIOobject/regIOobjectRead.C at line 72.

FOAM exiting

This error is coming because my "0/fluid/" directory just has p,U,T,epsilon,k and p_rgh files. But I don't know how can I put alphat file in this directory.


Can someone please help me out in this?

I am using chtMultiRegionSimpleFoam and my OpenFoam version is 4.1.



Thank you


All times are GMT -4. The time now is 08:46.