-
Notifications
You must be signed in to change notification settings - Fork 0
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
33 prolongation and restriction tests #34
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @CodingAllan, I had a brief look. Generally this looks quite complete but there are some things that could be addressed before a more detailed review. Could you add some comments and also look at what I annotated elsewise?
tests/test_restriction.cpp
Outdated
gyro::icntl[Param::verbose] = 0; | ||
gyro::icntl[Param::debug] = 0; | ||
gyro::icntl[Param::extrapolation] = 0; | ||
gyro::icntl[Param::DirBC_Interior] = 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should test with and without Dirichlet conditions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can do this, but should the boundary conditions affect the operator ?
I thought that if we prolongate a solution u, then the information on boundary conditions should be stored in the stiffness matrix and right-hand side not neccessarily in the prolongation and restriction operator.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No they shouldnt. And it should be ensured that we have the same operator.
tests/test_prolongation.cpp
Outdated
gyro::icntl[Param::verbose] = 0; | ||
gyro::icntl[Param::debug] = 0; | ||
gyro::icntl[Param::extrapolation] = 0; | ||
gyro::icntl[Param::DirBC_Interior] = 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should test with and without Dirichlet conditions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Additionally (and in contrast) to my comment about "why do you set it if you don't use it?", we should maybe check with parameters that could make a change as in a future version, these might be implemented here. In particular Dirichlet boundary conditions could lead to a simplification but the operator should still handle both cases correctly. However, some parameters are probably never used in the context of the prolongation (also applies to other functions below)
…undary condition. Removed parameters not needed for the test. Soon I will consider to mock functions creating the grid.
… the same ansatz does not work.Look into it next week
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #34 +/- ##
=======================================
Coverage ? 35.91%
=======================================
Files ? 86
Lines ? 7028
Branches ? 0
=======================================
Hits ? 2524
Misses ? 4504
Partials ? 0 ☔ View full report in Codecov by Sentry. |
Hi @mknaranja , I just wanted to ask if I should add more comments to the program. Aside from that I think that this is ready for review! |
#include "gmgpolar.h" | ||
|
||
#ifndef MOCKGRID_H | ||
#define MOCKGRID_H |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#define MOCKGRID_H | |
#define MOCKGRID_H |
for (int i = 0; i < new_level->nr; i++) { | ||
new_level->r[i] = gyro::dcntl[Param::R0] + | ||
i * (gyro::dcntl[Param::R] - gyro::dcntl[Param::R0]) / new_level->nr; //uniform grid | ||
} | ||
|
||
new_level->r[new_level->nr] = gyro::dcntl[Param::R]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for (int i = 0; i < new_level->nr; i++) { | |
new_level->r[i] = gyro::dcntl[Param::R0] + | |
i * (gyro::dcntl[Param::R] - gyro::dcntl[Param::R0]) / new_level->nr; //uniform grid | |
} | |
new_level->r[new_level->nr] = gyro::dcntl[Param::R]; | |
for (int i = 0; i <= new_level->nr; i++) { | |
new_level->r[i] = gyro::dcntl[Param::R0] + | |
static_cast<double>(i) * (gyro::dcntl[Param::R] - gyro::dcntl[Param::R0]) / static_cast<double>(new_level->nr); //uniform grid | |
} |
new_level->theta = std::vector<double>(new_level->ntheta); | ||
|
||
for (int i = 0; i < new_level->ntheta; i++) { | ||
new_level->theta[i] = 2 * PI * i / ntmp; //uniform in theta |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
new_level->theta[i] = 2 * PI * i / ntmp; //uniform in theta | |
new_level->theta[i] = 2. * PI * static_cast<double>(i) / ntmp; //uniform in theta |
EXPECT_EQ(u_test[(j / 2) * ctheta_int + (i / 2)], sol[j * p_level.ntheta_int + i]) | ||
<< "coarse node injection is failing"; | ||
} | ||
else if (i % 2 != 0 && j % 2 == 0) { // theta_i is fine node |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
else if (i % 2 != 0 && j % 2 == 0) { // theta_i is fine node | |
else if (i % 2 != 0 && j % 2 == 0) { | |
// as numbering in angle (theta_i) is odd, we have a fine node with | |
// coarse neighbors at (r_i, theta_j - k_{j-1}) and (r_i, theta_j + k_j) |
Please adapt comment as following. theta_i itself cannot be coarse or fine. It is one coordinate of the node.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i and j have to be exchanged
int i1 = (j / 2) * ctheta_int + (i - 1) / 2; //bottom coarse node in theta | ||
int i2 = (i < p_level.ntheta_int - 1) ? i1 + 1 : (j / 2) * ctheta_int; //top coarse node in theta | ||
|
||
double val = (k_q * u_test[i1] + k_qm1 * u_test[i2]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's discuss here (stopped here)
Merge Request - GuideLine Checklist
Guideline to check code before resolve WIP and approval, respectively.
As many checkboxes as possible should be ticked.
Checks by code author:
Always to be checked:
If functions were changed or functionality was added:
If new functionality was added:
If new third party software is used:
If new mathematical methods or epidemiological terms are used:
Are new methods referenced? Did you provide further documentation?
The following questions are addressed in the documentation (if need be):
** Developers (what did you do?, how can it be maintained?)
** For users (how to use your work?)
** For admins (how to install and configure your work?)
For documentation: Please write or update the Readme in the current working directory!
Checks by code reviewer(s):