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

Problem: Defining a linear scalar BC with groovyBC

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

Like Tree2Likes
  • 2 Post By gschaider

Reply
 
LinkBack Thread Tools Display Modes
Old   July 11, 2012, 17:22
Default Problem: Defining a linear scalar BC with groovyBC
  #1
New Member
 
Join Date: Jul 2012
Posts: 2
Rep Power: 0
holp is on a distinguished road
Hello everybody,

I'm new in this forum, so first: greetings everyone
Im currently in my 4th semester and was assigned a project which mainly involves openFoam. I was hoping you could help me with a problem, it would be very much appreciated.

I have to define a linear temperature distribution as B.C. over the lateral surface of a cylinder (along the z-axis). Since I couldn't find any tutorial how to adapt / write my own B.C. (it's also a bit complicated for a beginner), I wanted to use groovyBC in order to define the boundary condition.

My problem: it doesn't work. Or put another way: I screwed something up.
I downloaded the swak4Foam GNU tarball, executed wmake all and added
libs ("libOpenFOAM.so""libgroovyBC.so");
to my controlDict.

I then tried to define my B.C in the 0/T file:

Code:
surface
     {
         type     groovyBC;
         variables "zp = pos().z; m = pts().z ;minZ = min(m); maxZ =max(m)";
         valueExpression "200 + (zp) / (maxZ - minZ)) * 100";
         value uniform 1;
     }
I also tried some simpler variants variants, like
valueExpression "100*pos().z";
and used the mag() function since I wasn't enterely sure whether I was dealing with scalar values. Nothing worked.

When I execute paraFoam before calculating anything, the default value uniform 1 is always being used. Executing my modified IcoFoam solver, openFoam gives a bug report and crashes.

Code:
    // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time

Create mesh for time = 0

Reading transportProperties

Reading field p

Reading field T

Reading field U

Reading/calculating face flux field phi


Starting time loop

Time = 1

Courant Number mean: 0 max: 0
DILUPBiCG:  Solving for Ux, Initial residual = 0, Final residual = 0, No Iterations 0
DILUPBiCG:  Solving for Uy, Initial residual = 0, Final residual = 0, No Iterations 0
DILUPBiCG:  Solving for Uz, Initial residual = 0, Final residual = 0, No Iterations 0
DICPCG:  Solving for p, Initial residual = 0, Final residual = 0, No Iterations 0
time step continuity errors : sum local = 0, global = 0, cumulative = 0
DICPCG:  Solving for p, Initial residual = 0, Final residual = 0, No Iterations 0
time step continuity errors : sum local = 0, global = 0, cumulative = 0
word::stripInvalid() called for word zp
    For debug level (= 2) > 1 this is considered fatal

}
I would appreciate any help / advise. Thanks a lot in advance.

holp
holp is offline   Reply With Quote

Old   July 14, 2012, 06:30
Default
  #2
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,915
Rep Power: 40
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by holp View Post
Hello everybody,

I'm new in this forum, so first: greetings everyone
Im currently in my 4th semester and was assigned a project which mainly involves openFoam. I was hoping you could help me with a problem, it would be very much appreciated.

I have to define a linear temperature distribution as B.C. over the lateral surface of a cylinder (along the z-axis). Since I couldn't find any tutorial how to adapt / write my own B.C. (it's also a bit complicated for a beginner), I wanted to use groovyBC in order to define the boundary condition.

My problem: it doesn't work. Or put another way: I screwed something up.
I downloaded the swak4Foam GNU tarball, executed wmake all and added
libs ("libOpenFOAM.so""libgroovyBC.so");
to my controlDict.

I then tried to define my B.C in the 0/T file:

Code:
surface
     {
         type     groovyBC;
         variables "zp = pos().z; m = pts().z ;minZ = min(m); maxZ =max(m)";
         valueExpression "200 + (zp) / (maxZ - minZ)) * 100";
         value uniform 1;
     }
I also tried some simpler variants variants, like
valueExpression "100*pos().z";
and used the mag() function since I wasn't enterely sure whether I was dealing with scalar values. Nothing worked.

When I execute paraFoam before calculating anything, the default value uniform 1 is always being used.
That's alright I'm afraid: paraview does not know how to interpret groovyBC and therefor uses the old value (subsequent timesteps will always get value written and therefor be useful)

Quote:
Originally Posted by holp View Post
Executing my modified IcoFoam solver, openFoam gives a bug report and crashes.

Code:
    // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time

Create mesh for time = 0

Reading transportProperties

Reading field p

Reading field T

Reading field U

Reading/calculating face flux field phi


Starting time loop

Time = 1

Courant Number mean: 0 max: 0
DILUPBiCG:  Solving for Ux, Initial residual = 0, Final residual = 0, No Iterations 0
DILUPBiCG:  Solving for Uy, Initial residual = 0, Final residual = 0, No Iterations 0
DILUPBiCG:  Solving for Uz, Initial residual = 0, Final residual = 0, No Iterations 0
DICPCG:  Solving for p, Initial residual = 0, Final residual = 0, No Iterations 0
time step continuity errors : sum local = 0, global = 0, cumulative = 0
DICPCG:  Solving for p, Initial residual = 0, Final residual = 0, No Iterations 0
time step continuity errors : sum local = 0, global = 0, cumulative = 0
word::stripInvalid() called for word zp
    For debug level (= 2) > 1 this is considered fatal

}
I would appreciate any help / advise. Thanks a lot in advance.

holp
My bad: you tried to make it more readable by adding spaces. Now swak4Foam uses the variable name "zp " and OpenFOAM does not think this is a word. It occurred once before and I meant to fix this but I forget about such SEPs ("Somebody elses problem") if they are not in the Mantis. So for the time being remove the space before the = and you should be fine
gschaider is offline   Reply With Quote

Old   July 19, 2012, 08:46
Default
  #3
New Member
 
Join Date: Jul 2012
Posts: 2
Rep Power: 0
holp is on a distinguished road
Thank you very much for your answer, and also my apologies for answering one week late.

I managed to get it running by not defining the variables and only using the valueExpression term. But it's always good to know what caused the problem - might save me quite some trouble in the future.
I didn't expect that problem, because every (programming) language I ever dealt with absolutely ignores blank spaces.

You programmed swak4Foam? Respect, and thanks a lot!

holp
holp is offline   Reply With Quote

Old   July 19, 2012, 20:19
Default
  #4
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,915
Rep Power: 40
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by holp View Post
Thank you very much for your answer, and also my apologies for answering one week late.

I managed to get it running by not defining the variables and only using the valueExpression term. But it's always good to know what caused the problem - might save me quite some trouble in the future.
I didn't expect that problem, because every (programming) language I ever dealt with absolutely ignores blank spaces.
You're right (although one might say: Fortran 77 and Python take spaces very seriously. For different reasons ... and in one case I'd say: for good reasons). And swak ignores spaces everywhere else. But that part (variables) was a bit of an afterthought. And I'm a bit stubborn there: either a client demands a fix from me there or someone takes the time to write a bug report on the Mantis before I fix it

Quote:
Originally Posted by holp View Post
You programmed swak4Foam? Respect, and thanks a lot!
You're welcome. And as I said above: best "Thank you" is writing precise bug report on the Mantis, because the only three priorities for me to improve swak are: client demands, stuff that interests me and stuff that touches my ego (and keeping the number of bugs in the swak/openfoam-extend-Mantis low is important to my ego)
wyldckat and vitors like this.
gschaider 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
GroovyBC problem in the defining inlet velocity iampolaris OpenFOAM Running, Solving & CFD 7 October 18, 2014 09:25
Extrusion with OpenFoam problem No. Iterations 0 Lord Kelvin OpenFOAM 6 April 12, 2011 11:24
solution diverges when linear upwind interpolation scheme is used subash OpenFOAM 0 May 29, 2010 01:23
Scalar problem! lig FLUENT 0 May 5, 2010 15:16
Scalar problem Dougal McQueen CFX 0 November 21, 2003 08:23


All times are GMT -4. The time now is 11:57.