Skip to content

Commit

Permalink
Initial release of waves2Foam - all files
Browse files Browse the repository at this point in the history
  • Loading branch information
ngjacobsen committed Nov 10, 2011
1 parent 049bf65 commit d40c0d3
Show file tree
Hide file tree
Showing 161 changed files with 16,928 additions and 0 deletions.
48 changes: 48 additions & 0 deletions Allwmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/bin/bash

# Remove option "-llduSolvers" from non-extended versions of OF

arg=`echo $WM_PROJECT_VERSION | grep 'dev\|ext'`

if [ -z "$arg" ]
then

list=`find ./ -name "options" | grep -v $WM_OPTIONS`

for i in $list
do
dir=`dirname $i`

cd $dir

grep -v "\-llduSolvers" options > options.temp
mv options.temp options

cd $OLDPWD
done
fi

# Compilation of wave boundary conditions / relaxation zone

( cd src; ./Allwmake )

# Compilation of solvers
# Here there is a very clear destingtion between version 1.5 and 1.6+. Hence solvers more recent than
# 1.5 are compile in the same directory

apps="applications"

version=`echo $WM_PROJECT_VERSION | sed -e 's/\./\n/g' -e 's/-/\n/' | grep "[0-9]" | tr -d '\n'`
export WM_PROJECT_VERSION_NUMBER=$version

if [ "$version" = 15 ]
then
( cd $apps/solvers/solvers15 && wmake all )
else
( cd $apps/solvers/solvers && wmake all )
fi

# Compilation of utilities

( cd $apps/utilities && wmake all )

22 changes: 22 additions & 0 deletions CONTRIBUTORS
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
====== WAVEFRAMEWORK ======

This wave generation and absorption framework is initially developed by
Niels G. Jacobsen from the Technical University of Denmark. The method
and its validation has been published in

@article { jacobsenFuhrmanFredsoe2011,
Author = {Jacobsen, N G and Fuhrman, D R and Freds\o{}e, J},
title = {{A Wave Generation Toolbox for the Open-Source CFD Library: OpenFoam\textregistered{}}},
Journal = {{Int. J. for Numer. Meth. Fluids}},
Year = {2011},
Volume = {In print},
Pages = {},
}

Please make proper reference to this article, when the work is used.

---------------------------
Other contributions are kindly accepted received from:

Bo Terp Paulsen, Technical University of Denmark
Bjarne Jensen, Technical University of Denmark
31 changes: 31 additions & 0 deletions README
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
===== INSTALLATION =====

1. Make sure that Gnu Scientific Library is installed, e.g. using the Package Manager system
Examples (from http://lavandula.imim.es/adun-new/?page_id=186)

Ubuntu: sudo apt-get install libgsl0-dev
Fedora: sudo yum install gsl-devel
Suse: sudo zypper install gsl-devel

2. Type './Allwmake' in the command line

===== DOCUMENTATION =====

The following paper describes the implementation of boundary conditions, the relaxation zones
and the framework for relaxationShapes:

@article { jacobsenFuhrmanFredsoe2011,
Author = {Jacobsen, N G and Fuhrman, D R and Freds\o{}e, J},
title = {{A Wave Generation Toolbox for the Open-Source CFD Library: OpenFoam\textregistered{}}},
Journal = {{Int. J. for Numer. Meth. Fluids}},
Year = {2011},
Volume = {In print},
Pages = {},
}

Please make prober referencing to it, when using the toolbox. This part of the README will be
updated as soon as DOI or full referencing is available.

Furthermore, users are referred to:

http://openfoamwiki.net/index.php/Contrib/waves2Foam
3 changes: 3 additions & 0 deletions TODO
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- Get the projection of the pressure gradient correct

- Not all wave theories have had dpdx implemented
3 changes: 3 additions & 0 deletions applications/solvers/solvers/waveFoam/Make/files
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
waveFoam.C

EXE = $(FOAM_APPBIN)/waveFoam
18 changes: 18 additions & 0 deletions applications/solvers/solvers/waveFoam/Make/options
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
EXE_INC = \
-I$(LIB_SRC)/transportModels \
-I$(LIB_SRC)/transportModels/incompressible/lnInclude \
-I$(LIB_SRC)/transportModels/interfaceProperties/lnInclude \
-I$(LIB_SRC)/turbulenceModels/incompressible/turbulenceModel \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-DOFVERSION=16 \
-I./../../../../src/lnInclude \

EXE_LIBS = \
-linterfaceProperties \
-lincompressibleTransportModels \
-lincompressibleTurbulenceModel \
-lincompressibleRASModels \
-lincompressibleLESModels \
-lfiniteVolume \
-llduSolvers \
-lwaves2Foam
34 changes: 34 additions & 0 deletions applications/solvers/solvers/waveFoam/UEqn.H
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
surfaceScalarField muEff
(
"muEff",
twoPhaseProperties.muf()
+ fvc::interpolate(rho*turbulence->nut())
);

fvVectorMatrix UEqn
(
fvm::ddt(rho, U)
+ fvm::div(rhoPhi, U)
- fvm::laplacian(muEff, U)
- (fvc::grad(U) & fvc::grad(muEff))
//- fvc::div(muEff*(fvc::interpolate(dev(fvc::grad(U))) & mesh.Sf()))
);

UEqn.relax();

if (momentumPredictor)
{
solve
(
UEqn
==
fvc::reconstruct
(
(
fvc::interpolate(interface.sigmaK())*fvc::snGrad(alpha1)
- ghf*fvc::snGrad(rho)
- fvc::snGrad(pd)
) * mesh.magSf()
)
);
}
35 changes: 35 additions & 0 deletions applications/solvers/solvers/waveFoam/alphaEqn.H
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
word alphaScheme("div(phi,alpha)");
word alpharScheme("div(phirb,alpha)");

surfaceScalarField phic = mag(phi/mesh.magSf());
phic = min(interface.cAlpha()*phic, max(phic));
surfaceScalarField phir = phic*interface.nHatf();

for (int aCorr=0; aCorr<nAlphaCorr; aCorr++)
{
surfaceScalarField phiAlpha =
fvc::flux
(
phi,
alpha1,
alphaScheme
)
+ fvc::flux
(
-fvc::flux(-phir, scalar(1) - alpha1, alpharScheme),
alpha1,
alpharScheme
);

MULES::explicitSolve(alpha1, phi, phiAlpha, 1, 0);

rhoPhi = phiAlpha*(rho1 - rho2) + phi*rho2;
}

Info<< "Liquid phase volume fraction = "
<< alpha1.weightedAverage(mesh.V()).value()
<< " Min(alpha1) = " << min(alpha1).value()
<< " Max(alpha1) = " << max(alpha1).value()
<< endl;
}
35 changes: 35 additions & 0 deletions applications/solvers/solvers/waveFoam/alphaEqnSubCycle.H
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
label nAlphaCorr
(
readLabel(piso.lookup("nAlphaCorr"))
);

label nAlphaSubCycles
(
readLabel(piso.lookup("nAlphaSubCycles"))
);

if (nAlphaSubCycles > 1)
{
dimensionedScalar totalDeltaT = runTime.deltaT();
surfaceScalarField rhoPhiSum = 0.0*rhoPhi;

for
(
subCycle<volScalarField> alphaSubCycle(alpha1, nAlphaSubCycles);
!(++alphaSubCycle).end();
)
{
# include "alphaEqn.H"
rhoPhiSum += (runTime.deltaT()/totalDeltaT)*rhoPhi;
}

rhoPhi = rhoPhiSum;
}
else
{
# include "alphaEqn.H"
}

interface.correct();

rho == alpha1*rho1 + (scalar(1) - alpha1)*rho2;
54 changes: 54 additions & 0 deletions applications/solvers/solvers/waveFoam/correctPhi.H
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{
# include "continuityErrs.H"

wordList pcorrTypes
(
pd.boundaryField().size(),
zeroGradientFvPatchScalarField::typeName
);

for (label i=0; i<pd.boundaryField().size(); i++)
{
if (pd.boundaryField()[i].fixesValue())
{
pcorrTypes[i] = fixedValueFvPatchScalarField::typeName;
}
}

volScalarField pcorr
(
IOobject
(
"pcorr",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimensionedScalar("pcorr", pd.dimensions(), 0.0),
pcorrTypes
);

dimensionedScalar rUAf("(1|A(U))", dimTime/rho.dimensions(), 1.0);

adjustPhi(phi, U, pcorr);

for(int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
{
fvScalarMatrix pcorrEqn
(
fvm::laplacian(rUAf, pcorr) == fvc::div(phi)
);

pcorrEqn.setReference(pdRefCell, pdRefValue);
pcorrEqn.solve();

if (nonOrth == nNonOrthCorr)
{
phi -= pcorrEqn.flux();
}
}

# include "continuityErrs.H"
}
Loading

0 comments on commit d40c0d3

Please sign in to comment.