Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
hysop
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
particle_methods
hysop
Commits
e33e4aac
There was a problem fetching the pipeline summary.
Commit
e33e4aac
authored
6 years ago
by
Jean-Baptiste Keck
Browse files
Options
Downloads
Patches
Plain Diff
3D periodic jet with levelset
parent
1c66eb32
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!10
Resolve "Fix default parameters for the periodic bubble example"
Pipeline
#
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
examples/bubble/periodic_jet_levelset.py
+31
-9
31 additions, 9 deletions
examples/bubble/periodic_jet_levelset.py
with
31 additions
and
9 deletions
examples/bubble/periodic_jet_levelset.py
+
31
−
9
View file @
e33e4aac
...
@@ -21,11 +21,11 @@ def init_rho(data, coords):
...
@@ -21,11 +21,11 @@ def init_rho(data, coords):
def
init_phi
(
data
,
coords
,
L
):
def
init_phi
(
data
,
coords
,
L
):
phi
=
data
[
0
]
phi
=
data
[
0
]
phi
[...]
=
np
.
inf
phi
[...]
=
np
.
inf
Di
=
np
.
empty
_like
(
phi
)
Di
=
np
.
ones
_like
(
phi
)
X
,
Y
=
coords
X
,
Y
=
coords
[:
2
]
Ly
,
Lx
=
L
Ly
,
Lx
=
L
[:
2
]
R
=
Lx
*
(
0.15
-
0.05
*
np
.
sin
(
2
*
np
.
pi
*
Y
/
Ly
)
+
0.001
*
np
.
cos
(
2
*
np
.
pi
*
10
*
Y
/
Ly
))
R
=
Lx
*
(
0.15
-
0.05
*
np
.
sin
(
2
*
np
.
pi
*
Y
/
Ly
)
+
0.001
*
np
.
cos
(
2
*
np
.
pi
*
10
*
Y
/
Ly
))
Di
[...]
=
(
X
-
0.5
*
Lx
)
**
2
-
R
**
2
Di
[...]
*
=
(
X
-
0.5
*
Lx
)
**
2
-
R
**
2
mask
=
(
np
.
abs
(
Di
)
<
np
.
abs
(
phi
))
mask
=
(
np
.
abs
(
Di
)
<
np
.
abs
(
phi
))
phi
[
mask
]
=
Di
[
mask
]
phi
[
mask
]
=
Di
[
mask
]
assert
np
.
isfinite
(
phi
).
all
()
assert
np
.
isfinite
(
phi
).
all
()
...
@@ -148,10 +148,32 @@ def compute(args):
...
@@ -148,10 +148,32 @@ def compute(args):
diffuse
=
DirectionalDiffusion
(
implementation
=
impl
,
diffuse
=
DirectionalDiffusion
(
implementation
=
impl
,
name
=
'
diffuse_{}
'
.
format
(
vorti
.
name
),
name
=
'
diffuse_{}
'
.
format
(
vorti
.
name
),
pretty_name
=
u
'
D{}
'
.
format
(
vorti
.
pretty_name
.
decode
(
'
utf-8
'
)),
pretty_name
=
u
'
D{}
'
.
format
(
vorti
.
pretty_name
.
decode
(
'
utf-8
'
)),
coeffs
=
(
args
.
mu
,
args
.
mu
/
10.0
),
coeffs
=
(
args
.
mu
/
10.0
,
),
fields
=
(
vorti
,
phi
),
fields
=
(
phi
,
),
variables
=
{
vorti
:
npts
,
phi
:
npts
},
variables
=
{
vorti
:
npts
,
phi
:
npts
},
dt
=
dt
,
**
extra_op_kwds
)
dt
=
dt
,
**
extra_op_kwds
)
#> Directional stretching + diffusion
if
(
dim
==
3
):
stretch_diffuse
=
DirectionalStretchingDiffusion
(
implementation
=
impl
,
name
=
'
stretch_diffuse
'
,
pretty_name
=
u
'
SD{}
'
.
format
(
vorti
.
pretty_name
.
decode
(
'
utf-8
'
)),
formulation
=
args
.
stretching_formulation
,
viscosity
=
args
.
mu
,
velocity
=
velo
,
vorticity
=
vorti
,
variables
=
{
velo
:
npts
,
vorti
:
npts
},
dt
=
dt
,
**
extra_op_kwds
)
elif
(
dim
==
2
):
stretch_diffuse
=
DirectionalDiffusion
(
implementation
=
impl
,
name
=
'
diffuse_{}
'
.
format
(
vorti
.
name
),
pretty_name
=
u
'
D{}
'
.
format
(
vorti
.
pretty_name
.
decode
(
'
utf-8
'
)),
coeffs
=
args
.
mu
,
fields
=
vorti
,
variables
=
{
vorti
:
npts
},
dt
=
dt
,
**
extra_op_kwds
)
else
:
msg
=
'
Unsupported dimension {}.
'
.
format
(
dim
)
raise
RuntimeError
(
msg
)
#> External force rot(-rho*g)
#> External force rot(-rho*g)
Fext
=
np
.
zeros
(
shape
=
(
dim
,),
dtype
=
object
).
view
(
SymbolicTensor
)
Fext
=
np
.
zeros
(
shape
=
(
dim
,),
dtype
=
object
).
view
(
SymbolicTensor
)
...
@@ -169,7 +191,7 @@ def compute(args):
...
@@ -169,7 +191,7 @@ def compute(args):
#> Directional splitting operator subgraph
#> Directional splitting operator subgraph
splitting
=
StrangSplitting
(
splitting_dim
=
dim
,
order
=
args
.
strang_order
)
splitting
=
StrangSplitting
(
splitting_dim
=
dim
,
order
=
args
.
strang_order
)
splitting
.
push_operators
(
advec
,
diffuse
,
eval_fields
,
external_force
)
splitting
.
push_operators
(
advec
,
diffuse
,
stretch_diffuse
,
eval_fields
,
external_force
)
### Build standard operators
### Build standard operators
#> Poisson operator to recover the velocity from the vorticity
#> Poisson operator to recover the velocity from the vorticity
...
@@ -310,8 +332,8 @@ if __name__=='__main__':
...
@@ -310,8 +332,8 @@ if __name__=='__main__':
def
_setup_parameters
(
self
,
args
):
def
_setup_parameters
(
self
,
args
):
dim
=
args
.
ndim
dim
=
args
.
ndim
if
(
dim
not
in
(
2
,)):
if
(
dim
not
in
(
2
,
3
)):
msg
=
'
Domain should be 2D.
'
msg
=
'
Domain should be 2D
or 3D
.
'
self
.
error
(
msg
)
self
.
error
(
msg
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment