# Radial component Dirichlet Boundary Condition ODE

Suppose I have a Dirichlet boundary problem defined on the unit disk. I have managed to separate variables -- solution $y(r,\theta)= R(r)\Theta(\theta)$ -- and reduce the problem into 2 1D problems. Now, I would like to solve the radial component numerically.

eqn = second order ODE for the radial component (only);


(I shall omit its explicit form here)

Then I tried defining (for some reason, Mathematica didn't like me calling the solution $R$, so I called it $y$ here. Also, I called $r, z$ here )

dcond = DirichletCondition[y[z] == c, 0 <= z <= 1];


(where c is a constant to be entered), and

region = 0 <= z <= 1;


Then to set things in motion,

solution[c_,x_] := y /. (NDSolveValue[{eqn, region, dcond}, y, z \[Element] {0, 1}] // Flatten) /. z -> x


However, when I run solution[0.78, 0.1] (for example, to pick 2 numbers for the arguments) , I get the error messages:

NDSolveValue::femnr: z\[Element]{0,1} is not a valid region specification. >>
NDSolveValue::femnr: 0.1\[Element]{0,1} is not a valid region specification. >>


Could anyone teach me how to fix it? Thank you!

I'm not sure I completely get what you mean here, but here is what I think is the answer here. Let this be some second order ODE for radial part of the equation:

eqn = -D[y[z], {z, 2}] + y[z] == 0;


The Dirichlet boundary conditions are specified in the region boundary, so maybe you mean:

dcond[c_] := DirichletCondition[y[z] == c, True]


This is the region:

region = Interval[{0, 1}];


and the solution

sol[c_] := NDSolve[{eqn, dcond[c]}, y[z], z \[Element] region]


Hope this will help.

• Thank you very much! Your answer is perfect! I tried upvoting your answer but apparently I don't have enough reputation... Sorry and thanks again!
– Alex
May 18, 2017 at 20:16