Skip to main content
edited tags
Link
user21
  • 40.7k
  • 8
  • 114
  • 170
Improved formatting
Source Link
m_goldberg
  • 108.1k
  • 16
  • 104
  • 259

2D PDE with NDSolve - how to have How do I formulate a Dirichlet boundary condition for which the boundary depends on the other variable?

I am trying to solve the Poisson equation on a cylindrical grid.

$$ \frac{1}{r^2} \frac{\partial}{\partial r} r^2 \frac{\partial f(r, \theta)}{\partial r} = n(r, \theta) $$

Analytically, there is no angular dependence to the function $n(r, \theta)$, which is why I'm working in cylindrical coordinates. I would like to define a Dirichlet boundary condition for which $f(r_{max}(\theta), \theta) = 0$, but where $r_{max}(\theta)$ determines the distance from the origin to the boundary of a cylindrical box containing the simulation space.

Succinctly, I'd like to ask how to define a Dirichlet boundary condition on one variable which depends on the other variable for a 2D PDE.

The code I have tried is simple, but most likely naive:

sol = 
  NDSolve[
    {1/r^2*D[r^2*D[f[rr^2 D[r^2*D[f[r, \[Theta]]θ], r], r] == n[r], 
     Derivative[1, 0][f][0, \[Theta]]θ] == 0, 
     DirichletCondition[f[r, \[Theta]]θ] == 0, r == RRMAX[\[Theta]]]RRMAX[θ]]}, 
    f, {r, \[Theta]θ}]

RRMAXRRMAX is defined elsewhere, although I suspect it isn't important exactly what for it has for the purpose of the question. For example,

RRMAX[\[Theta]_]RRMAX[θ_] := 60*60 (1 - 0.1*Cos[\[Theta]]1 Cos[θ])

I get an error message which says the following: "The dependent variable in TemporaryVariable$xxxxxxxx[0] == 0 in the boundary condition DirichletCondition[...] needs to be linear"

The dependent variable in TemporaryVariable$xxxxxxxx[0] == 0 in the boundary condition DirichletCondition[...] needs to be linear

If anyone could help me, I'll give my firstborn to you. Thanks

2D PDE with NDSolve - how to have a Dirichlet boundary condition for which the boundary depends on the other variable?

I am trying to solve the Poisson equation on a cylindrical grid.

$$ \frac{1}{r^2} \frac{\partial}{\partial r} r^2 \frac{\partial f(r, \theta)}{\partial r} = n(r, \theta) $$

Analytically, there is no angular dependence to the function $n(r, \theta)$, which is why I'm working in cylindrical coordinates. I would like to define a Dirichlet boundary condition for which $f(r_{max}(\theta), \theta) = 0$, but where $r_{max}(\theta)$ determines the distance from the origin to the boundary of a cylindrical box containing the simulation space.

Succinctly, I'd like to ask how to define a Dirichlet boundary condition on one variable which depends on the other variable for a 2D PDE.

The code I have tried is simple, but most likely naive:

sol = NDSolve[{1/r^2*D[r^2*D[f[r, \[Theta]], r], r] == n[r], 
   Derivative[1, 0][f][0, \[Theta]] == 0, 
   DirichletCondition[f[r, \[Theta]] == 0, r == RRMAX[\[Theta]]]}, 
  f, {r, \[Theta]}]

RRMAX is defined elsewhere, although I suspect it isn't important exactly what for it has for the purpose of the question. For example,

RRMAX[\[Theta]_] := 60*(1 - 0.1*Cos[\[Theta]])

I get an error message which says the following: "The dependent variable in TemporaryVariable$xxxxxxxx[0] == 0 in the boundary condition DirichletCondition[...] needs to be linear"

If anyone could help me, I'll give my firstborn to you. Thanks

How do I formulate a Dirichlet boundary condition for which the boundary depends on the other variable?

I am trying to solve the Poisson equation on a cylindrical grid.

$$ \frac{1}{r^2} \frac{\partial}{\partial r} r^2 \frac{\partial f(r, \theta)}{\partial r} = n(r, \theta) $$

Analytically, there is no angular dependence to the function $n(r, \theta)$, which is why I'm working in cylindrical coordinates. I would like to define a Dirichlet boundary condition for which $f(r_{max}(\theta), \theta) = 0$, but where $r_{max}(\theta)$ determines the distance from the origin to the boundary of a cylindrical box containing the simulation space.

Succinctly, I'd like to ask how to define a Dirichlet boundary condition on one variable which depends on the other variable for a 2D PDE.

The code I have tried is simple, but most likely naive:

sol = 
  NDSolve[
    {1/r^2 D[r^2*D[f[r, θ], r], r] == n[r], 
     Derivative[1, 0][f][0, θ] == 0, 
     DirichletCondition[f[r, θ] == 0, r == RRMAX[θ]]}, 
    f, {r, θ}]

RRMAX is defined elsewhere, although I suspect it isn't important exactly what for it has for the purpose of the question. For example,

RRMAX[θ_] := 60 (1 - 0.1 Cos[θ])

I get an error message which says the following:

The dependent variable in TemporaryVariable$xxxxxxxx[0] == 0 in the boundary condition DirichletCondition[...] needs to be linear

If anyone could help me, I'll give my firstborn to you.

Source Link

2D PDE with NDSolve - how to have a Dirichlet boundary condition for which the boundary depends on the other variable?

I am trying to solve the Poisson equation on a cylindrical grid.

$$ \frac{1}{r^2} \frac{\partial}{\partial r} r^2 \frac{\partial f(r, \theta)}{\partial r} = n(r, \theta) $$

Analytically, there is no angular dependence to the function $n(r, \theta)$, which is why I'm working in cylindrical coordinates. I would like to define a Dirichlet boundary condition for which $f(r_{max}(\theta), \theta) = 0$, but where $r_{max}(\theta)$ determines the distance from the origin to the boundary of a cylindrical box containing the simulation space.

Succinctly, I'd like to ask how to define a Dirichlet boundary condition on one variable which depends on the other variable for a 2D PDE.

The code I have tried is simple, but most likely naive:

sol = NDSolve[{1/r^2*D[r^2*D[f[r, \[Theta]], r], r] == n[r], 
   Derivative[1, 0][f][0, \[Theta]] == 0, 
   DirichletCondition[f[r, \[Theta]] == 0, r == RRMAX[\[Theta]]]}, 
  f, {r, \[Theta]}]

RRMAX is defined elsewhere, although I suspect it isn't important exactly what for it has for the purpose of the question. For example,

RRMAX[\[Theta]_] := 60*(1 - 0.1*Cos[\[Theta]])

I get an error message which says the following: "The dependent variable in TemporaryVariable$xxxxxxxx[0] == 0 in the boundary condition DirichletCondition[...] needs to be linear"

If anyone could help me, I'll give my firstborn to you. Thanks