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

[swak4Foam] Using groovyBC and storedVariables to set periodic mooving walls

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By Tanmay95

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 4, 2016, 21:30
Unhappy Using groovyBC and storedVariables to set periodic mooving walls
  #1
New Member
 
Tanmay Inamdar
Join Date: Jan 2015
Posts: 10
Rep Power: 11
Tanmay95 is on a distinguished road
Hello,

I am simulating a 2D cavity flow using icoFoam and I want my top and bottom walls to move periodically.
Utop=U and Ubottom=0 for nT< t <(n+0.5)T
Utop=0 and Ubottom=U for (n+0.5)T< t <(n+1)T

Basically T is period and n is period number. During each period for half the period top wall moves with constant velocity and then for remaining half period bottom wall moves.

What I used is


topMovingWall
{
type groovyBC;

storedVariables
(
{
name n;
initialValue "0";
}
);
variables
(
"tperiod=20;"
"n = (time() % tperiod == 0) ? n+1 : n;"
);
valueExpression "vector((time()>n*tperiod && time()<(n+0.5)*tperiod)?0.01:0,0,0)";
}

bottomMovingWall
{
type groovyBC;

storedVariables
(
{
name n;
initialValue "0";
}
);
variables
(
"tperiod=20;"
"n = (time() % tperiod == 0) ? n+1 : n;"
);
valueExpression "vector((time()>(n+0.5)*tperiod && time()<(n+1)*tperiod)?0.01:0,0,0)";
}


For n=0 it works and I get wall motions but my n is not incrementing when a period of T (denoted by tperiod) gets over.
Tanmay95 is offline   Reply With Quote

Old   March 17, 2017, 01:46
Default In case anyone is interested, following worked
  #2
New Member
 
Tanmay Inamdar
Join Date: Jan 2015
Posts: 10
Rep Power: 11
Tanmay95 is on a distinguished road
dimensions [0 1 -1 0 0 0 0];

internalField uniform (0 0 0);

boundaryField
{
topMovingWall
{
type groovyBC;
valueExpression "vector((time()>n*tperiod && time()<(n+0.5)*tperiod)?0.01:0,0,0)";
value uniform (0 0 0);
storedVariables
(
{
name n;
initialValue "0";
}
);
variables
(
"tperiod=20;"
"n=(time()>n*tperiod && time()<(n+1)*tperiod)?n:n+1;"
);

}

bottomMovingWall
{
type groovyBC;
valueExpression "vector((time()>(n+0.5)*tperiod && time()<(n+1)*tperiod)?-0.01:0,0,0)";
value uniform (0 0 0);
storedVariables
(
{
name n;
initialValue "0";
}
);
variables
(
"tperiod=20;"
"n=(time()>n*tperiod && time()<(n+1)*tperiod)?n:n+1;"
);

}

fixWall
{
type fixedValue;
value uniform (0 0 0);
}

frontAndBack
{
type empty;
}
}
zhutaihang likes this.
Tanmay95 is offline   Reply With Quote

Reply

Tags
groovybc, storedvariables, swak4foam


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] Segmentation Fault - groovyBC storedVariables in parallel simulations philippose OpenFOAM Community Contributions 6 November 11, 2016 10:24
[swak4Foam] groovyBC storedVariables in parallel bugfix 9.6.3? Duncan_vdH OpenFOAM Community Contributions 6 June 1, 2016 18:03


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