CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Running, Solving & CFD

setting the correct format of nonuniform List<vector> for inlet in 0 Folder

Register Blogs Community New Posts Updated Threads Search

Like Tree16Likes
  • 10 Post By cfdonline2mohsen
  • 1 Post By KYPCK444
  • 3 Post By cfdonline2mohsen
  • 2 Post By RodriguezFatz

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 6, 2013, 09:12
Default setting the correct format of nonuniform List<vector> for inlet in 0 Folder
  #1
Senior Member
 
cfdonline2mohsen's Avatar
 
Mohsen KiaMansouri
Join Date: Jan 2010
Location: CFD Lab
Posts: 118
Rep Power: 16
cfdonline2mohsen is on a distinguished road
Dear All

I have some problem with the correct format of nonuniform List<vector> for my inlet boundary conditions for U in 0 Folder.
I want to specify a nonuniform velocity for U at inlet for my LES calculation from my previous RANS calculations output.
In nonuniform List<vector> we must specify only the U in the inlet faces like this:

Code:
value nonuniform List<vector>
32
(
( 0.125901997 0.138911426 0. )
( 0.128139153 0.172775626 0. )
( 0.126960248 0.211820379 0. )
( 0.120514534 0.254806578 0. )
( 0.107431941 0.30025211 0. )
( 0.0867254138 0.346227229 0. )
( 0.0579536967 0.390691847 0. )
( 0.0212141946 0.431824267 0. )
( 0.138057172 0.00678228773 0. )
( 0.135565937 0.0201092884 0. )
( 0.131116718 0.0328430161 0. )
( 0.126068711 0.0451080948 0. )
( 0.121914245 0.0576611347 0. )
( 0.11977531 0.0717905611 0. )
( 0.120108962 0.0890788361 0. )
( 0.122550257 0.111073039 0. )
( -0.461236358 0.508895934 0. )
( -0.393406957 0.530447841 0. )
( -0.32478264 0.541867137 0. )
( -0.257232815 0.543873072 0. )
( -0.192155391 0.537038386 0. )
( -0.130680457 0.521705806 0. )
( -0.0739541948 0.498558581 0. )
( -0.0230022091 0.468220979 0. )
( -0.802104294 0.0394048579 0. )
( -0.788241446 0.116924562 0. )
( -0.764009297 0.191374391 0. )
( -0.73147279 0.261725157 0. )
( -0.690910041 0.326776087 0. )
( -0.642638564 0.385182768 0. )
( -0.587392509 0.435639977 0. )
( -0.526437223 0.477134943 0. )
);
What I found is that 32 is the number of faces in inlet (not the points) and there is no need to specify the coordinates of the faces but what I don't know is the arrangement of these data in x,y,z directions??what is the coordinates of the related faces and where are these defined so that OF can detect them correctly?
so here is my question:
how can I export my inlet from my previous RANS calculations at the inlet patch to have the above format (i.e. the values of velocities at inlet faces with the OpenFOAM Format) without the need for arranging them manually. since my inlet have more than 4000 faces so it is impossible to do it manually.
I have used the sampling utility in inlet for my previous calculations but it gave me the values of velocities at points not cells.
Does anybody know how can i do that?
Thanks for your helps in advance.
__________________
“If you have an apple and I have an apple and we exchange these apples then you and I will still each have one apple. But if you have an idea and I have an idea and we exchange these ideas, then each of us will have two ideas.”
cfdonline2mohsen is offline   Reply With Quote

Old   August 6, 2013, 18:00
Default
  #2
Senior Member
 
cfdonline2mohsen's Avatar
 
Mohsen KiaMansouri
Join Date: Jan 2010
Location: CFD Lab
Posts: 118
Rep Power: 16
cfdonline2mohsen is on a distinguished road
I found The Answer.
I write it here for the future use.
The values for all the variables will be written for all the patches (including the inlet patch) in all timesteps (except 0 folders) in the same format that is needed for "nonuniform List<vector>" so I can easily copy them for 0 Folder.
so there is no need for sampling utility.
furthermore I found the answer to my question about sampling by reading the sampleDict headers in src.
in order to sample the data on a surface the following code should be added to controlDict:
Code:
surfaceSampling
    {
        // Sample at inlet

        type surfaces;

        // Where to load it from (if not already in solver)
        functionObjectLibs ("libsampling.so");
        enabled         true;
        outputControl   outputTime;

        interpolationScheme cellPointFace; //cellPoint; //cell;  

        surfaceFormat    foamFile;  //vtk;    foamFile : separate points, faces and values file

        // Fields to be sampled
        fields
        (
            U
            k
            epsilon
        );

        surfaces
        (

    Inlet_constant
    {
        type            patch;
        patches         ( inlet );
        // interpolate     true;    HTRL    If True then the point values will be given not cell values
        // Optional: whether to leave as faces (=default) or triangulate
        // triangulate     false;
    }
        );
    }

}
what I found is that (of course by trial and error method!) if :
Code:
interpolate     true
then the sampling will give the point values at inlet not cell values. so in order to find the cell values the above line should be commented out

Of course as I told before there is a simpler way and therefore no need to use the sampling utility in order to find the corresponding values that must be used with "nonuniform List<vector>"
but the final results for both was the same.
__________________
“If you have an apple and I have an apple and we exchange these apples then you and I will still each have one apple. But if you have an idea and I have an idea and we exchange these ideas, then each of us will have two ideas.”
cfdonline2mohsen is offline   Reply With Quote

Old   August 9, 2013, 13:30
Default
  #3
New Member
 
Join Date: Aug 2013
Posts: 20
Rep Power: 13
KYPCK444 is on a distinguished road
hi, thanks for sharing your results.

I tried to apply the sample utility to the channel flow case, creating a sampleDict where I define a plane at a certain distance from the outlet:


setFormat raw;

surfaceFormat foamFile;

formatOptions
{
ensight
{
format ascii;
}
}

interpolationScheme cellPoint;

fields
(
p
U
);

surfaces
(
constantPlane
{
type plane;
basePoint (3 0 0);
normalVector (1 0 0);
}
);



I run the solver, then I type:
sample -latestTime
and a directory called surfaces is created, where you can find:
a file called faceCentres which has twice the number of cells (if I have a square grid of 4x4 cells, faceCentres has 32 values);
a file called points where there's the list of the grid points coordinates (25 values if you have a 4x4 grid);
files p and U containing twice the number of cells (32).

What I think I have understood is that by the sample utility (and by the above sampleDict) I obtain values of p and U (and others if you want) at cell centres, not at points.

I am trying to use this "sampled" files to feed another channel flow case at inlet by timeVartingMappedFixedValue, such as in pitzDailyExptInlet tutorial).

The questions are:

how do you manage to get a list of values for p, U, .... fields at a certain section (at inlet, outlet, or middle sections) without sampling utility?

don't you need something like timeVaryingMappedFixedValue or groovyBC boundary patch type to set nonUniform list of values at inlet?

thanks!
ScarFace likes this.
KYPCK444 is offline   Reply With Quote

Old   August 9, 2013, 18:18
Default
  #4
Senior Member
 
cfdonline2mohsen's Avatar
 
Mohsen KiaMansouri
Join Date: Jan 2010
Location: CFD Lab
Posts: 118
Rep Power: 16
cfdonline2mohsen is on a distinguished road
Dear KYPCK444

Quote:
how do you manage to get a list of values for p, U, .... fields at a certain section (at inlet, outlet, or middle sections) without sampling utility?
As I said before, if you open U (or any other field) in your last time step folder you can see that the values for velocity are written for all the patches (including the inlet boundary). just search the inlet keyword (of course by using ctrl+F) and the copy and paste the desired value.then go to the 0 folder for your new case, open U and paste them under:
Code:
type fixedValue
value nonuniform List<vector>
for your new inlet patches.

Quote:
don't you need something like timeVaryingMappedFixedValue or groovyBC boundary patch type to set nonUniform list of values at inlet?
If the number of your points are very large; so it is impossible to enter them manually in the correct format that is used by OF.
in this case i use a trick so that i will use timeVaryingMappedFixedValue or groovyBC type for my inlet then i will run my case only for 1 time step then I go to the new time step folder and continue just like that i said above.
The reason for this is that because if I use timeVaryingMappedFixedValue or groovyBC for my inlet since they are a type not value then I can't use other inlet types like directMapped (at least I don't know how to use them simultaniously!!)
immortality, ScarFace and Abk005 like this.
__________________
“If you have an apple and I have an apple and we exchange these apples then you and I will still each have one apple. But if you have an idea and I have an idea and we exchange these ideas, then each of us will have two ideas.”
cfdonline2mohsen is offline   Reply With Quote

Old   September 17, 2013, 08:39
Default
  #5
Senior Member
 
RodriguezFatz's Avatar
 
Philipp
Join Date: Jun 2011
Location: Germany
Posts: 1,297
Rep Power: 27
RodriguezFatz will become famous soon enough
Dear Kia,

But what, if the outlet of the source case does not have the same mesh as the inlet of the target case, i.e. meshes are not conformal? I can not just copy the "old" values to the "new" inlet, because number and location of each face differs...

Philipp.
cfdonline2mohsen and THU_Gj like this.
__________________
The skeleton ran out of shampoo in the shower.
RodriguezFatz is offline   Reply With Quote

Old   September 17, 2013, 16:55
Default
  #6
Senior Member
 
cfdonline2mohsen's Avatar
 
Mohsen KiaMansouri
Join Date: Jan 2010
Location: CFD Lab
Posts: 118
Rep Power: 16
cfdonline2mohsen is on a distinguished road
Dear Philipp
Yeah you are right.I dont know what to do if you want to use the outlet of you case for the inlet of your new case.
Please let me know if you find something.
__________________
“If you have an apple and I have an apple and we exchange these apples then you and I will still each have one apple. But if you have an idea and I have an idea and we exchange these ideas, then each of us will have two ideas.”
cfdonline2mohsen is offline   Reply With Quote

Old   November 26, 2013, 03:59
Default
  #7
Member
 
sqing
Join Date: Sep 2012
Location: Dalian
Posts: 77
Rep Power: 14
Sunxing is on a distinguished road
Quote:
Originally Posted by cfdonline2mohsen View Post
Dear KYPCK444



As I said before, if you open U (or any other field) in your last time step folder you can see that the values for velocity are written for all the patches (including the inlet boundary). just search the inlet keyword (of course by using ctrl+F) and the copy and paste the desired value.then go to the 0 folder for your new case, open U and paste them under:
Code:
type fixedValue
value nonuniform List<vector>
for your new inlet patches.

Hi,

I have found that most of the LES tutorials in OF set the inlet velocity as
Code:
    inlet
    {
        type            turbulentInlet;
        referenceField  uniform (10 0 0);
        fluctuationScale (0.02 0.01 0.01);
        value           uniform (10 0 0);
    }
So I want to know did you set your inlet velocity as fixedValue in the new LES case? Have your new LES case given out good result? And can you share us your 0 folder in the new LES case?

Best regards
sunxing
Sunxing is offline   Reply With Quote

Old   April 28, 2017, 14:49
Default
  #8
Senior Member
 
adambarfi's Avatar
 
Mostafa Mahmoudi
Join Date: Jan 2012
Posts: 322
Rep Power: 15
adambarfi is on a distinguished road
Send a message via Yahoo to adambarfi Send a message via Skype™ to adambarfi
Hi everybody,

I'm trying to use my velocities in a plane within my channel as the inlet boundary conditions for my new case.

I used the sample utility for extracting the data on the plane. I set the output style as foamFile.

In my new case, I used the obtained data on the plane (from the previous solution) as follows:
Code:
type  fixedValue
value nonuniform List<vector>
1200
(
.
.
.
);
But, when I saw the velocity field in paraView, my z-component of velocities were wrong. Actually, they were multiplied by (-1).

Do u have any idea why this happened??

Regards,
Mostafa
adambarfi is offline   Reply With Quote

Old   July 18, 2019, 09:03
Default
  #9
New Member
 
Hardik Chauhan
Join Date: Apr 2019
Posts: 3
Rep Power: 7
Chhardik94 is on a distinguished road
Quote:
Originally Posted by cfdonline2mohsen View Post
I found The Answer.
I write it here for the future use.
The values for all the variables will be written for all the patches (including the inlet patch) in all timesteps (except 0 folders) in the same format that is needed for "nonuniform List<vector>" so I can easily copy them for 0 Folder.
so there is no need for sampling utility.
furthermore I found the answer to my question about sampling by reading the sampleDict headers in src.
in order to sample the data on a surface the following code should be added to controlDict:
Code:
surfaceSampling
    {
        // Sample at inlet

        type surfaces;

        // Where to load it from (if not already in solver)
        functionObjectLibs ("libsampling.so");
        enabled         true;
        outputControl   outputTime;

        interpolationScheme cellPointFace; //cellPoint; //cell;  

        surfaceFormat    foamFile;  //vtk;    foamFile : separate points, faces and values file

        // Fields to be sampled
        fields
        (
            U
            k
            epsilon
        );

        surfaces
        (

    Inlet_constant
    {
        type            patch;
        patches         ( inlet );
        // interpolate     true;    HTRL    If True then the point values will be given not cell values
        // Optional: whether to leave as faces (=default) or triangulate
        // triangulate     false;
    }
        );
    }

}
what I found is that (of course by trial and error method!) if :
Code:
interpolate     true
then the sampling will give the point values at inlet not cell values. so in order to find the cell values the above line should be commented out

Of course as I told before there is a simpler way and therefore no need to use the sampling utility in order to find the corresponding values that must be used with "nonuniform List<vector>"
but the final results for both was the same.
I am not able to sample data of particular patch not the whole field.
Chhardik94 is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Moving mesh Niklas Wikstrom (Wikstrom) OpenFOAM Running, Solving & CFD 122 June 15, 2014 07:20
[DesignModeler] Airfoil Coordinate data Error inspite correct format Bharath_S ANSYS Meshing & Geometry 0 December 25, 2012 13:56
What is the correct date format? surjamankhatiwora Main CFD Forum 0 November 26, 2010 00:00
[PyFoam] setting is not correct? or not compatible with 1.6? seasoul OpenFOAM Community Contributions 2 March 23, 2010 12:42
Warning 097- AB Siemens 6 November 15, 2004 05:41


All times are GMT -4. The time now is 18:07.