Giter VIP home page Giter VIP logo

Comments (4)

lecoanet avatar lecoanet commented on August 20, 2024

Under further investigation, it appears that there is a term Laplacian(Ta) where Ta is a z-dependent NCC which is not being evaluated correctly. In commit ff3aea3 it is evaluated correctly, but in f263415 it is zero. Here's a simple code snippet which illustrates the problem:

import numpy as np
import dedalus.public as d3
coords = d3.CartesianCoordinates('x', 'z')
dist = d3.Distributor(coords, dtype=np.float64)
xbasis = d3.RealFourier(coords['x'], size=16, bounds=(0, 1), dealias=3/2)
zbasis = d3.ChebyshevT(coords['z'], size=16, bounds=(0, 1), dealias=3/2)
rhoa = dist.Field(name='rhoa', bases=(zbasis)) # isentropic density profile
Ta = np.exp(rhoa)
Lapa = d3.lap(Ta)
print(Lapa)

For ff3aea3 it returns Lap(exp(rhoa)) -- this is the desired behavior
For f263415 it returns 0

from dedalus.

lecoanet avatar lecoanet commented on August 20, 2024

Actually turns out the commit that causes the shift from Lap(exp(rhoa)) to 0 is 191879c, the commit before f263415.

from dedalus.

lecoanet avatar lecoanet commented on August 20, 2024

The issue with 191879c is this code here in the Laplacian _preprocess_args method:

elif not isinstance(coordsys, coords.DirectProduct) and operand.domain.get_basis(coordsys) is None:
    raise SkipDispatchException(output=0)

Since rhoa is a function of z only, rhoa.domain.get_basis(coordsys) returns None.

Presumably we want to be able to take the laplacian of variables which do not depend on all of the coordinates in a coordinatesystem?

from dedalus.

lecoanet avatar lecoanet commented on August 20, 2024

I verified that if I comment out those two lines in Laplacian _preprocess_args, the script acts as expected.

To summarize, it appears that 1218c62 introduced a bug in CartesianGradient which was fixed in f263415. However, the previous commit (191879c) introduced this "bug" into Laplacian.

We should carefully consider how Laplacian should act on fields which are constant in certain directions.

from dedalus.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.