1 #ifndef _Delta_h_
2 #define _Delta_h_
3 /* Delta.h
4  *
5  * Copyright (C) 1992-2005,2007,2011,2015-2017,2019 Paul Boersma
6  *
7  * This code is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or (at
10  * your option) any later version.
11  *
12  * This code is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15  * See the GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this work. If not, see <http://www.gnu.org/licenses/>.
19  */
20 
21 #include "Thing.h"
22 
23 typedef struct structDelta_Tube *Delta_Tube;
24 struct structDelta_Tube
25 {
26 	/* Structure: static. */
27 
28 	Delta_Tube left1;   // if null: closed at left edge
29 	Delta_Tube left2;   // if not null: two merging streams
30 	Delta_Tube right1;  // if null: radiation at right edge
31 	Delta_Tube right2;  // if not null: a stream splitting into two
32 	integer parallel;   // parallel subdivision
33 
34 	/* Controlled by articulation: quasistatic. */
35 
36 	double Dxeq, Dyeq, Dzeq;
37 	double mass, k1, k3, Brel, s1, s3, dy;
38 	double k1left1, k1left2, k1right1, k1right2;   // linear coupling factors
39 	double k3left1, k3left2, k3right1, k3right2;   // cubic coupling factors
40 
41 	/* Dynamic. */
42 
43 	double Jhalf, Jleft, Jleftnew, Jright, Jrightnew;
44 	double Qhalf, Qleft, Qleftnew, Qright, Qrightnew;
45 	double Dx, Dxnew, dDxdt, dDxdtnew, Dxhalf;
46 	double Dy, Dynew, dDydt, dDydtnew;
47 	double Dz;
48 	double A, Ahalf, Anew, V, Vnew;
49 	double e, ehalf, eleft, eleftnew, eright, erightnew, ehalfold;
50 	double p, phalf, pleft, pleftnew, pright, prightnew;
51 	double Kleft, Kleftnew, Kright, Krightnew, Pturbright, Pturbrightnew;
52 	double B, r, R, DeltaP, v;
53 };
54 
Thing_define(Delta,Thing)55 Thing_define (Delta, Thing) {
56 	integer numberOfTubes;           // >= 1
57 	autovector <structDelta_Tube> tubes;
58 };
59 
60 void Delta_init (Delta me, integer numberOfTubes);
61 
62 autoDelta Delta_create (integer numberOfTubes);
63 /*
64 	Function:
65 		return a new Delta.
66 	Preconditions:
67 		numberOfTubes >= 1;
68 	Postconditions:
69 		result -> numberOfTubes = numberOfTubes;
70 		all members of result -> tube [1..numberOfTubes] are zero or null,
71 		except 'parallel', which is 1.
72 */
73 
74 /* End of file Delta.h */
75 #endif
76