Hi,
is there a possibility
Hi,
is there a possibility to output the forces a fluid causes on certain walls? Thanks Anja |
Hi again,
or can someone ju
Hi again,
or can someone just tell me, whether this option exists at all?? Anja |
The posibility doesn't exist a
The posibility doesn't exist as an option, but it is a very simple operation to code. See the lift/drag utility for example.
|
Sorry, but I can't find this u
Sorry, but I can't find this utility? Where is it supposed to be?
Anja |
It's missing from the 1.3 dist
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? |
Hmm, my mistake.
This code
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). |
Hi Eugene,
some more questi
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 |
Hi all,
maybe someone else
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 |
Hi Anja,
I am currently try
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? |
Hi you,
that would be great
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 |
The magnitude of the face area
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 |
Hi pUI,
could you please fo
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 |
Working on it. Will get back t
Working on it. Will get back to you in a few hours (hopefully).
|
Hi all,
concerning the lift
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 |
Hi Anja,
I really appreciat
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 |
Hi Hrvoje,
thanks for the ans
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 |
That would be because of the
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 |
Hi,
sure your answer helps as
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 |
Sorry, my mistake: use mesh in
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 |
Hi,
it "works" with:
label
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? |
All times are GMT -4. The time now is 14:56. |