- **OpenFOAM**
(*http://www.cfd-online.com/Forums/openfoam/*)

- - **Boundary condition problems**
(*http://www.cfd-online.com/Forums/openfoam/90138-boundary-condition-problems.html*)

Boundary condition problemsHi Everyone,
I hope someone can help me with some problems I am having producing waves using groovyBC in OpenFOam 1.7.1. I have successfully installed groovyBC and can run the GroovyWaveTank example and successfully produce waves. However when I enter my equations (Stokes second order, involving several terms and hyperbolic functions for both the surface elevation and velocity) the simulation crashes when it starts to model the trough of the wave. I don't think this is related to the hyperbolic functions but to the pos().z condition. I have tried simplifying the equations by removing the second terms. If I do this and change the initial level of water to z=0.5m (originally water was initially at z=0m with a depth of 1m like in GroovyWaveTank) I can produce waves but this scenario is not physically correct. I realise this may be a logic problem with the way I have entered the equations but I am only an OpenFoam novice and I have spent the better part of two weeks working on this problem. I would really appreciate a fresh perspective or some ideas on how to fix this problem. I do not have a form of the velocity equation that uses the surface elevation (such as in the GrooveWaveTank example). The code I am using for the velocity is: dimensions [0 1 -1 0 0 0 0]; internalField uniform (0 0 0); boundaryField { inlet { type groovyBC; refValue uniform (0 0 0); refGradient uniform (0 0 0); valueFraction uniform 1; value uniform (0 0 0); valueExpression "(pos().z<= q*cos(-phi*time())+ (pow(H,2)*k/16) * cos (2*-phi*time()) * (2+cosh(2*k*h))*cosh(k*h)/ pow(sinh(k*h),3) )? vector( cos(k*s-phi*time())*q*mag(g)*k/phi* cosh(k*c)/cosh(k*h) +3/16*cos(2*(k*s-phi*time()))*pow(H,2)*phi*k*cosh(2*k*c)/pow(sinh(k*h),4), 0, sin(k*s-phi*time())*q*mag(g)*k/phi* sinh(k*c)/cosh(k*h) +3/16*sin(2*(k*s-phi*time()))*pow(H,2)*phi*k*sinh(2*k*c)/pow(sinh(k*h),4) ) : vector(0,0,0)"; gradientExpression "vector(0,0,0)"; fractionExpression "1"; variables "L=2;s=0;H=0.2;q=H/2;h=1;c=h+q;g=vector(0,0,-9.81);k=2*pi/L;phi=sqrt(k*mag(g)*tanh(k*h));"; timelines ( ); } outlet { type zeroGradient; } bottom { type slip; } atmosphere { type pressureInletOutletVelocity; tangentialVelocity uniform (1 0 0); value uniform (0 0 0); } frontAndBack { type empty; } } Thanks, Rose |

Hi Rose,
as a first approach you can try to simulate Linear Waves with e. g. the equations given in the Coastal Engineering Manual (free download available). I made the experience that it is very useful to keep the initial water level at z=0 and to fit the surrounding mesh to this condition. It makes the equations easier. Also check if your wave parameters fit with the wave theory you want to apply. Cheers David |

Thanks to your suggestions David (going back to basics!), I found the mistake I had in my formula. Guess it always pays to take a step back sometimes.
Many thanks, Rose |

All times are GMT -4. The time now is 02:30. |