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
3325c4a7
Commit
3325c4a7
authored
12 years ago
by
Jean-Matthieu Etancelin
Browse files
Options
Downloads
Patches
Plain Diff
Fix scales launching
parent
9564b028
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
HySoP/hysop/operator/advection.py
+71
-50
71 additions, 50 deletions
HySoP/hysop/operator/advection.py
HySoP/hysop/operator/scales_advection.py
+2
-4
2 additions, 4 deletions
HySoP/hysop/operator/scales_advection.py
with
73 additions
and
54 deletions
HySoP/hysop/operator/advection.py
+
71
−
50
View file @
3325c4a7
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
Advection operator representation.
Advection operator representation.
"""
"""
from
parmepy.constants
import
debug
from
parmepy.constants
import
debug
,
np
,
PARMES_INDEX
from
parmepy.operator.continuous
import
Operator
from
parmepy.operator.continuous
import
Operator
from
parmepy.mpi.topology
import
Cartesian
from
parmepy.mpi.topology
import
Cartesian
...
@@ -44,56 +44,77 @@ class Advection(Operator):
...
@@ -44,56 +44,77 @@ class Advection(Operator):
"""
"""
Operator
.
setUp
(
self
)
Operator
.
setUp
(
self
)
#variables discretization
if
self
.
method
.
find
(
'
scales
'
)
>=
0
:
for
v
in
self
.
variables
:
if
not
self
.
advectedFields
.
dimension
==
3
:
topoId
,
topo
=
self
.
domain
.
addTopology
(
Cartesian
(
domain
=
self
.
domain
,
dim
=
self
.
domain
.
dimension
,
globalMeshResolution
=
self
.
resolutions
[
v
]))
df
,
dfId
=
v
.
discretize
(
topo
)
self
.
discreteFieldId
[
v
]
=
dfId
if
self
.
discreteOperator
is
None
:
if
self
.
method
.
find
(
'
gpu_2k
'
)
>=
0
:
if
self
.
advectedFields
.
vector
:
#if not isinstance(self.advectedFields.discreteField[
# self.discreteFieldId[self.advectedFields]],
# ScalarField):
raise
ValueError
(
"
Not implemented yet. GPU advection
"
+
"
is only for scalar fields
"
)
from
parmepy.operator.gpu_particle_advection_2k
\
import
GPUParticleAdvection2k
self
.
discreteOperator
=
\
GPUParticleAdvection2k
(
self
,
method
=
self
.
method
,
**
self
.
config
)
elif
self
.
method
.
find
(
'
gpu_1k
'
)
>=
0
:
if
self
.
advectedFields
.
vector
:
#if not isinstance(self.advectedFields.discreteField[
# self.discreteFieldId[self.advectedFields]],
# ScalarField):
raise
ValueError
(
"
Not implemented yet. GPU advection
"
+
"
is only for scalar fields
"
)
from
parmepy.operator.gpu_particle_advection_1k
\
import
GPUParticleAdvection1k
self
.
discreteOperator
=
\
GPUParticleAdvection1k
(
self
,
method
=
self
.
method
,
**
self
.
config
)
elif
self
.
method
.
find
(
'
scales
'
)
>=
0
:
if
not
self
.
advectedFields
.
dimension
==
3
:
raise
ValueError
(
"
Scales Advection not implemented in 2D.
"
)
raise
ValueError
(
"
Scales Advection not implemented in 2D.
"
)
from
parmepy.operator.scales_advection
\
## Scales imports for topology creation
import
ScalesAdvection
from
parmepy.operator.scales_advection
import
ScalesAdvection
self
.
discreteOperator
=
\
from
parmepy.f2py
import
scales2py
as
scales
ScalesAdvection
(
self
,
method
=
self
.
method
,
from
parmepy.mpi.main_var
import
main_size
**
self
.
config
)
else
:
## Extract order form self.method (default p_O2)
print
"
Using default advection operator
"
order
=
'
p_O2
'
if
self
.
advectedFields
.
vector
:
for
o
in
[
'
p_O2
'
,
'
p_O4
'
,
'
p_M6
'
]:
raise
ValueError
(
"
Not implemented yet. default advection
"
+
if
self
.
method
.
find
(
o
)
>=
0
:
"
is only for scalar fields
"
)
order
=
o
from
parmepy.operator.particle_advection
\
## Scales nbcells equals resolutions - 1
import
ParticleAdvection
## resolutions is a number of points given by user
self
.
discreteOperator
=
\
nbcells
=
np
.
asarray
(
self
.
resolutions
[
self
.
advectedFields
],
ParticleAdvection
(
self
,
method
=
self
.
method
,
dtype
=
PARMES_INDEX
)
-
1
**
self
.
config
)
topodims
=
[
1
,
1
,
main_size
]
scalesres
,
scalesoffset
,
stab_coeff
=
\
scales
.
init_advection_solver
(
nbcells
,
self
.
domain
.
length
,
topodims
,
order
=
order
)
## Use same topodims as scales to create Cartesian topology
## in order to discretize our fields
for
v
in
self
.
variables
:
topoId
,
topo
=
self
.
domain
.
addTopology
(
Cartesian
.
withResolution
(
domain
=
self
.
domain
,
topoResolution
=
topodims
,
globalMeshResolution
=
self
.
resolutions
[
v
]))
df
,
dfId
=
v
.
discretize
(
topo
)
self
.
discreteFieldId
[
v
]
=
dfId
self
.
discreteOperator
=
ScalesAdvection
(
self
,
method
=
self
.
method
,
**
self
.
config
)
else
:
#variables discretization
for
v
in
self
.
variables
:
topoId
,
topo
=
self
.
domain
.
addTopology
(
Cartesian
(
domain
=
self
.
domain
,
dim
=
self
.
domain
.
dimension
,
globalMeshResolution
=
self
.
resolutions
[
v
]))
df
,
dfId
=
v
.
discretize
(
topo
)
self
.
discreteFieldId
[
v
]
=
dfId
if
self
.
discreteOperator
is
None
:
if
self
.
method
.
find
(
'
gpu_2k
'
)
>=
0
:
if
self
.
advectedFields
.
vector
:
raise
ValueError
(
"
Not implemented yet. GPU advection
"
+
"
is only for scalar fields
"
)
from
parmepy.operator.gpu_particle_advection_2k
\
import
GPUParticleAdvection2k
self
.
discreteOperator
=
\
GPUParticleAdvection2k
(
self
,
method
=
self
.
method
,
**
self
.
config
)
elif
self
.
method
.
find
(
'
gpu_1k
'
)
>=
0
:
if
self
.
advectedFields
.
vector
:
raise
ValueError
(
"
Not implemented yet. GPU advection
"
+
"
is only for scalar fields
"
)
from
parmepy.operator.gpu_particle_advection_1k
\
import
GPUParticleAdvection1k
self
.
discreteOperator
=
\
GPUParticleAdvection1k
(
self
,
method
=
self
.
method
,
**
self
.
config
)
else
:
print
"
Using default advection operator
"
if
self
.
advectedFields
.
vector
:
raise
ValueError
(
"
Not implemented yet. default
"
+
"
advection is only for
"
+
"
scalar fields
"
)
from
parmepy.operator.particle_advection
\
import
ParticleAdvection
self
.
discreteOperator
=
\
ParticleAdvection
(
self
,
method
=
self
.
method
,
**
self
.
config
)
self
.
discreteOperator
.
setUp
()
self
.
discreteOperator
.
setUp
()
def
__str__
(
self
):
def
__str__
(
self
):
...
...
This diff is collapsed.
Click to expand it.
HySoP/hysop/operator/scales_advection.py
+
2
−
4
View file @
3325c4a7
...
@@ -46,8 +46,6 @@ class ScalesAdvection(DiscreteOperator):
...
@@ -46,8 +46,6 @@ class ScalesAdvection(DiscreteOperator):
self
.
ghosts
=
self
.
topology
.
ghosts
self
.
ghosts
=
self
.
topology
.
ghosts
self
.
resolution
=
self
.
topology
.
mesh
.
resolution
self
.
resolution
=
self
.
topology
.
mesh
.
resolution
self
.
dim
=
self
.
topology
.
dim
self
.
dim
=
self
.
topology
.
dim
# TODO scales setup
#scales2py.setup('p_O2', True, 'strang')
@debug
@debug
def
apply
(
self
,
t
,
dt
,
ite
):
def
apply
(
self
,
t
,
dt
,
ite
):
...
@@ -162,8 +160,8 @@ class ScalesAdvection(DiscreteOperator):
...
@@ -162,8 +160,8 @@ class ScalesAdvection(DiscreteOperator):
return
self
.
compute_time
return
self
.
compute_time
def
printComputeTime
(
self
):
def
printComputeTime
(
self
):
self
.
tim
ings
_info
[
0
]
=
"
\"
Advection calculation total
\"
"
self
.
tim
e
_info
[
0
]
=
"
\"
Advection calculation total
\"
"
self
.
tim
ings
_info
[
1
]
=
str
(
self
.
total_time
)
self
.
tim
e
_info
[
1
]
=
str
(
self
.
total_time
)
print
"
Time of the last advection calculation loop :
"
,
\
print
"
Time of the last advection calculation loop :
"
,
\
self
.
compute_time
self
.
compute_time
...
...
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