Repository navigation
Conversation
There was a problem hiding this comment.
Copilot wasn't able to review any files in this pull request. Check if the Files changed in this pull request are included in default exclusions.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
|
||
| // Store data for comparison | ||
| flops_md(cell_index) = static_cast<Real>((2 * nnz_md + U0_md.n_elem) * t); | ||
| flops_md(cell_index) = static_cast<Real>((2 * nnz_md + 3 * U0_md.n_elem) * t); |
There was a problem hiding this comment.
Hey @jbrzensk , thank you for this PR. May I ask why the 3 here? I thought the PR was only renaming the directory path. Thanks
There was a problem hiding this comment.
Renaming and fixing the C++ code. This was skipped.
The 3 is there as an estimate for the number of FLOPs.
The solve should be:
U2_md = 2.0 * U1_md + (L_interior * U1_md) - U0_md;Let n be the number of elements in U0_md, and z be the nnz in L_interior.
2*U1_md= n flopsL_interior*U1_md= approx 2z flops. Shortcut for sparsevector. I guess technically it is (z + (z-1)).- Step 1 + sparse mat mult = n flops
- Result -
U0_md= n flops
As I write this, I see the r2_md multiplying every step. That can be pre-multiplied to save n flops per step.
Arggh, I will fix it and rename the PR to address what it is actually doing.
There was a problem hiding this comment.
Should be:
addpath('../../../../src/octave');
|
Good catch @valeriabarra . The time stepping was perfect! With the time = 4/c, the final position was equal to the starting position. So the first order errors are gone, and you get 2*O, double the order of accuracy. I changed the time to 3 seconds / c. This shows the correct behavior of FD near 1, and MD being 2,4, and 6. |
There was a problem hiding this comment.
error. Fixed in both finite_diff files.
| ylim([min( min(walltime_fd), min(walltime_md) ) max( max(walltime_fd), max(walltime_md) )]); | ||
| xlabel('num points'); ylabel('walltime [s]'); | ||
| grid on; | ||
| title(['Walltime: FD (order 2) vs MD (order ', num2str(k), ')']); |
There was a problem hiding this comment.
I am not sure that we want to hard-code the FD order here and use the theoretical k value for MD here, instead of using their actual computed effective values like we do for the first plot, num2str(p_fd(1),'%.2f') and num2str(p_md(1),'%.2f').
I think the FD order hard-coded to 2 can be misleading as it doesn't take into account the BCs, only the interior.
There was a problem hiding this comment.
Those are for the scheme used, not necessarily what the scheme achieves. The stencil used is the second-order stencil, which has a fixed number of FLOPs per step. The comment gives the note for the method, not the results. Same for below.
% Floating point operations needed for each method. The mimetic difference
% methods use at least one more point, and have boundary calculations built in.| xlim([ num_cells(1) num_cells(end) ]); ylim([ 1e5 1e8 ]); | ||
| xlabel('num cells'); ylabel('FLOPs'); | ||
| grid on; | ||
| title(['FLOPs: FD (order 2) vs MD (order ', num2str(k), ')']); |
There was a problem hiding this comment.
Similarly as above. Thank you





What type of PR is this? (check all applicable)
Description
The two-way-wave-equation example was listed in an older matlab_octave folder. Moved to the octave folder.
Related Issues & Documents
Closes #143 and #501
Added/updated tests?
_We encourage you to test all code included with MOLE, including examples.
Read Contributing Guide and Code of Conduct
[not-optional] What gif best describes this PR or how it makes you feel?