1
Fork 0

Merge branch 'master' of ssh://git.edgarpierre.fr:39529/m2cce/internship

This commit is contained in:
Edgar P. Burkhart 2022-06-07 12:10:00 +02:00
commit a000c67e93
Signed by: edpibu
GPG key ID: 9833D3C5A25BD227
52 changed files with 1509 additions and 129 deletions

1
jngcgc/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
.~lock*

13
jngcgc/README.md Normal file
View file

@ -0,0 +1,13 @@
# JNGCGC
Journée Nationale Génie Côtier - Génie Civil
<https://site.paralia.fr/jngcgc-2022.html>
## Mise en forme
* Compatible Microsoft Word
* Interligne 16pt
* Corps *Times New Roman* 12pt
* Titre *Times New Roman* 16pt
* Marges T:41mm, BLR:30mm
* Pas de notes de bas de page

BIN
jngcgc/article.odt Normal file

Binary file not shown.

BIN
jngcgc/reference.doc Normal file

Binary file not shown.

View file

@ -1,5 +1,5 @@
[swash]
np_out=../swash/inp_post/real_spec_interp
np_out=../swash/inp_post/ts_4lay_1h
[bathy]
bathy=../data/out_of/bathy.dat
@ -12,11 +12,11 @@ level=4.5
path=/opt/OpenFOAM/OpenFOAM-9/bin:/opt/OpenFOAM/OpenFOAM-9/platforms/linux64GccDPInt32Opt/bin
root=of
out=out_of
t0 = 13900
tf = 14300
t0 = 1300
tf = 1900
x0 = -150
[post]
out = out_post_refined
out = out_post_ts_2
x = -50
z = 5

View file

@ -17,8 +17,8 @@ FoamFile
// Materials: clear region, core, secondary armour layer, primary armour layer
// a,b,c: tuning parameters
a 2(0 50);
b 2(0 1.2);
a 2(0 5000);
b 2(0 2.0);
c 2(0 0.34);
// D50: mean nominal diameter

View file

@ -24,7 +24,7 @@ startTime 0;
stopAt endTime;
endTime 400;
endTime 600;
deltaT 0.1;

View file

@ -15,13 +15,13 @@ FoamFile
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
numberOfSubdomains 4;
numberOfSubdomains 6;
method simple;
simpleCoeffs
{
n ( 2 2 1 );
n ( 3 1 2 );
delta 0.001;
}
@ -34,7 +34,7 @@ hierarchicalCoeffs
metisCoeffs
{
processorWeights ( 1 1 1 1 );
processorWeights ( 1 1 1 1 1 1 );
}
manualCoeffs

View file

@ -0,0 +1,25 @@
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: 9
\\/ M anipulation |
-------------------------------------------------------------------------------
Description
Writes graph data for specified fields along a line, specified by start and
end points. A specified number of graph points are used, distributed
uniformly along the line.
\*---------------------------------------------------------------------------*/
start (-50 0.5 -15);
end (-50 0.5 15);
nPoints 100;
fields (alpha.water);
axis z;
#includeEtc "caseDicts/postProcessing/graphs/graphUniform.cfg"
// ************************************************************************* //

View file

@ -0,0 +1,29 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 2.1.0 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "constant";
object porosityDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Materials: clear region, core, secondary armour layer, primary armour layer
// a,b,c: tuning parameters
a 2(0 50);
b 2(0 1.2);
c 2(0 0.34);
// D50: mean nominal diameter
D50 2(1 4);
// porosity (phi)
porosity 2(1 0.4);
// ************************************************************************* //

View file

@ -0,0 +1,81 @@
/*--------------------------------*- C++ -*----------------------------------*\ | ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.7.1 |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
scale 1;
vertices
(
(-150 0 -30)
(0 0 -30)
(0 0 30)
(-150 0 30)
(-150 1 -30)
(0 1 -30)
(0 1 30)
(-150 1 30)
);
blocks
(
hex (0 1 5 4 3 2 6 7) (300 1 120) simpleGrading (1 1 1)
);
edges
(
);
boundary
(
inlet
{
type patch;
faces
(
(0 4 7 3)
);
}
/*outlet
{
type patch;
faces
(
(1 5 6 2)
);
}*/
wall1
{
type wall;
faces
(
(0 1 5 4)
);
}
atmosphere
{
type patch;
faces
(
(3 2 6 7)
(1 5 6 2)
);
}
);
mergePatchPairs
(
);
// ************************************************************************* //

View file

@ -0,0 +1,138 @@
/*---------------------------------------------------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.3 |
| \\ / A nd | Web: http://www.openfoam.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
location "system";
class dictionary;
object controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
application olaFlow;
startFrom latestTime;
startTime 0;
stopAt endTime;
endTime 400;
deltaT 0.1;
writeControl adjustableRunTime;
writeInterval 0.5;
purgeWrite 0;
writeFormat ascii;
writePrecision 6;
compression on;
timeFormat general;
timePrecision 6;
runTimeModifiable yes;
adjustTimeStep yes;
maxCo 0.45;
maxAlphaCo 0.45;
maxDeltaT 0.5;
/*
functions
{
gaugesVOF
{
type sets;
libs ("libsampling.so");
writeControl outputTime;
writeInterval 1;
setFormat raw;
surfaceFormat raw;
interpolationScheme cell;
fields ( alpha.water );
sets
(
GaugeVOF01
{
type lineCellFace;
axis xyz;
start ( 0.5 0.001 0 );
end ( 0.5 0.001 1.2 );
}
GaugeVOF02
{
type lineCellFace;
axis xyz;
start ( 9.25 0.001 0 );
end ( 9.25 0.001 1.2 );
}
GaugeVOF03
{
type lineCellFace;
axis xyz;
start ( 15.75 0.001 0 );
end ( 15.75 0.001 1.2 );
}
GaugeVOF04
{
type lineCellFace;
axis xyz;
start ( 17.75 0.001 0 );
end ( 17.75 0.001 1.2 );
}
GaugeVOF05
{
type lineCellFace;
axis xyz;
start ( 21.1 0.001 0 );
end ( 21.1 0.001 1.2 );
}
);
}
gaugesP
{
type sets;
libs ("libsampling.so");
writeControl outputTime;
writeInterval 1;
setFormat raw;
surfaceFormat raw;
interpolationScheme cellPointFace;
fields ( p );
sets
(
GaugesP
{
type boundaryPoints;
axis xyz;
patches 1(caisson);
points ((18.0 0.01 0.75)
(18.00 0.01 0.80)
(18.00 0.01 0.85)
(18.00 0.01 0.95)
(18.01 0.01 0.70)
(18.25 0.01 0.70)
(18.50 0.01 0.70)
(18.75 0.01 0.70));
maxDistance 0.01;
}
);
}
}
*/
// ************************************************************************* //

View file

@ -0,0 +1,25 @@
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: 9
\\/ M anipulation |
-------------------------------------------------------------------------------
Description
Writes graph data for specified fields along a line, specified by start and
end points. A specified number of graph points are used, distributed
uniformly along the line.
\*---------------------------------------------------------------------------*/
start (-50 0.5 -15);
end (-50 0.5 15);
nPoints 100;
fields (alpha.water U);
axis z;
#includeEtc "caseDicts/postProcessing/graphs/graphUniform.cfg"
// ************************************************************************* //

View file

@ -0,0 +1,25 @@
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: 9
\\/ M anipulation |
-------------------------------------------------------------------------------
Description
Writes graph data for specified fields along a line, specified by start and
end points. A specified number of graph points are used, distributed
uniformly along the line.
\*---------------------------------------------------------------------------*/
start (-20 0.5 -15);
end (-20 0.5 15);
nPoints 100;
fields (alpha.water U);
axis z;
#includeEtc "caseDicts/postProcessing/graphs/graphUniform.cfg"
// ************************************************************************* //

View file

@ -0,0 +1,29 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 2.1.0 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "constant";
object porosityDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Materials: clear region, core, secondary armour layer, primary armour layer
// a,b,c: tuning parameters
a 2(0 0);
b 2(0 1.2);
c 2(0 0.34);
// D50: mean nominal diameter
D50 2(1 4);
// porosity (phi)
porosity 2(1 0.4);
// ************************************************************************* //

View file

@ -0,0 +1,29 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 2.1.0 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "constant";
object porosityDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Materials: clear region, core, secondary armour layer, primary armour layer
// a,b,c: tuning parameters
a 2(0 5000);
b 2(0 1.2);
c 2(0 0.34);
// D50: mean nominal diameter
D50 2(1 4);
// porosity (phi)
porosity 2(1 0.4);
// ************************************************************************* //

View file

@ -0,0 +1,29 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 2.1.0 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "constant";
object porosityDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Materials: clear region, core, secondary armour layer, primary armour layer
// a,b,c: tuning parameters
a 2(0 50);
b 2(0 0);
c 2(0 0.34);
// D50: mean nominal diameter
D50 2(1 4);
// porosity (phi)
porosity 2(1 0.4);
// ************************************************************************* //

View file

@ -0,0 +1,29 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 2.1.0 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "constant";
object porosityDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Materials: clear region, core, secondary armour layer, primary armour layer
// a,b,c: tuning parameters
a 2(0 50);
b 2(0 0.1);
c 2(0 0.34);
// D50: mean nominal diameter
D50 2(1 4);
// porosity (phi)
porosity 2(1 0.4);
// ************************************************************************* //

View file

@ -0,0 +1,29 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 2.1.0 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "constant";
object porosityDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Materials: clear region, core, secondary armour layer, primary armour layer
// a,b,c: tuning parameters
a 2(0 50);
b 2(0 3.0);
c 2(0 0.34);
// D50: mean nominal diameter
D50 2(1 4);
// porosity (phi)
porosity 2(1 0.4);
// ************************************************************************* //

View file

@ -0,0 +1,29 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 2.1.0 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "constant";
object porosityDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Materials: clear region, core, secondary armour layer, primary armour layer
// a,b,c: tuning parameters
a 2(0 50);
b 2(0 1.2);
c 2(0 0.34);
// D50: mean nominal diameter
D50 2(1 2);
// porosity (phi)
porosity 2(1 0.4);
// ************************************************************************* //

View file

@ -0,0 +1,29 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 2.1.0 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "constant";
object porosityDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Materials: clear region, core, secondary armour layer, primary armour layer
// a,b,c: tuning parameters
a 2(0 50);
b 2(0 1.2);
c 2(0 0.34);
// D50: mean nominal diameter
D50 2(1 4);
// porosity (phi)
porosity 2(1 0.25);
// ************************************************************************* //

View file

@ -0,0 +1,29 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 2.1.0 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "constant";
object turbulenceProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
simulationType RAS;
RAS
{
RASModel kOmegaSST;
turbulence on;
printCoeffs on;
}
// ************************************************************************* //

View file

@ -0,0 +1,29 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 2.1.0 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "constant";
object porosityDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Materials: clear region, core, secondary armour layer, primary armour layer
// a,b,c: tuning parameters
a 2(0 50);
b 2(0 1.2);
c 2(0 0.34);
// D50: mean nominal diameter
D50 2(1 4);
// porosity (phi)
porosity 2(1 0.4);
// ************************************************************************* //

View file

@ -0,0 +1,29 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 2.1.0 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "constant";
object turbulenceProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
simulationType RAS;
RAS
{
RASModel kOmegaSST;
turbulence on;
printCoeffs on;
}
// ************************************************************************* //

View file

@ -0,0 +1,81 @@
/*--------------------------------*- C++ -*----------------------------------*\ | ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.7.1 |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
scale 1;
vertices
(
(-150 0 -30)
(0 0 -30)
(0 0 30)
(-150 0 30)
(-150 1 -30)
(0 1 -30)
(0 1 30)
(-150 1 30)
);
blocks
(
hex (0 1 5 4 3 2 6 7) (1200 1 480) simpleGrading (1 1 1)
);
edges
(
);
boundary
(
inlet
{
type patch;
faces
(
(0 4 7 3)
);
}
/*outlet
{
type patch;
faces
(
(1 5 6 2)
);
}*/
wall1
{
type wall;
faces
(
(0 1 5 4)
);
}
atmosphere
{
type patch;
faces
(
(3 2 6 7)
(1 5 6 2)
);
}
);
mergePatchPairs
(
);
// ************************************************************************* //

View file

@ -0,0 +1,138 @@
/*---------------------------------------------------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.3 |
| \\ / A nd | Web: http://www.openfoam.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
location "system";
class dictionary;
object controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
application olaFlow;
startFrom latestTime;
startTime 0;
stopAt endTime;
endTime 400;
deltaT 0.1;
writeControl adjustableRunTime;
writeInterval 0.5;
purgeWrite 0;
writeFormat ascii;
writePrecision 6;
compression on;
timeFormat general;
timePrecision 6;
runTimeModifiable yes;
adjustTimeStep yes;
maxCo 0.45;
maxAlphaCo 0.45;
maxDeltaT 0.5;
/*
functions
{
gaugesVOF
{
type sets;
libs ("libsampling.so");
writeControl outputTime;
writeInterval 1;
setFormat raw;
surfaceFormat raw;
interpolationScheme cell;
fields ( alpha.water );
sets
(
GaugeVOF01
{
type lineCellFace;
axis xyz;
start ( 0.5 0.001 0 );
end ( 0.5 0.001 1.2 );
}
GaugeVOF02
{
type lineCellFace;
axis xyz;
start ( 9.25 0.001 0 );
end ( 9.25 0.001 1.2 );
}
GaugeVOF03
{
type lineCellFace;
axis xyz;
start ( 15.75 0.001 0 );
end ( 15.75 0.001 1.2 );
}
GaugeVOF04
{
type lineCellFace;
axis xyz;
start ( 17.75 0.001 0 );
end ( 17.75 0.001 1.2 );
}
GaugeVOF05
{
type lineCellFace;
axis xyz;
start ( 21.1 0.001 0 );
end ( 21.1 0.001 1.2 );
}
);
}
gaugesP
{
type sets;
libs ("libsampling.so");
writeControl outputTime;
writeInterval 1;
setFormat raw;
surfaceFormat raw;
interpolationScheme cellPointFace;
fields ( p );
sets
(
GaugesP
{
type boundaryPoints;
axis xyz;
patches 1(caisson);
points ((18.0 0.01 0.75)
(18.00 0.01 0.80)
(18.00 0.01 0.85)
(18.00 0.01 0.95)
(18.01 0.01 0.70)
(18.25 0.01 0.70)
(18.50 0.01 0.70)
(18.75 0.01 0.70));
maxDistance 0.01;
}
);
}
}
*/
// ************************************************************************* //

View file

@ -0,0 +1,25 @@
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: 9
\\/ M anipulation |
-------------------------------------------------------------------------------
Description
Writes graph data for specified fields along a line, specified by start and
end points. A specified number of graph points are used, distributed
uniformly along the line.
\*---------------------------------------------------------------------------*/
start (-50 0.5 -15);
end (-50 0.5 15);
nPoints 100;
fields (alpha.water U);
axis z;
#includeEtc "caseDicts/postProcessing/graphs/graphUniform.cfg"
// ************************************************************************* //

View file

@ -0,0 +1,25 @@
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: 9
\\/ M anipulation |
-------------------------------------------------------------------------------
Description
Writes graph data for specified fields along a line, specified by start and
end points. A specified number of graph points are used, distributed
uniformly along the line.
\*---------------------------------------------------------------------------*/
start (-20 0.5 -15);
end (-20 0.5 15);
nPoints 100;
fields (alpha.water U);
axis z;
#includeEtc "caseDicts/postProcessing/graphs/graphUniform.cfg"
// ************************************************************************* //

View file

@ -1,5 +1,4 @@
import argparse
import configparser
import gzip
import logging
import multiprocessing as mp
@ -16,16 +15,26 @@ from .olaflow import OFModel
parser = argparse.ArgumentParser(description="Post-process olaflow results")
parser.add_argument("-v", "--verbose", action="count", default=0)
parser.add_argument("-c", "--config", default="config.ini")
parser.add_argument(
"-o",
"--output",
type=pathlib.Path,
help="Output directory for pickled data",
required=True,
)
parser.add_argument(
"-m",
"--max",
help="Only compute maximum rather than animation",
action="store_true",
)
args = parser.parse_args()
logging.basicConfig(level=max((10, 20 - 10 * args.verbose)))
log = logging.getLogger("ola_post")
log.info("Animating olaFlow output")
config = configparser.ConfigParser()
config.read(args.config)
out = pathlib.Path(config.get("post", "out"))
out = args.output
out.mkdir(parents=True, exist_ok=True)
with (
@ -35,44 +44,41 @@ with (
) as f:
model = pickle.load(f)
x0 = config.getfloat("post", "x")
z0 = config.getfloat("post", "z")
i0 = np.argmin(np.abs((model.x - x0) + 1j * (model.z - z0)))
x0, idx0 = np.unique(model.x.astype(np.half), return_inverse=True)
z0, idz0 = np.unique(model.z.astype(np.half), return_inverse=True)
ix0 = np.argsort(x0)
iz0 = np.argsort(z0)[::-1]
X, Z = np.meshgrid(x0, z0)
P = np.full((model.t.size, *X.shape), np.nan)
P[:, idz0, idx0] = model.fields["porosity"]
P[:, iz0[idz0], ix0[idx0]] = model.fields["porosity"]
AW = np.full((model.t.size, *X.shape), np.nan)
AW[:, idz0, idx0] = model.fields["alpha.water"]
AW[:, iz0[idz0], ix0[idx0]] = model.fields["alpha.water"]
U = np.full((model.t.size, *X.shape), np.nan)
U[:, idz0, idx0] = np.linalg.norm(model.fields["U"], axis=1)
U[:, iz0[idz0], ix0[idx0]] = np.linalg.norm(model.fields["U"], axis=1)
fig = plt.figure(figsize=(19.2, 10.8), dpi=100)
gs = GridSpec(3, 1, figure=fig, height_ratios=[1, .05, .05])
fig = plt.figure()
gs = GridSpec(3, 1, figure=fig, height_ratios=[1, 0.05, 0.05])
ax = fig.add_subplot(gs[0])
cax1 = fig.add_subplot(gs[1])
cax2 = fig.add_subplot(gs[2])
tit = ax.text(
0.5,
0.95,
f"t={model.t[0]}s",
horizontalalignment="center",
verticalalignment="top",
transform=ax.transAxes,
aw_m = ax.imshow(
AW[0],
vmin=0,
vmax=1,
extent=(x0.min(), x0.max(), z0.min(), z0.max()),
cmap="Blues",
zorder=1,
)
aw_m = ax.pcolormesh(X, Z, AW[0], vmin=0, vmax=1, cmap="Blues", zorder=1)
p_m = ax.pcolormesh(
X,
Z,
p_m = ax.imshow(
P[1],
vmin=0,
vmax=1,
extent=(x0.min(), x0.max(), z0.min(), z0.max()),
cmap="Greys_r",
alpha=(np.nan_to_num(1 - P[1]) / 2).clip(0, 1),
zorder=1.1,
@ -86,62 +92,87 @@ ax.set(xlabel="x (m)", ylabel="z (m)", aspect="equal", facecolor="#000000")
ax.grid(c="k", alpha=0.2)
def anim(i):
tit.set_text(f"t={model.t[i]}s")
aw_m.set_array(AW[i])
figU = plt.figure(figsize=(19.2, 10.8), dpi=100)
gsU = GridSpec(3, 1, figure=figU, height_ratios=[1, .05, .05])
figU = plt.figure()
gsU = GridSpec(
2 if args.max else 3,
1,
figure=figU,
height_ratios=[1, 0.05] if args.max else [1, 0.05, 0.05],
)
axU = figU.add_subplot(gsU[0])
caxu1 = figU.add_subplot(gsU[1])
caxu2 = figU.add_subplot(gsU[2])
u_m = axU.pcolormesh(
X,
Z,
if not args.max:
caxu2 = figU.add_subplot(gsU[2])
u_m = axU.imshow(
U[0],
cmap="BuPu",
vmin=0,
vmax=np.nanquantile(U, 0.99),
vmax=20,
extent=(x0.min(), x0.max(), z0.min(), z0.max()),
zorder=1,
alpha=np.nan_to_num(AW[0]).clip(0, 1),
)
ur_m = axU.pcolormesh(
X,
Z,
ur_m = axU.imshow(
U[0],
cmap="YlOrBr",
vmin=0,
vmax=np.nanquantile(U, 0.99),
vmax=20,
extent=(x0.min(), x0.max(), z0.min(), z0.max()),
zorder=1,
alpha=1 - np.nan_to_num(AW[0]).clip(0, 1),
)
# aw_u = axU.contour(X, Z, AW[0], levels=(.5,))
axU.set(xlabel="x (m)", ylabel="z (m)", aspect="equal", facecolor="#bebebe")
axU.grid(c="k", alpha=0.2)
titU = axU.text(
0.5,
0.95,
f"t={model.t[0]}s",
horizontalalignment="center",
verticalalignment="top",
transform=axU.transAxes,
)
figU.colorbar(u_m, label=r"$U_w$", cax=caxu1, shrink=0.6, orientation="horizontal")
figU.colorbar(ur_m, label=r"$U_a$", cax=caxu2, shrink=0.6, orientation="horizontal")
def animU(i):
titU.set_text(f"t={model.t[i]}s")
u_m.set_array(U[i])
u_m.set_alpha(np.nan_to_num(AW[i]).clip(0, 1))
ur_m.set_array(U[i])
ur_m.set_alpha(1 - np.nan_to_num(AW[i]).clip(0, 1))
if args.max:
aw_m.set_array(AW.max(axis=0))
u_m.set_array(np.nanmax(np.where(AW > 0.5, U, np.nan), axis=0, initial=0))
u_m.set_alpha(1)
u_m.set_cmap("hot_r")
ur_m.remove()
ani = animation.FuncAnimation(fig, anim, frames=model.t.size, interval=1/24)
aniU = animation.FuncAnimation(figU, animU, frames=model.t.size, interval=1/24)
fig.savefig(out.joinpath("max_aw.pdf"))
figU.savefig(out.joinpath("max_U.pdf"))
else:
fig.set(figwidth=19.2, figheight=10.8, dpi=100)
figU.set(figwidth=19.2, figheight=10.8, dpi=100)
ani.save(out.joinpath("anim.mp4"), fps=24)
aniU.save(out.joinpath("animU.mp4"), fps=24)
figU.colorbar(ur_m, label=r"$U_a$", cax=caxu2, shrink=0.6, orientation="horizontal")
tit = ax.text(
0.5,
0.95,
f"t={model.t[0]}s",
horizontalalignment="center",
verticalalignment="top",
transform=ax.transAxes,
)
titU = axU.text(
0.5,
0.95,
f"t={model.t[0]}s",
horizontalalignment="center",
verticalalignment="top",
transform=axU.transAxes,
)
def anim(i):
tit.set_text(f"t={model.t[i]}s")
aw_m.set_array(AW[i])
def animU(i):
titU.set_text(f"t={model.t[i]}s")
u_m.set_array(U[i])
u_m.set_alpha(np.nan_to_num(AW[i]).clip(0, 1))
ur_m.set_array(U[i])
ur_m.set_alpha(1 - np.nan_to_num(AW[i]).clip(0, 1))
ani = animation.FuncAnimation(fig, anim, frames=model.t.size, interval=1 / 24)
aniU = animation.FuncAnimation(figU, animU, frames=model.t.size, interval=1 / 24)
ani.save(out.joinpath("anim.mp4"), fps=24)
aniU.save(out.joinpath("animU.mp4"), fps=24)

View file

@ -1,5 +1,4 @@
import argparse
import configparser
import gzip
import logging
import multiprocessing as mp
@ -16,16 +15,20 @@ from .olaflow import OFModel
parser = argparse.ArgumentParser(description="Post-process olaflow results")
parser.add_argument("-v", "--verbose", action="count", default=0)
parser.add_argument("-c", "--config", default="config.ini")
parser.add_argument(
"-o",
"--output",
type=pathlib.Path,
help="Output directory for pickled data",
required=True,
)
args = parser.parse_args()
logging.basicConfig(level=max((10, 20 - 10 * args.verbose)))
log = logging.getLogger("ola_post")
log.info("Animating olaFlow output")
config = configparser.ConfigParser()
config.read(args.config)
out = pathlib.Path(config.get("post", "out"))
out = args.output
out.mkdir(parents=True, exist_ok=True)
with (
@ -35,9 +38,6 @@ with (
) as f:
model = pickle.load(f)
x0 = config.getfloat("post", "x")
z0 = config.getfloat("post", "z")
flt = np.where((model.x >= -60) & (model.x <= -20) & (model.z >= 0) & (model.z <= 10))[
0
]
@ -73,8 +73,8 @@ u_m = axU.quiver(
*U[0],
UU[0],
alpha=alp[0],
cmap="spring",
clim=(0, np.nanquantile(UU, 0.99)),
cmap="inferno_r",
clim=(0, np.nanmax(UU)),
)
# (wat_p,) = axU.plot(x0, watl[0])

142
olaflow/processing/diff.py Normal file
View file

@ -0,0 +1,142 @@
import argparse
import gzip
from itertools import starmap
import logging
from multiprocessing import pool
import pathlib
import pickle
import sys
from cycler import cycler
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
import numpy as np
from scipy import interpolate
from .olaflow import OFModel
parser = argparse.ArgumentParser(description="Post-process olaflow results")
parser.add_argument("-v", "--verbose", action="count", default=0)
parser.add_argument(
"-o",
"--output",
action="append",
type=pathlib.Path,
help="Post-processing directory",
required=True,
)
parser.add_argument(
"-t",
"--timestep",
type=float,
help="Time-step to compare",
)
parser.add_argument(
"-f",
"--func",
type=str,
help="Post-process function to compare",
default="graphUniform",
choices=("graphUniform", "graphUniform2"),
)
parser.add_argument(
"-y",
"--field",
type=str,
help="Field to compare",
default="alpha.water",
choices=("alpha.water", "U"),
)
args = parser.parse_args()
logging.basicConfig(level=max((10, 20 - 10 * args.verbose)))
log = logging.getLogger("ola_post")
log.info("Plotting comparison of model output")
def get_pickle(out):
with (
path.open("rb")
if (path := out.joinpath("pickle")).exists()
else gzip.open(path.with_suffix(".gz"), "rb")
) as f:
return pickle.load(f)
models = list(map(get_pickle, args.output))
fig, ax_ = plt.subplots(
len(models),
figsize=(6, 1.5 * len(models)),
dpi=100,
constrained_layout=True,
squeeze=False,
)
ax = ax_[:, 0]
if args.timestep is None:
match args.field:
case "alpha.water":
for i, (_ax, _model) in enumerate(zip(ax, models)):
_ax.contour(
_model.t,
_model.post_fields[args.func][f"x_{args.field}"],
_model.post_fields[args.func][args.field].T,
(0.5,),
colors="k",
)
case "U":
for i, (_ax, _model) in enumerate(zip(ax, models)):
_c = _ax.imshow(
np.where(_model.post_fields[args.func]["alpha.water"] > 0.5, np.linalg.norm(_model.post_fields[args.func][args.field], axis=2), np.nan).T[::-1],
vmin=0,
vmax=20,
cmap="inferno_r",
extent=(
_model.t.min(),
_model.t.max(),
_model.post_fields[args.func][f"x_{args.field}"].min(),
_model.post_fields[args.func][f"x_{args.field}"].max(),
),
)
fig.colorbar(_c, label=f"{args.field} (m/s)", ax=_ax)
case _:
log.error(f"Cannot plot field {args.field} from {args.func}")
sys.exit(1)
for i, (_ax, _model) in enumerate(zip(ax, models)):
_ax.set(xlabel="t (s)", ylabel="z (m)", title=f"Case {i}")
_ax.grid(color="k", alpha=0.2)
fig.savefig(
args.output[0].joinpath(
f"diff_{args.func}_{args.field}_{'_'.join([o.name for o in args.output])}.pdf"
)
)
else:
match args.field:
case "alpha.water":
for i, (_ax, _model) in enumerate(zip(ax, models)):
_ax.tricontour(
_model.x,
_model.z,
_model.fields[args.field][np.where(_model.t == args.timestep)[0]][0],
levels=(0.5,),
colors="k",
)
case _:
log.error(f"Cannot plot field {args.field} from {args.func} at timestep")
sys.exit(1)
for i, (_ax, _model) in enumerate(zip(ax, models)):
_ax.set(xlabel="x (m)", ylabel="z (m)", title=f"Case {i}")
_ax.grid()
fig.savefig(
args.output[0].joinpath(
f"diff_t{args.timestep}_{'_'.join([o.name for o in args.output])}.pdf"
)
)

View file

@ -9,6 +9,7 @@ class OFModel:
def __init__(self, root):
self._root = root
self._fields = {}
self._post_fields = {}
def read_mesh(self):
self._x, self._y, self._z = readof.readmesh(str(self._root))
@ -51,6 +52,25 @@ class OFModel:
self.fields[field] = _field
return _field
def read_post(self, func, field):
_ft = lambda _d: self._root.joinpath(
"postProcessing", func, _d, f"line_{field}.xy"
)
_res_0 = np.loadtxt(_ft(self._t_dirs[0]))
_x = _res_0[:, 0]
_res = np.empty((self._t.size, _x.size, _res_0.shape[1] - 1))
_res[0] = _res_0[:, 1:]
for _r, _dir in zip(_res[1:], self._t_dirs[1:]):
_r[:] = np.loadtxt(_ft(_dir))[:, 1:]
_dict = {
f"x_{field}": _x,
field: np.squeeze(_res),
}
if func not in self._post_fields.keys():
self._post_fields[func] = {}
self._post_fields[func] |= _dict
return _dict
def write_field(self, field, values):
with open(self._root.joinpath("0", field), "r") as aw_file:
aw_raw = aw_file.read()
@ -106,12 +126,5 @@ class OFModel:
return self._fields
@property
def X(self):
return self._X
@property
def Z(self):
return self._Z
def FIELD(self, field):
return np.where(self._C > 0, field[:, C], np.nan)
def post_fields(self):
return self._post_fields

View file

@ -1,6 +1,5 @@
import argparse
import gzip
import configparser
import logging
import pathlib
import pickle
@ -14,28 +13,47 @@ from .olaflow import OFModel
parser = argparse.ArgumentParser(description="Post-process olaflow results")
parser.add_argument("-v", "--verbose", action="count", default=0)
parser.add_argument("-c", "--config", default="config.ini")
parser.add_argument("-o", "--output", type=pathlib.Path)
parser.add_argument(
"-i", "--input", type=pathlib.Path, help="Olaflow output directory", required=True
)
parser.add_argument(
"-o",
"--output",
type=pathlib.Path,
help="Output directory for pickled data",
required=True,
)
parser.add_argument(
"-z", "--compress", action="store_true", help="Enable gzip compression"
)
args = parser.parse_args()
logging.basicConfig(level=max((10, 20 - 10 * args.verbose)))
log = logging.getLogger("ola_post")
log.info("Starting sws -> olaFlow converter")
config = configparser.ConfigParser()
config.read(args.config)
out = pathlib.Path(config.get("post", "out"))
log.info("Starting pickling")
out = args.output
out.mkdir(parents=True, exist_ok=True)
olaflow_root = args.output
olaflow_root = args.input
model = OFModel(olaflow_root)
model.read_mesh()
model.read_time()
model.read_field_all("alpha.water")
model.read_field_all("porosity")
model.read_field_all("p")
model.read_field_all("p_rgh")
model.read_field_all("U")
with gzip.open(out.joinpath("pickle.gz"), "wb") as f:
model.read_post("graphUniform", "alpha.water")
model.read_post("graphUniform", "U")
model.read_post("graphUniform2", "alpha.water")
model.read_post("graphUniform2", "U")
with (
gzip.open(out.joinpath("pickle.gz"), "wb")
if args.compress
else out.joinpath("pickle").open("wb")
) as f:
pickle.dump(model, f)

View file

@ -57,11 +57,11 @@ org = org.replace("{v}", "\n".join(v.astype(np.str_)))
org = org.replace("{eta}", "\n".join(wl.astype(np.str_)))
olaflow_root.joinpath("constant", "waveDict").write_text(org)
fig, ax = plt.subplots()
fig, (ax, ax2) = plt.subplots(2)
ax.plot(t, wl)
ax.autoscale(True, "x", tight=True)
ax.set(xlabel="t (s)", ylabel="z (m)")
ax2 = ax.twinx()
ax2.plot(t, v)
ax2.set(ylabel="U (m/s)")
ax2.autoscale(True, "x", tight=True)
ax2.set(xlabel="t (s)", ylabel="U (m/s)")
fig.savefig(olaflow_root.joinpath("constant", "wave.pdf"))

View file

@ -1,10 +1,31 @@
#!/usr/bin/env sh
echo START
export inp="of"
read -p "Output: " out
export cas="$1"
export inp_of="of_$cas"
export out_of="out_of_$cas"
export out_post="out_post_$cas"
cp -r --reflink $inp $out
pushd $out
if [[ ! -d $inp_of ]]
then echo $inp_of not found
exit 1
fi
if [[ -d $out_of ]]
then echo $out_of already exists
mv $out_of "$out_of.bak"
fi
if [[ -d $out_post ]]
then echo $out_post already exists
mv $out_post "$out_post.bak"
fi
echo START
cp -r --reflink of $out_of
if [[ $2 ]]
then cp -r --reflink of_$2/* $out_of
fi
cp -r --reflink $inp_of/* $out_of
pushd $out_of
source /opt/OpenFOAM/OpenFOAM-9/etc/bashrc
mkdir log
echo Generating mesh
@ -17,18 +38,26 @@ setFields > log/setFields.log
popd
echo Converting swash output to initial condition
python -m processing.sws_ola -o $out
python -m processing.sws_ola -o $out_of > $out_of/log/sws_ola.log
echo Converting swash output to boundary condition
python -m processing.sws_wavedict_paddle -o $out
pushd $out
python -m processing.sws_wavedict_paddle -o $out_of > $out_of/log/sws_wave.log
pushd $out_of
echo Generating parallel cases
decomposePar > log/decomposePar.log
echo Running model
mpirun -np 4 olaFlow -parallel > log/olaFlow.log
mpirun --use-hwthread-cpus -np 6 olaFlow -parallel > log/olaFlow.log
echo Merging parallel cases
reconstructPar > log/reconstructPar.log
#echo Removing parallel cases
#rm -r processor*
echo Running Openfoam post-process
postProcess -func graphUniform > log/postProcess.log
postProcess -func graphUniform2 > log/postProcess2.log
popd
echo Pickling Olaflow output
python -m processing.pickle -i $out_of -o $out_post > $out_of/log/pickle.log
echo END

View file

@ -7,3 +7,120 @@ from the crest).
A tool that allows mapping the output fields from swash to the initial fields
in olaFlow was built. Alpha.water and U fields are mapped from swash to
olaFlow.
Boundary conditions are set using the output from the swash model.
A regular mesh is generated and snapped to the bathymetry (mesh resolution: \SI{.5}{\m}).
Simulation is run for 400 seconds using the largest wave from the swash model with the buoy spectrum as an input
(\autoref{fig:wave}).
\begin{figure}
\centering
\includegraphics{wave.pdf}
\caption{Boundary condition for olaflow model.}\label{fig:wave}
\end{figure}
Results are plotted using python \autoref{fig:resola}.
\begin{figure}
\centering
\includegraphics{resola.pdf}
\caption{Results from olaFlow model.}\label{fig:resola}
\end{figure}
\subsection{Porosity parameters}
Several parameters should be calibrated in order to accurately model the porous media: $a$, $b$ and $c$ are friction
parameters in Forcheimer's equation; D50 is the median diameter of the elements constituting the porous media; $p$ is
the porosity of the media.
7 cases were run with the values in \autoref{tab:porotest}.
\begin{table}
\centering
\begin{tabular}{cccccc}
\toprule
\textbf{Case} & $a$ & $b$ & $c$ & D50 (\si{\m}) & $\phi$ \\
\midrule
\textbf{0} & \num{50} & \num{1.2} & \num{0.34} & \num{4} & \num{0.4} \\
\textbf{1} & \intersemibold\num{0} & \num{1.2} & \num{0.34} & \num{4} & \num{0.4} \\
\textbf{2} & \intersemibold\num{5000} & \num{1.2} & \num{0.34} & \num{4} & \num{0.4} \\
\textbf{3} & \num{50} & \intersemibold\num{0} & \num{0.34} & \num{4} & \num{0.4} \\
\textbf{4} & \num{50} & \intersemibold\num{3.0} & \num{0.34} & \num{4} & \num{0.4} \\
\textbf{5} & \num{50} & \num{1.2} & \num{0.34} & \intersemibold\num{2} & \num{0.4} \\
\textbf{6} & \num{50} & \num{1.2} & \num{0.34} & \num{4} & \intersemibold\num{0.25} \\
\bottomrule
\end{tabular}
\caption{Test cases for porosity parameters.}\label{tab:porotest}
\end{table}
Some results are displayed in \autoref{fig:diff} and \autoref{fig:diff2}. No major differences are noticable
between cases (excepted for case 3, where $b=0$).
\begin{figure}
\centering
\includegraphics{diff.pdf}
\caption{Tests for porosity parameters; water - air border at \SI{-50}{\m}.}\label{fig:diff}
\end{figure}
\begin{figure}
\centering
\includegraphics{diff2.pdf}
\caption{Tests for porosity parameters; water - air border at \SI{-20}{\m}.}\label{fig:diff2}
\end{figure}
Another run with a different value for $b$ was made (\autoref{tab:porotestb}). Results are in \autoref{fig:diff3b}.
The value of $b$ seems to have a major effect how wave energy is dissipated / how waves break, as seen in
\autoref{fig:diff3b175}.
\begin{table}
\centering
\begin{tabular}{cccccc}
\toprule
\textbf{Case} & $a$ & $b$ & $c$ & D50 (\si{\m}) & $\phi$ \\
\midrule
\textbf{0} & \num{50} & \num{1.2} & \num{0.34} & \num{4} & \num{0.4} \\
\textbf{1} & \num{50} & \intersemibold\num{0} & \num{0.34} & \num{4} & \num{0.4} \\ % 3
\textbf{2} & \num{50} & \intersemibold\num{0.2} & \num{0.34} & \num{4} & \num{0.4} \\ % 3b
\bottomrule
\end{tabular}
\caption{Test cases for porosity parameters.}\label{tab:porotestb}
\end{table}
\begin{figure}
\centering
\includegraphics{diff3b.pdf}
\caption{Tests for porosity parameters; water - air border at \SI{-20}{\m}.}\label{fig:diff3b}
\end{figure}
\begin{figure}
\centering
\includegraphics{diff3b175.pdf}
\caption{Tests for porosity parameters; water - air border at \SI{175}{\s}.}\label{fig:diff3b175}
\end{figure}
\subsection{Turbulence model}
A case with the $k-\omega$ SST turbulence model was run to compare with the $k-\varepsilon$ model.
Results displayed in \autoref{fig:sst}. Significant differences are found between both models.
Wave breaking as expected using SST model (\autoref{fig:sst175}). See
\url{https://public.edgarpierre.fr/anim_olaflow_kom.mp4}
\begin{figure}
\centering
\includegraphics{diffsst.pdf}
\caption{$x=\SI{-50}{\m}$. Case 1: $k-\varepsilon$ model; case 2: $k-\omega$ SST model.}\label{fig:sst}
\end{figure}
\begin{figure}
\centering
\includegraphics{diffsst175.pdf}
\caption{$t=\SI{175}{\s}$. Case 1: $k-\varepsilon$ model; case 2: $k-\omega$ SST model.}\label{fig:sst175}
\end{figure}
\subsection{Results}
Maximum flow velocity is displayed in \autoref{fig:maxu}.
\begin{figure}
\centering
\includegraphics{maxu.pdf}
\caption{Maximum velocity.}\label{fig:maxu}
\end{figure}
The flow reaches \SIrange{15}{20}{\m\per\s} velocity, which is in accordance with results from \textcite{amir}.

View file

@ -124,5 +124,39 @@ Model runs with 4 layers. \autoref{fig:rests4lay}.
\caption{Results with real timeseries, 4 layers.}\label{fig:rests4lay}
\end{figure}
\section{Reflection coefficient verification}
A small Python script has been written to generate theoretical wave height and homogenized velocity for a combination of
incident and reflected waves.
The method was taken from \parencite{huntley1999use}. Incident waves are modelled by white noise, reflected waves are
incident waves shifted and multiplied by the reflection coefficient. Water level is the sum of incident waves and
reflected waves, velocity is the difference of reflected waves and incident waves. Additionnal noise is added to the
water level and velocity.
Results are displayed in \autoref{fig:r_test}.
\begin{figure}
\centering
\includegraphics{r_test.pdf}
\caption{Reflection coefficient testing (puv method from \cite{huntley1999use}).}\label{fig:r_test}
\end{figure}
\section{Plotting orbitals from buoy measurements}
\autoref{fig:orbitals}. Orbital for the large wave have been plotted in the average motion plane of the buoy.
\begin{figure}
\centering
\includegraphics{orbitals.pdf}
\caption{2Dv buoy trajectory for wave event of 20170228.}\label{fig:orbitals}
\end{figure}
\subsection{Buoy spectrum}
The swash model was run over 4 hours with the spectrum obtained from the buoy, with and without the breakwater. (2
layers).
A zero-crossing methods was implemented to find the largest waves.
%\subsection{2D Model}
%Working on 2D model which might work with overtopping.

View file

@ -170,6 +170,7 @@
%inter-unit-product = {.},
per-mode = power-positive-first,
uncertainty-mode = separate,
reset-text-family = false,
}
\SendSettingsToPgf
\DeclareSIUnit\met{met}

BIN
report/fig/diff.pdf Normal file

Binary file not shown.

BIN
report/fig/diff2.pdf Normal file

Binary file not shown.

BIN
report/fig/diff3b.pdf Normal file

Binary file not shown.

BIN
report/fig/diff3b175.pdf Normal file

Binary file not shown.

BIN
report/fig/diffsst.pdf Normal file

Binary file not shown.

BIN
report/fig/diffsst175.pdf Normal file

Binary file not shown.

BIN
report/fig/maxu.pdf Normal file

Binary file not shown.

BIN
report/fig/orbitals.pdf Normal file

Binary file not shown.

BIN
report/fig/r_test.pdf Normal file

Binary file not shown.

BIN
report/fig/resola.pdf Normal file

Binary file not shown.

BIN
report/fig/wave.pdf Normal file

Binary file not shown.

View file

@ -0,0 +1,71 @@
import argparse
import configparser
import logging
import pathlib
import matplotlib.pyplot as plt
import numpy as np
import scipy.signal as sgl
parser = argparse.ArgumentParser(description="Post-process swash output")
parser.add_argument("-v", "--verbose", action="count", default=0)
parser.add_argument("-c", "--config", default="config.ini")
args = parser.parse_args()
logging.basicConfig(level=max((10, 20 - 10 * args.verbose)))
log = logging.getLogger("post")
log.info("Starting post-processing")
config = configparser.ConfigParser()
config.read(args.config)
inp = pathlib.Path(config.get("post", "inp"))
root = pathlib.Path(config.get("swash", "out"))
log.info(f"Reading data from '{inp}'")
x = np.load(inp.joinpath("x.npy"))
t = np.load(inp.joinpath("t.npy"))
botl = np.load(inp.joinpath("botl.npy"))
watl = np.load(inp.joinpath("watl.npy"))
vel = np.load(inp.joinpath("vel.npy"))[0]
t0 = np.linspace(23 * 60 + 8, 23 * 60 + 8 + 100, 5)
# Plotting
log.info("Plotting results")
vlim = np.nanmin(np.maximum(watl, -botl)), np.nanmax(np.maximum(watl, -botl))
fig_x, ax = plt.subplots(
len(t0), figsize=(10 / 2.54, 4 / 3 * 10 / 2.54), constrained_layout=True
)
i0 = np.argmin(np.abs(t * 1e-3 - t0[0]))
for ax_x, t0_x in zip(ax, t0):
ax_x.plot(x, -botl, color="k")
i = np.argmin(np.abs(t * 1e-3 - t0_x))
ax_x.plot(
x,
np.maximum(watl[i, :], -botl),
color="#0066ff",
)
ax_x.axvline(-1450 + 1450 * ((t[i] - t[i0]) * 1e-3+5) / 100, color="k", alpha=0.2, lw=10)
ax_x.grid(color="k", alpha=0.2)
ax_x.set(ylabel="z (m)", ylim=vlim)
ax_x.text(
0.95,
0.95,
f"$T+{(t[i]-t[i0])*1e-3:.1f}s$",
horizontalalignment="right",
verticalalignment="top",
transform=ax_x.transAxes,
)
ax_x.autoscale(axis="x", tight=True)
out = pathlib.Path(config.get("post", "out")).joinpath(f"trans")
log.info(f"Saving plots in '{out}'")
out.mkdir(parents=True, exist_ok=True)
fig_x.savefig(out.joinpath("x.pdf"))
log.info("Finished post-processing")

View file

@ -19,6 +19,7 @@ config = configparser.ConfigParser()
config.read(args.config)
inp = pathlib.Path(config.get("post", "inp"))
inp_comp = pathlib.Path(config.get("post", "compare"))
root = pathlib.Path(config.get("swash", "out"))
log.info(f"Reading data from '{inp}'")
@ -26,13 +27,16 @@ x = np.load(inp.joinpath("x.npy"))
t = np.load(inp.joinpath("t.npy"))
watl = np.load(inp.joinpath("watl.npy"))
watl_comp = np.load(inp_comp.joinpath("watl.npy"))
# Cospectral calculations
x0 = config.getint("post", "x0")
arg_x0 = np.abs(x - x0).argmin()
w0 = watl[:, arg_x0]
w0_comp = watl_comp[:, arg_x0]
cr0 = np.where(np.diff(np.sign(w0)))[0]
cr0_comp = np.where(np.diff(np.sign(w0_comp)))[0]
wave = np.fromiter(
(
@ -44,6 +48,16 @@ wave = np.fromiter(
),
dtype=np.single,
)
wave_comp = np.fromiter(
(
np.abs(
np.max(np.abs(w0_comp[cr0_comp[i - 1] : cr0_comp[i]]))
+ np.max(np.abs(w0_comp[cr0_comp[i] : cr0_comp[i + 1]]))
)
for i in range(1, len(cr0) - 1)
),
dtype=np.single,
)
i0 = np.argmax(wave)
@ -53,8 +67,22 @@ out.mkdir(parents=True, exist_ok=True)
fig, ax = plt.subplots()
ax.plot(t[cr0[1:-1]] * 1e-3, wave)
ax.set(xlabel="t (s)", ylabel="z (m)")
ax.autoscale(True, "x", True)
ax.grid()
fig.savefig(out.joinpath("wsize.pdf"))
fig2, ax2 = plt.subplots()
ax2.plot(t[cr0[i0 - 5] : cr0[i0 + 7]], w0[cr0[i0 - 5] : cr0[i0 + 7]])
fig2, ax2 = plt.subplots(figsize=(10/2.54, 2/3*10/2.54), constrained_layout=True)
ax2.plot(t[cr0[i0 - 5] : cr0[i0 + 7]] * 1e-3, w0[cr0[i0 - 5] : cr0[i0 + 7]], color="k", label="Case 1")
ax2.plot(t[cr0[i0 - 5] : cr0[i0 + 7]] * 1e-3, w0_comp[cr0[i0 - 5] : cr0[i0 + 7]], color="k", ls="-.", label="Case 2")
ax2.set(xlabel="t (s)", ylabel="z (m)")
ax2.autoscale(True, "x", True)
ax2.grid()
ax2.legend()
fig2.savefig(out.joinpath("maxw.pdf"))
fig2.savefig(out.joinpath("maxw.jpg"), dpi=200)
log.info(f"RMS difference: {np.sqrt(np.mean((w0_comp-w0)**2))}m ; {np.sqrt(np.mean((w0_comp-w0)**2))/(w0.max()-w0.min()):%}")
log.info(f"Bias: {np.mean(w0_comp-w0)}m")
log.info(f"Maximum wave size: {wave.max()}m ; {wave_comp.max()}m")
log.info(f"Maximum wave size difference: {abs(wave_comp.max()-wave.max())/wave.max():%}")

View file

@ -40,20 +40,20 @@ TIMEI 0.2 0.6
$*********************** OUTPUTS *******************************************
SET OUTLEV 1
$BLOCK 'COMPGRID' HEAD 'test.txt' LAY 4 TSEC XP DEP BOTL WATL PRESS DISCH USTAR VEL VZ VELK ZK BRKP OUTPUT 000000.00 0.25 SEC
BLOCK 'COMPGRID' NOHEAD 'tsec.dat' TSEC OUTPUT 000000.00 0.25 SEC
BLOCK 'COMPGRID' NOHEAD 'xp.dat' XP OUTPUT 000000.00 0.25 SEC
BLOCK 'COMPGRID' NOHEAD 'dep.dat' DEP OUTPUT 000000.00 0.25 SEC
BLOCK 'COMPGRID' NOHEAD 'botl.dat' BOTL OUTPUT 000000.00 0.25 SEC
BLOCK 'COMPGRID' NOHEAD 'watl.dat' WATL OUTPUT 000000.00 0.25 SEC
BLOCK 'COMPGRID' NOHEAD 'press.dat' PRESS OUTPUT 000000.00 0.25 SEC
BLOCK 'COMPGRID' NOHEAD 'nhprsk.dat' NHPRSK OUTPUT 000000.00 0.25 SEC
BLOCK 'COMPGRID' NOHEAD 'pressk.dat' PRESSK OUTPUT 000000.00 0.25 SEC
BLOCK 'COMPGRID' NOHEAD 'disch.dat' DISCH OUTPUT 000000.00 0.25 SEC
BLOCK 'COMPGRID' NOHEAD 'ustar.dat' USTAR OUTPUT 000000.00 0.25 SEC
BLOCK 'COMPGRID' NOHEAD 'vel.dat' VEL OUTPUT 000000.00 0.25 SEC
BLOCK 'COMPGRID' NOHEAD 'vz.dat' VZ OUTPUT 000000.00 0.25 SEC
BLOCK 'COMPGRID' NOHEAD 'velk.dat' VELK OUTPUT 000000.00 0.25 SEC
BLOCK 'COMPGRID' NOHEAD 'zk.dat' ZK OUTPUT 000000.00 0.25 SEC
BLOCK 'COMPGRID' NOHEAD 'brkp.dat' BRKP OUTPUT 000000.00 0.25 SEC
COMPUTE 000000.000 0.015 SEC 006000.000 $timeini dtini unit timefin
BLOCK 'COMPGRID' NOHEAD 'tsec.mat' TSEC OUTPUT 000000.00 0.25 SEC
BLOCK 'COMPGRID' NOHEAD 'xp.mat' XP OUTPUT 000000.00 0.25 SEC
BLOCK 'COMPGRID' NOHEAD 'dep.mat' DEP OUTPUT 000000.00 0.25 SEC
BLOCK 'COMPGRID' NOHEAD 'botl.mat' BOTL OUTPUT 000000.00 0.25 SEC
BLOCK 'COMPGRID' NOHEAD 'watl.mat' WATL OUTPUT 000000.00 0.25 SEC
BLOCK 'COMPGRID' NOHEAD 'press.mat' PRESS OUTPUT 000000.00 0.25 SEC
BLOCK 'COMPGRID' NOHEAD 'nhprsk.mat' NHPRSK OUTPUT 000000.00 0.25 SEC
BLOCK 'COMPGRID' NOHEAD 'pressk.mat' PRESSK OUTPUT 000000.00 0.25 SEC
$BLOCK 'COMPGRID' NOHEAD 'disch.mat' DISCH OUTPUT 000000.00 0.25 SEC
$BLOCK 'COMPGRID' NOHEAD 'ustar.mat' USTAR OUTPUT 000000.00 0.25 SEC
BLOCK 'COMPGRID' NOHEAD 'vel.mat' VEL OUTPUT 000000.00 0.25 SEC
BLOCK 'COMPGRID' NOHEAD 'vz.mat' VZ OUTPUT 000000.00 0.25 SEC
BLOCK 'COMPGRID' NOHEAD 'velk.mat' VELK OUTPUT 000000.00 0.25 SEC
BLOCK 'COMPGRID' NOHEAD 'zk.mat' ZK OUTPUT 000000.00 0.25 SEC
$BLOCK 'COMPGRID' NOHEAD 'brkp.mat' BRKP OUTPUT 000000.00 0.25 SEC
COMPUTE 000000.000 0.015 SEC 010000.000 $timeini dtini unit timefin
STOP