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

setFields problems

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 2, 2021, 18:51
Default setFields problems
  #1
New Member
 
Join Date: Mar 2021
Posts: 4
Rep Power: 5
Konstantinos is on a distinguished road
Dear all,

To simulate the air flow in a tank I use the OpenFoam program. The tank contains water and particles.

As you can see from the attached pictures, the tank is cylindrical and half of it is full with water. For this reason I decided to use an stl file to set the water region in the setFields. I attached the setFields and the STL texts. To program setFields I use the command surfaceToCell.
My question is how can I program the setFields text in order to set a portion of the tank to be water.
I have also attached the results.

Thank you in advance for your help.
With Kind Regards,
Konstantinos
Attached Files
File Type: zip attached.zip (23.7 KB, 13 views)
Konstantinos is offline   Reply With Quote

Old   April 10, 2021, 18:30
Default
  #2
Senior Member
 
Claudio Boezio
Join Date: May 2020
Location: Europe
Posts: 137
Rep Power: 7
Ship Designer is on a distinguished road
Hello Konstantinos,

As far as I know it is not necessary that in the setFieldsDict the volume matches exactly the one of your geometry file. I assume that in your case the domain has the shape of the tank's interior. In that case you can more simply define a box that is bigger than the domain and intersects it at the desired fluid level for setting the liquid phase. In essence, the boolean union between the box and the domain will get the cells in the field set to 1. See my suggestion below. I hope I got the coordinates right, I'm used to having z pointing upwards. With this in mind, make sure that g also points in the right direction.

Code:
...
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    location    "system";
    object      setFieldsDict;
}

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
defaultFieldValues
(
    //volScalarFieldValue alpha.air 1  
    // It is typical to define this the other way around,
    // air = 0 and water = 1.
    // First set the entire domain to 0.
    volScalarFieldValue alpha.water 0
);

// Then only set to 1 what needs to be filled with the liquid phase.
regions
(
    boxToCell
    {
        box (-5 -10 -5) (5 0 5);        
        fieldValues
        (
            volScalarFieldValue alpha.water 1
        );
    }

    // If needed for the boundary conditions, do the same with faces
    boxToFace
    {
        box (-5 -10 -5) (5 0 5);        
        fieldValues
        (
            volScalarFieldValue alpha.water 1
        );
    }
);
// ************************************************************************* //
Hope this helps and if in doubt, check out the multiphase tutorials to see how they initialize the phases.

Cheers, Claudio
Ship Designer is offline   Reply With Quote

Old   April 18, 2021, 06:25
Default
  #3
New Member
 
Join Date: Mar 2021
Posts: 4
Rep Power: 5
Konstantinos is on a distinguished road
Dear Claudio,
Thank you for your help.
With Kind Regards,
Konstantinos
Konstantinos 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
Wierd results after running setFields without getting an error in terminal vava10 OpenFOAM Pre-Processing 3 January 15, 2021 12:12
[ICEM] Problems with coedge curves and surfaces tommymoose ANSYS Meshing & Geometry 6 December 1, 2020 12:12
Problems with setFields pbOPEN OpenFOAM Pre-Processing 2 March 26, 2019 11:23
rhoSimplecFoam with setFields sino75 OpenFOAM Pre-Processing 0 March 11, 2015 05:08
Needed Benchmark Problems for FSI Mechstud Main CFD Forum 4 July 26, 2011 13:13


All times are GMT -4. The time now is 13:21.