boundary forcing: "LHS is constant but RHS is nonconstant along L axis."

189 views
Skip to first unread message

Jeffrey S. Oishi

unread,
Jul 28, 2017, 11:11:18 AM7/28/17
to dedalus-users
Hi all,

I'm having a bit of trouble doing boundary forcing with a GeneralFunction. I do the usual things: create a function that takes the generic *args and calls a function (bump, in this case, which just is a function in C^\inf_0(R)). I create a GeneralFunction on that, and make it parseable. Finally, I call it on the Boundary, but of course, this gives 

dedalus.tools.exceptions.SymbolicParsingError: LHS is constant but RHS is nonconstant along L axis.

It's fairly obvious why that's happening: the GeneralFuction is returning a 3D data cube, but of course a boundary condition should be a 2D array at the boundary of the third dimension. How can I work around this? I've seen some references to boundary forcing on this list, so I'm sure it's possible. 

Sample code (not all of it) here:

# Boundary condtion forcing
def BoundaryFunc(*args):
    V = args[0].data
    K = args[1].data
    hw = args[2].value
    xmax = args[3].value
    ampl = args[4].value
    
    return ampl*bump(V,hw,xmax)*bump(K,hw,xmax)

def B(*args, domain=domain,F=BoundaryFunc):
    return de.operators.GeneralFunction(domain,layout='g',func=F,args=args)

de.operators.parseables['BF'] = B

[stuff]

FP.add_bc("left(f) = 0")
FP.add_bc("right(f) = BF(V,K,hw,xmax,ampl)")


Any help would be most appreciated! After I get this working, I'll generate a simple example of boundary forcing for the docs. 

thanks,

Jeff

Daniel Lecoanet

unread,
Jul 28, 2017, 11:21:58 AM7/28/17
to dedalu...@googlegroups.com
Could you do

FP.add_bc("right(f) = right(BF(V,K,hw,xmax,ampl))")

?

--
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-users+unsubscribe@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/CAAOZTN_X%2BN7AMbVnm5cMkEg-VRBzSvmPZGYyF3PMATJTF1%2BoSg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Jeffrey S. Oishi

unread,
Jul 28, 2017, 11:31:00 AM7/28/17
to dedalu...@googlegroups.com
Hi Daniel,

Oh, man. THAT'S embarrassing. Of course you can.

Thanks so much!

j

To unsubscribe from this group and stop receiving emails from it, send an email to dedalus-user...@googlegroups.com.

--
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.

Eric Hester

unread,
Sep 21, 2017, 2:52:46 AM9/21/17
to Dedalus Users
Hey Jeff,

Are some of your GeneralFunction arguments scalars? Because using scalar parameters as arguments I've just gotten errors saying " 'Scalar' object has no attribute 'layout' ".

I've also run into a similar error using the domain bases as arguments, since 'Array' objects don't have the layout attribute.

Is the simplest solution to just create fields for every GeneralFunction argument?

Cheers,
Eric

Jeffrey S. Oishi

unread,
Sep 21, 2017, 8:16:40 PM9/21/17
to Dedalus Users
Hi Eric,

Yes, the ones that use .value are scalars:

hw = args[2].value

I've also used the grids as arguments. I've attached a boundary forced wave equation script that has periodic in time and space forcing on the right boundary. It makes neat patterns; I haven't really thought much about whether or not it is correct, though. Nevertheless, it demonstrates how boundary forcing works. 

All, I'd like to propose this as a new example problem for dedalus. I'll issue a PR shortly, but if anyone wants to have a look, please let me know!

Let me know if this is helpful!

Jeff





--
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.
boundary_forced_waves.py

Eric Hester

unread,
Oct 3, 2017, 6:50:22 AM10/3/17
to dedalu...@googlegroups.com
Thanks a bunch Jeff!

Much appreciated. I think something like this would be great for an example script.

Cheers,
Eric
> On 22 Sep 2017, at 10:16, Jeffrey S. Oishi <jso...@gmail.com> wrote:
>
> <boundary_forced_waves.py>

Reply all
Reply to author
Forward
0 new messages