CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM Pre-Processing

Groovy BC for lookup Table values

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   July 22, 2013, 18:46
Default
  #21
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,926
Rep Power: 41
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by gruenertee View Post
Hi foamers,

first of all i want to thank everybody who keeps runing this forum; i want to implement a Robin Boundary condition via the groovy Boundary condition, but Tinf should be read out of a .dat file (lookuptable)
(Openfoam2.2.0)

wall
{
type groovyBC;
variables "k=0.8;alpha=15;Tinf=65;f=1/(1+k(alpha*mag(delta())));";
valueExpression "Tinf";
gradientExpression "0";
fractionExpression "f";
value uniform 0;
}

I am asking myself how to tell "Tinf" to read the inlet.dat file How to combine the type groovyBC with the lookuptables for Tinf?

lookuptables (
{
name inlet;
outOfBounds clamp;
fileName "$FOAM_CASE/inlet.dat";
}

Thank you
You're not very specific about the lookup-table (from which variable are you looking up)

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

Old   July 23, 2013, 13:39
Default
  #22
New Member
 
sebastian n
Join Date: Nov 2012
Posts: 17
Rep Power: 5
gruenertee is on a distinguished road
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
gruenertee is offline   Reply With Quote

Old   July 23, 2013, 14:01
Default
  #23
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,926
Rep Power: 41
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by gruenertee View Post
Hi foamers,

first of all i want to thank everybody who keeps runing this forum; i want to implement a Robin Boundary condition via the groovy Boundary condition, but Tinf should be read out of a .dat file (lookuptable)
(Openfoam2.2.0)

wall
{
type groovyBC;
variables "k=0.8;alpha=15;Tinf=65;f=1/(1+k(alpha*mag(delta())));";
valueExpression "Tinf";
gradientExpression "0";
fractionExpression "f";
value uniform 0;
}

I am asking myself how to tell "Tinf" to read the inlet.dat file How to combine the type groovyBC with the lookuptables for Tinf?

lookuptables (
{
name inlet;
outOfBounds clamp;
fileName "$FOAM_CASE/inlet.dat";
}

Thank you
That seems like a good start

Quote:
Originally Posted by gruenertee View Post
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
With this information you've just to modify the expression in your first posting slightly from this

Quote:
Originally Posted by gschaider View Post
You're not very specific about the lookup-table (from which variable are you looking up)

Assuming that inlet.dat has Tinf as a function of x you can write

Code:
valueExpression "inlet(pos().x)";
to this

Code:
valueExpression "inlet(time())";
As an alternative you can specify your data file as a timeline (just replace lookuptables with timelines) and you'll just have to write

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

Old   July 24, 2013, 12:41
Default
  #24
New Member
 
sebastian n
Join Date: Nov 2012
Posts: 17
Rep Power: 5
gruenertee is on a distinguished road
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";
        }
    );
}
But i am getting a warning and in particular "No value defined for T on wall therefore using 11214{0}" and "SIMPLE: no convergence criteria found." making me wonder. What does it mean? In /system/fvSolution i have a convergence criteria for field T tolerance;

Code:
solvers
{
    T
    {
        solver          PCG;
        preconditioner  DIC;
        tolerance       1e-06;
        relTol          0;
    }
}
My Warning:

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

Old   July 24, 2013, 13:18
Default
  #25
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,926
Rep Power: 41
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by gruenertee View Post
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";
        }
    );
}
But i am getting a warning and in particular "No value defined for T on wall therefore using 11214{0}" and "SIMPLE: no convergence criteria found." making me wonder. What does it mean? In /system/fvSolution i have a convergence criteria for field T tolerance;
Add
Code:
value uniform 295.36;
to the boundary condition. For technical reason groovyBC can't evaluate during startup and needs a value to start up
__________________
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 6, 2013, 12:57
Default Overestimation of the temperature distribution
  #26
New Member
 
sebastian n
Join Date: Nov 2012
Posts: 17
Rep Power: 5
gruenertee is on a distinguished road
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"; 
      }   
                   );
    }
but the Openfoam simulation overestimate the Temperature at the pipe outside... I am unsure if the groovyBC reads the Data from the inlet.dat in a correct way; how can i check it?

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)
Or do i use the groovybc in a wrong way?

Best regards,
gruenertee
gruenertee is offline   Reply With Quote

Old   August 6, 2013, 14:52
Default
  #27
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,926
Rep Power: 41
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by gruenertee View Post
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"; 
      }   
                   );
    }
but the Openfoam simulation overestimate the Temperature at the pipe outside... I am unsure if the groovyBC reads the Data from the inlet.dat in a correct way; how can i check it?

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)
Or do i use the groovybc in a wrong way?
Seems alright to me. To convince yourself that it works correctly set the fractionExpression to "1". Then run replayTransientBC (comes with swak4Foam) on the case. This utility loads specified fields and then timesteps and "only" updates the boundary conditions and writes them. Check the actual values (either with paraview or by looking at the files)
__________________
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 14, 2013, 14:02
Default
  #28
New Member
 
sebastian n
Join Date: Nov 2012
Posts: 17
Rep Power: 5
gruenertee is on a distinguished road
Quote:
Originally Posted by gschaider View Post
Seems alright to me. To convince yourself that it works correctly set the fractionExpression to "1". Then run replayTransientBC (comes with swak4Foam) on the case. This utility loads specified fields and then timesteps and "only" updates the boundary conditions and writes them. Check the actual values (either with paraview or by looking at the files)
First of all i want to thank you for your quick reply I tried to use "replayTransientBC"; i wrote the replayTransientBCDict for my T field:
Quote:

fields (
T
);
But i am getting the following mistake/warning:

Quote:
Create time

Create mesh for time = 187200

Reading field T of type volScalarField
--> FOAM Warning :
From function replayTransientBC
in file replayTransientBC.C at line 184
No list 'preloadFields' defined. Boundary conditions that depend on other fields will fail
End
What did i do wrong

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

Old   August 14, 2013, 18:27
Default
  #29
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,926
Rep Power: 41
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by gruenertee View Post
First of all i want to thank you for your quick reply I tried to use "replayTransientBC"; i wrote the replayTransientBCDict for my T field:
But i am getting the following mistake/warning:

What did i do wrong
This is only a warning. Its main purpose is to provide additional information in case something later goes really wrong. Which in your case it doesn't.

The real problem I think is that you already started from the last timestep (187200) so nothing will be done

Quote:
Originally Posted by gruenertee View Post
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

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

Old   August 15, 2013, 16:20
Default
  #30
New Member
 
sebastian n
Join Date: Nov 2012
Posts: 17
Rep Power: 5
gruenertee is on a distinguished road
Quote:
Originally Posted by gschaider View Post

The real problem I think is that you already started from the last timestep (187200) so nothing will be done
Ah i get the point, but why does it start from the last timestep?

Quote:
Originally Posted by gschaider View Post
Just one value or a whole subset of the geometry?
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
gruenertee is offline   Reply With Quote

Old   August 16, 2013, 05:30
Default
  #31
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,926
Rep Power: 41
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by gruenertee View Post
Ah i get the point, but why does it start from the last timestep?
Look in your controlDict. Probably startFrom set to latestTime.

Quote:
Originally Posted by gruenertee View Post
A whole subset of the geometry would be really helpful
Basically mapping from itself using an offset. Sorry. This currently can not be done.

Quote:
Originally Posted by gruenertee View Post
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
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
gschaider is offline   Reply With Quote

Old   June 20, 2016, 06:30
Default
  #32
Member
 
Laurent DASTUGUE
Join Date: May 2014
Location: Paris, France
Posts: 96
Rep Power: 4
laurentD is on a distinguished road
Quote:
Originally Posted by gruenertee View Post
Hi foamers,

first of all i want to thank everybody who keeps runing this forum; i want to implement a Robin Boundary condition via the groovy Boundary condition, but Tinf should be read out of a .dat file (lookuptable)
(Openfoam2.2.0)

wall
{
type groovyBC;
variables "k=0.8;alpha=15;Tinf=65;f=1/(1+k(alpha*mag(delta())));";
valueExpression "Tinf";
gradientExpression "0";
fractionExpression "f";
value uniform 0;
}

I am asking myself how to tell "Tinf" to read the inlet.dat file How to combine the type groovyBC with the lookuptables for Tinf?

lookuptables (
{
name inlet;
outOfBounds clamp;
fileName "$FOAM_CASE/inlet.dat";
}

Thank you
Anything new on this topic. I am facing the same problem.
I want to use groovyBC as an externalWallHeatFluxTemperature condition, with the value of h read from a tabular.

Thank you
Laurent
laurentD is offline   Reply With Quote

Old   June 20, 2016, 08:23
Default
  #33
Member
 
Laurent DASTUGUE
Join Date: May 2014
Location: Paris, France
Posts: 96
Rep Power: 4
laurentD is on a distinguished road
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;
    }
and filling the file data.data with
Code:
(
    (0 0)
    (1 0.1)
    (3 0.1)
    (4 -0.1)
)
i think i have succeed to define hBC as a function of a value, which is defined by the tabular included in data.data.
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
laurentD is offline   Reply With Quote

Reply

Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Numerical errors in nested domain with pre-calculated boundary values Arnoldinho OpenFOAM Running, Solving & CFD 3 April 4, 2012 10:31
max node values exceed max element values in contour plot jason_t FLUENT 0 August 19, 2009 11:32
exact face values RubenG Main CFD Forum 0 June 22, 2009 11:09
strange node values @ solid/fluid interface - help JB FLUENT 2 November 1, 2008 13:04
Generating table values in a loop Jarrod Sinclair CD-adapco 1 November 26, 2003 20:26


All times are GMT -4. The time now is 09:15.