# Numerical Solutions for Mixed Boundary Condition

• tau1777
In summary, the authors solve a 2nd order 1-d differential equation for the r-mode oscillations of a neutron star. They use the frequency of the mode as the parameter they mess with to match the solution. Newton's method is a possible method to integrate out to the surface with the condition that δρ [0] .
tau1777
Hi All,

I was reading this paper the other day and I've been trying to find the numerical techniques its mentions but have been thus far unsuccessful. The authors simply state that is well know and straightforward, and they believe this so much that they don't even include a reference. Ok, sorry about the rant.

The general problem they are trying to solve is for the r-mode oscillations of Neutron Stars. They get everything down to a 2nd order 1-d differential equation. They say the solution is zero at r=0, and at the surface they say it obeys something like A[r] * δρ[r] + B[r] * ∂ δρ[r] / ∂r =0. They they say they integrate from r=0 with the condition that δρ [0] =0, and from the surface with the condition A[r] * δρ[r] + B[r] * ∂ δρ[r] / ∂r =0 and they match the solutions at some specified point, and they use the frequency of the mode as the parameter they mess with to match the solution.

I understand how one can integrate out to the surface with the condition that δρ [0] , but how do they does the integration from the surface to the interior work when one has a Mixed boundary condition?

Any help is greatly appreciated. Thanks.

One possible method is Newton's method but with this methods you have to made an initial stab at the solution in the first place (asymptotic analysis perhaps?) It works very well when it works and then you can just code up the BCs without a problem.

I have some initial MATLAB code you can have if you want.

Mat

Hey Mat,

Thanks very much for the response. So if I understand what you are saying. I should just finite difference the boundary condition have have a an algebraic equation for the boundary. Then solve this equation and all the equations I got from the interior using a Newton-Raphson iteration scheme. And I need to find some way to find an initial guess for the iteration. Is this what you mean?

I'm basically trying to do something like this now within Mathematica, and I just wasn't sure how to incorporate the surface BC. Is there a specific Finite Difference scheme to use at the boundary because let say I use central differencing. Won't that take me outside my boundary?

I'd like to see you're code if that's ok. Thanks again for the help.

Essentially that is the thing I am saying, the only other thing is the BC on the boundary, so split your interval up into N pieces and you want to know how to compute your derivative on the boundary point $x_{N}$. The wa yto go about this is to examine the point $x_{N-\frac{1}{2}}$.
The derivative is given by:
$$\frac{dy}{dx}\Big|_{x_{N-\frac{1}{2}}}=\frac{y_{N}-y_{N-1}}{h}$$
Now the value of the derivative at $N-1/2$ is approximately the average of the derivatives at each side, so:
$$\frac{dy}{dx}\Big|_{x_{N-\frac{1}{2}}}=\frac{1}{2}\left(\frac{dy}{dx}\Big|_{x_{N}}+\frac{dy}{dx}\Big|_{x_{N-1}}\right)$$
Then you use:
$$\frac{dy}{dx}\Big|_{x_{N-1}}=\frac{y_{N}-y_{N-2}}{2h}$$
You solve for the thing you want
$$\frac{dy}{dx}\Big|_{x_{N}}=\frac{3y_{N}-4y_{N-1}+y_{N-2}}{2h}$$

I have sent you my programs.

Last edited:
Thanks for explanation. It helps me to solve manually.
Would you share with me MATLAB code. Because of i couldn't write.

Check your mail on this site, I sent you the programs there.

:( there isn't any new message in my mail or site private message inbox :( Would you send again

I am at a conference currently and I will post it here so there is no mistakes.

## 1. What is a mixed boundary condition in numerical solutions?

A mixed boundary condition in numerical solutions refers to a boundary condition that combines both Dirichlet and Neumann boundary conditions. This means that the boundary has both a prescribed value for the solution and a prescribed value for its derivative.

## 2. Why is it important to consider mixed boundary conditions in numerical solutions?

Mixed boundary conditions are important because they are more representative of real-world problems, where different types of boundary conditions may exist simultaneously. Ignoring mixed boundary conditions can lead to inaccurate results and incorrect interpretations of the problem.

## 3. What are some common numerical methods for solving mixed boundary condition problems?

Some common numerical methods for solving mixed boundary condition problems include finite difference methods, finite element methods, and boundary element methods. Each method has its own advantages and disadvantages, and the choice of method depends on the specific problem being solved.

## 4. How do you handle mixed boundary conditions in finite difference methods?

In finite difference methods, mixed boundary conditions can be handled by using a combination of forward and backward difference approximations for the Dirichlet and Neumann conditions, respectively. This approach is known as the ghost point method.

## 5. Can mixed boundary conditions be applied to all types of differential equations?

Yes, mixed boundary conditions can be applied to all types of differential equations, including ordinary differential equations, partial differential equations, and stochastic differential equations. However, the specific method for handling these conditions may vary depending on the type of equation and numerical method used.

• Differential Equations
Replies
2
Views
368
• Differential Equations
Replies
1
Views
2K
• Differential Equations
Replies
8
Views
2K
• Differential Equations
Replies
5
Views
2K
• Classical Physics
Replies
1
Views
516
• Differential Equations
Replies
1
Views
2K
• Differential Equations
Replies
5
Views
2K
• Electromagnetism
Replies
4
Views
1K
• Differential Equations
Replies
1
Views
1K
• Differential Equations
Replies
1
Views
2K