Server side scripts & all
This commit is contained in:
parent
a000c67e93
commit
b92e52ecbb
20 changed files with 629 additions and 58 deletions
29
olaflow/of_ts_fine_1/constant/porosityDict
Normal file
29
olaflow/of_ts_fine_1/constant/porosityDict
Normal 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);
|
||||
|
||||
// ************************************************************************* //
|
29
olaflow/of_ts_fine_1/constant/turbulenceProperties
Normal file
29
olaflow/of_ts_fine_1/constant/turbulenceProperties
Normal 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;
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
81
olaflow/of_ts_fine_1/system/blockMeshDict
Normal file
81
olaflow/of_ts_fine_1/system/blockMeshDict
Normal 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) (750 1 300) 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
|
||||
(
|
||||
);
|
||||
|
||||
// ************************************************************************* //
|
138
olaflow/of_ts_fine_1/system/controlDict
Normal file
138
olaflow/of_ts_fine_1/system/controlDict
Normal 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;
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
*/
|
||||
// ************************************************************************* //
|
25
olaflow/of_ts_fine_1/system/graphUniform
Normal file
25
olaflow/of_ts_fine_1/system/graphUniform
Normal 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"
|
||||
|
||||
// ************************************************************************* //
|
25
olaflow/of_ts_fine_1/system/graphUniform2
Normal file
25
olaflow/of_ts_fine_1/system/graphUniform2
Normal 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"
|
||||
|
||||
// ************************************************************************* //
|
|
@ -8,6 +8,7 @@ import pickle
|
|||
import matplotlib.pyplot as plt
|
||||
import matplotlib.animation as animation
|
||||
from matplotlib.gridspec import GridSpec
|
||||
from matplotlib.ticker import MultipleLocator
|
||||
import numpy as np
|
||||
from scipy import interpolate
|
||||
|
||||
|
@ -28,6 +29,12 @@ parser.add_argument(
|
|||
help="Only compute maximum rather than animation",
|
||||
action="store_true",
|
||||
)
|
||||
parser.add_argument(
|
||||
"-i",
|
||||
"--initial",
|
||||
help="Only compute initial domain",
|
||||
action="store_true",
|
||||
)
|
||||
args = parser.parse_args()
|
||||
|
||||
logging.basicConfig(level=max((10, 20 - 10 * args.verbose)))
|
||||
|
@ -61,11 +68,19 @@ AW[:, iz0[idz0], ix0[idx0]] = model.fields["alpha.water"]
|
|||
U = np.full((model.t.size, *X.shape), np.nan)
|
||||
U[:, iz0[idz0], ix0[idx0]] = np.linalg.norm(model.fields["U"], axis=1)
|
||||
|
||||
fig = plt.figure()
|
||||
gs = GridSpec(3, 1, figure=fig, height_ratios=[1, 0.05, 0.05])
|
||||
fig = plt.figure(
|
||||
figsize=(15 / 2.54, 4 / 2.54), dpi=200, constrained_layout=True
|
||||
)
|
||||
gs = GridSpec(
|
||||
3 if not args.initial else 1,
|
||||
1,
|
||||
figure=fig,
|
||||
height_ratios=[1, 0.1, 0.1] if not args.initial else [1],
|
||||
)
|
||||
ax = fig.add_subplot(gs[0])
|
||||
cax1 = fig.add_subplot(gs[1])
|
||||
cax2 = fig.add_subplot(gs[2])
|
||||
if not args.initial:
|
||||
cax1 = fig.add_subplot(gs[1])
|
||||
cax2 = fig.add_subplot(gs[2])
|
||||
aw_m = ax.imshow(
|
||||
AW[0],
|
||||
vmin=0,
|
||||
|
@ -86,10 +101,15 @@ p_m = ax.imshow(
|
|||
ax.axhline(4.5, ls="-.", lw=1, c="k", alpha=0.2, zorder=1.2)
|
||||
|
||||
|
||||
fig.colorbar(aw_m, label=r"$\alpha_w$", cax=cax1, shrink=0.6, orientation="horizontal")
|
||||
fig.colorbar(p_m, label=r"Porosity", cax=cax2, shrink=0.6, orientation="horizontal")
|
||||
if not args.initial:
|
||||
fig.colorbar(
|
||||
aw_m, label=r"$\alpha_w$", cax=cax1, shrink=0.6, orientation="horizontal"
|
||||
)
|
||||
fig.colorbar(p_m, label=r"Porosity", cax=cax2, shrink=0.6, orientation="horizontal")
|
||||
ax.set(xlabel="x (m)", ylabel="z (m)", aspect="equal", facecolor="#000000")
|
||||
ax.grid(c="k", alpha=0.2)
|
||||
ax.xaxis.set_minor_locator(MultipleLocator(5))
|
||||
ax.yaxis.set_minor_locator(MultipleLocator(5))
|
||||
|
||||
|
||||
figU = plt.figure()
|
||||
|
@ -137,6 +157,13 @@ if args.max:
|
|||
|
||||
fig.savefig(out.joinpath("max_aw.pdf"))
|
||||
figU.savefig(out.joinpath("max_U.pdf"))
|
||||
elif args.initial:
|
||||
aw_m.set_array(AW[0])
|
||||
ax.vlines(-20, -15, 15, color="k", lw=1, ls="--", label="Measurements")
|
||||
ax.text(-20, 15, "Measurements", ha="right", va="bottom")
|
||||
|
||||
fig.savefig(out.joinpath("aw_t0.pdf"))
|
||||
fig.savefig(out.joinpath("aw_t0.jpg"), dpi=200)
|
||||
else:
|
||||
fig.set(figwidth=19.2, figheight=10.8, dpi=100)
|
||||
figU.set(figwidth=19.2, figheight=10.8, dpi=100)
|
||||
|
|
|
@ -74,7 +74,7 @@ u_m = axU.quiver(
|
|||
UU[0],
|
||||
alpha=alp[0],
|
||||
cmap="inferno_r",
|
||||
clim=(0, np.nanmax(UU)),
|
||||
clim=(0, 20),
|
||||
)
|
||||
# (wat_p,) = axU.plot(x0, watl[0])
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ import sys
|
|||
|
||||
from cycler import cycler
|
||||
import matplotlib.pyplot as plt
|
||||
import matplotlib.gridspec as gridspec
|
||||
from matplotlib.ticker import MultipleLocator
|
||||
import numpy as np
|
||||
from scipy import interpolate
|
||||
|
||||
|
@ -67,11 +67,12 @@ def get_pickle(out):
|
|||
|
||||
models = list(map(get_pickle, args.output))
|
||||
|
||||
figsize = 15 / 2.54, 4 / 2.54 * len(models)
|
||||
|
||||
fig, ax_ = plt.subplots(
|
||||
len(models),
|
||||
figsize=(6, 1.5 * len(models)),
|
||||
dpi=100,
|
||||
figsize=figsize,
|
||||
dpi=200,
|
||||
constrained_layout=True,
|
||||
squeeze=False,
|
||||
)
|
||||
|
@ -90,32 +91,71 @@ if args.timestep is None:
|
|||
)
|
||||
case "U":
|
||||
for i, (_ax, _model) in enumerate(zip(ax, models)):
|
||||
v = np.nanmax(np.abs(np.where(
|
||||
_model.post_fields[args.func]["alpha.water"] > 0.5,
|
||||
#np.linalg.norm(_model.post_fields[args.func][args.field], axis=2),
|
||||
_model.post_fields[args.func][args.field][..., 0],
|
||||
np.nan,
|
||||
)))
|
||||
v150 = np.nanmax(np.abs(np.where(
|
||||
(_model.post_fields[args.func]["alpha.water"] > 0.5) & (_model.t[:, None] > 170) & (_model.t[:, None] < 200),
|
||||
#np.linalg.norm(_model.post_fields[args.func][args.field], axis=2),
|
||||
_model.post_fields[args.func][args.field][..., 0],
|
||||
np.nan,
|
||||
)))
|
||||
_data = _model.post_fields[args.func][args.field][..., 0].T
|
||||
#_c = _ax.contourf(
|
||||
# _model.t,
|
||||
# _model.post_fields[args.func][f"x_{args.field}"],
|
||||
# _data,
|
||||
# cmap="PiYG",
|
||||
# #levels=[-15, -10, -5, -2, -1, 0, 1, 2, 5, 10, 15],
|
||||
# vmin=-np.nanmax(np.abs(_data)),
|
||||
# vmax=np.nanmax(np.abs(_data)),
|
||||
# extend="both",
|
||||
#)
|
||||
_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",
|
||||
_data[::-1],
|
||||
cmap="PiYG",
|
||||
alpha=np.clip(_model.post_fields[args.func]["alpha.water"], 0, 1).T[::-1],
|
||||
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(),
|
||||
),
|
||||
vmin=-v150,
|
||||
vmax=v150,
|
||||
aspect="auto",
|
||||
)
|
||||
_ax.set(xlim=(100, 300))
|
||||
_ax.set(facecolor="k")
|
||||
_ax.xaxis.set_minor_locator(MultipleLocator(5))
|
||||
_ax.yaxis.set_minor_locator(MultipleLocator(1))
|
||||
fig.colorbar(_c, label=f"{args.field} (m/s)", ax=_ax)
|
||||
log.info(f"Vitesse max: {v}m/s")
|
||||
log.info(f"Vitesse max [170,200]: {v150}m/s")
|
||||
log.info(f"Écart: {abs(np.nanmax(_data)-17.7)/17.7:%}")
|
||||
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)
|
||||
_ax.set(xlabel="t (s)", ylabel="z (m)")
|
||||
if len(models) > 1:
|
||||
_ax.set(title=f"Case {i}")
|
||||
#_ax.grid(color="#797979", alpha=0.5)
|
||||
|
||||
fig.savefig(
|
||||
args.output[0].joinpath(
|
||||
f"diff_{args.func}_{args.field}_{'_'.join([o.name for o in args.output])}.pdf"
|
||||
)
|
||||
)
|
||||
fig.savefig(
|
||||
args.output[0].joinpath(
|
||||
f"diff_{args.func}_{args.field}_{'_'.join([o.name for o in args.output])}.jpg"
|
||||
)
|
||||
)
|
||||
else:
|
||||
match args.field:
|
||||
case "alpha.water":
|
||||
|
@ -123,7 +163,9 @@ else:
|
|||
_ax.tricontour(
|
||||
_model.x,
|
||||
_model.z,
|
||||
_model.fields[args.field][np.where(_model.t == args.timestep)[0]][0],
|
||||
_model.fields[args.field][np.where(_model.t == args.timestep)[0]][
|
||||
0
|
||||
],
|
||||
levels=(0.5,),
|
||||
colors="k",
|
||||
)
|
||||
|
|
Reference in a new issue