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

groovyBC and access to alpha field of other patch

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

Like Tree2Likes
  • 1 Post By Tobi
  • 1 Post By gschaider

Reply
 
LinkBack Thread Tools Display Modes
Old   August 19, 2014, 04:31
Default groovyBC and access to alpha field of other patch
  #1
Senior Member
 
Tobi's Avatar
 
Tobias Holzmann
Join Date: Oct 2010
Location: Leoben (Austria)
Posts: 1,089
Blog Entries: 6
Rep Power: 19
Tobi will become famous soon enough
Send a message via ICQ to Tobi Send a message via Skype™ to Tobi
Hi all,

I want to get access from alpha field from patch1 to use it in patch2.

The problem is that my alpha field does not exist?
Code:
type     groovyBC;
variables "alphaFromPatch1{patch1}=alpha.liquid;";
valueExpression "alphaFromPatch1";
Additionally I tried with:
  • alpha
  • alpha1
  • alpha2
  • alpha.liquid
  • alpha.air


But always I get an error that this variable does not exist or is of wrong type.
Does anyone have some idea?

Additionall question:

Is it possible to get velocity field U from patch1 and use it for patch2 not in an averaged value?
nimasam likes this.
__________________
Best regards,
Tobias Holzmann

Some interesting OpenFOAM tutorials and videos on www.Holzmann-cfd.de
Tobi is offline   Reply With Quote

Old   August 21, 2014, 19:05
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 Tobi View Post
Hi all,

I want to get access from alpha field from patch1 to use it in patch2.

The problem is that my alpha field does not exist?
Code:
type     groovyBC;
variables "alphaFromPatch1{patch1}=alpha.liquid;";
valueExpression "alphaFromPatch1";
Additionally I tried with:
  • alpha
  • alpha1
  • alpha2
  • alpha.liquid
  • alpha.air


But always I get an error that this variable does not exist or is of wrong type.
Does anyone have some idea?
alpha.liquid won't help at all. swak does not consider the dot to be a valid part of a field name (it is a bit like C++ here) because it needs it to access components. To access fields with "illegal" characters in the name "aliases" have been added to swak some time ago (have a look at the forum, the README or the incomplete reference guide).

To find out under which name this field is known you'd have to consult the sources. Or there is a function object listRegisteredObjects that lists all objects currently registered in the registry. One of these objects should be your alpha

Quote:
Originally Posted by Tobi View Post
Additionall question:

Is it possible to get velocity field U from patch1 and use it for patch2 not in an averaged value?
Only if the patches are declared as mapped in the boundary-file
__________________
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   September 1, 2014, 16:09
Default
  #3
Senior Member
 
Tobi's Avatar
 
Tobias Holzmann
Join Date: Oct 2010
Location: Leoben (Austria)
Posts: 1,089
Blog Entries: 6
Rep Power: 19
Tobi will become famous soon enough
Send a message via ICQ to Tobi Send a message via Skype™ to Tobi
Dear Bernhard,

if I use mapped patch type I also get a interpolated velocity field:

Code:
smoothSolver:  Solving for alpha.liquid, Initial residual = 0, Final residual = 0, No Iterations 0
Phase-1 volume fraction = 0.088941  Min(alpha1) = 0  Max(alpha1) = 1
MULES: Correcting alpha.liquid
MULES: Correcting alpha.liquid
Phase-1 volume fraction = 0.088941  Min(alpha1) = 0  Max(alpha1) = 1
swak4Foam: Setting default mesh
swak4Foam: Allocating new repository for sampledGlobalVariables
DILUPBiCG:  Solving for Ux, Initial residual = 1, Final residual = 4.41011e-06, No Iterations 3
DILUPBiCG:  Solving for Uy, Initial residual = 1, Final residual = 5.89124e-06, No Iterations 3
GAMG:  Solving for p_rgh, Initial residual = 1, Final residual = 0.00848398, No Iterations 5
--> FOAM Warning : 
    From function ExpressionResult::getUniformInternal(const label size,bool noWarn)
    in file ExpressionResult/ExpressionResultI.H at line 332
    The minimum value (-0.325913 -0.0248373 0) and the maximum (0.135614 1.34743 0) differ. I will use the average (-0.0315278 0.429949 0)
time step continuity errors : sum local = 1.2011e-06, global = -7.49768e-07, cumulative = -7.49768e-07
GAMG:  Solving for p_rgh, Initial residual = 0.00236714, Final residual = 7.34319e-09, No Iterations 31
--> FOAM Warning : 
    From function ExpressionResult::getUniformInternal(const label size,bool noWarn)
    in file ExpressionResult/ExpressionResultI.H at line 332
    The minimum value (-0.135501 0.000179205 0) and the maximum (0.101674 0.436928 0) differ. I will use the average (-0.0170261 0.171489 0)
time step continuity errors : sum local = 4.0578e-11, global = 3.5819e-11, cumulative = -7.49732e-07
DILUPBiCG:  Solving for epsilon, Initial residual = 0.0161811, Final residual = 1.53934e-06, No Iterations 2
DILUPBiCG:  Solving for k, Initial residual = 1, Final residual = 2.04556e-06, No Iterations 3
ExecutionTime = 0.36 s  ClockTime = 1 s
The BC is like that:
Code:
    internalFacesForGroovyBC_master
    {
        type            groovyBC;
        value           uniform (0 0 0);
        variables       "x1=5;y1=6;x2=30;y2=0;function1=(y2-y1)/(x2-x1)*(time()-x1)+y1;x3=35;y3=0;x4=60;y4=4;function2=(y4-y3)/(x4-x3)*(time()-x3)+y3;";
        valueExpression "vector(0,0,0)";
        gradientExpression "vector(0,0,0)";
        fractionExpression "(time() < 5) ? 0 : 1";
    }
    internalFacesForGroovyBC_slave
    {
        type            groovyBC;
        variables       "velo{internalFacesForGroovyBC_master}=U;";
        valueExpression "velo";
        value           uniform (0 0 0);
    }
Do you have some hints?
__________________
Best regards,
Tobias Holzmann

Some interesting OpenFOAM tutorials and videos on www.Holzmann-cfd.de
Tobi is offline   Reply With Quote

Old   September 1, 2014, 16:55
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 Tobi View Post
Dear Bernhard,

if I use mapped patch type I also get a interpolated velocity field:

Code:
smoothSolver:  Solving for alpha.liquid, Initial residual = 0, Final residual = 0, No Iterations 0
Phase-1 volume fraction = 0.088941  Min(alpha1) = 0  Max(alpha1) = 1
MULES: Correcting alpha.liquid
MULES: Correcting alpha.liquid
Phase-1 volume fraction = 0.088941  Min(alpha1) = 0  Max(alpha1) = 1
swak4Foam: Setting default mesh
swak4Foam: Allocating new repository for sampledGlobalVariables
DILUPBiCG:  Solving for Ux, Initial residual = 1, Final residual = 4.41011e-06, No Iterations 3
DILUPBiCG:  Solving for Uy, Initial residual = 1, Final residual = 5.89124e-06, No Iterations 3
GAMG:  Solving for p_rgh, Initial residual = 1, Final residual = 0.00848398, No Iterations 5
--> FOAM Warning : 
    From function ExpressionResult::getUniformInternal(const label size,bool noWarn)
    in file ExpressionResult/ExpressionResultI.H at line 332
    The minimum value (-0.325913 -0.0248373 0) and the maximum (0.135614 1.34743 0) differ. I will use the average (-0.0315278 0.429949 0)
time step continuity errors : sum local = 1.2011e-06, global = -7.49768e-07, cumulative = -7.49768e-07
GAMG:  Solving for p_rgh, Initial residual = 0.00236714, Final residual = 7.34319e-09, No Iterations 31
--> FOAM Warning : 
    From function ExpressionResult::getUniformInternal(const label size,bool noWarn)
    in file ExpressionResult/ExpressionResultI.H at line 332
    The minimum value (-0.135501 0.000179205 0) and the maximum (0.101674 0.436928 0) differ. I will use the average (-0.0170261 0.171489 0)
time step continuity errors : sum local = 4.0578e-11, global = 3.5819e-11, cumulative = -7.49732e-07
DILUPBiCG:  Solving for epsilon, Initial residual = 0.0161811, Final residual = 1.53934e-06, No Iterations 2
DILUPBiCG:  Solving for k, Initial residual = 1, Final residual = 2.04556e-06, No Iterations 3
ExecutionTime = 0.36 s  ClockTime = 1 s
The BC is like that:
Code:
    internalFacesForGroovyBC_master
    {
        type            groovyBC;
        value           uniform (0 0 0);
        variables       "x1=5;y1=6;x2=30;y2=0;function1=(y2-y1)/(x2-x1)*(time()-x1)+y1;x3=35;y3=0;x4=60;y4=4;function2=(y4-y3)/(x4-x3)*(time()-x3)+y3;";
        valueExpression "vector(0,0,0)";
        gradientExpression "vector(0,0,0)";
        fractionExpression "(time() < 5) ? 0 : 1";
    }
    internalFacesForGroovyBC_slave
    {
        type            groovyBC;
        variables       "velo{internalFacesForGroovyBC_master}=U;";
        valueExpression "velo";
        value           uniform (0 0 0);
    }
Do you have some hints?
Use mapped(U) instead of the remote patch syntax. There are 2 or three examples in Examples/test (the cases with "mapped" in the name)
Tobi likes this.
__________________
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   September 2, 2014, 04:04
Default
  #5
Senior Member
 
Tobi's Avatar
 
Tobias Holzmann
Join Date: Oct 2010
Location: Leoben (Austria)
Posts: 1,089
Blog Entries: 6
Rep Power: 19
Tobi will become famous soon enough
Send a message via ICQ to Tobi Send a message via Skype™ to Tobi
Hi Bernhard,

many thanks to you. Mapping the velocity field U is working without problems now. I think it knows which patch to map out of the boundary file (sampleRegion or coupleGroup). I will have a look at your mentioned "aliases" to get the alpha field for the further step now.

Thank you again.
__________________
Best regards,
Tobias Holzmann

Some interesting OpenFOAM tutorials and videos on www.Holzmann-cfd.de
Tobi 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 and funkySetFields married and got a kid named swak4Foam gschaider OpenFOAM 164 January 13, 2015 03:52
whats the trick to access to second layer of patch neighbors in groovyBC? immortality OpenFOAM 6 July 9, 2013 12:01
Can groovyBC (swak4foam) access dimensionedScalar? argonaut OpenFOAM Running, Solving & CFD 1 May 24, 2012 09:04
Wall heat transfer using groovyBC (XiFoam solver) usergk OpenFOAM 7 February 4, 2011 14:36


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