CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (https://www.cfd-online.com/Forums/openfoam-solving/)
-   -   time vary boundary condition to simulate waves in interFoam or equivalent (https://www.cfd-online.com/Forums/openfoam-solving/137015-time-vary-boundary-condition-simulate-waves-interfoam-equivalent.html)

haze_1986 June 9, 2014 03:27

time vary boundary condition to simulate waves in interFoam or equivalent
 
Hi all,

I am currently required to run a simulation that takes in boundary conditions that are time varying from a data file, basically with alpha1 and velocity beneath the surface of the water at every time step. Would like to find out what is the best way I can achieve this.
Generally, from many wave tank simulations we normally use groovy BC for regular waves, which we have been using for a while now: From http://openfoamwiki.net/index.php/Contrib/groovyBC

For a surface elevation following the second order stokes wave,
Code:


inlet
  {
      type            groovyBC;
      valueExpression "(pos().z<=A*cos(-w*time())+0.5*k*A*A*cos(2*(-w*time()))) ? 1 : 0";
      variables      "l=5;A=0.1;g=vector(0,0,-9.81);k=2*pi/l;w=sqrt(k*mag(g));";
      timelines      ();
  }

And for the velocity under the surface elevation,

Code:


  inlet
  {
      type            groovyBC;
      valueExpression "(pos().z<=A*cos(-w*time())+0.5*k*A*A*cos(2*(-w*time()))) ? vector( A*w*exp(k*pos().z)*cos(-w*time()), 0, A*w*exp(k*pos().z)*sin(-w*time())) : vector(0,0,0)";
      variables      "l=5;A=0.1;g=vector(0,0,-9.81);k=2*pi/l;w=sqrt(k*mag(g));";
      timelines      ();
  }

I am thus not sure in the current case how I can proceed if the parameters are irregular and known, stored in a data file of the surface elevation and velocities at the inlet boundary.

Regards.


All times are GMT -4. The time now is 15:33.