Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
fluidparticles
MigFlow
Commits
23b7453d
Commit
23b7453d
authored
Jun 08, 2018
by
Jonathan Lambrechts
Browse files
validation
parent
a5f7adf7
Pipeline
#3701
failed with stage
in 1 minute and 31 seconds
Changes
10
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
.gitlab-ci.yml
0 → 100644
View file @
23b7453d
# Marblesbag - Copyright (C) <2010-2018>
# <Universite catholique de Louvain (UCL), Belgium
# Universite de Montpellier, France>
#
# List of the contributors to the development of Marblesbag: see AUTHORS file.
# Description and complete License: see LICENSE file.
#
# This program (Marblesbag) is free software:
# you can redistribute it and/or modify it under the terms of the GNU Lesser General
# Public License as published by the Free Software Foundation, either version
# 3 of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program (see COPYING and COPYING.LESSER files). If not,
# see <http://www.gnu.org/licenses/>.
mbtests
:
image
:
immc/marblesbag-valid:v0.1
script
:
-
make -j4
-
cd validation
-
python mbtests.py
.ycm_extra_conf.py
0 → 100644
View file @
23b7453d
from
distutils.sysconfig
import
get_python_inc
import
platform
import
os
import
ycm_core
# These are the compilation flags that will be used in case there's no
# compilation database set (by default, one is not set).
# CHANGE THIS LIST OF FLAGS. YES, THIS IS THE DROID YOU HAVE BEEN LOOKING FOR.
flags
=
[
'-Wno-unused-function'
,
'-std=gnu99'
,
'-Iscontact'
,
'-Ihxt'
,
'-Isrc'
,
'-DDIMENSION=2'
]
# Clang automatically sets the '-std=' flag to 'c++14' for MSVC 2015 or later,
# which is required for compiling the standard library, and to 'c++11' for older
# versions.
#if platform.system() != 'Windows':
# flags.append( '-std=c++11' )
# Set this to the absolute path to the folder (NOT the file!) containing the
# compile_commands.json file to use that instead of 'flags'. See here for
# more details: http://clang.llvm.org/docs/JSONCompilationDatabase.html
#
# You can get CMake to generate this file for you by adding:
# set( CMAKE_EXPORT_COMPILE_COMMANDS 1 )
# to your CMakeLists.txt file.
#
# Most projects will NOT need to set this to anything; you can just change the
# 'flags' list of compilation flags. Notice that YCM itself uses that approach.
compilation_database_folder
=
''
if
os
.
path
.
exists
(
compilation_database_folder
):
database
=
ycm_core
.
CompilationDatabase
(
compilation_database_folder
)
else
:
database
=
None
SOURCE_EXTENSIONS
=
[
'.cpp'
,
'.cxx'
,
'.cc'
,
'.c'
,
'.m'
,
'.mm'
]
def
DirectoryOfThisScript
():
return
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
)
)
def
IsHeaderFile
(
filename
):
extension
=
os
.
path
.
splitext
(
filename
)[
1
]
return
extension
in
[
'.h'
,
'.hxx'
,
'.hpp'
,
'.hh'
]
def
FindCorrespondingSourceFile
(
filename
):
if
IsHeaderFile
(
filename
):
basename
=
os
.
path
.
splitext
(
filename
)[
0
]
for
extension
in
SOURCE_EXTENSIONS
:
replacement_file
=
basename
+
extension
if
os
.
path
.
exists
(
replacement_file
):
return
replacement_file
return
filename
def
FlagsForFile
(
filename
,
**
kwargs
):
# If the file is a header, try to find the corresponding source file and
# retrieve its flags from the compilation database if using one. This is
# necessary since compilation databases don't have entries for header files.
# In addition, use this source file as the translation unit. This makes it
# possible to jump from a declaration in the header file to its definition in
# the corresponding source file.
filename
=
FindCorrespondingSourceFile
(
filename
)
if
not
database
:
return
{
'flags'
:
flags
,
'include_paths_relative_to_dir'
:
DirectoryOfThisScript
(),
'override_filename'
:
filename
}
compilation_info
=
database
.
GetCompilationInfoForFile
(
filename
)
if
not
compilation_info
.
compiler_flags_
:
return
None
# Bear in mind that compilation_info.compiler_flags_ does NOT return a
# python list, but a "list-like" StringVec object.
final_flags
=
list
(
compilation_info
.
compiler_flags_
)
# NOTE: This is just for YouCompleteMe; it's highly likely that your project
# does NOT need to remove the stdlib flag. DO NOT USE THIS IN YOUR
# ycm_extra_conf IF YOU'RE NOT 100% SURE YOU NEED IT.
try
:
final_flags
.
remove
(
'-stdlib=libc++'
)
except
ValueError
:
pass
return
{
'flags'
:
final_flags
,
'include_paths_relative_to_dir'
:
compilation_info
.
compiler_working_dir_
,
'override_filename'
:
filename
}
docker/Dockerfile
View file @
23b7453d
...
...
@@ -2,6 +2,7 @@ FROM ubuntu:17.10
RUN
apt update
RUN
apt
install
-y
git python3 petsc-dev
RUN
apt
install
-y
curl
RUN
curl
-O
http://gmsh.info/bin/Linux/gmsh-3.0.6-Linux64.tgz
&&
tar
xf gmsh-3.0.6-Linux64.tgz
&&
mv
gmsh-3.0.6-Linux64/bin/gmsh /usr/local/bin
...
...
docker/README
0 → 100644
View file @
23b7453d
# build image
docker build -t immc/marblesbag-valid:v0.1 .
# push image to docker-hub
docker login
docker push immc/marblesbag-valid
testcases/poiseuille/poiseuilleTest.py
deleted
100644 → 0
View file @
a5f7adf7
# Marblesbag - Copyright (C) <2010-2018>
# <Universite catholique de Louvain (UCL), Belgium
# Universite de Montpellier, France>
#
# List of the contributors to the development of Marblesbag: see AUTHORS file.
# Description and complete License: see LICENSE file.
#
# This program (Marblesbag) is free software:
# you can redistribute it and/or modify it under the terms of the GNU Lesser General
# Public License as published by the Free Software Foundation, either version
# 3 of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program (see COPYING and COPYING.LESSER files). If not,
# see <http://www.gnu.org/licenses/>.
#!/usr/bin/env python
from
marblesbag
import
fluid
as
fluid
from
marblesbag
import
scontact2
import
numpy
as
np
import
os
import
time
import
shutil
import
random
#Physical parameters for the drops are the ones presented by Metzger et al. (2007) "Falling clouds of particles in viscous fluids"
outputdir
=
"output"
if
not
os
.
path
.
isdir
(
outputdir
)
:
os
.
makedirs
(
outputdir
)
t
=
0
ii
=
0
#physical parameters
g
=
-
9.81
# gravity
rho
=
1000
# fluid density
nu
=
1e-3
# kinematic viscosity
mu
=
nu
*
rho
# dynamic viscosity
tEnd
=
100000
# final time
#numerical parameters
lcmin
=
.
1
# mesh size
dt
=
10
# time step
alpha
=
1e-4
# stabilization coefficient
epsilon
=
alpha
*
lcmin
**
2
/
nu
# stabilization parametre
print
(
'epsilon'
,
epsilon
)
shutil
.
copy
(
"mesh.msh"
,
outputdir
+
"/mesh.msh"
)
outf
=
1
# number of iterations between output files
#Object fluid creation + Boundary condition of the fluid (field 0 is horizontal velocity; field 1 is vertical velocity; field 2 is pressure)
#Format: strong_boundaries = [(Boundary tag, Fluid field, Value)
strong_boundaries
=
[(
"Top"
,
1
,
1
,
0.
),(
"Bottom"
,
1
,
1
,
0.
),(
"LeftUp"
,
1
,
1
,
0.
),(
"RightUp"
,
1
,
1
,
0.
),(
"LeftDown"
,
1
,
1
,
0.
),(
"RightDown"
,
1
,
1
,
0.
),(
"Top"
,
0
,
0
,
0.
),(
"Bottom"
,
0
,
0
,
0.
),(
"LeftUp"
,
0
,
0
,
lambda
x
:
1
/
(
20
*
mu
)
*
x
[:,
1
]
*
(
1
-
x
[:,
1
])),(
"LeftDown"
,
0
,
0
,
lambda
x
:
1
/
(
20
*
mu
)
*
x
[:,
1
]
*
(
1
-
x
[:,
1
]))]
fluid
=
fluid
.
fluid_problem
(
"mesh.msh"
,
g
,[
nu
*
rho
],[
rho
],
epsilon
,
strong_boundaries
,
1
)
ii
=
0
t
=
0
#set initial_condition
x
=
fluid
.
coordinates
()
s
=
fluid
.
solution
()
a
=
(
x
[:,
0
]
+
5
)
/
10
s
[:,
2
]
=
1.
fluid
.
export_vtk
(
outputdir
,
0
,
0
)
ii
=
0
tic
=
time
.
clock
()
while
ii
<
100
:
#Fluid solver
fluid
.
implicit_euler
(
dt
)
t
+=
dt
#Output files writting
if
ii
%
outf
==
0
:
ioutput
=
int
(
ii
/
outf
)
+
1
fluid
.
export_vtk
(
outputdir
,
t
,
ioutput
)
ii
+=
1
print
(
"%i : %.2g/%.2g (cpu %.6g)"
%
(
ii
,
t
,
tEnd
,
time
.
clock
()
-
tic
))
s
=
fluid
.
solution
()
x
=
fluid
.
coordinates
()
vel
=
(
s
[:,
0
]
-
1
/
(
20
*
nu
*
rho
)
*
x
[:,
1
]
*
(
1
-
x
[:,
1
]))
**
2
print
(
'Error'
,
(
vel
.
sum
())
**
.
5
)
if
(
vel
.
sum
())
**
.
5
<
1.5e-3
:
exit
(
1
)
else
:
exit
(
0
)
\ No newline at end of file
testcases/poiseuille2fluids/poiseuilleTest.py
deleted
100644 → 0
View file @
a5f7adf7
# Marblesbag - Copyright (C) <2010-2018>
# <Universite catholique de Louvain (UCL), Belgium
# Universite de Montpellier, France>
#
# List of the contributors to the development of Marblesbag: see AUTHORS file.
# Description and complete License: see LICENSE file.
#
# This program (Marblesbag) is free software:
# you can redistribute it and/or modify it under the terms of the GNU Lesser General
# Public License as published by the Free Software Foundation, either version
# 3 of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program (see COPYING and COPYING.LESSER files). If not,
# see <http://www.gnu.org/licenses/>.
#!/usr/bin/env python
from
marblesbag
import
fluid
as
fluid
from
marblesbag
import
scontact2
import
numpy
as
np
import
os
import
time
import
shutil
import
random
#Physical parameters for the drops are the ones presented by Metzger et al. (2007) "Falling clouds of particles in viscous fluids"
outputdir
=
"output"
if
not
os
.
path
.
isdir
(
outputdir
)
:
os
.
makedirs
(
outputdir
)
t
=
0
ii
=
0
#physical parameters
g
=
-
9.81
# gravity
rho
=
1000
# fluid density
nu0
=
1e-3
# kinematic viscosity
nu1
=
1e-3
# kinematic viscosity
tEnd
=
100000
# final time
#numerical parameters
lcmin
=
.
1
# mesh size
dt
=
10
# time step
alpha
=
1e-4
# stabilization coefficient
epsilon
=
alpha
*
lcmin
**
2
/
min
(
nu0
,
nu1
)
# stabilization parametre
print
(
'epsilon'
,
epsilon
)
shutil
.
copy
(
"mesh.msh"
,
outputdir
+
"/mesh.msh"
)
outf
=
1
# number of iterations between output files
#Object fluid creation + Boundary condition of the fluid (field 0 is horizontal velocity; field 1 is vertical velocity; field 2 is pressure)
#Format: strong_boundaries = [(Boundary tag, Fluid field, Value)
u0
,
v0
,
q0
=
0
,
1
,
2
u1
,
v1
,
q1
=
3
,
4
,
5
p
=
6
strong_boundaries
=
[
(
"Bottom"
,
u0
,
u0
,
0
),
(
"Bottom"
,
v0
,
v0
,
0.
),
(
"Bottom"
,
u1
,
u1
,
0
),
(
"Bottom"
,
v1
,
v1
,
0.
),
(
"Top"
,
u0
,
u0
,
0
),
(
"Top"
,
v0
,
v0
,
0.
),
(
"Top"
,
u1
,
u1
,
0
),
(
"Top"
,
v1
,
v1
,
0.
),
(
"LeftUp"
,
u0
,
u0
,
lambda
x
:
x
[:,
1
]
/
(
20
*
nu0
*
rho
)
*
x
[:,
1
]
*
(
1
-
x
[:,
1
])),
(
"LeftUp"
,
v0
,
v0
,
0
),
(
"LeftUp"
,
q0
,
q0
,
lambda
x
:
x
[:,
1
]),
(
"LeftUp"
,
u1
,
u1
,
lambda
x
:
(
1
-
x
[:,
1
])
/
(
20
*
nu1
*
rho
)
*
x
[:,
1
]
*
(
1
-
x
[:,
1
])),
(
"LeftUp"
,
v1
,
v1
,
0
),
(
"LeftDown"
,
u0
,
u0
,
lambda
x
:
(
x
[:,
1
])
/
(
20
*
nu0
*
rho
)
*
x
[:,
1
]
*
(
1
-
x
[:,
1
])),
(
"LeftDown"
,
v0
,
v0
,
0
),
(
"LeftDown"
,
q0
,
q0
,
lambda
x
:
x
[:,
1
]),
(
"LeftDown"
,
u1
,
u1
,
lambda
x
:
(
1
-
x
[:,
1
])
/
(
20
*
nu1
*
rho
)
*
x
[:,
1
]
*
(
1
-
x
[:,
1
])),
(
"LeftDown"
,
v1
,
v1
,
0
),
(
"RightDown"
,
v0
,
v0
,
0
),
(
"RightDown"
,
v1
,
v1
,
0
),
(
"RightUp"
,
v0
,
v0
,
0
),
(
"RightUp"
,
v1
,
v1
,
0
),
]
fluid
=
fluid
.
fluid_problem
(
"mesh.msh"
,
g
,[
nu0
*
rho
,
nu1
*
rho
],[
rho
,
rho
],
epsilon
,
strong_boundaries
,
2
)
ii
=
0
t
=
0
#set initial_condition
x
=
fluid
.
coordinates
()
s
=
fluid
.
solution
()
a
=
(
x
[:,
0
]
+
5
)
/
10
s
[:,
2
]
=
x
[:,
1
]
s
[:,
5
]
=
1
-
s
[:,
2
]
fluid
.
export_vtk
(
outputdir
,
0
,
0
)
ii
=
0
tic
=
time
.
clock
()
while
ii
<
100
:
#Fluid solver
fluid
.
implicit_euler
(
dt
)
t
+=
dt
#Output files writting
if
ii
%
outf
==
0
:
ioutput
=
int
(
ii
/
outf
)
+
1
fluid
.
export_vtk
(
outputdir
,
t
,
ioutput
)
ii
+=
1
print
(
"%i : %.2g/%.2g (cpu %.6g)"
%
(
ii
,
t
,
tEnd
,
time
.
clock
()
-
tic
))
s
=
fluid
.
solution
()
x
=
fluid
.
coordinates
()
vel
=
(
s
[:,
0
]
+
s
[:,
3
]
-
1
/
(
20
*
nu0
*
rho
)
*
x
[:,
1
]
*
(
1
-
x
[:,
1
]))
**
2
print
(
'Error'
,
(
vel
.
sum
())
**
.
5
)
if
(
vel
.
sum
())
**
.
5
<
2.2e-3
:
exit
(
1
)
else
:
exit
(
0
)
\ No newline at end of file
validation/mbtests.py
0 → 100644
View file @
23b7453d
import
unittest
all_tests
=
[
"poiseuille.poiseuille"
,
"poiseuille.poiseuille-2fluids"
]
suite
=
unittest
.
TestSuite
()
for
t
in
all_tests
:
suite
.
addTest
(
unittest
.
defaultTestLoader
.
loadTestsFromName
(
t
))
unittest
.
TextTestRunner
().
run
(
suite
)
validation/poiseuille/mesh.geo
0 → 100644
View file @
23b7453d
L = 5;
H = 1;
y = 0;
lc = .05;
Point(1) = {-L, H, 0, lc};
Point(2) = {-L, H/2., 0, lc};
Point(3) = {-L,0,0,lc};
Point(4) = {L, 0, 0, lc};
Point(5) = {L,H/2.,0,lc};
Point(6) = {L, H, 0, lc};
Line(1) = {1, 2};
Line(2) = {2, 3};
Line(3) = {3, 4};
Line(4) = {4, 5};
Line(5) = {5, 6};
Line(6) = {6, 1};
Line Loop(1) = {1:6};
Plane Surface(1) = {1};
Physical Line("LeftUp") = {1};
Physical Line("LeftDown") = {2};
Physical Line("RightDown") = {4};
Physical Line("RightUp") = {5};
Physical Line("Bottom") = {3};
Physical Line("Top") = {6};
Physical Surface("Domain") = {1};
Physical Point("PtFix") = {1};
validation/poiseuille/poiseuille-2fluids.py
0 → 100644
View file @
23b7453d
# Marblesbag - Copyright (C) <2010-2018>
# <Universite catholique de Louvain (UCL), Belgium
# Universite de Montpellier, France>
#
# List of the contributors to the development of Marblesbag: see AUTHORS file.
# Description and complete License: see LICENSE file.
#
# This program (Marblesbag) is free software:
# you can redistribute it and/or modify it under the terms of the GNU Lesser General
# Public License as published by the Free Software Foundation, either version
# 3 of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program (see COPYING and COPYING.LESSER files). If not,
# see <http://www.gnu.org/licenses/>.
#!/usr/bin/env python
from
marblesbag
import
fluid
as
mbfluid
from
marblesbag
import
scontact2
import
numpy
as
np
import
os
import
time
import
shutil
import
random
import
subprocess
#Physical parameters for the drops are the ones presented by Metzger et al. (2007) "Falling clouds of particles in viscous fluids"
import
unittest
class
Poiseuille
(
unittest
.
TestCase
)
:
def
runTest
(
self
)
:
dir_path
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
os
.
chdir
(
dir_path
)
outputdir
=
"output"
if
not
os
.
path
.
isdir
(
outputdir
)
:
os
.
makedirs
(
outputdir
)
subprocess
.
call
([
"gmsh"
,
"-2"
,
"mesh.geo"
,
"-clscale"
,
"2"
])
t
=
0
ii
=
0
#physical parameters
g
=
-
9.81
# gravity
rho
=
1000
# fluid density
nu0
=
1e-3
# kinematic viscosity
nu1
=
1e-3
# kinematic viscosity
tEnd
=
100000
# final time
#numerical parameters
lcmin
=
.
1
# mesh size
dt
=
10
# time step
alpha
=
1e-4
# stabilization coefficient
epsilon
=
alpha
*
lcmin
**
2
/
min
(
nu0
,
nu1
)
# stabilization parametre
print
(
'epsilon'
,
epsilon
)
shutil
.
copy
(
"mesh.msh"
,
outputdir
+
"/mesh.msh"
)
outf
=
1
# number of iterations between output files
#Object fluid creation + Boundary condition of the fluid (field 0 is horizontal velocity; field 1 is vertical velocity; field 2 is pressure)
#Format: strong_boundaries = [(Boundary tag, Fluid field, Value)
u0
,
v0
,
q0
=
0
,
1
,
2
u1
,
v1
,
q1
=
3
,
4
,
5
p
=
6
strong_boundaries
=
[
(
"Bottom"
,
u0
,
u0
,
0
),
(
"Bottom"
,
v0
,
v0
,
0.
),
(
"Bottom"
,
u1
,
u1
,
0
),
(
"Bottom"
,
v1
,
v1
,
0.
),
(
"Top"
,
u0
,
u0
,
0
),
(
"Top"
,
v0
,
v0
,
0.
),
(
"Top"
,
u1
,
u1
,
0
),
(
"Top"
,
v1
,
v1
,
0.
),
(
"LeftUp"
,
u0
,
u0
,
lambda
x
:
x
[:,
1
]
/
(
20
*
nu0
*
rho
)
*
x
[:,
1
]
*
(
1
-
x
[:,
1
])),
(
"LeftUp"
,
v0
,
v0
,
0
),
(
"LeftUp"
,
q0
,
q0
,
lambda
x
:
x
[:,
1
]),
(
"LeftUp"
,
u1
,
u1
,
lambda
x
:
(
1
-
x
[:,
1
])
/
(
20
*
nu1
*
rho
)
*
x
[:,
1
]
*
(
1
-
x
[:,
1
])),
(
"LeftUp"
,
v1
,
v1
,
0
),
(
"LeftDown"
,
u0
,
u0
,
lambda
x
:
(
x
[:,
1
])
/
(
20
*
nu0
*
rho
)
*
x
[:,
1
]
*
(
1
-
x
[:,
1
])),
(
"LeftDown"
,
v0
,
v0
,
0
),
(
"LeftDown"
,
q0
,
q0
,
lambda
x
:
x
[:,
1
]),
(
"LeftDown"
,
u1
,
u1
,
lambda
x
:
(
1
-
x
[:,
1
])
/
(
20
*
nu1
*
rho
)
*
x
[:,
1
]
*
(
1
-
x
[:,
1
])),
(
"LeftDown"
,
v1
,
v1
,
0
),
(
"RightDown"
,
v0
,
v0
,
0
),
(
"RightDown"
,
v1
,
v1
,
0
),
(
"RightUp"
,
v0
,
v0
,
0
),
(
"RightUp"
,
v1
,
v1
,
0
),
]
fluid
=
mbfluid
.
fluid_problem
(
"mesh.msh"
,
g
,[
nu0
*
rho
,
nu1
*
rho
],[
rho
,
rho
],
epsilon
,
strong_boundaries
,
2
)
ii
=
0
t
=
0
#set initial_condition
x
=
fluid
.
coordinates
()
s
=
fluid
.
solution
()
a
=
(
x
[:,
0
]
+
5
)
/
10
s
[:,
2
]
=
x
[:,
1
]
s
[:,
5
]
=
1
-
s
[:,
2
]
fluid
.
export_vtk
(
outputdir
,
0
,
0
)
ii
=
0
tic
=
time
.
clock
()
while
ii
<
100
:
#Fluid solver
fluid
.
implicit_euler
(
dt
)
t
+=
dt
#Output files writting
if
ii
%
outf
==
0
:
ioutput
=
int
(
ii
/
outf
)
+
1
fluid
.
export_vtk
(
outputdir
,
t
,
ioutput
)
ii
+=
1
print
(
"%i : %.2g/%.2g (cpu %.6g)"
%
(
ii
,
t
,
tEnd
,
time
.
clock
()
-
tic
))
s
=
fluid
.
solution
()
x
=
fluid
.
coordinates
()
vel
=
(
s
[:,
0
]
+
s
[:,
3
]
-
1
/
(
20
*
nu0
*
rho
)
*
x
[:,
1
]
*
(
1
-
x
[:,
1
]))
**
2
print
(
'Error'
,
(
vel
.
sum
())
**
.
5
)
self
.
assertLess
(
vel
.
sum
()
**
.
5
,
2.2e-3
,
"error is too large in Poiseuille 2 fluids"
)
validation/poiseuille/poiseuille.py
0 → 100644
View file @
23b7453d
# Marblesbag - Copyright (C) <2010-2018>
# <Universite catholique de Louvain (UCL), Belgium
# Universite de Montpellier, France>
#
# List of the contributors to the development of Marblesbag: see AUTHORS file.
# Description and complete License: see LICENSE file.
#
# This program (Marblesbag) is free software:
# you can redistribute it and/or modify it under the terms of the GNU Lesser General
# Public License as published by the Free Software Foundation, either version
# 3 of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program (see COPYING and COPYING.LESSER files). If not,
# see <http://www.gnu.org/licenses/>.
#!/usr/bin/env python
from
marblesbag
import
fluid
as
mbfluid
from
marblesbag
import
scontact2
import
numpy
as
np
import
os
import
subprocess
import
time
import
shutil
import
random
import
unittest
class
Poiseuille
(
unittest
.
TestCase
)
:
def
runTest
(
self
)
:
dir_path
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
os
.
chdir
(
dir_path
)
# Physical parameters for the drops are the ones presented by Metzger et al. (2007) "Falling clouds of particles in viscous fluids"
outputdir
=
"output"
if
not
os
.
path
.
isdir
(
outputdir
)
:
os
.
makedirs
(
outputdir
)
subprocess
.
call
([
"gmsh"
,
"-2"
,
"mesh.geo"
,
"-clscale"
,
"2"
])
t
=
0
ii
=
0
#physical parameters
g
=
-
9.81
# gravity
rho
=
1000
# fluid density
nu
=
1e-3
# kinematic viscosity
mu
=
nu
*
rho
# dynamic viscosity
tEnd
=
100000
# final time
#numerical parameters
lcmin
=
.
1
# mesh size
dt
=
10
# time step
alpha
=
1e-4
# stabilization coefficient
epsilon
=
alpha
*
lcmin
**
2
/
nu
# stabilization parametre