Convolution/integration operation

166 views
Skip to first unread message

alexis....@gmail.com

unread,
Mar 5, 2017, 3:30:03 PM3/5/17
to Dedalus Users
Dear all,

I would like to implement the following term in Dedalus, for a 1+1PDE, with $u(x,t)$:

$$f(x,t) = \int_{-\infty}^x u(y,t) dy, $$

which can be seen as a convolution of u with the Heavyside step function.

I could not find such an operation, as 'integ' does an integration over the entire space, and I don't know how to implement a Heavyside function which needs to depend on two variables, $x$ and $y$.

Thanks in advance for your help!
Alexis Arnaudon

Keaton Burns

unread,
Mar 6, 2017, 10:11:41 AM3/6/17
to dedalu...@googlegroups.com
Hi Alexis,

I think the simplest way to do this is to expand the problem variables to include f and enforce the relation through a differential equation like “dx(f) - u = 0”, along with a boundary condition to set the constant of integration.

Best,
-Keaton
--
You received this message because you are subscribed to the Google Groups "Dedalus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dedalus-user...@googlegroups.com.
To post to this group, send email to dedalu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dedalus-users/997fd49e-da9b-4425-97f1-4a7926d9b39b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

arnaudon alexis

unread,
Mar 6, 2017, 5:28:20 PM3/6/17
to Dedalus Users
Hi Keaton,

this is a really good idea! I tried but I failed so far... When I use what you sugested I obtain the following error after the first timestep:

/python3.5/site-packages/scipy/sparse/linalg/dsolve/linsolve.py:145: MatrixRankWarning: Matrix is exactly singular
  warn("Matrix is exactly singular", MatrixRankWarning)

Also, I am using periodic boundary conditions, which may be the issue here. I don't see how to solve this problem, which seems to be coming from the fact that I define f via its derivative (if I remove the derivative on f, the code does not crash).

Thanks a lot for your help!

Daniel Lecoanet

unread,
Mar 6, 2017, 6:25:33 PM3/6/17
to dedalu...@googlegroups.com
Hi there,

I think you may not be setting the gauge on f.  For instance, taking f->f+4 does not change your problem.  To set the gauge, you can do something like

problem.add_equation("dx(f) - u = 0", condition="nx != 0")
problem.add_equation("f = 0", condition = "nx == 0")

Daniel

On Tue, Mar 7, 2017 at 9:28 AM, arnaudon alexis <alexis....@gmail.com> wrote:
Hi Keaton,

this is a really good idea! I tried but I failed so far... When I use what you sugested I obtain the following error after the first timestep:

/python3.5/site-packages/scipy/sparse/linalg/dsolve/linsolve.py:145: MatrixRankWarning: Matrix is exactly singular
  warn("Matrix is exactly singular", MatrixRankWarning)

Also, I am using periodic boundary conditions, which may be the issue here. I don't see how to solve this problem, which seems to be coming from the fact that I define f via its derivative (if I remove the derivative on f, the code does not crash).

Thanks a lot for your help!

On Monday, March 6, 2017 at 3:11:41 PM UTC, Keaton Burns wrote:
To unsubscribe from this group and stop receiving emails from it, send an email to dedalus-users+unsubscribe@googlegroups.com.

To post to this group, send email to dedalu...@googlegroups.com.

Ben Brown

unread,
Mar 6, 2017, 6:29:14 PM3/6/17
to dedalus-users
Followup:

On a periodic domain you can't sent boundary conditions.  I'm not sure if "add_bc()" throws an error on a periodic Fourier domain, or if it causes a singular matrix.  And you may not be doing this anyways, already.  But something to be aware of.

arnaudon alexis

unread,
Mar 7, 2017, 9:50:20 AM3/7/17
to Dedalus Users
Thanks a lot, Daniel, it works well! I'll make sure I'll cite your paper and acknowledge your help! Dedalus is a really nice tool, keep developing it!

Ben, I tried what you said, and using add_bc with Fourier modes does not work, Dedalus complains about it.

All the best!

--
You received this message because you are subscribed to the Google Groups "Dedalus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dedalus-user...@googlegroups.com.
To post to this group, send email to dedalu...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages