CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Community Contributions (https://www.cfd-online.com/Forums/openfoam-community-contributions/)
-   -   [waves2Foam] Waves2Foam Related Topics (https://www.cfd-online.com/Forums/openfoam-community-contributions/100091-waves2foam-related-topics.html)

Sagun November 13, 2012 11:01

Thank you so much, both of you. :)

mf. November 14, 2012 12:03

Dear Niels,

I'm interested in simulating moving ships in waves. For this I have experiment with waveFoam, stokes waves and combinedWaves and all looks fine for me.

Now to simulate the movement of the ship I will add a constant velocity to the wave velovities in x-dir and move the wave generating boundary time dependent.
To realize this I have tryed to create a new waveType like stokesFirstFwd. I create new folders in waveTheories and setWaveProperties out of the existing folders for stokesFirst. After renaming all files and entries I modify the files file and compiled all with wmake libso. (I have tryed this method, because creating new BC's will working in this way) The compiling works fine but when I uses the new wavetype I get this message.

Quote:

[1] --> FOAM FATAL ERROR:
[1] Unknown wave theory type stokesFirstFwd
..
[1] From function waveTheory::New(const word &, const fvMesh &)
[1] in file waveTheories/waveTheory/newWaveTheory.C at line 68.
After this I checked the linux64GccDPOpt folder and there are no files generated for the new wavetype. Could it be that I have to modify the newWaveTheory.C too? I guess I do something wrong.

Thank you for this toolbox, it looks like a lot of work till keep this code going. (out of my limited view in programming)

Kind regards
Marco

ngj November 14, 2012 14:33

Hi Marco,

It sounds as if you have done the right thing. I do not know about the missing object file in case you have actually renamed all the files.

What about the lines including
Code:

defineTypeNameAndDebug(stokesFirst, 0);
addToRunTimeSelectionTable(waveTheory, stokesFirst, dictionary);

have you remembered to change the name there?

Otherwise, you might have made a mistake in your Make/files file.

This is all I can think of.

/ Niels

mf. November 14, 2012 15:18

Hi Niels,

I checked the files again, it seems to be ok. I modify the Make/files file in the main folder of wave2Foam were the waveTheories and relaxationZone folders are locaded. There I added only the two lines

Quote:

$(waveTheories)/$(regular)/stokesFirstFwd/stokesFirstFwd.C
$(waveProp)/$(regular)/stokesFirstFwdProperties/stokesFirstFwdProperties.C
did I miss something? Only to make it clear I didn't need to modify the newWaveTheory.C.

thanks again
Marco

ngj November 14, 2012 16:14

Hi Marco,

You are doing the same thing, as I would have done in the case of adding a new wave theory.

Could I get you to type "wclean all" in the waves2Foam-directory and then recompile everything.

You could also see, if you are able to run setWaveParameters, and if this is successful, then the problem is only related to the waveTheory.

Correct, you do not need to change newWaveTheory.C - this is the beauty of the runtime selection in OpenFoam, which I am benefiting from.

/ Niels

rosswin November 19, 2012 13:17

waveFoam install
 
Dear Niels,

I have been getting this error in my log files for waveFoam.

Quote:

/opt/openfoam171/bin/tools/RunFunctions: line 45: waveFoam: command not found
I am assuming I have made a mistake in the install however I have followed all the instructions on the wiki.
I have the OpenFoam version: 1.7.1.
Linux version: Ubuntu 12.04

Is there any other information that I should provide?
I have tried searching the forum, but I haven't managed to find any similar threads.

Thanks
Regards
Ross

ngj November 19, 2012 13:57

Hi Ross,

Can you provide us with the output from the run of the Allwmake script in the waves2Foam directory.

It seems that something went wrong during the compilation somewhere.

Kind regards,

Niels

rosswin November 19, 2012 14:08

Hi Niels

I don't have a record of the first compilation of ./Allwmake so I compiled it again. I hope this is ok. If not I can uninstall and reinstall waves2Foam.

Quote:

ross@ubuntu:~/waves2Foam$ ./Allwmake | tee log
'/home/ross/OpenFOAM/ross-1.7.1/lib/linux64GccDPOpt/libwaves2Foam.so' is up to date.
./Allwmake: line 47: cd: applications/solvers/solvers171: No such file or directory
make[1]: Entering directory `/home/ross/waves2Foam/applications/utilities/misc'
make[2]: Entering directory `/home/ross/waves2Foam/applications/utilities/misc/matlab'
make[3]: Entering directory `/home/ross/waves2Foam/applications/utilities/misc/matlab/postprocessing'
make[3]: Nothing to be done for `application'.
make[3]: Leaving directory `/home/ross/waves2Foam/applications/utilities/misc/matlab/postprocessing'
make[3]: Entering directory `/home/ross/waves2Foam/applications/utilities/misc/matlab/preprocessing'
make[3]: Nothing to be done for `application'.
make[3]: Leaving directory `/home/ross/waves2Foam/applications/utilities/misc/matlab/preprocessing'
make[2]: Leaving directory `/home/ross/waves2Foam/applications/utilities/misc/matlab'
make[1]: Leaving directory `/home/ross/waves2Foam/applications/utilities/misc'
make[1]: Entering directory `/home/ross/waves2Foam/applications/utilities/postProcessing'
make[2]: Entering directory `/home/ross/waves2Foam/applications/utilities/postProcessing/surfaceElevation'
make[2]: `/home/ross/OpenFOAM/ross-1.7.1/applications/bin/linux64GccDPOpt/surfaceElevation' is up to date.
make[2]: Leaving directory `/home/ross/waves2Foam/applications/utilities/postProcessing/surfaceElevation'
make[1]: Leaving directory `/home/ross/waves2Foam/applications/utilities/postProcessing'
make[1]: Entering directory `/home/ross/waves2Foam/applications/utilities/preProcessing'
make[2]: Entering directory `/home/ross/waves2Foam/applications/utilities/preProcessing/relaxationZoneLayout'
make[2]: `/home/ross/OpenFOAM/ross-1.7.1/applications/bin/linux64GccDPOpt/relaxationZoneLayout' is up to date.
make[2]: Leaving directory `/home/ross/waves2Foam/applications/utilities/preProcessing/relaxationZoneLayout'
make[2]: Entering directory `/home/ross/waves2Foam/applications/utilities/preProcessing/setWaveField'
make[2]: `/home/ross/OpenFOAM/ross-1.7.1/applications/bin/linux64GccDPOpt/setWaveField' is up to date.
make[2]: Leaving directory `/home/ross/waves2Foam/applications/utilities/preProcessing/setWaveField'
make[2]: Entering directory `/home/ross/waves2Foam/applications/utilities/preProcessing/setWaveParameters'
make[2]: `/home/ross/OpenFOAM/ross-1.7.1/applications/bin/linux64GccDPOpt/setWaveParameters' is up to date.
make[2]: Leaving directory `/home/ross/waves2Foam/applications/utilities/preProcessing/setWaveParameters'
make[1]: Leaving directory `/home/ross/waves2Foam/applications/utilities/preProcessing'
Thank you for your help.

Regards
Ross

ngj November 19, 2012 14:16

Hi Ross

It is me being unaware of the 1.7.1 version. Could you please test the following for me:

1. Go to waves2Foam/applications/solvers

2. Do in the command line:
Code:

cp -r solvers170 solvers171
cd solvers171
find ./ -name ".svn" | xargs rm -rf
cd waveFoam
wclean
wmake

This should make a clean directory accessible for the Allwmake script. The "find" command is for cleaning it for svn-related files.

If everything compiles nicely, then please notify me, and I will make it a part of the repository. If it does not work, then you have to follow the instructions on the wiki on how to modify interFoam into waveFoam.

Kind regards,

Niels

rosswin November 19, 2012 15:00

Hi Niels

No luck with that unfortunately.

I followed the wiki instructions to modify interFoam to WaveFoam but that didn't work either.

I got this result after wclean and wmake
Quote:

ross@ubuntu:~/OpenFOAM/waveFoam$ wclean all
wclean ./
ross@ubuntu:~/OpenFOAM/waveFoam$ wmake
/bin/sh: 1: cannot open Replace: No such file
SOURCE=waveFoam.C ; g++ -m64 -Dlinux64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3 -DNoRepository -ftemplate-depth-40 -I/opt/openfoam171/src/transportModels -I/opt/openfoam171/src/transportModels/incompressible/lnInclude -I/opt/openfoam171/src/transportModels/interfaceProperties/lnInclude -I/opt/openfoam171/src/turbulenceModels/incompressible/turbulenceModel -I/opt/openfoam171/src/finiteVolume/lnInclude -DOFVERSION=<Replace brackets with the first two digits in the OF-version number> -I./../../../../src/lnInclude -IlnInclude -I. -I/opt/openfoam171/src/OpenFOAM/lnInclude -I/opt/openfoam171/src/OSspecific/POSIX/lnInclude -fPIC -c $SOURCE -o Make/linux64GccDPOpt/waveFoam.o
/bin/sh: 1: cannot open Replace: No such file
make: *** [Make/linux64GccDPOpt/waveFoam.o] Error 2
Thanks

Ross

ngj November 19, 2012 15:09

Ross,

Please try to read the following line. This is incorrect

Code:

-DOFVERSION=<Replace brackets with the first two digits in the OF-version number> \
Replace it with

Code:

-DOFVERSION=171 \
/ Niels

P.S. Wiki is updated, as it should read "the first three digits".

rosswin November 19, 2012 15:16

Hi Niels

Sorry to bother you again. I know I am making silly mistakes. I haven't been using OpenFoam for very long.

I have got another error.

Quote:

ross@ubuntu:~/OpenFOAM/waveFoam$ wclean all
wclean ./
ross@ubuntu:~/OpenFOAM/waveFoam$ wmake
Making dependency list for source file waveFoam.C
could not open file relaxationZone.H for source file waveFoam.C
could not open file readWaveProperties.H for source file waveFoam.C
SOURCE=waveFoam.C ; g++ -m64 -Dlinux64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3 -DNoRepository -ftemplate-depth-40 -I/opt/openfoam171/src/transportModels -I/opt/openfoam171/src/transportModels/incompressible/lnInclude -I/opt/openfoam171/src/transportModels/interfaceProperties/lnInclude -I/opt/openfoam171/src/turbulenceModels/incompressible/turbulenceModel -I/opt/openfoam171/src/finiteVolume/lnInclude -DOFVERSION=171 -I./../../../../src/lnInclude -IlnInclude -I. -I/opt/openfoam171/src/OpenFOAM/lnInclude -I/opt/openfoam171/src/OSspecific/POSIX/lnInclude -fPIC -c $SOURCE -o Make/linux64GccDPOpt/waveFoam.o
waveFoam.C:47:28: fatal error: relaxationZone.H: No such file or directory
compilation terminated.
make: *** [Make/linux64GccDPOpt/waveFoam.o] Error 1
Thanks
Ross

ngj November 19, 2012 15:23

The line

Code:

-I./../../../../src/lnInclude
is a relative path pointing to the waves2Foam/src/lnInclude directory. If you place the solver in another relative location, then this line has to be changed accordingly.

The relative path assumes that you places the solver-directory in the same location as waveFoam for the other OF-versions. In your case
Code:

waves2Foam/applications/solvers/solvers171
/ Niels

kev4573 November 20, 2012 13:15

Hi Niels,

I noticed that when using the setWaveParameters utility, a temporary file called wavePropertiesTEMP is written to, then moved to waveProperties. This is usually fine, though if the Foam::mv( ) operation fails, the utility does not report that back to the user. It might be good to have some error handling there, to either throw a fatal error, or at least alert the user that moving the file failed.

Kind regards,
Kevin

ngj November 20, 2012 13:43

Hi Kevin

True. Have you experienced that the move is not successful? This would be extremely unfortunate, since you would loose everything? Or is the temp file still preserved?

One of my colleagues asked for a backup of the old waveProperties file, which will be added to the repository at some time.

Kind regards,

Niels

kev4573 November 20, 2012 14:53

This happened recently while I was working inside a virtualbox VM, with the case residing in a host OS shared folder.. So I was doing something a bit out of the ordinary :) . The temp file remained after running the utility and the original waveProperties file was intact. Once I moved the case to a guest partition on the VM, everything worked fine.

I've been using the *.org file pattern to keep the original wave file around.

Kevin

ngj November 20, 2012 15:40

Hi Kevin

I see. It was a bit of a special operation, but it should nonetheless be supported. So, I am thinking aloud; would this work:

1. Read from a waveProperties.input file. This file contains the needed input parameters.

2. Run setWaveParameters and the file waveProperties is written (no move operation).

3. Setting of wave parameters is done, and the two files waveProperties.input and waveProperties are still in <case>/constant.

It makes sense to do it this way, especially when using e.g. irregular waves, then the waveProperties.input gives the possibility of a quick view on the parameters.

Kind regards,

Niels

kev4573 November 20, 2012 16:22

Niels,

I'm personally okay with manually copying the waveProperties.org file, since I already do this sort of thing with the fields in the zero directory. I think your proposed approach makes sense anyway.

Kevin

ngj November 20, 2012 16:50

Hi Kevin

Good, I will put it on my waves2Foam-TODO.

With respect the need of two files during the running of setWaveParameters, then the reason is very simple.

Previously, I wrote generated wave parameters of the type Field<Type> to a separate file using the IOField<Type> method in OpenFoam. However, it turned out that it worked perfectly in serial, but for versions >= 2.0, the data files could suddenly not be read in parallel. In order to overcome this problem, those of my colleagues who are running irregular waves, had to run setWaveParameters and manually copy the data into waveProperties. The need of IOField<Type> is due to a restriction in the IOdictionary format, which does not support adding a nonuniform List<Type> to the dict. It was added per say, however, as a raw list without any formatting. For some reason the data was then read in the waveTheory as a bunch of zeros.

As the practical work-around was too cumbersome and error-prone, I am now writing a completely fresh waveProperties file, where all the data are either read from the source file or computed in setWaveProperties. This gives me complete control over the output format, hence it is also possible to have nonuniform fields in the output - so parallel runs can be executed.

The drawback is that the final waveProperties file is stripped of all comments, etc, since each derived class from setWaveProperties know exactly, which bits and piece are needed for say stokesSecond - everything else is disregarded.

I hope that someone liked this long explanation :)

Have a nice evening,

Niels

niallosully November 21, 2012 11:09

Hi Niels,

I am preforming pimplefoam LES simulations of airflow over research vessels and wanted to implement the wave2foam at the air-sea interface. my question is it possible to apply a uniforminletvelocity at the air section of the wave2foam simulation using this type of simulation with a K-epsilon model in place and would you have any pointers on where i would start changing the waves2foam tutorials to achieve this.

Niall


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