CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (https://www.cfd-online.com/Forums/openfoam-solving/)
-   -   Saving patch motion as an IOobject (https://www.cfd-online.com/Forums/openfoam-solving/59614-saving-patch-motion-ioobject.html)

jaswi June 26, 2007 12:47

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

jaswi June 26, 2007 13:07

I tried adding following to cr
 
I tried adding following to createFields.H

---------------------
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'

Please tell what I did wrong

With Best Regards
Jaswinder


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