|
[Sponsors] |
Boundary condition: check all cell values normal to the face of patch |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
March 31, 2021, 06:14 |
Boundary condition: check all cell values normal to the face of patch
|
#1 |
Senior Member
Agustín Villa
Join Date: Apr 2013
Location: Alcorcón
Posts: 314
Rep Power: 15 |
Hi,
for a certain simulation I need to define a fixed value for a patch in function of all the cells which are on the normal direction to the patch. I need to recognize these cells, and compute a value in function of these cells. As the mesh is just a prism, I was thinking to filter in function of a cell coordinate (with the same coordinate value the face has), but I was wondering if there is another "easier way" for this, like considering the patch normal vector, etc. Thanks in advance for your tips and advices! |
|
April 27, 2021, 09:36 |
|
#2 |
New Member
Jérémy Chevalier
Join Date: Feb 2021
Posts: 10
Rep Power: 5 |
Hi,
I would like to have something like that too, have you found the solution? Jérémy |
|
April 30, 2021, 20:01 |
|
#3 |
Senior Member
Agustín Villa
Join Date: Apr 2013
Location: Alcorcón
Posts: 314
Rep Power: 15 |
Hi
Unfortunately I haven't found any other way to compute this. |
|
May 1, 2021, 07:00 |
|
#4 |
New Member
Jérémy Chevalier
Join Date: Feb 2021
Posts: 10
Rep Power: 5 |
Hi, I think I found the good way to do that, maybe we don't wan't to do the same thing but I share it with you. It is very inspired by another topic on this forum but I can't find it anymore sorry
Code:
#include "wallDist.H" #include "wallFvPatch.H" const fvPatchList& patches = mesh.boundary(); volScalarField y = wallDist(mesh).y(); scalar tol = 0.0000001 //Fixe it has you need const surfaceVectorField& Cf = mesh.Cf(); const volVectorField& C = mesh.C(); dynamicList<scalar> listOfCells forAll(patches,patchi) { const fvPatch& currPatch = patches[patchi]; label nFaces = mesh.boundaryMesh()[patchi].size(); if(isType<wallFvPatch>(currPatch)) { for(int facei = 0; facei<nFaces; facei++) { scalar distance; distance = Foam::sqrt(sqr(C[cellI].x()-Cf.boundaryField()[patchi][facei].x()) + sqr(C[cellI].y()-Cf.boundaryField()[patchi][facei].y())+ sqr(C[cellI].z()- Cf.boundaryField()[patchi][facei].z())); scalar yTemp = y[cellI]; scalar diff = mag(distance - yTemp); if( diff <= tol) { listOfCells.append(cellI) //Here you can add cellI on a list, and you have all cells normal to facei in } } } } Note that I use foamExtend 4.1 and some function can be different. Sorry for my bad english Jérémy |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[mesh manipulation] Importing Multiple Meshes | thomasnwalshiii | OpenFOAM Meshing & Mesh Conversion | 18 | December 19, 2015 19:57 |
[Netgen] Import netgen mesh to OpenFOAM | hsieh | OpenFOAM Meshing & Mesh Conversion | 32 | September 13, 2011 06:50 |
[blockMesh] BlockMeshmergePatchPairs | hjasak | OpenFOAM Meshing & Mesh Conversion | 11 | August 15, 2008 08:36 |
[blockMesh] Axisymmetrical mesh | Rasmus Gjesing (Gjesing) | OpenFOAM Meshing & Mesh Conversion | 10 | April 2, 2007 15:00 |
[Commercial meshers] Trimmed cell and embedded refinement mesh conversion issues | michele | OpenFOAM Meshing & Mesh Conversion | 2 | July 15, 2005 05:15 |