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
aa363165
Commit
aa363165
authored
6 years ago
by
Pierre Augier
Browse files
Options
Downloads
Patches
Plain Diff
Clean up InitFieldsFromSimul base
parent
9cdf7786
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/base/init_fields.py
+16
-23
16 additions, 23 deletions
fluidsim/base/init_fields.py
fluidsim/solvers/ns2d/strat/state.py
+0
-1
0 additions, 1 deletion
fluidsim/solvers/ns2d/strat/state.py
with
16 additions
and
24 deletions
fluidsim/base/init_fields.py
+
16
−
23
View file @
aa363165
...
...
@@ -281,8 +281,4 @@
tag
=
"
from_simul
"
# @classmethod
# def _complete_params_with_default(cls, params):
# super(InitFieldsFromSimul, cls)._complete_params_with_default(params)
def
__call__
(
self
):
...
...
@@ -288,5 +284,4 @@
def
__call__
(
self
):
# params = self.sim.params
self
.
sim
.
init_fields
.
get_state_from_simul
=
self
.
_get_state_from_simul
def
_get_state_from_simul
(
self
,
sim_in
):
...
...
@@ -290,7 +285,7 @@
self
.
sim
.
init_fields
.
get_state_from_simul
=
self
.
_get_state_from_simul
def
_get_state_from_simul
(
self
,
sim_in
):
# params = self.sim.params
# Warning: this function is for 2d pseudo-spectral solver!
# We have to write something more general.
# It should be done directly in the operators.
...
...
@@ -301,6 +296,7 @@
"
DO NOT USE THIS METHOD WITH MPI
"
)
self
.
sim
.
time_stepping
.
t
=
sim_in
.
time_stepping
.
t
sim
=
self
.
sim
sim
.
time_stepping
.
t
=
sim_in
.
time_stepping
.
t
if
(
...
...
@@ -305,8 +301,8 @@
if
(
self
.
sim
.
params
.
oper
.
nx
==
sim_in
.
params
.
oper
.
nx
and
self
.
sim
.
params
.
oper
.
ny
==
sim_in
.
params
.
oper
.
ny
sim
.
params
.
oper
.
nx
==
sim_in
.
params
.
oper
.
nx
and
sim
.
params
.
oper
.
ny
==
sim_in
.
params
.
oper
.
ny
):
state_spect
=
deepcopy
(
sim_in
.
state
.
state_spect
)
else
:
# modify resolution
...
...
@@ -309,9 +305,8 @@
):
state_spect
=
deepcopy
(
sim_in
.
state
.
state_spect
)
else
:
# modify resolution
# state_spect = SetOfVariables('state_spect')
state_spect
=
SetOfVariables
(
like
=
self
.
sim
.
state
.
state_spect
)
state_spect
=
SetOfVariables
(
like
=
sim
.
state
.
state_spect
)
keys_state_spect
=
sim_in
.
info
.
solver
.
classes
.
State
[
"
keys_state_spect
"
]
...
...
@@ -315,7 +310,5 @@
keys_state_spect
=
sim_in
.
info
.
solver
.
classes
.
State
[
"
keys_state_spect
"
]
for
k
,
v
in
enumerate
(
keys_state_spect
):
# print("sim_in.state.state_spect", sim_in.state.state_spect)
# print("k", k)
for
index_key
in
range
(
len
(
keys_state_spect
)):
...
...
@@ -321,6 +314,6 @@
field_fft_seq_in
=
sim_in
.
state
.
state_spect
[
k
]
field_fft_seq_new_res
=
self
.
sim
.
oper
.
create_arrayK
(
value
=
0.
)
field_fft_seq_in
=
sim_in
.
state
.
state_spect
[
index_key
]
field_fft_seq_new_res
=
sim
.
oper
.
create_arrayK
(
value
=
0.
)
[
nk0_seq
,
nk1_seq
]
=
field_fft_seq_new_res
.
shape
[
nk0_seq_in
,
nk1_seq_in
]
=
field_fft_seq_in
.
shape
...
...
@@ -342,5 +335,5 @@
-
ik0
,
ik1
]
state_spect
[
k
]
=
field_fft_seq_new_res
state_spect
[
index_key
]
=
field_fft_seq_new_res
...
...
@@ -346,7 +339,7 @@
if
self
.
sim
.
output
.
name_solver
==
sim_in
.
output
.
name_solver
:
self
.
sim
.
state
.
state_spect
=
state_spect
if
sim
.
output
.
name_solver
==
sim_in
.
output
.
name_solver
:
sim
.
state
.
state_spect
=
state_spect
else
:
# complicated case... untested solution !
# state_spect = SetOfVariables('state_spect')
raise
ValueError
(
"
Not yet implemented...
"
)
...
...
@@ -349,6 +342,6 @@
else
:
# complicated case... untested solution !
# state_spect = SetOfVariables('state_spect')
raise
ValueError
(
"
Not yet implemented...
"
)
for
k
in
self
.
sim
.
info
.
solver
.
classes
.
State
[
"
keys_state_spect
"
]:
for
k
in
sim
.
info
.
solver
.
classes
.
State
[
"
keys_state_spect
"
]:
if
k
in
sim_in
.
info
.
solver
.
classes
.
State
[
"
keys_state_spect
"
]:
...
...
@@ -354,3 +347,3 @@
if
k
in
sim_in
.
info
.
solver
.
classes
.
State
[
"
keys_state_spect
"
]:
self
.
sim
.
state
.
state_spect
[
k
]
=
state_spect
[
k
]
sim
.
state
.
state_spect
[
k
]
=
state_spect
[
k
]
else
:
...
...
@@ -356,5 +349,5 @@
else
:
self
.
sim
.
state
.
state_spect
[
k
]
=
self
.
oper
.
create_arrayK
(
sim
.
state
.
state_spect
[
k
]
=
self
.
oper
.
create_arrayK
(
value
=
0.
)
...
...
@@ -358,7 +351,7 @@
value
=
0.
)
self
.
sim
.
state
.
statephys_from_statespect
()
sim
.
state
.
statephys_from_statespect
()
class
InitFieldsInScript
(
SpecificInitFields
):
...
...
This diff is collapsed.
Click to expand it.
fluidsim/solvers/ns2d/strat/state.py
+
0
−
1
View file @
aa363165
...
...
@@ -134,7 +134,6 @@
rot
=
self
.
state_phys
.
get_var
(
"
rot
"
)
ux
=
self
.
state_phys
.
get_var
(
"
ux
"
)
uy
=
self
.
state_phys
.
get_var
(
"
uy
"
)
b
=
self
.
state_phys
.
get_var
(
"
b
"
)
...
...
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