CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Community Contributions

[swak4Foam] Swak4Foam-groovybc- face's vertices

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By IgnacioSarmientoINH

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 30, 2018, 11:22
Default Swak4Foam-groovybc- face's vertices
  #1
New Member
 
Ignacio Sarmiento
Join Date: Jul 2018
Posts: 8
Rep Power: 8
IgnacioSarmientoINH is on a distinguished road
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~
gschaider likes this.

Last edited by IgnacioSarmientoINH; July 31, 2018 at 11:53.
IgnacioSarmientoINH is offline   Reply With Quote

Old   August 7, 2018, 10:49
Default
  #2
New Member
 
Ignacio Sarmiento
Join Date: Jul 2018
Posts: 8
Rep Power: 8
IgnacioSarmientoINH is on a distinguished road
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?
IgnacioSarmientoINH is offline   Reply With Quote

Old   August 7, 2018, 20:02
Default
  #3
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by IgnacioSarmientoINH View Post
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?

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))
would work. But for every face separately there is no way to do this in swak



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"

);
would add that. But it would have to be extended for patches
__________________
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
gschaider is offline   Reply With Quote

Old   August 9, 2018, 16:25
Default
  #4
New Member
 
Ignacio Sarmiento
Join Date: Jul 2018
Posts: 8
Rep Power: 8
IgnacioSarmientoINH is on a distinguished road
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
IgnacioSarmientoINH is offline   Reply With Quote

Old   August 21, 2018, 17:07
Default
  #5
New Member
 
Ignacio Sarmiento
Join Date: Jul 2018
Posts: 8
Rep Power: 8
IgnacioSarmientoINH is on a distinguished road
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?
IgnacioSarmientoINH is offline   Reply With Quote

Old   August 22, 2018, 06:00
Default
  #6
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by IgnacioSarmientoINH View Post
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?

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
gschaider is offline   Reply With Quote

Reply

Tags
bounadry condition, groovy, groovybc, swak, swak4foam


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
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


All times are GMT -4. The time now is 16:23.