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

interFoam, can I just set velocity of water if the inlet boundary has air and water m

Register Blogs Community New Posts Updated Threads Search

Like Tree6Likes
  • 5 Post By crubio.abujas
  • 1 Post By crubio.abujas

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 26, 2020, 10:52
Default interFoam, can I just set velocity of water if the inlet boundary has air and water m
  #1
New Member
 
Z. Cao
Join Date: May 2020
Posts: 2
Rep Power: 0
tidal is on a distinguished road
hi, guys, I want to simulate a simple ocean flow within a box domain. I am using interFoam. The alpha.water was defined by setField, and the rest is air. Can I only set the velocity of water? If I set the U.inlet a value, means both air and water have same inlet velocoty. That causes the interface between air and water unsteady. Is it possible to set U.water and U.air separately? Thank you.
tidal is offline   Reply With Quote

Old   May 26, 2020, 14:35
Default Usage of coded boundary condition
  #2
Senior Member
 
Carlos Rubio Abujas
Join Date: Jan 2018
Location: Spain
Posts: 127
Rep Power: 9
crubio.abujas is on a distinguished road
Quote:
Originally Posted by tidal View Post
hi, guys, I want to simulate a simple ocean flow within a box domain. I am using interFoam. The alpha.water was defined by setField, and the rest is air. Can I only set the velocity of water? If I set the U.inlet a value, means both air and water have same inlet velocoty. That causes the interface between air and water unsteady. Is it possible to set U.water and U.air separately? Thank you.
Short answer is no. interFoam solves uses a VOF approach to model the multiphase, which it means that it solve the momentum equation just once for whatever fluid is in the cell. In the VOF model it is expected that the cell just contains one fluid or the other, although if there is a mix of both it interpolate the properties using the volume fraction.

If you really want to model two separate momemtum equations for each of the phases you need to use an Eulerian approach (multiphaseEulerianFoam, for example). In this solver you have those U.water/U.air files to handle, but this approach may be a little overkill as it is computationally more expensive.

As you have already two well separated phases you may want to use some kind of special boundary condition that only impose a velocity in a specific region. You can add an additional patch on the bottom of the domain and implement the velocity there. Other option is to just code in a boundary condition that suits your requirements. For example you can quickly do some test using rather codedFixedValue of codedMixed boundary conditions.

Code:
    leftWall
    {
        type             codedFixedValue;
        value           uniform (0 0 0);
        name           leftWall;
        code            
        #{

            const fvPatch& boundaryPatch = patch();
            const vectorField& Cf = boundaryPatch.Cf();
            vectorField& field = *this;

            const scalar ymax     =   0.2;        // Max Height to apply cond
            const scalar addV     =   0.3;         // X-Velocity [m/s]

            forAll(Cf, faceI) 
            {
                field[faceI] = Cf[faceI].y() < ymax ?  vector(vx, 0, 0) : vector(0, 0, 0);
            }
        #};
Or you can set a condition only on the "wet" region of the boundary using a reference to the field alpha.water:
Code:
    leftWall
    {
        type             codedFixedValue;
        value           uniform (0 0 0);
        name           leftWall;
        code            
        #{
            label ownName = this->patch().boundaryMesh().findPatchID("leftWall");
            const fvPatch& boundaryPatch = patch();
            const vectorField& Cf = boundaryPatch.Cf();

            const volScalarField& alphaW = 
                db().lookupObject<volScalarField>("alpha.water");
            const scalarField aWPatch(alphaW.boundaryField()[ownName]);

            const scalar minVOF     =   0.2;        // Max Height to apply cond
            const scalar addV     =   0.3;         // X-Velocity [m/s]

            forAll(Cf, faceI) 
            {
                field[faceI] = aWPatch[faceI] > minVOF ? vector(vx, 0, 0) : vector(0, 0, 0);
            }
        #};
Hopes it help!
Rvadrabade, mowei, Myiced and 2 others like this.
crubio.abujas is offline   Reply With Quote

Old   May 26, 2020, 14:48
Wink
  #3
New Member
 
Z. Cao
Join Date: May 2020
Posts: 2
Rep Power: 0
tidal is on a distinguished road
Thank you. I think this will help me to define the region. I will try it. If other questions came out, I will come back.
tidal is offline   Reply With Quote

Old   October 13, 2021, 10:56
Default
  #4
New Member
 
Join Date: Sep 2021
Posts: 6
Rep Power: 4
Naira is on a distinguished road
I am applying the same boundary condition on inlet but it gives me that error


Cannot find patchField entry for outlet
Naira is offline   Reply With Quote

Old   October 19, 2021, 09:43
Default
  #5
Senior Member
 
Carlos Rubio Abujas
Join Date: Jan 2018
Location: Spain
Posts: 127
Rep Power: 9
crubio.abujas is on a distinguished road
Quote:
Originally Posted by Naira View Post
I am applying the same boundary condition on inlet but it gives me that error


Cannot find patchField entry for outlet

I think the code I shared is missing a clousure bracket, that may be causing the error by not recognizing the patches defined after it.
Naira likes this.
crubio.abujas 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
CFD analaysis of Pelton turbine amodpanthee CFX 31 April 19, 2018 18:02
mass flow in is not equal to mass flow out saii CFX 12 March 19, 2018 05:21
Multiphase flow - incorrect velocity on inlet Mike_Tom CFX 6 September 29, 2016 01:27
Wrong flow in ratating domain problem Sanyo CFX 17 August 15, 2015 06:20
air bubble is disappear increasing time using vof xujjun CFX 9 June 9, 2009 07:59


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