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

Outlet fields as inlet fields, how to.

Register Blogs Community New Posts Updated Threads Search

Like Tree5Likes
  • 3 Post By romant
  • 2 Post By MaySea

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 22, 2014, 06:43
Post Outlet fields as inlet fields, how to.
  #1
New Member
 
Tommy V
Join Date: Nov 2013
Posts: 29
Rep Power: 13
Villo is on a distinguished road
Dears,
i`m running a unsteady RANS simulation (k-epsilon) with twoLiquidMixingFoam.
In order to reduce the computational domain showed in the top of the attached figure1 i need to use the outlet from the bottom left geometry (at -latestTime) as inlet condition for the bottom right geometry.
I tried two ways (to take fields from the outlet of the bottom left geometry):
1) mapFields (with mapFieldsDict), the result of the mapped field (for U) is show in figure2
2) sample (with sampleDict), the result of the mapped field (for U) is show in figure3
In both cases k, epsilon, U, nut are well mapped: I have set these fields as inlet condition for the bottom left geometry in 0/U 0/k etc etc.
BUT seems to be the solver does not "feel" this nonuniform List of inlet condition and solved fields are wherever 0.
Suggestions?
p.s. If to answer you need some dictionaries just ask!
cheers
Attached Images
File Type: png figure1.PNG (48.8 KB, 382 views)
File Type: jpg figure2.jpg (11.6 KB, 323 views)
File Type: jpg figure3.jpg (10.4 KB, 269 views)
Villo is offline   Reply With Quote

Old   January 22, 2014, 11:00
Talking Making it more interesting...
  #2
New Member
 
Tommy V
Join Date: Nov 2013
Posts: 29
Rep Power: 13
Villo is on a distinguished road
Just to make it more interesting ( or more (un)clear...?) here you some more information:
- attached the mapFieldsDict.txt and sampleDict.txt used to map fields at outlet patch
- attached the example of 0/U obtained after run mapFields and sample utility (for the last one I have just copy the sample result after value nonuniform List<vector>)
Attached Files
File Type: txt mapFieldsDict.txt (964 Bytes, 389 views)
File Type: txt sampleDict.txt (1.3 KB, 295 views)
File Type: txt U.txt (55.3 KB, 222 views)
Villo is offline   Reply With Quote

Old   January 22, 2014, 11:22
Talking Making it more interesting... part2
  #3
New Member
 
Tommy V
Join Date: Nov 2013
Posts: 29
Rep Power: 13
Villo is on a distinguished road
Browsing for similar problems i prefer show you the constant/polymesh/boundary. The mapping/sampling target is the patch int_1B (and the mapping/sampling source is the patch int_1A)
Could be that my problem is just due from the definition of boundary condition on int_1B? So (eg) chancing it from patch to mappedPatch (and similarly for all the 0/fields)

3
(
wall
{
type wall;
nFaces 84456;
startFace 3005866;
}
int_1B
{
type patch;
nFaces 1637;
startFace 3090322;
}
outlet
{
type patch;
nFaces 1637;
startFace 3091959;
}
)
Villo is offline   Reply With Quote

Old   February 4, 2014, 11:06
Default
  #4
Senior Member
 
romant's Avatar
 
Roman Thiele
Join Date: Aug 2009
Location: Eindhoven, NL
Posts: 374
Rep Power: 21
romant is on a distinguished road
Did you solve the problem? And if yes, could you share your procedure step by step?
__________________
~roman
romant is offline   Reply With Quote

Old   February 4, 2014, 11:44
Default
  #5
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,938
Rep Power: 39
alexeym has a spectacular aura aboutalexeym has a spectacular aura about
Send a message via Skype™ to alexeym
Did you try something like this:

Code:
    inlet
    {
        type            outletMappedUniformInlet;
        outletPatchName outlet;
        phi             phi;
        value           uniform 0;
    }

    outlet
    {
        type            zeroGradient;
    }
Or this is not what you want? As from the pictures I wasn't able to see any difference in geometries.

--
Sorry forgot that you need to rotate vectors. My solution is wrong in this case.

Last edited by alexeym; February 4, 2014 at 11:47. Reason: mistake
alexeym is offline   Reply With Quote

Old   February 4, 2014, 15:23
Default
  #6
Senior Member
 
romant's Avatar
 
Roman Thiele
Join Date: Aug 2009
Location: Eindhoven, NL
Posts: 374
Rep Power: 21
romant is on a distinguished road
Hej,

the way I solved something similar applied to your problem:

1. Sample the outlet patch int_1A -> with the result that you get a folder postProcessing/surfaces/latestTime/sampleValues/vectorField with contains the velocity values and then under sampleValues, which is just the name of the surface set you have faceCentres, faces and points
2. Next I renamed the faceCentres to points and discarded faces and points completely.
3. Put the new points file into a folder which has the same name as the boundary patch that you would like to use (in your case int_1B) and also create a 0 folder in there.
4. In the 0 folder you put all the sampled fields that you would like to have an inlet condition for (U, nu, p, ...)
5. The files are missing headers. I attached the necessary headers in this post, the points one gets the points.txt header, the vector fields get vector headers and the scalar field get the scalar header.
5. The full folder int_1B , containing the 0 folder and the points file are now copied to constant/boundaryData
6. The inlet boundary condition gets the following type
Code:
    inlet
    {
        type            timeVaryingMappedFixedValue;
        setAverage      true; 
        offset          (0 0 0);
    }
where the offset could be used to move it to the right location, but as your sampling and the mapping are most likely in the same location, you don't have to offset it. The setAverage is set to true in the above example, however, one must then set also an average value in the field files under boundaryData, otherwise it will set it to 0, as this is the average that I have in the header files at the moment. Set to false if no averaging should be done.
7. run the case
Attached Files
File Type: txt points.txt (796 Bytes, 120 views)
File Type: txt scalar.txt (770 Bytes, 95 views)
File Type: txt vectorHeader.txt (772 Bytes, 94 views)
charmc, calf.Z and _el_jugador like this.
__________________
~roman
romant is offline   Reply With Quote

Old   February 5, 2014, 10:21
Default
  #7
New Member
 
Tommy V
Join Date: Nov 2013
Posts: 29
Rep Power: 13
Villo is on a distinguished road
Hi Alexey and Roman, thanks for your interest.

The problem (solved for RANS computation)was due to my mistake because i was using the outlet from the left geometry as inlet for the right geometry... independently from the followed procedure (mapFields, sample... or just copying the field from the time folder of interest as i did at the end) the direction of the flow is maintained... OpenFoam was feeling my flow as going out and not coming in
So, what i did can be summarized as:
1) On the the whole geometry create an AMI in the location where i want to split the geometry (let`s say left_AMI and right_AMI)
2) From the solved whole geometry copy the fields (from left_AMI patch) that have to be mapped
3) On the new case reduced geometry (in my case the one on the right) paste this fields in the correspondent 0/fields for the right_AMI patch (the new inlet)

This will keep the flow direction.

@Alexey i will try on one other case your suggestion "outletMappedUniformInlet"... could works nice, bypassing the need to simulate the whole geometry as i did. I will let you know if it works.
@Roman "timeVaryingMappedFixedValue" is nice but i prefer to use it just for transient inlet. By the way you show me how to use it

BUT...
I said "I solve it for RANS computation."... because trying to apply the procedure laid before and more as sample and mapFields, on LES computation... well, look at the new attached picture.
I thought it was due to the enumeration of cells, but if it was so I should have had the same problem in the RANS computation.
Guys, any idea?

__________________________________________________ ______________________
@Alexey I read the edit to your post only after answering. The origin of my problem was exactly the no rotation of the vector field (U). So let me understand, i cannot apply "outletMappedUniformInlet" because does not reverse the vector field? So what is the purpose of "outletMappedUniformInlet"?
Attached Images
File Type: jpg Capture.jpg (31.7 KB, 277 views)
Villo is offline   Reply With Quote

Old   February 5, 2014, 11:46
Default
  #8
Senior Member
 
romant's Avatar
 
Roman Thiele
Join Date: Aug 2009
Location: Eindhoven, NL
Posts: 374
Rep Power: 21
romant is on a distinguished road
Due to the nature of how the timeVaryingMappedFixedValue works, you can even create the sample surface in matlab, meaning you could also of course turn around the velocity vectors in matlab. When you sample in raw instead of foamFile, you get something that can easily be read into matlab, turn around the vectors and put out the 2 files (U and points) in a OpenFoam compatible version.
__________________
~roman
romant is offline   Reply With Quote

Old   November 2, 2015, 13:38
Default
  #9
New Member
 
Join Date: Jul 2014
Posts: 26
Rep Power: 12
Minisasi is on a distinguished road
Hello,
I need to access a field on a boundary patch and to use it on another patch.
I am not sure if mappedField could be the right choice, since I have to repeat this operation per each timestep. The two patches in question have the same size.
Any advises?
Thank you
Minisasi is offline   Reply With Quote

Old   November 2, 2015, 14:26
Default
  #10
Senior Member
 
Ehsan Asgari
Join Date: Apr 2010
Posts: 473
Rep Power: 18
syavash is on a distinguished road
Quote:
Originally Posted by Minisasi View Post
Hello,
I need to access a field on a boundary patch and to use it on another patch.
I am not sure if mappedField could be the right choice, since I have to repeat this operation per each timestep. The two patches in question have the same size.
Any advises?
Thank you

Hi,

I refer you to this thread of mine!

HTML Code:
http://www.cfd-online.com/Forums/openfoam-programming-development/160541-give-file-proper-header-being-used-timevaryingmappedfixedvalue-input.html
I managed to achieve this through adding the following lines to pimpleFoam:

Code:
word patchName = "inlet";
label patchID = mesh.boundary().findPatchID(patchName);    
   
  IOField<vector> U2
(
    IOobject
    (
        "U",
        mesh.time().constant(),
        "boundaryData/inlet"/runTime.timeName(),
        mesh,
        IOobject::NO_READ,
        IOobject::NO_WRITE
    ),
    U.boundaryField()[ patchID ]
);

U2.write();
Bests
syavash is offline   Reply With Quote

Old   November 2, 2015, 14:35
Default
  #11
New Member
 
Join Date: Jul 2014
Posts: 26
Rep Power: 12
Minisasi is on a distinguished road
Thank you for your fast reply,
I guess that in our case 'inlet' is the source patch. But how can I use the new U2 in my target patch at the same timestep?

Cheers
Minisasi is offline   Reply With Quote

Old   November 2, 2015, 17:14
Default
  #12
Senior Member
 
Ehsan Asgari
Join Date: Apr 2010
Posts: 473
Rep Power: 18
syavash is on a distinguished road
Quote:
Originally Posted by Minisasi View Post
Thank you for your fast reply,
I guess that in our case 'inlet' is the source patch. But how can I use the new U2 in my target patch at the same timestep?

Cheers
In this way, you should save data of the source patch in the first simulation before you proceed to the next one. In the second simulation you should use timeVaryingFixedValue as the bc to read data from the same files generated during the first simulation.
There might be a way to run both simulations simultaneously which I am not aware of.

Goodluck
syavash is offline   Reply With Quote

Old   November 2, 2015, 17:25
Default
  #13
New Member
 
Join Date: Jul 2014
Posts: 26
Rep Power: 12
Minisasi is on a distinguished road
I see what you mean,
But I want to access a field on a boundary patch and use on another boundary patch in the same simulation, not in a different one.
I think I may have found my solution by using patchtopatchinterpolation.
Thank you anyway.

Best
Minisasi is offline   Reply With Quote

Old   May 27, 2018, 09:13
Default
  #14
Member
 
Cristina Hernandez
Join Date: May 2018
Posts: 35
Rep Power: 8
crizpi21 is on a distinguished road
Quote:
Originally Posted by romant View Post
Due to the nature of how the timeVaryingMappedFixedValue works, you can even create the sample surface in matlab, meaning you could also of course turn around the velocity vectors in matlab. When you sample in raw instead of foamFile, you get something that can easily be read into matlab, turn around the vectors and put out the 2 files (U and points) in a OpenFoam compatible version.

Hi, do you mean that you can generate a file in Matlab that creates the coordinates (points) and the velocity components for each point and then be read by OpenFOAM?

If so, how can you do that, is there any specific sintax or format?

I am trying to model a power law velocity profile for a the inlet of my domain (as boundary condition) and so far I have typed in all the values of the velocity field and coordinates manually. However, obviously this is very time consuming so, if I could generate a Matlab file which could be read by OpenFOAM directly, this would save me a lot of time.

Thanks in advance!
crizpi21 is offline   Reply With Quote

Old   January 21, 2021, 07:06
Default
  #15
Member
 
Jan Majcher
Join Date: Nov 2018
Posts: 39
Rep Power: 8
MaySea is on a distinguished road
Cristina, I know it's late, but perhaps it might help. Have you tried using a fixed profile at the inlets?
In this way you can just import a .csv file as a velocity profile e.g. in my U file:

Code:
boundaryField
{
    south //inlet
	{

		type            fixedProfile;
        profile         csvFile;
        profileCoeffs
        {
            nHeaderLine     0;
            refColumn       0;
            componentColumns 3(1 2 3);
            separator       ",";
            mergeSeparators 0;
            file        "/pathToProfile/Uprofile.csv";
        }
        direction       (0 0 1);
        origin          0;

	}
NatJ and sciFoam like this.
MaySea is offline   Reply With Quote

Reply

Tags
inlet and outlet, mapfields, sample


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
a reconstructPar issue immortality OpenFOAM Post-Processing 8 June 16, 2013 12:25
an odd(at least for me!) reconstructPar error on a field immortality OpenFOAM Running, Solving & CFD 3 June 3, 2013 23:36
Mapping outlet patch to inlet patch of new case val46 OpenFOAM 0 February 18, 2011 12:22
Inlet but not outlet mireis FLUENT 1 June 10, 2010 11:56
ATTENTION! Reliability problems in CFX 5.7 Joseph CFX 14 April 20, 2010 16:45


All times are GMT -4. The time now is 11:49.