Swak4Foam-groovybc- face's vertices
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~ |
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? |
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 ( |
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 ;) |
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? |
Quote:
Code:
variables ( 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 |
All times are GMT -4. The time now is 18:02. |