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

sampledSurface/Plane has no faces

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 26, 2014, 01:14
Default sampledSurface/Plane has no faces
  #1
Member
 
Christian Butcher
Join Date: Jul 2013
Location: Japan
Posts: 85
Rep Power: 12
chrisb2244 is on a distinguished road
I have created a vector containing all the discrete values of x within my simulation, and then a sampledPlane at each value of x, (I want these to be normal to x, but I have also tested with other normals due to this problem)

When I ran my solver (mostly identical to dnsFoam), it all seemed nice and average values for each value of x, of Uy and Uz in my pipe were all 0. However, this seemed a little too good to be true, so I tested for average Ux, expecting everywhere a positive value, and also found 1024{0} (I have 1024 cells in the x direction)

Some further investigation led me to find that my sampledPlanes have no faces/points on them - hence the use of different normals (I figured that way at least some faces would have to be cut?)

I'm sure I'm making a stupid mistake - any help would be appreciated.

Below is the code I'm using, followed by a section of the output.
The code requires a `--std=c++11` flag within the options file for wmake, since emplace_back is a new(ish, now, I suppose) function for std::vector.
Using
Code:
Foam::vector<sampledPlane> xList;
xList.append(blah);
doesn't work, since the sampledPlane/Surface/etc classes all disable the copy assignment operators.

Code:
DynamicList<scalar> discreteX;
forAll(mesh.cellCentres(), cellI)
{
	//~ Info<< "cellI = " << cellI << endl;
	if (discreteX.size() < 2)
	{
		discreteX.append(mesh.cellCentres()[cellI][0]);
		continue;
	}
	if (mesh.cellCentres()[cellI][0] < discreteX[discreteX.size()-2])
	{
		//~ Info << "Break" << endl;
		break;
	}
	discreteX.append(mesh.cellCentres()[cellI][0]);
}

std::vector<sampledPlane> planeListX;
forAll(discreteX, x)
{
	planeListX.emplace_back
	(
		sampledPlane
		(
			"xPlane",
			mesh,
			plane
			(
				point(discreteX[x], 0.001, 0.0001),
				vector(1,0,0)
			)
		)
	);
	Info<< "planeListX[" << x<< "] = ";
        //~ dynamic_cast so as to avoid ambiguous << operator call.
	Info<< dynamic_cast<Foam::sampledSurface&>(planeListX[x]);
	Info<< endl;
}

DynamicList<scalar> UzField;
DynamicList<scalar> UyField;
DynamicList<scalar> UxField;
forAll(planeListX, x)
{
	UzField.append(planeListX[x].average(U.internalField().component(2)));
	UxField.append(planeListX[x].average(U.internalField().component(0)));
	UyField.append(planeListX[x].average(U.internalField().component(1)));
}
Info<< "UzField = " << UzField << endl;
Info<< "UyField = " << UyField << endl;
Info<< "UxField = " << UxField << endl;
with
Code:
UxField.clear();
UzField.clear();
UyField.clear();
forAll(planeListX, x)
{
	UxField.append(planeListX[x].average(U.internalField().component(0)));
	UyField.append(planeListX[x].average(U.internalField().component(1)));
	UzField.append(planeListX[x].average(U.internalField().component(2)));
}
Info<< "UxField = " << UxField << endl;
Info<< "UyField = " << UyField << endl;
Info<< "UzField = " << UzField << endl;
appended to the end of each timestep within the myDnsFoam.C solver file.

Output:
Code:
Reading transportProperties

Reading field p

Reading field U

Reading/calculating face flux field phi

Creating list Avg(U.z)

planeListX[0] = sampledPlane: lowPlane :  base:(0.000549316 0.001 0.0001)  normal:(0.880451 0.440225 0.17609)  triangulate:1  faces:0  points:0
planeListX[1] = sampledPlane: lowPlane :  base:(0.00164795 0.001 0.0001)  normal:(0.880451 0.440225 0.17609)  triangulate:1  faces:0  points:0
planeListX[2] = sampledPlane: lowPlane :  base:(0.00274658 0.001 0.0001)  normal:(0.880451 0.440225 0.17609)  triangulate:1  faces:0  points:0
planeListX[3] = sampledPlane: lowPlane :  base:(0.00384521 0.001 0.0001)  normal:(0.880451 0.440225 0.17609)  triangulate:1  faces:0  points:0
planeListX[4] = sampledPlane: lowPlane :  base:(0.00494385 0.001 0.0001)  normal:(0.880451 0.440225 0.17609)  triangulate:1  faces:0  points:0
planeListX[5] = sampledPlane: lowPlane :  base:(0.00604248 0.001 0.0001)  normal:(0.880451 0.440225 0.17609)  triangulate:1  faces:0  points:0
planeListX[6] = sampledPlane: lowPlane :  base:(0.00714111 0.001 0.0001)  normal:(0.880451 0.440225 0.17609)  triangulate:1  faces:0  points:0
planeListX[7] = sampledPlane: lowPlane :  base:(0.00823975 0.001 0.0001)  normal:(0.880451 0.440225 0.17609)  triangulate:1  faces:0  points:0
...
...
chrisb2244 is offline   Reply With Quote

Reply

Tags
sampledsurface


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
[snappyHexMesh] Add Mesh Layers doesnt work on the whole surface Kryo OpenFOAM Meshing & Mesh Conversion 13 February 17, 2022 07:34
[Other] Mesh Importing Problem cuteapathy ANSYS Meshing & Geometry 2 June 24, 2017 05:29
[snappyHexMesh] No layers in a small gap bobburnquist OpenFOAM Meshing & Mesh Conversion 6 August 26, 2015 09:38
snappyhexmesh remove blockmesh geometry philipp1 OpenFOAM Running, Solving & CFD 2 December 12, 2014 10:58
[snappyHexMesh] external flow with snappyHexMesh chelvistero OpenFOAM Meshing & Mesh Conversion 11 January 15, 2010 19:43


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