|
3 | 3 | ################################################# |
4 | 4 | ############Scalar############################### |
5 | 5 | class Franke: |
6 | | - """Franke problem with exact solution https://polyfem.github.io/documentation/#franke""" |
| 6 | + """Franke problem with exact solution https://polyfem.github.io/documentation/#franke""" |
7 | 7 |
|
8 | | - def name(self): |
9 | | - return "Franke" |
| 8 | + def name(self): |
| 9 | + return "Franke" |
10 | 10 |
|
11 | | - def params(self): |
12 | | - return {} |
| 11 | + def params(self): |
| 12 | + return {} |
13 | 13 |
|
14 | 14 |
|
15 | 15 | class GenericScalar: |
16 | | - """Generic scalar problem https://polyfem.github.io/documentation/#genericscalar""" |
| 16 | + """Generic scalar problem https://polyfem.github.io/documentation/#genericscalar""" |
17 | 17 |
|
18 | | - def __init__(self): |
19 | | - self.rhs = 0 |
20 | | - self.exact = None |
21 | | - self.dirichlet_boundary = [] |
22 | | - self.neumann_boundary = [] |
| 18 | + def __init__(self): |
| 19 | + self.rhs = 0 |
| 20 | + self.exact = None |
| 21 | + self.dirichlet_boundary = [] |
| 22 | + self.neumann_boundary = [] |
23 | 23 |
|
24 | | - def add_dirichlet_value(self, id, value): |
25 | | - """add the Dirichlet value value for the sideset id""" |
| 24 | + def add_dirichlet_value(self, id, value): |
| 25 | + """add the Dirichlet value value for the sideset id""" |
26 | 26 |
|
27 | | - tmp = {} |
28 | | - tmp["id"] = id |
29 | | - tmp["value"] = value |
30 | | - self.dirichlet_boundary.append(tmp) |
| 27 | + tmp = {} |
| 28 | + tmp["id"] = id |
| 29 | + tmp["value"] = value |
| 30 | + self.dirichlet_boundary.append(tmp) |
31 | 31 |
|
32 | | - def add_neumann_value(self, id, value): |
33 | | - """add the Neumann value value for the sideset id""" |
| 32 | + def add_neumann_value(self, id, value): |
| 33 | + """add the Neumann value value for the sideset id""" |
34 | 34 |
|
35 | | - tmp = {} |
36 | | - tmp["id"] = id |
37 | | - tmp["value"] = value |
38 | | - self.neumann_boundary.append(tmp) |
| 35 | + tmp = {} |
| 36 | + tmp["id"] = id |
| 37 | + tmp["value"] = value |
| 38 | + self.neumann_boundary.append(tmp) |
39 | 39 |
|
40 | | - def name(self): |
41 | | - return "GenericScalar" |
| 40 | + def name(self): |
| 41 | + return "GenericScalar" |
42 | 42 |
|
43 | | - def params(self): |
44 | | - return self.__dict__ |
| 43 | + def params(self): |
| 44 | + return self.__dict__ |
45 | 45 |
|
46 | 46 |
|
47 | 47 | ################################################# |
48 | 48 | ############Elasticity########################### |
49 | 49 | class Gravity: |
50 | | - """time dependent gravity problem https://polyfem.github.io/documentation/#gravity""" |
| 50 | + """time dependent gravity problem https://polyfem.github.io/documentation/#gravity""" |
51 | 51 |
|
52 | | - def __init__(self, force=0.1): |
53 | | - self.force = force |
| 52 | + def __init__(self, force=0.1): |
| 53 | + self.force = force |
54 | 54 |
|
55 | | - def name(self): |
56 | | - return "Gravity" |
| 55 | + def name(self): |
| 56 | + return "Gravity" |
57 | 57 |
|
58 | | - def params(self): |
59 | | - return self.__dict__ |
| 58 | + def params(self): |
| 59 | + return self.__dict__ |
60 | 60 |
|
61 | 61 |
|
62 | 62 | class Torsion: |
63 | | - """3D torsion problem, specify which sideset to fix (fixed_boundary) and which one turns turning_boundary https://polyfem.github.io/documentation/#torsionelastic""" |
| 63 | + """3D torsion problem, specify which sideset to fix (fixed_boundary) and which one turns turning_boundary https://polyfem.github.io/documentation/#torsionelastic""" |
64 | 64 |
|
65 | | - def __init__(self, axis_coordiante=None, axis_coordinate=2, n_turns=0.5, fixed_boundary=5, turning_boundary=6): |
66 | | - if axis_coordiante: |
67 | | - self.axis_coordiante = axis_coordiante |
68 | | - else: |
69 | | - self.axis_coordiante = axis_coordinate |
70 | | - self.n_turns = n_turns |
71 | | - self.fixed_boundary = fixed_boundary |
72 | | - self.turning_boundary = turning_boundary |
| 65 | + def __init__(self, axis_coordiante=None, axis_coordinate=2, n_turns=0.5, fixed_boundary=5, turning_boundary=6): |
| 66 | + if axis_coordiante: |
| 67 | + self.axis_coordiante = axis_coordiante |
| 68 | + else: |
| 69 | + self.axis_coordiante = axis_coordinate |
| 70 | + self.n_turns = n_turns |
| 71 | + self.fixed_boundary = fixed_boundary |
| 72 | + self.turning_boundary = turning_boundary |
73 | 73 |
|
| 74 | + def name(self): |
| 75 | + return "TorsionElastic" |
74 | 76 |
|
75 | | - def name(self): |
76 | | - return "TorsionElastic" |
77 | | - |
78 | | - |
79 | | - def params(self): |
80 | | - return self.__dict__ |
| 77 | + def params(self): |
| 78 | + return self.__dict__ |
81 | 79 |
|
82 | 80 |
|
83 | 81 | class GenericTensor: |
84 | | - """Generic tensor problem https://polyfem.github.io/documentation/#generictensor""" |
| 82 | + """Generic tensor problem https://polyfem.github.io/documentation/#generictensor""" |
85 | 83 |
|
86 | | - def __init__(self): |
87 | | - self.rhs = [0, 0, 0] |
88 | | - self.exact = None |
89 | | - self.dirichlet_boundary = [] |
90 | | - self.neumann_boundary = [] |
| 84 | + def __init__(self): |
| 85 | + self.rhs = [0, 0, 0] |
| 86 | + self.exact = None |
| 87 | + self.dirichlet_boundary = [] |
| 88 | + self.neumann_boundary = [] |
91 | 89 |
|
92 | | - def set_velocity(self, id, value, is_dim_fixed=None): |
93 | | - """set the velocity value for the sideset id. Note the value must be a vector in 2D or 3D depending on the problem""" |
94 | | - self.add_dirichlet_value(id, value, is_dim_fixed) |
| 90 | + def set_velocity(self, id, value, is_dim_fixed=None): |
| 91 | + """set the velocity value for the sideset id. Note the value must be a vector in 2D or 3D depending on the problem""" |
| 92 | + self.add_dirichlet_value(id, value, is_dim_fixed) |
95 | 93 |
|
96 | | - def set_displacement(self, id, value, is_dim_fixed=None): |
97 | | - """set the displacement value for the sideset id. Note the value must be a vector in 2D or 3D depending on the problem""" |
98 | | - self.add_dirichlet_value(id, value, is_dim_fixed) |
| 94 | + def set_displacement(self, id, value, is_dim_fixed=None): |
| 95 | + """set the displacement value for the sideset id. Note the value must be a vector in 2D or 3D depending on the problem""" |
| 96 | + self.add_dirichlet_value(id, value, is_dim_fixed) |
99 | 97 |
|
100 | | - def set_force(self, id, value): |
101 | | - """set the force value for the sideset id. Note the value must be a vector in 2D or 3D depending on the problem""" |
102 | | - self.add_neumann_value(id, value) |
| 98 | + def set_force(self, id, value): |
| 99 | + """set the force value for the sideset id. Note the value must be a vector in 2D or 3D depending on the problem""" |
| 100 | + self.add_neumann_value(id, value) |
103 | 101 |
|
| 102 | + def add_dirichlet_value(self, id, value, is_dirichlet_dim=None): |
| 103 | + """add the Dirichlet value value for the sideset id. Note the value must be a vector in 2D or 3D depending on the problem. is_dirichlet_dim is a vector of boolean specifying which dimentions are fixed.""" |
| 104 | + assert(len(value) == 3 or len(value) == 2) |
| 105 | + tmp = {} |
| 106 | + tmp["id"] = id |
| 107 | + tmp["value"] = value |
| 108 | + if is_dirichlet_dim is not None: |
| 109 | + assert(len(is_dirichlet_dim) == 3 or len(is_dirichlet_dim) == 2) |
| 110 | + tmp["dimension"] = is_dirichlet_dim |
104 | 111 |
|
105 | | - def add_dirichlet_value(self, id, value, is_dirichlet_dim=None): |
106 | | - """add the Dirichlet value value for the sideset id. Note the value must be a vector in 2D or 3D depending on the problem. is_dirichlet_dim is a vector of boolean specifying which dimentions are fixed.""" |
107 | | - assert(len(value) == 3 or len(value) == 2) |
108 | | - tmp = {} |
109 | | - tmp["id"] = id |
110 | | - tmp["value"] = value |
111 | | - if is_dirichlet_dim is not None: |
112 | | - assert(len(is_dirichlet_dim) == 3 or len(is_dirichlet_dim) == 2) |
113 | | - tmp["dimension"] = is_dirichlet_dim |
| 112 | + self.dirichlet_boundary.append(tmp) |
114 | 113 |
|
115 | | - self.dirichlet_boundary.append(tmp) |
| 114 | + def add_neumann_value(self, id, value): |
| 115 | + """add the Neumann value value for the sideset id. Note the value must be a vector in 2D or 3D depending on the problem""" |
116 | 116 |
|
117 | | - def add_neumann_value(self, id, value): |
118 | | - """add the Neumann value value for the sideset id. Note the value must be a vector in 2D or 3D depending on the problem""" |
| 117 | + tmp = {} |
| 118 | + tmp["id"] = id |
| 119 | + tmp["value"] = value |
| 120 | + self.neumann_boundary.append(tmp) |
119 | 121 |
|
120 | | - tmp = {} |
121 | | - tmp["id"] = id |
122 | | - tmp["value"] = value |
123 | | - self.neumann_boundary.append(tmp) |
| 122 | + def name(self): |
| 123 | + return "GenericTensor" |
124 | 124 |
|
125 | | - def name(self): |
126 | | - return "GenericTensor" |
127 | | - |
128 | | - def params(self): |
129 | | - return self.__dict__ |
| 125 | + def params(self): |
| 126 | + return self.__dict__ |
130 | 127 |
|
131 | 128 |
|
132 | 129 | ################################################# |
133 | 130 | ############Stokes############################### |
134 | 131 | class Flow: |
135 | | - """Inflow/outflow problem for fluids. You can specify the sideset for the moving fluxes, the axial direction of the flow, and the list of obstacle sidesets. https://polyfem.github.io/documentation/#flow""" |
| 132 | + """Inflow/outflow problem for fluids. You can specify the sideset for the moving fluxes, the axial direction of the flow, and the list of obstacle sidesets. https://polyfem.github.io/documentation/#flow""" |
136 | 133 |
|
137 | | - def __init__(self, inflow=1, outflow=3, inflow_amout=0.25, outflow_amout=0.25, direction=0, obstacle=[7]): |
138 | | - self.inflow = inflow |
139 | | - self.outflow = outflow |
140 | | - self.inflow_amout = inflow_amout |
141 | | - self.outflow_amout = outflow_amout |
142 | | - self.direction = direction |
143 | | - self.obstacle = obstacle |
| 134 | + def __init__(self, inflow=1, outflow=3, inflow_amout=0.25, outflow_amout=0.25, direction=0, obstacle=[7]): |
| 135 | + self.inflow = inflow |
| 136 | + self.outflow = outflow |
| 137 | + self.inflow_amout = inflow_amout |
| 138 | + self.outflow_amout = outflow_amout |
| 139 | + self.direction = direction |
| 140 | + self.obstacle = obstacle |
144 | 141 |
|
145 | | - def name(self): |
146 | | - return "Flow" |
| 142 | + def name(self): |
| 143 | + return "Flow" |
147 | 144 |
|
148 | | - def params(self): |
149 | | - return self.__dict__ |
| 145 | + def params(self): |
| 146 | + return self.__dict__ |
150 | 147 |
|
151 | 148 |
|
152 | 149 | class DrivenCavity: |
153 | | - """Classical driven cavity problem in fluid simulation""" |
| 150 | + """Classical driven cavity problem in fluid simulation""" |
| 151 | + |
| 152 | + def name(self): |
| 153 | + return "DrivenCavity" |
| 154 | + |
| 155 | + def params(self): |
| 156 | + return {} |
| 157 | + |
| 158 | + |
| 159 | +class FlowWithObstacle: |
| 160 | + """FLuid Obstacle problem""" |
| 161 | + |
| 162 | + def __init__(self, U=1.5, time_dependent=True): |
| 163 | + self.U = U |
| 164 | + self.time_dependent = time_dependent |
154 | 165 |
|
155 | | - def name(self): |
156 | | - return "DrivenCavity" |
| 166 | + def name(self): |
| 167 | + return "FlowWithObstacle" |
157 | 168 |
|
158 | | - def params(self): |
159 | | - return {} |
| 169 | + def params(self): |
| 170 | + return self.__dict__ |
0 commit comments