-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathIterAlph.hh
144 lines (116 loc) · 4.62 KB
/
IterAlph.hh
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
132
133
134
135
136
137
/**********************************************************************
* *
* File Name: IterAlpha.hh *
* *
* Class Name: IterAlpha *
* *
* Goal: Advection of alpha with a finite volume method *
* *
* Copyright (C) 04/2002 Arthur Moncorge *
* arthur.moncorge@ensta.org *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
* as published by the Free Software Foundation; either version 2 *
* of the License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the Free Software *
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, *
* MA 02111-1307, USA. *
* *
*********************************************************************/
#ifndef _CLASS_ITERALPH_HH_
#define _CLASS_ITERALPH_HH_
#include<iostream>
#include "Mesh.hh" // for T_edge
#include "mylibrary.hh"
class IterAlph {
public:
struct iteralph_arg {
int Nt;
int Np;
double dt;
double flux_in;
int segINJE;
int nloop;
int limitgrad;
int inject0_1;
// Data arrays
double* area;
struct Mesh::Edge*** T_edge;
// For limitgrad only
double** Ihat;
double** Ixhat;
double** Iyhat;
int* Coort;
double* Coorp;
double* SumMass;
};
//! get global values
IterAlph(struct iteralph_arg iteralph_val);
~IterAlph();
//! not sure what this is! this could be a mistake
void init(struct iteralph_arg iteralph_val);
//! this function is called by prog to start the advection for each timestep
void iteration_alpha(double** flux, double* alpha);
//! take weighted averages of previous fluxes fn fnm1 fnm2 for this timesteps flux.
void extrap_velflux(int N, double frac,
double** fnm2, double** fnm1, double** fn, double** f);
//! given alpha_flux calculated in create_alphaflux advect the fluid into
void advection_alpha(double t, double* alpha, double** flux,
double* new_alpha);
//! calculate the flux of alpha along the segments (from flux and alpha from provious computation) populate alpha_flux
/*! alpha in this function is not `global' alpha. here alpha is a [3][Nt]
which is the alpha on each segment
-- this function is called several times.
*/
void create_alphaflux(double** alpha, double** flux, double** alpha_flux);
//!
void limit_grad(double** alpha);
//!
void limit_grad3(double** alpha);
public:
int Nt;
int Np;
double dt;
double flux_in;
int segINJE;
int nloop;
int limitgrad;
int inject0_1;
// Data arrays
double* area; // double[Nt] area of each triangle
struct Mesh::Edge*** T_edge; //(Edge*)[Nt][3] ptr on edges of triangle
// For limitgrad only
// these are test functions from Mesh::compute_mesh
double** Ihat;
double** Ixhat;
double** Iyhat;
int* Coort;
double* Coorp;
double* SumMass;
// Working arrays
//! double for each triangle for each edge
double** alpha_flux;
//! flux from previous time step (t-3)
double** fnm2;
//! flux from previous time step (t-2)
double** fnm1;
//! flux from previous time step (t-1)
double** fn;
//! [3][Nt] double
double** alpha_seg;
//! alpha on each point used by limitgrad
double* alpha_node;
//! temporary holding place for new alpha values
double* new_alpha;
//! internaly used nonzero for first time step only.
int test_first;
};
#endif // End of _CLASS_ITERALPH_HH_