1
Fork 0

Fixed sws_ola

This commit is contained in:
Edgar P. Burkhart 2022-03-28 10:27:38 +02:00
parent ba675fb763
commit a335f2f5ce
Signed by: edpibu
GPG key ID: 9833D3C5A25BD227
19 changed files with 311413 additions and 33 deletions

View file

@ -2,10 +2,9 @@
np_out=../swash/inp_post np_out=../swash/inp_post
[bathy] [bathy]
bathy=../swash/data/bathyhires.dat bathy=../data/out_of/bathy.dat
hstru=../swash/data/Hstru.dat hstru=../data/out_of/hstru.dat
scale=[0.5,1,1] scale=[0.5,1,1]
translate=[-149,0,0]
out=out_bathy out=out_bathy
[olaflow] [olaflow]

View file

@ -0,0 +1,53 @@
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: 9
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
format ascii;
class polyBoundaryMesh;
location "constant/polyMesh";
object boundary;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
5
(
inlet
{
type patch;
nFaces 77;
startFace 38318;
}
outlet
{
type patch;
nFaces 34;
startFace 38395;
}
atmosphere
{
type patch;
nFaces 300;
startFace 38429;
}
defaultFaces
{
type empty;
inGroups List<word> 1(empty);
nFaces 38698;
startFace 38729;
}
bathy
{
type wall;
inGroups List<word> 1(wall);
nFaces 349;
startFace 77427;
}
)
// ************************************************************************* //

View file

@ -0,0 +1,19 @@
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: 9
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
format ascii;
class labelList;
location "constant/polyMesh";
object cellLevel;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
19349{0}
// ************************************************************************* //

View file

@ -0,0 +1,20 @@
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: 9
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
format ascii;
class regIOobject;
location "constant/polyMesh";
object cellZones;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
0
()
// ************************************************************************* //

View file

@ -0,0 +1,20 @@
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: 9
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
format ascii;
class regIOobject;
location "constant/polyMesh";
object faceZones;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
0
()
// ************************************************************************* //

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,22 @@
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: 9
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
format ascii;
class uniformDimensionedScalarField;
location "constant/polyMesh";
object level0Edge;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 1 0 0 0 0 0];
value 0.5;
// ************************************************************************* //

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,19 @@
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: 9
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
format ascii;
class labelList;
location "constant/polyMesh";
object pointLevel;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
39460{0}
// ************************************************************************* //

View file

@ -0,0 +1,20 @@
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: 9
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
format ascii;
class regIOobject;
location "constant/polyMesh";
object pointZones;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
0
()
// ************************************************************************* //

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1 @@
../../out_bathy/

View file

@ -19,14 +19,14 @@ scale 1;
vertices vertices
( (
(-150 0 -30)
(0 0 -30) (0 0 -30)
(150 0 -30) (0 0 30)
(150 0 20) (-150 0 30)
(0 0 20) (-150 1 -30)
(0 1 -30) (0 1 -30)
(150 1 -30) (0 1 30)
(150 1 20) (-150 1 30)
(0 1 20)
); );
blocks blocks

View file

@ -25,7 +25,7 @@ regions
( (
boxToCell boxToCell
{ {
box (-10 -10 -100) (500 10 5); box (-200 -100 -100) (100 100 4.5);
fieldValues fieldValues
( (
@ -34,8 +34,8 @@ regions
} }
surfaceToCell surfaceToCell
{ {
file "./constant/triSurface/rubble.stl"; file "./constant/triSurface/poro.stl";
outsidePoints ((0 0 0)); // definition of outside outsidePoints ((-100 0 0)); // definition of outside
includeCut true; // cells cut by surface includeCut true; // cells cut by surface
includeInside true; // cells not on outside of surf includeInside true; // cells not on outside of surf
includeOutside false; // cells on outside of surf includeOutside false; // cells on outside of surf

View file

@ -29,16 +29,6 @@ addLayers false;
geometry geometry
{ {
bloc0.stl
{
type triSurfaceMesh;
name bloc0;
}
bloc1.stl
{
type triSurfaceMesh;
name bloc1;
}
bathy.stl bathy.stl
{ {
@ -125,14 +115,6 @@ castellatedMeshControls
{ {
level ( 0 0 ); level ( 0 0 );
} }
bloc0
{
level ( 0 0 );
}
bloc1
{
level ( 0 0 );
}
} }
@ -172,7 +154,7 @@ castellatedMeshControls
// section reachable from the locationInMesh is kept. // section reachable from the locationInMesh is kept.
// NOTE: This point should never be on a face, always inside a cell, even // NOTE: This point should never be on a face, always inside a cell, even
// after refinement. // after refinement.
locationInMesh (0.25 0.01 0.25); locationInMesh (-100 0 0);
// Whether any faceZones (as specified in the refinementSurfaces) // Whether any faceZones (as specified in the refinementSurfaces)
// are only on the boundary of corresponding cellZones or also allow // are only on the boundary of corresponding cellZones or also allow

View file

@ -20,8 +20,9 @@ log.info("Starting sws -> olaFlow converter")
config = configparser.ConfigParser() config = configparser.ConfigParser()
config.read("config.ini") config.read("config.ini")
bathy = np.loadtxt(config.get("bathy", "bathy")) bathy = np.loadtxt(config.get("bathy", "bathy"))[::-1]
poro = bathy + np.loadtxt(config.get("bathy", "hstru")) hstru = np.loadtxt(config.get("bathy", "hstru"))[::-1]
poro = bathy + np.where(hstru == 0, -5, hstru)
out = pathlib.Path(config.get("bathy", "out")) out = pathlib.Path(config.get("bathy", "out"))
out.mkdir(exist_ok=True) out.mkdir(exist_ok=True)

View file

@ -12,6 +12,7 @@ def stl_from_1d(data, output, scale=[1, 1, 1], translate=[0, 0, 0]):
np.savetxt(tmpdir.joinpath("data.dat"), np.stack((data, data))) np.savetxt(tmpdir.joinpath("data.dat"), np.stack((data, data)))
with open(tmpdir.joinpath("scad"), "wt") as scad: with open(tmpdir.joinpath("scad"), "wt") as scad:
scad.write( scad.write(
f"mirror([1, 0, 0])"
f"translate({translate})" f"translate({translate})"
f"scale({scale})" f"scale({scale})"
f"""surface("data.dat");""" f"""surface("data.dat");"""