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/)
-   -   Some Problems about the Boundary Conditions in OpenFoam (https://www.cfd-online.com/Forums/openfoam-solving/71473-some-problems-about-boundary-conditions-openfoam.html)

sabago October 31, 2015 17:00

HERE'S what i get

Checking geometry...
Overall domain bounding box (0 0 0) (0.0001 0.00057 5e-05)
Mesh (non-empty, non-wedge) directions (1 1 0)
Mesh (non-empty) directions (1 1 0)
All edges aligned with or perpendicular to non-empty directions.
Boundary openness (2.34216e-17 0 4.68431e-17) OK.
Max cell openness = 1.0982e-16 OK.
Max aspect ratio = 43.6937 OK.
Minimum face area = 1.14433e-10. Maximum face area = 5e-09. Face area magnitudes OK.
Min volume = 1.14433e-14. Max volume = 5.72165e-14. Total volume = 2.85e-12. Cell volumes OK.
Mesh non-orthogonality Max: 0 average: 0
Non-orthogonality check OK.
Face pyramids OK.
Max skewness = 0.197788 OK.
Coupled point location match (average 0) OK.

Mesh OK.

End

wyldckat October 31, 2015 17:57

Then shouldn't the file "tcath.dat" have these values?
Code:

(
(0.00000 2.5)
(0.00025 3)
(0.00035 4)
)

I say this because of this:
Code:

Overall domain bounding box (0 0 0) (0.0001 0.00057 5e-05)
In addition to this, in ParaView, are you looking at the last time snapshot?

sabago November 1, 2015 03:05

i am checking the last time step in paraview. and i have this for my .dat file

Code:

((0e-6 4)
(25e-6 3)
(35e-6 2.5)


)

____________

i also tried
Code:

(
(0e-6 2.5)
(25e-6 3)
(35e-6 4)


)

____________

i am checking the last time step in paraview. and i have this for my .dat file

Code:

((0e-6 4)
(25e-6 3)
(35e-6 2.5)


)

and
Code:

(
(570e-6 2.5)
(545e-6 3)
(535e-6 4)
)

____________

I notice that you use a name different from the .dat file name as I do. COuld that be causing my problems?

wyldckat November 1, 2015 15:39

Hi Sandra,

Quote:

Originally Posted by sabago (Post 571251)
Code:

(
(570e-6 2.5)
(545e-6 3)
(535e-6 4)
)


It's best to use the first column ordered from smallest to largest:
Code:

(
(535e-6 4)
(545e-6 3)
(570e-6 2.5)
)

But there is something strange with these numbers... what is the mesh resolution that you are using? Because this assumes that you have at least 3 cells between "535e-6" and "570e-6".


Quote:

Originally Posted by sabago (Post 571251)
I notice that you use a name different from the .dat file name as I do. COuld that be causing my problems?

This would only be a problem if you are not editing the file "tcath.dat" in the correct folder.
Try running this command inside the case folder:
Code:

find -name tcath.dat
it will tell you the paths where it finds this file is located.

If this doesn't help, then I strongly suggest that you take a step back and test with another test case, preferably one of OpenFOAM's tutorial cases. I say this because sometimes there are certain details that we only see when we look at them from a different perspective.

Best regards,
Bruno

sabago November 2, 2015 05:51

Quote:

Originally Posted by wyldckat (Post 571331)
Hi Sandra,


It's best to use the first column ordered from smallest to largest:
Code:

(
(535e-6 4)
(545e-6 3)
(570e-6 2.5)
)

But there is something strange with these numbers... what is the mesh resolution that you are using? Because this assumes that you have at least 3 cells between "535e-6" and "570e-6".
Best regards,
Bruno

hi Bruno,, how can i determine my resolution? all i know is that the parameter that i want to change is 50micron along y

wyldckat November 2, 2015 17:08

Quote:

Originally Posted by sabago (Post 571424)
hi Bruno,, how can i determine my resolution? all i know is that the parameter that i want to change is 50micron along y

Quick answer: If you created the mesh, you should know what resolution you have defined ;)

If you used blockMesh, check how you defined the blocks. For example, in the tutorial case "incompressible/icoFoam/cavity", the following definitions were used:
Code:

convertToMeters 0.1;

vertices
(
    (0 0 0)
    (1 0 0)
    (1 1 0)
    (0 1 0)
    (0 0 0.1)
    (1 0 0.1)
    (1 1 0.1)
    (0 1 0.1)
);

blocks
(
    hex (0 1 2 3 4 5 6 7) (20 20 1) simpleGrading (1 1 1)
);

Which means that the mesh is 0.1 by 0.1 by 0.01 (m) in total dimensions, divided in a cell distribution of 20 by 20 by 1, which equals to a resolution of 0.005 by 0.005 by 0.01 (m).

sabago November 2, 2015 17:11

oh, my resolution is 100micronx5.7micronx50micron

wyldckat November 7, 2015 11:31

Hi Sandra,

I hope you've figured out what the problem was.
If not, we need a common example to work with, in order to make it easier to diagnose what it is the exact problem. Otherwise we'll be going back and forth with a guessing game for which I don't have enough time for.

If you can share your case at least privately, send me a PM with a download link for the case on DropBox or similar file sharing service. If not, then please use one of OpenFOAM's tutorials as a base for creating a similar case structure and then share it here. That way it's a lot easier to figure out what the exact problem is.

Best regards,
Bruno

sabago November 9, 2015 09:53

will PM you

sabago November 9, 2015 13:54

what did you set as your internalField at 0/U?
It seems that mine only reads the internalField.

Sandra
Quote:

Originally Posted by wyldckat (Post 571171)
Greetings to all!

@Sandra: I'm going to use part of the PM you sent me to answer your question, since the two topics are related:


This is one of those situations I have to test things myself, namely to do some trial-and-error. I've tested the following in the tutorial case "incompressible/icoFoam/cavity":
  1. In "0/U":
    Code:

        movingWall
        {
            type groovyBC;

            lookuptables (
                {
                    name dataMe;
                    outOfBounds clamp;
                    fileName "$FOAM_CASE/data.dat";
                }
            );

            valueExpression "vector(dataMe(pos().x),0.0,0.0)";
            value          uniform (1 0 0);
        }

  2. Created the file "data.dat" in the "cavity" folder:
    Code:

    (
    (0    2.5)
    (0.05 3)
    (0.1  4)
    )

  3. In "system/controlDict" I added this line:
    Code:

    libs ("libgroovyBC.so");
And it ran fine. The detail is that you are trying to use the field name "y", when you should instead use "pos().y":
Code:

tcath(pos().y)
I think that the entry "fields" is not used, namely this one:
Code:

fields
    (y tc);

If this still doesn't work, then perhaps the values for "pos().y" aren't the ones you're planning for? For example, if your calculations are in millimetre, but the mesh is in metre, then it's somewhat natural that this problem occurs.

Best regards,
Bruno


wyldckat November 15, 2015 13:41

Hi Sandra,

I've finally managed to take a look into this today.
Quote:

Originally Posted by sabago (Post 572657)
what did you set as your internalField at 0/U?
It seems that mine only reads the internalField.

In the test case I did, I only changed the boundary condition, the rest is the original settings in the tutorial.

Quoting from the PM you sent me:
Quote:

Originally Posted by sabago
After running the case, the parameters that I'm looking at in ParaView are "jbvag" and "jbvcg"; after integration, they should be the same within some error.
But changing the values in my .dat files doesn't do anything to the values of "jbvag" and "jbvcg" but changing the internalField shows a difference.

Actually, I had to look at the files "0/anode/pang" and "0/anode/tang", which were the ones with the groovyBC boundary conditions. Fortunately, since you sent me the code for solver as well, I was able to pinpoint the problem.
For example, since the fields "pang" and "tang" are used only for conventional calculations and are not part of equations, then their boundary conditions aren't updated and are used as-is after loading. In order to force the update you need to call the method "correctBoundaryConditions()". For example, for the field "pang" you need to call this method right after loading it:
Code:

    Info<< "Reading pang\n" << endl;
    volScalarField pang
    (
        IOobject
        (
            "pang",
            runTime.timeName(),
            anodeMesh,
            IOobject::MUST_READ,
            IOobject::AUTO_WRITE
        ),
        anodeMesh
    );
    pang.correctBoundaryConditions();

The last line is the new code.

If you do this for all of the relevant fields, then things should finally work as intended.

Best regards,
Bruno

sabago December 14, 2015 09:39

Hi Bruno,

I did try your suggestion but it seems that it's still only reading the internal field.
I PMed you the revised solver (and case).

Best,
Sandra

wyldckat December 28, 2015 18:19

1 Attachment(s)
Hi Sandra,

I have to say that I feel a bit lost on where I should look at to see the problem.
Here are the steps I took:
  1. I downloaded the folders you sent me and I ran inside the folder "ysofcFoam" the following commands:
    Code:

    wclean
    wmake

    Note: I used OpenFOAM 2.3.1.
  2. Then I went to the folder of the case "YSOFC" and ran the solver ysofcFoam.
  3. I aborted the run after several iterations, where it stopped at around "0.00113".
  4. Then I opened the case in ParaView with this command:
    Code:

    paraFoam -builtin
  5. Then I selected only the surface mesh patches "anode/anode_inlet" and "anode/fixedWalls".
  6. From the fields list, I selected only the "pang" field.
  7. Also turned on the "Cube Axes", which is an option more at the bottom of the "Properties" widget (the small window on the bottom left entitled "Properties").
  8. Then clicked on the "Apply" button.
  9. Then went to the next time step "1e-05" and changed the view to see what I see in the attached image.
    • Notice the several settings that are shown in the image, such as the represented field and the represented time step.
As you can see in the attached image, everything seems to be working as intended, given that the "pan.dat" file has this:
Code:

(
(69e-6 0)
(70e-6 0.17)
(90e-6    0.17)
(91e-6  0.3)
(570e-6 0.3)
)

The first column refers to the Y axis position and the second column is the value to be represented in the "pang" field.

If you follow these same steps, are you able to see the same results?
What is the exact problem I should be looking for?

Best regards,
Bruno

sabago January 11, 2016 06:55

how do I get the "represented field" and "time" to show in the plot?

wyldckat January 31, 2016 11:57

Quick question: Are you referring to a 2D plot or a 3D view?

sabago February 24, 2016 13:53

2D plot view

LeeRuns March 25, 2016 12:12

Quote:

Originally Posted by Axel_T (Post 241574)
Hi Why,

there are many types of BC, right. But they are all set in the fieldvariables in your first time-dictionary.

A simple pipe for example would have a inlet, outlet and fixed walls, when you defined the boundaries right during mesh-generation.
In the time-dictionary /0 must be for example the file of the pressure variable: /0/p
In that file there is a entry for the initial state:
internalField uniform 100000;
and a sub-dictionary for the boundaries:
boundaryField
{
inlet
{
type fixedValue;
value uniform 1.1e5;
}

fixedWalls
{
type zeroGradient;
}

outlet
{
type fixedValue;
value uniform 1e5;
}
}
For the velocity at the inlet, there is a BC called pressureInletOutletVelocity which calculates the velocity depending on the pressure.

Take a look at the OF-UserGuide chapter 5.2 especially page U-133

bye
Axel


i have run 2 cases (icoFOam and nonNewtonian Icofoam). I see you are defining the initial conditions in your p and u files as individual scalars. All of my are x,y,x component of u or p at that boundary. How are you describing x,y,x with just an individual value?

wyldckat March 28, 2016 15:34

1 Attachment(s)
Greetings to all!

@Sandra:
Quote:

Originally Posted by sabago (Post 586698)
2D plot view

Sorry, but only today did I finally manage to take a look into this. Attached is the image "ParaView 4.4 2D plot options.jpg" that shows how it can be configured in ParaView 4.4. I could not find similar settings on ParaView 4.1.0.
Notice 3 important details on the left side of the image, inside the "Properties" tab:
  1. The gear icon (below the blue question mark "?") is turned on.
  2. The "Series Parameters" has the selection of the desired field to be plotted.
  3. The "Chart Title" is defined as:
    Code:

    Time so far: ${TIME}s
    where "${TIME}" is the place-holder keyword that ParaView provides for representing the time.
  4. A bit below the chart title option, which is not shown in the image, is the option to show the legend with the names of the plotted fields.

@LeeRuns:
Quote:

Originally Posted by LeeRuns (Post 591652)
i have run 2 cases (icoFOam and nonNewtonian Icofoam). I see you are defining the initial conditions in your p and u files as individual scalars. All of my are x,y,x component of u or p at that boundary. How are you describing x,y,x with just an individual value?

For example, this:
Code:

value      uniform 1e5;
means that all entries are uniformly set to 100000. If there was at least one different value, then this would actually be something like:
Code:

value nonuniform 234(1e5 1e5 .... 1e4 ... 1e5);
where the dots are just hinting there there would be more values there.

In order to set values depending on X, Y, Z positions, you can use funkySetFields: http://openfoamwiki.net/index.php/Co...funkySetFields

Best regards,
Bruno

Bharath Bhushan April 15, 2017 03:26

boundary condition
 
hello guys,



I am confused with the boundary conditions. I want to simulate nozzle flow with water as fluid.

I have these values-

velocity at inlet = 1.46m/s
total pressure = 6 Bar
simpleFoam with either kepsilon or kOmega

I set the conditions as

velocity - inlet (fixedValue 1.43), outlet (zeroGradient)
pressure - inlet (zeroGradient), outlet (fixedValue uniform 0)

when I see it in the paraview, the pressure at the inlet shows 2000 pascal, but the actual value is around 5 Bar.

Actually I am confused with the pressure boundary conditions. Whether in simpleFoam, pressure in 0/p takes static or dynamic or total pressure ?.

please can anybody suggest appropriate boundary condition for my case ?


thank you

Bharadwaj

piu58 April 15, 2017 07:35

> total pressure = 6 Bar

I think you mean the pressure difference between inlet and outlet.

You may set this difference and calculate the velocity or set the velocity and calculate the pressure difference.

If you have measured values and the results of your calculation differ, you have a good example to learn how OF needs to be set and which degree of accuracy can be reached with fluid simulations.

Please keep in mind: When simulating incompressible, OF takes the kinematic pressure.


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