Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
TurTLE
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
Service Desk
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
TurTLE
TurTLE
Commits
b49f29db
Commit
b49f29db
authored
9 years ago
by
Cristian Lalescu
Browse files
Options
Downloads
Plain Diff
Merge branch 'feature/executable' into develop
parents
a622d95a
f11c52a1
Branches
Branches containing commit
Tags
0.5
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
bfps/Launcher.py
+65
-20
65 additions, 20 deletions
bfps/Launcher.py
bfps/__init__.py
+0
-38
0 additions, 38 deletions
bfps/__init__.py
with
65 additions
and
58 deletions
bfps/Launcher.py
+
65
−
20
View file @
b49f29db
import
os
import
os
import
sys
import
argparse
import
numpy
as
np
import
bfps
import
bfps
class
Launcher
:
class
Launcher
:
def
__init__
(
def
__init__
(
self
):
self
,
self
.
base_class
=
bfps
.
NavierStokes
data_dir
=
'
./
'
):
self
.
parser
=
argparse
.
ArgumentParser
(
prog
=
'
bfps
'
)
self
.
parser
=
bfps
.
get_parser
(
self
.
parser
.
add_argument
(
bfps
.
NavierStokes
,
'
-v
'
,
'
--version
'
,
work_dir
=
os
.
path
.
realpath
(
data_dir
))
action
=
'
version
'
,
version
=
'
%(prog)s
'
+
bfps
.
__version__
)
self
.
parser
.
add_argument
(
'
-n
'
,
type
=
int
,
dest
=
'
n
'
,
default
=
32
,
metavar
=
'
N
'
,
help
=
'
code is run by default in a grid of NxNxN
'
)
self
.
parser
.
add_argument
(
'
--run
'
,
dest
=
'
run
'
,
action
=
'
store_true
'
)
self
.
parser
.
add_argument
(
'
--ncpu
'
,
type
=
int
,
dest
=
'
ncpu
'
,
default
=
2
)
self
.
parser
.
add_argument
(
'
--precision
'
,
type
=
str
,
dest
=
'
precision
'
,
default
=
'
single
'
)
self
.
parser
.
add_argument
(
'
--simname
'
,
type
=
str
,
dest
=
'
simname
'
,
default
=
'
test
'
)
self
.
parser
.
add_argument
(
'
--wd
'
,
type
=
str
,
dest
=
'
work_dir
'
,
default
=
'
./
'
)
self
.
parser
.
add_argument
(
'
--njobs
'
,
type
=
int
,
dest
=
'
njobs
'
,
default
=
1
)
self
.
parser
.
add_argument
(
self
.
parser
.
add_argument
(
'
--QR-stats
'
,
'
--QR-stats
'
,
action
=
'
store_true
'
,
action
=
'
store_true
'
,
dest
=
'
QR_stats
'
)
dest
=
'
QR_stats
'
,
help
=
'
add this option if you want to compute velocity gradient and QR stats
'
)
self
.
parser
.
add_argument
(
self
.
parser
.
add_argument
(
'
--kMeta
'
,
'
--kMeta
'
,
type
=
float
,
type
=
float
,
...
@@ -41,8 +73,18 @@ class Launcher:
...
@@ -41,8 +73,18 @@ class Launcher:
type
=
int
,
type
=
int
,
dest
=
'
src_iteration
'
,
dest
=
'
src_iteration
'
,
default
=
0
)
default
=
0
)
self
.
data_dir
=
data_dir
self
.
parser
.
add_argument
(
self
.
base_class
=
bfps
.
NavierStokes
'
--particle-rand-seed
'
,
type
=
int
,
dest
=
'
particle_rand_seed
'
,
default
=
None
)
c
=
self
.
base_class
()
for
k
in
sorted
(
c
.
parameters
.
keys
()):
self
.
parser
.
add_argument
(
'
--{0}
'
.
format
(
k
),
type
=
type
(
c
.
parameters
[
k
]),
dest
=
k
,
default
=
None
)
return
None
return
None
def
__call__
(
def
__call__
(
self
,
self
,
...
@@ -50,17 +92,14 @@ class Launcher:
...
@@ -50,17 +92,14 @@ class Launcher:
opt
=
self
.
parser
.
parse_args
(
args
)
opt
=
self
.
parser
.
parse_args
(
args
)
if
opt
.
environment
!=
''
:
if
opt
.
environment
!=
''
:
bfps
.
host_info
[
'
environment
'
]
=
opt
.
environment
bfps
.
host_info
[
'
environment
'
]
=
opt
.
environment
opt
.
nx
=
opt
.
n
opt
.
ny
=
opt
.
n
opt
.
nz
=
opt
.
n
opt
.
work_dir
=
os
.
path
.
join
(
opt
.
work_dir
=
os
.
path
.
join
(
os
.
path
.
realpath
(
opt
.
work_dir
),
os
.
path
.
realpath
(
opt
.
work_dir
),
'
N{0:0>4}
'
.
format
(
opt
.
n
))
'
N{0:0>4}
'
.
format
(
opt
.
n
))
c
=
self
.
base_class
(
c
=
self
.
base_class
(
work_dir
=
opt
.
work_dir
,
fluid_precision
=
opt
.
precision
,
fluid_precision
=
opt
.
precision
,
simname
=
opt
.
simname
,
simname
=
opt
.
simname
,
QR_stats_on
=
opt
.
QR_stats
)
QR_stats_on
=
opt
.
QR_stats
)
c
.
pars_from_namespace
(
opt
)
# with the default Lundgren forcing, I can estimate the dissipation
# with the default Lundgren forcing, I can estimate the dissipation
# with nondefault forcing, figure out the amplitude for this viscosity
# with nondefault forcing, figure out the amplitude for this viscosity
# yourself
# yourself
...
@@ -75,6 +114,16 @@ class Launcher:
...
@@ -75,6 +114,16 @@ class Launcher:
meantrS2
=
(
opt
.
n
//
2
/
opt
.
kMeta
)
**
4
*
c
.
parameters
[
'
nu
'
]
**
2
meantrS2
=
(
opt
.
n
//
2
/
opt
.
kMeta
)
**
4
*
c
.
parameters
[
'
nu
'
]
**
2
c
.
parameters
[
'
max_Q_estimate
'
]
=
meantrS2
c
.
parameters
[
'
max_Q_estimate
'
]
=
meantrS2
c
.
parameters
[
'
max_R_estimate
'
]
=
.
4
*
meantrS2
**
1.5
c
.
parameters
[
'
max_R_estimate
'
]
=
.
4
*
meantrS2
**
1.5
# command line parameters will overwrite any defaults
cmd_line_pars
=
vars
(
opt
)
for
k
in
[
'
nx
'
,
'
ny
'
,
'
nz
'
]:
if
type
(
cmd_line_pars
[
k
])
==
type
(
None
):
cmd_line_pars
[
k
]
=
opt
.
n
for
k
in
c
.
parameters
.
keys
():
if
k
in
cmd_line_pars
.
keys
():
if
not
type
(
cmd_line_pars
[
k
])
==
type
(
None
):
c
.
parameters
[
k
]
=
cmd_line_pars
[
k
]
c
.
fill_up_fluid_code
()
c
.
fill_up_fluid_code
()
c
.
finalize_code
()
c
.
finalize_code
()
c
.
write_src
()
c
.
write_src
()
...
@@ -83,11 +132,7 @@ class Launcher:
...
@@ -83,11 +132,7 @@ class Launcher:
if
not
os
.
path
.
exists
(
os
.
path
.
join
(
c
.
work_dir
,
c
.
simname
+
'
.h5
'
)):
if
not
os
.
path
.
exists
(
os
.
path
.
join
(
c
.
work_dir
,
c
.
simname
+
'
.h5
'
)):
c
.
write_par
()
c
.
write_par
()
if
c
.
parameters
[
'
nparticles
'
]
>
0
:
if
c
.
parameters
[
'
nparticles
'
]
>
0
:
if
opt
.
particle_rand_seed
!=
0
:
data
=
c
.
generate_tracer_state
(
species
=
0
,
rseed
=
opt
.
particle_rand_seed
)
rseed
=
opt
.
particle_rand_seed
else
:
rseed
=
None
data
=
c
.
generate_tracer_state
(
species
=
0
,
rseed
=
rseed
)
for
s
in
range
(
1
,
c
.
particle_species
):
for
s
in
range
(
1
,
c
.
particle_species
):
c
.
generate_tracer_state
(
species
=
s
,
data
=
data
)
c
.
generate_tracer_state
(
species
=
s
,
data
=
data
)
init_condition_file
=
os
.
path
.
join
(
init_condition_file
=
os
.
path
.
join
(
...
...
This diff is collapsed.
Click to expand it.
bfps/__init__.py
+
0
−
38
View file @
b49f29db
...
@@ -53,41 +53,3 @@ from .fluid_converter import fluid_converter
...
@@ -53,41 +53,3 @@ from .fluid_converter import fluid_converter
from
.fluid_resize
import
fluid_resize
from
.fluid_resize
import
fluid_resize
from
.NavierStokes
import
NavierStokes
from
.NavierStokes
import
NavierStokes
import
argparse
def
get_parser
(
base_class
=
NavierStokes
,
n
=
32
,
ncpu
=
2
,
precision
=
'
single
'
,
simname
=
'
test
'
,
work_dir
=
'
./
'
,
njobs
=
1
):
parser
=
argparse
.
ArgumentParser
()
parser
.
add_argument
(
'
--run
'
,
dest
=
'
run
'
,
action
=
'
store_true
'
)
parser
.
add_argument
(
'
-n
'
,
type
=
int
,
dest
=
'
n
'
,
default
=
n
)
parser
.
add_argument
(
'
--ncpu
'
,
type
=
int
,
dest
=
'
ncpu
'
,
default
=
ncpu
)
parser
.
add_argument
(
'
--precision
'
,
type
=
str
,
dest
=
'
precision
'
,
default
=
precision
)
parser
.
add_argument
(
'
--simname
'
,
type
=
str
,
dest
=
'
simname
'
,
default
=
simname
)
parser
.
add_argument
(
'
--wd
'
,
type
=
str
,
dest
=
'
work_dir
'
,
default
=
work_dir
)
parser
.
add_argument
(
'
--njobs
'
,
type
=
int
,
dest
=
'
njobs
'
,
default
=
njobs
)
c
=
base_class
(
simname
=
simname
)
for
k
in
sorted
(
c
.
parameters
.
keys
()):
parser
.
add_argument
(
'
--{0}
'
.
format
(
k
),
type
=
type
(
c
.
parameters
[
k
]),
dest
=
k
,
default
=
c
.
parameters
[
k
])
return
parser
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