# Regular wave generation via open boundaries

Hi all, I am trying to generate regular waves via open boundaries.

In the example

`\examples\inletoutlet\04_Waves2D` , it uses imposed velocity in the buffer zone to generate 2nd order Stokes wave. And the velocity distribution is the same over the depth. From what I understand, the velocity of the particle changes over the depth according to the theory. Does this example use Madsen' s wave generation theory to impose the same velocity as the piston wavemaker?

The first pic is from `waves.csv` and the second is from my calculation from Madsen's theory, they look close.

So my question is, to generate wave in open boundaries, what will the velocity of fluid particles be over the depth?

Thanks for your help in advance.

## Comments

• @iarba27 can reply to this with accurate information

• You need to use a different option to be able to vary by depth. You should use Option 3 for Impose Velocity: Interpolate. You will find more information at Page 17 of XML_GUIDE_INLETOUTLET.pdf

• Dear Barry,

you can either use a uniform velocity profile or imposed velocity that varies with the depth. In that case, as a_meduri2312 mentioned, you can impose velocity but use interpolate option. My advise is to construct the velocity file using at least 11 points (dividing the water depth by 10). The lowest one corresponds to the fluid bottom, hence vel=0. The highest one is on the still water level. It would be better if your file has the following structure (see picture).

Regards

Corrado

• @a_meduri2312 Thanks for the insight!

• Hi Corrado,

Thanks a lot for your comprehensive suggestion and I will try that.

Best,

Barry

• Dear @iarba27,

Greetings.

I am trying to generate waves as per to your suggestion.

My <imposevelocity>XML reads:

``` <imposevelocity mode="3" comment="Imposed velocity 0:fixed value, 1:variable value, 2:Extrapolated velocity, 3:Interpolated velocity (default=0)">
<gridveldata file ="u_vel.csv" comment="CSV file with velocity data in different times and positions" />
<gridresetvelz value="true" comment="Reset Z velocity after interaction (default=false)" />
<gridposzero x="0" z="0" comment="Defines position of grid (default=0)" />
</imposevelocity>
```

My `u_vel.csv` is like:

However, I get the error:

```*** Exception (JXml::ErrReadElement) at ..\source\JXml.cpp:231
Text: Error reading xml - Element 'gridresetvelz' is invalid.
File: T6_out/T6.xml(row:95)
```

Do you have any ideas about how to resolve it? Thanks a lot in advance!

• Perhaps use "1" instead of "true"? I do not understand the error message completely, since it could either mean that the value or the element it self is causing trouble. But this seems like a simple initial check to make.

But a very interesting way of going about this, hopefully a more fully fledged example doing what you are trying to will be added some time

Kind regards

• Hi @Asalih3d ,

Thanks for your reply. I tried "1" but I didn't work....

I am not good at coding but I believe it's because of DualSPHysics doesn't know what "gridresetvelz" is. If you simply replace "gridresetvelz" with "ABCDE", error `Element 'ABCDE' is invalid` appears.

And I am not able to find any item in the source code in the Github repository that contains "gridresetvelz", which is strange...

Best

Sign In or Register to comment.