GithubHelp home page GithubHelp logo

Non-uniform grid (dim >1) about findiff HOT 5 CLOSED

maroba avatar maroba commented on August 18, 2024
Non-uniform grid (dim >1)

from findiff.

Comments (5)

maroba avatar maroba commented on August 18, 2024 1

Ah, I see. I'm sorry, the non-uniform grid in findiff so far is only very basic. It is actually a cartesian product of one-dimensional non-uniform grids, which was sufficient for my needs so far. AMR is more advanced. That would something for the future to implement.

from findiff.

maroba avatar maroba commented on August 18, 2024

Hi,

thanks!

The non-linear case accepts the 1D axes instead of the meshed N-dimensional grids. Here is an example, how it works in two dimensions:

import findiff
import numpy as np
import matplotlib.pyplot as plt


x, y = np.logspace(-1, 1, 50), np.logspace(-1, 1, 50)
X, Y = np.meshgrid(x, y, indexing='ij')

f = np.sin(X) * np.sin(Y)
df_dy = np.sin(X) * np.cos(Y)

d_dy = findiff.FinDiff(1, y, acc=6)
df_dy_fd = d_dy(f)
plt.plot(y, df_dy[0, :], '-')
plt.plot(y, df_dy_fd[0, :], 'o')

If you have trouble with that or have more questions, don't hesitate to ask. :-)

from findiff.

cjoana avatar cjoana commented on August 18, 2024

Yes, sure. But here is an uniform grid. The issue is when the gridding is non-uniform, there the 1D array is not enough.

from findiff.

maroba avatar maroba commented on August 18, 2024

What do you mean? The example above is a non-uniform grid (logspace, not linspace). Can you give an example of your issue in code?

from findiff.

cjoana avatar cjoana commented on August 18, 2024

Hi, sorry for the late reply. Ok, I see what you mean.

What I was meaning by a non-uniform grid is something like adaptative mesh refinement (AMR) grid.
Something like this illustration:
Selection_181

There you would need to insert the whole grid of coordinates to derive the individual "dx" at each cell.
Either this or perform the derivatives per AMR levels (but this then is specific to AMR like non-uniform grids).

from findiff.

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.