|
[Sponsors] |
[swak4Foam] Groovy BC for lookup Table values |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
July 22, 2013, 19:46 |
|
#21 | |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
Quote:
Assuming that inlet.dat has Tinf as a function of x you can write Code:
valueExpression "inlet(pos().x)";
__________________
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 |
||
July 23, 2013, 14:39 |
|
#22 |
New Member
sebastian n
Join Date: Nov 2012
Posts: 17
Rep Power: 14 |
First of all i want to thank gschaider for the prompt reply To specify my problem: In a heat transfer experiment i measured the Temperature in a pipe (Tinf); and via the robin boundary condition (groovyBC) i want to simulate the heat transfer through the pipe wall; i calculated the heat transfer coefficent htot by using the Dittus Boelter approximation; but i dont want to simulate the fluid flow convection heat transfer, just the solid heat transfer with laplacianFoam; But i dont know how to implement the measured Temperature Tinf, which i put into a inlet.dat file, to be read by the groovyBC; The inlet.dat file has got two columns; in the first columns i write the measured time in step of 1 minute; and in column two i write the measured temperature in °Kelvin:
( (0.000000 295.244444) (60.000000 295.747222) (120.000000 295.986111) (180.000000 296.288889) .... ) The way to write it like that is from chtMultiRegionFoam and the boundary condition for table files: type uniformFixedValue; uniformValue tableFile; tableFileCoeffs { fileName "$FOAM_CASE/inlet.dat" outOfBounds warn; }; Now i am asking myself how to deal with groovy boundary condition and the .dat file read by Tinf |
|
July 23, 2013, 15:01 |
|
#23 | |||
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
Quote:
Quote:
Quote:
Code:
valueExpression "inlet(time())"; Code:
valueExpression "inlet";
__________________
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 |
||||
July 24, 2013, 13:41 |
|
#24 |
New Member
sebastian n
Join Date: Nov 2012
Posts: 17
Rep Power: 14 |
I want to thank you for the good advices; my case is running; i have reworked the Boundary condition a little and inserted valueExpression "inlet(time())";
Code:
wall { type groovyBC; variables "htot=1429.44;Tinf=295.36;rho=2650.0;cp=724.0;k=DT*rho*cp;"; valueExpression "inlet(time())"; fractionExpression "1.0/(1.0 + k/(mag(delta())*htot))"; lookuptables ( { name inlet; outOfBounds clamp; fileName "$FOAM_CASE/inlet.dat"; } ); } Code:
solvers { T { solver PCG; preconditioner DIC; tolerance 1e-06; relTol 0; } } --> FOAM Warning : From function groovyBCFvPatchField<Type>::groovyBCFvPatchField(c onst fvPatch& p,const DimensionedField<Type, volMesh>& iF,const dictionary& dict) in file groovyBCFvPatchField.C at line 131 No value defined for T on wall therefore using 11214{0} Reading transportProperties Reading diffusivity DT SIMPLE: no convergence criteria found. Calculations will run for 187200 steps. Calculating temperature distribution |
|
July 24, 2013, 14:18 |
|
#25 | |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
Quote:
Code:
value uniform 295.36;
__________________
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 6, 2013, 13:57 |
Overestimation of the temperature distribution
|
#26 |
New Member
sebastian n
Join Date: Nov 2012
Posts: 17
Rep Power: 14 |
Hello,
the comparison of my Openfoam results to the measured Data show that the Openfoam results are too high; In the experiment water flows through a pipe and the temperature at the inlet is measured (my lookuptable reads out temperature data called inlet.dat). Besides the temperature are measured on the outside of the pipe. I want to compare these temperatures to my openfoam Results. My idea is to use the solver laplacianFoam and the heat transfer from the water to the pipe wall is calculated by the groovyBC; Code:
wall { type groovyBC; variables "htot=1429.44;Tinf=295.36;rho=2650.0;cp=724.0;k=DT*rho*cp;"; valueExpression "inlet(time())"; fractionExpression "1.0/(1.0 + k/(mag(delta())*htot))"; lookuptables ( { name inlet; outOfBounds clamp; fileName "$FOAM_CASE/inlet.dat"; } ); } my inlet.dat data file looks like this: (temperature on the outside is measured every minute) Code:
( (0.000000 295.244444) (60.000000 295.747222) (120.000000 295.986111) (180.000000 296.288889) (240.000000 296.744444) (300.000000 296.866667) (360.000000 297.277778) .... (187080.000000 311.847222) (187140.000000 311.847222) (187200.000000 311.847222) Best regards, gruenertee |
|
August 6, 2013, 15:52 |
|
#27 | |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
Quote:
__________________
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 14, 2013, 15:02 |
|
#28 | |||
New Member
sebastian n
Join Date: Nov 2012
Posts: 17
Rep Power: 14 |
Quote:
Quote:
Quote:
2. Question: Is there any function to read out values (I have a T Field but i want to read out the difference between the T field value at xyz coordinate minus value at x'y'z' divided by c over the whole time range); at the time i am using sampleDict Best Regards |
||||
August 14, 2013, 19:27 |
|
#29 | ||
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
Quote:
The real problem I think is that you already started from the last timestep (187200) so nothing will be done Quote:
Just one value or a whole subset of the geometry?
__________________
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 15, 2013, 17:20 |
|
#30 | |
New Member
sebastian n
Join Date: Nov 2012
Posts: 17
Rep Power: 14 |
Quote:
A whole subset of the geometry would be really helpful 3. question I am working with chtMultiRegionFoam with two regions (Fluid and Solid); is there any possibilty to read out the overall heat transfer coefficient from fluid to solid by using swak4foam; or do you know another (better) way to do this Best Regards |
||
August 16, 2013, 06:30 |
|
#31 | |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
Quote:
Basically mapping from itself using an offset. Sorry. This currently can not be done. You mean "overall heat transfer" (no coefficient)? Whatever. Calculate whatever you want on a "per-face"-basis on one side (either fluid or solid), multiply it with the face areas and sum it up: voila. Overall (=integral). Or calculate it on both sides to be sure that it is consistent
__________________
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 |
||
June 20, 2016, 07:30 |
|
#32 | |
Senior Member
Laurent DASTUGUE
Join Date: May 2014
Location: Chartres, France
Posts: 122
Rep Power: 12 |
Quote:
I want to use groovyBC as an externalWallHeatFluxTemperature condition, with the value of h read from a tabular. Thank you Laurent |
||
June 20, 2016, 09:23 |
|
#33 |
Senior Member
Laurent DASTUGUE
Join Date: May 2014
Location: Chartres, France
Posts: 122
Rep Power: 12 |
I think i am on the right road to my objective.
Doing this for example : Code:
ailetteFace { type groovyBC; variables (//"hBC=50.0;" "Ta=20.0;" "kBC=0.5;"); lookuptables ( { name data; outOfBounds clamp; fileName "$FOAM_CASE/data.data"; } ); valueExpression "Ta"; fractionExpression "1.0/(1.0 + kBC/(mag(delta())*data(kBC)))"; value uniform 293.15; } Code:
( (0 0) (1 0.1) (3 0.1) (4 -0.1) ) Can anyone confirm it is the good way ? (don't be affraid about the numerical values, it is completely crazy, i am just trying to build the boundary condition as i want for the moment. I will fulfill the good values and the good dependencies after.) How can i verify that the value written on the tabular are read correctly ? Thanks. Laurent |
|
June 9, 2017, 05:23 |
|
#34 |
New Member
Sachin
Join Date: Sep 2016
Location: Poitiers,France
Posts: 17
Rep Power: 10 |
Hello,
I also would like to implement robin boundary condition in my electrostatic program. To implement my robin BC in code, I was comparing with heat exchange robin BC. Final robin BC in heat exchange problem is Tface = f*Tinf + (1-f)* Tcentre ; f=(1+(k/alpha*delta)) So my question is how to find fraction value (f) in robin BC? In a my code I am solving governing equation related electrostatics problem. I want to implement following robin BC in my wall. My robin BC is (kp*E*Np)-(D*grad(Np)) Where kp and D is physical properties value(fixed=1), E is surfacescalarfiels(which I am calculate in code), Np is volscalarfield (which I am calculate in my code) In a my code 1st I calculate (volvectorField) Efiled and then also convert the Efield in (surfacescalarfield) named "E". Then I calculate governing equation for Np. which is (volscalarfield). So my question is how to implement (kp*E*Np)-(D*grad(Np)) BC in time directories. I tried through groovy BC, but not succeeded. Following way I implement robin BC in groovy type groovyBC; variables " N_P=N_P*mag(Sf()); E=E*mag(Sf());K_P=1;D=0.0001; " valueExpression "(K_P*E*N_N)-(D*snGrad(N_P))"; // gradientExpression "0"; value uniform 0; fractionExpression "0"; // 0 for neumann and 1 for dirichlet But dont understand how to calculate fractionExpression for my robin BC. Thanks Last edited by smodh; June 15, 2017 at 04:05. |
|
June 15, 2017, 11:59 |
|
#35 |
Super Moderator
Tobias Holzmann
Join Date: Oct 2010
Location: Bad Wörishofen
Posts: 2,711
Blog Entries: 6
Rep Power: 52 |
Hi,
I think I got the point but your formating is a bit poor. However, to implement a Robin BC in FOAM you can use groovy or the codedMixedBC. Groovy provides you a lot of things and easy handling and access to fields that are available in the OpenFOAM database. Right now I always code it in codedMixed but groovy is the easier choice. Your question is related on - how to get/calc the valueFraction - right? So just do that by defining a new variable and use this in the valueFraction expression. An example (I am not sure about the correct syntax now but you will figure it out yourself or with the groovyBC tutorials): Code:
variables "Tinf=243; valFrac=log(T+13)*exp(U)-14;"; valueExpression "Tinf"; gradientExpression "0"; fractionExpression "valFrac"; value uniform 0; Code:
fractionExpression "log(T+13)*exp(U)-14"; But that's how it works. In the case that I made some mistakes, I hope that Bernhard will clearify everything. Its a while ago that I used Groovy. Good luck. By the way, if you just read the post above yours, you should get the feeling about how you have to do it.
__________________
Keep foaming, Tobias Holzmann |
|
June 15, 2017, 13:17 |
|
#36 |
New Member
Sachin
Join Date: Sep 2016
Location: Poitiers,France
Posts: 17
Rep Power: 10 |
Hello Tobi,
Thanks for your reply. I think, I did not explain properly my problem. I want to implement robin BC in my wall. My robin BC is (kp*E*Np)-(D*grad(Np))=0 Where kp and D is physical properties value(fixed=1). In a my solver code 1st, I calculate (volvectorField) Efield and convert the Efield in surfacescalarfield named "E". Np is volscalarfield (which I am calculate in my solver code) So my question is how to implement (kp*E*Np)-(D*grad(Np)) BC in time directories for Np. I tried through groovy BC, but not succeeded. In a codedMixed BC, I don't under stand how I can call the value which I am calculate in a solver. I hope you understand my problem. Thanks again. Sachin. |
|
July 6, 2017, 13:13 |
|
#37 |
New Member
Diego Ferrando
Join Date: Mar 2017
Location: Zaragoza
Posts: 19
Rep Power: 9 |
Hi Foamers,
I’m trying to set a velocity profile with groovyBC using lookuptables. When I try to set a vector (U, V, W) in valueColumns, OF brings me an error saying that he expected a scalar. The Boundary Condition looks like this: Code:
inlet { type groovyBC; lookuptables ( { name profile1; fileName "$FOAM_CASE/0/U1.csv"; outOfBounds clamp; readerType csv; hasHeaderLine 2; timeColumn 0; valueColumns 3 (1 2 3); separator " "; } ); valueExpression "profile(pos().z)"; } Code:
--> FOAM FATAL ERROR: 3(1 2 3) does not have the expected length 1 From function Foam::csvTableReader<Type>::csvTableReader(const Foam::dictionary&) [with Type = double] in file interpolations/interpolationTable/tableReaders/csv/csvTableReader.C at line 43. FOAM exiting Thank you. Diego |
|
July 7, 2017, 08:13 |
|
#38 | ||
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
Quote:
Quote:
__________________
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 |
|||
July 7, 2017, 11:05 |
|
#39 | |
New Member
Diego Ferrando
Join Date: Mar 2017
Location: Zaragoza
Posts: 19
Rep Power: 9 |
Quote:
Code:
--> FOAM FATAL IO ERROR: attempt to read beyond EOF file: /home/diego/OpenFOAM/diego-4.1/run/windAroundBuildings/0/U.boundaryField.inlet.lookuptables.valueColumns at line 74. From function virtual Foam::Istream& Foam::ITstream::read(Foam::token&) in file db/IOstreams/Tstreams/ITstream.C at line 82. FOAM exiting Code:
inlet { type groovyBC; lookuptables ( { name profileX; fileName "$FOAM_CASE/0/U1.csv"; outOfBounds clamp; readerType csv; hasHeaderLine 2; timeColumn 0; valueColumns 1; separator " "; } ); lookuptables ( { name profileY; fileName "$FOAM_CASE/0/U1.csv"; outOfBounds clamp; readerType csv; hasHeaderLine 2; timeColumn 0; valueColumns 2; separator " "; } ); lookuptables ( { name profileZ; fileName "$FOAM_CASE/0/U1.csv"; outOfBounds clamp; readerType csv; hasHeaderLine 2; timeColumn 0; valueColumns 3; separator " "; } ); valueExpression "vector(profileX(pos().z), profileY(pos().z), profileZ(pos().z))"; } Diego. |
||
July 7, 2017, 11:12 |
|
#40 | |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
Quote:
__________________
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 |
||
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Values for nu t and nu tilda | Phizz82 | OpenFOAM Running, Solving & CFD | 1 | March 2, 2020 07:00 |
What is the table values for amplitude in uniformFixedvalue bc? | sinhavivekananda318 | OpenFOAM Running, Solving & CFD | 0 | May 5, 2017 03:11 |
Field Function for interpolating a table to regulate a mass-flow | Eike | STAR-CCM+ | 0 | August 7, 2012 04:59 |
strange node values @ solid/fluid interface - help | JB | FLUENT | 2 | November 1, 2008 13:04 |
Generating table values in a loop | Jarrod Sinclair | Siemens | 1 | November 26, 2003 20:26 |