CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (http://www.cfd-online.com/Forums/openfoam-solving/)
-   -   Vector operations on Cell Zones (http://www.cfd-online.com/Forums/openfoam-solving/93952-vector-operations-cell-zones.html)

 ganeshv October 31, 2011 19:35

Vector operations on Cell Zones

Can I get standard vector operations done on certain cell zones alone.. For e.g fvm::laplacian(U) or fvc::grad(U)?

 deepsterblue October 31, 2011 23:33

Take a look at fvMeshSubset. This allows you to define an fvMesh on a set of cells (where exposed internal faces are added to a "default" patch).

Once you have this defined, you can define GeometricFields (like volVectorFields such as velocity - U) using this mesh subset, and subsequently, vector calculus operators as well.

Boundary conditions, etc will all be handled automatically.

 ganeshv November 1, 2011 01:11

Example?

hi Sandeep,

Could you point me to an example where fvMeshSubset is used inside a code? That would be extremely helpful.

 deepsterblue November 1, 2011 08:41

I can't seem to find any examples, but you can accumulate a set of cells in a labelHashSet, and use the fvMeshSubset::setCellSubset member function to construct your mesh. From then on, field creation, etc is the same as fvMesh, but you would substitute the fvMeshSubset::subMesh() member function instead of a regular mesh.

 Fabian_W February 19, 2013 12:39

Urgent help on fvMeshSubset

I need to do the same and came to the same idea. My problem is, that setCellSubset fails.

Here my example code:

labelHashSet sub;

for(int i = 0; i < mesh.C().internalField().size(); i++)
{
const vector& v = mesh.C().internalField()[i];
if(v.x() > 8.75-1e-5 && v.x() < 13.75+1e-5 && v.y() > 1.25-1e-5 && v.y() < 6.25+1e-5 && v.z() > 0.5595-1e-5 && v.z() < 1.5605+1e-5)
{
sub.insert(i);
}
}

fvMeshSubset sm(mesh);
sm.setCellSubset(sub);

I have the following problem:

Number of cells in new mesh: 18
Number of faces in new mesh: 75
Number of points in new mesh: 48

--> FOAM FATAL ERROR:
Cannot find face 281 in any of the patches
3
(
sideWalls
topWalls
inlet
)

It seems your patches are not consistent with the mesh : internalFaces:278 total number of faces:442

From function label polyBoundaryMesh::whichPatch(const label faceIndex) const
in file meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.C at line 541.

FOAM aborting

#0 Foam::error::printStack(Foam::Ostream&) in "/opt/OpenFOAM-2.1.1/platforms/linux64GccDPOpt/lib/libOpenFOAM.so"
#1 Foam::error::abort() in "/opt/OpenFOAM-2.1.1/platforms/linux64GccDPOpt/lib/libOpenFOAM.so"
#2 Foam::polyBoundaryMesh::whichPatch(int) const in "/opt/OpenFOAM-2.1.1/platforms/linux64GccDPOpt/lib/libOpenFOAM.so"
#3 Foam::fvMeshSubset::setCellSubset(Foam::HashSet<in t, Foam::Hash<int> > const&, int) in "/opt/OpenFOAM-2.1.1/platforms/linux64GccDPOpt/lib/libfiniteVolume.so"
#4

Any help is very much appreciated!!

Thanks,

Fabian

 Fabian_W February 21, 2013 09:24

Solved

my problem was, that external faces where not assigned to a label and the internal mesh intersects these external faces.

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