CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Post-Processing (https://www.cfd-online.com/Forums/openfoam-post-processing/)
-   -   Fit the image using run time post processing (https://www.cfd-online.com/Forums/openfoam-post-processing/214972-fit-image-using-run-time-post-processing.html)

Gaubtas February 19, 2019 06:45

Fit the image using run time post processing
 
Hi I am using run-time post processing to get a nicely generated image after my OpenFOAM case is done. I do this as a part of automating the CFD process. The part I am stuck on is scaling the result to fit the image.

controlDict contains camera section which adjusts what I'm looking for.

camera {
nFrameTotal 1;
zoom _zoom; //replaced at runtime by a script, but how do I compute this?
parallelProjection yes;
position (_halfWidth, _halfHeight, 1); //center the view
focalPoint (_halfWidth, _halfHeight, 0); //center the view
clipBox (0,0,0)(_width, _height, 1);
}

The cases are essentially 2d. Problem for me is that I want to fit the image to the entire resolution. There is some kind of correlation between this and the aspect ratio of the simulation (setting zoom to be aspect ratio almost works). I can't figure out why or what is the exact behaviour. Ideally I would like some padding on the right side and put my scale legend there.

Coming from a 3D background I would imagine that you'd need to define a projection plane for a parallel (ortho) projection, but it seems the only parameter that does something similar is zoom, which seems arbitrary.

Gaubtas February 20, 2019 09:31

Seems I've found a solution.

Ended up using:
camera
{
viewAngle 90;
nFrameTotal 1;
parallelProjection no;
focalPoint (_halfWidth _halfHeight 0.0);
up (0 1 0);
position (_halfWidth _halfHeight _offsetHalfHeight);
}

for _offsetHalfHeight (distance away from the mesh):
If your mesh has 0 depth, or all depth is in -z coordinated (front face is z 0) then you can use half of the height of the simulation space. If it is not you have to add half of the depth of the mesh to half of the height of the mesh.

Still not sure how parallelProjection behaves.

Carlo_P August 7, 2019 08:38

Hey Gaubtas,
I'm managing to understand how to create pics in openFOAM.

can you give me the controlDict file?
Thanks a lot,
Carlo


All times are GMT -4. The time now is 07:12.