Skip to content

Commit

Permalink
TL: minor optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
tlunet committed Oct 30, 2024
1 parent aacb5d4 commit f6fa9df
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pySDC/playgrounds/dedalus/sdc.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,10 @@ def __init__(self, solver):
self.firstEval = True
self.firstStep = True

# FNO state
if self.initSweep == "NN":
self.stateFNO = [field.copy() for field in self.solver.state]

@property
def M(self):
return len(self.nodes)
Expand Down Expand Up @@ -573,7 +577,9 @@ def _sweep(self, k):
# => evaluate current state with NN to be used
# for the tendencies at k=0 for the initial guess of next step
current = solver.state
state = [field.copy() for field in current]
state = self.stateFNO
for c, f in zip(current, state):
np.copyto(f.data, c.data)
uState = self._toNumpy(state)
uNext = self.model(uState)
np.clip(uNext[2], a_min=0, a_max=1, out=uNext[2]) # temporary : clip buoyancy between 0 and 1
Expand Down

0 comments on commit f6fa9df

Please sign in to comment.