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

openfoam 2206 vs 2212 activePressureForceBaffleVelocity

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 10, 2023, 08:39
Default openfoam 2206 vs 2212 activePressureForceBaffleVelocity
  #1
New Member
 
London
Join Date: Dec 2020
Posts: 10
Rep Power: 5
CBranch171 is on a distinguished road
Hello

I have changed to openfoam 2212 and the behaviour of activePressureForceBaffleVelocity changes compared to 2206. For some reason I get a factor of 2 mutliplied for the force on both sides of the baffle. So now the pressure difference on the baffle is twice the 2206 version of the code. Yet I cannot see any difference between the files. Has anybody noticed this.

The code in both versions 2206 and 2212 have the same fix to correct division by 2 that was occurring due to the walls patch being 2 twice the area of the cyclic patches. But for some reason the force calculated now is 2x the size. This occurs for either side of the patch so the master pressure and the slave pressure are 2x what they are actually.

I can add a divide by 2 and the codes agree perfectly but I would like to know what has changed between the 2206 and 2212 versions to make this happen.
CBranch171 is offline   Reply With Quote

Old   March 11, 2023, 08:04
Default I have fixed the problem
  #2
New Member
 
London
Join Date: Dec 2020
Posts: 10
Rep Power: 5
CBranch171 is on a distinguished road
This is not due to openfoam versions. I have multiple activePressureForceBaffleVelocity BCs, 3 in total, and the way the current code calculates the pressure gave incorrect pressures on the BC after the first one. They were twice the actual pressures and hence twice the pressure difference.

I changed the code as follows and the error is removed:

scalar valueDiff = 0;
scalar force1 = 0;
scalar force2 = 0;
scalar press1 = 0;
scalar press2 = 0;
scalar area1 = 0;
scalar area2 = 0;

if (fBased_)
{
// Add this side
forAll(cyclicFaceCells, facei)
{
force1 +=p[cyclicFaceCells[facei]]*mag(initCyclicSf_[facei]);
}

// Remove other side
forAll(nbrFaceCells, facei)
{
force2 -=p[nbrFaceCells[facei]]*mag(initCyclicSf_[facei]);
}

reduce(valueDiff, sumOp<scalar>());
reduce(force1, sumOp<scalar>());
reduce(force2, sumOp<scalar>());

valueDiff = force1 - force2;

Info<< "Force difference = " << valueDiff << endl;
}
else // pressure based
{
forAll(cyclicFaceCells, facei)
{
force1 += p[cyclicFaceCells[facei]]*mag(initCyclicSf_[facei]);
area1 += mag(initCyclicSf_[facei]);
}

forAll(nbrFaceCells, facei)
{
force2 += p[nbrFaceCells[facei]]*mag(initCyclicSf_[facei]);
area2 += mag(initCyclicSf_[facei]);
}

reduce(valueDiff, sumOp<scalar>());
reduce(force1, sumOp<scalar>());
reduce(force2, sumOp<scalar>());
reduce(press1, sumOp<scalar>());
reduce(press2, sumOp<scalar>());
reduce(area1, sumOp<scalar>());
reduce(area2, sumOp<scalar>());

press1 = force1/area1;
press2 = force2/area2;
valueDiff = press1 - press2;

Info<< "Pressure difference = " << valueDiff << endl;
Info<< "p1 p2 = " << press1 << " " << press2 << endl;
}

It seems you cannot calculate the pressure average or pressure difference with the area that is not reduced. area1 and area2 are indeed the same but for consistency I have left it like the above.
CBranch171 is offline   Reply With Quote

Reply

Tags
openfoam-2206, openfoam-2212


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
Frequently Asked Questions about Installing OpenFOAM wyldckat OpenFOAM Installation 3 November 14, 2023 12:58
openfoam 2206 twoPhaseEulerFoam CBranch171 Main CFD Forum 0 November 25, 2022 13:56
[OpenFOAM.com] Problem installing OpenFoam 2206 on WSL2 with Ubuntu 22.04 LTS amolgole73 OpenFOAM Installation 3 September 7, 2022 15:25
How to develop OpenFOAM with CMake and popular IDEs cosscholar OpenFOAM Programming & Development 0 March 16, 2022 16:17
OpenFOAM Training, London, Chicago, Munich, Sep-Oct 2015 cfd.direct OpenFOAM Announcements from Other Sources 2 August 31, 2015 14:36


All times are GMT -4. The time now is 08:28.