Skip to content

Commit 8dc8191

Browse files
committed
Change in matrix multiplication
1 parent c169393 commit 8dc8191

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

wakis/solverFIT3D.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,9 @@ def __init__(self, grid, wake=None, cfln=0.5, dt=None,
176176
hstack([self.Pz, sparse_mat((N,N)), -self.Px]),
177177
hstack([-self.Py, self.Px, sparse_mat((N,N))])
178178
], dtype=np.int8)
179+
180+
self.S = hstack([self.Px, self.Py, self.Pz])
181+
print(self.S*self.C)
179182

180183
# Boundaries
181184
if verbose:
@@ -244,8 +247,8 @@ def __init__(self, grid, wake=None, cfln=0.5, dt=None,
244247
self.iDmu = diags(self.imu.toarray(), shape=(3*N, 3*N), dtype=self.dtype)
245248
self.Dsigma = diags(self.sigma.toarray(), shape=(3*N, 3*N), dtype=self.dtype)
246249

247-
self.tDsiDmuiDaC = self.tDs * self.iDmu * self.iDa * self.C
248-
self.itDaiDepsDstC = self.itDa * self.iDeps * self.Ds * self.C.transpose()
250+
self.tDsiDmuiDaC = self.iDa * self.iDmu * self.C * self.Ds
251+
self.itDaiDepsDstC = self.iDeps * self.itDa * self.C.transpose() * self.tDs
249252

250253
if imported_mkl and not self.use_gpu: # MKL backend for CPU
251254
if verbose:
@@ -303,8 +306,8 @@ def update_tensors(self, tensor='all'):
303306

304307
if self.verbose:
305308
print('Re-Pre-computing ...')
306-
self.tDsiDmuiDaC = self.tDs * self.iDmu * self.iDa * self.C
307-
self.itDaiDepsDstC = self.itDa * self.iDeps * self.Ds * self.C.transpose()
309+
self.tDsiDmuiDaC = self.iDa * self.iDmu * self.C * self.Ds
310+
self.itDaiDepsDstC = self.iDeps * self.itDa * self.C.transpose() * self.tDs
308311
self.step_0 = False
309312

310313
def _one_step(self):
@@ -325,7 +328,8 @@ def _one_step(self):
325328

326329
#include current computation
327330
if self.use_conductivity:
328-
self.J.fromarray(self.sigma.toarray()*self.E.toarray())
331+
self.J.fromarray(self.sigma.toarray()*self.E.toarray()
332+
)
329333

330334
def one_step_mkl(self):
331335
if self.step_0:

wakis/sources.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,6 @@ def update(self, solver, t):
6363
s = solver.z - self.v*t
6464
# gaussian
6565
profile = 1/np.sqrt(2*np.pi*self.sigmaz**2)*np.exp(-(s-s0)**2/(2*self.sigmaz**2))
66-
#profile = np.exp(-(s-s0)**2/(2*self.sigmaz**2))
67-
#profile /= np.sum(profile*solver.dz)
6866
# update
6967
solver.J[self.ixs,self.iys,:,'z'] = self.q*self.v*profile/solver.dx[self.ixs]/solver.dy[self.iys]
7068

0 commit comments

Comments
 (0)