Skip to content

Commit f6fa9df

Browse files
committed
TL: minor optimization
1 parent aacb5d4 commit f6fa9df

File tree

1 file changed

+7
-1
lines changed
  • pySDC/playgrounds/dedalus

1 file changed

+7
-1
lines changed

pySDC/playgrounds/dedalus/sdc.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,10 @@ def __init__(self, solver):
266266
self.firstEval = True
267267
self.firstStep = True
268268

269+
# FNO state
270+
if self.initSweep == "NN":
271+
self.stateFNO = [field.copy() for field in self.solver.state]
272+
269273
@property
270274
def M(self):
271275
return len(self.nodes)
@@ -573,7 +577,9 @@ def _sweep(self, k):
573577
# => evaluate current state with NN to be used
574578
# for the tendencies at k=0 for the initial guess of next step
575579
current = solver.state
576-
state = [field.copy() for field in current]
580+
state = self.stateFNO
581+
for c, f in zip(current, state):
582+
np.copyto(f.data, c.data)
577583
uState = self._toNumpy(state)
578584
uNext = self.model(uState)
579585
np.clip(uNext[2], a_min=0, a_max=1, out=uNext[2]) # temporary : clip buoyancy between 0 and 1

0 commit comments

Comments
 (0)