-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BUG, MDEIM : Convection Operator #17
Comments
I build the complete reduced operator by projection of the FOM operator and by addition of the approximation reduced operators. To my surprise, they seem transposed!
|
Ch = hrom.mdeim_convection.assemble(mu=mu_space[0], t=0.5)
Ch = bilinear_to_csr(Ch)
Ch = Ch.todense()
Ch_int = hrom.mdeim_convection.interpolate(
mu=mu_space[0],
t=0.5,
which=OperatorType.FOM,
)
Ch_int = Ch_int.todense()
Aha! The error can be traced back to the actual interpolation of the FOM. What I do not understand then is how am I getting such a low online evaluation error ...
My guess is that probably in the vector form these two arrays are the same, but the bug is located when building back the matrix form. Let's have a look. |
for mu in tqdm(space, desc=msg_mu, leave=True):
mu_idx, mu = self.add_mu(step=Stage.ONLINE, mu=mu)
for t in tqdm(ts, desc=msg_time, leave=False):
# Exact solution
fh = self.assemble_snapshot(mu, t)
# Compute approximation
fh_appr = self._interpolate(mu, t, which=self.FOM)
breakpoint()
error = self._compute_error(u=fh_appr, ue=fh)
self.errors_rom[mu_idx].append(error)
self.errors_rom[mu_idx] = np.array(self.errors_rom[mu_idx]) Indeed, in the vector form the two arrays are the same.
|
There is a bug in the determination of the rows and the columns. def get_matrix_topology(self, mu, t):
"""Get mesh rows and columns arrangement.
Parameters
----------
mu : dict
t : float
Returns
-------
rows : np.array
cols : np.array
"""
Ah = self._assemble_matrix(mu, t)
Ah = eliminate_zeros(Ah)
Ah_dense = Ah.todense()
rows, cols, _ = get_nonzero_entries(Ah)
if self.name == OperatorType.CONVECTION:
_list = list(zip(rows, cols, Ah.data))
_list = sorted(_list, key=lambda x: x[0])
_true_list = []
for row in range(Ah_dense.shape[0]):
for col in range(Ah_dense.shape[0]):
value = Ah_dense[row, col]
if np.isclose(value, 0.0):
continue
else:
_true_list.append((row, col, value))
breakpoint()
return rows, cols
|
BUG: Correct ordering of rows and columns in matrix topology Fixes #4 Fixes https://github.com/KikeM/msc-thesis/issues/52
What is going on with the HROM when the convection term is reduced too?
Reference: KikeM/msc-thesis#51
The text was updated successfully, but these errors were encountered: