Browse code

Добавил тест на СУ, сделал доп. цель в Makefile

Dmitrii Kashin authored on 03/09/2014 21:10:56
Showing 2 changed files
... ...
@@ -2,13 +2,29 @@ CC=g++
2 2
 CFLAGS=-Wall -g -ggdb
3 3
 LDFLAGS=-lm
4 4
 #SOURCES=frolov.c grid1d.c vars.c initgrid.c convergence.c solver.c
5
-SOURCES=main.cxx variables.cxx cell.cxx grid.cxx grid-init-monotonous.cxx solver.cxx timestep_constant.cxx march.cxx
6
-OBJECTS=$(SOURCES:.cxx=.o)
5
+SOURCES=main.cxx variables.cxx cell.cxx grid.cxx solver.cxx timestep_constant.cxx march.cxx
6
+OBJECTS=$(SOURCES:.cxx=.o) grid-init.o
7 7
 DEPENDS=$(OBJECTS:.o=.deps)
8 8
 EXECUTABLE=frolov
9 9
 
10
-all: $(EXECUTABLE)
10
+all:
11
+	@echo "syntax: make test-*"
12
+	@echo "See Makefile in order to know the aims"
11 13
 
14
+build: $(EXECUTABLE)
15
+
16
+# tests
17
+test-mono: 
18
+	make grid-init-monotonous.o
19
+	ln -f grid-init-monotonous.o grid-init.o
20
+	make build
21
+
22
+test-shock1:
23
+	make grid-init-shock1.o
24
+	ln -f grid-init-shock1.o grid-init.o
25
+	make build
26
+
27
+# the main aim
12 28
 $(EXECUTABLE): $(OBJECTS) 
13 29
 	$(CC) $(CFLAGS) $(LDFLAGS) $(OBJECTS) -o $@
14 30
 
... ...
@@ -9,4 +9,26 @@
9 9
 void
10 10
 set_initial_field(Grid1D& grid)
11 11
 {
12
-double phi = 
12
+double phi_L = 0.999999;
13
+double rho_L = 1; // [kg/m^3]
14
+double Ug_L = 400; // [m/s]
15
+double Ul_L = 400; // [m/s]
16
+
17
+double phi_R = phi_L;
18
+double Ug_R = sos*sos/(kappa*Ug_L);
19
+double Ul_R = sos*sos/(kappa*Ul_L);
20
+double rho_R = rho_L * Ug_L/Ug_R;
21
+
22
+ConservVars lv = primitive2conserv((PrimitiveVars){phi_L,rho_L,Ug_L,Ul_L});
23
+ConservVars rv = primitive2conserv((PrimitiveVars){phi_R,rho_R,Ug_R,Ul_R});
24
+
25
+grid.lbc.vars = lv;
26
+grid.rbc.vars = rv;
27
+
28
+for (unsigned int i=0; i<grid.N; i++)
29
+  if (i<grid.N/2)
30
+    grid.cells[i].vars = lv;
31
+  else
32
+    grid.cells[i].vars = rv;
33
+}
34
+