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

[swak4Foam] groovyBC and access to alpha field of other patch

Register Blogs Community New Posts Updated Threads Search

Like Tree4Likes
  • 2 Post By Tobi
  • 2 Post By gschaider

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 19, 2014, 05:31
Default groovyBC and access to alpha field of other patch
  #1
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 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 and Bana like this.
__________________
Keep foaming,
Tobias Holzmann
Tobi is offline   Reply With Quote

Old   August 21, 2014, 20:05
Default
  #2
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 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, 17:09
Default
  #3
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
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?
__________________
Keep foaming,
Tobias Holzmann
Tobi is offline   Reply With Quote

Old   September 1, 2014, 17:55
Default
  #4
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 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 and the_ichthyologist like 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, 05:04
Default
  #5
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 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.
__________________
Keep foaming,
Tobias Holzmann
Tobi 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
[swak4Foam] codedMixed instead of groovyBC GerHan OpenFOAM Community Contributions 3 February 20, 2019 12:08
[swak4Foam] access field variables in groovyBC mehtab OpenFOAM Community Contributions 11 February 4, 2019 13:08
[swak4Foam] groovyBC and access to fields of other Regions ancolli OpenFOAM Community Contributions 0 July 29, 2017 09:41
[swak4Foam] whats the trick to access to second layer of patch neighbors in groovyBC? immortality OpenFOAM Community Contributions 6 July 9, 2013 13:01
[swak4Foam] Can groovyBC access dimensionedScalar? argonaut OpenFOAM Community Contributions 1 May 24, 2012 10:04


All times are GMT -4. The time now is 13:55.