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
0a53773b
Commit
0a53773b
authored
9 years ago
by
Cristian Lalescu
Browse files
Options
Downloads
Patches
Plain Diff
__main__ uses _fluid_particle_base directly
parent
3e3cd9b3
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
bfps/NavierStokes.py
+56
-0
56 additions, 0 deletions
bfps/NavierStokes.py
bfps/__main__.py
+3
-4
3 additions, 4 deletions
bfps/__main__.py
bfps/_fluid_base.py
+4
-0
4 additions, 0 deletions
bfps/_fluid_base.py
with
63 additions
and
4 deletions
bfps/NavierStokes.py
+
56
−
0
View file @
0a53773b
...
@@ -27,7 +27,9 @@
...
@@ -27,7 +27,9 @@
import
os
import
os
import
numpy
as
np
import
numpy
as
np
import
h5py
import
h5py
import
argparse
import
bfps
from
._fluid_base
import
_fluid_particle_base
from
._fluid_base
import
_fluid_particle_base
class
NavierStokes
(
_fluid_particle_base
):
class
NavierStokes
(
_fluid_particle_base
):
...
@@ -970,4 +972,58 @@ class NavierStokes(_fluid_particle_base):
...
@@ -970,4 +972,58 @@ class NavierStokes(_fluid_particle_base):
dest
=
'
particle_rand_seed
'
,
dest
=
'
particle_rand_seed
'
,
default
=
None
)
default
=
None
)
return
None
return
None
def
launch
(
self
,
args
=
[],
**
kwargs
):
# with the default Lundgren forcing, I can estimate the dissipation
# with nondefault forcing, figure out the amplitude for this viscosity
# yourself
parser
=
argparse
.
ArgumentParser
(
'
bfps
'
+
type
(
self
).
__name__
)
self
.
add_parser_arguments
(
parser
)
opt
=
parser
.
parse_args
(
args
)
self
.
QR_stats_on
=
opt
.
QR_stats
self
.
parameters
[
'
nu
'
]
=
(
opt
.
kMeta
*
2
/
opt
.
n
)
**
(
4.
/
3
)
self
.
parameters
[
'
dt
'
]
=
(
opt
.
dtfactor
/
opt
.
n
)
if
((
self
.
parameters
[
'
niter_todo
'
]
%
self
.
parameters
[
'
niter_out
'
])
!=
0
):
self
.
parameters
[
'
niter_out
'
]
=
self
.
parameters
[
'
niter_todo
'
]
if
self
.
QR_stats_on
:
# max_Q_estimate and max_R_estimate are just used for the 2D pdf
# therefore I just want them to be small multiples of mean trS2
# I'm already estimating the dissipation with kMeta...
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
self
.
pars_from_namespace
(
opt
)
self
.
fill_up_fluid_code
()
self
.
finalize_code
()
self
.
write_src
()
self
.
set_host_info
(
bfps
.
host_info
)
if
not
os
.
path
.
exists
(
os
.
path
.
join
(
self
.
work_dir
,
self
.
simname
+
'
.h5
'
)):
self
.
write_par
()
if
self
.
parameters
[
'
nparticles
'
]
>
0
:
data
=
self
.
generate_tracer_state
(
species
=
0
,
rseed
=
opt
.
particle_rand_seed
)
for
s
in
range
(
1
,
self
.
particle_species
):
self
.
generate_tracer_state
(
species
=
s
,
data
=
data
)
init_condition_file
=
os
.
path
.
join
(
self
.
work_dir
,
self
.
simname
+
'
_cvorticity_i{0:0>5x}
'
.
format
(
0
))
if
not
os
.
path
.
exists
(
init_condition_file
):
if
len
(
opt
.
src_simname
)
>
0
:
src_file
=
os
.
path
.
join
(
self
.
work_dir
,
opt
.
src_simname
+
'
_cvorticity_i{0:0>5x}
'
.
format
(
opt
.
src_iteration
))
os
.
symlink
(
src_file
,
init_condition_file
)
else
:
self
.
generate_vector_field
(
write_to_file
=
True
,
spectra_slope
=
2.0
,
amplitude
=
0.25
)
self
.
run
(
ncpu
=
opt
.
ncpu
,
njobs
=
opt
.
njobs
)
return
None
This diff is collapsed.
Click to expand it.
bfps/__main__.py
+
3
−
4
View file @
0a53773b
...
@@ -28,7 +28,6 @@ import sys
...
@@ -28,7 +28,6 @@ import sys
import
argparse
import
argparse
import
bfps
import
bfps
from
.Launcher
import
Launcher
from
.NavierStokes
import
NavierStokes
from
.NavierStokes
import
NavierStokes
from
.FluidConvert
import
FluidConvert
from
.FluidConvert
import
FluidConvert
from
.FluidResize
import
FluidResize
from
.FluidResize
import
FluidResize
...
@@ -46,12 +45,12 @@ def main():
...
@@ -46,12 +45,12 @@ def main():
'
FluidResize
'
],
'
FluidResize
'
],
type
=
str
)
type
=
str
)
# first option is the choice of base class or -h or -v
# first option is the choice of base class or -h or -v
# all other options are passed on to the
Launcher
instance
# all other options are passed on to the
base_class
instance
opt
=
parser
.
parse_args
(
sys
.
argv
[
1
:
2
])
opt
=
parser
.
parse_args
(
sys
.
argv
[
1
:
2
])
# error is thrown if first option is not a base class, so Launcher
# error is thrown if first option is not a base class, so Launcher
# cannot be executed by mistake.
# cannot be executed by mistake.
l
=
eval
(
'
Launcher(base_class =
{0})
'
.
format
(
opt
.
base_class
))
c
=
eval
(
'
{0}
(
)
'
.
format
(
opt
.
base_class
))
l
(
sys
.
argv
[
2
:])
c
.
launch
(
sys
.
argv
[
2
:])
return
None
return
None
if
__name__
==
'
__main__
'
:
if
__name__
==
'
__main__
'
:
...
...
This diff is collapsed.
Click to expand it.
bfps/_fluid_base.py
+
4
−
0
View file @
0a53773b
...
@@ -396,4 +396,8 @@ class _fluid_particle_base(_code):
...
@@ -396,4 +396,8 @@ class _fluid_particle_base(_code):
nshells
=
kspace
[
'
nshell
'
].
shape
[
0
]
nshells
=
kspace
[
'
nshell
'
].
shape
[
0
]
ofile
.
close
()
ofile
.
close
()
return
None
return
None
def
launch
(
self
,
**
kwargs
):
return
None
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