|
[Sponsors] |
[swak4Foam] Using groovyBC and storedVariables to set periodic mooving walls |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
December 4, 2016, 21:30 |
Using groovyBC and storedVariables to set periodic mooving walls
|
#1 |
New Member
Tanmay Inamdar
Join Date: Jan 2015
Posts: 10
Rep Power: 11 |
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. |
|
March 17, 2017, 01:46 |
In case anyone is interested, following worked
|
#2 |
New Member
Tanmay Inamdar
Join Date: Jan 2015
Posts: 10
Rep Power: 11 |
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; } } |
|
Tags |
groovybc, storedvariables, swak4foam |
|
|
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 |