|
[Sponsors] |
April 21, 2006, 10:13 |
Hi,
is there a possibility
|
#1 |
Member
Anja Stretz
Join Date: Mar 2009
Posts: 92
Rep Power: 17 |
Hi,
is there a possibility to output the forces a fluid causes on certain walls? Thanks Anja |
|
April 24, 2006, 06:39 |
Hi again,
or can someone ju
|
#2 |
Member
Anja Stretz
Join Date: Mar 2009
Posts: 92
Rep Power: 17 |
Hi again,
or can someone just tell me, whether this option exists at all?? Anja |
|
April 24, 2006, 06:47 |
The posibility doesn't exist a
|
#3 |
Senior Member
Eugene de Villiers
Join Date: Mar 2009
Posts: 725
Rep Power: 21 |
The posibility doesn't exist as an option, but it is a very simple operation to code. See the lift/drag utility for example.
|
|
April 24, 2006, 07:30 |
Sorry, but I can't find this u
|
#4 |
Member
Anja Stretz
Join Date: Mar 2009
Posts: 92
Rep Power: 17 |
Sorry, but I can't find this utility? Where is it supposed to be?
Anja |
|
April 24, 2006, 08:20 |
It's missing from the 1.3 dist
|
#5 |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
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 |
|
April 24, 2006, 08:22 |
Hmm, my mistake.
This code
|
#6 |
Senior Member
Eugene de Villiers
Join Date: Mar 2009
Posts: 725
Rep Power: 21 |
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). |
|
April 24, 2006, 09:14 |
Hi Eugene,
some more questi
|
#7 |
Member
Anja Stretz
Join Date: Mar 2009
Posts: 92
Rep Power: 17 |
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 |
|
May 3, 2006, 14:19 |
Hi all,
maybe someone else
|
#8 |
Member
Anja Stretz
Join Date: Mar 2009
Posts: 92
Rep Power: 17 |
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 |
|
May 3, 2006, 17:22 |
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 |
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? |
|
May 4, 2006, 05:54 |
Hi you,
that would be great
|
#10 |
Member
Anja Stretz
Join Date: Mar 2009
Posts: 92
Rep Power: 17 |
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 |
|
May 4, 2006, 06:06 |
The magnitude of the face area
|
#11 |
Senior Member
Hrvoje Jasak
Join Date: Mar 2009
Location: London, England
Posts: 1,907
Rep Power: 33 |
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 |
|
May 4, 2006, 08:39 |
Hi pUI,
could you please fo
|
#12 |
Member
Anja Stretz
Join Date: Mar 2009
Posts: 92
Rep Power: 17 |
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 |
|
May 4, 2006, 13:48 |
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 |
Working on it. Will get back to you in a few hours (hopefully).
|
|
May 5, 2006, 08:01 |
Hi all,
concerning the lift
|
#14 |
Member
Anja Stretz
Join Date: Mar 2009
Posts: 92
Rep Power: 17 |
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 |
|
May 5, 2006, 08:57 |
Hi Anja,
I really appreciat
|
#15 |
Senior Member
Hrvoje Jasak
Join Date: Mar 2009
Location: London, England
Posts: 1,907
Rep Power: 33 |
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 |
|
May 8, 2006, 05:58 |
Hi Hrvoje,
thanks for the ans
|
#16 |
Member
Anja Stretz
Join Date: Mar 2009
Posts: 92
Rep Power: 17 |
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 |
|
May 8, 2006, 06:37 |
That would be because of the
|
#17 |
Senior Member
Hrvoje Jasak
Join Date: Mar 2009
Location: London, England
Posts: 1,907
Rep Power: 33 |
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 |
|
May 8, 2006, 06:53 |
Hi,
sure your answer helps as
|
#18 |
Member
Anja Stretz
Join Date: Mar 2009
Posts: 92
Rep Power: 17 |
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 |
|
May 8, 2006, 07:14 |
Sorry, my mistake: use mesh in
|
#19 |
Senior Member
Hrvoje Jasak
Join Date: Mar 2009
Location: London, England
Posts: 1,907
Rep Power: 33 |
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 |
|
May 8, 2006, 07:16 |
Hi,
it "works" with:
label
|
#20 |
Member
Anja Stretz
Join Date: Mar 2009
Posts: 92
Rep Power: 17 |
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? |
|
|
|
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 |