|
[Sponsors] |
[swak4Foam] Swak4Foam-groovybc- face's vertices |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
July 30, 2018, 11:22 |
Swak4Foam-groovybc- face's vertices
|
#1 |
New Member
Ignacio Sarmiento
Join Date: Jul 2018
Posts: 8
Rep Power: 8 |
Hi, I don't want to extend too much, my doubt is:
when I use pts(), I got the position of all the vertices of the patch, and if I use pos() I got the cell's position, I need the height of the face or the cell, I was thinking about pow(area(),0.5) o pow(vol(),1/3), but that's not too exact if the mesh is uneven, I would like to approximate it like max(facepts().z)-min(facepts().z), but I don't know how to acced to the position of the face's vertices, is it possible? when I read the incomplete reference I understand it is possible to use pts() in diferent parsers, but I don't understand how to do it, any help? Edit: Solved~ I used hv=(max(toPoint(pos()).z)-min(toPoint(pos()).z)) I don't know why when I tried to use fpos() or face() I got error: Field not found thanks anyway~ Last edited by IgnacioSarmientoINH; July 31, 2018 at 11:53. |
|
August 7, 2018, 10:49 |
|
#2 |
New Member
Ignacio Sarmiento
Join Date: Jul 2018
Posts: 8
Rep Power: 8 |
reedit: not solved
Gschaider, I failed you </3 So.. in my mind when I said toPoint(pos()), swak was going to take pos() -> face's center coordenates and transform it in 4 vectors with the position of the 4 vertices, so I could take the z component and look for the max and min.. but apparently it doesn't work this way... I'm not sure about what exactly toPoint(pos()) expression does in a groovypatch, but the boundary became really caothic, in a coarse mesh it looks like it's generation little waves, but in finer meshs it's a storm so... any ideas for getting face's height? |
|
August 7, 2018, 20:02 |
|
#3 | |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
Quote:
max and min always calculate over the whole patch. Not individual faces to get the "height" of the complete patch something like Code:
toFace(max(pts().z)-min(pts().z)) I once had a similar problem but on the internalMesh (needed maximum and minimum of the faces of a cell) and there is a function plugin LocalCalculations that adds some functions that do something similar to what you want. But unfortunately not for patches Code:
libs ( "libswakLocalCalculationsFunctionPlugin.so" );
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request |
||
August 9, 2018, 16:25 |
|
#4 |
New Member
Ignacio Sarmiento
Join Date: Jul 2018
Posts: 8
Rep Power: 8 |
mmm.. I see
thanks a lot for your answer for now I think I will work with pow(mag(sf()),0.5) and thanks for Swak by the way |
|
August 21, 2018, 17:07 |
|
#5 |
New Member
Ignacio Sarmiento
Join Date: Jul 2018
Posts: 8
Rep Power: 8 |
void faceBoundsZ(scalarField* zSup, scalarField* zInf)
{ const label nF = patch().faceCells().size(); scalarField zMax = Foam::scalarField(nF, -9999.0); scalarField zMin = Foam::scalarField(nF, 9999.0); const faceList& faces = this->patch().patch().localFaces(); const List<vector>& points = this->patch().patch().localPoints(); forAll( faces, faceI ) { const face& f = faces[faceI]; forAll(f, point) { scalar auxiliar = points[f[point]].component(2); zMax[faceI] = max(zMax[faceI], auxiliar); zMin[faceI] = min(zMin[faceI], auxiliar); } } *zSup = zMax; *zInf = zMin; } that's how olaflow gets z max and z min of the face, so I'm programming my own BC, but I have a problem, and I was wondering if you could help me, apparently I can't define several tableFile's by my own, if I try to define two, the solver only remembers the last one, how does it GroovyBC? |
|
August 22, 2018, 06:00 |
|
#6 | |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
Quote:
Code:
variables ( "zMax=toFace(max(pts().z));" "zMin=toFace(min(pts().z));" ); The only non-obious part is toFace which is needed because the maximum of a point-value is a point-value as well. zMax and zMin can then be used in the valueExpression BTW: use references for the function parameters. It is much clearer and safer. C++ code in OpenFOAM almost never needs pointer parameterse
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request |
||
Tags |
bounadry condition, groovy, groovybc, swak, swak4foam |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Decomposing meshes | Tobi | OpenFOAM Pre-Processing | 22 | February 24, 2023 10:23 |
[snappyHexMesh] Add Mesh Layers doesnt work on the whole surface | Kryo | OpenFOAM Meshing & Mesh Conversion | 13 | February 17, 2022 08:34 |
[snappyHexMesh] No layers in a small gap | bobburnquist | OpenFOAM Meshing & Mesh Conversion | 6 | August 26, 2015 10:38 |
DecomposePar unequal number of shared faces | maka | OpenFOAM Pre-Processing | 6 | August 12, 2010 10:01 |
Unaligned accesses on IA64 | andre | OpenFOAM | 5 | June 23, 2008 11:37 |