You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: polyfempy/Problems.py
+21Lines changed: 21 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -3,6 +3,8 @@
3
3
#################################################
4
4
############Scalar###############################
5
5
classFranke:
6
+
"""Franke problem with exact solution https://polyfem.github.io/documentation/#franke"""
7
+
6
8
defname(self):
7
9
return"Franke"
8
10
@@ -11,18 +13,24 @@ def params(self):
11
13
12
14
13
15
classGenericScalar:
16
+
"""Generic scalar problem https://polyfem.github.io/documentation/#genericscalar"""
17
+
14
18
def__init__(self):
15
19
self.rhs=0
16
20
self.dirichlet_boundary= []
17
21
self.neumann_boundary= []
18
22
19
23
defadd_dirichlet_value(self, id, value):
24
+
"""add the Dirichlet value value for the sideset id"""
25
+
20
26
tmp= {}
21
27
tmp["id"] =id
22
28
tmp["value"] =value
23
29
self.dirichlet_boundary.append(tmp)
24
30
25
31
defadd_neumann_value(self, id, value):
32
+
"""add the Neumann value value for the sideset id"""
33
+
26
34
tmp= {}
27
35
tmp["id"] =id
28
36
tmp["value"] =value
@@ -38,6 +46,8 @@ def params(self):
38
46
#################################################
39
47
############Elasticity###########################
40
48
classGravity:
49
+
"""time dependent gravity problem https://polyfem.github.io/documentation/#gravity"""
50
+
41
51
defname(self):
42
52
return"Gravity"
43
53
@@ -46,6 +56,8 @@ def params(self):
46
56
47
57
48
58
classTorsion:
59
+
"""3D torsion problem, specify which sideset to fix (fixed_boundary) and which one turns turning_boundary https://polyfem.github.io/documentation/#torsionelastic"""
60
+
49
61
def__init__(self):
50
62
self.axis_coordiante=2
51
63
self.n_turns=0.5
@@ -62,12 +74,15 @@ def params(self):
62
74
63
75
64
76
classGenericTensor:
77
+
"""Generic tensor problem https://polyfem.github.io/documentation/#generictensor"""
"""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."""
"""add the Neumann value value for the sideset id. Note the value must be a vector in 2D or 3D depending on the problem"""
98
+
82
99
tmp= {}
83
100
tmp["id"] =id
84
101
tmp["value"] =value
@@ -94,6 +111,8 @@ def params(self):
94
111
#################################################
95
112
############Stokes###############################
96
113
classFlow:
114
+
"""Inflow/outflow problem for fluids. You can specify the sideset for the moving fluxes and the list of obstacle sidesets. https://polyfem.github.io/documentation/#flow"""
115
+
97
116
def__init__(self):
98
117
self.inflow=1
99
118
self.outflow=3
@@ -109,6 +128,8 @@ def params(self):
109
128
110
129
111
130
classDrivenCavity:
131
+
"""Classical driven cavity problem in fluid simulation"""
Copy file name to clipboardExpand all lines: polyfempy/Settings.py
+11-1Lines changed: 11 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -3,6 +3,7 @@
3
3
4
4
classSettings:
5
5
"""Class that encodes the settings of the solver, it nodels the input json file"""
6
+
6
7
def__init__(self):
7
8
self.discr_order=1
8
9
self.pressure_discr_order=1
@@ -36,42 +37,50 @@ def __init__(self):
36
37
37
38
defset_problem(self, problem):
38
39
"""Sets the problem, use any of the problems in Problems"""
40
+
39
41
self.problem=problem.name()
40
42
self.problem_params=problem.params()
41
43
42
44
43
45
defset_material_params(self, name, value):
44
-
"""set the material parameters, for instance set_material_params("E", 200) sets the Young's modulus E to 200"""
46
+
"""set the material parameters, for instance set_material_params("E", 200) sets the Young's modulus E to 200. See https://polyfem.github.io/documentation/#formulations for full list"""
"""Sets the path to export a vtu file with the results, use bounda_only to export only one layer of the mesh in 3d"""
53
+
50
54
self.export["vis_mesh"] =path
51
55
self.export["vis_boundary_only"] =bounda_only
52
56
53
57
54
58
defset_wireframe_export_path(self, path):
55
59
"""Sets the path to export a wireframe of the mesh"""
60
+
56
61
self.export["wire_mesh"] =path
57
62
58
63
59
64
defset_isolines_export_path(self, path):
60
65
"""Sets the path to export the isolines of the solution"""
66
+
61
67
self.export["iso_mesh"] =path
62
68
63
69
64
70
defset_solution_export_path(self, path):
65
71
"""Sets the path to save the solution"""
72
+
66
73
self.export["solution"] =path
67
74
68
75
69
76
defset_advanced_option(self, key, value):
70
77
"""Used to set any advanced option not present in this class, for instance set_advanced_option("use_spline",True), see https://polyfem.github.io/documentation/ for full list"""
78
+
71
79
self.advanced_options[key] =value
72
80
73
81
def__str__(self):
74
82
"""stringygied json description of this class, used to run the solver"""
83
+
75
84
tmp=dict(
76
85
(key, value)
77
86
for (key, value) inself.__dict__.items())
@@ -82,4 +91,5 @@ def __str__(self):
82
91
83
92
defserialize(self):
84
93
"""stringygied json description of this class, used to run the solver"""
0 commit comments