Commit 6d6d97dba5a0433da1dda2dbc9009d2b981f3877

Authored by Erdogan Furkan
1 parent c6024146
Exists in master

libkt17 - Minor fix

Showing 1 changed file with 137 additions and 0 deletions   Show diff stats
libkt/libkt.h 0 → 100644
... ... @@ -0,0 +1,137 @@
  1 +#ifndef __LIBKT_H__
  2 +#define __LIBKT_H__
  3 +#include <stdio.h>
  4 +#include <stdlib.h>
  5 +
  6 +extern "C" {
  7 + /***********************************************************************
  8 + * NAME : void ModelField(n,x,y,z,lP,nP,Params,Bx,By,Bz)
  9 + *
  10 + * DESCRIPTION : Calculate the KT14/17 magnetic field.
  11 + *
  12 + * INPUTS :
  13 + * int n Number field vectors to find.
  14 + * double *x Position array (Rm).
  15 + * double *y Position array (Rm).
  16 + * double *z Position array (Rm).
  17 + * int lP Number or sets of parameters.
  18 + * int nP Number of parameters (2 or 3)
  19 + * double **Params 2D array of parameters, shape (lP,nP)
  20 + *
  21 + * OUTPUTS :
  22 + * double *Bx Output magnetic field (nT).
  23 + * double *By Output magnetic field (nT).
  24 + * double *Bz Output magnetic field (nT).
  25 + *
  26 + * ********************************************************************/
  27 + void ModelField(int n, double *x, double *y, double *z,
  28 + int lP, int nP, double **Params,
  29 + double *Bx, double *By, double *Bz);
  30 +
  31 +
  32 + /***********************************************************************
  33 + * NAME : void TraceField(n,x0,y0,z0,nP,P0,P1,P2,BoundMP,BoundTail,
  34 + * BoundSurface,MaxLen,MaxStep,InitStep,
  35 + * MinStep,ErrMax,Delta,Verbose,TraceDir,nstep,
  36 + * x,y,z,Bx,By,Bz,Rmsm,Rmso,S,Rnorm,FP,nalpha,
  37 + * alpha,halpha)
  38 + *
  39 + * DESCRIPTION : Trace field lines using the KT14/17 model.
  40 + *
  41 + * INPUTS :
  42 + * int n number of traces.
  43 + * double *x Trace start position MSM (Rm)
  44 + * double *y Trace start position MSM (Rm)
  45 + * double *z Trace start position MSM (Rm)
  46 + * int nP Number of parameters 2(KT17) or 3(KT14).
  47 + * double *P0 Rsun in AU (KT17) or Rsm in Rm (KT14)
  48 + * double *P1 Disturbance index from 0-97 (KT17) or t1 disk
  49 + * magnitude (KT14).
  50 + * double *P2 Unused (KT17) or t2 quasi harris sheet magnitude
  51 + * (KT14).
  52 + * bool BoundMP If true, then the trace will stop at the
  53 + * magnetopause.
  54 + * double BoundTail X limit to stop trace in magnetotail,
  55 + * ignored if positive.
  56 + * int BoundSurface Surface on which to end the field trace:
  57 + * 1 - Stop at the planetary surface
  58 + * 2 - Stop at the planetary core (0.832 Rm).
  59 + * 3 - Stop at dipole at 1 Rm
  60 + * 4 - Stop at dipole at 0.832 Rm (core radius)
  61 + * 5 - Stop at northern surface, southern dipole at
  62 + * 1 Rm (virtual surface).
  63 + * 6 - Stop at northern core and southern dipole at
  64 + * 0.832 Rm.
  65 + * int MaxLen Maximum length of each trace.
  66 + * double MaxStep Maximum step size (Rm)
  67 + * double InitStep Initial step size (Rm)
  68 + * double MinStep Minimum step size (Rm)
  69 + * double ErrMax Maximum error.
  70 + * double Delta Distance between adjacent field lines (Rm) to be
  71 + * used int he calculation of h_alpha.
  72 + * bool Verbose Display tracing progress.
  73 + * int TraceDir Direction in which to trace:
  74 + * 0 - trace in both directions
  75 + * 1 - along the field (towards north)
  76 + * -1 - opposite to the field (towards south)
  77 + * int nalpha The number of alpha values.
  78 + * double *alpha Array of alphas (degrees) 0 = toroidal.
  79 + *
  80 + * OUTPUTS :
  81 + * int *nstep Number of trace steps
  82 + * double **x Trace positions
  83 + * double **y Trace positions
  84 + * double **z Trace positions
  85 + * double **Bx Trace field
  86 + * double **By Trace field
  87 + * double **Bz Trace field
  88 + * double **Rmsm Trace radial coordinates (MSM)
  89 + * double **Rmso Trace radial coordinates (MSO)
  90 + * double **S Trace distance.
  91 + * double **Rnorm Array of Rnorms.
  92 + * double **FP Output footprint coords, shape (n,18), where n
  93 + * is the number of traces and the elements in the
  94 + * 2nd dimension correspond to the following
  95 + * footprints:
  96 + * 0: North planetary latitude
  97 + * 1: North planetary local time
  98 + * 2: South planetary latitude
  99 + * 3: South planetary local time
  100 + * 4: North core latitude
  101 + * 5: North core local time
  102 + * 6: South core latitude
  103 + * 7: South core local time
  104 + * 8: North dipole R=1 latitude
  105 + * 9: North dipole R=1 local time
  106 + * 10: South dipole R=1 latitude
  107 + * 11: South dipole R=1 local time
  108 + * 12: North dipole R=0.832 latitude
  109 + * 13: North dipole R=0.832 local time
  110 + * 14: South dipole R=0.832 latitude
  111 + * 15: South dipole R=0.832 local time
  112 + * 16: L-shell
  113 + * 17: Equatorial footprint magnetic local time.
  114 + *
  115 + * NOTE: core is assumed to be a sphere at
  116 + * Rmso = 0.832 Rm and the dipole footprints
  117 + * are footprints on a sphere centered on the
  118 + * dipole rather than the planet itself.
  119 + * double *halpha 1-D array containing all trace h_alphas,
  120 + * reshape in Python to (n,nalpha,MaxLen)
  121 + *
  122 + * ********************************************************************/
  123 + void TraceField(int n, double *x0, double *y0, double *z0,
  124 + int nP, double *P0, double *P1, double *P2,
  125 + bool BoundMP, double BoundTail, int BoundSurface,
  126 + int MaxLen, double MaxStep, double InitStep,
  127 + double MinStep, double ErrMax, double Delta,
  128 + bool Verbose, int TraceDir,
  129 + int *nstep,
  130 + double **x, double **y, double **z,
  131 + double **Bx, double **By, double **Bz,
  132 + double **Rmsm, double **Rmso,
  133 + double **S, double **Rnorm, double **FP,
  134 + int nalpha, double *alpha, double *halpha);
  135 +}
  136 +
  137 +#endif
0 138 \ No newline at end of file
... ...