-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfunctions.h
131 lines (87 loc) · 3.54 KB
/
functions.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
/*
* BHAC tools
* Copyright 2024
* Author: Jordy Davelaar
*/
#include "definitions.h"
#include "model_definitions.h"
#ifndef FUNCTIONS_H
#define FUNCTIONS_H
// UNIFORM.C
////////////
void uniform_data_array(double *unif,int param);
// FFT.C
////////
void perform_fft(double TIME_INIT);
void fftfreq(double* freq, int N, double size);
double window_func(double x);
void get_quant(double* unif, fftw_complex *quant );
//LFAC_SPEC.C
/////////////
void compute_lfac_spec(double TIME_INIT);
//PROFILES.C
////////////
void compute_profile(double TIME_INIT);
// IO.C
///////
void write_fft_file(double *freq,double *out, double TIME_INIT);
void write_spec_file(double *spec, double TIME_INIT);
void write_profile_file(double *out,char* param,double TIME_INIT);
// See grmonty paper by Dolence et al.
// HARM model internal utilities
void init_model();
void set_units();
void init_grmhd_data(char *fname);
void init_storage();
void Xtoijk(double *X, int *i, int *j, int *k, double *del);
// void get_fluid_params(double X[4], double *Ne, double *Thetae, double *B,
// double *B_u, double Ucon[4], int *IN_VOLUME);
int get_fluid_params(double X[NDIM], struct GRMHD *modvar);
// IO
// GRMATH.C
///////////
void get_spatial_lc(double lc[NDIM][NDIM][NDIM]);
void get_full_lc(double lc[NDIM][NDIM][NDIM]);
double get_r(double X_u[4]);
// Lowers the index of the contravariant vector V_u, storing the results in
// a covariant one (V_d), based on the metric at position X_u
void lower_index(double X_u[4], double V_u[4], double V_d[4]);
// Lowers two indices of a rank (2, 0) tensor
void lower_two_indices(double N_uu[4][4], double N_dd[4][4], double X_u[4]);
// Lowers the index of a contravariant vector V_u in BL coordinates.
void BL_lower_index(double X_u[4], double V_u[4], double V_d[4]);
// Raises the index of the covariant vector V_d, storing the results in a
// contravariant one (V_u), based on the metric at position X_u
void raise_index(double X_u[4], double V_d[4], double V_u[4]);
// Raises the index of the covariant vector V_d, storing the results in a
// contravariant one (V_u), based on the metric at position X_u
// Needed for CKS coordinates
void raise_index_KS(double X_u[4], double V_d[4], double V_u[4]);
// Adjusts y[4] = U_u[0] so that y describes a lightray/null geodesic
void normalize_null(double X_u[4], double U_u[4]);
// Returns the norm of U_u, which is the scalar g_dd[a][b] * U_u[a] * U_u[b]
double four_velocity_norm(double X_u[4], double U_u[4]);
// Returns the inner product of vectors A and B, i.e. A_u B_d
double inner_product(double *X_u, double *A_u, double *B_u);
// Transform a contravariant vector from BL to KS coordinates
void BL_to_KS_u(double *BLphoton_u, double *KSphoton_u);
// Transform a contravariant vector from KS to BL coordinates
void KS_to_BL_u(double *KSphoton_u, double *BLphoton_u);
// Convert KS to CKS coordinates
void KS_to_CKS(double *X_KS_u, double *X_CKS_u);
// Convert CKS to KS coordinates
void CKS_to_KS(double *X_CKS_u, double *X_KS_u);
// Transform a contravariant vector from KS to CKS coordinates
void KS_to_CKS_u(double *KScoords, double *CKScoords);
// METRIC.C
///////////
// Computes the metric at location X
void metric_dd(double X_u[4], double g_dd[4][4]);
// Computes the inverse metric at location X
void metric_uu(double X_u[4], double g_uu[4][4]);
// Computes the inverse metric at location X
void metric_KS_uu(double X_u[4], double g_uu[4][4]);
// Transformation functions
double Xg2_approx_rand(double Xr2);
double Ug2_approx_rand(double Ur2, double Xg2);
#endif // FUNCTIONS_H