Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Development
openfoam
Commits
dd437aa6
Commit
dd437aa6
authored
Jun 11, 2019
by
Andrew Heather
Browse files
INT: Clean-up and integration of wave BC updates
parent
7d9f3c8a
Changes
218
Hide whitespace changes
Inline
Side-by-side
src/waveModels/derivedPointPatchFields/waveMaker/waveMakerPointPatchVectorField.C
View file @
dd437aa6
...
...
@@ -2,8 +2,10 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2018 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2018 IH-Cantabria
\\ / A nd | Copyright (C) 2018-2019 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
| Copyright (C) 2018-2019 IH-Cantabria
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
...
...
@@ -116,7 +118,7 @@ Foam::waveMakerPointPatchVectorField::waveMakerPointPatchVectorField
)
:
fixedValuePointPatchField
<
vector
>
(
p
,
iF
,
dict
,
false
),
motionType_
(
motionTypeNames
.
lookup
(
"motionType"
,
dict
)),
motionType_
(
motionTypeNames
.
get
(
"motionType"
,
dict
)),
n_
(
dict
.
get
<
vector
>
(
"n"
)),
gHat_
(
Zero
),
initialDepth_
(
dict
.
get
<
scalar
>
(
"initialDepth"
)),
...
...
@@ -251,47 +253,34 @@ void Foam::waveMakerPointPatchVectorField::updateCoeffs()
}
case
motionTypes
:
:
solitary
:
{
const
scalar
kappa_
=
sqrt
(
3
.
0
/
4
.
0
*
waveHeight_
/
(
pow
(
initialDepth_
,
3
)));
const
scalar
waveCelerity_
=
sqrt
(
mag
(
g
())
*
(
initialDepth_
+
waveHeight_
));
const
scalar
stroke_
=
sqrt
(
16
.
0
*
waveHeight_
*
initialDepth_
/
3
.
0
);
wavePeriod_
=
(
2
.
0
/
(
kappa_
*
waveCelerity_
))
*
(
3
.
8
+
waveHeight_
/
initialDepth_
);
scalar
motionX
=
0
;
const
scalar
error
=
0
.
001
;
if
(
onlyFirst
==
0
)
{
tAux
=
-
wavePeriod_
/
2
.
0
+
(
t
-
tOld
);
}
else
{
tAux
=
tAuxOld
+
(
t
-
tOld
);
}
//Newton-Rapshon
scalar
theta1OF
=
0
;
scalar
theta2OF
=
0
;
scalar
er
=
10000
;
while
(
er
>
error
)
{
theta2OF
=
theta1OF
-
(
theta1OF
-
kappa_
*
waveCelerity_
*
tAux
+
(
waveHeight_
/
initialDepth_
)
*
tanh
(
theta1OF
)
)
/
(
1
.
0
+
(
waveHeight_
/
initialDepth_
)
*
(
1
.
0
/
cosh
(
theta1OF
))
*
(
1
.
0
/
cosh
(
theta1OF
)));
er
=
fabs
(
theta1OF
-
theta2OF
);
theta1OF
=
theta2OF
;
}
motionX
=
waveHeight_
/
(
kappa_
*
initialDepth_
)
*
tanh
(
theta1OF
)
+
stroke_
/
2
.
0
;
if
(
tAux
!=
0
)
const
scalar
kappa
=
sqrt
(
0
.
75
*
waveHeight_
/
(
pow3
(
initialDepth_
)));
const
scalar
waveCelerity
=
sqrt
(
mag
(
g
())
*
(
initialDepth_
+
waveHeight_
));
const
scalar
stroke
=
sqrt
(
16
.
0
*
waveHeight_
*
initialDepth_
/
3
.
0
);
const
scalar
hr
=
waveHeight_
/
initialDepth_
;
wavePeriod_
=
(
2
.
0
/
(
kappa
*
waveCelerity
))
*
(
3
.
8
+
hr
);
const
scalar
tSolitary
=
-
0
.
5
*
wavePeriod_
+
t
-
db
().
time
().
startTime
().
value
();
// Newton-Rapshon
scalar
theta1
=
0
;
scalar
theta2
=
0
;
scalar
er
=
10000
;
const
scalar
error
=
0
.
001
;
while
(
er
>
error
)
{
onlyFirst
=
1
;
theta2
=
theta1
-
(
theta1
-
kappa
*
waveCelerity
*
tSolitary
+
hr
*
tanh
(
theta1
))
/
(
1
.
0
+
hr
*
(
1
.
0
/
cosh
(
theta1
))
*
(
1
.
0
/
cosh
(
theta1
)));
er
=
mag
(
theta1
-
theta2
);
theta1
=
theta2
;
}
tOld
=
t
;
tAuxOld
=
tAux
;
scalar
motionX
=
waveHeight_
/
(
kappa
*
initialDepth_
)
*
tanh
(
theta1
)
+
0
.
5
*
stroke
;
Field
<
vector
>::
operator
=
(
n_
*
motionX
);
...
...
src/waveModels/derivedPointPatchFields/waveMaker/waveMakerPointPatchVectorField.H
View file @
dd437aa6
...
...
@@ -3,7 +3,9 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2018 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2018 IH-Cantabria
\\/ M anipulation |
-------------------------------------------------------------------------------
| Copyright (C) 2018-2019 IH-Cantabria
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
...
...
@@ -68,6 +70,7 @@ Usage
Available motion types include:
- piston
- flap
- solitary
SourceFiles
waveMakerPointPatchVectorField.C
...
...
@@ -99,7 +102,7 @@ class waveMakerPointPatchVectorField
{
piston
,
flap
,
solitary
solitary
};
//- Names for motion types
...
...
@@ -140,13 +143,6 @@ class waveMakerPointPatchVectorField
//- On/off second order calculation switch
scalar
secondOrder_
;
//- Solitary time [-T/2, T/2]
scalar
tOld
=
0
;
scalar
tAux
=
0
;
scalar
tAuxOld
=
0
;
scalar
onlyFirst
=
0
;
// Protected Member Functions
...
...
tutorials/multiphase/interFoam/laminar/waveExampleSolitaryMcCowan/system/fvSchemes
deleted
100644 → 0
View file @
7d9f3c8a
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v1812 |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object fvSchemes;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
ddtSchemes
{
default Euler;
}
gradSchemes
{
default Gauss linear;
}
divSchemes
{
div(rhoPhi,U) Gauss linearUpwind grad(U);
div(phi,alpha) Gauss vanLeer;
div(phirb,alpha) Gauss linear;
div(((rho*nuEff)*dev2(T(grad(U))))) Gauss linear;
}
laplacianSchemes
{
default Gauss linear orthogonal;
}
interpolationSchemes
{
default linear;
}
snGradSchemes
{
default orthogonal;
}
// ************************************************************************* //
tutorials/multiphase/interFoam/laminar/waveExampleStokesI/system/fvSchemes
deleted
100644 → 0
View file @
7d9f3c8a
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v1812 |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object fvSchemes;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
ddtSchemes
{
default Euler;
}
gradSchemes
{
default Gauss linear;
}
divSchemes
{
div(rhoPhi,U) Gauss linearUpwind grad(U);
div(phi,alpha) Gauss vanLeer;
div(phirb,alpha) Gauss linear;
div(((rho*nuEff)*dev2(T(grad(U))))) Gauss linear;
}
laplacianSchemes
{
default Gauss linear orthogonal;
}
interpolationSchemes
{
default linear;
}
snGradSchemes
{
default orthogonal;
}
// ************************************************************************* //
tutorials/multiphase/interFoam/laminar/waveExampleStokesI/system/fvSolution
deleted
100644 → 0
View file @
7d9f3c8a
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v1812 |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object fvSolution;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
solvers
{
"alpha.water.*"
{
nAlphaCorr 1;
nAlphaSubCycles 3;
cAlpha 1;
}
"pcorr.*"
{
solver PCG;
preconditioner DIC;
tolerance 1e-6;
relTol 0;
}
p_rgh
{
solver PCG;
preconditioner DIC;
tolerance 1e-6;
relTol 0.1;
}
p_rghFinal
{
solver GAMG;
smoother DIC;
tolerance 1e-7;
relTol 0;
}
U
{
solver PBiCG;
preconditioner DILU;
tolerance 1e-6;
relTol 0.1;
}
UFinal
{
solver PBiCG;
preconditioner DILU;
tolerance 1e-6;
relTol 0;
}
}
PIMPLE
{
momentumPredictor no;
nCorrectors 2;
nNonOrthogonalCorrectors 0;
}
// ************************************************************************* //
tutorials/multiphase/interFoam/laminar/waveExampleStokesII/system/fvSchemes
deleted
100644 → 0
View file @
7d9f3c8a
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v1812 |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object fvSchemes;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
ddtSchemes
{
default Euler;
}
gradSchemes
{
default Gauss linear;
}
divSchemes
{
div(rhoPhi,U) Gauss linearUpwind grad(U);
div(phi,alpha) Gauss vanLeer;
div(phirb,alpha) Gauss linear;
div(((rho*nuEff)*dev2(T(grad(U))))) Gauss linear;
}
laplacianSchemes
{
default Gauss linear orthogonal;
}
interpolationSchemes
{
default linear;
}
snGradSchemes
{
default orthogonal;
}
// ************************************************************************* //
tutorials/multiphase/interFoam/laminar/waveExampleStokesII/system/fvSolution
deleted
100644 → 0
View file @
7d9f3c8a
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v1812 |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object fvSolution;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
solvers
{
"alpha.water.*"
{
nAlphaCorr 1;
nAlphaSubCycles 3;
cAlpha 1;
}
"pcorr.*"
{
solver PCG;
preconditioner DIC;
tolerance 1e-6;
relTol 0;
}
p_rgh
{
solver PCG;
preconditioner DIC;
tolerance 1e-6;
relTol 0.1;
}
p_rghFinal
{
solver GAMG;
smoother DIC;
tolerance 1e-7;
relTol 0;
}
U
{
solver PBiCG;
preconditioner DILU;
tolerance 1e-6;
relTol 0.1;
}
UFinal
{
solver PBiCG;
preconditioner DILU;
tolerance 1e-6;
relTol 0;
}
}
PIMPLE
{
momentumPredictor no;
nCorrectors 2;
nNonOrthogonalCorrectors 0;
}
// ************************************************************************* //
tutorials/multiphase/interFoam/laminar/waveExampleStokesV/system/fvSchemes
deleted
100644 → 0
View file @
7d9f3c8a
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v1812 |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object fvSchemes;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
ddtSchemes
{
default Euler;
}
gradSchemes
{
default Gauss linear;
}
divSchemes
{
div(rhoPhi,U) Gauss linearUpwind grad(U);
div(phi,alpha) Gauss vanLeer;
div(phirb,alpha) Gauss linear;
div(((rho*nuEff)*dev2(T(grad(U))))) Gauss linear;
}
laplacianSchemes
{
default Gauss linear orthogonal;
}
interpolationSchemes
{
default linear;
}
snGradSchemes
{
default orthogonal;
}
// ************************************************************************* //
tutorials/multiphase/interFoam/laminar/waveExampleStokesV/system/fvSolution
deleted
100644 → 0
View file @
7d9f3c8a
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v1812 |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object fvSolution;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
solvers
{
"alpha.water.*"
{
nAlphaCorr 1;
nAlphaSubCycles 3;
cAlpha 1;
}
"pcorr.*"
{
solver PCG;
preconditioner DIC;
tolerance 1e-6;
relTol 0;
}
p_rgh
{
solver PCG;
preconditioner DIC;
tolerance 1e-6;
relTol 0.1;
}
p_rghFinal
{
solver GAMG;
smoother DIC;
tolerance 1e-7;
relTol 0;
}
U
{
solver PBiCG;
preconditioner DILU;
tolerance 1e-6;
relTol 0.1;
}
UFinal
{
solver PBiCG;
preconditioner DILU;
tolerance 1e-6;
relTol 0;
}
}
PIMPLE
{
momentumPredictor no;
nCorrectors 2;
nNonOrthogonalCorrectors 0;
}
// ************************************************************************* //
tutorials/multiphase/interFoam/laminar/waveExampleStreamFunction/system/fvSchemes
deleted
100644 → 0
View file @
7d9f3c8a
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v1812 |
| \\ / A nd | Web: www.OpenFOAM.com |