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

surfaceFieldValue setup with sampleSurface

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 14, 2022, 09:11
Default surfaceFieldValue setup with sampleSurface
  #1
Member
 
Ben Simpson
Join Date: Dec 2019
Location: UK
Posts: 32
Rep Power: 6
b.simpson is on a distinguished road
Hi,

I am modelling a simple naturally ventilated building where I need to calculate the total CO2 leaving and entering the building through the windows.

I am trying to achieve this by using the surfaceFieldValue function object but I am struggling to get it to select/sample the correct cells. Currently I am using the code below in my controlDict. Does anyone know if you can use the plan type in the sampleSurfaceDict in a way that it doesn't span across the entire model? As I have areas outside of the building which I do not want to include in this.

Code:
westValuesSum
    {
        type            surfaceFieldValue;
        libs            ("libfieldFunctionObjects.so");
        log				true;
        writeControl    writeTime;
        writeFields		true;
			
        surfaceFormat   none;
        regionType		sampledSurface;
        name			sum;
        sampledSurfaceDict
        {
            type	plane;
            planeType	pointAndNormal;
            basePoint	(0.05 0 0);
            normalVector	(1 0 0);
        }
			
        operation		sum;

        fields
        (
            CO2
        );
    }
I am using openFOAM v8 with the buoyantSimpleFoam and Spalart-Allmaras turbulence model.

I have also tried using the other two methods (faceSet and patch) for selecting the cells but have been unable to get these to work to a satisfactory level.

Thanks in advance for any help on this issue.

Regards,
Ben
Attached Images
File Type: png buildingLayout.PNG (29.3 KB, 18 views)
b.simpson is offline   Reply With Quote

Old   December 27, 2022, 10:11
Default
  #2
Member
 
Join Date: Jun 2020
Posts: 49
Rep Power: 6
Swirl is on a distinguished road
Hi Ben,

in case your problem still exists, I think you could go a different route than using sampledSurface. Instead, you could define facezones for each window. To do that, you first create a faceSet for the windows with the topoSet command. In the topoSetDict you can specify boxes to define the desired area. In your case, those boxes should probably be very thin in the direction going inside/outside the building.

The topoSetDict options to do thisare explained further here:
https://www.openfoam.com/documentati...boxToFace.html

In the second step you have to covert the faceSet to a faceZone, also using the topoSetDict as described here:
https://www.openfoam.com/documentati...oFaceZone.html

This should create a usable source for your surfaceFieldValue utility.

Hope this helps a little.
Swirl is offline   Reply With Quote

Old   January 9, 2023, 11:50
Default Thanks
  #3
Member
 
Ben Simpson
Join Date: Dec 2019
Location: UK
Posts: 32
Rep Power: 6
b.simpson is on a distinguished road
Thank you for your reply.

I agree that the faceSet/faceZone is the way to go for what I am trying to achieve.

In case anyone is interested I got it to work on my model by creating a cellSet from an stl file that I generated in blender. I then created a faceSet and faceZone from this. I was then able to use the faceZone for the surfaceFieldValue.

Below is the setup I used.

topoSetDict:
Code:
{
        name    southCell;
        type    cellSet;
        action  new;
		source surfaceToCell;
		sourceInfo
		{
			file            "$FOAM_CASE/constant/triSurface/sWin.stl";
			useSurfaceOrientation false;  
			outsidePoints   ((1 1 1));    // definition of outside
			includeCut      true;              // cells cut by surface
			includeInside   false;              // cells not on outside of surf
			includeOutside  false;              // cells on outside of surf
			nearDistance    -1;                 // cells with centre near surf
												// (set to -1 if not used)
			curvature       -100;                // cells within nearDistance
												// and near surf curvature
												// (set to -100 if not used)
		}
}
{
        name    southFace;
        type    faceSet;
        action  new;
        source  cellToFace;
		sourceInfo
		{
			set     southCell;
			option	all;
		}
}
{
        name    southZone;
        type    faceZoneSet;
        action  new;
        source  setToFaceZone;
		sourceInfo
		{
			faceSet	southFace;
		}
}
controlDict:
Code:
surfaceInterpolate_CO2
		{
			 type        surfaceInterpolate;
			 libs        ("libfieldFunctionObjects.so");
			 fields      
			 (
				 (CO2 CO2Interp)
			 ); 
			 executeControl  writeTime;
			 writeControl    writeTime;   
		}

southSumPos
		{
			type            surfaceFieldValue;
			libs            ("libfieldFunctionObjects.so");
			log				true;
			executeControl  writeTime;
			writeControl    writeTime;
			writeFields		true;
			
			surfaceFormat   none;
			regionType		faceZone;
			name			southZone;
			
			operation		sumDirection;
			direction		(0 1 0);

			fields
			(
				CO2Interp
			);
		}
Hope this is helpful for anyone using the surfaceFieldValue function objects.

Regards,
Ben
b.simpson is offline   Reply With Quote

Reply

Tags
openfoam 8, sampledsurface, surfacefieldvalue


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
Setup for buoyantBoussinesqPimpleFoam with openings SadBoySquad OpenFOAM 5 August 25, 2022 11:31
setup problem SANORANJAM FLUENT 3 May 6, 2020 11:21
2D Glass Melt Simulation Setup marmz FLUENT 5 October 9, 2016 16:25
[ICEM] surface/curve mesh setup Studi ANSYS Meshing & Geometry 15 November 12, 2014 01:32
[ICEM] Hexa mesh, curve mesh setup, bunching law Anorky ANSYS Meshing & Geometry 4 November 12, 2014 01:27


All times are GMT -4. The time now is 17:04.