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
643f732d
Commit
643f732d
authored
11 years ago
by
Franck Pérignon
Browse files
Options
Downloads
Patches
Plain Diff
Add methods to serialize the problem and restart a simulation from a file
parent
b8784c07
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
HySoP/hysop/problem/problem.py
+17
-4
17 additions, 4 deletions
HySoP/hysop/problem/problem.py
with
17 additions
and
4 deletions
HySoP/hysop/problem/problem.py
+
17
−
4
View file @
643f732d
...
@@ -31,7 +31,8 @@ class Problem(object):
...
@@ -31,7 +31,8 @@ class Problem(object):
return
object
.
__new__
(
cls
,
*
args
,
**
kw
)
return
object
.
__new__
(
cls
,
*
args
,
**
kw
)
@debug
@debug
def
__init__
(
self
,
operators
,
simulation
,
monitors
=
[],
name
=
None
):
def
__init__
(
self
,
operators
,
simulation
,
monitors
=
[],
dumpFreq
=
100
,
name
=
None
):
"""
"""
Create a transport problem instance.
Create a transport problem instance.
...
@@ -40,6 +41,8 @@ class Problem(object):
...
@@ -40,6 +41,8 @@ class Problem(object):
to describe simulation parameters.
to describe simulation parameters.
@param monitors : list of monitors.
@param monitors : list of monitors.
@param name : an id for the problem
@param name : an id for the problem
@param dumpFreq : frequency of dump (i.e. saving to a file)
for the problem; set dumpFreq = -1 for no dumps. Default = 100.
"""
"""
## Problem operators
## Problem operators
self
.
operators
=
operators
self
.
operators
=
operators
...
@@ -58,8 +61,15 @@ class Problem(object):
...
@@ -58,8 +61,15 @@ class Problem(object):
## A list of variables that must be initialized before
## A list of variables that must be initialized before
## any call to op.apply()
## any call to op.apply()
self
.
input
=
[]
self
.
input
=
[]
## call to problem.dump frequency during apply. 0 means never.
## call to problem.dump frequency during apply.
self
.
dumpFreq
=
0
if
dumpFreq
>=
0
:
## dump problem every self.dumpFreq iter
self
.
dumpFreq
=
dumpFreq
self
.
_doDump
=
True
else
:
self
.
_doDump
=
False
self
.
dumpFreq
=
100000
## Id for the problem. Used for dump file name.
## Id for the problem. Used for dump file name.
if
name
is
None
:
if
name
is
None
:
self
.
name
=
'
parmesPb
'
self
.
name
=
'
parmesPb
'
...
@@ -136,7 +146,8 @@ class Problem(object):
...
@@ -136,7 +146,8 @@ class Problem(object):
for
op
in
self
.
operators
:
for
op
in
self
.
operators
:
op
.
apply
(
self
.
simulation
)
op
.
apply
(
self
.
simulation
)
self
.
simulation
.
advance
()
self
.
simulation
.
advance
()
if
self
.
simulation
.
currentIteration
%
self
.
dumpFreq
is
0
:
testdump
=
self
.
simulation
.
currentIteration
%
self
.
dumpFreq
if
self
.
_doDump
and
testdump
:
self
.
dump
()
self
.
dump
()
@debug
@debug
...
@@ -212,6 +223,8 @@ class Problem(object):
...
@@ -212,6 +223,8 @@ class Problem(object):
@param rate : the frequency of output
@param rate : the frequency of output
"""
"""
self
.
dumpFreq
=
freq
self
.
dumpFreq
=
freq
if
freq
<
0
:
self
.
_doDump
=
False
if
__name__
==
"
__main__
"
:
if
__name__
==
"
__main__
"
:
print
__doc__
print
__doc__
...
...
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