Main Lemma Repository
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

KernelEM1DSpec.cpp 96KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651
  1. /* This file is part of Lemma, a geophysical modelling and inversion API */
  2. /* This Source Code Form is subject to the terms of the Mozilla Public
  3. * License, v. 2.0. If a copy of the MPL was not distributed with this
  4. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  5. /**
  6. @file
  7. @author Trevor Irons
  8. @date 05/17/2012
  9. **/
  10. #include "KernelEM1DSpec.h"
  11. namespace Lemma {
  12. // ==================== SPECIALISATIONS ===============================
  13. ////////////////////////////////////////////////////////////////////////
  14. // GetBesselOrder
  15. /* TM INAIR INAIR */
  16. template <>
  17. int KernelEM1DSpec<TM, 0, INAIR, INAIR>::GetBesselOrder( ) {
  18. return 0;
  19. }
  20. template <>
  21. int KernelEM1DSpec<TM, 1, INAIR, INAIR>::GetBesselOrder( ) {
  22. return 1;
  23. }
  24. template <>
  25. int KernelEM1DSpec<TM, 2, INAIR, INAIR>::GetBesselOrder( ) {
  26. return 0;
  27. }
  28. template <>
  29. int KernelEM1DSpec<TM, 3, INAIR, INAIR>::GetBesselOrder( ) {
  30. return 1;
  31. }
  32. template <>
  33. int KernelEM1DSpec<TM, 4, INAIR, INAIR>::GetBesselOrder( ) {
  34. return 1;
  35. }
  36. template <>
  37. int KernelEM1DSpec<TM, 5, INAIR, INAIR>::GetBesselOrder( ) {
  38. return 0;
  39. }
  40. template <>
  41. int KernelEM1DSpec<TM, 6, INAIR, INAIR>::GetBesselOrder( ) {
  42. return 1;
  43. }
  44. template <>
  45. int KernelEM1DSpec<TM, 7, INAIR, INAIR>::GetBesselOrder( ) {
  46. return 0;
  47. }
  48. template <>
  49. int KernelEM1DSpec<TM, 8, INAIR, INAIR>::GetBesselOrder( ) {
  50. return 1;
  51. }
  52. template <>
  53. int KernelEM1DSpec<TM, 9, INAIR, INAIR>::GetBesselOrder( ) {
  54. return 1;
  55. }
  56. template <>
  57. int KernelEM1DSpec<TM, 10, INAIR, INAIR>::GetBesselOrder( ) {
  58. return 1;
  59. }
  60. template <>
  61. int KernelEM1DSpec<TM, 11, INAIR, INAIR>::GetBesselOrder( ) {
  62. return 0;
  63. }
  64. template <>
  65. int KernelEM1DSpec<TM, 12, INAIR, INAIR>::GetBesselOrder( ) {
  66. return 1;
  67. }
  68. /* TE INAIR INAIR */
  69. template <>
  70. int KernelEM1DSpec<TE, 0, INAIR, INAIR>::GetBesselOrder( ) {
  71. return 0;
  72. }
  73. template <>
  74. int KernelEM1DSpec<TE, 1, INAIR, INAIR>::GetBesselOrder( ) {
  75. return 1;
  76. }
  77. template <>
  78. int KernelEM1DSpec<TE, 2, INAIR, INAIR>::GetBesselOrder( ) {
  79. return 0;
  80. }
  81. template <>
  82. int KernelEM1DSpec<TE, 3, INAIR, INAIR>::GetBesselOrder( ) {
  83. return 1;
  84. }
  85. template <>
  86. int KernelEM1DSpec<TE, 4, INAIR, INAIR>::GetBesselOrder( ) {
  87. return 1;
  88. }
  89. template <>
  90. int KernelEM1DSpec<TE, 5, INAIR, INAIR>::GetBesselOrder( ) {
  91. return 0;
  92. }
  93. template <>
  94. int KernelEM1DSpec<TE, 6, INAIR, INAIR>::GetBesselOrder( ) {
  95. return 1;
  96. }
  97. template <>
  98. int KernelEM1DSpec<TE, 7, INAIR, INAIR>::GetBesselOrder( ) {
  99. return 0;
  100. }
  101. template <>
  102. int KernelEM1DSpec<TE, 8, INAIR, INAIR>::GetBesselOrder( ) {
  103. return 1;
  104. }
  105. template <>
  106. int KernelEM1DSpec<TE, 9, INAIR, INAIR>::GetBesselOrder( ) {
  107. return 1;
  108. }
  109. template <>
  110. int KernelEM1DSpec<TE, 10, INAIR, INAIR>::GetBesselOrder( ) {
  111. return 1;
  112. }
  113. template <>
  114. int KernelEM1DSpec<TE, 11, INAIR, INAIR>::GetBesselOrder( ) {
  115. return 0;
  116. }
  117. template <>
  118. int KernelEM1DSpec<TE, 12, INAIR, INAIR>::GetBesselOrder( ) {
  119. return 1;
  120. }
  121. /* TM INAIR INGROUND */
  122. template <>
  123. int KernelEM1DSpec<TM, 0, INAIR, INGROUND>::GetBesselOrder( ) {
  124. return 0;
  125. }
  126. template <>
  127. int KernelEM1DSpec<TM, 1, INAIR, INGROUND>::GetBesselOrder( ) {
  128. return 1;
  129. }
  130. template <>
  131. int KernelEM1DSpec<TM, 2, INAIR, INGROUND>::GetBesselOrder( ) {
  132. return 0;
  133. }
  134. template <>
  135. int KernelEM1DSpec<TM, 3, INAIR, INGROUND>::GetBesselOrder( ) {
  136. return 1;
  137. }
  138. template <>
  139. int KernelEM1DSpec<TM, 4, INAIR, INGROUND>::GetBesselOrder( ) {
  140. return 1;
  141. }
  142. template <>
  143. int KernelEM1DSpec<TM, 5, INAIR, INGROUND>::GetBesselOrder( ) {
  144. return 0;
  145. }
  146. template <>
  147. int KernelEM1DSpec<TM, 6, INAIR, INGROUND>::GetBesselOrder( ) {
  148. return 1;
  149. }
  150. template <>
  151. int KernelEM1DSpec<TM, 7, INAIR, INGROUND>::GetBesselOrder( ) {
  152. return 0;
  153. }
  154. template <>
  155. int KernelEM1DSpec<TM, 8, INAIR, INGROUND>::GetBesselOrder( ) {
  156. return 1;
  157. }
  158. template <>
  159. int KernelEM1DSpec<TM, 9, INAIR, INGROUND>::GetBesselOrder( ) {
  160. return 1;
  161. }
  162. template <>
  163. int KernelEM1DSpec<TM, 10, INAIR, INGROUND>::GetBesselOrder( ) {
  164. return 1;
  165. }
  166. template <>
  167. int KernelEM1DSpec<TM, 11, INAIR, INGROUND>::GetBesselOrder( ) {
  168. return 0;
  169. }
  170. template <>
  171. int KernelEM1DSpec<TM, 12, INAIR, INGROUND>::GetBesselOrder( ) {
  172. return 1;
  173. }
  174. /* TE INAIR INGROUND */
  175. template <>
  176. int KernelEM1DSpec<TE, 0, INAIR, INGROUND>::GetBesselOrder( ) {
  177. return 0;
  178. }
  179. template <>
  180. int KernelEM1DSpec<TE, 1, INAIR, INGROUND>::GetBesselOrder( ) {
  181. return 1;
  182. }
  183. template <>
  184. int KernelEM1DSpec<TE, 2, INAIR, INGROUND>::GetBesselOrder( ) {
  185. return 0;
  186. }
  187. template <>
  188. int KernelEM1DSpec<TE, 3, INAIR, INGROUND>::GetBesselOrder( ) {
  189. return 1;
  190. }
  191. template <>
  192. int KernelEM1DSpec<TE, 4, INAIR, INGROUND>::GetBesselOrder( ) {
  193. return 1;
  194. }
  195. template <>
  196. int KernelEM1DSpec<TE, 5, INAIR, INGROUND>::GetBesselOrder( ) {
  197. return 0;
  198. }
  199. template <>
  200. int KernelEM1DSpec<TE, 6, INAIR, INGROUND>::GetBesselOrder( ) {
  201. return 1;
  202. }
  203. template <>
  204. int KernelEM1DSpec<TE, 7, INAIR, INGROUND>::GetBesselOrder( ) {
  205. return 0;
  206. }
  207. template <>
  208. int KernelEM1DSpec<TE, 8, INAIR, INGROUND>::GetBesselOrder( ) {
  209. return 1;
  210. }
  211. template <>
  212. int KernelEM1DSpec<TE, 9, INAIR, INGROUND>::GetBesselOrder( ) {
  213. return 1;
  214. }
  215. template <>
  216. int KernelEM1DSpec<TE, 10, INAIR, INGROUND>::GetBesselOrder( ) {
  217. return 1;
  218. }
  219. template <>
  220. int KernelEM1DSpec<TE, 11, INAIR, INGROUND>::GetBesselOrder( ) {
  221. return 0;
  222. }
  223. template <>
  224. int KernelEM1DSpec<TE, 12, INAIR, INGROUND>::GetBesselOrder( ) {
  225. return 1;
  226. }
  227. /* TM INGROUND INAIR */
  228. template <>
  229. int KernelEM1DSpec<TM, 0, INGROUND, INAIR>::GetBesselOrder( ) {
  230. return 0;
  231. }
  232. template <>
  233. int KernelEM1DSpec<TM, 1, INGROUND, INAIR>::GetBesselOrder( ) {
  234. return 1;
  235. }
  236. template <>
  237. int KernelEM1DSpec<TM, 2, INGROUND, INAIR>::GetBesselOrder( ) {
  238. return 0;
  239. }
  240. template <>
  241. int KernelEM1DSpec<TM, 3, INGROUND, INAIR>::GetBesselOrder( ) {
  242. return 1;
  243. }
  244. template <>
  245. int KernelEM1DSpec<TM, 4, INGROUND, INAIR>::GetBesselOrder( ) {
  246. return 1;
  247. }
  248. template <>
  249. int KernelEM1DSpec<TM, 5, INGROUND, INAIR>::GetBesselOrder( ) {
  250. return 0;
  251. }
  252. template <>
  253. int KernelEM1DSpec<TM, 6, INGROUND, INAIR>::GetBesselOrder( ) {
  254. return 1;
  255. }
  256. template <>
  257. int KernelEM1DSpec<TM, 7, INGROUND, INAIR>::GetBesselOrder( ) {
  258. return 0;
  259. }
  260. template <>
  261. int KernelEM1DSpec<TM, 8, INGROUND, INAIR>::GetBesselOrder( ) {
  262. return 1;
  263. }
  264. template <>
  265. int KernelEM1DSpec<TM, 9, INGROUND, INAIR>::GetBesselOrder( ) {
  266. return 1;
  267. }
  268. template <>
  269. int KernelEM1DSpec<TM, 10, INGROUND, INAIR>::GetBesselOrder( ) {
  270. return 1;
  271. }
  272. template <>
  273. int KernelEM1DSpec<TM, 11, INGROUND, INAIR>::GetBesselOrder( ) {
  274. return 0;
  275. }
  276. template <>
  277. int KernelEM1DSpec<TM, 12, INGROUND, INAIR>::GetBesselOrder( ) {
  278. return 1;
  279. }
  280. /* TE INGROUND INAIR */
  281. template <>
  282. int KernelEM1DSpec<TE, 0, INGROUND, INAIR>::GetBesselOrder( ) {
  283. return 0;
  284. }
  285. template <>
  286. int KernelEM1DSpec<TE, 1, INGROUND, INAIR>::GetBesselOrder( ) {
  287. return 1;
  288. }
  289. template <>
  290. int KernelEM1DSpec<TE, 2, INGROUND, INAIR>::GetBesselOrder( ) {
  291. return 0;
  292. }
  293. template <>
  294. int KernelEM1DSpec<TE, 3, INGROUND, INAIR>::GetBesselOrder( ) {
  295. return 1;
  296. }
  297. template <>
  298. int KernelEM1DSpec<TE, 4, INGROUND, INAIR>::GetBesselOrder( ) {
  299. return 1;
  300. }
  301. template <>
  302. int KernelEM1DSpec<TE, 5, INGROUND, INAIR>::GetBesselOrder( ) {
  303. return 0;
  304. }
  305. template <>
  306. int KernelEM1DSpec<TE, 6, INGROUND, INAIR>::GetBesselOrder( ) {
  307. return 1;
  308. }
  309. template <>
  310. int KernelEM1DSpec<TE, 7, INGROUND, INAIR>::GetBesselOrder( ) {
  311. return 0;
  312. }
  313. template <>
  314. int KernelEM1DSpec<TE, 8, INGROUND, INAIR>::GetBesselOrder( ) {
  315. return 1;
  316. }
  317. template <>
  318. int KernelEM1DSpec<TE, 9, INGROUND, INAIR>::GetBesselOrder( ) {
  319. return 1;
  320. }
  321. template <>
  322. int KernelEM1DSpec<TE, 10, INGROUND, INAIR>::GetBesselOrder( ) {
  323. return 1;
  324. }
  325. template <>
  326. int KernelEM1DSpec<TE, 11, INGROUND, INAIR>::GetBesselOrder( ) {
  327. return 0;
  328. }
  329. template <>
  330. int KernelEM1DSpec<TE, 12, INGROUND, INAIR>::GetBesselOrder( ) {
  331. return 1;
  332. }
  333. /* TM INGROUND INGROUND */
  334. template <>
  335. int KernelEM1DSpec<TM, 0, INGROUND, INGROUND>::GetBesselOrder( ) {
  336. return 0;
  337. }
  338. template <>
  339. int KernelEM1DSpec<TM, 1, INGROUND, INGROUND>::GetBesselOrder( ) {
  340. return 1;
  341. }
  342. template <>
  343. int KernelEM1DSpec<TM, 2, INGROUND, INGROUND>::GetBesselOrder( ) {
  344. return 0;
  345. }
  346. template <>
  347. int KernelEM1DSpec<TM, 3, INGROUND, INGROUND>::GetBesselOrder( ) {
  348. return 1;
  349. }
  350. template <>
  351. int KernelEM1DSpec<TM, 4, INGROUND, INGROUND>::GetBesselOrder( ) {
  352. return 1;
  353. }
  354. template <>
  355. int KernelEM1DSpec<TM, 5, INGROUND, INGROUND>::GetBesselOrder( ) {
  356. return 0;
  357. }
  358. template <>
  359. int KernelEM1DSpec<TM, 6, INGROUND, INGROUND>::GetBesselOrder( ) {
  360. return 1;
  361. }
  362. template <>
  363. int KernelEM1DSpec<TM, 7, INGROUND, INGROUND>::GetBesselOrder( ) {
  364. return 0;
  365. }
  366. template <>
  367. int KernelEM1DSpec<TM, 8, INGROUND, INGROUND>::GetBesselOrder( ) {
  368. return 1;
  369. }
  370. template <>
  371. int KernelEM1DSpec<TM, 9, INGROUND, INGROUND>::GetBesselOrder( ) {
  372. return 1;
  373. }
  374. template <>
  375. int KernelEM1DSpec<TM, 10, INGROUND, INGROUND>::GetBesselOrder( ) {
  376. return 1;
  377. }
  378. template <>
  379. int KernelEM1DSpec<TM, 11, INGROUND, INGROUND>::GetBesselOrder( ) {
  380. return 0;
  381. }
  382. template <>
  383. int KernelEM1DSpec<TM, 12, INGROUND, INGROUND>::GetBesselOrder( ) {
  384. return 1;
  385. }
  386. /* TE INGROUND INGROUND */
  387. template <>
  388. int KernelEM1DSpec<TE, 0, INGROUND, INGROUND>::GetBesselOrder( ) {
  389. return 0;
  390. }
  391. template <>
  392. int KernelEM1DSpec<TE, 1, INGROUND, INGROUND>::GetBesselOrder( ) {
  393. return 1;
  394. }
  395. template <>
  396. int KernelEM1DSpec<TE, 2, INGROUND, INGROUND>::GetBesselOrder( ) {
  397. return 0;
  398. }
  399. template <>
  400. int KernelEM1DSpec<TE, 3, INGROUND, INGROUND>::GetBesselOrder( ) {
  401. return 1;
  402. }
  403. template <>
  404. int KernelEM1DSpec<TE, 4, INGROUND, INGROUND>::GetBesselOrder( ) {
  405. return 1;
  406. }
  407. template <>
  408. int KernelEM1DSpec<TE, 5, INGROUND, INGROUND>::GetBesselOrder( ) {
  409. return 0;
  410. }
  411. template <>
  412. int KernelEM1DSpec<TE, 6, INGROUND, INGROUND>::GetBesselOrder( ) {
  413. return 1;
  414. }
  415. template <>
  416. int KernelEM1DSpec<TE, 7, INGROUND, INGROUND>::GetBesselOrder( ) {
  417. return 0;
  418. }
  419. template <>
  420. int KernelEM1DSpec<TE, 8, INGROUND, INGROUND>::GetBesselOrder( ) {
  421. return 1;
  422. }
  423. template <>
  424. int KernelEM1DSpec<TE, 9, INGROUND, INGROUND>::GetBesselOrder( ) {
  425. return 1;
  426. }
  427. template <>
  428. int KernelEM1DSpec<TE, 10, INGROUND, INGROUND>::GetBesselOrder( ) {
  429. return 1;
  430. }
  431. template <>
  432. int KernelEM1DSpec<TE, 11, INGROUND, INGROUND>::GetBesselOrder( ) {
  433. return 0;
  434. }
  435. template <>
  436. int KernelEM1DSpec<TE, 12, INGROUND, INGROUND>::GetBesselOrder( ) {
  437. return 1;
  438. }
  439. ////////////////////////////////////////////////////////////////////////
  440. // BesselArg specialisations
  441. // TODO eradicate all ReflCalc->id terms, these should be hard coded
  442. /* TM INAIR INAIR */
  443. template <>
  444. Complex KernelEM1DSpec<TM, 0, INAIR, INAIR>::BesselArg( const Real& lambda ) {
  445. ReflCalc->ComputeReflectionCoeffs(lambda);
  446. ReflCalc->id = 4;
  447. return PotentialInSourceLayer(lambda)/ReflCalc->uk;
  448. }
  449. template <>
  450. Complex KernelEM1DSpec<TM, 0, INAIR, INAIR>::RelBesselArg( const Real& lambda ) {
  451. ReflCalc->id = 4;
  452. return RelPotentialInSourceLayer(lambda)/ReflCalc->uk;
  453. }
  454. template <>
  455. Complex KernelEM1DSpec<TM, 1, INAIR, INAIR>::BesselArg( const Real& lambda ) {
  456. ReflCalc->ComputeReflectionCoeffs(lambda);
  457. ReflCalc->id = 4;
  458. return PotentialInSourceLayer(1)/ReflCalc->uk;
  459. }
  460. template <>
  461. Complex KernelEM1DSpec<TM, 1, INAIR, INAIR>::RelBesselArg( const Real& lambda ) {
  462. ReflCalc->id = 4;
  463. return RelPotentialInSourceLayer(1)/ReflCalc->uk;
  464. }
  465. template <>
  466. Complex KernelEM1DSpec<TM, 2, INAIR, INAIR>::BesselArg(const Real& lambda ) {
  467. ReflCalc->ComputeReflectionCoeffs(lambda);
  468. ReflCalc->id = 1;
  469. return PotentialInSourceLayer(lambda)/ReflCalc->uk;
  470. }
  471. template <>
  472. Complex KernelEM1DSpec<TM, 2, INAIR, INAIR>::RelBesselArg(const Real& lambda ) {
  473. ReflCalc->id = 1;
  474. return RelPotentialInSourceLayer(lambda)/ReflCalc->uk;
  475. }
  476. template <>
  477. Complex KernelEM1DSpec<TM, 3, INAIR, INAIR>::BesselArg(const Real& lambda ) {
  478. ReflCalc->ComputeReflectionCoeffs(lambda);
  479. ReflCalc->id = 1;
  480. return PotentialInSourceLayer(1)/ReflCalc->uk;
  481. }
  482. template <>
  483. Complex KernelEM1DSpec<TM, 3, INAIR, INAIR>::RelBesselArg(const Real& lambda ) {
  484. ReflCalc->id = 1;
  485. return RelPotentialInSourceLayer(1)/ReflCalc->uk;
  486. }
  487. template <>
  488. Complex KernelEM1DSpec<TM, 4, INAIR, INAIR>::BesselArg(const Real& lambda ) {
  489. ReflCalc->ComputeReflectionCoeffs(lambda);
  490. ReflCalc->id = 3;
  491. return PotentialInSourceLayer(ReflCalc->rams)/ReflCalc->uk;
  492. }
  493. template <>
  494. Complex KernelEM1DSpec<TM, 4, INAIR, INAIR>::RelBesselArg(const Real& lambda ) {
  495. ReflCalc->id = 3;
  496. return RelPotentialInSourceLayer(ReflCalc->rams)/ReflCalc->uk;
  497. }
  498. template <>
  499. Complex KernelEM1DSpec<TM, 5, INAIR, INAIR>::BesselArg(const Real& lambda ) {
  500. ReflCalc->ComputeReflectionCoeffs(lambda);
  501. ReflCalc->id = 3;
  502. return PotentialInSourceLayer(lambda)/ReflCalc->uk;
  503. }
  504. template <>
  505. Complex KernelEM1DSpec<TM, 5, INAIR, INAIR>::RelBesselArg(const Real& lambda ) {
  506. ReflCalc->id = 3;
  507. return RelPotentialInSourceLayer(lambda)/ReflCalc->uk;
  508. }
  509. template <>
  510. Complex KernelEM1DSpec<TM, 6, INAIR, INAIR>::BesselArg(const Real& lambda ) {
  511. ReflCalc->ComputeReflectionCoeffs(lambda);
  512. ReflCalc->id = 3;
  513. return PotentialInSourceLayer(1)/ReflCalc->uk;
  514. }
  515. template <>
  516. Complex KernelEM1DSpec<TM, 6, INAIR, INAIR>::RelBesselArg(const Real& lambda ) {
  517. ReflCalc->id = 3;
  518. return RelPotentialInSourceLayer(1)/ReflCalc->uk;
  519. }
  520. template <>
  521. Complex KernelEM1DSpec<TM, 7, INAIR, INAIR>::BesselArg(const Real& lambda ) {
  522. ReflCalc->ComputeReflectionCoeffs(lambda);
  523. ReflCalc->id = 2;
  524. return PotentialInSourceLayer(lambda)/ReflCalc->uk;
  525. }
  526. template <>
  527. Complex KernelEM1DSpec<TM, 7, INAIR, INAIR>::RelBesselArg(const Real& lambda ) {
  528. ReflCalc->id = 2;
  529. return RelPotentialInSourceLayer(lambda)/ReflCalc->uk;
  530. }
  531. template <>
  532. Complex KernelEM1DSpec<TM, 8, INAIR, INAIR>::BesselArg(const Real& lambda ) {
  533. ReflCalc->ComputeReflectionCoeffs(lambda);
  534. ReflCalc->id = 2;
  535. return PotentialInSourceLayer(1)/ReflCalc->uk;
  536. }
  537. template <>
  538. Complex KernelEM1DSpec<TM, 8, INAIR, INAIR>::RelBesselArg(const Real& lambda ) {
  539. ReflCalc->id = 2;
  540. return RelPotentialInSourceLayer(1)/ReflCalc->uk;
  541. }
  542. template <>
  543. Complex KernelEM1DSpec<TM, 9, INAIR, INAIR>::BesselArg(const Real& lambda ) {
  544. ReflCalc->ComputeReflectionCoeffs(lambda);
  545. ReflCalc->id = 1;
  546. return PotentialInSourceLayer(ReflCalc->rams)/ReflCalc->uk;
  547. }
  548. template <>
  549. Complex KernelEM1DSpec<TM, 9, INAIR, INAIR>::RelBesselArg(const Real& lambda ) {
  550. ReflCalc->id = 1;
  551. return RelPotentialInSourceLayer(ReflCalc->rams)/ReflCalc->uk;
  552. }
  553. template <>
  554. Complex KernelEM1DSpec<TM, 10, INAIR, INAIR>::BesselArg(const Real& lambda ) {
  555. ReflCalc->ComputeReflectionCoeffs(lambda);
  556. ReflCalc->id = 2;
  557. return PotentialInSourceLayer(ReflCalc->rams)/ReflCalc->uk;
  558. }
  559. template <>
  560. Complex KernelEM1DSpec<TM, 10, INAIR, INAIR>::RelBesselArg(const Real& lambda ) {
  561. ReflCalc->id = 2;
  562. return RelPotentialInSourceLayer(ReflCalc->rams)/ReflCalc->uk;
  563. }
  564. template <>
  565. Complex KernelEM1DSpec<TM, 11, INAIR, INAIR>::BesselArg(const Real& lambda ) {
  566. ReflCalc->ComputeReflectionCoeffs(lambda);
  567. ReflCalc->id = 1;
  568. return PotentialInSourceLayer(lambda*ReflCalc->rams)/ReflCalc->uk;
  569. }
  570. template <>
  571. Complex KernelEM1DSpec<TM, 11, INAIR, INAIR>::RelBesselArg(const Real& lambda ) {
  572. ReflCalc->id = 1;
  573. return RelPotentialInSourceLayer(lambda*ReflCalc->rams)/ReflCalc->uk;
  574. }
  575. template <>
  576. Complex KernelEM1DSpec<TM, 12, INAIR, INAIR>::BesselArg(const Real& lambda ) {
  577. ReflCalc->ComputeReflectionCoeffs(lambda);
  578. ReflCalc->id = 1;
  579. return PotentialInSourceLayer(ReflCalc->rams)/ReflCalc->uk;
  580. }
  581. template <>
  582. Complex KernelEM1DSpec<TM, 12, INAIR, INAIR>::RelBesselArg(const Real& lambda ) {
  583. ReflCalc->id = 1;
  584. return RelPotentialInSourceLayer(ReflCalc->rams)/ReflCalc->uk;
  585. }
  586. /* TE INAIR INAIR */
  587. template <>
  588. Complex KernelEM1DSpec<TE, 0, INAIR, INAIR>::BesselArg(const Real& lambda ) {
  589. ReflCalc->ComputeReflectionCoeffs(lambda);
  590. ReflCalc->id = 4;
  591. return PotentialInSourceLayer(lambda)/ReflCalc->uk;
  592. }
  593. template <>
  594. Complex KernelEM1DSpec<TE, 0, INAIR, INAIR>::RelBesselArg(const Real& lambda ) {
  595. ReflCalc->id = 4;
  596. return RelPotentialInSourceLayer(lambda)/ReflCalc->uk;
  597. }
  598. template <>
  599. Complex KernelEM1DSpec<TE, 1, INAIR, INAIR>::BesselArg(const Real& lambda ) {
  600. ReflCalc->ComputeReflectionCoeffs(lambda);
  601. ReflCalc->id = 4;
  602. return PotentialInSourceLayer(1)/ReflCalc->uk;
  603. }
  604. template <>
  605. Complex KernelEM1DSpec<TE, 1, INAIR, INAIR>::RelBesselArg(const Real& lambda ) {
  606. ReflCalc->id = 4;
  607. return RelPotentialInSourceLayer(1)/ReflCalc->uk;
  608. }
  609. template <>
  610. Complex KernelEM1DSpec<TE, 2, INAIR, INAIR>::BesselArg(const Real& lambda ) {
  611. ReflCalc->ComputeReflectionCoeffs(lambda);
  612. ReflCalc->id = 1;
  613. return PotentialInSourceLayer(lambda)/ReflCalc->uk;
  614. }
  615. template <>
  616. Complex KernelEM1DSpec<TE, 2, INAIR, INAIR>::RelBesselArg(const Real& lambda ) {
  617. ReflCalc->id = 1;
  618. return RelPotentialInSourceLayer(lambda)/ReflCalc->uk;
  619. }
  620. template <>
  621. Complex KernelEM1DSpec<TE, 3, INAIR, INAIR>::BesselArg(const Real& lambda ) {
  622. ReflCalc->ComputeReflectionCoeffs(lambda);
  623. ReflCalc->id = 1;
  624. return PotentialInSourceLayer(1)/ReflCalc->uk;
  625. }
  626. template <>
  627. Complex KernelEM1DSpec<TE, 3, INAIR, INAIR>::RelBesselArg(const Real& lambda ) {
  628. ReflCalc->id = 1;
  629. return RelPotentialInSourceLayer(1)/ReflCalc->uk;
  630. }
  631. template <>
  632. Complex KernelEM1DSpec<TE, 4, INAIR, INAIR>::BesselArg(const Real& lambda ) {
  633. ReflCalc->ComputeReflectionCoeffs(lambda);
  634. ReflCalc->id = 3;
  635. return PotentialInSourceLayer(ReflCalc->rams)/ReflCalc->uk;
  636. }
  637. template <>
  638. Complex KernelEM1DSpec<TE, 4, INAIR, INAIR>::RelBesselArg(const Real& lambda ) {
  639. ReflCalc->id = 3;
  640. return RelPotentialInSourceLayer(ReflCalc->rams)/ReflCalc->uk;
  641. }
  642. template <>
  643. Complex KernelEM1DSpec<TE, 5, INAIR, INAIR>::BesselArg(const Real& lambda ) {
  644. ReflCalc->ComputeReflectionCoeffs(lambda);
  645. ReflCalc->id = 3;
  646. return PotentialInSourceLayer(lambda)/ReflCalc->uk;
  647. }
  648. template <>
  649. Complex KernelEM1DSpec<TE, 5, INAIR, INAIR>::RelBesselArg(const Real& lambda ) {
  650. ReflCalc->id = 3;
  651. return RelPotentialInSourceLayer(lambda)/ReflCalc->uk;
  652. }
  653. template <>
  654. Complex KernelEM1DSpec<TE, 6, INAIR, INAIR>::BesselArg(const Real& lambda ) {
  655. ReflCalc->ComputeReflectionCoeffs(lambda);
  656. ReflCalc->id = 3;
  657. return PotentialInSourceLayer(1)/ReflCalc->uk;
  658. }
  659. template <>
  660. Complex KernelEM1DSpec<TE, 6, INAIR, INAIR>::RelBesselArg(const Real& lambda ) {
  661. ReflCalc->id = 3;
  662. return RelPotentialInSourceLayer(1)/ReflCalc->uk;
  663. }
  664. template <>
  665. Complex KernelEM1DSpec<TE, 7, INAIR, INAIR>::BesselArg(const Real& lambda ) {
  666. ReflCalc->ComputeReflectionCoeffs(lambda);
  667. ReflCalc->id = 2;
  668. return PotentialInSourceLayer(lambda)/ReflCalc->uk;
  669. }
  670. template <>
  671. Complex KernelEM1DSpec<TE, 7, INAIR, INAIR>::RelBesselArg(const Real& lambda ) {
  672. ReflCalc->id = 2;
  673. return RelPotentialInSourceLayer(lambda)/ReflCalc->uk;
  674. }
  675. template <>
  676. Complex KernelEM1DSpec<TE, 8, INAIR, INAIR>::BesselArg(const Real& lambda ) {
  677. ReflCalc->ComputeReflectionCoeffs(lambda);
  678. ReflCalc->id = 2;
  679. return PotentialInSourceLayer(1)/ReflCalc->uk;
  680. }
  681. template <>
  682. Complex KernelEM1DSpec<TE, 8, INAIR, INAIR>::RelBesselArg(const Real& lambda ) {
  683. ReflCalc->id = 2;
  684. return RelPotentialInSourceLayer(1)/ReflCalc->uk;
  685. }
  686. template <>
  687. Complex KernelEM1DSpec<TE, 9, INAIR, INAIR>::BesselArg(const Real& lambda ) {
  688. ReflCalc->ComputeReflectionCoeffs(lambda);
  689. ReflCalc->id = 1;
  690. return PotentialInSourceLayer(ReflCalc->rams)/ReflCalc->uk;
  691. }
  692. template <>
  693. Complex KernelEM1DSpec<TE, 9, INAIR, INAIR>::RelBesselArg(const Real& lambda ) {
  694. ReflCalc->id = 1;
  695. return RelPotentialInSourceLayer(ReflCalc->rams)/ReflCalc->uk;
  696. }
  697. template <>
  698. Complex KernelEM1DSpec<TE, 10, INAIR, INAIR>::BesselArg(const Real& lambda ) {
  699. ReflCalc->ComputeReflectionCoeffs(lambda);
  700. ReflCalc->id = 2;
  701. return PotentialInSourceLayer(ReflCalc->rams)/ReflCalc->uk;
  702. }
  703. template <>
  704. Complex KernelEM1DSpec<TE, 10, INAIR, INAIR>::RelBesselArg(const Real& lambda ) {
  705. ReflCalc->id = 2;
  706. return RelPotentialInSourceLayer(ReflCalc->rams)/ReflCalc->uk;
  707. }
  708. template <>
  709. Complex KernelEM1DSpec<TE, 11, INAIR, INAIR>::BesselArg(const Real& lambda ) {
  710. ReflCalc->ComputeReflectionCoeffs(lambda);
  711. ReflCalc->id = 1;
  712. return PotentialInSourceLayer(lambda*ReflCalc->rams)/ReflCalc->uk;
  713. }
  714. template <>
  715. Complex KernelEM1DSpec<TE, 11, INAIR, INAIR>::RelBesselArg(const Real& lambda ) {
  716. ReflCalc->id = 1;
  717. return RelPotentialInSourceLayer(lambda*ReflCalc->rams)/ReflCalc->uk;
  718. }
  719. template <>
  720. Complex KernelEM1DSpec<TE, 12, INAIR, INAIR>::BesselArg(const Real& lambda ) {
  721. ReflCalc->ComputeReflectionCoeffs(lambda);
  722. ReflCalc->id = 1;
  723. return PotentialInSourceLayer(ReflCalc->rams)/ReflCalc->uk;
  724. }
  725. template <>
  726. Complex KernelEM1DSpec<TE, 12, INAIR, INAIR>::RelBesselArg(const Real& lambda ) {
  727. ReflCalc->id = 1;
  728. return RelPotentialInSourceLayer(ReflCalc->rams)/ReflCalc->uk;
  729. }
  730. /* TM INAIR INGROUND */
  731. template <>
  732. Complex KernelEM1DSpec<TM, 0, INAIR, INGROUND>::BesselArg(const Real& lambda ) {
  733. ReflCalc->ComputeReflectionCoeffs(lambda);
  734. ReflCalc->id = 4;
  735. return PotentialBelowSourceLayer(lambda)/ReflCalc->uk;
  736. }
  737. template <>
  738. Complex KernelEM1DSpec<TM, 0, INAIR, INGROUND>::RelBesselArg(const Real& lambda ) {
  739. ReflCalc->id = 4;
  740. return RelPotentialBelowSourceLayer(lambda)/ReflCalc->uk;
  741. }
  742. template <>
  743. Complex KernelEM1DSpec<TM, 1, INAIR, INGROUND>::BesselArg(const Real& lambda ) {
  744. ReflCalc->ComputeReflectionCoeffs(lambda);
  745. ReflCalc->id = 4;
  746. return PotentialBelowSourceLayer(1)/ReflCalc->uk;
  747. }
  748. template <>
  749. Complex KernelEM1DSpec<TM, 1, INAIR, INGROUND>::RelBesselArg(const Real& lambda ) {
  750. ReflCalc->id = 4;
  751. return RelPotentialBelowSourceLayer(1)/ReflCalc->uk;
  752. }
  753. template <>
  754. Complex KernelEM1DSpec<TM, 2, INAIR, INGROUND>::BesselArg(const Real& lambda ) {
  755. ReflCalc->ComputeReflectionCoeffs(lambda);
  756. ReflCalc->id = 1;
  757. return PotentialBelowSourceLayer(lambda)/ReflCalc->uk;
  758. }
  759. template <>
  760. Complex KernelEM1DSpec<TM, 2, INAIR, INGROUND>::RelBesselArg(const Real& lambda ) {
  761. ReflCalc->id = 1;
  762. return RelPotentialBelowSourceLayer(lambda)/ReflCalc->uk;
  763. }
  764. template <>
  765. Complex KernelEM1DSpec<TM, 3, INAIR, INGROUND>::BesselArg(const Real& lambda ) {
  766. ReflCalc->ComputeReflectionCoeffs(lambda);
  767. ReflCalc->id = 1;
  768. return PotentialBelowSourceLayer(1)/ReflCalc->uk;
  769. }
  770. template <>
  771. Complex KernelEM1DSpec<TM, 3, INAIR, INGROUND>::RelBesselArg(const Real& lambda ) {
  772. ReflCalc->id = 1;
  773. return RelPotentialBelowSourceLayer(1)/ReflCalc->uk;
  774. }
  775. template <>
  776. Complex KernelEM1DSpec<TM, 4, INAIR, INGROUND>::BesselArg(const Real& lambda ) {
  777. ReflCalc->ComputeReflectionCoeffs(lambda);
  778. ReflCalc->id = 3;
  779. return PotentialBelowSourceLayer(ReflCalc->rams)/ReflCalc->uk;
  780. }
  781. template <>
  782. Complex KernelEM1DSpec<TM, 4, INAIR, INGROUND>::RelBesselArg(const Real& lambda ) {
  783. ReflCalc->id = 3;
  784. return RelPotentialBelowSourceLayer(ReflCalc->rams)/ReflCalc->uk;
  785. }
  786. template <>
  787. Complex KernelEM1DSpec<TM, 5, INAIR, INGROUND>::BesselArg(const Real& lambda ) {
  788. ReflCalc->ComputeReflectionCoeffs(lambda);
  789. ReflCalc->id = 3;
  790. return PotentialBelowSourceLayer(lambda)/ReflCalc->uk;
  791. }
  792. template <>
  793. Complex KernelEM1DSpec<TM, 5, INAIR, INGROUND>::RelBesselArg(const Real& lambda ) {
  794. ReflCalc->id = 3;
  795. return RelPotentialBelowSourceLayer(lambda)/ReflCalc->uk;
  796. }
  797. template <>
  798. Complex KernelEM1DSpec<TM, 6, INAIR, INGROUND>::BesselArg(const Real& lambda ) {
  799. ReflCalc->ComputeReflectionCoeffs(lambda);
  800. ReflCalc->id = 3;
  801. return PotentialBelowSourceLayer(1)/ReflCalc->uk;
  802. }
  803. template <>
  804. Complex KernelEM1DSpec<TM, 6, INAIR, INGROUND>::RelBesselArg(const Real& lambda ) {
  805. ReflCalc->id = 3;
  806. return RelPotentialBelowSourceLayer(1)/ReflCalc->uk;
  807. }
  808. template <>
  809. Complex KernelEM1DSpec<TM, 7, INAIR, INGROUND>::BesselArg(const Real& lambda ) {
  810. ReflCalc->ComputeReflectionCoeffs(lambda);
  811. ReflCalc->id = 2;
  812. return PotentialBelowSourceLayer(lambda)/ReflCalc->uk;
  813. }
  814. template <>
  815. Complex KernelEM1DSpec<TM, 7, INAIR, INGROUND>::RelBesselArg(const Real& lambda ) {
  816. ReflCalc->id = 2;
  817. return RelPotentialBelowSourceLayer(lambda)/ReflCalc->uk;
  818. }
  819. template <>
  820. Complex KernelEM1DSpec<TM, 8, INAIR, INGROUND>::BesselArg(const Real& lambda ) {
  821. ReflCalc->ComputeReflectionCoeffs(lambda);
  822. ReflCalc->id = 2;
  823. return PotentialBelowSourceLayer(1)/ReflCalc->uk;
  824. }
  825. template <>
  826. Complex KernelEM1DSpec<TM, 8, INAIR, INGROUND>::RelBesselArg(const Real& lambda ) {
  827. ReflCalc->id = 2;
  828. return RelPotentialBelowSourceLayer(1)/ReflCalc->uk;
  829. }
  830. template <>
  831. Complex KernelEM1DSpec<TM, 9, INAIR, INGROUND>::BesselArg(const Real& lambda ) {
  832. ReflCalc->ComputeReflectionCoeffs(lambda);
  833. ReflCalc->id = 1;
  834. return PotentialBelowSourceLayer(ReflCalc->rams)/ReflCalc->uk;
  835. }
  836. template <>
  837. Complex KernelEM1DSpec<TM, 9, INAIR, INGROUND>::RelBesselArg(const Real& lambda ) {
  838. ReflCalc->id = 1;
  839. return RelPotentialBelowSourceLayer(ReflCalc->rams)/ReflCalc->uk;
  840. }
  841. template <>
  842. Complex KernelEM1DSpec<TM, 10, INAIR, INGROUND>::BesselArg(const Real& lambda ) {
  843. ReflCalc->ComputeReflectionCoeffs(lambda);
  844. ReflCalc->id = 2;
  845. return PotentialBelowSourceLayer(ReflCalc->rams)/ReflCalc->uk;
  846. }
  847. template <>
  848. Complex KernelEM1DSpec<TM, 10, INAIR, INGROUND>::RelBesselArg(const Real& lambda ) {
  849. ReflCalc->id = 2;
  850. return RelPotentialBelowSourceLayer(ReflCalc->rams)/ReflCalc->uk;
  851. }
  852. template <>
  853. Complex KernelEM1DSpec<TM, 11, INAIR, INGROUND>::BesselArg(const Real& lambda ) {
  854. ReflCalc->ComputeReflectionCoeffs(lambda);
  855. ReflCalc->id = 1;
  856. return PotentialBelowSourceLayer(lambda*ReflCalc->rams)/ReflCalc->uk;
  857. }
  858. template <>
  859. Complex KernelEM1DSpec<TM, 11, INAIR, INGROUND>::RelBesselArg(const Real& lambda ) {
  860. ReflCalc->id = 1;
  861. return RelPotentialBelowSourceLayer(lambda*ReflCalc->rams)/ReflCalc->uk;
  862. }
  863. template <>
  864. Complex KernelEM1DSpec<TM, 12, INAIR, INGROUND>::BesselArg(const Real& lambda ) {
  865. ReflCalc->ComputeReflectionCoeffs(lambda);
  866. ReflCalc->id = 1;
  867. return PotentialBelowSourceLayer(ReflCalc->rams)/ReflCalc->uk;
  868. }
  869. template <>
  870. Complex KernelEM1DSpec<TM, 12, INAIR, INGROUND>::RelBesselArg(const Real& lambda ) {
  871. ReflCalc->id = 1;
  872. return RelPotentialBelowSourceLayer(ReflCalc->rams)/ReflCalc->uk;
  873. }
  874. /* TE INAIR INGROUND */
  875. template <>
  876. Complex KernelEM1DSpec<TE, 0, INAIR, INGROUND>::BesselArg(const Real& lambda ) {
  877. ReflCalc->ComputeReflectionCoeffs(lambda);
  878. ReflCalc->id = 4;
  879. return PotentialBelowSourceLayer(lambda)/ReflCalc->uk;
  880. }
  881. template <>
  882. Complex KernelEM1DSpec<TE, 0, INAIR, INGROUND>::RelBesselArg(const Real& lambda ) {
  883. ReflCalc->id = 4;
  884. return RelPotentialBelowSourceLayer(lambda)/ReflCalc->uk;
  885. }
  886. template <>
  887. Complex KernelEM1DSpec<TE, 1, INAIR, INGROUND>::BesselArg(const Real& lambda ) {
  888. ReflCalc->ComputeReflectionCoeffs(lambda);
  889. ReflCalc->id = 4;
  890. return PotentialBelowSourceLayer(1)/ReflCalc->uk;
  891. }
  892. template <>
  893. Complex KernelEM1DSpec<TE, 1, INAIR, INGROUND>::RelBesselArg(const Real& lambda ) {
  894. ReflCalc->id = 4;
  895. return RelPotentialBelowSourceLayer(1)/ReflCalc->uk;
  896. }
  897. template <>
  898. Complex KernelEM1DSpec<TE, 2, INAIR, INGROUND>::BesselArg(const Real& lambda ) {
  899. ReflCalc->ComputeReflectionCoeffs(lambda);
  900. ReflCalc->id = 1;
  901. return PotentialBelowSourceLayer(lambda)/ReflCalc->uk;
  902. }
  903. template <>
  904. Complex KernelEM1DSpec<TE, 2, INAIR, INGROUND>::RelBesselArg(const Real& lambda ) {
  905. ReflCalc->id = 1;
  906. return RelPotentialBelowSourceLayer(lambda)/ReflCalc->uk;
  907. }
  908. template <>
  909. Complex KernelEM1DSpec<TE, 3, INAIR, INGROUND>::BesselArg(const Real& lambda ) {
  910. ReflCalc->ComputeReflectionCoeffs(lambda);
  911. ReflCalc->id = 1;
  912. return PotentialBelowSourceLayer(1)/ReflCalc->uk;
  913. }
  914. template <>
  915. Complex KernelEM1DSpec<TE, 3, INAIR, INGROUND>::RelBesselArg(const Real& lambda ) {
  916. ReflCalc->id = 1;
  917. return RelPotentialBelowSourceLayer(1)/ReflCalc->uk;
  918. }
  919. template <>
  920. Complex KernelEM1DSpec<TE, 4, INAIR, INGROUND>::BesselArg(const Real& lambda ) {
  921. ReflCalc->ComputeReflectionCoeffs(lambda);
  922. ReflCalc->id = 3;
  923. return PotentialBelowSourceLayer(ReflCalc->rams)/ReflCalc->uk;
  924. }
  925. template <>
  926. Complex KernelEM1DSpec<TE, 4, INAIR, INGROUND>::RelBesselArg(const Real& lambda ) {
  927. ReflCalc->id = 3;
  928. return RelPotentialBelowSourceLayer(ReflCalc->rams)/ReflCalc->uk;
  929. }
  930. template <>
  931. Complex KernelEM1DSpec<TE, 5, INAIR, INGROUND>::BesselArg(const Real& lambda ) {
  932. ReflCalc->ComputeReflectionCoeffs(lambda);
  933. ReflCalc->id = 3;
  934. return PotentialBelowSourceLayer(lambda)/ReflCalc->uk;
  935. }
  936. template <>
  937. Complex KernelEM1DSpec<TE, 5, INAIR, INGROUND>::RelBesselArg(const Real& lambda ) {
  938. ReflCalc->id = 3;
  939. return RelPotentialBelowSourceLayer(lambda)/ReflCalc->uk;
  940. }
  941. template <>
  942. Complex KernelEM1DSpec<TE, 6, INAIR, INGROUND>::BesselArg(const Real& lambda ) {
  943. ReflCalc->ComputeReflectionCoeffs(lambda);
  944. ReflCalc->id = 3;
  945. return PotentialBelowSourceLayer(1)/ReflCalc->uk;
  946. }
  947. template <>
  948. Complex KernelEM1DSpec<TE, 6, INAIR, INGROUND>::RelBesselArg(const Real& lambda ) {
  949. ReflCalc->id = 3;
  950. return RelPotentialBelowSourceLayer(1)/ReflCalc->uk;
  951. }
  952. template <>
  953. Complex KernelEM1DSpec<TE, 7, INAIR, INGROUND>::BesselArg(const Real& lambda ) {
  954. ReflCalc->ComputeReflectionCoeffs(lambda);
  955. ReflCalc->id = 2;
  956. return PotentialBelowSourceLayer(lambda)/ReflCalc->uk;
  957. }
  958. template <>
  959. Complex KernelEM1DSpec<TE, 7, INAIR, INGROUND>::RelBesselArg(const Real& lambda ) {
  960. ReflCalc->id = 2;
  961. return RelPotentialBelowSourceLayer(lambda)/ReflCalc->uk;
  962. }
  963. template <>
  964. Complex KernelEM1DSpec<TE, 8, INAIR, INGROUND>::BesselArg(const Real& lambda ) {
  965. ReflCalc->ComputeReflectionCoeffs(lambda);
  966. ReflCalc->id = 2;
  967. return PotentialBelowSourceLayer(1)/ReflCalc->uk;
  968. }
  969. template <>
  970. Complex KernelEM1DSpec<TE, 8, INAIR, INGROUND>::RelBesselArg(const Real& lambda ) {
  971. ReflCalc->id = 2;
  972. return RelPotentialBelowSourceLayer(1)/ReflCalc->uk;
  973. }
  974. template <>
  975. Complex KernelEM1DSpec<TE, 9, INAIR, INGROUND>::BesselArg(const Real& lambda ) {
  976. ReflCalc->ComputeReflectionCoeffs(lambda);
  977. ReflCalc->id = 1;
  978. return PotentialBelowSourceLayer(ReflCalc->rams)/ReflCalc->uk;
  979. }
  980. template <>
  981. Complex KernelEM1DSpec<TE, 9, INAIR, INGROUND>::RelBesselArg(const Real& lambda ) {
  982. ReflCalc->id = 1;
  983. return RelPotentialBelowSourceLayer(ReflCalc->rams)/ReflCalc->uk;
  984. }
  985. template <>
  986. Complex KernelEM1DSpec<TE, 10, INAIR, INGROUND>::BesselArg(const Real& lambda ) {
  987. ReflCalc->ComputeReflectionCoeffs(lambda);
  988. ReflCalc->id = 2;
  989. return PotentialBelowSourceLayer(ReflCalc->rams)/ReflCalc->uk;
  990. }
  991. template <>
  992. Complex KernelEM1DSpec<TE, 10, INAIR, INGROUND>::RelBesselArg(const Real& lambda ) {
  993. ReflCalc->id = 2;
  994. return RelPotentialBelowSourceLayer(ReflCalc->rams)/ReflCalc->uk;
  995. }
  996. template <>
  997. Complex KernelEM1DSpec<TE, 11, INAIR, INGROUND>::BesselArg(const Real& lambda ) {
  998. ReflCalc->ComputeReflectionCoeffs(lambda);
  999. ReflCalc->id = 1;
  1000. return PotentialBelowSourceLayer(lambda*ReflCalc->rams)/ReflCalc->uk;
  1001. }
  1002. template <>
  1003. Complex KernelEM1DSpec<TE, 11, INAIR, INGROUND>::RelBesselArg(const Real& lambda ) {
  1004. ReflCalc->id = 1;
  1005. return RelPotentialBelowSourceLayer(lambda*ReflCalc->rams)/ReflCalc->uk;
  1006. }
  1007. template <>
  1008. Complex KernelEM1DSpec<TE, 12, INAIR, INGROUND>::BesselArg(const Real& lambda ) {
  1009. ReflCalc->ComputeReflectionCoeffs(lambda);
  1010. ReflCalc->id = 1;
  1011. return PotentialBelowSourceLayer(ReflCalc->rams)/ReflCalc->uk;
  1012. }
  1013. template <>
  1014. Complex KernelEM1DSpec<TE, 12, INAIR, INGROUND>::RelBesselArg(const Real& lambda) {
  1015. ReflCalc->id = 1;
  1016. return RelPotentialBelowSourceLayer(ReflCalc->rams)/ReflCalc->uk;
  1017. }
  1018. ////////////////////////////////////////////////////////////////////////
  1019. // Potential terms
  1020. // TODO the following could be precomputed in PotentialInSourceLayer: adz,
  1021. // iud, and con *before* source term.
  1022. template <>
  1023. Complex KernelEM1DSpec<TM, 0, INAIR, INAIR>::PotentialInSourceLayer(const Real &ra) {
  1024. int iud(0);
  1025. if (ReflCalc->rx_z <= ReflCalc->tx_z) iud=1;
  1026. Real adz = std::abs(ReflCalc->rx_z-ReflCalc->tx_z);
  1027. Complex con = ReflCalc->rtd(0)*std::exp(ReflCalc->u(0)*(ReflCalc->rx_z+ReflCalc->tx_z));
  1028. // Add singular term (source term)
  1029. con += SS_SL(3, iud)*std::exp(-ReflCalc->uk*adz);
  1030. return ra*ReflCalc->uk*ReflCalc->uk*con;
  1031. }
  1032. template <>
  1033. Complex KernelEM1DSpec<TM, 0, INAIR, INAIR>::RelPotentialInSourceLayer(const Real &ra) {
  1034. Complex con = ReflCalc->relCon + SS_SL(3, ReflCalc->relIud)*ReflCalc->relenukadz;
  1035. return ra*ReflCalc->uk*ReflCalc->uk*con;
  1036. }
  1037. template <>
  1038. Complex KernelEM1DSpec<TM, 1, INAIR, INAIR>::PotentialInSourceLayer(const Real &ra) {
  1039. int iud(0);
  1040. if (ReflCalc->rx_z <= ReflCalc->tx_z) iud=1;
  1041. Real adz = std::abs(ReflCalc->rx_z-ReflCalc->tx_z);
  1042. Complex con = ReflCalc->rtd(0)*std::exp(ReflCalc->u(0)*(ReflCalc->rx_z+ReflCalc->tx_z));
  1043. // Add singular term (source term)
  1044. con += SS_SL(3, iud)*std::exp(-ReflCalc->uk*adz);
  1045. return ra*ReflCalc->uk*ReflCalc->uk*con;
  1046. }
  1047. template <>
  1048. Complex KernelEM1DSpec<TM, 1, INAIR, INAIR>::RelPotentialInSourceLayer(const Real &ra) {
  1049. Complex con = ReflCalc->relCon + SS_SL(3, ReflCalc->relIud)*ReflCalc->relenukadz;
  1050. return ra*ReflCalc->uk*ReflCalc->uk*con;
  1051. }
  1052. template <>
  1053. Complex KernelEM1DSpec<TM, 2, INAIR, INAIR>::PotentialInSourceLayer(const Real &ra) {
  1054. int iud(0);
  1055. if (ReflCalc->rx_z <= ReflCalc->tx_z) iud=1;
  1056. Real adz = std::abs(ReflCalc->rx_z-ReflCalc->tx_z);
  1057. Complex con = ReflCalc->rtd(0)*std::exp(ReflCalc->u(0)*(ReflCalc->rx_z+ReflCalc->tx_z));
  1058. // Add singular term (source term)
  1059. con += SS_SL(0, iud)*std::exp(-ReflCalc->uk*adz);
  1060. return ra*con;
  1061. }
  1062. template <>
  1063. Complex KernelEM1DSpec<TM, 2, INAIR, INAIR>::RelPotentialInSourceLayer(const Real &ra) {
  1064. Complex con = ReflCalc->relCon + SS_SL(0, ReflCalc->relIud)*ReflCalc->relenukadz;
  1065. return ra*con;
  1066. }
  1067. template <>
  1068. Complex KernelEM1DSpec<TM, 3, INAIR, INAIR>::PotentialInSourceLayer(const Real &ra) {
  1069. int iud(0);
  1070. if (ReflCalc->rx_z <= ReflCalc->tx_z) iud=1;
  1071. Real adz = std::abs(ReflCalc->rx_z-ReflCalc->tx_z);
  1072. Complex con = ReflCalc->rtd(0)*std::exp(ReflCalc->u(0)*(ReflCalc->rx_z+ReflCalc->tx_z));
  1073. // Add singular term (source term)
  1074. con += SS_SL(0, iud)*std::exp(-ReflCalc->uk*adz);
  1075. return ra*con;
  1076. }
  1077. template <>
  1078. Complex KernelEM1DSpec<TM, 3, INAIR, INAIR>::RelPotentialInSourceLayer(const Real &ra) {
  1079. Complex con = ReflCalc->relCon + SS_SL(0, ReflCalc->relIud)*ReflCalc->relenukadz;
  1080. return ra*con;
  1081. }
  1082. template <>
  1083. Complex KernelEM1DSpec<TM, 4, INAIR, INAIR>::PotentialInSourceLayer(const Real &ra) {
  1084. int iud(0);
  1085. if (ReflCalc->rx_z <= ReflCalc->tx_z) iud=1;
  1086. Real adz = std::abs(ReflCalc->rx_z-ReflCalc->tx_z);
  1087. Complex con = ReflCalc->rtd(0)*std::exp(ReflCalc->u(0)*(ReflCalc->rx_z+ReflCalc->tx_z));
  1088. // Add singular term (source term)
  1089. con += SS_SL(2, iud)*std::exp(-ReflCalc->uk*adz);
  1090. return ra*ReflCalc->uk*con;
  1091. }
  1092. template <>
  1093. Complex KernelEM1DSpec<TM, 4, INAIR, INAIR>::RelPotentialInSourceLayer(const Real &ra) {
  1094. Complex con = ReflCalc->relCon + SS_SL(2, ReflCalc->relIud)*ReflCalc->relenukadz;
  1095. return ra*ReflCalc->uk*con;
  1096. }
  1097. template <>
  1098. Complex KernelEM1DSpec<TM, 5, INAIR, INAIR>::PotentialInSourceLayer(const Real &ra) {
  1099. int iud(0);
  1100. if (ReflCalc->rx_z <= ReflCalc->tx_z) iud=1;
  1101. Real adz = std::abs(ReflCalc->rx_z-ReflCalc->tx_z);
  1102. Complex con = ReflCalc->rtd(0)*std::exp(ReflCalc->u(0)*(ReflCalc->rx_z+ReflCalc->tx_z));
  1103. // Add singular term (source term)
  1104. con += SS_SL(2, iud)*std::exp(-ReflCalc->uk*adz);
  1105. return ra*ReflCalc->uk*con;
  1106. }
  1107. template <>
  1108. Complex KernelEM1DSpec<TM, 5, INAIR, INAIR>::RelPotentialInSourceLayer(const Real &ra) {
  1109. Complex con = ReflCalc->relCon + SS_SL(2, ReflCalc->relIud)*ReflCalc->relenukadz;
  1110. return ra*ReflCalc->uk*con;
  1111. }
  1112. template <>
  1113. Complex KernelEM1DSpec<TM, 6, INAIR, INAIR>::PotentialInSourceLayer(const Real &ra) {
  1114. int iud(0);
  1115. if (ReflCalc->rx_z <= ReflCalc->tx_z) iud=1;
  1116. Real adz = std::abs(ReflCalc->rx_z-ReflCalc->tx_z);
  1117. Complex con = ReflCalc->rtd(0)*std::exp(ReflCalc->u(0)*(ReflCalc->rx_z+ReflCalc->tx_z));
  1118. // Add singular term (source term)
  1119. con += SS_SL(2, iud)*std::exp(-ReflCalc->uk*adz);
  1120. return ra*ReflCalc->uk*con;
  1121. }
  1122. template <>
  1123. Complex KernelEM1DSpec<TM, 6, INAIR, INAIR>::RelPotentialInSourceLayer(const Real &ra) {
  1124. Complex con = ReflCalc->relCon + SS_SL(2, ReflCalc->relIud)*ReflCalc->relenukadz;
  1125. return ra*ReflCalc->uk*con;
  1126. }
  1127. template <>
  1128. Complex KernelEM1DSpec<TM, 7, INAIR, INAIR>::PotentialInSourceLayer(const Real &ra) {
  1129. int iud(0);
  1130. if (ReflCalc->rx_z <= ReflCalc->tx_z) iud=1;
  1131. Real adz = std::abs(ReflCalc->rx_z-ReflCalc->tx_z);
  1132. Complex con = ReflCalc->rtd(0)*std::exp(ReflCalc->u(0)*(ReflCalc->rx_z+ReflCalc->tx_z));
  1133. // Add singular term (source term)
  1134. con += SS_SL(1, iud)*std::exp(-ReflCalc->uk*adz);
  1135. return ra*ReflCalc->uk*con;
  1136. }
  1137. template <>
  1138. Complex KernelEM1DSpec<TM, 7, INAIR, INAIR>::RelPotentialInSourceLayer(const Real &ra) {
  1139. Complex con = ReflCalc->relCon + SS_SL(1, ReflCalc->relIud)*ReflCalc->relenukadz;
  1140. return ra*ReflCalc->uk*con;
  1141. }
  1142. template <>
  1143. Complex KernelEM1DSpec<TM, 8, INAIR, INAIR>::PotentialInSourceLayer(const Real &ra) {
  1144. int iud(0);
  1145. if (ReflCalc->rx_z <= ReflCalc->tx_z) iud=1;
  1146. Real adz = std::abs(ReflCalc->rx_z-ReflCalc->tx_z);
  1147. Complex con = ReflCalc->rtd(0)*std::exp(ReflCalc->u(0)*(ReflCalc->rx_z+ReflCalc->tx_z));
  1148. // Add singular term (source term)
  1149. con += SS_SL(1, iud)*std::exp(-ReflCalc->uk*adz);
  1150. return ra*ReflCalc->uk*con;
  1151. }
  1152. template <>
  1153. Complex KernelEM1DSpec<TM, 8, INAIR, INAIR>::RelPotentialInSourceLayer(const Real &ra) {
  1154. Complex con = ReflCalc->relCon + SS_SL(1, ReflCalc->relIud)*ReflCalc->relenukadz;
  1155. return ra*ReflCalc->uk*con;
  1156. }
  1157. template <>
  1158. Complex KernelEM1DSpec<TM, 9, INAIR, INAIR>::PotentialInSourceLayer(const Real &ra) {
  1159. int iud(0);
  1160. if (ReflCalc->rx_z <= ReflCalc->tx_z) iud=1;
  1161. Real adz = std::abs(ReflCalc->rx_z-ReflCalc->tx_z);
  1162. Complex con = ReflCalc->rtd(0)*std::exp(ReflCalc->u(0)*(ReflCalc->rx_z+ReflCalc->tx_z));
  1163. // Add singular term (source term)
  1164. con += SS_SL(0, iud)*std::exp(-ReflCalc->uk*adz);
  1165. return ra*con;
  1166. }
  1167. template <>
  1168. Complex KernelEM1DSpec<TM, 9, INAIR, INAIR>::RelPotentialInSourceLayer(const Real &ra) {
  1169. Complex con = ReflCalc->relCon + SS_SL(0, ReflCalc->relIud)*ReflCalc->relenukadz;
  1170. return ra*con;
  1171. }
  1172. template <>
  1173. Complex KernelEM1DSpec<TM, 10, INAIR, INAIR>::PotentialInSourceLayer(const Real &ra) {
  1174. int iud(0);
  1175. if (ReflCalc->rx_z <= ReflCalc->tx_z) iud=1;
  1176. Real adz = std::abs(ReflCalc->rx_z-ReflCalc->tx_z);
  1177. Complex con = ReflCalc->rtd(0)*std::exp(ReflCalc->u(0)*(ReflCalc->rx_z+ReflCalc->tx_z));
  1178. // Add singular term (source term)
  1179. con += SS_SL(1, iud)*std::exp(-ReflCalc->uk*adz);
  1180. return ra*ReflCalc->uk*con;
  1181. }
  1182. template <>
  1183. Complex KernelEM1DSpec<TM, 10, INAIR, INAIR>::RelPotentialInSourceLayer(const Real &ra) {
  1184. Complex con = ReflCalc->relCon + SS_SL(1, ReflCalc->relIud)*ReflCalc->relenukadz;
  1185. return ra*ReflCalc->uk*con;
  1186. }
  1187. template <>
  1188. Complex KernelEM1DSpec<TM, 11, INAIR, INAIR>::PotentialInSourceLayer(const Real &ra) {
  1189. int iud(0);
  1190. if (ReflCalc->rx_z <= ReflCalc->tx_z) iud=1;
  1191. Real adz = std::abs(ReflCalc->rx_z-ReflCalc->tx_z);
  1192. Complex con = ReflCalc->rtd(0)*std::exp(ReflCalc->u(0)*(ReflCalc->rx_z+ReflCalc->tx_z));
  1193. // Add singular term (source term)
  1194. con += SS_SL(0, iud)*std::exp(-ReflCalc->uk*adz);
  1195. return ra*con;
  1196. }
  1197. template <>
  1198. Complex KernelEM1DSpec<TM, 11, INAIR, INAIR>::RelPotentialInSourceLayer(const Real &ra) {
  1199. Complex con = ReflCalc->relCon + SS_SL(0, ReflCalc->relIud)*ReflCalc->relenukadz;
  1200. return ra*con;
  1201. }
  1202. template <>
  1203. Complex KernelEM1DSpec<TM, 12, INAIR, INAIR>::PotentialInSourceLayer(const Real &ra) {
  1204. int iud(0);
  1205. if (ReflCalc->rx_z <= ReflCalc->tx_z) iud=1;
  1206. Real adz = std::abs(ReflCalc->rx_z-ReflCalc->tx_z);
  1207. Complex con = ReflCalc->rtd(0)*std::exp(ReflCalc->u(0)*(ReflCalc->rx_z+ReflCalc->tx_z));
  1208. // Add singular term (source term)
  1209. con += SS_SL(0, iud)*std::exp(-ReflCalc->uk*adz);
  1210. return ra*con;
  1211. }
  1212. template <>
  1213. Complex KernelEM1DSpec<TM, 12, INAIR, INAIR>::RelPotentialInSourceLayer(const Real &ra) {
  1214. Complex con = ReflCalc->relCon + SS_SL(0, ReflCalc->relIud)*ReflCalc->relenukadz;
  1215. return ra*con;
  1216. }
  1217. template <>
  1218. Complex KernelEM1DSpec<TE, 0, INAIR, INAIR>::PotentialInSourceLayer(const Real &ra) {
  1219. int iud(0);
  1220. if (ReflCalc->rx_z <= ReflCalc->tx_z) iud=1;
  1221. Real adz = std::abs(ReflCalc->rx_z-ReflCalc->tx_z);
  1222. Complex con = ReflCalc->rtd(0)*std::exp(ReflCalc->u(0)*(ReflCalc->rx_z+ReflCalc->tx_z));
  1223. // Add singular term (source term)
  1224. con += SS_SL(3, iud)*std::exp(-ReflCalc->uk*adz);
  1225. return ra*ReflCalc->uk*ReflCalc->uk*con;
  1226. }
  1227. template <>
  1228. Complex KernelEM1DSpec<TE, 0, INAIR, INAIR>::RelPotentialInSourceLayer(const Real &ra) {
  1229. Complex con = ReflCalc->relCon + SS_SL(3, ReflCalc->relIud)*ReflCalc->relenukadz;
  1230. return ra*ReflCalc->uk*ReflCalc->uk*con;
  1231. }
  1232. template <>
  1233. Complex KernelEM1DSpec<TE, 1, INAIR, INAIR>::PotentialInSourceLayer(const Real &ra) {
  1234. int iud(0);
  1235. if (ReflCalc->rx_z <= ReflCalc->tx_z) iud=1;
  1236. Real adz = std::abs(ReflCalc->rx_z-ReflCalc->tx_z);
  1237. Complex con = ReflCalc->rtd(0)*std::exp(ReflCalc->u(0)*(ReflCalc->rx_z+ReflCalc->tx_z));
  1238. // Add singular term (source term)
  1239. con += SS_SL(3, iud)*std::exp(-ReflCalc->uk*adz);
  1240. return ra*ReflCalc->uk*ReflCalc->uk*con;
  1241. }
  1242. template <>
  1243. Complex KernelEM1DSpec<TE, 1, INAIR, INAIR>::RelPotentialInSourceLayer(const Real &ra) {
  1244. Complex con = ReflCalc->relCon + SS_SL(3, ReflCalc->relIud)*ReflCalc->relenukadz;
  1245. return ra*ReflCalc->uk*ReflCalc->uk*con;
  1246. }
  1247. template <>
  1248. Complex KernelEM1DSpec<TE, 2, INAIR, INAIR>::PotentialInSourceLayer(const Real &ra) {
  1249. int iud(0);
  1250. if (ReflCalc->rx_z <= ReflCalc->tx_z) iud=1;
  1251. Real adz = std::abs(ReflCalc->rx_z-ReflCalc->tx_z);
  1252. Complex con = ReflCalc->rtd(0)*std::exp(ReflCalc->u(0)*(ReflCalc->rx_z+ReflCalc->tx_z));
  1253. // Add singular term (source term)
  1254. con += SS_SL(0, iud)*std::exp(-ReflCalc->uk*adz);
  1255. return ra*con;
  1256. }
  1257. template <>
  1258. Complex KernelEM1DSpec<TE, 2, INAIR, INAIR>::RelPotentialInSourceLayer(const Real &ra) {
  1259. Complex con = ReflCalc->relCon + SS_SL(0, ReflCalc->relIud)*ReflCalc->relenukadz;
  1260. return ra*con;
  1261. }
  1262. template <>
  1263. Complex KernelEM1DSpec<TE, 3, INAIR, INAIR>::PotentialInSourceLayer(const Real &ra) {
  1264. int iud(0);
  1265. if (ReflCalc->rx_z <= ReflCalc->tx_z) iud=1;
  1266. Real adz = std::abs(ReflCalc->rx_z-ReflCalc->tx_z);
  1267. Complex con = ReflCalc->rtd(0)*std::exp(ReflCalc->u(0)*(ReflCalc->rx_z+ReflCalc->tx_z));
  1268. // Add singular term (source term)
  1269. con += SS_SL(0, iud)*std::exp(-ReflCalc->uk*adz);
  1270. return ra*con;
  1271. }
  1272. template <>
  1273. Complex KernelEM1DSpec<TE, 3, INAIR, INAIR>::RelPotentialInSourceLayer(const Real &ra) {
  1274. Complex con = ReflCalc->relCon + SS_SL(0, ReflCalc->relIud)*ReflCalc->relenukadz;
  1275. return ra*con;
  1276. }
  1277. template <>
  1278. Complex KernelEM1DSpec<TE, 4, INAIR, INAIR>::PotentialInSourceLayer(const Real &ra) {
  1279. int iud(0);
  1280. if (ReflCalc->rx_z <= ReflCalc->tx_z) iud=1;
  1281. Real adz = std::abs(ReflCalc->rx_z-ReflCalc->tx_z);
  1282. Complex con = ReflCalc->rtd(0)*std::exp(ReflCalc->u(0)*(ReflCalc->rx_z+ReflCalc->tx_z));
  1283. // Add singular term (source term)
  1284. con += SS_SL(2, iud)*std::exp(-ReflCalc->uk*adz);
  1285. return ra*ReflCalc->uk*con;
  1286. }
  1287. template <>
  1288. Complex KernelEM1DSpec<TE, 4, INAIR, INAIR>::RelPotentialInSourceLayer(const Real &ra) {
  1289. Complex con = ReflCalc->relCon + SS_SL(2, ReflCalc->relIud)*ReflCalc->relenukadz;
  1290. return ra*ReflCalc->uk*con;
  1291. }
  1292. template <>
  1293. Complex KernelEM1DSpec<TE, 5, INAIR, INAIR>::PotentialInSourceLayer(const Real &ra) {
  1294. int iud(0);
  1295. if (ReflCalc->rx_z <= ReflCalc->tx_z) iud=1;
  1296. Real adz = std::abs(ReflCalc->rx_z-ReflCalc->tx_z);
  1297. Complex con = ReflCalc->rtd(0)*std::exp(ReflCalc->u(0)*(ReflCalc->rx_z+ReflCalc->tx_z));
  1298. // Add singular term (source term)
  1299. con += SS_SL(2, iud)*std::exp(-ReflCalc->uk*adz);
  1300. return ra*ReflCalc->uk*con;
  1301. }
  1302. template <>
  1303. Complex KernelEM1DSpec<TE, 5, INAIR, INAIR>::RelPotentialInSourceLayer(const Real &ra) {
  1304. Complex con = ReflCalc->relCon + SS_SL(2, ReflCalc->relIud)*ReflCalc->relenukadz;
  1305. return ra*ReflCalc->uk*con;
  1306. }
  1307. template <>
  1308. Complex KernelEM1DSpec<TE, 6, INAIR, INAIR>::PotentialInSourceLayer(const Real &ra) {
  1309. int iud(0);
  1310. if (ReflCalc->rx_z <= ReflCalc->tx_z) iud=1;
  1311. Real adz = std::abs(ReflCalc->rx_z-ReflCalc->tx_z);
  1312. Complex con = ReflCalc->rtd(0)*std::exp(ReflCalc->u(0)*(ReflCalc->rx_z+ReflCalc->tx_z));
  1313. // Add singular term (source term)
  1314. con += SS_SL(2, iud)*std::exp(-ReflCalc->uk*adz);
  1315. return ra*ReflCalc->uk*con;
  1316. }
  1317. template <>
  1318. Complex KernelEM1DSpec<TE, 6, INAIR, INAIR>::RelPotentialInSourceLayer(const Real &ra) {
  1319. Complex con = ReflCalc->relCon + SS_SL(2, ReflCalc->relIud)*ReflCalc->relenukadz;
  1320. return ra*ReflCalc->uk*con;
  1321. }
  1322. template <>
  1323. Complex KernelEM1DSpec<TE, 7, INAIR, INAIR>::PotentialInSourceLayer(const Real &ra) {
  1324. int iud(0);
  1325. if (ReflCalc->rx_z <= ReflCalc->tx_z) iud=1;
  1326. Real adz = std::abs(ReflCalc->rx_z-ReflCalc->tx_z);
  1327. Complex con = ReflCalc->rtd(0)*std::exp(ReflCalc->u(0)*(ReflCalc->rx_z+ReflCalc->tx_z));
  1328. // Add singular term (source term)
  1329. con += SS_SL(1, iud)*std::exp(-ReflCalc->uk*adz);
  1330. return ra*ReflCalc->uk*con;
  1331. }
  1332. template <>
  1333. Complex KernelEM1DSpec<TE, 7, INAIR, INAIR>::RelPotentialInSourceLayer(const Real &ra) {
  1334. Complex con = ReflCalc->relCon + SS_SL(1, ReflCalc->relIud)*ReflCalc->relenukadz;
  1335. return ra*ReflCalc->uk*con;
  1336. }
  1337. template <>
  1338. Complex KernelEM1DSpec<TE, 8, INAIR, INAIR>::PotentialInSourceLayer(const Real &ra) {
  1339. int iud(0);
  1340. if (ReflCalc->rx_z <= ReflCalc->tx_z) iud=1;
  1341. Real adz = std::abs(ReflCalc->rx_z-ReflCalc->tx_z);
  1342. Complex con = ReflCalc->rtd(0)*std::exp(ReflCalc->u(0)*(ReflCalc->rx_z+ReflCalc->tx_z));
  1343. // Add singular term (source term)
  1344. con += SS_SL(1, iud)*std::exp(-ReflCalc->uk*adz);
  1345. return ra*ReflCalc->uk*con;
  1346. }
  1347. template <>
  1348. Complex KernelEM1DSpec<TE, 8, INAIR, INAIR>::RelPotentialInSourceLayer(const Real &ra) {
  1349. Complex con = ReflCalc->relCon + SS_SL(1, ReflCalc->relIud)*ReflCalc->relenukadz;
  1350. return ra*ReflCalc->uk*con;
  1351. }
  1352. template <>
  1353. Complex KernelEM1DSpec<TE, 9, INAIR, INAIR>::PotentialInSourceLayer(const Real &ra) {
  1354. int iud(0);
  1355. if (ReflCalc->rx_z <= ReflCalc->tx_z) iud=1;
  1356. Real adz = std::abs(ReflCalc->rx_z-ReflCalc->tx_z);
  1357. Complex con = ReflCalc->rtd(0)*std::exp(ReflCalc->u(0)*(ReflCalc->rx_z+ReflCalc->tx_z));
  1358. // Add singular term (source term)
  1359. con += SS_SL(0, iud)*std::exp(-ReflCalc->uk*adz);
  1360. return ra*con;
  1361. }
  1362. template <>
  1363. Complex KernelEM1DSpec<TE, 9, INAIR, INAIR>::RelPotentialInSourceLayer(const Real &ra) {
  1364. Complex con = ReflCalc->relCon + SS_SL(0, ReflCalc->relIud)*ReflCalc->relenukadz;
  1365. return ra*con;
  1366. }
  1367. template <>
  1368. Complex KernelEM1DSpec<TE, 10, INAIR, INAIR>::PotentialInSourceLayer(const Real &ra) {
  1369. int iud(0);
  1370. if (ReflCalc->rx_z <= ReflCalc->tx_z) iud=1;
  1371. Real adz = std::abs(ReflCalc->rx_z-ReflCalc->tx_z);
  1372. Complex con = ReflCalc->rtd(0)*std::exp(ReflCalc->u(0)*(ReflCalc->rx_z+ReflCalc->tx_z));
  1373. // Add singular term (source term)
  1374. con += SS_SL(1, iud)*std::exp(-ReflCalc->uk*adz);
  1375. return ra*ReflCalc->uk*con;
  1376. }
  1377. template <>
  1378. Complex KernelEM1DSpec<TE, 10, INAIR, INAIR>::RelPotentialInSourceLayer(const Real &ra) {
  1379. Complex con = ReflCalc->relCon + SS_SL(1, ReflCalc->relIud)*ReflCalc->relenukadz;
  1380. return ra*ReflCalc->uk*con;
  1381. }
  1382. template <>
  1383. Complex KernelEM1DSpec<TE, 11, INAIR, INAIR>::PotentialInSourceLayer(const Real &ra) {
  1384. int iud(0);
  1385. if (ReflCalc->rx_z <= ReflCalc->tx_z) iud=1;
  1386. Real adz = std::abs(ReflCalc->rx_z-ReflCalc->tx_z);
  1387. Complex con = ReflCalc->rtd(0)*std::exp(ReflCalc->u(0)*(ReflCalc->rx_z+ReflCalc->tx_z));
  1388. // Add singular term (source term)
  1389. con += SS_SL(0, iud)*std::exp(-ReflCalc->uk*adz);
  1390. return ra*con;
  1391. }
  1392. template <>
  1393. Complex KernelEM1DSpec<TE, 11, INAIR, INAIR>::RelPotentialInSourceLayer(const Real &ra) {
  1394. Complex con = ReflCalc->relCon + SS_SL(0, ReflCalc->relIud)*ReflCalc->relenukadz;
  1395. return ra*con;
  1396. }
  1397. template <>
  1398. Complex KernelEM1DSpec<TE, 12, INAIR, INAIR>::PotentialInSourceLayer(const Real &ra) {
  1399. int iud(0);
  1400. if (ReflCalc->rx_z <= ReflCalc->tx_z) iud=1;
  1401. Real adz = std::abs(ReflCalc->rx_z-ReflCalc->tx_z);
  1402. Complex con = ReflCalc->rtd(0)*std::exp(ReflCalc->u(0)*(ReflCalc->rx_z+ReflCalc->tx_z));
  1403. // Add singular term (source term)
  1404. con += SS_SL(0, iud)*std::exp(-ReflCalc->uk*adz);
  1405. return ra*con;
  1406. }
  1407. template <>
  1408. Complex KernelEM1DSpec<TE, 12, INAIR, INAIR>::RelPotentialInSourceLayer(const Real &ra) {
  1409. Complex con = ReflCalc->relCon + SS_SL(0, ReflCalc->relIud)*ReflCalc->relenukadz;
  1410. return ra*con;
  1411. }
  1412. // TODO in PotentialBelowSourceLayer:
  1413. template<>
  1414. Complex KernelEM1DSpec<TM, 0, INAIR, INGROUND>::PotentialBelowSourceLayer(const Real &ra) {
  1415. Complex dd = ((Real)(1.)+ReflCalc->rtd(1)*ReflCalc->cf(1));
  1416. Complex a = ((Real)(1.) + ReflCalc->rtd(0)) / dd;
  1417. if (ReflCalc->layr >= 2) {
  1418. for (int n=2; n<=ReflCalc->layr; ++n) {
  1419. a *= ((Real)(1.)+ReflCalc->rtd(n-1));
  1420. if (n < ReflCalc->nlay-1) {
  1421. a /= ((Real)(1.)+ReflCalc->rtd(n)*ReflCalc->cf(n));
  1422. }
  1423. }
  1424. }
  1425. Complex p(0,0);
  1426. for (int n=1; n<=ReflCalc->layr; ++n) {
  1427. Complex ut = ReflCalc->u(0);
  1428. if (n>1) {
  1429. ut = ReflCalc->u(n-1);
  1430. }
  1431. p += (ReflCalc->u(n)-ut) * ReflCalc->LayerDepth(n-1);
  1432. }
  1433. Complex con = SR_SN(3, 0) * std::exp(ReflCalc->uk*ReflCalc->tx_z - ReflCalc->um*ReflCalc->rx_z+ p);
  1434. if (ReflCalc->layr < ReflCalc->Earth->GetNumberOfLayers()-1) {
  1435. con += SR_SN(3, 2) * ReflCalc->rtd(ReflCalc->layr) * std::exp(ReflCalc->uk*ReflCalc->tx_z-
  1436. ReflCalc->um*((Real)(2.)*ReflCalc->LayerDepth(ReflCalc->layr)-ReflCalc->rx_z)+p);
  1437. }
  1438. return ra*a*con*ReflCalc->um*ReflCalc->uk;
  1439. }
  1440. template<>
  1441. Complex KernelEM1DSpec<TM, 0, INAIR, INGROUND>::RelPotentialBelowSourceLayer(const Real &ra) {
  1442. Complex con = SR_SN(3, 0) * ReflCalc->relexp_pbs1;
  1443. if (ReflCalc->layr < ReflCalc->Earth->GetNumberOfLayers()-1) {
  1444. con += SR_SN(3, 2) * ReflCalc->rtd(ReflCalc->layr) * ReflCalc->relexp_pbs2;
  1445. }
  1446. return ra*ReflCalc->rel_a*con*ReflCalc->um*ReflCalc->uk;
  1447. }
  1448. template<>
  1449. Complex KernelEM1DSpec<TM, 1, INAIR, INGROUND>::PotentialBelowSourceLayer(const Real &ra) {
  1450. Complex dd = ((Real)(1.)+ReflCalc->rtd(1)*ReflCalc->cf(1));
  1451. Complex a = ((Real)(1.) + ReflCalc->rtd(0)) / dd;
  1452. if (ReflCalc->layr >= 2) {
  1453. for (int n=2; n<=ReflCalc->layr; ++n) {
  1454. a *= ((Real)(1.)+ReflCalc->rtd(n-1));
  1455. if (n < ReflCalc->nlay-1) {
  1456. a /= ((Real)(1.)+ReflCalc->rtd(n)*ReflCalc->cf(n));
  1457. }
  1458. }
  1459. }
  1460. Complex p(0,0);
  1461. for (int n=1; n<=ReflCalc->layr; ++n) {
  1462. Complex ut = ReflCalc->u(0);
  1463. if (n>1) {
  1464. ut = ReflCalc->u(n-1);
  1465. }
  1466. p += (ReflCalc->u(n)-ut) * ReflCalc->LayerDepth(n-1);
  1467. }
  1468. Complex con = SR_SN(3, 0) * std::exp(ReflCalc->uk*ReflCalc->tx_z - ReflCalc->um*ReflCalc->rx_z+ p);
  1469. if (ReflCalc->layr < ReflCalc->Earth->GetNumberOfLayers()-1) {
  1470. con += SR_SN(3, 2) * ReflCalc->rtd(ReflCalc->layr) * std::exp(ReflCalc->uk*ReflCalc->tx_z-
  1471. ReflCalc->um*((Real)(2.)*ReflCalc->LayerDepth(ReflCalc->layr)-ReflCalc->rx_z)+p);
  1472. }
  1473. return ra*a*con*ReflCalc->um*ReflCalc->uk;
  1474. }
  1475. template<>
  1476. Complex KernelEM1DSpec<TM, 1, INAIR, INGROUND>::RelPotentialBelowSourceLayer(const Real &ra) {
  1477. Complex con = SR_SN(3, 0) * ReflCalc->relexp_pbs1;
  1478. if (ReflCalc->layr < ReflCalc->Earth->GetNumberOfLayers()-1) {
  1479. con += SR_SN(3, 2) * ReflCalc->rtd(ReflCalc->layr) * ReflCalc->relexp_pbs2;
  1480. }
  1481. return ra*ReflCalc->rel_a*con*ReflCalc->um*ReflCalc->uk;
  1482. }
  1483. template<>
  1484. Complex KernelEM1DSpec<TM, 2, INAIR, INGROUND>::PotentialBelowSourceLayer(const Real &ra) {
  1485. Complex dd = ((Real)(1.)+ReflCalc->rtd(1)*ReflCalc->cf(1));
  1486. Complex a = ((Real)(1.) + ReflCalc->rtd(0)) / dd;
  1487. if (ReflCalc->layr >= 2) {
  1488. for (int n=2; n<=ReflCalc->layr; ++n) {
  1489. a *= ((Real)(1.)+ReflCalc->rtd(n-1));
  1490. if (n < ReflCalc->nlay-1) {
  1491. a /= ((Real)(1.)+ReflCalc->rtd(n)*ReflCalc->cf(n));
  1492. }
  1493. }
  1494. }
  1495. Complex p(0,0);
  1496. for (int n=1; n<=ReflCalc->layr; ++n) {
  1497. Complex ut = ReflCalc->u(0);
  1498. if (n>1) {
  1499. ut = ReflCalc->u(n-1);
  1500. }
  1501. p += (ReflCalc->u(n)-ut) * ReflCalc->LayerDepth(n-1);
  1502. }
  1503. Complex con = SR_SN(0, 0) * std::exp(ReflCalc->uk*ReflCalc->tx_z - ReflCalc->um*ReflCalc->rx_z+ p);
  1504. if (ReflCalc->layr < ReflCalc->Earth->GetNumberOfLayers()-1) {
  1505. con += SR_SN(0, 2) * ReflCalc->rtd(ReflCalc->layr) * std::exp(ReflCalc->uk*ReflCalc->tx_z-
  1506. ReflCalc->um*((Real)(2.)*ReflCalc->LayerDepth(ReflCalc->layr)-ReflCalc->rx_z)+p);
  1507. }
  1508. return ra*a*con;//*ReflCalc->um;
  1509. }
  1510. template<>
  1511. Complex KernelEM1DSpec<TM, 2, INAIR, INGROUND>::RelPotentialBelowSourceLayer(const Real &ra) {
  1512. Complex con = SR_SN(0, 0) * ReflCalc->relexp_pbs1;
  1513. if (ReflCalc->layr < ReflCalc->Earth->GetNumberOfLayers()-1) {
  1514. con += SR_SN(0, 2) * ReflCalc->rtd(ReflCalc->layr) * ReflCalc->relexp_pbs2;
  1515. }
  1516. return ra*ReflCalc->rel_a*con;//*ReflCalc->um;
  1517. }
  1518. template<>
  1519. Complex KernelEM1DSpec<TM, 3, INAIR, INGROUND>::PotentialBelowSourceLayer(const Real &ra) {
  1520. Complex dd = ((Real)(1.)+ReflCalc->rtd(1)*ReflCalc->cf(1));
  1521. Complex a = ((Real)(1.) + ReflCalc->rtd(0)) / dd;
  1522. if (ReflCalc->layr >= 2) {
  1523. for (int n=2; n<=ReflCalc->layr; ++n) {
  1524. a *= ((Real)(1.)+ReflCalc->rtd(n-1));
  1525. if (n < ReflCalc->nlay-1) {
  1526. a /= ((Real)(1.)+ReflCalc->rtd(n)*ReflCalc->cf(n));
  1527. }
  1528. }
  1529. }
  1530. Complex p(0,0);
  1531. for (int n=1; n<=ReflCalc->layr; ++n) {
  1532. Complex ut = ReflCalc->u(0);
  1533. if (n>1) {
  1534. ut = ReflCalc->u(n-1);
  1535. }
  1536. p += (ReflCalc->u(n)-ut) * ReflCalc->LayerDepth(n-1);
  1537. }
  1538. Complex con = SR_SN(0, 0) * std::exp(ReflCalc->uk*ReflCalc->tx_z - ReflCalc->um*ReflCalc->rx_z+ p);
  1539. if (ReflCalc->layr < ReflCalc->Earth->GetNumberOfLayers()-1) {
  1540. con += SR_SN(0, 2) * ReflCalc->rtd(ReflCalc->layr) * std::exp(ReflCalc->uk*ReflCalc->tx_z-
  1541. ReflCalc->um*((Real)(2.)*ReflCalc->LayerDepth(ReflCalc->layr)-ReflCalc->rx_z)+p);
  1542. }
  1543. return ra*a*con;
  1544. }
  1545. template<>
  1546. Complex KernelEM1DSpec<TM, 3, INAIR, INGROUND>::RelPotentialBelowSourceLayer(const Real &ra) {
  1547. Complex con = SR_SN(0, 0) * ReflCalc->relexp_pbs1;
  1548. if (ReflCalc->layr < ReflCalc->Earth->GetNumberOfLayers()-1) {
  1549. con += SR_SN(0, 2) * ReflCalc->rtd(ReflCalc->layr) * ReflCalc->relexp_pbs2;
  1550. }
  1551. return ra*ReflCalc->rel_a*con;
  1552. }
  1553. template<>
  1554. Complex KernelEM1DSpec<TM, 4, INAIR, INGROUND>::PotentialBelowSourceLayer(const Real &ra) {
  1555. Complex dd = ((Real)(1.)+ReflCalc->rtd(1)*ReflCalc->cf(1));
  1556. Complex a = ((Real)(1.) + ReflCalc->rtd(0)) / dd;
  1557. if (ReflCalc->layr >= 2) {
  1558. for (int n=2; n<=ReflCalc->layr; ++n) {
  1559. a *= ((Real)(1.)+ReflCalc->rtd(n-1));
  1560. if (n < ReflCalc->nlay-1) {
  1561. a /= ((Real)(1.)+ReflCalc->rtd(n)*ReflCalc->cf(n));
  1562. }
  1563. }
  1564. }
  1565. Complex p(0,0);
  1566. for (int n=1; n<=ReflCalc->layr; ++n) {
  1567. Complex ut = ReflCalc->u(0);
  1568. if (n>1) {
  1569. ut = ReflCalc->u(n-1);
  1570. }
  1571. p += (ReflCalc->u(n)-ut) * ReflCalc->LayerDepth(n-1);
  1572. }
  1573. Complex con = SR_SN(2, 0) * std::exp(ReflCalc->uk*ReflCalc->tx_z - ReflCalc->um*ReflCalc->rx_z+ p);
  1574. if (ReflCalc->layr < ReflCalc->Earth->GetNumberOfLayers()-1) {
  1575. con += SR_SN(2, 2) * ReflCalc->rtd(ReflCalc->layr) * std::exp(ReflCalc->uk*ReflCalc->tx_z-
  1576. ReflCalc->um*((Real)(2.)*ReflCalc->LayerDepth(ReflCalc->layr)-ReflCalc->rx_z)+p);
  1577. }
  1578. return ra*a*con*ReflCalc->uk;
  1579. }
  1580. template<>
  1581. Complex KernelEM1DSpec<TM, 4, INAIR, INGROUND>::RelPotentialBelowSourceLayer(const Real &ra) {
  1582. Complex con = SR_SN(2, 0) * ReflCalc->relexp_pbs1;
  1583. if (ReflCalc->layr < ReflCalc->Earth->GetNumberOfLayers()-1) {
  1584. con += SR_SN(2, 2) * ReflCalc->rtd(ReflCalc->layr) * ReflCalc->relexp_pbs2;
  1585. }
  1586. return ra*ReflCalc->rel_a*con*ReflCalc->uk;
  1587. }
  1588. template<>
  1589. Complex KernelEM1DSpec<TM, 5, INAIR, INGROUND>::PotentialBelowSourceLayer(const Real &ra) {
  1590. Complex dd = ((Real)(1.)+ReflCalc->rtd(1)*ReflCalc->cf(1));
  1591. Complex a = ((Real)(1.) + ReflCalc->rtd(0)) / dd;
  1592. if (ReflCalc->layr >= 2) {
  1593. for (int n=2; n<=ReflCalc->layr; ++n) {
  1594. a *= ((Real)(1.)+ReflCalc->rtd(n-1));
  1595. if (n < ReflCalc->nlay-1) {
  1596. a /= ((Real)(1.)+ReflCalc->rtd(n)*ReflCalc->cf(n));
  1597. }
  1598. }
  1599. }
  1600. Complex p(0,0);
  1601. for (int n=1; n<=ReflCalc->layr; ++n) {
  1602. Complex ut = ReflCalc->u(0);
  1603. if (n>1) {
  1604. ut = ReflCalc->u(n-1);
  1605. }
  1606. p += (ReflCalc->u(n)-ut) * ReflCalc->LayerDepth(n-1);
  1607. }
  1608. Complex con = SR_SN(2, 0) * std::exp(ReflCalc->uk*ReflCalc->tx_z - ReflCalc->um*ReflCalc->rx_z+ p);
  1609. if (ReflCalc->layr < ReflCalc->Earth->GetNumberOfLayers()-1) {
  1610. con += SR_SN(2, 2) * ReflCalc->rtd(ReflCalc->layr) * std::exp(ReflCalc->uk*ReflCalc->tx_z-
  1611. ReflCalc->um*((Real)(2.)*ReflCalc->LayerDepth(ReflCalc->layr)-ReflCalc->rx_z)+p);
  1612. }
  1613. return ra*a*con*ReflCalc->uk;
  1614. }
  1615. template<>
  1616. Complex KernelEM1DSpec<TM, 5, INAIR, INGROUND>::RelPotentialBelowSourceLayer(const Real &ra) {
  1617. Complex con = SR_SN(2, 0) * ReflCalc->relexp_pbs1;
  1618. if (ReflCalc->layr < ReflCalc->Earth->GetNumberOfLayers()-1) {
  1619. con += SR_SN(2, 2) * ReflCalc->rtd(ReflCalc->layr) * ReflCalc->relexp_pbs2;
  1620. }
  1621. return ra*ReflCalc->rel_a*con*ReflCalc->uk;
  1622. }
  1623. template<>
  1624. Complex KernelEM1DSpec<TM, 6, INAIR, INGROUND>::PotentialBelowSourceLayer(const Real &ra) {
  1625. Complex dd = ((Real)(1.)+ReflCalc->rtd(1)*ReflCalc->cf(1));
  1626. Complex a = ((Real)(1.) + ReflCalc->rtd(0)) / dd;
  1627. if (ReflCalc->layr >= 2) {
  1628. for (int n=2; n<=ReflCalc->layr; ++n) {
  1629. a *= ((Real)(1.)+ReflCalc->rtd(n-1));
  1630. if (n < ReflCalc->nlay-1) {
  1631. a /= ((Real)(1.)+ReflCalc->rtd(n)*ReflCalc->cf(n));
  1632. }
  1633. }
  1634. }
  1635. Complex p(0,0);
  1636. for (int n=1; n<=ReflCalc->layr; ++n) {
  1637. Complex ut = ReflCalc->u(0);
  1638. if (n>1) {
  1639. ut = ReflCalc->u(n-1);
  1640. }
  1641. p += (ReflCalc->u(n)-ut) * ReflCalc->LayerDepth(n-1);
  1642. }
  1643. Complex con = SR_SN(2, 0) * std::exp(ReflCalc->uk*ReflCalc->tx_z - ReflCalc->um*ReflCalc->rx_z+ p);
  1644. if (ReflCalc->layr < ReflCalc->Earth->GetNumberOfLayers()-1) {
  1645. con += SR_SN(2, 2) * ReflCalc->rtd(ReflCalc->layr) * std::exp(ReflCalc->uk*ReflCalc->tx_z-
  1646. ReflCalc->um*((Real)(2.)*ReflCalc->LayerDepth(ReflCalc->layr)-ReflCalc->rx_z)+p);
  1647. }
  1648. return ra*a*con*ReflCalc->uk;
  1649. }
  1650. template<>
  1651. Complex KernelEM1DSpec<TM, 6, INAIR, INGROUND>::RelPotentialBelowSourceLayer(const Real &ra) {
  1652. Complex con = SR_SN(2, 0) * ReflCalc->relexp_pbs1;
  1653. if (ReflCalc->layr < ReflCalc->Earth->GetNumberOfLayers()-1) {
  1654. con += SR_SN(2, 2) * ReflCalc->rtd(ReflCalc->layr) * ReflCalc->relexp_pbs2;
  1655. }
  1656. return ra*ReflCalc->rel_a*con*ReflCalc->uk;
  1657. }
  1658. template<>
  1659. Complex KernelEM1DSpec<TM, 7, INAIR, INGROUND>::PotentialBelowSourceLayer(const Real &ra) {
  1660. Complex dd = ((Real)(1.)+ReflCalc->rtd(1)*ReflCalc->cf(1));
  1661. Complex a = ((Real)(1.) + ReflCalc->rtd(0)) / dd;
  1662. if (ReflCalc->layr >= 2) {
  1663. for (int n=2; n<=ReflCalc->layr; ++n) {
  1664. a *= ((Real)(1.)+ReflCalc->rtd(n-1));
  1665. if (n < ReflCalc->nlay-1) {
  1666. a /= ((Real)(1.)+ReflCalc->rtd(n)*ReflCalc->cf(n));
  1667. }
  1668. }
  1669. }
  1670. Complex p(0,0);
  1671. for (int n=1; n<=ReflCalc->layr; ++n) {
  1672. Complex ut = ReflCalc->u(0);
  1673. if (n>1) {
  1674. ut = ReflCalc->u(n-1);
  1675. }
  1676. p += (ReflCalc->u(n)-ut) * ReflCalc->LayerDepth(n-1);
  1677. }
  1678. Complex con = SR_SN(1, 0) * std::exp(ReflCalc->uk*ReflCalc->tx_z - ReflCalc->um*ReflCalc->rx_z+ p);
  1679. if (ReflCalc->layr < ReflCalc->Earth->GetNumberOfLayers()-1) {
  1680. con += SR_SN(1, 2) * ReflCalc->rtd(ReflCalc->layr) * std::exp(ReflCalc->uk*ReflCalc->tx_z-
  1681. ReflCalc->um*((Real)(2.)*ReflCalc->LayerDepth(ReflCalc->layr)-ReflCalc->rx_z)+p);
  1682. }
  1683. return ra*a*con*ReflCalc->um;
  1684. }
  1685. template<>
  1686. Complex KernelEM1DSpec<TM, 7, INAIR, INGROUND>::RelPotentialBelowSourceLayer(const Real &ra) {
  1687. Complex con = SR_SN(1, 0) * ReflCalc->relexp_pbs1;
  1688. if (ReflCalc->layr < ReflCalc->Earth->GetNumberOfLayers()-1) {
  1689. con += SR_SN(1, 2) * ReflCalc->rtd(ReflCalc->layr) * ReflCalc->relexp_pbs2;
  1690. }
  1691. return ra*ReflCalc->rel_a*con*ReflCalc->um;
  1692. }
  1693. template<>
  1694. Complex KernelEM1DSpec<TM, 8, INAIR, INGROUND>::PotentialBelowSourceLayer(const Real &ra) {
  1695. Complex dd = ((Real)(1.)+ReflCalc->rtd(1)*ReflCalc->cf(1));
  1696. Complex a = ((Real)(1.) + ReflCalc->rtd(0)) / dd;
  1697. if (ReflCalc->layr >= 2) {
  1698. for (int n=2; n<=ReflCalc->layr; ++n) {
  1699. a *= ((Real)(1.)+ReflCalc->rtd(n-1));
  1700. if (n < ReflCalc->nlay-1) {
  1701. a /= ((Real)(1.)+ReflCalc->rtd(n)*ReflCalc->cf(n));
  1702. }
  1703. }
  1704. }
  1705. Complex p(0,0);
  1706. for (int n=1; n<=ReflCalc->layr; ++n) {
  1707. Complex ut = ReflCalc->u(0);
  1708. if (n>1) {
  1709. ut = ReflCalc->u(n-1);
  1710. }
  1711. p += (ReflCalc->u(n)-ut) * ReflCalc->LayerDepth(n-1);
  1712. }
  1713. Complex con = SR_SN(1, 0) * std::exp(ReflCalc->uk*ReflCalc->tx_z - ReflCalc->um*ReflCalc->rx_z+ p);
  1714. if (ReflCalc->layr < ReflCalc->Earth->GetNumberOfLayers()-1) {
  1715. con += SR_SN(1, 2) * ReflCalc->rtd(ReflCalc->layr) * std::exp(ReflCalc->uk*ReflCalc->tx_z-
  1716. ReflCalc->um*((Real)(2.)*ReflCalc->LayerDepth(ReflCalc->layr)-ReflCalc->rx_z)+p);
  1717. }
  1718. return ra*a*con*ReflCalc->um;
  1719. }
  1720. template<>
  1721. Complex KernelEM1DSpec<TM, 8, INAIR, INGROUND>::RelPotentialBelowSourceLayer(const Real &ra) {
  1722. Complex con = SR_SN(1, 0) * ReflCalc->relexp_pbs1;
  1723. if (ReflCalc->layr < ReflCalc->Earth->GetNumberOfLayers()-1) {
  1724. con += SR_SN(1, 2) * ReflCalc->rtd(ReflCalc->layr) * ReflCalc->relexp_pbs2;
  1725. }
  1726. return ra*ReflCalc->rel_a*con*ReflCalc->um;
  1727. }
  1728. template<>
  1729. Complex KernelEM1DSpec<TM, 9, INAIR, INGROUND>::PotentialBelowSourceLayer(const Real &ra) {
  1730. Complex dd = ((Real)(1.)+ReflCalc->rtd(1)*ReflCalc->cf(1));
  1731. Complex a = ((Real)(1.) + ReflCalc->rtd(0)) / dd;
  1732. if (ReflCalc->layr >= 2) {
  1733. for (int n=2; n<=ReflCalc->layr; ++n) {
  1734. a *= ((Real)(1.)+ReflCalc->rtd(n-1));
  1735. if (n < ReflCalc->nlay-1) {
  1736. a /= ((Real)(1.)+ReflCalc->rtd(n)*ReflCalc->cf(n));
  1737. }
  1738. }
  1739. }
  1740. Complex p(0,0);
  1741. for (int n=1; n<=ReflCalc->layr; ++n) {
  1742. Complex ut = ReflCalc->u(0);
  1743. if (n>1) {
  1744. ut = ReflCalc->u(n-1);
  1745. }
  1746. p += (ReflCalc->u(n)-ut) * ReflCalc->LayerDepth(n-1);
  1747. }
  1748. Complex con = SR_SN(0, 0) * std::exp(ReflCalc->uk*ReflCalc->tx_z - ReflCalc->um*ReflCalc->rx_z+ p);
  1749. if (ReflCalc->layr < ReflCalc->Earth->GetNumberOfLayers()-1) {
  1750. con += SR_SN(0, 2) * ReflCalc->rtd(ReflCalc->layr) * std::exp(ReflCalc->uk*ReflCalc->tx_z-
  1751. ReflCalc->um*((Real)(2.)*ReflCalc->LayerDepth(ReflCalc->layr)-ReflCalc->rx_z)+p);
  1752. }
  1753. return ra*a*con;
  1754. }
  1755. template<>
  1756. Complex KernelEM1DSpec<TM, 9, INAIR, INGROUND>::RelPotentialBelowSourceLayer(const Real &ra) {
  1757. Complex con = SR_SN(0, 0) * ReflCalc->relexp_pbs1;
  1758. if (ReflCalc->layr < ReflCalc->Earth->GetNumberOfLayers()-1) {
  1759. con += SR_SN(0, 2) * ReflCalc->rtd(ReflCalc->layr) * ReflCalc->relexp_pbs2;
  1760. }
  1761. return ra*ReflCalc->rel_a*con;
  1762. }
  1763. template<>
  1764. Complex KernelEM1DSpec<TM, 10, INAIR, INGROUND>::PotentialBelowSourceLayer(const Real &ra) {
  1765. Complex dd = ((Real)(1.)+ReflCalc->rtd(1)*ReflCalc->cf(1));
  1766. Complex a = ((Real)(1.) + ReflCalc->rtd(0)) / dd;
  1767. if (ReflCalc->layr >= 2) {
  1768. for (int n=2; n<=ReflCalc->layr; ++n) {
  1769. a *= ((Real)(1.)+ReflCalc->rtd(n-1));
  1770. if (n < ReflCalc->nlay-1) {
  1771. a /= ((Real)(1.)+ReflCalc->rtd(n)*ReflCalc->cf(n));
  1772. }
  1773. }
  1774. }
  1775. Complex p(0,0);
  1776. for (int n=1; n<=ReflCalc->layr; ++n) {
  1777. Complex ut = ReflCalc->u(0);
  1778. if (n>1) {
  1779. ut = ReflCalc->u(n-1);
  1780. }
  1781. p += (ReflCalc->u(n)-ut) * ReflCalc->LayerDepth(n-1);
  1782. }
  1783. Complex con = SR_SN(ReflCalc->id-1, 0) * std::exp(ReflCalc->uk*ReflCalc->tx_z - ReflCalc->um*ReflCalc->rx_z+ p);
  1784. if (ReflCalc->layr < ReflCalc->Earth->GetNumberOfLayers()-1) {
  1785. con += SR_SN(ReflCalc->id-1, 2) * ReflCalc->rtd(ReflCalc->layr) * std::exp(ReflCalc->uk*ReflCalc->tx_z-
  1786. ReflCalc->um*((Real)(2.)*ReflCalc->LayerDepth(ReflCalc->layr)-ReflCalc->rx_z)+p);
  1787. }
  1788. return ra*a*con*ReflCalc->um;
  1789. }
  1790. template<>
  1791. Complex KernelEM1DSpec<TM, 10, INAIR, INGROUND>::RelPotentialBelowSourceLayer(const Real &ra) {
  1792. Complex con = SR_SN(ReflCalc->id-1, 0) * ReflCalc->relexp_pbs1;
  1793. if (ReflCalc->layr < ReflCalc->Earth->GetNumberOfLayers()-1) {
  1794. con += SR_SN(ReflCalc->id-1, 2) * ReflCalc->rtd(ReflCalc->layr) * ReflCalc->relexp_pbs2;
  1795. }
  1796. return ra*ReflCalc->rel_a*con*ReflCalc->um;
  1797. }
  1798. template<>
  1799. Complex KernelEM1DSpec<TM, 11, INAIR, INGROUND>::PotentialBelowSourceLayer(const Real &ra) {
  1800. Complex dd = ((Real)(1.)+ReflCalc->rtd(1)*ReflCalc->cf(1));
  1801. Complex a = ((Real)(1.) + ReflCalc->rtd(0)) / dd;
  1802. if (ReflCalc->layr >= 2) {
  1803. for (int n=2; n<=ReflCalc->layr; ++n) {
  1804. a *= ((Real)(1.)+ReflCalc->rtd(n-1));
  1805. if (n < ReflCalc->nlay-1) {
  1806. a /= ((Real)(1.)+ReflCalc->rtd(n)*ReflCalc->cf(n));
  1807. }
  1808. }
  1809. }
  1810. Complex p(0,0);
  1811. for (int n=1; n<=ReflCalc->layr; ++n) {
  1812. Complex ut = ReflCalc->u(0);
  1813. if (n>1) {
  1814. ut = ReflCalc->u(n-1);
  1815. }
  1816. p += (ReflCalc->u(n)-ut) * ReflCalc->LayerDepth(n-1);
  1817. }
  1818. Complex con = SR_SN(ReflCalc->id-1, 0) * std::exp(ReflCalc->uk*ReflCalc->tx_z - ReflCalc->um*ReflCalc->rx_z+ p);
  1819. if (ReflCalc->layr < ReflCalc->Earth->GetNumberOfLayers()-1) {
  1820. con += SR_SN(ReflCalc->id-1, 2) * ReflCalc->rtd(ReflCalc->layr) * std::exp(ReflCalc->uk*ReflCalc->tx_z-
  1821. ReflCalc->um*((Real)(2.)*ReflCalc->LayerDepth(ReflCalc->layr)-ReflCalc->rx_z)+p);
  1822. }
  1823. return ra*a*con;
  1824. }
  1825. template<>
  1826. Complex KernelEM1DSpec<TM, 11, INAIR, INGROUND>::RelPotentialBelowSourceLayer(const Real &ra) {
  1827. Complex con = SR_SN(ReflCalc->id-1, 0) * ReflCalc->relexp_pbs1;
  1828. if (ReflCalc->layr < ReflCalc->Earth->GetNumberOfLayers()-1) {
  1829. con += SR_SN(ReflCalc->id-1, 2) * ReflCalc->rtd(ReflCalc->layr) * ReflCalc->relexp_pbs2;
  1830. }
  1831. return ra*ReflCalc->rel_a*con;
  1832. }
  1833. template<>
  1834. Complex KernelEM1DSpec<TM, 12, INAIR, INGROUND>::PotentialBelowSourceLayer(const Real &ra) {
  1835. Complex dd = ((Real)(1.)+ReflCalc->rtd(1)*ReflCalc->cf(1));
  1836. Complex a = ((Real)(1.) + ReflCalc->rtd(0)) / dd;
  1837. if (ReflCalc->layr >= 2) {
  1838. for (int n=2; n<=ReflCalc->layr; ++n) {
  1839. a *= ((Real)(1.)+ReflCalc->rtd(n-1));
  1840. if (n < ReflCalc->nlay-1) {
  1841. a /= ((Real)(1.)+ReflCalc->rtd(n)*ReflCalc->cf(n));
  1842. }
  1843. }
  1844. }
  1845. Complex p(0,0);
  1846. for (int n=1; n<=ReflCalc->layr; ++n) {
  1847. Complex ut = ReflCalc->u(0);
  1848. if (n>1) {
  1849. ut = ReflCalc->u(n-1);
  1850. }
  1851. p += (ReflCalc->u(n)-ut) * ReflCalc->LayerDepth(n-1);
  1852. }
  1853. Complex con = SR_SN(ReflCalc->id-1, 0) * std::exp(ReflCalc->uk*ReflCalc->tx_z - ReflCalc->um*ReflCalc->rx_z+ p);
  1854. if (ReflCalc->layr < ReflCalc->Earth->GetNumberOfLayers()-1) {
  1855. con += SR_SN(ReflCalc->id-1, 2) * ReflCalc->rtd(ReflCalc->layr) * std::exp(ReflCalc->uk*ReflCalc->tx_z-
  1856. ReflCalc->um*((Real)(2.)*ReflCalc->LayerDepth(ReflCalc->layr)-ReflCalc->rx_z)+p);
  1857. }
  1858. return ra*a*con;
  1859. }
  1860. template<>
  1861. Complex KernelEM1DSpec<TM, 12, INAIR, INGROUND>::RelPotentialBelowSourceLayer(const Real &ra) {
  1862. Complex con = SR_SN(ReflCalc->id-1, 0) * ReflCalc->relexp_pbs1;
  1863. if (ReflCalc->layr < ReflCalc->Earth->GetNumberOfLayers()-1) {
  1864. con += SR_SN(ReflCalc->id-1, 2) * ReflCalc->rtd(ReflCalc->layr) * ReflCalc->relexp_pbs2;
  1865. }
  1866. return ra*ReflCalc->rel_a*con;
  1867. }
  1868. template<>
  1869. Complex KernelEM1DSpec<TE, 0, INAIR, INGROUND>::PotentialBelowSourceLayer(const Real &ra) {
  1870. Complex dd = ((Real)(1.)+ReflCalc->rtd(1)*ReflCalc->cf(1));
  1871. Complex a = ((Real)(1.) + ReflCalc->rtd(0)) / dd;
  1872. if (ReflCalc->layr >= 2) {
  1873. for (int n=2; n<=ReflCalc->layr; ++n) {
  1874. a *= ((Real)(1.)+ReflCalc->rtd(n-1));
  1875. if (n < ReflCalc->nlay-1) {
  1876. a /= ((Real)(1.)+ReflCalc->rtd(n)*ReflCalc->cf(n));
  1877. }
  1878. }
  1879. }
  1880. Complex p(0,0);
  1881. for (int n=1; n<=ReflCalc->layr; ++n) {
  1882. Complex ut = ReflCalc->u(0);
  1883. if (n>1) {
  1884. ut = ReflCalc->u(n-1);
  1885. }
  1886. p += (ReflCalc->u(n)-ut) * ReflCalc->LayerDepth(n-1);
  1887. }
  1888. Complex con = SR_SN(3, 0) * std::exp(ReflCalc->uk*ReflCalc->tx_z - ReflCalc->um*ReflCalc->rx_z+ p);
  1889. if (ReflCalc->layr < ReflCalc->Earth->GetNumberOfLayers()-1) {
  1890. con += SR_SN(3, 2) * ReflCalc->rtd(ReflCalc->layr) * std::exp(ReflCalc->uk*ReflCalc->tx_z-
  1891. ReflCalc->um*((Real)(2.)*ReflCalc->LayerDepth(ReflCalc->layr)-ReflCalc->rx_z)+p);
  1892. }
  1893. return ra*a*con*ReflCalc->um*ReflCalc->uk;
  1894. }
  1895. template<>
  1896. Complex KernelEM1DSpec<TE, 0, INAIR, INGROUND>::RelPotentialBelowSourceLayer(const Real &ra) {
  1897. Complex con = SR_SN(3, 0) * ReflCalc->relexp_pbs1;
  1898. if (ReflCalc->layr < ReflCalc->Earth->GetNumberOfLayers()-1) {
  1899. con += SR_SN(3, 2) * ReflCalc->rtd(ReflCalc->layr) * ReflCalc->relexp_pbs2;
  1900. }
  1901. return ra*ReflCalc->rel_a*con*ReflCalc->um*ReflCalc->uk;
  1902. }
  1903. template<>
  1904. Complex KernelEM1DSpec<TE, 1, INAIR, INGROUND>::PotentialBelowSourceLayer(const Real &ra) {
  1905. Complex dd = ((Real)(1.)+ReflCalc->rtd(1)*ReflCalc->cf(1));
  1906. Complex a = ((Real)(1.) + ReflCalc->rtd(0)) / dd;
  1907. if (ReflCalc->layr >= 2) {
  1908. for (int n=2; n<=ReflCalc->layr; ++n) {
  1909. a *= ((Real)(1.)+ReflCalc->rtd(n-1));
  1910. if (n < ReflCalc->nlay-1) {
  1911. a /= ((Real)(1.)+ReflCalc->rtd(n)*ReflCalc->cf(n));
  1912. }
  1913. }
  1914. }
  1915. Complex p(0,0);
  1916. for (int n=1; n<=ReflCalc->layr; ++n) {
  1917. Complex ut = ReflCalc->u(0);
  1918. if (n>1) {
  1919. ut = ReflCalc->u(n-1);
  1920. }
  1921. p += (ReflCalc->u(n)-ut) * ReflCalc->LayerDepth(n-1);
  1922. }
  1923. Complex con = SR_SN(3, 0) * std::exp(ReflCalc->uk*ReflCalc->tx_z - ReflCalc->um*ReflCalc->rx_z+ p);
  1924. if (ReflCalc->layr < ReflCalc->Earth->GetNumberOfLayers()-1) {
  1925. con += SR_SN(3, 2) * ReflCalc->rtd(ReflCalc->layr) * std::exp(ReflCalc->uk*ReflCalc->tx_z-
  1926. ReflCalc->um*((Real)(2.)*ReflCalc->LayerDepth(ReflCalc->layr)-ReflCalc->rx_z)+p);
  1927. }
  1928. return ra*a*con*ReflCalc->um*ReflCalc->uk;
  1929. }
  1930. template<>
  1931. Complex KernelEM1DSpec<TE, 1, INAIR, INGROUND>::RelPotentialBelowSourceLayer(const Real &ra) {
  1932. Complex con = SR_SN(3, 0) * ReflCalc->relexp_pbs1;
  1933. if (ReflCalc->layr < ReflCalc->Earth->GetNumberOfLayers()-1) {
  1934. con += SR_SN(3, 2) * ReflCalc->rtd(ReflCalc->layr) * ReflCalc->relexp_pbs2;
  1935. }
  1936. return ra*ReflCalc->rel_a*con*ReflCalc->um*ReflCalc->uk;
  1937. }
  1938. template<>
  1939. Complex KernelEM1DSpec<TE, 2, INAIR, INGROUND>::PotentialBelowSourceLayer(const Real &ra) {
  1940. Complex dd = ((Real)(1.)+ReflCalc->rtd(1)*ReflCalc->cf(1));
  1941. Complex a = ((Real)(1.) + ReflCalc->rtd(0)) / dd;
  1942. if (ReflCalc->layr >= 2) {
  1943. for (int n=2; n<=ReflCalc->layr; ++n) {
  1944. a *= ((Real)(1.)+ReflCalc->rtd(n-1));
  1945. if (n < ReflCalc->nlay-1) {
  1946. a /= ((Real)(1.)+ReflCalc->rtd(n)*ReflCalc->cf(n));
  1947. }
  1948. }
  1949. }
  1950. Complex p(0,0);
  1951. for (int n=1; n<=ReflCalc->layr; ++n) {
  1952. Complex ut = ReflCalc->u(0);
  1953. if (n>1) {
  1954. ut = ReflCalc->u(n-1);
  1955. }
  1956. p += (ReflCalc->u(n)-ut) * ReflCalc->LayerDepth(n-1);
  1957. }
  1958. Complex con = SR_SN(0, 0) * std::exp(ReflCalc->uk*ReflCalc->tx_z - ReflCalc->um*ReflCalc->rx_z+ p);
  1959. if (ReflCalc->layr < ReflCalc->Earth->GetNumberOfLayers()-1) {
  1960. con += SR_SN(0, 2) * ReflCalc->rtd(ReflCalc->layr) * std::exp(ReflCalc->uk*ReflCalc->tx_z-
  1961. ReflCalc->um*((Real)(2.)*ReflCalc->LayerDepth(ReflCalc->layr)-ReflCalc->rx_z)+p);
  1962. }
  1963. return ra*a*con;
  1964. }
  1965. template<>
  1966. Complex KernelEM1DSpec<TE, 2, INAIR, INGROUND>::RelPotentialBelowSourceLayer(const Real &ra) {
  1967. Complex con = SR_SN(0, 0) * ReflCalc->relexp_pbs1;
  1968. if (ReflCalc->layr < ReflCalc->Earth->GetNumberOfLayers()-1) {
  1969. con += SR_SN(0, 2) * ReflCalc->rtd(ReflCalc->layr) * ReflCalc->relexp_pbs2;
  1970. }
  1971. return ra*ReflCalc->rel_a*con;
  1972. }
  1973. template<>
  1974. Complex KernelEM1DSpec<TE, 3, INAIR, INGROUND>::PotentialBelowSourceLayer(const Real &ra) {
  1975. Complex dd = ((Real)(1.)+ReflCalc->rtd(1)*ReflCalc->cf(1));
  1976. Complex a = ((Real)(1.) + ReflCalc->rtd(0)) / dd;
  1977. if (ReflCalc->layr >= 2) {
  1978. for (int n=2; n<=ReflCalc->layr; ++n) {
  1979. a *= ((Real)(1.)+ReflCalc->rtd(n-1));
  1980. if (n < ReflCalc->nlay-1) {
  1981. a /= ((Real)(1.)+ReflCalc->rtd(n)*ReflCalc->cf(n));
  1982. }
  1983. }
  1984. }
  1985. Complex p(0,0);
  1986. for (int n=1; n<=ReflCalc->layr; ++n) {
  1987. Complex ut = ReflCalc->u(0);
  1988. if (n>1) {
  1989. ut = ReflCalc->u(n-1);
  1990. }
  1991. p += (ReflCalc->u(n)-ut) * ReflCalc->LayerDepth(n-1);
  1992. }
  1993. Complex con = SR_SN(0, 0) * std::exp(ReflCalc->uk*ReflCalc->tx_z - ReflCalc->um*ReflCalc->rx_z+ p);
  1994. if (ReflCalc->layr < ReflCalc->Earth->GetNumberOfLayers()-1) {
  1995. con += SR_SN(0, 2) * ReflCalc->rtd(ReflCalc->layr) * std::exp(ReflCalc->uk*ReflCalc->tx_z-
  1996. ReflCalc->um*((Real)(2.)*ReflCalc->LayerDepth(ReflCalc->layr)-ReflCalc->rx_z)+p);
  1997. }
  1998. return ra*a*con;
  1999. }
  2000. template<>
  2001. Complex KernelEM1DSpec<TE, 3, INAIR, INGROUND>::RelPotentialBelowSourceLayer(const Real &ra) {
  2002. Complex con = SR_SN(0, 0) * ReflCalc->relexp_pbs1;
  2003. if (ReflCalc->layr < ReflCalc->Earth->GetNumberOfLayers()-1) {
  2004. con += SR_SN(0, 2) * ReflCalc->rtd(ReflCalc->layr) * ReflCalc->relexp_pbs2;
  2005. }
  2006. return ra*ReflCalc->rel_a*con;
  2007. }
  2008. template<>
  2009. Complex KernelEM1DSpec<TE, 4, INAIR, INGROUND>::PotentialBelowSourceLayer(const Real &ra) {
  2010. Complex dd = ((Real)(1.)+ReflCalc->rtd(1)*ReflCalc->cf(1));
  2011. Complex a = ((Real)(1.) + ReflCalc->rtd(0)) / dd;
  2012. if (ReflCalc->layr >= 2) {
  2013. for (int n=2; n<=ReflCalc->layr; ++n) {
  2014. a *= ((Real)(1.)+ReflCalc->rtd(n-1));
  2015. if (n < ReflCalc->nlay-1) {
  2016. a /= ((Real)(1.)+ReflCalc->rtd(n)*ReflCalc->cf(n));
  2017. }
  2018. }
  2019. }
  2020. Complex p(0,0);
  2021. for (int n=1; n<=ReflCalc->layr; ++n) {
  2022. Complex ut = ReflCalc->u(0);
  2023. if (n>1) {
  2024. ut = ReflCalc->u(n-1);
  2025. }
  2026. p += (ReflCalc->u(n)-ut) * ReflCalc->LayerDepth(n-1);
  2027. }
  2028. Complex con = SR_SN(2, 0) * std::exp(ReflCalc->uk*ReflCalc->tx_z - ReflCalc->um*ReflCalc->rx_z+ p);
  2029. if (ReflCalc->layr < ReflCalc->Earth->GetNumberOfLayers()-1) {
  2030. con += SR_SN(2, 2) * ReflCalc->rtd(ReflCalc->layr) * std::exp(ReflCalc->uk*ReflCalc->tx_z-
  2031. ReflCalc->um*((Real)(2.)*ReflCalc->LayerDepth(ReflCalc->layr)-ReflCalc->rx_z)+p);
  2032. }
  2033. return ra*a*con*ReflCalc->uk;
  2034. }
  2035. template<>
  2036. Complex KernelEM1DSpec<TE, 4, INAIR, INGROUND>::RelPotentialBelowSourceLayer(const Real &ra) {
  2037. Complex con = SR_SN(2, 0) * ReflCalc->relexp_pbs1;
  2038. if (ReflCalc->layr < ReflCalc->Earth->GetNumberOfLayers()-1) {
  2039. con += SR_SN(2, 2) * ReflCalc->rtd(ReflCalc->layr) * ReflCalc->relexp_pbs2;
  2040. }
  2041. return ra*ReflCalc->rel_a*con*ReflCalc->uk;
  2042. }
  2043. template<>
  2044. Complex KernelEM1DSpec<TE, 5, INAIR, INGROUND>::PotentialBelowSourceLayer(const Real &ra) {
  2045. Complex dd = ((Real)(1.)+ReflCalc->rtd(1)*ReflCalc->cf(1));
  2046. Complex a = ((Real)(1.) + ReflCalc->rtd(0)) / dd;
  2047. if (ReflCalc->layr >= 2) {
  2048. for (int n=2; n<=ReflCalc->layr; ++n) {
  2049. a *= ((Real)(1.)+ReflCalc->rtd(n-1));
  2050. if (n < ReflCalc->nlay-1) {
  2051. a /= ((Real)(1.)+ReflCalc->rtd(n)*ReflCalc->cf(n));
  2052. }
  2053. }
  2054. }
  2055. Complex p(0,0);
  2056. for (int n=1; n<=ReflCalc->layr; ++n) {
  2057. Complex ut = ReflCalc->u(0);
  2058. if (n>1) {
  2059. ut = ReflCalc->u(n-1);
  2060. }
  2061. p += (ReflCalc->u(n)-ut) * ReflCalc->LayerDepth(n-1);
  2062. }
  2063. Complex con = SR_SN(2, 0) * std::exp(ReflCalc->uk*ReflCalc->tx_z - ReflCalc->um*ReflCalc->rx_z+ p);
  2064. if (ReflCalc->layr < ReflCalc->Earth->GetNumberOfLayers()-1) {
  2065. con += SR_SN(2, 2) * ReflCalc->rtd(ReflCalc->layr) * std::exp(ReflCalc->uk*ReflCalc->tx_z-
  2066. ReflCalc->um*((Real)(2.)*ReflCalc->LayerDepth(ReflCalc->layr)-ReflCalc->rx_z)+p);
  2067. }
  2068. return ra*a*con*ReflCalc->uk;
  2069. }
  2070. template<>
  2071. Complex KernelEM1DSpec<TE, 5, INAIR, INGROUND>::RelPotentialBelowSourceLayer(const Real &ra) {
  2072. Complex con = SR_SN(2, 0) * ReflCalc->relexp_pbs1;
  2073. if (ReflCalc->layr < ReflCalc->Earth->GetNumberOfLayers()-1) {
  2074. con += SR_SN(2, 2) * ReflCalc->rtd(ReflCalc->layr) * ReflCalc->relexp_pbs2;
  2075. }
  2076. return ra*ReflCalc->rel_a*con*ReflCalc->uk;
  2077. }
  2078. template<>
  2079. Complex KernelEM1DSpec<TE, 6, INAIR, INGROUND>::PotentialBelowSourceLayer(const Real &ra) {
  2080. Complex dd = ((Real)(1.)+ReflCalc->rtd(1)*ReflCalc->cf(1));
  2081. Complex a = ((Real)(1.) + ReflCalc->rtd(0)) / dd;
  2082. if (ReflCalc->layr >= 2) {
  2083. for (int n=2; n<=ReflCalc->layr; ++n) {
  2084. a *= ((Real)(1.)+ReflCalc->rtd(n-1));
  2085. if (n < ReflCalc->nlay-1) {
  2086. a /= ((Real)(1.)+ReflCalc->rtd(n)*ReflCalc->cf(n));
  2087. }
  2088. }
  2089. }
  2090. Complex p(0,0);
  2091. for (int n=1; n<=ReflCalc->layr; ++n) {
  2092. Complex ut = ReflCalc->u(0);
  2093. if (n>1) {
  2094. ut = ReflCalc->u(n-1);
  2095. }
  2096. p += (ReflCalc->u(n)-ut) * ReflCalc->LayerDepth(n-1);
  2097. }
  2098. Complex con = SR_SN(2, 0) * std::exp(ReflCalc->uk*ReflCalc->tx_z - ReflCalc->um*ReflCalc->rx_z+ p);
  2099. if (ReflCalc->layr < ReflCalc->Earth->GetNumberOfLayers()-1) {
  2100. con += SR_SN(2, 2) * ReflCalc->rtd(ReflCalc->layr) * std::exp(ReflCalc->uk*ReflCalc->tx_z-
  2101. ReflCalc->um*((Real)(2.)*ReflCalc->LayerDepth(ReflCalc->layr)-ReflCalc->rx_z)+p);
  2102. }
  2103. return ra*a*con*ReflCalc->uk;
  2104. }
  2105. template<>
  2106. Complex KernelEM1DSpec<TE, 6, INAIR, INGROUND>::RelPotentialBelowSourceLayer(const Real &ra) {
  2107. Complex con = SR_SN(2, 0) * ReflCalc->relexp_pbs1;
  2108. if (ReflCalc->layr < ReflCalc->Earth->GetNumberOfLayers()-1) {
  2109. con += SR_SN(2, 2) * ReflCalc->rtd(ReflCalc->layr) * ReflCalc->relexp_pbs2;
  2110. }
  2111. return ra*ReflCalc->rel_a*con*ReflCalc->uk;
  2112. }
  2113. template<>
  2114. Complex KernelEM1DSpec<TE, 7, INAIR, INGROUND>::PotentialBelowSourceLayer(const Real &ra) {
  2115. Complex dd = ((Real)(1.)+ReflCalc->rtd(1)*ReflCalc->cf(1));
  2116. Complex a = ((Real)(1.) + ReflCalc->rtd(0)) / dd;
  2117. if (ReflCalc->layr >= 2) {
  2118. for (int n=2; n<=ReflCalc->layr; ++n) {
  2119. a *= ((Real)(1.)+ReflCalc->rtd(n-1));
  2120. if (n < ReflCalc->nlay-1) {
  2121. a /= ((Real)(1.)+ReflCalc->rtd(n)*ReflCalc->cf(n));
  2122. }
  2123. }
  2124. }
  2125. Complex p(0,0);
  2126. for (int n=1; n<=ReflCalc->layr; ++n) {
  2127. Complex ut = ReflCalc->u(0);
  2128. if (n>1) {
  2129. ut = ReflCalc->u(n-1);
  2130. }
  2131. p += (ReflCalc->u(n)-ut) * ReflCalc->LayerDepth(n-1);
  2132. }
  2133. Complex con = SR_SN(1, 0) * std::exp(ReflCalc->uk*ReflCalc->tx_z - ReflCalc->um*ReflCalc->rx_z+ p);
  2134. if (ReflCalc->layr < ReflCalc->Earth->GetNumberOfLayers()-1) {
  2135. con += SR_SN(1, 2) * ReflCalc->rtd(ReflCalc->layr) * std::exp(ReflCalc->uk*ReflCalc->tx_z-
  2136. ReflCalc->um*((Real)(2.)*ReflCalc->LayerDepth(ReflCalc->layr)-ReflCalc->rx_z)+p);
  2137. }
  2138. return ra*a*con*ReflCalc->um;
  2139. }
  2140. template<>
  2141. Complex KernelEM1DSpec<TE, 7, INAIR, INGROUND>::RelPotentialBelowSourceLayer(const Real &ra) {
  2142. Complex con = SR_SN(1, 0) * ReflCalc->relexp_pbs1;
  2143. if (ReflCalc->layr < ReflCalc->Earth->GetNumberOfLayers()-1) {
  2144. con += SR_SN(1, 2) * ReflCalc->rtd(ReflCalc->layr) * ReflCalc->relexp_pbs2;
  2145. }
  2146. return ra*ReflCalc->rel_a*con*ReflCalc->um;
  2147. }
  2148. template<>
  2149. Complex KernelEM1DSpec<TE, 8, INAIR, INGROUND>::PotentialBelowSourceLayer(const Real &ra) {
  2150. Complex dd = ((Real)(1.)+ReflCalc->rtd(1)*ReflCalc->cf(1));
  2151. Complex a = ((Real)(1.) + ReflCalc->rtd(0)) / dd;
  2152. if (ReflCalc->layr >= 2) {
  2153. for (int n=2; n<=ReflCalc->layr; ++n) {
  2154. a *= ((Real)(1.)+ReflCalc->rtd(n-1));
  2155. if (n < ReflCalc->nlay-1) {
  2156. a /= ((Real)(1.)+ReflCalc->rtd(n)*ReflCalc->cf(n));
  2157. }
  2158. }
  2159. }
  2160. Complex p(0,0);
  2161. for (int n=1; n<=ReflCalc->layr; ++n) {
  2162. Complex ut = ReflCalc->u(0);
  2163. if (n>1) {
  2164. ut = ReflCalc->u(n-1);
  2165. }
  2166. p += (ReflCalc->u(n)-ut) * ReflCalc->LayerDepth(n-1);
  2167. }
  2168. Complex con = SR_SN(1, 0) * std::exp(ReflCalc->uk*ReflCalc->tx_z - ReflCalc->um*ReflCalc->rx_z+ p);
  2169. if (ReflCalc->layr < ReflCalc->Earth->GetNumberOfLayers()-1) {
  2170. con += SR_SN(1, 2) * ReflCalc->rtd(ReflCalc->layr) * std::exp(ReflCalc->uk*ReflCalc->tx_z-
  2171. ReflCalc->um*((Real)(2.)*ReflCalc->LayerDepth(ReflCalc->layr)-ReflCalc->rx_z)+p);
  2172. }
  2173. return ra*a*con*ReflCalc->um;
  2174. }
  2175. template<>
  2176. Complex KernelEM1DSpec<TE, 8, INAIR, INGROUND>::RelPotentialBelowSourceLayer(const Real &ra) {
  2177. Complex con = SR_SN(1, 0) * ReflCalc->relexp_pbs1;
  2178. if (ReflCalc->layr < ReflCalc->Earth->GetNumberOfLayers()-1) {
  2179. con += SR_SN(1, 2) * ReflCalc->rtd(ReflCalc->layr) * ReflCalc->relexp_pbs2;
  2180. }
  2181. return ra*ReflCalc->rel_a*con*ReflCalc->um;
  2182. }
  2183. template<>
  2184. Complex KernelEM1DSpec<TE, 9, INAIR, INGROUND>::PotentialBelowSourceLayer(const Real &ra) {
  2185. Complex dd = ((Real)(1.)+ReflCalc->rtd(1)*ReflCalc->cf(1));
  2186. Complex a = ((Real)(1.) + ReflCalc->rtd(0)) / dd;
  2187. if (ReflCalc->layr >= 2) {
  2188. for (int n=2; n<=ReflCalc->layr; ++n) {
  2189. a *= ((Real)(1.)+ReflCalc->rtd(n-1));
  2190. if (n < ReflCalc->nlay-1) {
  2191. a /= ((Real)(1.)+ReflCalc->rtd(n)*ReflCalc->cf(n));
  2192. }
  2193. }
  2194. }
  2195. Complex p(0,0);
  2196. for (int n=1; n<=ReflCalc->layr; ++n) {
  2197. Complex ut = ReflCalc->u(0);
  2198. if (n>1) {
  2199. ut = ReflCalc->u(n-1);
  2200. }
  2201. p += (ReflCalc->u(n)-ut) * ReflCalc->LayerDepth(n-1);
  2202. }
  2203. Complex con = SR_SN(0, 0) * std::exp(ReflCalc->uk*ReflCalc->tx_z - ReflCalc->um*ReflCalc->rx_z+ p);
  2204. if (ReflCalc->layr < ReflCalc->Earth->GetNumberOfLayers()-1) {
  2205. con += SR_SN(0, 2) * ReflCalc->rtd(ReflCalc->layr) * std::exp(ReflCalc->uk*ReflCalc->tx_z-
  2206. ReflCalc->um*((Real)(2.)*ReflCalc->LayerDepth(ReflCalc->layr)-ReflCalc->rx_z)+p);
  2207. }
  2208. return ra*a*con;
  2209. }
  2210. template<>
  2211. Complex KernelEM1DSpec<TE, 9, INAIR, INGROUND>::RelPotentialBelowSourceLayer(const Real &ra) {
  2212. Complex con = SR_SN(0, 0) * ReflCalc->relexp_pbs1;
  2213. if (ReflCalc->layr < ReflCalc->Earth->GetNumberOfLayers()-1) {
  2214. con += SR_SN(0, 2) * ReflCalc->rtd(ReflCalc->layr) * ReflCalc->relexp_pbs2;
  2215. }
  2216. return ra*ReflCalc->rel_a*con;
  2217. }
  2218. template<>
  2219. Complex KernelEM1DSpec<TE, 10, INAIR, INGROUND>::PotentialBelowSourceLayer(const Real &ra) {
  2220. Complex dd = ((Real)(1.)+ReflCalc->rtd(1)*ReflCalc->cf(1));
  2221. Complex a = ((Real)(1.) + ReflCalc->rtd(0)) / dd;
  2222. if (ReflCalc->layr >= 2) {
  2223. for (int n=2; n<=ReflCalc->layr; ++n) {
  2224. a *= ((Real)(1.)+ReflCalc->rtd(n-1));
  2225. if (n < ReflCalc->nlay-1) {
  2226. a /= ((Real)(1.)+ReflCalc->rtd(n)*ReflCalc->cf(n));
  2227. }
  2228. }
  2229. }
  2230. Complex p(0,0);
  2231. for (int n=1; n<=ReflCalc->layr; ++n) {
  2232. Complex ut = ReflCalc->u(0);
  2233. if (n>1) {
  2234. ut = ReflCalc->u(n-1);
  2235. }
  2236. p += (ReflCalc->u(n)-ut) * ReflCalc->LayerDepth(n-1);
  2237. }
  2238. Complex con = SR_SN(ReflCalc->id-1, 0) * std::exp(ReflCalc->uk*ReflCalc->tx_z - ReflCalc->um*ReflCalc->rx_z+ p);
  2239. if (ReflCalc->layr < ReflCalc->Earth->GetNumberOfLayers()-1) {
  2240. con += SR_SN(ReflCalc->id-1, 2) * ReflCalc->rtd(ReflCalc->layr) * std::exp(ReflCalc->uk*ReflCalc->tx_z-
  2241. ReflCalc->um*((Real)(2.)*ReflCalc->LayerDepth(ReflCalc->layr)-ReflCalc->rx_z)+p);
  2242. }
  2243. return ra*a*con*ReflCalc->um;
  2244. }
  2245. template<>
  2246. Complex KernelEM1DSpec<TE, 10, INAIR, INGROUND>::RelPotentialBelowSourceLayer(const Real &ra) {
  2247. Complex con = SR_SN(ReflCalc->id-1, 0) * ReflCalc->relexp_pbs1;
  2248. if (ReflCalc->layr < ReflCalc->Earth->GetNumberOfLayers()-1) {
  2249. con += SR_SN(ReflCalc->id-1, 2) * ReflCalc->rtd(ReflCalc->layr) * ReflCalc->relexp_pbs2;
  2250. }
  2251. return ra*ReflCalc->rel_a*con*ReflCalc->um;
  2252. }
  2253. template<>
  2254. Complex KernelEM1DSpec<TE, 11, INAIR, INGROUND>::PotentialBelowSourceLayer(const Real &ra) {
  2255. Complex dd = ((Real)(1.)+ReflCalc->rtd(1)*ReflCalc->cf(1));
  2256. Complex a = ((Real)(1.) + ReflCalc->rtd(0)) / dd;
  2257. if (ReflCalc->layr >= 2) {
  2258. for (int n=2; n<=ReflCalc->layr; ++n) {
  2259. a *= ((Real)(1.)+ReflCalc->rtd(n-1));
  2260. if (n < ReflCalc->nlay-1) {
  2261. a /= ((Real)(1.)+ReflCalc->rtd(n)*ReflCalc->cf(n));
  2262. }
  2263. }
  2264. }
  2265. Complex p(0,0);
  2266. for (int n=1; n<=ReflCalc->layr; ++n) {
  2267. Complex ut = ReflCalc->u(0);
  2268. if (n>1) {
  2269. ut = ReflCalc->u(n-1);
  2270. }
  2271. p += (ReflCalc->u(n)-ut) * ReflCalc->LayerDepth(n-1);
  2272. }
  2273. Complex con = SR_SN(ReflCalc->id-1, 0) * std::exp(ReflCalc->uk*ReflCalc->tx_z - ReflCalc->um*ReflCalc->rx_z+ p);
  2274. if (ReflCalc->layr < ReflCalc->Earth->GetNumberOfLayers()-1) {
  2275. con += SR_SN(ReflCalc->id-1, 2) * ReflCalc->rtd(ReflCalc->layr) * std::exp(ReflCalc->uk*ReflCalc->tx_z-
  2276. ReflCalc->um*((Real)(2.)*ReflCalc->LayerDepth(ReflCalc->layr)-ReflCalc->rx_z)+p);
  2277. }
  2278. return ra*a*con;
  2279. }
  2280. template<>
  2281. Complex KernelEM1DSpec<TE, 11, INAIR, INGROUND>::RelPotentialBelowSourceLayer(const Real &ra) {
  2282. Complex con = SR_SN(ReflCalc->id-1, 0) * ReflCalc->relexp_pbs1;
  2283. if (ReflCalc->layr < ReflCalc->Earth->GetNumberOfLayers()-1) {
  2284. con += SR_SN(ReflCalc->id-1, 2) * ReflCalc->rtd(ReflCalc->layr) * ReflCalc->relexp_pbs2;
  2285. }
  2286. return ra*ReflCalc->rel_a*con;
  2287. }
  2288. template<>
  2289. Complex KernelEM1DSpec<TE, 12, INAIR, INGROUND>::PotentialBelowSourceLayer(const Real &ra) {
  2290. Complex dd = ((Real)(1.)+ReflCalc->rtd(1)*ReflCalc->cf(1));
  2291. Complex a = ((Real)(1.) + ReflCalc->rtd(0)) / dd;
  2292. if (ReflCalc->layr >= 2) {
  2293. for (int n=2; n<=ReflCalc->layr; ++n) {
  2294. a *= ((Real)(1.)+ReflCalc->rtd(n-1));
  2295. if (n < ReflCalc->nlay-1) {
  2296. a /= ((Real)(1.)+ReflCalc->rtd(n)*ReflCalc->cf(n));
  2297. }
  2298. }
  2299. }
  2300. Complex p(0,0);
  2301. for (int n=1; n<=ReflCalc->layr; ++n) {
  2302. Complex ut = ReflCalc->u(0);
  2303. if (n>1) {
  2304. ut = ReflCalc->u(n-1);
  2305. }
  2306. p += (ReflCalc->u(n)-ut) * ReflCalc->LayerDepth(n-1);
  2307. }
  2308. Complex con = SR_SN(ReflCalc->id-1, 0) * std::exp(ReflCalc->uk*ReflCalc->tx_z - ReflCalc->um*ReflCalc->rx_z+ p);
  2309. if (ReflCalc->layr < ReflCalc->Earth->GetNumberOfLayers()-1) {
  2310. con += SR_SN(ReflCalc->id-1, 2) * ReflCalc->rtd(ReflCalc->layr) * std::exp(ReflCalc->uk*ReflCalc->tx_z-
  2311. ReflCalc->um*((Real)(2.)*ReflCalc->LayerDepth(ReflCalc->layr)-ReflCalc->rx_z)+p);
  2312. }
  2313. return ra*a*con;
  2314. }
  2315. template<>
  2316. Complex KernelEM1DSpec<TE, 12, INAIR, INGROUND>::RelPotentialBelowSourceLayer(const Real &ra) {
  2317. Complex con = SR_SN(ReflCalc->id-1, 0) * ReflCalc->relexp_pbs1;
  2318. if (ReflCalc->layr < ReflCalc->Earth->GetNumberOfLayers()-1) {
  2319. con += SR_SN(ReflCalc->id-1, 2) * ReflCalc->rtd(ReflCalc->layr) * ReflCalc->relexp_pbs2;
  2320. }
  2321. return ra*ReflCalc->rel_a*con;
  2322. }
  2323. } // ----- end of :Lemma name -----