CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM

Sampling a limited size cutting plane

Register Blogs Community New Posts Updated Threads Search

Like Tree4Likes
  • 3 Post By ykanani
  • 1 Post By nusivares

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 18, 2017, 09:45
Default Sampling a limited size cutting plane
  #1
Member
 
1214
Join Date: Sep 2015
Posts: 30
Rep Power: 10
nusivares is on a distinguished road
Hi,

I am in my Friday afternoon fury.

I have spent the whole afternoon googling about with no result on a fairly simple problem.

For some strange reasons there is very little documentation on how to sample a fixed size square plane through the domain.

It should be very easy and a standard thing to do. But it is not.

And I do not want to press a bunch of button on paraview every time to get the surfaces out. I would like a simple script. The code below does not cut it. Just produces the slice through the whole domain which further annoys.

I checked the points and the points are ok.

Essentially I want to limit my plane by those 3 points.

Code:
type surfaces;
libs ("libsampling.so");

interpolationScheme cellPointFace;

surfaceFormat vtk;

surfaces 
(
    xNew
    {
	type            cuttingPlane;    // always triangulated
	planeType       embeddedPoints;
	embeddedPointsDict
	{
	point1		(0       	  0.0005    0.00407);
	point2		(0.00125          0.0005    0.00407);
	point3		(0                0.0014    0.00407);
	}
	interpolate	true;
       }
)
nusivares is offline   Reply With Quote

Old   August 23, 2017, 03:08
Default
  #2
Senior Member
 
akidess's Avatar
 
Anton Kidess
Join Date: May 2009
Location: Germany
Posts: 1,377
Rep Power: 30
akidess will become famous soon enough
Use an STL sampledSurface.
__________________
*On twitter @akidTwit
*Spend as much time formulating your questions as you expect people to spend on their answer.
akidess is offline   Reply With Quote

Old   August 23, 2017, 04:41
Default
  #3
Member
 
1214
Join Date: Sep 2015
Posts: 30
Rep Power: 10
nusivares is on a distinguished road
Hello,

Do you have an example syntax of it?

Cannot find it in .H file or anywhere within the bound of Google.
nusivares is offline   Reply With Quote

Old   August 29, 2017, 06:18
Default
  #4
Member
 
1214
Join Date: Sep 2015
Posts: 30
Rep Power: 10
nusivares is on a distinguished road
Anyone? I cannot find any examples anywhere of a such thing.
nusivares is offline   Reply With Quote

Old   August 30, 2017, 11:25
Default
  #5
Member
 
Yousef
Join Date: Feb 2015
Posts: 40
Rep Power: 11
ykanani is on a distinguished road
Hi,
I believe you can use faceZone sampling. You need to define a faceZone reflecting the surface that you need to sample. To do this, run setSet utility. First define a faceSet. you can type help to see the syntax. Then, create a faceZoneSet based on the faceSet that you just defined. So it will be something like this:

run this command, then you will be able to run the following commands
Code:
setSet
after running setSet:
Code:
faceSet f0 new boxToFace (0 0 0) (0.1 0.1 0)
hint: change boxToFace to something like "apple" and run it, openfoam will show you options that you can use instead of boxToFace to define your surface.

Then, convert the faceSet to faceZoneSet:

Code:
faceZoneSet f0Zone new setToFaceZone f0
and quit:
Code:
quit
Now that you have defined the faceZoneSet, add this to the controlDict file under functions:
Code:
YourDesiredName
    {
          type            surfaceRegion; //for of4.1 //surfaceFieldValue //for of5.x ;
          libs            ("libfieldFunctionObjects.so");
          surfaceFormat   vtk;
          writeControl    adjustableRunTime;
          writeInterval   1e-03;
          writeFields     true;
          log             true;
          regionType faceZone;
          fields          (U p);
          orientedFields  (phi);
          operation       none;
          name    f0Zone;
    }
Note: use surfaceRegion for OpenFOAM 4.x and surfaceFieldValue for OpenFOAM 5.x. I tested this in OpenFOAM 4.1

You can use your preferred output intervals by editing the write method (specified in red). You will find vtk files under postProcessing/YourDesiredName/surface folder
Please take a look at the following files for more information and examples:

OpenFOAM-5.x/etc/caseDicts/postProcessing/flowRate/flowRateFaceZone
OpenFOAM-5.x/etc/caseDicts/postProcessing/flowRate/flowRateFaceZone.cfg
OpenFOAM-5.x/etc/caseDicts/postProcessing/surfaceFieldValue/faceZone.cfg
OpenFOAM-5.x/etc/caseDicts/postProcessing/surfaceFieldValue/surfaceRegion.cfg

You can find the detailed explanation in the header files:
OpenFOAM-5.x/src/functionObjects/field/fieldValues/surfaceFieldValue/surfaceFieldValue.H
OpenFOAM-4.x/src/functionObjects/field/fieldValues/surfaceRegion/surfaceRegion.H

Hint: you can do various operations on the field you sampled as well, check the mentioned header files for details.


Regards,
Yousef
hwangpo, AnnaF and alireza94 like this.

Last edited by ykanani; August 30, 2017 at 14:24.
ykanani is offline   Reply With Quote

Old   July 25, 2018, 08:11
Default
  #6
Member
 
1214
Join Date: Sep 2015
Posts: 30
Rep Power: 10
nusivares is on a distinguished road
Just leaving here two solutions: new OpenFOAM version has the feature called bounded plane. Alternatively, it is possible to do batch processing using paraview. It is a similar way of doing post-processing as with CFD post within Ansys suite. It is called tracing and creates a python script and can be accessed through Tools-> start trace. Here you record your operations within paraFoam. For sampling a limited size plane, this can be:

Code:
#### import the simple module from the paraview
from paraview.simple import *
#### disable automatic camera reset on 'Show'
paraview.simple._DisableFirstRenderCameraReset()

corrug_ALMcOpenFOAM = OpenFOAMReader(FileName='./core_ALM-channel-25.OpenFOAM')
corrug_ALMcOpenFOAM.CaseType = 'Reconstructed Case'
corrug_ALMcOpenFOAM.Createcelltopointfiltereddata = 1

# get active source.
corrug_ALMcOpenFOAM = GetActiveSource()

# Properties modified on corrug_ALMcOpenFOAM
corrug_ALMcOpenFOAM.CellArrays = ['T', 'alphat', 'p', 'p_rgh', 'U']


writeCuttingPlanes1 = True
if writeCuttingPlanes1 == True:
	# create a new 'Clip'
	clip1 = Clip(Input=corrug_ALMcOpenFOAM)
	clip1.ClipType.Origin = [0, 0.01, 0]
	clip1.ClipType.Normal = [0.0, 1.0, 0.0]
	clip1.InsideOut = 1

	names = ['x1/x1.vtm' , 'x2/x2.vtm' ]

	orig = [[0.005 , 0 , 0] , [0.0186 , 0 , 0]] 
        	
	for i in range(len(names)):
		slice1 = Slice(Input=clip1)
		slice1.SliceType = 'Plane'
		slice1.SliceOffsetValues = [0.0]
		slice1.SliceType.Origin = orig[i]
		slice1.SliceType.Normal = [1.0, 0.0, 0.0]
		SaveData('./postProcessing/cutPlanes1/'+names[i], proxy=slice1, Writealltimestepsasfileseries=1)
		print('Layer 1 = ',i )
Note: when you trace - there will be a lot of rendering lines left which could cause trouble - delete them, leave the lines left related to data extraction only.
rob3rt 0ng likes this.
nusivares is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
[General] Reducing the size of slice plane milidon ParaView 4 October 21, 2015 03:44
[OpenFOAM] cutting plane norkistar ParaView 0 November 4, 2012 20:54
Is it possible that make sampling plane not triangulated panda60 OpenFOAM 2 May 26, 2010 23:25
[Gmsh] boundaries with gmshToFoam‏ ouafa OpenFOAM Meshing & Mesh Conversion 7 May 21, 2010 12:43
define cutting plane - parallel running Schag OpenFOAM 5 July 24, 2009 10:26


All times are GMT -4. The time now is 20:18.