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/)
-   -   LEMOS InflowGenerator (https://www.cfd-online.com/Forums/openfoam-solving/122628-lemos-inflowgenerator.html)

r_gordon August 23, 2013 09:58

LEMOS InflowGenerator
 
I am currently investigating the use of OpenFoam LES for urban dispersion modelling and would like to use the LEMOS decayingTurbulanceInflowGenerator for the Inlet profile. I have downloaded and compiled the LEMOS library with no issues but am struggling to find any literature on what properties I should use withing the 0/U file. The pdf example file provided with LEMOS gives the following:

inlet
{
type decayingTurbulenceInflowGenerator;
direction 1;
LField nonuniform List<scalar> ...
refField nonuniform List<vector> ...
RField nonuniform List<symmTensor> ...
value nonuniform List<vector> ...
}


However, I am not sure what values / data needs to be entered in the 'List<...> fields and wondered if anyone could provide any help with this or an example they would be willing to provide that demonstrates how to use the InflowGenerator?

Thanks
Rob

roth August 26, 2013 10:58

LEMOS example
 
1 Attachment(s)
A neat little BC. I believe it is based on Lund's work.

Attached is one based on a quick scan of the source code. All the values are probably nonsense but it runs and gives some eddies. Note that it is based on the motorbike tutorial (without the motorbike) so has a bottom wall moving at 20 m/s.

The important bit is the definition of U:

Code:

    inlet
    {
        type            decayingTurbulenceInflowGenerator;
        direction      1;
        LField          uniform 1;
        RField          uniform (0.1 0 0 0.1 0 0.1);
        refField        uniform ( 20 0 0 );
        value          uniform ( 20 0 0 );
    }

Note that I just put uniform values in for the fields. For your case you will likely want a non-uniform values to represent an atmospheric boundary layer. Perhaps generated by funky.

r_gordon August 29, 2013 06:54

roth, thanks for the help. I have just come back from holiday and will give this a go later today. I have been using the atmBoundaryLayerInletVelocity boundary condition and will need to figure out how to combine this with the LeMoS BC. Do you know of any good tutorials on how to use the non-uniform BC? Im new to OpenFoam.

Thanks

Rob

r_gordon August 29, 2013 12:15

Michael,

I have had a go an managed to et your example running with no problems at all however I struggle to get paraview to visuaise the U and U_0 fields as i get a vtk error:

ERROR: In /home/punk/Downloads/vtkPOFFReader/vtkOFFDevReader.cxx, line 7807
vtkOFFReaderPrivate (0x3450a20): Error reading line 4667 of /home/OpenFoamUser/OpenFOAM/Simulations/LEMOS/0.1/U: Expected '(', found 1

Im currently using paraview 3.10.0, do I need an upgrade?

Thanks

Rob

marc.immer September 11, 2013 03:07

Hi Rob,

there is a "bug" in the code. It writes additional variables into the U files (the vortons) and that's why paraview can't read it.
As far as I remember, paraFoam could read the U files.

Cheers
Marc

r_gordon October 3, 2013 06:56

Quote:

Originally Posted by marc.immer (Post 451068)
Hi Rob,

there is a "bug" in the code. It writes additional variables into the U files (the vortons) and that's why paraview can't read it.
As far as I remember, paraFoam could read the U files.

Cheers
Marc

Thanks for that. I was pulling my hair out for days on that one. I have now downgraded to OF2.1.1 and the surface sampling works.

cfdonline2mohsen October 7, 2013 08:28

Would you please tell me where can I download the LEMOS library?

r_gordon October 7, 2013 08:44

Quote:

Originally Posted by cfdonline2mohsen (Post 455484)
Would you please tell me where can I download the LEMOS library?

You can download the library from here: http://www.lemos.uni-rostock.de/en/d.../cfd-software/

cfdonline2mohsen October 7, 2013 09:07

Thank you so much Dear Rob
It is really so kind of you.

marc.immer October 28, 2013 02:29

I wrote a small bash script to remove the vortons from the U file. It also creates a backup copy of U:

Code:

cp $1 $1.bak
rm $1
sed '/vortons/,/;/d' $1.bak > $1

start like this:
./removeVortons "pathToUFile", e.g. "10/U"

Regards
Marc

r_gordon October 28, 2013 04:01

Quote:

Originally Posted by marc.immer (Post 459340)
I wrote a small bash script to remove the vortons from the U file. It also creates a backup copy of U:

Code:

cp $1 $1.bak
rm $1
sed '/vortons/,/;/d' $1.bak > $1

start like this:
./removeVortons "pathToUFile", e.g. "10/U"

Regards
Marc

Marc,

That great. Thanks very much for that. I gave up on LEMOS but will be having another look at in the coming weeks. I don't suppose you have a simple example you could send through that will give me a better idea of how to utilise the unsteady fields? There is so little documentation on the inflow generator that it almost renders it useless.

Thanks
Rob

matthias October 30, 2013 09:17

Dear Rob,

we will provide a little test case or tutorial where you can see the settings and some explanations of the inflow generator. Furthermore the OF reader of paraview is not designed to read the vortons which are used to create the fluctuations. So that's not a bug in the code but a missing feature in OF paraview plugin.

We will have a look at it and publish a workaround as fast as possible.


Best regards

Matthias

marc.immer November 4, 2013 06:55

Dear Matthias,

you are indeed right, apologies. The bug is in the paraview nativ OF reader, which can't read the SLList field.
I use the "remove vortons" script now to postProcess with paraview, works fine.

Regards,
Marc

openfoammaofnepo January 22, 2014 06:23

Hello there,

I tried to find the paper from which this boundary condition is developed but did not find the right one. Does anybody know something about that? Give me some hints ? Thank you so much.

I have found the corresponding paper in the following webpage, thanks.

http://www.lemos.uni-rostock.de/publikationen/

The title is
Code:

Kornev, N. & Hassel, E. (2007). Method of random spots for generation of synthetic inhomogeneous turbulent fields with prescribed autocorrelation functions. Communications in Numerical Methods Engineering, Vol. 23, Issue 1, pp. 35-43.

Kornev, N., Kröger, H., Turnow, J. & Hassel, E. (2007). Synthesis of artificial turbulent fields with prescribed second-order statistics using the random-spot method. Proceedings in Applied Mathematics and Mechanics. Vol. 7, Issue 1, pp. 2100047-2100048.

Quote:

Originally Posted by roth (Post 448131)
A neat little BC. I believe it is based on Lund's work.

Attached is one based on a quick scan of the source code. All the values are probably nonsense but it runs and gives some eddies. Note that it is based on the motorbike tutorial (without the motorbike) so has a bottom wall moving at 20 m/s.

The important bit is the definition of U:
Code:

    inlet
    {
        type            decayingTurbulenceInflowGenerator;
        direction      1;
        LField          uniform 1;
        RField          uniform (0.1 0 0 0.1 0 0.1);
        refField        uniform ( 20 0 0 );
        value          uniform ( 20 0 0 );
    }

Note that I just put uniform values in for the fields. For your case you will likely want a non-uniform values to represent an atmospheric boundary layer. Perhaps generated by funky.


openfoammaofnepo January 22, 2014 11:12

Hello everyone,

I read both the code and the paper I mentioned in the last thread,

I am a little confused about the calculation of C_ in the following. What is the purpose of these lines? Thank you very much.

Code:

Field<tensor> C_(R_.size(), pTraits<tensor>::zero);
        forAll(C_, I)
        {
            C_[I].xx() = 1.0;
            C_[I].yy() = 1.0;
            C_[I].zz() = 1.0;
        }

        forAll(R_, I)
        {
            scalar D1 = R_[I].xx();
            if (D1 > 0)
                C_[I].xx() = 1.0/sqrt(D1);
   
            scalar D2 = R_[I].xx()*R_[I].yy() - R_[I].xy()*R_[I].xy();
            if (D1 > 0 && D2 > 0)
            {
                C_[I].yx() = -R_[I].xy()/sqrt(D1*D2);
                C_[I].yy() = sqrt(D1/D2);
            }

            scalar D3 = det(R_[I]);
            if (D2 > 0 && D3 > 0)
            {
                C_[I].zx() = (R_[I].xy()*R_[I].yz()-R_[I].yy()*R_[I].xz())/sqrt(D2*D3);
                C_[I].zy() = -(R_[I].xx()*R_[I].yz()-R_[I].xz()*R_[I].xy())/sqrt(D2*D3);
                C_[I].zz() = sqrt(D2/D3);
            }
        }

From the following code,
Code:

fixedValueFvPatchField<vector>::operator==(refField_+ turbulent);
,
we can deduce: refField_ is the mean fields and turbulent is the fluctuation field.

From
Code:

turbulent = Lund_&turbulent;
Lund_ is the coefficient tensor by Lund et al , and turbulent in RHS is u_tilde in Eq. (10) in Kornel and Hassel 2007.

But I got stuck in the following:
Code:

turbulent = C_&turbulent;
What is C_ and turbulent (the LHS one)? The turbulence in the RHS is mean fields I think.

Anybody gives some comments?

matthias January 23, 2014 09:38

The constant C_ represents some kind of scaling factor in tensor notation. It is chosen during the rms (=standard deviation) calculation from the condition that rms has a prescribed value.

For instance, let us generate a random signal with the rms value of 0.9:

First we generate randomly numbers -0.1, 0.2, 0.5, -0.3. The mean value is of this sample is 0.075. The standard deviation is 0.3031.

Let us introduce the constant C=(0.9/0.3031). Multiply all numbers above with C. The signal sample -0.1*C, 0.2*C, 0.5*C, -0.3*C has the rms 0.9 or variance of 0.81.

The same is made in Lund transformation and referred to as the conditioning

openfoammaofnepo January 23, 2014 14:57

Dear Matthias,

Thank you so much for your help. I understand this is a kind of normalization (but in your reply it should be C=sqrt(0.9/0.3031)?). I found that this scaling approach is different from what is used in Kornev and Hassel , Commun. Numer. Meth. Engng. 2007. I also checked the paper by Lund from JCP and it seems that they did not explicitly mentioned this scaling method. Could you please give me some references about this scaling approach?

Besides I found that there is an variable "ind_" is used in the code. What does this variable mean? it is used in the following equation:

Code:

R_=((ind_-1)/ind_)*R_+(1/ind_)*sqr(turbulent)
Thank you in advance.

matthias January 23, 2014 19:35

On our homepage you can find another paper from 2008

Kornev, N., Kröger, H. & Hassel, E. (2008). Synthesis of homogeneous anisotropic turbulent fields with prescribed second-order statistics by the random spots method. Communications in Numerical Methods in Engineering, Vol. 24, Issue 10, pp. 875-877.

for information regarding the scaling operations. For Lund transformation I have to look for the correct paper.

Exactly if using the square root it should be C=sqrt(0.9/0.091869). That's depending on the definition (or point of view) what the rms value is.

The line of code you mentioned is used for time averaging of Reynolds stresses. The ind_ label is increased everytime the bc is activated, so the accuracy of Reynolds stresses will be improved the longer the case is running.

openfoammaofnepo January 23, 2014 19:47

Thanks, Matthias.

I read the paper you mentioned. It is very helpful for me to understand the algorithms of the BC. However, I did not find the information about the scaling and for my understanding it was emphasized that how to obtain the function f, the inner velocity of the random spots. Did I dismiss something?

Thank you for your help and sorry for my frequent questions. I would like to know something about the principle before I use your method. Thank you again.

matthias January 24, 2014 03:55

Please, have a look at the last part of the paper where the constant C is determined. In principle that is the same scaling operation as done in the inflow generator.

The Lund transformation isn't considered in this paper.

openfoammaofnepo January 24, 2014 10:17

Thank you very much, I found the Lund transformation in JCP paper. Besides, in the source file (decayingTurbulenceFvPatchVectorField.C), what is the difference between R_ and RField_? Thank you.

openfoammaofnepo February 3, 2014 18:21

Dear Matthias,

Can I ask you another question about the inflowGenerator? In the source file decayingTurbulenceFvPatchVectorField.C, there are following several lines:
Code:

    List<scalar> L  = ListListOps::combine<List<scalar> >(l, accessOp<List<scalar> >());
    List<vector> CF = ListListOps::combine<List<vector> >(cf, accessOp<List<vector> >());
    List<vector> RF = ListListOps::combine<List<vector> >(rf, accessOp<List<vector> >());

Before these lines, we have:

Code:

    Pstream::gatherList(l);
    Pstream::gatherList(cf);
    Pstream::gatherList(rf);

I also checked the source files in the following:

Code:

OpenFOAM/OpenFOAM-2.1.1/src/OpenFOAM/containers/Lists/ListListOps
Actually combine and gatherList are a pair.

For my previous appreciation, the "gatherList", similar to MPI_gather, should collect the data from all the processors and then store the data in the root. About the how to store in the root (the order or numbering), it should be automatic or at least can be set by the programmer. So the question is: what is the usage for the combine operations here?

Thank you so much

$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ $$$$$$$$$$$$$$$$$$$

Not sure the red sentence is correct or not, because in the same source files
Code:

    Pstream::scatterList(v);

    List<decayingVorton> V = ListListOps::combine<List<decayingVorton> >(v, accessOp<List<decayingVorton> >());

Here after scatterList, the ListListOps::combine is used.

Any comments?

flames February 20, 2014 15:03

Hello there,

in the LEMOS InflowGenerator, if the integral length scale is less than the nominal cell size, then is this method still valid? Should I always specify the integral length scale large than the mesh size?

Thank you all if any comments can be provided!

flames February 22, 2014 11:32

Code:

    vector velocityAt(const vector& v) const
    {
        vector dv = v - location_;
        scalar nrm2 = magSqr(dv);
        vector t = dv ^ omega_;

        return (1/length_)*exp(-(M_PI/2)*nrm2/(length_*length_))*t;
    }

Hello there, is there any explanation about the above distribution? It looks like a gaussina distribution but is not exactly the same. The vector t is constructed from omega, which is from the random vector.

hannes March 12, 2014 02:10

The derivation of the velocity distribution is explained in the following article by Kornev et al. (2007):
http://dx.doi.org/10.1063/1.2738607

It is obtained, if the spectrum for decaying turbulence is demanded from the generated fluctuations.

Regards, Hannes

hannes March 12, 2014 02:23

and regarding the selection of the length scale:

If the length scale becomes less than the cell size, the grid can no longer resolve the inner structure of the turbulence as well as that of the generated vortons.

It is questionable, if you are still doing LES in such a case. But in addition to that, you will probably get the same results with the inflow generator as with simple white noise (the vanilla "turbulentInlet" BC in OpenFOAM) but for a higher computational cost.

Regards, Hannes

aka March 27, 2014 21:47

Dear Mathias,
Thanks for the contribution with the LEMOS. I successfully compiled all of them without problems and run the turbulence libraries for Large Eddy Simulation. I am interested to extend for scalar transport and I see that both the LDMMS and dynamicMixedModel have extensions with "f.name()". Can you please provide me an idea how to call "divFeff" and "Feff" in my solvers?


Thank you

IvanaS April 10, 2014 07:30

Hi,

In the LEMOS InflowGenerator does it matter how inlet is oriented? Or what should be axial velocity? Is that hard coded?

Thank you

Regards

tung.nguyen July 7, 2014 10:47

Hi,

In LEMOS, would it be possible to generate the homogeneous and isotropic turbulence by inputting proper values of Reynolds shear stresses?

Sincerely,

Tung.

hannes July 8, 2014 04:34

Dear Tung,

yes it is possible.
Just prescribe an appropriate uniform distribution of the Reynolds Stresses and the length scales. The generated length scales are isotropic anyway.

Regards, Hannes

tung.nguyen July 8, 2014 12:23

Dear Hannes,

Thank you very much for your response.

I have been followed your paper of 'Synthesis of homogeneous anisotropic turbulent fields with prescribed second-order statistics by the random spots method'. Please correct me if I am wrong. From this paper, I think that by prescribing a auto-correlation function like the one I found in the your published code, the turbulent field will be homogeneous. The isotropic property is then controlled by the Reynolds stresses.

Also, could you tell me a bit more about the isotropic turbulent length scale please?

Thank you very much your time and support.

Sincerely,

Tung Nguyen.

amanbearpig September 17, 2014 11:25

Quote:

Originally Posted by matthias (Post 459879)
Dear Rob,

we will provide a little test case or tutorial where you can see the settings and some explanations of the inflow generator. Furthermore the OF reader of paraview is not designed to read the vortons which are used to create the fluctuations. So that's not a bug in the code but a missing feature in OF paraview plugin.

We will have a look at it and publish a workaround as fast as possible.


Best regards

Matthias

I realize that this is an old topic I'm bringing back, but I've been looking at using the inflow generator from the LEMOS extensions and I can't seem to find the mentioned tutorial cases or examples. Does anyone know where I can find them?

There is a one page .pdf in the LEMOS extensions download, but it doesn't seem to provide any more information on how to setup the inflow generator correctly.

Thank you!

amanbearpig September 30, 2014 11:07

Just bumping this back up - not sure how many people use the LEMOS Inflow Generator, or if anyone knows where I could find the mentioned test case/tutorial for its use? :o Thanks!

wyldckat October 4, 2014 09:04

Quote:

Originally Posted by amanbearpig (Post 512457)
Just bumping this back up - not sure how many people use the LEMOS Inflow Generator, or if anyone knows where I could find the mentioned test case/tutorial for its use? :o Thanks!

Quick answer:
If you're looking for something more, please be a bit more specific ;)

amanbearpig October 6, 2014 11:19

Hi Bruno,

Thanks for the message. :) Sorry if the message seemed unclear, I was referring to the post I had made just above the "bumping" post in the last message. I have the Inflow Generator downloaded and installed, I'm just looking for some help/clarification on properly setting it up and configuring the boundary condition.

When I look in the repository for LEMOS, I only see tutorials for "PODSolver" and "movingBlockRBF", nothing for the Inflow Generator.

I was referring to the message above from Matthias where he mentions putting together a tutorial or test case for the Inflow Generator:

Quote:

Originally Posted by matthias
Dear Rob,
we will provide a little test case or tutorial where you can see the settings and some explanations of the inflow generator. Furthermore the OF reader of paraview is not designed to read the vortons which are used to create the fluctuations. So that's not a bug in the code but a missing feature in OF paraview plugin.

We will have a look at it and publish a workaround as fast as possible.


Best regards

Matthias


openfoammaofnepo November 20, 2014 04:41

Dear Hannes,

When I use this boundary condition to run my simulation, I tried to use paraview to plot the data. However, for the file U, I always go the error messege from paraview as follows:

=============
ERROR: In /home/utkarsh/Dashboards/MyTests/NightlyMaster/ParaViewSuperbuild-Release/paraview/src/paraview/VTK/IO/Geometry/vtkOpenFOAMReader.cxx, line 6478
vtkOpenFOAMReaderPrivate (0xa3a0d0): Error reading line 9161360 of /media/usb2T/ColdFlow_LES/LES_VortonInlet/0.16/U: Expected a number, found (
=============

So I cannot see the velocity fields. I check the U file and actually the line 9161360 corresponds to the the following:

==================
ind 2;

100
(
0.00125
(....)
(....)
(....)
0.00375
)
==================

I am not sure if you have the same problem when you visualize the data using paraview. Thank you.

openfoammaofnepo November 20, 2014 06:19

I found that this problem is there because we output the list of vortons in the file of velocity U. When I comment the following lines in the decayingTurbulenceFvPatchVectorField.C:

=============
// if (Pstream::master())
// os.writeKeyword("vortons")<<vortons_<<token::END_S TATEMENT<<nl;
=============

I found I can open the file U using paraview now. However, it seems that the vorton number is reset to the initial values. So that means the time averaging operation is stopped after I did that and each time I resume the simulations, the vorton is fresh.

Any good solutions to maintain the time averaging/accummulation effect and at the same time open the U file using paraview? Thank you.

Quote:

Originally Posted by openfoammaofnepo (Post 520113)
Dear Hannes,

When I use this boundary condition to run my simulation, I tried to use paraview to plot the data. However, for the file U, I always go the error messege from paraview as follows:

=============
ERROR: In /home/utkarsh/Dashboards/MyTests/NightlyMaster/ParaViewSuperbuild-Release/paraview/src/paraview/VTK/IO/Geometry/vtkOpenFOAMReader.cxx, line 6478
vtkOpenFOAMReaderPrivate (0xa3a0d0): Error reading line 9161360 of /media/usb2T/ColdFlow_LES/LES_VortonInlet/0.16/U: Expected a number, found (
=============

So I cannot see the velocity fields. I check the U file and actually the line 9161360 corresponds to the the following:

==================
ind 2;

100
(
0.00125
(....)
(....)
(....)
0.00375
)
==================

I am not sure if you have the same problem when you visualize the data using paraview. Thank you.


openfoammaofnepo November 22, 2014 05:42

Hello,

In my case, the turbulent inlet is concentric ring with inner radius 25 mm and out radius 30 mm. The air inlet is just between the inner and outer radii. I set the LField uniform to be 0.00175m. The bulk velocity going through the inlet about 20 m/s. The RField is very close to the fields from a pipe flow. Then in my simulation, the number of vorton is about 5000.

Is this vorton number reasonable for a good LES? Thank you very much.

Another problem is:

When I use this boundary condition, I will always have numerical stability problem, i.e. the simulation will sometimes blow up at the inlet due to the fluctuations. Do you have similar experience?



Quote:

Originally Posted by openfoammaofnepo (Post 520134)
I found that this problem is there because we output the list of vortons in the file of velocity U. When I comment the following lines in the decayingTurbulenceFvPatchVectorField.C:

=============
// if (Pstream::master())
// os.writeKeyword("vortons")<<vortons_<<token::END_S TATEMENT<<nl;
=============

I found I can open the file U using paraview now. However, it seems that the vorton number is reset to the initial values. So that means the time averaging operation is stopped after I did that and each time I resume the simulations, the vorton is fresh.

Any good solutions to maintain the time averaging/accummulation effect and at the same time open the U file using paraview? Thank you.


openfoammaofnepo November 25, 2014 16:25

Dear Hannes,

I am interested in knowing about the vorton number which can be used for the LES inlet boundary conditions. I found if I use a uniform LField, changing the LField will lead to the large variation of the length scale. So now a question arises:

For a jet exit (from a fully developed pipe flow) with diameter 3.6 mm, axial bulk velocity with 60 m/s. If I used LField=0.0009 m, the vorton number will be around 270. Then I use d LField=0.00045 m, the vorton number will be 720 or so. How will the vorton number affect the results?

Of course I can do two tests in the LES, but for my simulation this is a little expensive. So could you please give some comments about this issue?

Thank you.

openfoammaofnepo November 28, 2014 06:37

Dear All,

I found a problem about the quantity "ind_" when I resume the simulation but with different processor number.

For example, in the first simulation, if the decayingTurbulenceInflowGenerator boundary only treated in processor0, then when I use reconstructPar to get the complete data set, the quantity "ind_" should be correct, i.e. real iteration step so far. However, if this boundary condition is not processor0, then the reconstructed data set will only have ind_ =2, what the real ind_ is.

This is always fine if I resume the second simulation with the same processors. However, if we would like to use the reconstructed data to start another simulation, then the quantity "ind_" will be set to "2", which means the time averaging effects will be erased and the vorton accummulation will start from scratch.

But I do not know how to fix this. Anybody has some suggestions??

Thank you.


All times are GMT -4. The time now is 23:48.