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
2a858420
Commit
2a858420
authored
4 years ago
by
EXT Jean-Matthieu Etancelin
Browse files
Options
Downloads
Patches
Plain Diff
add simulation flag not to clamp to tend (avoid tiny and possibliy negative irrelevant dt)
parent
3d081bee
No related branches found
No related tags found
1 merge request
!16
MPI operators
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
hysop/simulation.py
+11
-7
11 additions, 7 deletions
hysop/simulation.py
with
11 additions
and
7 deletions
hysop/simulation.py
+
11
−
7
View file @
2a858420
...
@@ -47,7 +47,7 @@ class Simulation(object):
...
@@ -47,7 +47,7 @@ class Simulation(object):
def
__init__
(
self
,
name
=
None
,
start
=
0.0
,
end
=
1.0
,
nb_iter
=
None
,
dt0
=
None
,
def
__init__
(
self
,
name
=
None
,
start
=
0.0
,
end
=
1.0
,
nb_iter
=
None
,
dt0
=
None
,
max_iter
=
None
,
t
=
None
,
dt
=
None
,
times_of_interest
=
None
,
max_iter
=
None
,
t
=
None
,
dt
=
None
,
times_of_interest
=
None
,
mpi_params
=
None
,
quiet
=
False
,
mpi_params
=
None
,
quiet
=
False
,
clamp_t_to_end
=
True
,
**
kwds
):
**
kwds
):
"""
"""
Parameters
Parameters
...
@@ -76,6 +76,8 @@ class Simulation(object):
...
@@ -76,6 +76,8 @@ class Simulation(object):
time dependent dumping.
time dependent dumping.
tstart < ti <= tend
tstart < ti <= tend
Defaults to empty set.
Defaults to empty set.
clamp_t_to_end : bool, optional
Specify if Simulation adjst dt for last iteration to have t=end
Attributes
Attributes
----------
----------
...
@@ -114,6 +116,7 @@ class Simulation(object):
...
@@ -114,6 +116,7 @@ class Simulation(object):
self
.
current_iteration
=
-
1
self
.
current_iteration
=
-
1
self
.
_rank
=
main_rank
if
mpi_params
is
None
else
mpi_params
.
rank
self
.
_rank
=
main_rank
if
mpi_params
is
None
else
mpi_params
.
rank
self
.
_comm
=
main_comm
if
mpi_params
is
None
else
mpi_params
.
comm
self
.
_comm
=
main_comm
if
mpi_params
is
None
else
mpi_params
.
comm
self
.
clamp_t_to_end
=
clamp_t_to_end
if
(
nb_iter
is
not
None
):
if
(
nb_iter
is
not
None
):
self
.
nb_iter
=
nb_iter
self
.
nb_iter
=
nb_iter
...
@@ -258,13 +261,14 @@ class Simulation(object):
...
@@ -258,13 +261,14 @@ class Simulation(object):
self
.
update_time_step
(
self
.
target_time_of_interest
-
self
.
t
())
self
.
update_time_step
(
self
.
target_time_of_interest
-
self
.
t
())
self
.
_last_forced_timestep
=
self
.
dt
()
self
.
_last_forced_timestep
=
self
.
dt
()
elif
(
self
.
tkp1
>=
self
.
end
):
elif
(
self
.
tkp1
>=
self
.
end
):
msg
=
'
** Next iteration is last iteration, clamping dt to achieve t={}. **
'
msg
=
msg
.
format
(
self
.
end
)
vprint
()
self
.
_print_banner
(
msg
)
self
.
_next_is_last
=
True
self
.
_next_is_last
=
True
self
.
tkp1
=
self
.
end
if
self
.
clamp_t_to_end
:
self
.
update_time_step
(
self
.
end
-
self
.
t
())
msg
=
'
** Next iteration is last iteration, clamping dt to achieve t={}. **
'
msg
=
msg
.
format
(
self
.
end
)
vprint
()
self
.
_print_banner
(
msg
)
self
.
tkp1
=
self
.
end
self
.
update_time_step
(
self
.
end
-
self
.
t
())
elif
(
self
.
dt
()
==
self
.
_last_forced_timestep
):
elif
(
self
.
dt
()
==
self
.
_last_forced_timestep
):
self
.
update_time_step
(
self
.
_dt0
)
self
.
update_time_step
(
self
.
_dt0
)
self
.
_last_forced_timestep
=
None
self
.
_last_forced_timestep
=
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