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.9.2 on 2025-04-24 between 17:00 and 18:00 UTC+2
Show more breadcrumbs
fluiddyn
fluidsim
Commits
5de8a8db
Commit
5de8a8db
authored
6 years ago
by
Pierre Augier
Browse files
Options
Downloads
Patches
Plain Diff
Bugfix init_fields ns3d.
parent
aee65554
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
fluidsim/solvers/ns3d/init_fields.py
+6
-9
6 additions, 9 deletions
fluidsim/solvers/ns3d/init_fields.py
fluidsim/solvers/ns3d/time_stepping.py
+3
-3
3 additions, 3 deletions
fluidsim/solvers/ns3d/time_stepping.py
with
9 additions
and
12 deletions
fluidsim/solvers/ns3d/init_fields.py
+
6
−
9
View file @
5de8a8db
...
...
@@ -42,6 +42,7 @@
fields
=
{
"
vx_fft
"
:
vx_fft
,
"
vy_fft
"
:
vy_fft
}
self
.
sim
.
state
.
init_statespect_from
(
**
fields
)
self
.
sim
.
state
.
statephys_from_statespect
()
def
vorticity_1dipole2d
(
self
):
oper
=
self
.
sim
.
oper
...
...
@@ -132,6 +133,7 @@
fields
[
key
]
=
(
velo_max
/
value_max
)
*
field_fft
self
.
sim
.
state
.
init_statespect_from
(
**
fields
)
self
.
sim
.
state
.
statephys_from_statespect
()
def
compute_vv_fft
(
self
):
...
...
@@ -148,4 +150,6 @@
# to compute always the same field... (for 1 resolution...)
np
.
random
.
seed
(
42
+
mpi
.
rank
)
vv
=
[
np
.
random
.
random
(
oper
.
shapeX_loc
)
-
0.5
for
i
in
range
(
3
)]
vv_fft
=
[]
...
...
@@ -151,13 +155,6 @@
vv_fft
=
[]
for
ii
in
range
(
3
):
vv_fft
.
append
(
(
np
.
random
.
random
(
oper
.
shapeK
)
+
1j
*
np
.
random
.
random
(
oper
.
shapeK
)
-
0.5
-
0.5j
)
)
for
ii
,
vi
in
enumerate
(
vv
):
vv_fft
.
append
(
oper
.
fft
(
vi
))
if
mpi
.
rank
==
0
:
vv_fft
[
ii
][
0
,
0
,
0
]
=
0.
...
...
This diff is collapsed.
Click to expand it.
fluidsim/solvers/ns3d/time_stepping.py
+
3
−
3
View file @
5de8a8db
...
...
@@ -8,7 +8,8 @@
def
one_time_step_computation
(
self
):
"""
One time step
"""
state_spect
=
self
.
sim
.
state
.
state_spect
# WARNING: if the function _time_step_RK comes from an extension, its
# execution time seems to be attributed to the function
# one_time_step_computation by cProfile
self
.
_time_step_RK
()
...
...
@@ -11,12 +12,11 @@
# WARNING: if the function _time_step_RK comes from an extension, its
# execution time seems to be attributed to the function
# one_time_step_computation by cProfile
self
.
_time_step_RK
()
self
.
sim
.
oper
.
dealiasing
(
self
.
sim
.
state
.
state_spect
)
state_spect
=
self
.
sim
.
state
.
state_spect
self
.
sim
.
oper
.
dealiasing
(
state_spect
)
vx_fft
=
state_spect
.
get_var
(
"
vx_fft
"
)
vy_fft
=
state_spect
.
get_var
(
"
vy_fft
"
)
vz_fft
=
state_spect
.
get_var
(
"
vz_fft
"
)
self
.
sim
.
oper
.
project_perpk3d
(
vx_fft
,
vy_fft
,
vz_fft
)
self
.
sim
.
state
.
statephys_from_statespect
()
# np.isnan(np.sum seems to be really fast
...
...
@@ -17,10 +17,10 @@
vx_fft
=
state_spect
.
get_var
(
"
vx_fft
"
)
vy_fft
=
state_spect
.
get_var
(
"
vy_fft
"
)
vz_fft
=
state_spect
.
get_var
(
"
vz_fft
"
)
self
.
sim
.
oper
.
project_perpk3d
(
vx_fft
,
vy_fft
,
vz_fft
)
self
.
sim
.
state
.
statephys_from_statespect
()
# np.isnan(np.sum seems to be really fast
if
np
.
isnan
(
np
.
sum
(
self
.
sim
.
state
.
state_spect
[
0
])):
if
np
.
isnan
(
np
.
sum
(
state_spect
[
0
])):
raise
ValueError
(
"
nan at it = {0}, t = {1:.4f}
"
.
format
(
self
.
it
,
self
.
t
)
)
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