-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcase_select.py
101 lines (90 loc) · 3.21 KB
/
case_select.py
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
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Mar 20 12:14:27 2021
@author: rmojgani
"""
import numpy as np
def case_select(imperfect_type, case):
lambdas = []
lambdas_imperfect = []
# KS
if imperfect_type == 'KS':
lambdas = [1.0,1.0,1.0]
eqn_str = np.array( ['uu_{x}','u_{xx}','u_{xxxx}'] )
if case == 1:
lambdas_imperfect = [0.0,1.0,1.0]
elif case == 2:
lambdas_imperfect = [1.0,0.0,1.0]
elif case == 3:
lambdas_imperfect = [1.0,1.0,0.0]
elif case == 4:
lambdas_imperfect = [1.0,0.0,0.0]
elif case == 5:
lambdas_imperfect = [0.0,1.0,0.0]
elif case == 6:
lambdas_imperfect = [0.0,0.0,1.0]
elif case == 7:
lambdas_imperfect = [0.5,1.0,1.0]
elif case == 8:
lambdas_imperfect = [1.0,0.5,1.0]
elif case == 9:
lambdas_imperfect = [1.0,1.0,0.5]
elif case == 10:
lambdas_imperfect = [2.0,2.0,2.0]
elif case == 11:
lambdas_imperfect = [0.0,0.5,2.0] # might need revisiting
elif case == 12:
lambdas_imperfect = [0.5,0.0,1.0]
# Burgers
elif imperfect_type == 'Burgers':
lambdas = [1.0,-0.1,0.0]
eqn_str = 'tobeassigned'
lambdas_imperfect = [1.0,-0.1,0.0]
elif imperfect_type == 'KSpu3x':
lambdas = [1.0,1.0,1.0]
eqn_str = np.array( ['uu_{x}','u_{xx}','u_{xxxx}','u_{xxx}'] )
if case == 1:
lambdas_imperfect = [1.0,1.0,1.0,0.1]
elif case == 2:
lambdas_imperfect = [1.0,1.0,1.0,0.5]
elif case == 3:
lambdas_imperfect = [1.0,1.0,1.0,1.0]
elif case == 21:
lambdas_imperfect = [0.0,1.0,1.0,0.5]
elif case == 22:
lambdas_imperfect = [1.0,0.0,1.0,0.5]
elif case == 23:
lambdas_imperfect = [1.0,1.0,0.0,0.5]
elif imperfect_type == 'KSpu3x_Du3':
lambdas = [1.0,1.0,1.0]
eqn_str = np.array( ['uu_{x}','u_{xx}','u_{xxxx}','u^2u_{x}'] )
if case == 1:
lambdas_imperfect = [1.0,1.0,1.0,1.5]
elif case == 2:
lambdas_imperfect = [1.0,1.0,1.0,0.15]
elif case == 3:
lambdas_imperfect = [1.0,1.0,1.0,0.015]
elif case == 21:
lambdas_imperfect = [0.0,1.0,1.0,0.15]
elif case == 22:
lambdas_imperfect = [1.0,0.0,1.0,0.15]
elif case == 23:
lambdas_imperfect = [1.0,1.0,0.0,0.15]
elif imperfect_type == 'SH':
# epsilon = 0.5
# g = 1
lambdas = [1.0,-1.0,1.0,2.0,1.0]
eqn_str = np.array( ['u','u^2','u^3','u_{xx}','u_{xxxx}'] )
if case == 1:
lambdas_imperfect = [1.0,-1.0,1.0,2.0,1.0]
elif imperfect_type == 'KS_p_u2uxx':
lambdas = [1.0,1.0,1.0]
eqn_str = np.array( ['uu_{x}','u_{xx}','u_{xxxx}','u^2u_{xx}'] )
if case == 1:
lambdas_imperfect = [1.0,1.0,1.0,1.5]
elif case == 2:
lambdas_imperfect = [1.0,1.0,1.0,0.15]
elif case == 3:
lambdas_imperfect = [1.0,1.0,1.0,0.015]
return lambdas, lambdas_imperfect, eqn_str