# Help with boundary-value problem

**URL:** https://discourse.julialang.org/t/help-with-boundary-value-problem/86862
**Category:** Offtopic
**Created:** [September 1, 2022, 2:17am UTC](https://discourse.julialang.org/t/help-with-boundary-value-problem/86862 "2022-09-01T02:17:35Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![BJR](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bjr/32/36613_2.png) [@BJR](https://discourse.julialang.org/u/BJR)
#### Post date: [September 1, 2022, 2:17am UTC](https://discourse.julialang.org/t/help-with-boundary-value-problem/86862/1 "2022-09-01T02:17:35Z")

</div>

I have been trying to solve this (see image) equation 1 using the finite difference method with the initial conditions as given in equations (2,3 & 4). Note that the initial condition is z = -2400 nm for all values of the r range. Is it possible to solve this equation (1) with this information? I have been trying without success. Especially, how to approximate r-dependent derivatives without knowing anything about initial conditions, i.e., E\_p, E\_s at r = -1800 nm for all values of z? Any suggestions, please?

 ![Screenshot](https://global.discourse-cdn.com/julialang/original/3X/0/f/0f2efd792c9726f6090d3ec52ecfbeef460ade35.jpeg)

---

<div class="post-metadata">

### Author: ![BJR](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bjr/32/36613_2.png) [@BJR](https://discourse.julialang.org/u/BJR)
#### Post date: [September 7, 2022, 12:08am UTC](https://discourse.julialang.org/t/help-with-boundary-value-problem/86862/2 "2022-09-07T00:08:05Z")

</div>

@amontoison @stevengj

---

<div class="post-metadata">

### Author: ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)
#### Post date: [September 7, 2022, 12:44am UTC](https://discourse.julialang.org/t/help-with-boundary-value-problem/86862/3 "2022-09-07T00:44:50Z")

</div>

> [@BJR](#):
>
> Is it possible to solve this equation (1) with this information?

No. You can’t solve a second-order equation in z given only the value of the solution at one z boundary. You need some additional information.

Most likely, since this is a wave equation (a 2d scalar Helmholtz equation), you want to assume outgoing/radiation boundary conditions as |z|,r \to \infty (the r=0 boundary is determined by the cylindrical symmetry). Then you can use a variety of techniques, e.g. finite differences with [PML boundaries](https://arxiv.org/abs/2108.05348) (as in [this example Julia code](https://nbviewer.org/urls/dl.dropbox.com/s/s7x9kojyioib8ba/Helmholtz2d.ipynb)), finite elements with PML (as in [this Gridap tutorial](https://gridap.github.io/Tutorials/dev/pages/t012_emscatter/)), or perhaps integral-equation methods (where the outgoing boundaries are implicitly specified via the Green’s function).

---

<div class="post-metadata">

### Author: ![BJR](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bjr/32/36613_2.png) [@BJR](https://discourse.julialang.org/u/BJR)
#### Post date: [September 7, 2022, 2:02am UTC](https://discourse.julialang.org/t/help-with-boundary-value-problem/86862/4 "2022-09-07T02:02:12Z")

</div>

@stevengj Thank you for the quick response. I will write more after reading about PML boundary conditions as I am not aware of the theory behind this method. However, just to make a brief response, this equation comes in CARS microscopy [J. Opt. Soc. Am. B 17, 1678 (2000)] where the authors use the integral transform method to the equation (1) i.e., applying Hankel transform to eliminate the r-dependent derivatives in cylindrical coordinates and solving the resulting second-order differential equation in one variable (z) by numerical integration. However, I am trying to solve the same equation (1) by using the finite difference method. Here, the only known initial fields (pump, Stokes) at the front face of the sample cell (assuming a square cell in r, z coordinates) are given by equations 2,3.

I will write more after going through PML theory later. thank you again.

---

<div class="post-metadata">

### Author: ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)
#### Post date: [September 7, 2022, 11:47am UTC](https://discourse.julialang.org/t/help-with-boundary-value-problem/86862/5 "2022-09-07T11:47:51Z")

</div>

> [@BJR](#):
>
> where the authors use the integral transform method to the equatio

I haven’t looked at this paper, but it sounds like they are effectively using a kind of integral-equation method, which implicitly incorporates outgoing boundary conditions via the Green’s function.

---

<div class="post-metadata">

### Author: ![BJR](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bjr/32/36613_2.png) [@BJR](https://discourse.julialang.org/u/BJR)
#### Post date: [September 7, 2022, 12:09pm UTC](https://discourse.julialang.org/t/help-with-boundary-value-problem/86862/6 "2022-09-07T12:09:01Z")

</div>

That is right. they use Hankel transform to simplify the radial derivatives by using the known relation of Hankel transform property, that is HT [d^2/dr^2 + 1/r \* d/dr] = - 4pi rho^2. This way they convert the second-order differential equation in two variables (r , z) into a second-order diff. eq. in single variable, z while rho (conjugate of r) becomes a parameter.
