Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
TurTLE
TurTLE
Commits
f312fbc7
Commit
f312fbc7
authored
Jan 27, 2016
by
Cristian Lalescu
Browse files
Merge branch 'feature/exec-name' into develop
parents
bf509869
ac587668
Changes
7
Hide whitespace changes
Inline
Side-by-side
bfps/FluidConvert.py
View file @
f312fbc7
...
...
@@ -28,6 +28,7 @@ import numpy as np
import
pickle
import
os
from
._fluid_base
import
_fluid_particle_base
import
bfps
class
FluidConvert
(
_fluid_particle_base
):
"""This class is meant to be used for conversion of native DNS field
...
...
@@ -37,14 +38,14 @@ class FluidConvert(_fluid_particle_base):
"""
def
__init__
(
self
,
name
=
'FluidConvert
'
,
name
=
'FluidConvert
-v'
+
bfps
.
__version__
,
work_dir
=
'./'
,
simname
=
'test'
,
fluid_precision
=
'single'
,
use_fftw_wisdom
=
True
):
_fluid_particle_base
.
__init__
(
self
,
name
=
name
,
name
=
name
+
'-'
+
fluid_precision
,
work_dir
=
work_dir
,
simname
=
simname
,
dtype
=
fluid_precision
,
...
...
bfps/FluidResize.py
View file @
f312fbc7
...
...
@@ -38,17 +38,17 @@ class FluidResize(_fluid_particle_base):
"""
def
__init__
(
self
,
name
=
'FluidResize
'
,
name
=
'FluidResize
-v'
+
bfps
.
__version__
,
work_dir
=
'./'
,
simname
=
'test'
,
dtype
=
np
.
float32
,
fluid_precision
=
'single'
,
use_fftw_wisdom
=
False
):
_fluid_particle_base
.
__init__
(
self
,
name
=
name
,
name
=
name
+
'-'
+
fluid_precision
,
work_dir
=
work_dir
,
simname
=
simname
,
dtype
=
dtype
,
dtype
=
fluid_precision
,
use_fftw_wisdom
=
use_fftw_wisdom
)
self
.
parameters
[
'src_simname'
]
=
'test'
self
.
parameters
[
'dst_iter'
]
=
0
...
...
bfps/NavierStokes.py
View file @
f312fbc7
...
...
@@ -41,7 +41,7 @@ class NavierStokes(_fluid_particle_base):
"""
def
__init__
(
self
,
name
=
'NavierStokes
'
,
name
=
'NavierStokes
-v'
+
bfps
.
__version__
,
work_dir
=
'./'
,
simname
=
'test'
,
fluid_precision
=
'single'
,
...
...
@@ -54,7 +54,7 @@ class NavierStokes(_fluid_particle_base):
self
.
fftw_plan_rigor
=
fftw_plan_rigor
_fluid_particle_base
.
__init__
(
self
,
name
=
name
,
name
=
name
+
'-'
+
fluid_precision
,
work_dir
=
work_dir
,
simname
=
simname
,
dtype
=
fluid_precision
,
...
...
@@ -62,8 +62,8 @@ class NavierStokes(_fluid_particle_base):
self
.
parameters
[
'nu'
]
=
0.1
self
.
parameters
[
'fmode'
]
=
1
self
.
parameters
[
'famplitude'
]
=
0.5
self
.
parameters
[
'fk0'
]
=
1.5
self
.
parameters
[
'fk1'
]
=
3
.0
self
.
parameters
[
'fk0'
]
=
2.0
self
.
parameters
[
'fk1'
]
=
4
.0
self
.
parameters
[
'forcing_type'
]
=
'linear'
self
.
parameters
[
'histogram_bins'
]
=
256
self
.
parameters
[
'max_velocity_estimate'
]
=
1.0
...
...
@@ -943,10 +943,6 @@ class NavierStokes(_fluid_particle_base):
type
=
int
,
dest
=
'src_iteration'
,
default
=
0
)
parser
.
add_argument
(
'--precision'
,
type
=
str
,
dest
=
'precision'
,
default
=
'single'
)
parser
.
add_argument
(
'--njobs'
,
type
=
int
,
dest
=
'njobs'
,
...
...
@@ -984,6 +980,11 @@ class NavierStokes(_fluid_particle_base):
self
.
QR_stats_on
=
opt
.
QR_stats
self
.
parameters
[
'nu'
]
=
(
opt
.
kMeta
*
2
/
opt
.
n
)
**
(
4.
/
3
)
self
.
parameters
[
'dt'
]
=
(
opt
.
dtfactor
/
opt
.
n
)
# custom famplitude for 288 and 576
if
opt
.
n
==
288
:
self
.
parameters
[
'famplitude'
]
=
0.45
elif
opt
.
n
==
576
:
self
.
parameters
[
'famplitude'
]
=
0.47
if
((
self
.
parameters
[
'niter_todo'
]
%
self
.
parameters
[
'niter_out'
])
!=
0
):
self
.
parameters
[
'niter_out'
]
=
self
.
parameters
[
'niter_todo'
]
if
self
.
QR_stats_on
:
...
...
@@ -993,7 +994,9 @@ class NavierStokes(_fluid_particle_base):
meantrS2
=
(
opt
.
n
//
2
/
opt
.
kMeta
)
**
4
*
self
.
parameters
[
'nu'
]
**
2
self
.
parameters
[
'max_Q_estimate'
]
=
meantrS2
self
.
parameters
[
'max_R_estimate'
]
=
.
4
*
meantrS2
**
1.5
# add QR suffix to code name, since we now expect additional
# datasets in the .h5 file
self
.
name
+=
'-QR'
if
len
(
opt
.
src_work_dir
)
==
0
:
opt
.
src_work_dir
=
opt
.
work_dir
self
.
pars_from_namespace
(
opt
)
...
...
bfps/__main__.py
View file @
f312fbc7
...
...
@@ -37,17 +37,36 @@ def main():
'-v'
,
'--version'
,
action
=
'version'
,
version
=
'%(prog)s '
+
bfps
.
__version__
)
NSoptions
=
[
'NavierStokes'
,
'NavierStokes-single'
,
'NavierStokes-double'
,
'NS'
,
'NS-single'
,
'NS-double'
]
FRoptions
=
[
'FluidResize'
,
'FluidResize-single'
,
'FluidResize-double'
,
'FR'
,
'FR-single'
,
'FR-double'
]
parser
.
add_argument
(
'base_class'
,
choices
=
[
'NavierStokes'
,
'FluidResize'
],
choices
=
NSoptions
+
FRoptions
,
type
=
str
)
# first option is the choice of base class or -h or -v
# all other options are passed on to the base_class instance
opt
=
parser
.
parse_args
(
sys
.
argv
[
1
:
2
])
# error is thrown if first option is not a base class, so launch
# cannot be executed by mistake.
c
=
eval
(
'{0}()'
.
format
(
opt
.
base_class
))
if
'double'
in
opt
.
base_class
:
precision
=
'double'
else
:
precision
=
'single'
if
opt
.
base_class
in
NSoptions
:
base_class
=
NavierStokes
elif
opt
.
base_class
in
FRoptions
:
base_class
=
FluidResize
c
=
base_class
(
fluid_precision
=
precision
)
c
.
launch
(
args
=
sys
.
argv
[
2
:])
return
None
...
...
bfps/_code.py
View file @
f312fbc7
...
...
@@ -198,7 +198,7 @@ class _code(_base):
self
.
write_sge_file
(
file_name
=
os
.
path
.
join
(
self
.
work_dir
,
qsub_script_name
),
nprocesses
=
ncpu
,
name_of_run
=
self
.
name
+
'_'
+
suffix
,
name_of_run
=
suffix
,
command_atoms
=
command_atoms
[
3
:],
hours
=
hours
,
minutes
=
minutes
,
...
...
@@ -210,7 +210,7 @@ class _code(_base):
qsub_atoms
+=
[
'-hold_jid'
,
job_name_list
[
-
1
]]
subprocess
.
call
(
qsub_atoms
+
[
qsub_script_name
])
os
.
chdir
(
current_dir
)
job_name_list
.
append
(
self
.
name
+
'_'
+
suffix
)
job_name_list
.
append
(
suffix
)
elif
self
.
host_info
[
'type'
]
==
'pc'
:
os
.
chdir
(
self
.
work_dir
)
os
.
environ
[
'LD_LIBRARY_PATH'
]
+=
':{0}'
.
format
(
bfps
.
lib_dir
)
...
...
bfps/_fluid_base.py
View file @
f312fbc7
...
...
@@ -48,7 +48,7 @@ class _fluid_particle_base(_code):
work_dir
=
work_dir
,
simname
=
simname
)
self
.
use_fftw_wisdom
=
use_fftw_wisdom
self
.
name
=
name
+
'_'
+
simname
self
.
name
=
name
self
.
particle_species
=
0
if
dtype
in
[
np
.
float32
,
np
.
float64
]:
self
.
dtype
=
dtype
...
...
@@ -395,4 +395,9 @@ class _fluid_particle_base(_code):
nshells
=
kspace
[
'nshell'
].
shape
[
0
]
ofile
.
close
()
return
None
def
specific_parser_arguments
(
self
,
parser
):
_code
.
specific_parser_arguments
(
self
,
parser
)
return
None
tests/base.py
View file @
f312fbc7
...
...
@@ -92,7 +92,7 @@ parser.add_argument(
def
double
(
opt
):
old_simname
=
'N{0:0>3x}'
.
format
(
opt
.
n
)
new_simname
=
'N{0:0>3x}'
.
format
(
opt
.
n
*
2
)
c
=
FluidResize
(
dtype
=
opt
.
precision
)
c
=
FluidResize
(
fluid_precision
=
opt
.
precision
)
c
.
launch
(
args
=
[
'--simname'
,
old_simname
+
'_double'
,
'--wd'
,
opt
.
work_dir
,
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment