|
[Sponsors] |
[swak4Foam] calculate gradient of U in groovyBC |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
May 21, 2014, 05:48 |
calculate gradient of U in groovyBC
|
#1 |
New Member
Chao Liu
Join Date: May 2014
Posts: 5
Rep Power: 12 |
Hello
I'm trying to calculate the force on a surface to update the moving-wall boundary condition of the surface. The gradient of U is needed for calculating viscous contribution of forces. The code is based on the example on wiki http://openfoamwiki.net/index.php/Co...ectionalForces Code:
sphere { type groovyBC; variables ( "pressure_force=sum(p*normal()*area());" "viscous_force=sum(-snGrad(U)*area()*0.01);" //nu=0.01 "force=pressure_force+viscous_force;" "acceleration=force*1000/33.51;" //density=1000;mass=33.51 SI "torque=sum((pos()-vector(0,0.4,0))^(p*normal()*area()-snGrad(U)*area()*0.01));" "angular_acceleration=torque*1000/0.5362;" //moment of inertia=0.5362 ); valueExpression "(time()>1.0) ? U+(vector(acceleration.x,0,0)+angular_acceleration^(pos()-vector(0,0.4,0)))*deltaT()*0.5 : U"; value uniform (0 0 0); } Code:
--> FOAM FATAL ERROR: Parser Error for driver PatchValueExpressionDriver at "1.1-4" :"field grad not existing or of wrong type" "grad(U)" ^^^^ --| Regards, |
|
May 21, 2014, 07:49 |
|
#2 |
Senior Member
Philipp
Join Date: Jun 2011
Location: Germany
Posts: 1,297
Rep Power: 27 |
Hi!
But what is snGrad(U) else?
__________________
The skeleton ran out of shampoo in the shower. |
|
May 21, 2014, 09:16 |
|
#3 |
New Member
Chao Liu
Join Date: May 2014
Posts: 5
Rep Power: 12 |
||
May 21, 2014, 09:18 |
|
#4 |
Senior Member
Philipp
Join Date: Jun 2011
Location: Germany
Posts: 1,297
Rep Power: 27 |
Well ok, this does not account for the moving wall... or what is the problem?
__________________
The skeleton ran out of shampoo in the shower. |
|
May 21, 2014, 10:30 |
|
#5 |
New Member
Chao Liu
Join Date: May 2014
Posts: 5
Rep Power: 12 |
Philipp, I want to impose a moving wall boundary condition on the surface of a sphere. The motion results from the hydrodynamic force . Therefore, the gradient of U at the surface must be obtained to calculate the force. The problem is that an error appears when I use grad(U). Using snGrad(U) is incorrect physically.
|
|
May 23, 2014, 07:32 |
|
#6 | |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
Quote:
On the other hand: as you probably know the U of the sphere it is probably better to calculate grad(U) in tangential direction analytically
__________________
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 |
||
May 25, 2014, 11:34 |
|
#7 | |
New Member
Chao Liu
Join Date: May 2014
Posts: 5
Rep Power: 12 |
Quote:
Thanks for your advice! I' m trying to do the calculation by modify the source code. My general idea is adding a new equation for the tensor grad(U) after the momentum equation is solved. Does this way can avoid the inaccuracy? Regards Chao |
||
Tags |
groovybc |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[swak4Foam] Velocity gradient outlet BC penalisation using groovyBC | Hiroshiman | OpenFOAM Community Contributions | 10 | June 11, 2014 17:57 |
[swak4Foam] Time varying non uniform velocity gradient, groovyBC? | ic3wall | OpenFOAM Community Contributions | 1 | November 14, 2012 18:26 |
calculate temperature gradient from temperature field | xiyuqiu | Main CFD Forum | 14 | July 30, 2012 15:38 |
A function to calculate gradient in a cell | Ballal | Siemens | 0 | June 9, 2012 01:07 |
calculate the temperature gradient on a profile | arther | FLUENT | 0 | April 20, 2006 00:12 |