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/)
-   -   New Wave BC bContinuousb over the Interface for OF 141 (https://www.cfd-online.com/Forums/openfoam-solving/57792-new-wave-bc-bcontinuousb-over-interface-141-a.html)

ngj March 6, 2008 07:20

Hi Foamers I have made a bo
 
Hi Foamers

I have made a boundary condition to be used within the multiphase solvers. At present I have only used it with InterFoam, but I cannot see any problem in applying it with rasInterFoam or lesInterFoam.

The BC generates Stokes 1st order waves on a vertical boundary - though easily extended to any higher order wave theories. The key difference from those BCs previously posted is that the faces at the boundary patch is evaluated each and every one. If a face intersects the interface at the boundary, then the wet and dry areas are determined, and a weighting of the boundary condition above and below the surface is given to that specific face. The reason for this extension is that the other procedure gave me problems with noise generated at the boundary if WET/DRY was only evaluated based on whether the center of the face was above or below the surface. This smoother approach seems to eliminate that.

I am in the middle of making a small technical note, which will be posted her, as soon it is done, but I thought I would like to share with all of you. The technical note will include a small verification and documentation of the chosen procedure together with verification of the BC against available experimental data.

The boundary conditions can be found by following this link:

http://www.student.dtu.dk/~s001581/f...BasedBC.tar.gz

and an example of the use can be found here:

http://www.student.dtu.dk/~s001581/testExample.tar.gz

Any comments will be appreciatedhttp://www.cfd-online.com/OpenFOAM_D...part/happy.gif Have fun,

Niels

kjmaki March 6, 2008 14:34

Niels- Thanks for sharing y
 
Niels-

Thanks for sharing your new boundary conditions. I am trying to use them on your test case, but I am having some difficulties.

I unpacked your files and ran the Allwmake script. It executes smoothly, and the *so files are placed in my $FOAM_LIBBIN.

When I execute interFoam, I get the following response:

--> FOAM FATAL ERROR :
gradientInternalCoeffs cannot be called for a defaultFvPatchField (actual type surfaceWaveVelocity)
on patch inlet of field U in file "/k/kjmaki/OpenFOAM/kjmaki-1.4.1-dev/run/testExample/0/U"
You are probably trying to solve for a field with a default boundary condition.

From function defaultFvPatchField<type>::gradientInternalCoeffs( ) const
in file fields/fvPatchFields/basic/default/defaultFvPatchField.C at line 694.

FOAM exiting

If I switch disallowDefaultFvPatchField to 1 in my ~/.OpenFOAM-1.4.1-dev/controlDict, it informs me that surfaceWavePressure is an unknown patchField type.

I have searched the Message Board, and I have found numerous posts that deal with related problems. Unfortunately, none of them were descriptive enough for me to understand exactly how to ensure interFoam will recognize the new conditions.

Thanks for the help!

Kevin

ngj March 6, 2008 15:17

Hi Kevin Good to hear that
 
Hi Kevin

Good to hear that you can use it.
You have to recompile InterFoam, so it links to the new libraries. Look in the file
OpenFOAM/OpenFOAM-1.4.1/applications/solvers/multiphase/interFoam/Make/options

and add the libraries in the same fashion as "-lfiniteVolume".
The libsurfaceWaveGammaFvPatchField.so does not need to be linked to interFoam as it is not used .. I never managed to get a robust method, where gamma was given as a Dirichlet, thus it is just set to zeroGradient in /0/gamma. The files are just left in the directory for completeness, if any of you come of with a clever ideahttp://www.cfd-online.com/OpenFOAM_D...part/happy.gif

I forgot to write, that my test example is rather large - 4 hours run in parallel on 3 cpus - so you might consider to look at the number of cells. I just gave a test, which I used for my verification - details on that to follow.

Further it could be difficult to use the BC on anything but rectangular faces on the boundary patch, where the faces is aligned with the y-z axes. This is due to a minor part of the method, which hasn't been implemented yet - when that is done arbitrary polygons can be used. This addition will come together with the technical note.

Have fun,

Niels

yann_delaure March 10, 2008 05:06

Hi Niels, Thank you for pos
 
Hi Niels,

Thank you for posting your BCs.
I have one comment and and one question.

It seems that OpenFoam recommends that new boundary conditions be compiled as new user dynamic library (for example as "libmyBCs.so") by using the following compilation line in the Make/files file: LIB = $(FOAM_LIBBIN)/libmyBCs. The library can then be accessed simply by including the following line at the end of the case/system/controDict:

libs ("libmyBCs.so")

In this way the OpenFoam source code is not modified.

My question concerns the contructor of your boundary condition. You are using the environmentalProperties dictionary. It seems that this dictionary is not loaded when the setFields and decomposePart utilities are run. So when I try to initialise the fields using setFields I get the following errors:

Exec : setFields . testExample
Date : Mar 10 2008
Time : 09:44:50
Host : CARNOT6
PID : 10012
Root : /home/delaurey/OpenFOAM/delaurey-1.4.1/run/tutorials/interFoam/VOF_Apps
Case : testExample
Nprocs : 1
Create time

Create mesh for time = 0

Reading setFieldsDict

Setting field default values
Setting volScalarField gamma
Setting volVectorField U


--> FOAM FATAL ERROR :
request for dictionary environmentalProperties from objectRegistry region0 failed
available objects of type dictionary are

3
(
fvSolution
fvSchemes
setFieldsDict
)


Reading the gamma field does not generate any error since I use like you a zeroGradient boundary condition. But executation terminates with the initialisation of U. Did you experience similar difficulties?
Thanks
Yann

ngj March 10, 2008 06:03

Hi Yann I tried to remove m
 
Hi Yann

I tried to remove my BCs from the compilation of interFoam. When I did that I got the same error as yours. Though compiling with the libraries does not seems to give any problems.

I am very new to both OpenFOAM and C++ thus if there is a need to change things in my BCs, I believe we need to get some advise from a more experienced user. The present BCs is actually based on some other FvPatch<type>Field I found in the source.

Best regards,

Niels

yann_delaure March 10, 2008 07:23

Niels, Thanks for your resp
 
Niels,

Thanks for your response. I am also just starting using OpenFoam. I also had a look at the BCs class you used to derive your own. One way of avoiding the problem is to remove the BC variable from the environmentalPropeties dictionary and placing them in the 0/U and other initial field definition. For example:

boundaryName
{
type surfaceWaveVelocity;
inletValue uniform (0 0 0);
value uniform (0 0 0);
depth 1;
seaLevel 1;
...
}

and in the contructor:

...
depth_(readScalar(dict.lookup("depth"))),
...

instead of reading the environmentalProperties dictionary. Just to check have you had any problem running your case in parallel? I have implemented a similar BC which runs well on a single processor but fails in parallel. Has anyone else experienced similar problems when using dynamic libraries by using the dlopen methd recommended in the last distribution of OpenFoam (by adding libs ("libfoamUser.so" in controlDict)
Regards
Yann

ngj March 11, 2008 14:21

Hi While implementing a sec
 
Hi

While implementing a second order stokes, I found that I have made a bug in the pressure gradient.

Corrected version will be uploaded as soon as possible.

Hope you haven't trusted your life on ithttp://www.cfd-online.com/OpenFOAM_D...part/happy.gif

- Niels

yann_delaure March 13, 2008 05:26

Niels, I was reading throug
 
Niels,

I was reading through your codes and I have a quick question about a line in interfaceWeight.H:

points[fProp[fI]].component(1)

Does this return the value of the first component of the point vector. In your test case, the x axis is aligned with the wave tank and the gravity vector is in the y direction. Doesn't this mean that your test to check that the point is above the elevation of the free surface should be made with regard to component(2).
Have I misunderstood the meaning of the component() function?
Thanks
Yann

ngj March 13, 2008 06:14

Hi Yann The componet() coun
 
Hi Yann

The componet() counts from 0, thus 0->x, 1->y and 2->z

Hope ypu have been getting it to work.

- Niels

yann_delaure March 13, 2008 07:12

Niels, Of course, sorry about
 
Niels,
Of course, sorry about that.
Yann

ngj March 16, 2008 14:24

Hi The bug has now been cor
 
Hi

The bug has now been corrected and the boundary condition can be found following the link at the top of this thread.
A second order stokes wave has been implemented, which resulted in an additional keyword in the environmental-dictionary, namely waveType. It has to be either StokesFirst or StokesSecond. At second order wavenumber, etc is the same as for first order.

Have fun,

Niels

chiggins June 5, 2008 12:08

Hi Niels, I am very keen to
 
Hi Niels,

I am very keen to look at the boundary conditions you have created but I cant access the link supplied:

http://www.student.dtu.dk/~s001581/f...BasedBC.tar.gz

Are you able to email it to me?

Cheers
Charlotte

ngj June 6, 2008 03:03

Hi Charlotte My initials ha
 
Hi Charlotte

My initials have been changed, so please replace "s001581" with "ngja" and you should be able to access the files.

Best regards,

Niels

ngj June 8, 2008 11:47

Hi Charlotte I have ended u
 
Hi Charlotte

I have ended up with setting the velocity in the air to zero in each time step, as discussed in [1] p. 11.

The reason for this is that I never got around to control the air velocities at the inlet. Large and unphysical velocities appear if such means are not taken.

Best regards,

Niels

[1]. http://vtchl.uiuc.edu/~liu19/publications/scour.pdf

ben_wraight October 3, 2008 06:38

Hi I'm new to OpenFoam and
 
Hi

I'm new to OpenFoam and i'm having difficulty applying these boundary conditions. Eventually I'd like to place an aerofoil into a wave tank, but initially I'm trying to use a wave tank with a cylinder inside it. I've built the mesh and the tank is producing waves, however the waves are generating from the centre creating 2 sets of waves. Does anyone know why this is happening and how I would go about generating the waves from the left hand side of my tank.

Thanks
Ben

ngj October 3, 2008 07:19

Hi Waves are generated at x
 
Hi

Waves are generated at x=0 at default (a.k.a. hard-coded).

- Niels

ngj October 3, 2008 07:20

Sorry, that does not make sens
 
Sorry, that does not make sense, as internal generation of waves sound pretty weird. You need to elaborate on the problem, otherwise we will not be able to help you.
A screen-dump or similar would be helpful.

- Niels

ben_wraight October 3, 2008 07:36

The screen shot shows how the
 
The screen shot shows how the waves are mirrored about x = 0. The mesh I built starts at x = -2. If I rebuild the mesh to start at x = 0, should the waves generate from the far left of my mesh?

file:///home/ben/OpenFOAM/ben-1.5/run/tutorials/interFoam/wavecylinder/wavecylin der/wave.0002.jpg

Thanks

Ben

ben_wraight October 3, 2008 07:42

Sorry, here is the screen h
 
Sorry, here is the screen

http://pichostonline.com/][img]http://pichostonline.com/u/081003/c1f756d531.jpg[/img][/url]

ngj October 3, 2008 08:40

Hi Are you sure, that you h
 
Hi

Are you sure, that you haven't applied the waveBC to a patch internally, as the boundary conditions are applied to a patch and not in the internal part of the domain.

/ Niels

ben_wraight October 3, 2008 09:20

I don't think so. I tried to a
 
I don't think so. I tried to adapt the test example conditions for the mesh I wanted to use. I assumed that the waves would be generated at the face I assigned as the inlet.

ngj October 3, 2008 09:33

Well, they should be. Otherwis
 
Well, they should be. Otherwise there is a bug I have not tested for.

/ Niels

erik023 October 4, 2008 07:32

Niels, looks like you have so
 
Niels,
looks like you have some really nice BC's and to install them i followed the instructions above.
i did try to compile interFoam adding to the "files" (last two lines):
EXE_LIBS = \
-linterfaceProperties \
-lincompressibleTransportModels \
-lfiniteVolume \
-libsurfaceWavePressureFvPatchScalarField.so \
-libsurfaceWaveVelocityFvPatchScalarField.so

also tried:
-$(FOAM_USER_LIBBIN)libsurfaceWavePressureFvPatchSc alarField.so
and so.
but it does, in the first case, find:
/usr/bin/ld: cannot find -libsurfaceWavePressureFvPatchScalarField.so
in the second case:
g++: unrecognized option '-/home/erik/OpenFOAM/erik-1.5/lib/linuxGccDPOpt/libsurfaceWaveVelocityFvPatchSc alarField'

what can be wrong?
i used the Allmake you made for the catalog i placed in my catalog as you see in the path above.

would be grateful for help!
thank you
Erik

ngj October 4, 2008 08:25

Hi Under the options EXE_LI
 
Hi

Under the options EXE_LIBS add it in the following form:

-lsurfaceWavePressureFvPatchScalarField \
-lsurfaceWaveVelocityFvPatchVectorField

Enjoy your weekend,

Niels

erik023 October 5, 2008 05:00

Niels - Brilliant! Thank you!
 
Niels - Brilliant!
Thank you!

Looking forward to trying this out with my boat in there!

Erik

nicoparo October 13, 2008 11:08

Hi Niels, I am looking at y
 
Hi Niels,

I am looking at your BC implementation and I'd like to use it combined with a non-zero inflow mean velocity (to simulate a boat advancing in a wavy sea). How would you set your 0/U properties for your BC in that case ?

Thanks a lot.

Nicola

erik023 October 15, 2008 12:47

hi! Niels, i have tried to fi
 
hi!
Niels, i have tried to figure out what the sampleSurfaceDict and sampleDict is used for, could you lease explain?
also i run into an error (only when i run first order, but for second order nothing happens but no error either) it says:
MULES: Solving for gamma
Liquid phase volume fraction = 0.4498884 Min(gamma) = 0 Max(gamma) = 1
MULES: Solving for gamma
Liquid phase volume fraction = 0.4498895 Min(gamma) = -8.762161e-22 Max(gamma) = 1
This routine has not yet been implemented
...and so on.
what can i do you think, it seems to come from evaluateFace.H!?
it is when i use snappyhexmesh to make a box (six walls) hanging inside another bigger box and then run it with this setup. could it be the size of the mesh, it is quite big cells?

any help would be appreciated!
thank you
Erik

ngj October 17, 2008 11:26

Hi Sorry for the late resp
 
Hi

Sorry for the late response, but I am currently out-of-sync with the forum and will continue to be so for some time.

@Nicola

I would locate an appropriate theory for wave and currents and implement it.
I would suggest to start looking for a potential theory solution, even though one could question the validity of the vertical velocity profile.

@Erik

The reason for "This routine has not yet been implemented" is, that the "horizontal" edges in your boundary faces are not truly horizontal. It is a missing piece, which I know needs to be implemented, but have not had the time and/or need to do it.

sample*Dict are for postprocessing purposes only and will properly not work for 1.5, as the sample utility has been reimplemented by combined both sample and sampleSurfaces into one.

Hope it clears the uncertainties.

Have a nice weekend,

Niels

ngj October 17, 2008 15:40

Hi Nicola To be a little bi
 
Hi Nicola

To be a little bit more specific, you need to find a theory which takes the current into consideration when determining the dispersion relation, as the current will come in as a first order contribution, and it will result in multiple solutions to the dispersion relations, where one or the other will come into play when/if wave blocking occur, e.g. change of propagation direction and wave number with waves over a bar with an opposing current.

Unfortunately I cannot think of any references, but hopefully the above have given you come clues.

Best regards,

Niels

fverworn November 21, 2008 11:10

Hi Niels, thanks for sharin
 
Hi Niels,

thanks for sharing your wave bc! I looked at your testEx and it worked out perfectly (in parallel on four cpus).

I am thinking of using it for my case, but I have triangular faces on the boundary patch (and I need to generate a solitary wave but that's another problem). As I'm new to OpenFoam and C++ - has someone already looked at the "minor part of the method, which hasn't been implemented yet" in order to use arbitrary polygons or are there by any chance updates of your bc?

Thank for any helpful comments in advance.
Franziska

ngj November 25, 2008 13:19

Hi Franziska Well, first of
 
Hi Franziska

Well, first of all, I need to admit that you do not need to have extensive knowledge in C++ to extend the code to cover arbitrary polygons, as my own experience back then was limited and it is therefor written in a C-flavor style.

Further, I can promise you that I will not have time to consider it at least before February;) To explain it in short terms, the part which has not been implemented looks at polygons, which has only one node which intersects the water surface, the rest are either wet or dry. This is not possible to occur if you have horizontally aligned hex-faces as there will either be two or zero intersecting nodes.

The implementation of a solitary wave should be rather straight forward.

Good luck,

Niels

markc January 9, 2009 02:50

Hello All, Great work. Also
 
Hello All,

Great work. Also for me very useful. Some questions and comments:
1. Regarding speed: many of us want to simulate some object in the middle of the domain moving at some speed. This speed is usually supplied at the inlet BC. If I am right Niels tells that he does not know any theory about how to implement this speed. However, isn't this just a matter of adding a fixedValue for Ux on top of the calculated values? You do not change the waves with that, you only make the entire reference frame moving. Or am I wrong?

2. Without having studied the subject very much I had the idea to implement waves by simply supplying a gamma field for every time step at the inlet. Apparantly this thought is too simple but can anyone explain me why this is not correct?

3. Implementation in interFoam: in the user manual, 3.2.6, an explanation is given about how to implement a user created library without having to recompile all individual applications. Has anyone tried this? And secondly: the manual speaks about a src/foamUser directory which is meant for this purpose. However, in my OF-1.5 there is no such directory. Any ideas here?

Brgds,

Mark

ngj January 9, 2009 04:27

Hi Mark Thanks for the posi
 
Hi Mark

Thanks for the positive responsehttp://www.cfd-online.com/OpenFOAM_D...part/happy.gif

ad 1.: Since my last post I have discussed this with one of my supervisors. In stream-function theory by Fenton (cannot recall the year, but it is in the last of the 1980'ies), you can specify a certain flux integrated over the vertical, which is identical to a mean current.
The reason that you cannot add a current directly on top of the solution is, that the current effects the dispersion relation as a first order term! So you could solve the stream function theory coefficients and apply those on your boundary and then you will have some sort of current.
This current will most definitely not be the one you see in nature, as the profile originates from potential theory and thus do not include turbulence, which is indeed present - though it is a good first approximation to get things started.

ad 2.: I do not have a thourough answer, but only applying the gamma field (and I suppose zeroGradient for U and pd?), it would be the same as having a free surface channel flow with no body-force and only zeroGradient on all terms, which will not drive the wanted flow, as you do not apply neither momentum nor acceleration at the boundary.

ad 3.: I have not looked into it as it has been less prioritated than anything else, thus I cannot help you with that.

Best regards,

Niels

tian January 10, 2009 02:45

Hi Niels, it is also possib
 
Hi Niels,

it is also possible to use your libs for OF 1.5? I tried it but I always got this error also:

/usr/bin/ld: cannot find -libsurfaceWavePressureFvPatchScalarField.so

this happen if I try to recompile interFoam. I adjusted the "option" file like as per description.

Maybe somebody was successfull in OF 1.5 and can give me some advice.

Thanks a lot

Bye
Thomas

sxhdhi January 11, 2009 22:37

Hi Mark, I am also trying t
 
Hi Mark,

I am also trying to add Niels's new Wave BC to interFoam using OF 1.5 on Ubuntu 8.10.

Now I have recompiled interFOAM already. I am about to run it...

I think you should meet a problem because I've got them during my doing. Regarding "foamUser", Yes, your are right, there is no such folder in OF 1.5. Therefore, my treatment is to recompile interFOAM. You may meet the problem when you wmake those new BC libs, there are no such files cpuTime.H and cpuTime.C. Then again my treatment is to search them through OpenFOAM document and copy them into ..\OpenFOAM-1.5\src\finiteVolume\InInclude\. After that you can try to recompile interFOAM following Niels's suggestion.

--------------------------------------------------------------


Hi Niels,

Thanks a lot for your new Wave BC. I am trying to run it then apply it into a real case.

I have successfully recompiled interFOAM. But there is an error when I run it:

Create time

Create mesh for time = 0


Reading environmentalProperties
Reading field pd



keyword waveType is undefined in dictionary "/home/user/OpenFOAM/OpenFOAM-1.5/sxh-1.5/run/VOF_BC/testExample/constant/enviro nmentalProperties"

file: /home/user/OpenFOAM/OpenFOAM-1.5/sxh-1.5/run/VOF_BC/testExample/constant/environ mentalProperties from line 25 to line 30.

From function dictionary::lookupEntry(const word& keyword) const
in file db/dictionary/dictionary.C at line 213.

FOAM exiting

May I get your advice about this, Thanks in advance.

Regards

Xiaohui

markc January 12, 2009 01:53

Hello All, I managed to bui
 
Hello All,

I managed to build the BC in OF1.5, I do not have access to that specific computer right now, there was indeed something with a name change or so but anyway it worked very easy.
But still my question: is it possible to build the BC as a user_lib so that it is accessible for all solvers? Well, as time allows I will just try it.
Last thing Xiaohui: your error message says exactly what is going wrong: as Niels you have to define waveType in the dictionary.

Brgds,

Mark

sxhdhi January 12, 2009 01:54

Dear Niels, Your new BC is
 
Dear Niels,

Your new BC is working by adding waveType into EnvironmentalProperties file. The test case is running now. I run the case by serial not Parallel, so a bit of slowly.

I am thinking of adding uniform flux BC in inlet based on your code. Do you think it is feasible?

Regards

Xiaohui

ngj January 12, 2009 06:58

----------------- I am thinki
 
-----------------
I am thinking of adding uniform flux BC in inlet based on your code. Do you think it is feasible?
-----------------

If you want to add a uniform flux inlet, then wouldn't it be significantly more easy to used fixedValue on the velocity field?

Otherwise you need to elaborate on the question.

Best regards,

Niels

fverworn January 29, 2009 06:16

Hi Niels, sorry for asking
 
Hi Niels,

sorry for asking again, you said earlier you were setting the velocity in the air to zero in each time step in your bc. I'm probably at a complete loss, but how did you achieved that.

Thanks in advance,
Franziska

fverworn January 29, 2009 06:19

Hi Niels, sorry for asking
 
Hi Niels,

sorry for asking again, you said earlier you were setting the velocity in the air to zero in each time step in your bc. I'm probably at a complete loss, but how did you achieved that.

Thanks in advance,
Franziska


All times are GMT -4. The time now is 21:57.