heterogeneous boundary condition in custom pde class #601
Replies: 4 comments 3 replies
-
One problem lies in the fact that you try to use MPI, where the computation domain will be split into different parts, but your |
Beta Was this translation helpful? Give feedback.
-
Hello, similarly I rewrote the corresponding part in the numpy implementation as well. Above the function pde_rhs I added : However it still shows an error Thank you in advance. |
Beta Was this translation helpful? Give feedback.
-
I understand.
Without the numba implementation the code runs in serial without issue.
This time to make the numba implementation work expanded in laplacian like
in your example
https://py-pde.readthedocs.io/en/latest/examples_gallery/pde_heterogeneous_diffusion.html
The space dependent diffusion constant part wrote in the beginning of the
class like this :
class BWH(PDEBase):
def __init__(self, P = 120, bc = "auto_periodic_neumann"):
super().__init__
self.lamda = 0.5
self.E = 10.0
self.K = 0.9
self.M = 11.4
self.DB = 1.2
*self.DH = self.DB + ScalarField.from_expression(grid, "0.5 * sin(0.5 *
x)") self.DH_grad = ScalarField.from_expression(grid, "0.25 *
cos(0.5 * x)")*
then in the "evolution rate" function I called them like this,
B_t = (self.lamda * B * W * ((1.0 + (self.E * B))**2) * (1.0 - (B/self.K)))
- (self.M * B) - (self.AlphaH * H * B/(self.BetaH + B)) + (self.DH *
B.laplace(self.bc)) + (self.DH_grad * B.gradient(self.bc))
while in "pde_rhs" function I used them like,
rate[0] = (lamda * B * W * ((1.0 + (E * B))**2) * (1.0 - (B/K))) - (M * B)
- (AlphaH * H * B/(BetaH + B)) + (DH * laplace(B)) + (DH_grad *
gradient(B))
with this the error msg is :
raise ValueError(f"Grids {self} and {other} are incompatible")
What does this mean ? Can you please give at least some hint as to what I
am doing wrong ?
…On Mon, Aug 26, 2024 at 3:40 PM David Zwicker ***@***.***> wrote:
I unfortunately don't have the bandwidth to debug your code.
—
Reply to this email directly, view it on GitHub
<#601 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AIPKN3QURPAWWOUDHMJIVVLZTMO4BAVCNFSM6AAAAABMYT2U26VHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTANBVGE2DEOA>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
Hello The numba implementation part of the code below now works. The purpose was to introduce heterogeneity by introducing a x dependance in the diffusion. But we got around it and introduced a 4th equation with a term which depends on x coordinates. It serves the main purpose. Thank you for the suggestions, David.
|
Beta Was this translation helpful? Give feedback.
-
I am trying to run a pde system with a heterogeneous diffusion in one of the three variables in the system. I am using the custom pde class example and wrote mine accordingly. It is a fairly simple set of PDEs.
I modified the diffusion coefficient, DB, as DB + (0.5 * np.sin(x)). However I am getting an error saying that there is a problem with multiplication operation in the rate equation.
The system has three variables, B, W, H. In the rate equation for B, I implement the heterogeneous diffusion. I am expecting the code to give a travelling pattern.
The code is given below ______
When I run the code above I get the following error
The issue may be really trivial which I can't really figure out. I am new to using this.
Please any help/suggestion is greatly appreciated.
Beta Was this translation helpful? Give feedback.
All reactions