CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Paraview & paraFoam (http://www.cfd-online.com/Forums/openfoam-paraview/)
-   -   Visualizing Patch Motion (http://www.cfd-online.com/Forums/openfoam-paraview/61201-visualizing-patch-motion.html)

jaswi June 26, 2007 12:46

Dear OpenFoam Users Hello.
 
Dear OpenFoam Users

Hello.

I need to visualize the motion of a patch as it moves. As recommended by Hrv, I added following to the main solver file :

added --> #include "OFstream.H"
before -->main()

then declared a variable

label wallPatchID = mesh.boundaryMesh().findPatchID("walls");

and then just after-->runTime.write();

OFstream of("myFile.txt");

This way I could save just once instance of the patch motion. What i am wondering is that can it be done the way one saves the pressure , velocity and gamma fields and then animate the fields in paraFoam

What I have in mind is something like this to be added to --> createFields.H

1)capture the label for the desired patch

label wallPatchID = mesh.boundaryMesh().findPatchID("walls");

2) Get the pint list for the captured label

const labelList listOfWallPatchPointLabels mesh.boundaryMesh()[wallPatchID].meshPoints();

3) make an IOobject

IOobject WallPos
(
"listofWallPatchPointLabels",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
);


Or alternatively declare a pointField comprising of the desired patch and then create an IOobject using it. In that --> runTime.write(); shall write the position of the desired patch as a time instance as it writes for the other variables declared in createFields.H

My problem is that I do not know how IOobject syntax is organized.

Please help if anybody has done this before or knows how to accomplish this

With Best Regards
Jaswinder

philippose June 26, 2007 13:25

Hello Jaswinder, I am not s
 
Hello Jaswinder,

I am not sure I completely understand your question.... are you using one of the already available solvers, or are you writing a completely new solver to be used with OpenFOAM?

Usually, if you are running one of the standard solvers, the p, U, epsilon, cellMotionU, pointMotionU, etc, etc... variables are automatically written to disk during each write operation.

This data coupled with the patch names present in the boundary file of your case is enough to visualise patch motion in Paraview, without the need for any modifications to the top level OpenFOAM solver.

Each time step is displayed in paraview, and with the "play" button at the bottom left corner of the graphics window, you can create an animation.

Enjoy!

Philippose

jaswi June 26, 2007 15:26

Hi Philippose I am using in
 
Hi Philippose

I am using interFoam solver. I have modified to include rotation of the domain by adding

dimensionedVector Omega
(
"Omega",
dimensionSet(0,0,-1,0,0),
vector(0, 2 *PI/60 *RPM, 0)
);
//centrifugal foce
volVectorField Fcent = (Omega ^ (Omega^mesh.C()));
// coriolis force
2*Omega ^ U)

As a result i see the motion of the freesurface(the gamma field) as it changes. Alongwith the gamma field i want to visulaize the motion of my geometry as well which comprises of two patches. Now as far my understanding of OpenFOAM goes, these fields are written to U, pd, gamma files after the specified time interval and these fields are defined as IOobjects in the createFields.H.
Drawing analogy i tried something like this to record the patch motion so that alongwith U,pd and gamma i get another file named "wallpos" which contains face centres.

label wallPatchID = mesh.boundaryMesh().findPatchID("walls");

surfaceScalarField WALLPOS=mesh.boundaryMesh()[wallPatchID].Cf()
(
IOobject
(
"WALLPOS",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
mesh
);

Compiling this gives the following error

createFields.H:107: error: 'const class Foam::polyPatch' has no member named 'Cf'

Let me know if you got my point

With Best Regards
Jaswinder

philippose June 26, 2007 16:26

Hi again Jaswinder, I was j
 
Hi again Jaswinder,

I was just looking into interFoam... and I have a distinct feeling that you have mistaken the features the solver offers.

As far as I can see, interFoam does not have the capability to incorporate moving meshes. It is a solver capable of handling two liquid phases, but not moving meshes.

Unless you have exclusively modified the interFoam solver to incorporate dynamic meshes, there will be no physical motion of any of your patches when running a simulation using the standard interFoam solver.

You can "simulate" a velocity on different wall patches by providing them with non-zero values in the "U" dictionary, but that does not imply displacement of the points of the mesh.

Have a nice day!

Philippose

lr103476 June 26, 2007 17:48

In fact the OF-1.3 version of
 
In fact the OF-1.3 version of interFoam does incorporate mesh motion.

Watch this:
http://www.aero.lr.tudelft.nl/~frank...ngCylinder.avi

Regards, Frank

jaswi June 26, 2007 18:36

Hi Philippose Thanks for t
 
Hi Philippose

Thanks for the discussion.

It seems you are quite right about that. Just to make sure that I understand it fully please take some time to review my problem setup. I would really appreciate if you can provide me with some comments.

I have a rotating domain. Take a look at the sketch.
http://www.cfd-online.com/OpenFOAM_D...ges/1/4790.jpg. I need to simulate the motion of the free surface when the domain is rotating with the given rpm . There is no motion of mesh involved. The center of the reference frame is at (0,0,0) and the center of geometry is at(8,0,0). This leads to an ecentricty of 8 units.

Next UEqn is modified to account for the rotation by adding terms corresponding to centrifugal and coriolis forces.

dimensionedVector Omega
(
"Omega",
dimensionSet(0,0,-1,0,0),
vector(0, 2 *PI/60 *RPM, 0)
);
//centrifugal foce
volVectorField Fcent = (Omega ^ (Omega^mesh.C()));
// coriolis force
2*Omega ^ U)

After these modification I could simulate the motion of free surface. As you must be knowing already that interFoam uses surface capturing approach and free surface is nothing but an isosurface correponding to gamma = 1.

To further validate the setup, i would like to see the domain movement as well.

The changes I have made to the createFields.H to record the patchmovement seems to be useless as you have said :
---------------------
You can "simulate" a velocity on different wall patches by providing them with non-zero values in the "U" dictionary, but that does not imply displacement of the points of the mesh.
-----------------------------------------

Is there any other way one could achieve that.
Will the moving mesh approach makes that possible ? . please provide some hints

With Best Regards
Jaswinder



Is


All times are GMT -4. The time now is 13:27.