Replies: 5 comments
-
This is certainly possible. The simplest way would be to use the from pde import PDE
eq = PDE({'P': '(P - P**2) * laplace(P)'}) where I used See |
Beta Was this translation helpful? Give feedback.
-
I may be missing something, but it seems that you actually used |
Beta Was this translation helpful? Give feedback.
-
Ohh, I wasn't reading your question carefully enough – sorry about this. The current implementation of the import pde
class HeterogeneousDiffusionPDE(pde.PDEBase):
def evolution_rate(self, state, t=0):
""" implement the python version of the evolution equation """
assert state.grid.dim == 1 # implementation only works for 1d problems
cell_coords = state.grid.cell_coords[:, 0] # this extracts the x-coordinates of all cells
coeff = (cell_coords - cell_coords**2) # this calculates the pre-factor
return state.laplace('natural') * coeff
grid = pde.CartesianGrid([[0, 1]], 32) # generate grid
state = pde.ScalarField.random_normal(grid, 0.1, 0.9) # generate initial condition
eq = HeterogeneousDiffusionPDE() # define the pde
result = eq.solve(state, t_range=1, dt=1e-4)
result.plot() A numba-compiled implementation to accelerate the computation can be created similarly. I'll think about extending the |
Beta Was this translation helpful? Give feedback.
-
I took you suggestion as a challenge and implemented an extended version of the |
Beta Was this translation helpful? Give feedback.
-
Thanks! Looks good |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
 \cdot \frac{\partial^2 P}{{\partial x}^2})
I didn't see it mentioned anywhere and it doesn't appear in any of the examples.
Can I define a PDE of the form:
where D(x) could be a polynomial of x for example
Thanks
Itay
Beta Was this translation helpful? Give feedback.
All reactions