
[Sponsors] 
May 21, 2014, 04:48 
calculate gradient of U in groovyBC

#1 
New Member
Chao Liu
Join Date: May 2014
Posts: 5
Rep Power: 5 
Hello
I'm trying to calculate the force on a surface to update the movingwall 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.14" :"field grad not existing or of wrong type" "grad(U)" ^^^^  Regards, 

May 21, 2014, 06:49 

#2 
Senior Member
Philipp
Join Date: Jun 2011
Location: Germany
Posts: 1,297
Rep Power: 20 
Hi!
But what is snGrad(U) else?
__________________
The skeleton ran out of shampoo in the shower. 

May 21, 2014, 08:16 

#3 
New Member
Chao Liu
Join Date: May 2014
Posts: 5
Rep Power: 5 

May 21, 2014, 08:18 

#4 
Senior Member
Philipp
Join Date: Jun 2011
Location: Germany
Posts: 1,297
Rep Power: 20 
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, 09:30 

#5 
New Member
Chao Liu
Join Date: May 2014
Posts: 5
Rep Power: 5 
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, 06:32 

#6  
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,020
Rep Power: 43 
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, 10:34 

#7  
New Member
Chao Liu
Join Date: May 2014
Posts: 5
Rep Power: 5 
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 
Thread Tools  
Display Modes  


Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
WSS and normal velocity gradient for the slanted pipe  wanna88  FLUENT  2  October 1, 2012 22:34 
calculate temperature gradient from temperature field  xiyuqiu  Main CFD Forum  14  July 30, 2012 14:38 
A function to calculate gradient in a cell  Ballal  Siemens  0  June 9, 2012 00:07 
Temperature Gradient at Wall  sven  OpenFOAM  7  November 1, 2010 18:25 
calculate the temperature gradient on a profile  arther  FLUENT  0  April 19, 2006 23:12 