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

Forces caused by fluids

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 21, 2006, 10:13
Default Hi, is there a possibility
  #1
Member
 
Anja Stretz
Join Date: Mar 2009
Posts: 92
Rep Power: 17
anja is on a distinguished road
Hi,

is there a possibility to output the forces a fluid causes on certain walls?

Thanks
Anja
anja is offline   Reply With Quote

Old   April 24, 2006, 06:39
Default Hi again, or can someone ju
  #2
Member
 
Anja Stretz
Join Date: Mar 2009
Posts: 92
Rep Power: 17
anja is on a distinguished road
Hi again,

or can someone just tell me, whether this option exists at all??

Anja
anja is offline   Reply With Quote

Old   April 24, 2006, 06:47
Default The posibility doesn't exist a
  #3
Senior Member
 
Eugene de Villiers
Join Date: Mar 2009
Posts: 725
Rep Power: 21
eugene is on a distinguished road
The posibility doesn't exist as an option, but it is a very simple operation to code. See the lift/drag utility for example.
eugene is offline   Reply With Quote

Old   April 24, 2006, 07:30
Default Sorry, but I can't find this u
  #4
Member
 
Anja Stretz
Join Date: Mar 2009
Posts: 92
Rep Power: 17
anja is on a distinguished road
Sorry, but I can't find this utility? Where is it supposed to be?

Anja
anja is offline   Reply With Quote

Old   April 24, 2006, 08:20
Default It's missing from the 1.3 dist
  #5
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
It's missing from the 1.3 distribution (and the folder src/postProcessing that contains the real calculation is missing, too).

Is this by mistake or by design?
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request
gschaider is offline   Reply With Quote

Old   April 24, 2006, 08:22
Default Hmm, my mistake. This code
  #6
Senior Member
 
Eugene de Villiers
Join Date: Mar 2009
Posts: 725
Rep Power: 21
eugene is on a distinguished road
Hmm, my mistake.

This code should do the trick though:

pressureForce = vector::zero;
viscousForce = vector::zero;

forAll(patchNames, i)
{
label patchI = mesh.boundaryMesh().findPatchID(patchNames[i]);

if (patchI != -1)
{
vectorField pf =
p.boundaryField()[patchI]
*mesh.Sf().boundaryField()[patchI];

pressureForce += gSum(pf);

vectorField vf =
-mu.boundaryField()[patchI]
*U.boundaryField()[patchI].snGrad()
*mesh.magSf().boundaryField()[patchI];

viscousForce += gSum(vf);
}
else
{
pressureForce += gSum(vectorField(0));
viscousForce += gSum(vectorField(0));
}
}

where patchNames are the names of the boundaries you wish to sum forces for and mu is an effective viscosity field (laminar + turbulent).
eugene is offline   Reply With Quote

Old   April 24, 2006, 09:14
Default Hi Eugene, some more questi
  #7
Member
 
Anja Stretz
Join Date: Mar 2009
Posts: 92
Rep Power: 17
anja is on a distinguished road
Hi Eugene,

some more questions:
- where do I get the mu field from?
- do I have to change the code for a compressible fluid?
- where do I have to write the code?
- how can I actually use it?

Thanks alot
Anja
anja is offline   Reply With Quote

Old   May 3, 2006, 14:19
Default Hi all, maybe someone else
  #8
Member
 
Anja Stretz
Join Date: Mar 2009
Posts: 92
Rep Power: 17
anja is on a distinguished road
Hi all,

maybe someone else can answer my questions?

Moreover I do not know how to write the header, I mean which functions to call.

Thanks
Anja
anja is offline   Reply With Quote

Old   May 3, 2006, 17:22
Default Hi Anja, I am currently try
  #9
Senior Member
 
Srinath Madhavan (a.k.a pUl|)
Join Date: Mar 2009
Location: Edmonton, AB, Canada
Posts: 703
Rep Power: 21
msrinath80 is on a distinguished road
Hi Anja,

I am currently trying to follow instructions given by another user. I have moved back to the 1.2 version. I have no choice. I will give it an try and if everything works fine, I will post the source code and the instructions to get it working. Hope that is fine?
msrinath80 is offline   Reply With Quote

Old   May 4, 2006, 05:54
Default Hi you, that would be great
  #10
Member
 
Anja Stretz
Join Date: Mar 2009
Posts: 92
Rep Power: 17
anja is on a distinguished road
Hi you,

that would be great. Thanks.

And maybe you also have an answer to that problem:
I want to multiply the pressure of each face of one patch by it's area, something like p*A (for each face). But how to get A. In te program above it is:
p.boundaryField()[patchI]
*mesh.Sf().boundaryField()[patchI];
I don't how the size of the area is connected with the surface vector.

Anja
anja is offline   Reply With Quote

Old   May 4, 2006, 06:06
Default The magnitude of the face area
  #11
Senior Member
 
Hrvoje Jasak
Join Date: Mar 2009
Location: London, England
Posts: 1,907
Rep Power: 33
hjasak will become famous soon enough
The magnitude of the face area vector is equal to the area. If you don't want the vector, try mesh.magSf(). Quoting from fvMesh.H:


//- Return cell face area magnitudes
const surfaceScalarField& magSf() const;



Hrv
__________________
Hrvoje Jasak
Providing commercial FOAM/OpenFOAM and CFD Consulting: http://wikki.co.uk
hjasak is offline   Reply With Quote

Old   May 4, 2006, 08:39
Default Hi pUI, could you please fo
  #12
Member
 
Anja Stretz
Join Date: Mar 2009
Posts: 92
Rep Power: 17
anja is on a distinguished road
Hi pUI,

could you please forward me the instructions from the other user? or do you already have any news? I really need some hints!

Anja
anja is offline   Reply With Quote

Old   May 4, 2006, 13:48
Default Working on it. Will get back t
  #13
Senior Member
 
Srinath Madhavan (a.k.a pUl|)
Join Date: Mar 2009
Location: Edmonton, AB, Canada
Posts: 703
Rep Power: 21
msrinath80 is on a distinguished road
Working on it. Will get back to you in a few hours (hopefully).
msrinath80 is offline   Reply With Quote

Old   May 5, 2006, 08:01
Default Hi all, concerning the lift
  #14
Member
 
Anja Stretz
Join Date: Mar 2009
Posts: 92
Rep Power: 17
anja is on a distinguished road
Hi all,

concerning the liftDrag utility.
I can find the following chapter there:

vector Uav = vector::zero;
forAll(U.boundaryField(), patchI)
{
if (U.boundaryField()[patchI].fixesValue())
{
Uav += average(U.boundaryField()[patchI]);
}
}

Why does that not work for p? I tried to compile the changed file and got this error message:

liftDrag2.C:111: error: no match for 'operator+=' in 'pav += Foam::average [with Type = Foam::scalar](((const Foam::UList<foam::scalar>&)((const Foam::UList<foam::scalar>*)(&(+(+ p. Foam::GeometricField<type,>::boundaryField [with Type = Foam::scalar, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh]())->Foam::GeometricField<foam::scalar,>::GeometricBou ndaryField:: <anonymous>.Foam::FieldField<foam::fvpatchfield,>: :<anonymous>.Foam::PtrList<t>: :operator[] [with T = Foam::fvPatchField<foam::scalar>](patchI))->Foam::fvPatchField<foam::scalar>::<a nonymous>.Foam::Field<foam::scalar>::<anonymous>.F oam::List<foam::scalar>::<anon ymous>))))'

Thanks for your help.
Anja
anja is offline   Reply With Quote

Old   May 5, 2006, 08:57
Default Hi Anja, I really appreciat
  #15
Senior Member
 
Hrvoje Jasak
Join Date: Mar 2009
Location: London, England
Posts: 1,907
Rep Power: 33
hjasak will become famous soon enough
Hi Anja,

I really appreciate the effort you are putting in and the above should work for p with no trouble. I have written the following piece of code which works for me with no trouble - please compare with your stuff and tell me what's the difference:


volScalarField p
(
IOobject
(
"p",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);

scalar pav = 0.0;
forAll(p.boundaryField(), patchI)
{
if (p.boundaryField()[patchI].fixesValue())
{
pav += average(p.boundaryField()[patchI]);

}
}

Hrv
__________________
Hrvoje Jasak
Providing commercial FOAM/OpenFOAM and CFD Consulting: http://wikki.co.uk
hjasak is offline   Reply With Quote

Old   May 8, 2006, 05:58
Default Hi Hrvoje, thanks for the ans
  #16
Member
 
Anja Stretz
Join Date: Mar 2009
Posts: 92
Rep Power: 17
anja is on a distinguished road
Hi Hrvoje,
thanks for the answer. Yes I can compile this part, but unfortunately the result is p=0 (at each time step).

Where do I define which patch is to be calculated within the liftDrag utility?

Anja
anja is offline   Reply With Quote

Old   May 8, 2006, 06:37
Default That would be because of the
  #17
Senior Member
 
Hrvoje Jasak
Join Date: Mar 2009
Location: London, England
Posts: 1,907
Rep Power: 33
hjasak will become famous soon enough
That would be because of the if (p.boundaryField()[patchI].fixesValue()) bit.

If you want to do a specific patch, do the findPatchID trick - beware, if there's no such patch, the index returned will be -1.

You can do something like:


label fixedPatchID=aMesh().boundary().findPatchID(myPatc hName);

if (fixedPatchID != -1)
{
// Your stuff here, using
mesh.boundaryMesh()[fixedPatchID];

}


In liftDrag, the force will be calculated for all patches of the wall type:


forAll(patches, patchI)
{
if (isType<wallfvpatch>(patches[patchI]))
{



Hope this helps,

Hrv
__________________
Hrvoje Jasak
Providing commercial FOAM/OpenFOAM and CFD Consulting: http://wikki.co.uk
hjasak is offline   Reply With Quote

Old   May 8, 2006, 06:53
Default Hi, sure your answer helps as
  #18
Member
 
Anja Stretz
Join Date: Mar 2009
Posts: 92
Rep Power: 17
anja is on a distinguished road
Hi,
sure your answer helps as usual. But still....

This time I tried:
scalar pav = 0.0;
label fixedPatchID=aMesh().boundary().findPatchID("inlet ");
if (fixedPatchID != -1)
{
forAll(p.boundaryField(), patchI)
{
if (p.boundaryField()[patchI].fixesValue())
{
pav += average(p.boundaryField()[patchI]);
}
}
mesh.boundaryMesh()[fixedPatchID];
}

Error:'aMesh' was not declared in this scope

Moreover I want to come back to the Uavg I have posted before. It does not calculate an average inlet velocity?!

Anja
anja is offline   Reply With Quote

Old   May 8, 2006, 07:14
Default Sorry, my mistake: use mesh in
  #19
Senior Member
 
Hrvoje Jasak
Join Date: Mar 2009
Location: London, England
Posts: 1,907
Rep Power: 33
hjasak will become famous soon enough
Sorry, my mistake: use mesh instead of amesh().

The Uav will sum up the values for all patches that fix the value, which will probably be inlet and all the walls.

Hrv
__________________
Hrvoje Jasak
Providing commercial FOAM/OpenFOAM and CFD Consulting: http://wikki.co.uk
hjasak is offline   Reply With Quote

Old   May 8, 2006, 07:16
Default Hi, it "works" with: label
  #20
Member
 
Anja Stretz
Join Date: Mar 2009
Posts: 92
Rep Power: 17
anja is on a distinguished road
Hi,
it "works" with:
label fixedPatchID = mesh.boundaryMesh().findPatchID("inlet");

But what I got when I use it for one of my cases is:
Time = 50
Reading U
Reading p
Inlet velocity: (1.58209 -0.306071 0)
p : 0
Wall patch 2 named wall :
Reference area: 0.00161926 Reference length: 0.191748 Drag coefficient: 0.0630347

So the wrong inlet velocity and p=0;

Any suggestions?
anja 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
Bug caused by CrankNicholson scheme cbeck OpenFOAM Bugs 8 March 28, 2009 02:48
waves caused by stones gamego Main CFD Forum 5 October 1, 2008 11:33
Problems caused by fvcmeshPhi rolando OpenFOAM Bugs 26 April 3, 2007 11:34
Adiabatic compression caused by gas ram Chris FLUENT 0 December 13, 2005 05:42
problem caused by the different materials limingtiger Siemens 1 November 21, 2005 09:02


All times are GMT -4. The time now is 04:41.