Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
F
fluidsim
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Admin message
This instance will be upgraded to Heptapod 17.11.0rc1 on 2025-04-24 between 17:00 and 18:00 UTC+2
Show more breadcrumbs
fluiddyn
fluidsim
Commits
9c11a18d
Commit
9c11a18d
authored
9 years ago
by
Pierre Augier
Browse files
Options
Downloads
Patches
Plain Diff
Debug and improve fluidsim/util
parent
0c57cf72
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
fluidsim/util/util.py
+8
-7
8 additions, 7 deletions
fluidsim/util/util.py
with
8 additions
and
7 deletions
fluidsim/util/util.py
+
8
−
7
View file @
9c11a18d
...
...
@@ -94,8 +94,8 @@
"""
Return the file name whose time is the closest to the given time.
"""
list_
path_files
=
_glob
.
glob
(
path_dir
+
'
/state_phys_t=*
'
)
nb_files
=
len
(
list_
path_files
)
path_files
=
_glob
.
glob
(
path_dir
+
'
/state_phys_t=*
'
)
nb_files
=
len
(
path_files
)
if
nb_files
==
0
and
mpi
.
rank
==
0
:
raise
ValueError
(
'
No state file in the dir
\n
'
+
path_dir
)
times
=
_np
.
empty
([
nb_files
])
...
...
@@ -99,8 +99,8 @@
if
nb_files
==
0
and
mpi
.
rank
==
0
:
raise
ValueError
(
'
No state file in the dir
\n
'
+
path_dir
)
times
=
_np
.
empty
([
nb_files
])
for
ii
in
xrange
(
nb
_files
):
times
[
ii
]
=
float
(
list_path_files
[
ii
][
-
11
:
-
4
])
for
ii
,
path
in
enumerate
(
path
_files
):
times
[
ii
]
=
float
(
path
.
split
(
'
_t=
'
)[
1
][:
7
])
if
t_approx
is
None
:
t_approx
=
times
.
max
()
i_file
=
abs
(
times
-
t_approx
).
argmin
()
...
...
@@ -104,7 +104,7 @@
if
t_approx
is
None
:
t_approx
=
times
.
max
()
i_file
=
abs
(
times
-
t_approx
).
argmin
()
name_file
=
list_
path_files
[
i_file
][
-
24
:
]
name_file
=
_os
.
path
.
split
(
path_files
[
i_file
]
)
[
-
1
]
return
name_file
...
...
@@ -130,7 +130,7 @@
return
solver
def
load_state_phys_file
(
name_dir
=
None
,
t_approx
=
None
):
def
load_state_phys_file
(
name_dir
=
None
,
t_approx
=
None
,
modif_save_params
=
True
):
"""
Create a simulation from a file.
"""
path_dir
=
pathdir_from_namedir
(
name_dir
)
...
...
@@ -146,7 +146,8 @@
params
.
path_run
=
path_dir
params
.
NEW_DIR_RESULTS
=
False
params
.
output
.
HAS_TO_SAVE
=
False
if
modif_save_params
:
params
.
output
.
HAS_TO_SAVE
=
False
params
.
init_fields
.
type
=
'
from_file
'
params
.
init_fields
.
from_file
.
path
=
path_file
sim
=
solver
.
Simul
(
params
)
...
...
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