|
[Sponsors] |
August 18, 2017, 10:45 |
Sampling a limited size cutting plane
|
#1 |
Member
1214
Join Date: Sep 2015
Posts: 30
Rep Power: 11 |
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; } ) |
|
August 23, 2017, 05:41 |
|
#3 |
Member
1214
Join Date: Sep 2015
Posts: 30
Rep Power: 11 |
Hello,
Do you have an example syntax of it? Cannot find it in .H file or anywhere within the bound of Google. |
|
August 29, 2017, 07:18 |
|
#4 |
Member
1214
Join Date: Sep 2015
Posts: 30
Rep Power: 11 |
Anyone? I cannot find any examples anywhere of a such thing.
|
|
August 30, 2017, 12:25 |
|
#5 |
Member
Yousef
Join Date: Feb 2015
Posts: 40
Rep Power: 11 |
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 Code:
faceSet f0 new boxToFace (0 0 0) (0.1 0.1 0) Then, convert the faceSet to faceZoneSet: Code:
faceZoneSet f0Zone new setToFaceZone f0 Code:
quit 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; } 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 Last edited by ykanani; August 30, 2017 at 15:24. |
|
July 25, 2018, 09:11 |
|
#6 |
Member
1214
Join Date: Sep 2015
Posts: 30
Rep Power: 11 |
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 ) |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[General] Reducing the size of slice plane | milidon | ParaView | 4 | October 21, 2015 04:44 |
[OpenFOAM] cutting plane | norkistar | ParaView | 0 | November 4, 2012 21:54 |
Is it possible that make sampling plane not triangulated | panda60 | OpenFOAM | 2 | May 27, 2010 00:25 |
[Gmsh] boundaries with gmshToFoam | ouafa | OpenFOAM Meshing & Mesh Conversion | 7 | May 21, 2010 13:43 |
define cutting plane - parallel running | Schag | OpenFOAM | 5 | July 24, 2009 11:26 |