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

[swak4Foam] Groovy BC for lookup Table values

Register Blogs Community New Posts Updated Threads Search

Like Tree2Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 22, 2013, 19:46
Default
  #21
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 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, 14:39
Default
  #22
New Member
 
sebastian n
Join Date: Nov 2012
Posts: 17
Rep Power: 14
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, 15:01
Default
  #23
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 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, 13:41
Default
  #24
New Member
 
sebastian n
Join Date: Nov 2012
Posts: 17
Rep Power: 14
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, 14:18
Default
  #25
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 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, 13:57
Default Overestimation of the temperature distribution
  #26
New Member
 
sebastian n
Join Date: Nov 2012
Posts: 17
Rep Power: 14
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, 15:52
Default
  #27
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 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, 15:02
Default
  #28
New Member
 
sebastian n
Join Date: Nov 2012
Posts: 17
Rep Power: 14
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, 19:27
Default
  #29
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 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, 17:20
Default
  #30
New Member
 
sebastian n
Join Date: Nov 2012
Posts: 17
Rep Power: 14
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, 06:30
Default
  #31
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 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, 07:30
Default
  #32
Senior Member
 
Laurent DASTUGUE
Join Date: May 2014
Location: Chartres, France
Posts: 122
Rep Power: 12
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, 09:23
Default
  #33
Senior Member
 
Laurent DASTUGUE
Join Date: May 2014
Location: Chartres, France
Posts: 122
Rep Power: 12
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

Old   June 9, 2017, 05:23
Default
  #34
New Member
 
Sachin
Join Date: Sep 2016
Location: Poitiers,France
Posts: 17
Rep Power: 10
smodh is on a distinguished road
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.
smodh is offline   Reply With Quote

Old   June 15, 2017, 11:59
Default
  #35
Super Moderator
 
Tobi's Avatar
 
Tobias Holzmann
Join Date: Oct 2010
Location: Bad Wörishofen
Posts: 2,711
Blog Entries: 6
Rep Power: 52
Tobi has a spectacular aura aboutTobi has a spectacular aura aboutTobi has a spectacular aura about
Send a message via ICQ to Tobi Send a message via Skype™ to Tobi
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;
The fields T and U has to be in the FOAM database as registered objects. The formulation is just arbitrary. Of course you also can put the expression I build directly into the fractionExpression like:

Code:
fractionExpression "log(T+13)*exp(U)-14";
Again, I am not sure about the correct syntax (Sorry bernhard that I do not have your groovy in mind )

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

Old   June 15, 2017, 13:17
Default
  #36
New Member
 
Sachin
Join Date: Sep 2016
Location: Poitiers,France
Posts: 17
Rep Power: 10
smodh is on a distinguished road
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.
smodh is offline   Reply With Quote

Old   July 6, 2017, 13:13
Default
  #37
New Member
 
Diego Ferrando
Join Date: Mar 2017
Location: Zaragoza
Posts: 19
Rep Power: 9
dferrando is on a distinguished road
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)";
    }
The error:
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
How can I set a velocity profile with 3 velocity componets using groovyBC?

Thank you.

Diego
dferrando is offline   Reply With Quote

Old   July 7, 2017, 08:13
Default
  #38
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 dferrando View Post
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)";
    }
Surly you mean profile1 in the expression. But that is not the problem
Quote:
Originally Posted by dferrando View Post
The error:
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
How can I set a velocity profile with 3 velocity componets using groovyBC?

Thank you.

Diego
Problem is that the lookup tables in swak4foam only allow returning scalars. That more than one valueColumn can be specified comes from the underlying library. I'm afraid you'll have to create three lookups on the same file and then use an expression "vector(profileX(pos().z),profileY(pos().z),profil eZ(pos().z))"
__________________
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 7, 2017, 11:05
Default
  #39
New Member
 
Diego Ferrando
Join Date: Mar 2017
Location: Zaragoza
Posts: 19
Rep Power: 9
dferrando is on a distinguished road
Quote:
Originally Posted by gschaider View Post
Surly you mean profile1 in the expression. But that is not the problem


Problem is that the lookup tables in swak4foam only allow returning scalars. That more than one valueColumn can be specified comes from the underlying library. I'm afraid you'll have to create three lookups on the same file and then use an expression "vector(profileX(pos().z),profileY(pos().z),profil eZ(pos().z))"
Thank you very much. I do that but I have another Error that I don't understand:

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
My lookuptables and expresion:

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))";
    }
Thanks Bernhard!

Diego.
merlinwilliams and MFWilliams like this.
dferrando is offline   Reply With Quote

Old   July 7, 2017, 11:12
Default
  #40
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 dferrando View Post
Thank you very much. I do that but I have another Error that I don't understand:

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
My lookuptables and expresion:

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))";
    }
Thanks Bernhard!

Diego.
That is not a swak-problem. But it happens in the OpenFOAM-code: even if it is only one element OF insists that valueColumns is a list. So instead of "1" write "( 1 )"
__________________
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


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


All times are GMT -4. The time now is 17:31.