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

Stokes biharmonic #29

Open
wants to merge 222 commits into
base: main
Choose a base branch
from
Open

Stokes biharmonic #29

wants to merge 222 commits into from

Conversation

isuruf
Copy link
Collaborator

@isuruf isuruf commented Sep 10, 2020

@isuruf isuruf marked this pull request as draft September 10, 2020 22:14
pytential/symbolic/stokes.py Outdated Show resolved Hide resolved
@inducer
Copy link
Owner

inducer commented Sep 11, 2020

When I print the expression you feed to bind(), there's a "naked" (i.e. not inside an IntG) area element there:

CSE0 : sigma[0] + (-1)*(NodeSum(area_element*w_quad[?]*sigma[0]) / area)
CSE1 : sigma[1] + (-1)*(NodeSum(area_element*w_quad[?]*sigma[1]) / area)
area : NodeSum(area_element*w_quad[?]*Ones[?])
area_element : sqrt(pd_matrix0_0*pd_matrix0_0 + pd_matrix1_0*pd_matrix1_0)
pd_matrix0_0 : d/dr0[?] x0[?]
pd_matrix1_0 : d/dr0[?] x1[?]
===========================================================================
array(
  0: (-1)*(Int[?->?]@(2){mu: mu} (StressletKnl2D_000 * normal[0]*sigma[0]) + Int[?->?]@(2){mu: mu} (StressletKnl2D_001 * normal[0]*sigma[1]) + Int[?->?]@(2){mu: mu} (StressletKnl2D_001 * normal[1]*sigma[0]) + Int[?->?]@(2){mu: mu} (StressletKnl2D_011 * normal[1]*sigma[1])) + (-1)*((-1) / mu)*(Int[?->?]@(2) (d/dx1 d/dx1 BiharmKnl2D * CSE0) + (-0.1193662073189215)*CSE0) + ((-1) / mu)*Int[?->?]@(2) (d/dx1 d/dx0 BiharmKnl2D * CSE1) + (-1)*((-1)*((-1) / mu)*(Int[?->?]@(2) (d/dx1 d/dx1 BiharmKnl2D * omega[0]) + (-0.1193662073189215)*omega[0]) + ((-1) / mu)*Int[?->?]@(2) (d/dx1 d/dx0 BiharmKnl2D * omega[1])) + sigma_int_val[0]
  ---------------------------------------------------------------------------
  1: (-1)*(Int[?->?]@(2){mu: mu} (StressletKnl2D_001 * normal[0]*sigma[0]) + Int[?->?]@(2){mu: mu} (StressletKnl2D_011 * normal[0]*sigma[1]) + Int[?->?]@(2){mu: mu} (StressletKnl2D_011 * normal[1]*sigma[0]) + Int[?->?]@(2){mu: mu} (StressletKnl2D_111 * normal[1]*sigma[1])) + ((-1) / mu)*Int[?->?]@(2) (d/dx0 d/dx1 BiharmKnl2D * CSE0) + (-1)*((-1) / mu)*(Int[?->?]@(2) (d/dx0 d/dx0 BiharmKnl2D * CSE1) + (-0.1193662073189215)*CSE1) + (-1)*(((-1) / mu)*Int[?->?]@(2) (d/dx0 d/dx1 BiharmKnl2D * omega[0]) + (-1)*((-1) / mu)*(Int[?->?]@(2) (d/dx0 d/dx0 BiharmKnl2D * omega[1]) + (-0.1193662073189215)*omega[1])) + sigma_int_val[1]
)

(Use sym.pretty() to reproduce this.)
Specifically, I'm talking about theCSE0. Since that's outside an IntG, it's evaluated in a "target" context. The target you request are the vis points, and it's not possible/not reasonable to calculate derivatives on them (in order to compute an area element), and so it yells at you.

@isuruf
Copy link
Collaborator Author

isuruf commented Sep 11, 2020

Got it. Thanks. Is there a way to pass a constant to IntG instead of a sumpy kernel?

@isuruf
Copy link
Collaborator Author

isuruf commented Sep 11, 2020

I meant passing CSE0 like IntG(1, density=CSE0)

@inducer
Copy link
Owner

inducer commented Sep 11, 2020

Got it. Thanks. Is there a way to pass a constant to IntG instead of a sumpy kernel?

I mean, you could create an ExpressionKernel with expression 1. But it's probably overkill to warm up the layer potential machinery for that. What you want is probably a length integral times the constant. (sym.integral) The ToTargetTagger likely won't auto-tag this correctly, so you'll have to manually pass it the name of the source geometry.

from math import pi
from pytential.symbolic.primitives import as_dofdesc, DEFAULT_SOURCE
const = -3/(8*pi) * sym.integral(self.dim, self.dim-1, density,
dofdesc=as_dofdesc(DEFAULT_SOURCE))
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@inducer, is this correct?

Copy link
Owner

Choose a reason for hiding this comment

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

Yes, it looks that way. One remaining issue is that the Stokeslet is being passed a density with the mean removed. This mean also involves an integral that needs to be told where to evaluate. I'm suspecting there might be a way to make the ToTargetTagger smarter to automatically tag things more appropriately.

:arg qbx_forced_limit: the *qbx_forced_limit* argument to be passed on
to :class:`~pytential.symbolic.primitives.IntG`.
"""
return self.apply(density_vec_sym, qbx_forced_limit, [deriv_dir])
Copy link
Owner

Choose a reason for hiding this comment

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

Raise a DeprecationWarning, remove from docs.

for j in range(i):
self.kernel_dict[(i, j)] = self.kernel_dict[(j, i)]

def get_int_g(self, idx, density_sym, dir_vec_sym, qbx_forced_limit,
Copy link
Owner

Choose a reason for hiding this comment

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

Underscore me.

:arg qbx_forced_limit: the *qbx_forced_limit* argument to be passed on
to :class:`~pytential.symbolic.primitives.IntG`.
"""
raise NotImplementedError
Copy link
Owner

Choose a reason for hiding this comment

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

What are u_i in these docstrings?

# TargetPointMultiplier has to be the outermost kernel
# If it is the inner kernel, return early
if isinstance(knl, TargetPointMultiplier):
return 1, int_g
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
return 1, int_g
return int_g

?

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.

3 participants