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

Update boundary values and correctBoundaryConditions()

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 26, 2021, 17:21
Default Update boundary values and correctBoundaryConditions()
  #1
Member
 
Join Date: Feb 2020
Posts: 90
Rep Power: 6
Shibi is on a distinguished road
Hello to all,


I would like to have some input on how to update the boundary values of a field.


I created a field called test:



Code:
        volScalarField test
        (
            IOobject
            (
                "test",
                runTime.timeName(),
                mesh,
                IOobject::MUST_READ,
                IOobject::AUTO_WRITE
            ),
            mesh,
            dimensionedScalar("test_", dimless, 2)
        );
The boundary conditions for test are fixedValue for all patches with a value of 2.

Code:
dimensions      [0 0 0 0 0 0 0];


internalField   uniform 0;

boundaryField
{
    "(.*)"
    {
        type            fixedValue;
        value           uniform 2;
    }

}
I perform some arithmetic with this field:
Code:
test = test+test
If I specify to write the field I will get:


Code:
test.write();
Code:
dimensions      [0 0 0 0 0 0 0];


internalField   uniform 4;

boundaryField
{
    myPatch1
    {
        type            calculated;
        value           uniform 4;
    }
myPatch2
    {
        type            calculated;
        value           uniform 4;
    }
myPatch3
    {
        type            calculated;
        value           uniform 4;
    }
myPatch4
    {
        type            calculated;
        value           uniform 4;
    }
myPatch5
    {
        type            calculated;
        value           uniform 4;
    }
}
Now, I would like to update the boundary values of test.

How can I do this?
I could just loop over the patch faces and adjust the value but is there a function for this?

If I try:
Code:
test.correctBoundaryConditions();
I will get the same output as before (all values at 4). I was hoping to get the values of the patches to be 2.

Can anyone clarify this ?
Shibi is offline   Reply With Quote

Old   March 27, 2021, 09:04
Default
  #2
New Member
 
Giovanni Luddeni
Join Date: Jan 2021
Posts: 14
Rep Power: 5
gionni is on a distinguished road
I don't know the answer but I have an idea.
As you know, a field has a boundary (list of boundary faces) and an internal field (list of cells).
Maybe you could try to sum the internal fields instead of the whole fields.

I had a similar problem anyway, and I just ended up cycling on the cells.
gionni is offline   Reply With Quote

Old   March 28, 2021, 14:58
Default
  #3
Member
 
Join Date: Feb 2020
Posts: 90
Rep Power: 6
Shibi is on a distinguished road
Quote:
Originally Posted by gionni View Post
I don't know the answer but I have an idea.
As you know, a field has a boundary (list of boundary faces) and an internal field (list of cells).
Maybe you could try to sum the internal fields instead of the whole fields.

I had a similar problem anyway, and I just ended up cycling on the cells.



That is a fix, but I would like to know why this happens.



In the PEqn of a lot of solvers you see: Some operation on U followed by the update of the boundary conditions:


e.g., in PISO foam



Code:
U = HbyA - rAU*fvc::grad(p);
U.correctBoundaryConditions();

You can also see this applied to p_ rhg in several solvers.

I would like to know what it is doing (or what I did wrong in calling it), since the function call 3 functions:



Code:
    this->setUpToDate();    

    storeOldTimes();
     boundaryField_.evaluate();
Shibi 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
3D Windturbine simulation in SU2 k.vimalakanthan SU2 15 October 12, 2023 05:53
Boundary face values in density based solver? Chen Zhi FLUENT 3 November 28, 2019 06:51
FLUENT: Reference values, Boundary Conditions, Drag Co-efficient and Downforce Harshal FLUENT 21 September 12, 2017 11:12
Co-simulation, map values to a non-convective boundary Jimmy123 STAR-CCM+ 0 September 6, 2013 07:01
RPM in Wind Turbine Pankaj CFX 9 November 23, 2009 04:05


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