CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Community Contributions

[waves2Foam] Compiling waves2Foam for OF8

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 12, 2022, 09:31
Default Compiling waves2Foam for OF8
  #1
New Member
 
Kai Siebo
Join Date: Mar 2022
Posts: 12
Rep Power: 4
Siebo is on a distinguished road
Hey everyone,

the Institute I work at wants to use the waves2Foam toolbox for wave generation together with OpenFOAM 8, and it is my duty to do it. Has anyone done this before?

My approach is to just try to compile waves2Foam and then go through the output of the terminal to find the errors and correct them. Currently I'm stuck on this error:

Code:
waveTheories/externalWaveForcing/oceanWave3D/oceanWave3D.C:511:53: error: passing ‘const Internal’ {aka ‘const Foam::DimensionedField<double, Foam::surfaceMesh>’} as ‘this’ argument discards qualifiers [-fpermissive]
  511 |         phi.internalField() = phiTemp.internalField();
      |                                                     ^
In file included from /opt/openfoam8/src/OpenFOAM/lnInclude/DimensionedField.H:389,
                 from /opt/openfoam8/src/finiteVolume/lnInclude/fvMesh.H:58,
                 from lnInclude/externalWaveForcing.H:44,
                 from waveTheories/externalWaveForcing/oceanWave3D/oceanWave3D.H:43,
                 from waveTheories/externalWaveForcing/oceanWave3D/oceanWave3D.C:27:
My first problem here is that I can't find the file oceanWave3D.C, I tried using
Code:
find $WM_PROJECT_DIR oceanWave3D.C
and the same for $WAVES_DIR, but there is no such file or directory.

The second problem is that I don't fully understand this error. I looked up the API guide ( https://www.openfoam.com/documentati...onedField.html ) and my explanation for this error so far is that some function tries to change a variable that was declared as constant. Since I can't find the filde oceanWave3D.C I can't see which function that is... So I'm a little bit lost here.

Kind regards
Siebo
Siebo is offline   Reply With Quote

Old   April 13, 2022, 06:37
Default
  #2
New Member
 
Kai Siebo
Join Date: Mar 2022
Posts: 12
Rep Power: 4
Siebo is on a distinguished road
Today I finally managed to find the file oceanWave3D.C in the $WAVES_DIR/applications/utilties/.../externalWaveForcing directory. The fix is way more simpler than I thought. Following the code snippet from oceanWave3D.C from line 500 to 515

Code:
    // Map the phiTemp -> phi
#if EXTBRANCH==1
    phi.internalField() = phiTemp.internalField();
#elif OFPLUSBRANCH==1
    #if OFVERSION<1706
        phi.internalField() = phiTemp.internalField();
    #else
        phi.ref() = phiTemp.internalField();
    #endif
#else
    #if OFVERSION<400
        phi.internalField() = phiTemp.internalField();
    #else
        phi.ref() = phiTemp.internalField();
    #endif
#endif
The bashrc in $WAVES_DIR/bin/bashrc recognizes the OF8 version as $version=80 and thus goes down the if-branch to

Code:
#if OFVERSION<400
This can easily be extended by an appropriate statement for OFVERSION==80 or the bashrc can be adjusted to recognize the OF version as 800 instead of 80.

I think I will try out the bashrc solution first and will edit this post once done.

EDIT:

I changed the bashrc file in $WAVES_DIR/bin/ as follows:

I deleted lines 26 to 31 and replaced it with the following code:

Code:
# The vers_check part is for OpenFOAM versions 5 and later. At the time I implemented this it was done for OpenFOAM 8.

vers_check=`echo $WM_PROJECT_VERSION`

if [ $vers_check -ge 5 ]
then
	if [ `uname` = "Darwin" ]
	then
	    version=`echo $WM_PROJECT_VERSION"-0-0" | sed -e 's/\.x/-0/' -e 's/\./\'$'\n/g' -e 's/[v+-]/\'$'\n/g' | grep "[0-9]" | head -3 | tr -d '\n'`
	else
	    version=`echo $WM_PROJECT_VERSION"-0-0" | sed -e 's/\.x/-0/' -e 's/\./\n/g' -e 's/[v+-]/\n/g' | grep "[0-9]" | head -3 | tr -d '\n'`
	fi
else
	if [ `uname` = "Darwin" ]
	then
	    version=`echo $WM_PROJECT_VERSION"-0" | sed -e 's/\.x/-0/' -e 's/\./\'$'\n/g' -e 's/[v+-]/\'$'\n/g' | grep "[0-9]" | head -3 | tr -d '\n'`
	else
	    version=`echo $WM_PROJECT_VERSION"-0" | sed -e 's/\.x/-0/' -e 's/\./\n/g' -e 's/[v+-]/\n/g' | grep "[0-9]" | head -3 | tr -d '\n'`
	fi
fi

Last edited by Siebo; April 13, 2022 at 11:24.
Siebo is offline   Reply With Quote

Old   April 28, 2022, 13:43
Default
  #3
New Member
 
Kai Siebo
Join Date: Mar 2022
Posts: 12
Rep Power: 4
Siebo is on a distinguished road
I decided to just document my proceedings on this project here, for other people that have similar problems or want to do the same.

The next error line that was generated when compiling with the new changes to the bashrc was as follows:

Code:
waveTheories/externalWaveForcing/oceanWave3D/oceanWave3D.C: In member function ‘void Foam::waveTheories::oceanWave3D::updatePhi()’:
	waveTheories/externalWaveForcing/oceanWave3D/oceanWave3D.C:527:32: error: no match for ‘operator==’ (operand types are
	const Foam::fvsPatchField<double>’ and ‘const Foam::fvsPatchField<double>’)
	  527 |    phi.boundaryField()[patchi] == phiTemp.boundaryField()[patchi];
	In file included from /opt/openfoam8/src/finiteVolume/lnInclude/fvsPatchFields.H:34,
            	 from /opt/openfoam8/src/finiteVolume/lnInclude/surfaceFields.H:41,
                 from /opt/openfoam8/src/finiteVolume/lnInclude/surfaceInterpolationScheme.C:28,
                 from /opt/openfoam8/src/finiteVolume/lnInclude/surfaceInterpolationScheme.H:308,
                 from /opt/openfoam8/src/finiteVolume/lnInclude/surfaceInterpolate.H:41,
                 from /opt/openfoam8/src/finiteVolume/lnInclude/fvc.H:39,
                 from /opt/openfoam8/src/finiteVolume/lnInclude/fvCFD.H:8,
                 from lnInclude/crossVersionCompatibility.H:41,
                 from lnInclude/externalWaveForcing.H:52,
                 from waveTheories/externalWaveForcing/oceanWave3D/oceanWave3D.H:43,
                 from waveTheories/externalWaveForcing/oceanWave3D/oceanWave3D.C:27:
This was resolved by changing line 527 in the file oceanWave3D.C from

Code:
phi.boundaryField()[patchi] == phiTemp.boundaryField()[patchi];
to

Code:
phi.boundaryFieldRef()[patchi] == phiTemp.boundaryField()[patchi];
Siebo is offline   Reply With Quote

Old   April 28, 2022, 13:49
Default
  #4
New Member
 
Kai Siebo
Join Date: Mar 2022
Posts: 12
Rep Power: 4
Siebo is on a distinguished road
The next error was the following:

Code:
fvPatchFields/waveAlpha/waveAlphaFvPatchScalarField.C: In member function ‘virtual void Foam::waveAlphaFvPatchScalarField::write(Foam::Ostream&) const’:
	fvPatchFields/waveAlpha/waveAlphaFvPatchScalarField.C:325:22: error: ‘const class Foam::Field<double>’ has no member named ‘writeEntry’
	  325 |     this->refValue().writeEntry("refValue", os);
	      |                      ^~~~~~~~~~
obviously occuring for every other value of fvPatchField<scalar>::write(os) and fvPatchField<vector>::write(os)

This was resolved by adopting the changed write syntax that was changed from OF6 to OF7. Together with a version comparison the following code was implemented in waveAlphaFvPatchScalarField.C from line 321 onwards

Code:
// Write

// Original Code

//void waveAlphaFvPatchScalarField::write(Ostream& os) const
//{
//    fvPatchField<scalar>::write(os);
//    this->refValue().writeEntry("refValue", os);
//    this->refGrad().writeEntry("refGradient", os);
//    this->valueFraction().writeEntry("valueFraction", os);
//    this->writeEntry("value", os);
//}
//335 to 384 work in progress code for new syntax of OF8

#if EXTBRANCH==1
        void waveAlphaFvPatchScalarField::write(Ostream& os) const
	{
	    fvPatchField<scalar>::write(os);
	    this->refValue().writeEntry("refValue", os);
	    this->refGrad().writeEntry("refGradient", os);
	    this->valueFraction().writeEntry("valueFraction", os);
	    this->writeEntry("value", os);
	}
#elif OFPLUSBRANCH==1
    #if OFVERSION<1706
        void waveAlphaFvPatchScalarField::write(Ostream& os) const
	{
	    fvPatchField<scalar>::write(os);
	    this->refValue().writeEntry("refValue", os);
	    this->refGrad().writeEntry("refGradient", os);
	    this->valueFraction().writeEntry("valueFraction", os);
	    this->writeEntry("value", os);
	}
    #else
        void waveAlphaFvPatchScalarField::write(Ostream& os) const
	{
	    fvPatchField<scalar>::write(os);
	    this->refValue().writeEntry("refValue", os);
	    this->refGrad().writeEntry("refGradient", os);
	    this->valueFraction().writeEntry("valueFraction", os);
	    this->writeEntry("value", os);
	}
    #endif
#else
    #if OFVERSION>699
        void waveAlphaFvPatchScalarField::write(Ostream& os) const
	{
	    fvPatchField<scalar>::write(os);
	    writeEntry(os,"refValue",refValue());
	    writeEntry(os,"refGradient",refGrad());
	    writeEntry(os,"valueFraction",valueFraction());
	    writeEntry(os,"value",*this);
	}
    #else
        void waveAlphaFvPatchScalarField::write(Ostream& os) const
	{
	    fvPatchField<scalar>::write(os);
	    this->refValue().writeEntry("refValue", os);
	    this->refGrad().writeEntry("refGradient", os);
	    this->valueFraction().writeEntry("valueFraction", os);
	    this->writeEntry("value", os);
	}
    #endif
#endif

EDIT: Another error of the same kind occured, so for completeness of this thread I'm adding the fix here as well.

The error:

Code:
preProcessing/setWaveProperties/irregular/waveSpectra/waveSpectra.C: In member function ‘void Foam::waveSpectra::writeSpectrum(Foam::Ostream&, const scalarField&, const scalarField&) const’:
	preProcessing/setWaveProperties/irregular/waveSpectra/waveSpectra.C:102:11: error: ‘const scalarField’ {aka ‘const class Foam::Field<double>’} has no member named ‘writeEntry’
	  102 |         S.writeEntry("spectramValues", os);
	      |           ^~~~~~~~~~
	preProcessing/setWaveProperties/irregular/waveSpectra/waveSpectra.C:105:14: error: ‘const scalarField’ {aka ‘const class Foam::Field<double>’} has no member named ‘writeEntry’
	  105 |         freq.writeEntry("fspectrum", os);
	      |              ^~~~~~~~~~
	make: *** [/opt/openfoam8/wmake/rules/General/transform:26: Make/linux64GccDPInt32Opt/preProcessing/setWaveProperties/irregular/waveSpectra/waveSpectra.o] Error 1
The fix in $WAVES_DIR/src/waves2FoamProcessing/preProcessing/setWaveProperties/irregular/waveSpectra/waveSpectra.C starting at line 102

Code:
//Original Code
        //S.writeEntry("spectramValues", os);
        //os << nl;

        //freq.writeEntry("fspectrum", os);
        //os << nl;
        
        #if EXTBRANCH==1
	S.writeEntry("spectramValues", os);
	os << nl;

	freq.writeEntry("fspectrum", os);
	os << nl;
		
	#elif OFPLUSBRANCH==1
	    #if OFVERSION<1706
		S.writeEntry("spectramValues", os);
		os << nl;

		freq.writeEntry("fspectrum", os);
		os << nl;
		
	    #else
		S.writeEntry("spectramValues", os);
		os << nl;

		freq.writeEntry("fspectrum", os);
		os << nl;
		
	    #endif
	#else
	    #if OFVERSION>699
		writeEntry(os,"spectramValues",S);
		os << nl;

		writeEntry(os,"fspectrum",freq);
		os << nl;    
		    		
	    #else
		S.writeEntry("spectramValues", os);
		os << nl;

		freq.writeEntry("fspectrum", os);
		os << nl;
		
	    #endif
	#endif

Last edited by Siebo; April 30, 2022 at 09:45.
Siebo is offline   Reply With Quote

Old   April 30, 2022, 11:44
Default
  #5
New Member
 
Kai Siebo
Join Date: Mar 2022
Posts: 12
Rep Power: 4
Siebo is on a distinguished road
I also got this warning:

Code:
g++ -std=c++11 -m64 -Dlinux64 -DWM_ARCH_OPTION=64 -DWM_DP -DWM_LABEL_SIZE=32 -Wall -Wextra -Wold-style-cast -Wnon-virtual-dtor -Wno-unused-parameter -Wno-invalid-offsetof -Wno-attributes -O3  -DNoRepository -ftemplate-depth-100 -DOFVERSION=800 -DEXTBRANCH=0 -DXVERSION=0 -DOFPLUSBRANCH=0 -I/opt/openfoam8/src/finiteVolume/lnInclude -I/opt/openfoam8/src/meshTools/lnInclude -I/opt/openfoam8/src/sampling/lnInclude -I/opt/openfoam8/src/lagrangian/basic/lnInclude -I/opt/openfoam8/src/fileFormats/lnInclude -I/home/kaihi/OpenFOAM/kaihi-8/applications/utilities/waves2Foam/src/waves2Foam/lnInclude -I/usr/include -IlnInclude -I. -I/opt/openfoam8/src/OpenFOAM/lnInclude -I/opt/openfoam8/src/OSspecific/POSIX/lnInclude   -fPIC -c preProcessing/probes/pointDistributions/concatenatedDistribution/concatenatedDistribution.C -o Make/linux64GccDPInt32Opt/preProcessing/probes/pointDistributions/concatenatedDistribution/concatenatedDistribution.o
In file included from preProcessing/probes/pointDistributions/concatenatedDistribution/concatenatedDistribution.C:27:
preProcessing/probes/pointDistributions/concatenatedDistribution/concatenatedDistribution.H: In constructor ‘Foam::concatenatedDistribution::concatenatedDistribution(const Foam::dictionary&)’:
preProcessing/probes/pointDistributions/concatenatedDistribution/concatenatedDistribution.H:63:20: warning: ‘Foam::concatenatedDistribution::ppS_’ will be initialized after [-Wreorder]
   63 |         pointField ppS_;
      |                    ^~~~
preProcessing/probes/pointDistributions/concatenatedDistribution/concatenatedDistribution.H:62:20: warning:   ‘Foam::pointField Foam::concatenatedDistribution::ppE_’ [-Wreorder]
   62 |         pointField ppE_;
      |                    ^~~~
preProcessing/probes/pointDistributions/concatenatedDistribution/concatenatedDistribution.C:48:1: warning:   when initialized here [-Wreorder]
   48 | concatenatedDistribution::concatenatedDistribution
      | ^~~~~~~~~~~~~~~~~~~~~~~~
this was easily fixed by changing line 62 and 63 of $WAVES_DIR/src/waves2FoamProcessing/preProcessing/probes/pointDistributions/concatenatedDistribution/concatenatedDistribution.H

Code:
        pointField ppS_; //original ppE_
        pointField ppE_; //original ppS_
Siebo is offline   Reply With Quote

Old   April 30, 2022, 12:54
Default
  #6
New Member
 
Kai Siebo
Join Date: Mar 2022
Posts: 12
Rep Power: 4
Siebo is on a distinguished road
With the documented changes LAPACK-3.3.1, SPARSKIT2, OCEANWAVE3D, FENTON4FOAM and LIBRARY compiles without error. Next I need to fix the solvers and would be grateful for any kind of help. The output when compiling is as follows:

Code:
=====================================
    COMPILE SOLVERS
=====================================
wmakeLnIncludeAll: running wmakeLnInclude on dependent libraries:
    wmakeLnInclude error: base directory /opt/openfoam8/src/transportModels/twoPhaseMixture/ does not exist
    wmakeLnInclude error: base directory /opt/openfoam8/src/transportModels/incompressible/ does not exist
    wmakeLnInclude error: base directory /opt/openfoam8/src/transportModels/interfaceProperties/ does not exist
    wmakeLnInclude error: base directory /opt/openfoam8/src/TurbulenceModels/turbulenceModels/ does not exist
    wmakeLnInclude error: base directory /opt/openfoam8/src/TurbulenceModels/incompressible/ does not exist
    wmakeLnInclude error: base directory /opt/openfoam8/src/transportModels/immiscibleIncompressibleTwoPhaseMixture/ does not exist
g++ -std=c++11 -m64 -Dlinux64 -DWM_ARCH_OPTION=64 -DWM_DP -DWM_LABEL_SIZE=32 -Wall -Wextra -Wold-style-cast -Wnon-virtual-dtor -Wno-unused-parameter -Wno-invalid-offsetof -Wno-attributes -O3  -DNoRepository -ftemplate-depth-100 -I/opt/openfoam8/src/transportModels/twoPhaseMixture/lnInclude -I/opt/openfoam8/src/transportModels -I/opt/openfoam8/src/transportModels/incompressible/lnInclude -I/opt/openfoam8/src/transportModels/interfaceProperties/lnInclude -I/opt/openfoam8/src/TurbulenceModels/turbulenceModels/lnInclude -I/opt/openfoam8/src/TurbulenceModels/incompressible/lnInclude -I/opt/openfoam8/src/transportModels/immiscibleIncompressibleTwoPhaseMixture/lnInclude -I/opt/openfoam8/src/finiteVolume/lnInclude -I/opt/openfoam8/src/meshTools/lnInclude -I/opt/openfoam8/src/sampling/lnInclude -DOFVERSION=400 -DEXTBRANCH=0 -DXVERSION=0 -DOFPLUSBRANCH=0 -I/home/kaihi/OpenFOAM/kaihi-8/applications/utilities/waves2Foam/src/waves2Foam/lnInclude -I/usr/include -IlnInclude -I. -I/opt/openfoam8/src/OpenFOAM/lnInclude -I/opt/openfoam8/src/OSspecific/POSIX/lnInclude   -fPIC -c waveFoam.C -o Make/linux64GccDPInt32Opt/waveFoam.o
waveFoam.C:46:10: fatal error: immiscibleIncompressibleTwoPhaseMixture.H: No such file or directory
   46 | #include "immiscibleIncompressibleTwoPhaseMixture.H"
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make: *** [/opt/openfoam8/wmake/rules/General/transform:26: Make/linux64GccDPInt32Opt/waveFoam.o] Error 1
The first block of errors are just about relinking the directories. If any of you have input on how to tackle this problem in a smart way, I would highly aprreciate it. So far I am comparing directories between OF4 and OF8 on openfoam.org C++ source guide.

The relinking of libraries is done so far, the complete options file in $WAVES_DIR/applications/solvers/solvers800/waveFoam/Make/options now looks like this

Code:
EXE_INC = \
    -I$(LIB_SRC)/twoPhaseModels/twoPhaseMixture/lnInclude \
    -I$(LIB_SRC)/transportModels/lnInclude \
    -I$(LIB_SRC)/twoPhaseModels/incompressibleTwoPhaseMixture/lnInclude \
    -I$(LIB_SRC)/twoPhaseModels/interfaceProperties/lnInclude \
    -I$(LIB_SRC)/MomentumTransportModels/momentumTransportModels/lnInclude \
    -I$(LIB_SRC)/MomentumTransportModels/incompressible/lnInclude \
    -I$(LIB_SRC)/twoPhaseModels/immiscibleIncompressibleTwoPhaseMixture/lnInclude \
    -I$(LIB_SRC)/finiteVolume/lnInclude \
    -I$(LIB_SRC)/meshTools/lnInclude \
    -I$(LIB_SRC)/sampling/lnInclude \
    -DOFVERSION=800 \
    -DEXTBRANCH=0 \
    -DXVERSION=$(WAVES_XVERSION) \
    -DOFPLUSBRANCH=0 \
    -I$(WAVES_SRC)/waves2Foam/lnInclude \
    -I$(WAVES_GSL_INCLUDE)

EXE_LIBS = \
    -limmiscibleIncompressibleTwoPhaseMixture \
    -lturbulenceModels \
    -lincompressibleTurbulenceModels \
    -lfiniteVolume \
    -lfvOptions \
    -lmeshTools \
    -lsampling \
    -L$(WAVES_LIBBIN) \
    -lwaves2Foam \
    -L$(WAVES_GSL_LIB) \
    -lgsl \
    -lgslcblas

Last edited by Siebo; May 4, 2022 at 07:58.
Siebo is offline   Reply With Quote

Old   May 12, 2022, 07:59
Default
  #7
New Member
 
Kai Siebo
Join Date: Mar 2022
Posts: 12
Rep Power: 4
Siebo is on a distinguished road
Hey everyone, the next errors were mainly syntax problems or version updates of code files.

First the following error occured:
Code:
waveFoam.C:47:10: fatal error: turbulentTransportModel.H: No such file or directory
   47 | #include "turbulentTransportModel.H"
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~
Fix: In waveFoam.C change the line 47 to

Code:
#include "momentumTransportModel.H"
==============================================

After fixing that, I got a series of errors from createFields.H

Code:
In file included from /opt/openfoam8/src/OpenFOAM/lnInclude/postProcess.H:105,
                 from waveFoam.C:61:
./createFields.H: In function ‘int main(int, char**)’:
./createFields.H:77:9: error: ‘incompressible’ was not declared in this scope
   77 | autoPtr<incompressible::turbulenceModel> turbulence
      |         ^~~~~~~~~~~~~~
For that I had to fix the syntax in createFields.H and add another #include in waveFoam.C

in createFields.H line 47:
Code:
autoPtr<incompressible::momentumTransportModel> turbulence
in waveFoam.C add the following line:
Code:
#include "kinematicMomentumTransportModel.H"
==============================================

After that a series of errors with correctPhi.H occured

Code:
In file included from waveFoam.C:74:
correctPhi.H: In function ‘int main(int, char**)’:
correctPhi.H:9:1: error: no matching function for call to ‘CorrectPhi(Foam::volVectorField&, Foam::surfaceScalarField&, Foam::volScalarField&, Foam::dimensionedScalar, Foam::geometricZeroField, Foam::pimpleControl&)’
    9 | );
      | ^
for that I changed line 75 in waveFoam.C

Code:
#include "CorrectPhi.H" //originally #include "correctPhi.H"
Next, there were a lot of error regarding the functionality of alphaEqn and related files. I won't list them all, for this post's overview sake, but most of them looked similar to these:

Code:
alphaEqn.H:48:37: error: ‘class Foam::immiscibleIncompressibleTwoPhaseMixture’ has no member named ‘cAlpha’
   48 |     surfaceScalarField phic(mixture.cAlpha()*mag(phi/mesh.magSf()));
      |                                     ^~~~~~
alphaEqn.H:51:9: error: ‘icAlpha’ was not declared in this scope; did you mean ‘isalpha’?
   51 |     if (icAlpha > 0)
      |         ^~~~~~~
      |         isalpha
This was simply fixed by copying the alpha code files from interFoam of OF8, for my installation I fixed it by executing the following ubuntu commands in terminal:

Code:
cp /opt/openfoam8/applications/solvers/multiphase/interFoam/alphaEqn.H /home/kaihi/OpenFOAM/kaihi-8/applications/utilities/waves2Foam/applications/solvers/solvers800/waveFoam/
cp /opt/openfoam8/applications/solvers/multiphase/interFoam/alphaEqnSubCycle.H /home/kaihi/OpenFOAM/kaihi-8/applications/utilities/waves2Foam/applications/solvers/solvers800/waveFoam/
cp /opt/openfoam8/applications/solvers/multiphase/interFoam/alphaSuSp.H /home/kaihi/OpenFOAM/kaihi-8/applications/utilities/waves2Foam/applications/solvers/solvers800/waveFoam/
cp /opt/openfoam8/applications/solvers/multiphase/interFoam/rhofs.H /home/kaihi/OpenFOAM/kaihi-8/applications/utilities/waves2Foam/applications/solvers/solvers800/waveFoam/
cp /opt/openfoam8/src/twoPhaseModels/twoPhaseMixture/VoF/createAlphaFluxes.H /home/kaihi/OpenFOAM/kaihi-8/applications/utilities/waves2Foam/applications/solvers/solvers800/waveFoam/
last but not least for this problem I needed to include the new file createAlphaFluxes.H in waveFoam.C. It was added in line 73 (inside the int main block)

Code:
#include "createAlphaFluxes.H"
===============================================

The next error was the following:

Code:
In file included from waveFoam.C:121:
UEqn.H: In function ‘int main(int, char**)’:
UEqn.H:7:21: error: ‘class Foam::IncompressibleMomentumTransportModel<Foam::transportModel>’ has no member named ‘divDevRhoReff’
    7 |       + turbulence->divDevRhoReff(rho, U)
      |                     ^~~~~~~~~~~~~
which was fixed by changing UEqn.H in line 7

Code:
+ turbulence->divDevTau(rho, U)
===============================================

After that an error with the pressure equation occured as well:

Code:
In file included from waveFoam.C:126:
pEqn.H: In function ‘int main(int, char**)’:
pEqn.H:38:29: error: ‘class Foam::fvMesh’ has no member named ‘solver’; did you mean ‘Foam::dictionary Foam::solution::solvers_’? (not accessible from this context)
   38 |         p_rghEqn.solve(mesh.solver(p_rgh.select(pimple.finalInnerIter())));
      |                             ^~~~~~
In file included from /opt/openfoam8/src/finiteVolume/lnInclude/fvSolution.H:37,
                 from /opt/openfoam8/src/finiteVolume/lnInclude/fvMesh.H:56,
                 from /opt/openfoam8/src/finiteVolume/lnInclude/fvCFD.H:7,
                 from waveFoam.C:40:
which was easily "solved" by changing line 38 of pEqn.H

Code:
p_rghEqn.solve(); // originally p_rghEqn.solve(mesh.solver(p_rgh.select(pimple.finalInnerIter())));
Siebo is offline   Reply With Quote

Old   May 12, 2022, 08:06
Default
  #8
New Member
 
Kai Siebo
Join Date: Mar 2022
Posts: 12
Rep Power: 4
Siebo is on a distinguished road
The current error I am stuck with is the following:

Code:
g++ -std=c++11 -m64 -Dlinux64 -DWM_ARCH_OPTION=64 -DWM_DP -DWM_LABEL_SIZE=32 -Wall -Wextra -Wold-style-cast -Wnon-virtual-dtor -Wno-unused-parameter -Wno-invalid-offsetof -Wno-attributes -O3  -DNoRepository -ftemplate-depth-100 -I/opt/openfoam8/src/twoPhaseModels/twoPhaseMixture/lnInclude -I/opt/openfoam8/src/transportModels/lnInclude -I/opt/openfoam8/src/twoPhaseModels/incompressibleTwoPhaseMixture/lnInclude -I/opt/openfoam8/src/twoPhaseModels/interfaceProperties/lnInclude -I/opt/openfoam8/src/MomentumTransportModels/momentumTransportModels/lnInclude -I/opt/openfoam8/src/MomentumTransportModels/incompressible/lnInclude -I/opt/openfoam8/src/twoPhaseModels/immiscibleIncompressibleTwoPhaseMixture/lnInclude -I/opt/openfoam8/src/finiteVolume/lnInclude -I/opt/openfoam8/src/meshTools/lnInclude -I/opt/openfoam8/src/sampling/lnInclude -DOFVERSION=800 -DEXTBRANCH=0 -DXVERSION=0 -DOFPLUSBRANCH=0 -I/home/kaihi/OpenFOAM/kaihi-8/applications/utilities/waves2Foam/src/waves2Foam/lnInclude -I/usr/include -IlnInclude -I. -I/opt/openfoam8/src/OpenFOAM/lnInclude -I/opt/openfoam8/src/OSspecific/POSIX/lnInclude   -fPIC -fuse-ld=bfd -Xlinker --add-needed -Xlinker --no-as-needed Make/linux64GccDPInt32Opt/waveFoam.o -L/opt/openfoam8/platforms/linux64GccDPInt32Opt/lib \
    -limmiscibleIncompressibleTwoPhaseMixture -lturbulenceModels -lincompressibleTurbulenceModels -lfiniteVolume -lfvOptions -lmeshTools -lsampling -L/home/kaihi/OpenFOAM/kaihi-8/platforms/linux64GccDPInt32Opt/lib -lwaves2Foam -L/usr/lib64 -lgsl -lgslcblas -lOpenFOAM -ldl  \
     -lm -o /home/kaihi/OpenFOAM/kaihi-8/platforms/linux64GccDPInt32Opt/bin/waveFoam
/usr/bin/ld.bfd: cannot find -lturbulenceModels
/usr/bin/ld.bfd: cannot find -lincompressibleTurbulenceModels
collect2: error: ld returned 1 exit status
make: *** [/opt/openfoam8/wmake/makefiles/general:142: /home/kaihi/OpenFOAM/kaihi-8/platforms/linux64GccDPInt32Opt/bin/waveFoam] Error 1
As always, I am glad for any input or even smarter solutions to my previous problems. Once I find the fix the this I will edit it in this post.

fixed by changing line 21 and line 22 of file /home/kaihi/OpenFOAM/kaihi-8/applications/utilities/waves2Foam/applications/solvers/solvers800/waveFoam/Make/options

Code:
-lmomentumTransportModels \
-lincompressibleMomentumTransportModels \

Last edited by Siebo; May 16, 2022 at 12:06.
Siebo is offline   Reply With Quote

Old   May 16, 2022, 12:50
Default
  #9
New Member
 
Kai Siebo
Join Date: Mar 2022
Posts: 12
Rep Power: 4
Siebo is on a distinguished road
So with the steps documented above, wave2foam compiles without error messages. Next I will try to get a wave2foam tutorial case to work on OF8. For that I will use the simplest case of a standing wave which is found in $WAVES_DIR/tutorials/waveFoam/standingWave

just trying to run this from scratch yields the following:

Code:
> blockMesh
works fine, no errors

Code:
> setWaveParameters
works fine, no errors

Code:
> setWaveField
yields following output:

Code:
kaihi@DESKTOP-LRQENFN:~/OpenFOAM/kaihi-8/run/standingWave$ setWaves
/*---------------------------------------------------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     | Website:  https://openfoam.org
    \\  /    A nd           | Version:  8
     \\/     M anipulation  |
\*---------------------------------------------------------------------------*/
Build  : 8-1c9b5879390b
Exec   : setWaves
Date   : May 16 2022
Time   : 17:18:20
Host   : "DESKTOP-LRQENFN"
PID    : 5212
I/O    : uncollated
Case   : /home/kaihi/OpenFOAM/kaihi-8/run/standingWave
nProcs : 1
sigFpe : Enabling floating point exception trapping (FOAM_SIGFPE).
fileModificationChecking : Monitoring run-time modified files using timeStampMaster (fileModificationSkew 10)
allowSystemOperations : Allowing user-supplied system call operations

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time

Create mesh for time = 0



--> FOAM FATAL ERROR:
cannot find file "/home/kaihi/OpenFOAM/kaihi-8/run/standingWave/system/fvSchemes"

    From function virtual Foam::autoPtr<Foam::ISstream> Foam::fileOperations::uncollatedFileOperation::readStream(Foam::regIOobject&, const Foam::fileName&, const Foam::word&, bool) const
    in file global/fileOperations/uncollatedFileOperation/uncollatedFileOperation.C at line 538.

FOAM exiting
This was quite easy to resolve. Just copy the fvSchemes.30 and fvSolution.30 files from the fvFiles directory. Once running the setWaveField command again, the openfoam is suggesting using the new syntax. So I changed the fvSolution to the new syntax which looks like this:

Code:
    U
    {
        solver	         PBiCG;
        preconditioner   DILU;
        tolerance        1e-09;
        relTol           0;
    };
Upon running setWaveField again, openfoam is complaining about the missing "transportProperties" file, which can be found in the $WAVES_DIR/tutorials/commonFiles/transportProperties.23 directory. Just copy this into the standingWave/constant/ directory.

Now I can use setWaveField without errors. The waveFoam command starts the calculation and runs just fine

So now we are finally done with porting waves2foam to OF8, I hope me documenting the steps will help someone in the future

Last edited by Siebo; May 18, 2022 at 08:04.
Siebo is offline   Reply With Quote

Old   November 26, 2022, 11:06
Default
  #10
New Member
 
Lige Zhao
Join Date: Nov 2022
Posts: 2
Rep Power: 0
Lige is on a distinguished road
hello,Siebo, thanks for your sharing.
I also met errors when complied waves2Foam with OpenFOAM1912 using Ubuntu virtual system on Windows.
when I complie the "OceanWav3D" in "ThirdParty" folder, I met the error:

Type mismatch between actual argument at (1) and actual argument at (2) (INTEGER(4)/REAL(8)).
make: *** [makefile:138:ORDERINGS/ccn.o] error 1
mv:'libskit_gfortran.a' folder state (stat): No such file or directory


Do you have any idea of this error? really appreciate any suggestions.
Lige is offline   Reply With Quote

Old   January 4, 2023, 06:07
Default
  #11
New Member
 
Kai Siebo
Join Date: Mar 2022
Posts: 12
Rep Power: 4
Siebo is on a distinguished road
Quote:
Originally Posted by Lige View Post
hello,Siebo, thanks for your sharing.
I also met errors when complied waves2Foam with OpenFOAM1912 using Ubuntu virtual system on Windows.
when I complie the "OceanWav3D" in "ThirdParty" folder, I met the error:

Type mismatch between actual argument at (1) and actual argument at (2) (INTEGER(4)/REAL(8)).
make: *** [makefile:138:ORDERINGS/ccn.o] error 1
mv:'libskit_gfortran.a' folder state (stat): No such file or directory


Do you have any idea of this error? really appreciate any suggestions.

Hey Lige, sorry for the late reply. If you still have problems with compiling waves2Foam check out this post: waves2Foam on an Ubuntu 18.04 with OpenFOAM 1712


I hope it helps.


Kind regards
Siebo
Siebo is offline   Reply With Quote

Reply

Tags
of8, openfoam 8, waves2foam


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
[foam-extend.org] Error in Compiling waves2foam with foam-extend4.0 sayed786 OpenFOAM Installation 0 March 14, 2020 04:06
[waves2Foam] Compiling Waves2Foam r2137 error: no matching function for call to ‘exp(Foam::complex Marc_H OpenFOAM Community Contributions 0 March 5, 2020 11:54
[waves2Foam] stuck in compiling the waves2Foam library for OF-v1712 due to MA41 Ya_Squall2010 OpenFOAM Community Contributions 3 April 16, 2019 09:21
waves2foam compiling yapalparvi OpenFOAM Running, Solving & CFD 0 May 9, 2015 22:02
[waves2Foam] Compiling problem for waveDyMFoam of waves2Foam in OF 2.3.0 ashkan OpenFOAM Community Contributions 3 December 13, 2014 01:31


All times are GMT -4. The time now is 08:29.