26static double de (
int n,
double *
ha,
double *
hx,
double ** M)
31 for (
int i = 0;
i <
n;
i++) {
34 for (
int j = 0;
j <
n;
j++)
44 if (!
s.harmonic.omega) {
46 for (
double *
o =
omega; *
o > 0.;
o++,
n++);
47 s.harmonic.omega =
malloc(
n*
sizeof(
double));
49 s.harmonic.M = (
double **)
matrix_new (2*
n + 1, 2*
n + 1,
sizeof (
double));
50 s.harmonic.Mn = (
double **)
matrix_new (2*
n + 1, 2*
n + 1,
sizeof (
double));
51 for (
int i = 0;
i < 2*
n + 1;
i++)
52 for (
int j = 0;
j < 2*
n + 1;
j++) {
53 s.harmonic.M[
i][
j] = 0.;
54 s.harmonic.Mn[
i][
j] = (
i ==
j);
59 s.harmonic.A =
s.harmonic.B =
NULL;
60 for (
int i = 0;
i <
n;
i++) {
72 s.harmonic.invertible =
false;
77 double **
Mn =
s.harmonic.Mn;
79 for (
int _a = 0;
_a < 1;
_a++)
83 for (
int i = 0;
i <
n;
i++) {
88 double ** M =
s.harmonic.M;
89 for (
int i = 0;
i <
n;
i++) {
90 for (
int j = 0;
j <
n;
j++) {
99 for (
int j = 0;
j <
n;
j++) {
105 double **
iM = (
double **)
matrix_new (2*
n + 1, 2*
n + 1,
sizeof (
double));
106 for (
int i = 0;
i < 2*
n + 1;
i++)
107 for (
int j = 0;
j < 2*
n + 1;
j++)
110 assert (!
s.harmonic.invertible);
127 double x =
s[],
sx2 = 0.;
142 for (
int i = 0;
i < 2*
n + 1;
i++) {
144 for (
int j = 0;
j < 2*
n + 1;
j++)
149 if (
s.harmonic.invertible)
156 for (
int i = 0;
i <
n;
i++) {
163 for (
int i = 0;
i < 2*
n + 1;
i++) {
165 for (
int j = 0;
j < 2*
n + 1;
j++)
180 s.harmonic.invertible =
true;
181 for (
int i = 0;
i < 2*
n + 1;
i++)
182 for (
int j = 0;
j < 2*
n + 1;
j++)
191 for (
int _s = 0;
_s < 1;
_s++)
192 if (
s.harmonic.omega) {
193 free (
s.harmonic.omega);
s.harmonic.omega =
NULL;
198 delete (
s.harmonic.A);
200 delete (
s.harmonic.B);
void matrix_free(void *m)
void * matrix_new(int n, int=(type *) realloc(p,(size) *sizeof(type)) p=(type *) realloc(p,(size) *sizeof(type)), size_t size)
double matrix_inverse(double **m, int n, double pivmin)
scalar * list_append(scalar *list, scalar s)
define sysmalloc malloc define syscalloc calloc define sysrealloc realloc define sysfree free define systrdup strdup define line line line line strdup(s) @ define tracing(...) @ define end_tracing(...) @define tid() 0 @define pid() 0 @define npe() 1 @define mpi_all_reduce(v
*cs[i, 0, 0] a *[i -1, 0, 0] j
static double de(int n, double *ha, double *hx, double **M)
void event_cleanup(void)
Event: cleanup (t = end)
void harmonic_decomposition(scalar s, double t, double *omega, scalar e={-1})
scalar omega[]
We allocate the vorticity field , the streamfunction field and a structure to store the statistics o...