|
[Sponsors] |
May 18, 2012, 18:23 |
How to sample a patch with swak?
|
#1 |
New Member
Pekka Röyttä
Join Date: Nov 2010
Location: Singapore
Posts: 7
Rep Power: 16 |
Hi all,
I would like to replicate the behaviour of a heat flux sensor on surface. I think a nice way to do this is to sample running average over a subset of my wall patch. I need the time trace of this running average to calculate the spectrum. For internal mesh this was easy enough, but patches seem more difficult. First, this succeeds in calculating Nusselt number (in controlDict): Code:
functions { NusseltNumber { type swakExpression; valueType patch; patchName Wall; verbose true; variables ( "T0=293;" "lc2D=0.025;" ); expression "lc2D*snGrad(T)/(T-T0)"; accumulations ( max min average ); } } Code:
nuSensor { type dumpSwakExpression; verbose true; valueType cellSet; setName sensor0c; expression "NusseltNumber"; } Since I am writing here, it's not that easy. I can dump the whole patch, but since I need around 2*150k timesteps, it is a bit too much data. The cellSet method fails because NusseltNumber apparently belongs to patch, it's not found in cellSet. I also tried faceSet on surface, but with no improvement. Could someone please point me to right direction? Also non-swak solutions are welcome. br, Pekka |
|
May 21, 2012, 18:44 |
|
#2 | |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
Quote:
The problem with the faceSet approach was what? Maybe that the snGrad is not supported on faceSets? |
||
May 22, 2012, 06:46 |
|
#3 | |
New Member
Pekka Röyttä
Join Date: Nov 2010
Location: Singapore
Posts: 7
Rep Power: 16 |
Quote:
I noticed that it's possible to cheat a bit and calculate the Nusselt number in wall adjacent cells if I know the geometry exactly. I'll post that solution when I get to my computer. But it will only work for relatively simple geometries. br, Pekka |
||
May 22, 2012, 09:57 |
|
#4 | |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
Quote:
The problem here is that I'm not aware of a functionObject described in point 2. Neither in OF nor in swak. But I could persuade the developer of swak to write such a FO (I'm on rather good terms with him ) provided you promise to write a small description of the usage on the swak-page on the Wiki afterwards |
||
May 23, 2012, 16:25 |
|
#5 | |
New Member
Pekka Röyttä
Join Date: Nov 2010
Location: Singapore
Posts: 7
Rep Power: 16 |
Quote:
I promised the cheat around the problem, so here it goes. I simplified a bit so that avid readers are not totally lost. This works still. My case is a circular cylinder in a cross flow, origin is at cylinder center. Further this approach works for constant wall temperature, but constant heat flux would be as easy. This is in controlDict and under functions: Code:
sensorDumb { type dumpSwakExpression; valueType cellSet; setName sensor0c; variables ( "rCyl=0.0125;" "T0=293;" "lc2D=0.025;" "Tw=343;" ); expression "(Tw-T)/(Tw-T0)/(sqrt(pos().y*pos().y+pos().x*pos().x) - rCyl)*lc2D "; } |
||
May 24, 2012, 10:35 |
|
#6 |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
OK. Changed version hit the server (see Wiki-page on how to get the development-version). The new functionObject is both in default branch (1.x) as well as in the 2.x-branch. For "documentation" have a look at the bottom of the README. Example of usage is in Examples/other/angledDuctImplicit (controlDict and 0/heatFlux). The example is a bit unfortunate as due to the boundary-conditions (gradT=0) the heatFlux is zero. But that is calculated correctly (I tried other values too but didn't verify them)
|
|
May 31, 2012, 07:58 |
|
#7 |
Member
Ganesh Vijayakumar
Join Date: Jan 2010
Posts: 44
Rep Power: 16 |
I do not understand what exactly is the functionObject that hit the development version. Although I understand that pulling that file is the correct thing to do since I already have the development version on the git, I'm still not comfortable messing with my openfoam installation lest I break it. So is there any way I can check it out online?
This post seems to be the closest to what I want.. i.e probes/faceSets on a patch. See post here. http://www.cfd-online.com/Forums/ope...tml#post364016 @Bernhard: Is there any way I can use swak to create faceSets on a patch based on pos()? |
|
May 31, 2012, 14:54 |
|
#8 | ||
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
Quote:
Quote:
|
|||
May 31, 2012, 14:55 |
|
#9 |
New Member
Pekka Röyttä
Join Date: Nov 2010
Location: Singapore
Posts: 7
Rep Power: 16 |
EDIT:
I was too slow, ignore this. Wiki coming up. |
|
May 31, 2012, 15:34 |
|
#10 | |
Member
Ganesh Vijayakumar
Join Date: Jan 2010
Posts: 44
Rep Power: 16 |
Quote:
|
||
June 4, 2012, 13:01 |
|
#11 |
Member
Ganesh Vijayakumar
Join Date: Jan 2010
Posts: 44
Rep Power: 16 |
That is awesome. But I can't seem to figure it out. Any examples of using it? And topoSet doesn't seem to know where swakTopoSources are and hence says that "expressionToFace" is not a valid topoSource. Could you help Bernhard? I have OpenFOAM 2.1.x installed and the swak4Foam installed from the svn repo.
ganesh |
|
June 4, 2012, 16:17 |
|
#12 | |
Member
Ganesh Vijayakumar
Join Date: Jan 2010
Posts: 44
Rep Power: 16 |
Never mind the previous question. I never thought that a library included in the controlDict would have an effect on topoSet. Once I included it, it was able to run. However it doesn't seem to understand fpos.
Quote:
|
||
June 4, 2012, 16:59 |
|
#13 | |
Member
Ganesh Vijayakumar
Join Date: Jan 2010
Posts: 44
Rep Power: 16 |
Quote:
I understand from the README for swak that "expressionToFace" works only on internal faces. Is this true or my misunderstanding? I tried the following in setSet faceSet jump1 new expressionToFace "fset(blade)" It just seg faults. I do have a face set called blade. |
||
June 4, 2012, 18:46 |
|
#14 | |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
Quote:
Will have a look at how to fix it ASAIFT (Hint: this process is usually sped up by a bug report with a small test-case) PS: ASAIFT stands for "As Soon As I Find Time" - a yet unknown abbreviation with a big future Last edited by gschaider; June 5, 2012 at 05:56. Reason: Corrected Freudian slip |
||
June 4, 2012, 22:07 |
|
#15 | ||
Member
Ganesh Vijayakumar
Join Date: Jan 2010
Posts: 44
Rep Power: 16 |
Quote:
ASAIFT! No probs Bernard. I wrote my own utility. Hopefully this will serve as an example to others to create their own faceSets. The essence of it is this Quote:
|
|||
June 6, 2012, 05:55 |
|
#16 |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
Had a case of WTFITTT (What the f###, I'll take the time). A version that fixes the crash with faceSet on patches and adds two functions onPatch and internalFace (guess what they do) is in the development version (the mercurial repository). See the README for details
|
|
November 7, 2015, 21:48 |
|
#17 | |
Senior Member
Himanshu Sharma
Join Date: Jul 2012
Posts: 101
Rep Power: 14 |
Quote:
I am trying to calculated snGradT on the faceset made using the following toposet on the Top wall of my geometry Code:
actions ( { name Dummycell; type cellSet; action new; source boxToCell; sourceInfo { box (0.1 2.8 0.0)(8.8 3.1 0.3); } } { name Dummyface; type faceSet; action new; source cellToFace; sourceInfo { set Dummycell; option all; } } { name Dummyface; type faceSet; action subset; source patchToFace; sourceInfo { name "wall.ceiling"; } } |-------|----------------------|------- | | |_ | | (Faces of Interest) | |_ | But when I am using the faceset "Dummyface" in the swak4Foam function in controlDict Code:
Nu_ceiling_test { type swakExpression; valueType faceSet; setName Dummyface; verbose true; variables ( "Tsat=283.61;" "lc2D=0.1452;" ); expression "lc2D*snGrad(T)/(T-Tsat)"; accumulations ( max min average ); outputControl timeStep; outputInterval 100; } Code:
--> FOAM FATAL ERROR: Parser Error for driver FaceSetValueExpressionDriver at "1.6-11" :"field snGrad not existing or of wrong type" "lc2D*snGrad(T)/(T-Tsat)" ^^^^^^ -------| Context of the error: - From dictionary: .Nu_ceiling_test Evaluating expression "lc2D*snGrad(T)/(T-Tsat)" From function parsingValue in file lnInclude/CommonValueExpressionDriverI.H at line 1189. FOAM exiting I will be thankful if you can provide some advice on it and how it can be done using Swak. The main objective is to calculate "Nusselt Number on the Selected Faces of Interest on the patch" Thank you Regards |
||
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
y+ and u+ values with low-Re RANS turbulence models: utility + testcase | florian_krause | OpenFOAM | 114 | August 23, 2023 06:37 |
Near wall treatment in k-omega SST | Arnoldinho | OpenFOAM Running, Solving & CFD | 38 | March 8, 2017 14:48 |
[mesh manipulation] Importing Multiple Meshes | thomasnwalshiii | OpenFOAM Meshing & Mesh Conversion | 18 | December 19, 2015 19:57 |
[Gmsh] Import gmsh msh to Foam | adorean | OpenFOAM Meshing & Mesh Conversion | 24 | April 27, 2005 09:19 |
Multicomponent fluid | Andrea | CFX | 2 | October 11, 2004 06:12 |