Skip to content
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

Added function to compute convolution. #4

Merged
merged 1 commit into from
Jan 18, 2022
Merged

Added function to compute convolution. #4

merged 1 commit into from
Jan 18, 2022

Conversation

abarret
Copy link
Owner

@abarret abarret commented Jan 11, 2022

This computes a convolution of (alpha * a + beta * b) and a function phi(r) at a specified cell index. Note that phi is assumed to be of the form phi(r) = phi(x)*phi(y) (like IB delta functions).

@jmcragun, take a look and feel free to merge if this makes sense to you.

@abarret abarret mentioned this pull request Jan 12, 2022
int_box.grow(phi_width);
#ifndef NDEBUG
// Error checking. Need ghost data for patch data.
TBOX_ASSERT(a_data.getGhostBox() * int_box == int_box);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you elaborate on why we need ghost data here, and what exactly this line is doing?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line computes the intersection between the two boxes, and makes sure that it's equal to the integration box. * is an overloaded operator for type Box<NDIM>. Essentially, we're checking that the integration box is contained within the ghost box.

@jmcragun
Copy link
Collaborator

Can I call this function from ActivatedPlateletSource.cpp simply by locally including it or would the setup process be more applied?

@abarret
Copy link
Owner Author

abarret commented Jan 13, 2022

Can I call this function from ActivatedPlateletSource.cpp simply by locally including it or would the setup process be more applied?

Yeah. You need to include the header utility_functions.h to get the definition of the function, and then the linker will fill in the definition.

@jmcragun jmcragun merged commit 0a16bd1 into main Jan 18, 2022
* Both patch data MUST have enough ghost cells for the width of the phi function. This assumes the phi function is
* centered at idx and scaled by the grid spacing.
*/
double convolution(double alpha,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you explain these parameters some more? I'm trying to include this in the two files I've been working on. In particular I'm curious as to where phi, phi_width, and dx come from and should be defined. I'm assuming a_data and b_data correspond loosely to phi_a and phi_b?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm also a bit confused in my implementation since to compute alpha, you need to compute R2, which uses eta. But then eta is computed using alpha? This seems like a circular dependency.

@abarret abarret deleted the convolution branch June 27, 2022 19:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants