Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Bortfeld single BP model #8

Open
grzanka opened this issue Dec 28, 2018 · 7 comments
Open

Add Bortfeld single BP model #8

grzanka opened this issue Dec 28, 2018 · 7 comments

Comments

@grzanka
Copy link
Contributor

grzanka commented Dec 28, 2018

See libamtrack/library#22

@grzanka
Copy link
Contributor Author

grzanka commented Dec 28, 2018

@grzanka
Copy link
Contributor Author

grzanka commented Dec 28, 2018

@grzanka
Copy link
Contributor Author

grzanka commented Dec 28, 2018

@grzanka
Copy link
Contributor Author

grzanka commented Jan 10, 2019

image
image
image

image

image

@grzanka
Copy link
Contributor Author

grzanka commented Jan 10, 2019

Some prototype code to start with:

import mpmath as mp  # its part of sympy, offers high-precision floating-point arithmetic

# lets use again models.py file and display the implementation of Wilkens model
from models import WilkensLET

def fun(energy_MeV, Phi_0_cm2, sigma_energy_MeV, z_cm, eps = 0.1):
  
  rho_g_cm3 = 1.0
  
  beta_cm = 0.012  # 1/cm
  
  gamma = 0.6

  # range
  range_cm = ERSCalc.range_cm(energy_MeV)

  # range straggling of monoenergetical protons, see Appendix [1]
  sigma_mono_cm = 0.012 * range_cm ** 0.935

  # range equivalent of energy straggline, equation (A2) in [1]
  sigma_r_cm = sigma_energy_MeV
  sigma_r_cm *= ERSCalc.alpha_cm_MeV
  sigma_r_cm *= ERSCalc.p
  sigma_r_cm *= (energy_MeV ** (ERSCalc.p - 1.0))

  # total sigma, equation (A3) in [1]
  sigma_cm = (sigma_mono_cm ** 2 + sigma_r_cm ** 2) ** 0.5
  
  A = sigma_cm ** (1.0 / ERSCalc.p)
  A *= mp.gamma(1.0 / ERSCalc.p)
  A /= mp.sqrt( 2.0 * np.pi)
  A /= rho_g_cm3
  A /= ERSCalc.p
  A /= (ERSCalc.alpha_cm_MeV ** (1.0 / ERSCalc.p))
  A /= (1.0 + beta_cm * range_cm)
  
  # zeta variable introduced for equation (A8) in [1]
  zeta = (range_cm - z_cm) / sigma_cm
  
  B = beta_cm / ERSCalc.p + gamma * beta_cm + eps / range_cm
  
  result = Phi_0_cm2 * A
  bracket_part1 = WilkensLET.parabolic_integral(1.0 / ERSCalc.p, -zeta) / sigma_cm
  bracket_part2 = B * WilkensLET.parabolic_integral(1.0 + (1.0 / ERSCalc.p), -zeta)
  result *= ( bracket_part1 + bracket_part2 )
  
  result *= 1.6021766e-10
  
  return result

@grzanka
Copy link
Contributor Author

grzanka commented Jan 10, 2019

Basic implementation is in 9469f2f

TODO:

  • better description
  • test directory with validation notebooks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant