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

Generalize get_source_field for arbitrarily shaped sources #101

Closed
prisae opened this issue May 19, 2020 · 0 comments · Fixed by #165
Closed

Generalize get_source_field for arbitrarily shaped sources #101

prisae opened this issue May 19, 2020 · 0 comments · Fixed by #165
Labels
enhancement New feature or request
Milestone

Comments

@prisae
Copy link
Member

prisae commented May 19, 2020

The function get_source_field returns the field for a dipole source. Source fields can be summed up to yield arbitrary sources, e.g. a square loop (hence providing a 'magnetic' source). An example of this is given in the example magnetic_source_el_loop in the gallery:

# Initiate a zero-valued source field.
sfield = emg3d.fields.SourceField(pgrid, freq=freq)

# Define the four dipole segments.
srcloop = [
    np.r_[src[0]-0.5, src[0]+0.5, src[1]-0.5, src[1]-0.5, src[2], src[2]],
    np.r_[src[0]+0.5, src[0]+0.5, src[1]-0.5, src[1]+0.5, src[2], src[2]],
    np.r_[src[0]+0.5, src[0]-0.5, src[1]+0.5, src[1]+0.5, src[2], src[2]],
    np.r_[src[0]-0.5, src[0]-0.5, src[1]+0.5, src[1]-0.5, src[2], src[2]],
]

# Add the source fields up.
for srcl in srcloop:
    sfield += emg3d.fields.get_source_field(pgrid, srcl, freq, strength)

The function get_source_field should be extended to do this in one call, get_source_field(grid, src, freq, strength), where each parameter in the tuple src=(x0, x1, y0, y1, z0, z1) will be an array instead of a float.

@prisae prisae added the enhancement New feature or request label Jun 19, 2020
@prisae prisae added this to the v1.0.0 milestone Jun 24, 2020
@prisae prisae linked a pull request Jan 7, 2021 that will close this issue
5 tasks
@prisae prisae mentioned this issue Jan 7, 2021
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant