Skip to content

Commit 4bbc16c

Browse files
author
Teseo Schneider
committed
better documentation
1 parent ddda644 commit 4bbc16c

File tree

2 files changed

+32
-1
lines changed

2 files changed

+32
-1
lines changed

polyfempy/Problems.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
#################################################
44
############Scalar###############################
55
class Franke:
6+
"""Franke problem with exact solution https://polyfem.github.io/documentation/#franke"""
7+
68
def name(self):
79
return "Franke"
810

@@ -11,18 +13,24 @@ def params(self):
1113

1214

1315
class GenericScalar:
16+
"""Generic scalar problem https://polyfem.github.io/documentation/#genericscalar"""
17+
1418
def __init__(self):
1519
self.rhs = 0
1620
self.dirichlet_boundary = []
1721
self.neumann_boundary = []
1822

1923
def add_dirichlet_value(self, id, value):
24+
"""add the Dirichlet value value for the sideset id"""
25+
2026
tmp = {}
2127
tmp["id"] = id
2228
tmp["value"] = value
2329
self.dirichlet_boundary.append(tmp)
2430

2531
def add_neumann_value(self, id, value):
32+
"""add the Neumann value value for the sideset id"""
33+
2634
tmp = {}
2735
tmp["id"] = id
2836
tmp["value"] = value
@@ -38,6 +46,8 @@ def params(self):
3846
#################################################
3947
############Elasticity###########################
4048
class Gravity:
49+
"""time dependent gravity problem https://polyfem.github.io/documentation/#gravity"""
50+
4151
def name(self):
4252
return "Gravity"
4353

@@ -46,6 +56,8 @@ def params(self):
4656

4757

4858
class Torsion:
59+
"""3D torsion problem, specify which sideset to fix (fixed_boundary) and which one turns turning_boundary https://polyfem.github.io/documentation/#torsionelastic"""
60+
4961
def __init__(self):
5062
self.axis_coordiante = 2
5163
self.n_turns = 0.5
@@ -62,12 +74,15 @@ def params(self):
6274

6375

6476
class GenericTensor:
77+
"""Generic tensor problem https://polyfem.github.io/documentation/#generictensor"""
78+
6579
def __init__(self):
6680
self.rhs = [0, 0, 0]
6781
self.dirichlet_boundary = []
6882
self.neumann_boundary = []
6983

7084
def add_dirichlet_value(self, id, value, is_dirichlet_dim=None):
85+
"""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."""
7186
assert(len(value) == 3)
7287
tmp = {}
7388
tmp["id"] = id
@@ -79,6 +94,8 @@ def add_dirichlet_value(self, id, value, is_dirichlet_dim=None):
7994
self.dirichlet_boundary.append(tmp)
8095

8196
def add_neumann_value(self, id, value):
97+
"""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+
8299
tmp = {}
83100
tmp["id"] = id
84101
tmp["value"] = value
@@ -94,6 +111,8 @@ def params(self):
94111
#################################################
95112
############Stokes###############################
96113
class Flow:
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+
97116
def __init__(self):
98117
self.inflow = 1
99118
self.outflow = 3
@@ -109,6 +128,8 @@ def params(self):
109128

110129

111130
class DrivenCavity:
131+
"""Classical driven cavity problem in fluid simulation"""
132+
112133
def name(self):
113134
return "DrivenCavity"
114135

polyfempy/Settings.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
class Settings:
55
"""Class that encodes the settings of the solver, it nodels the input json file"""
6+
67
def __init__(self):
78
self.discr_order = 1
89
self.pressure_discr_order = 1
@@ -36,42 +37,50 @@ def __init__(self):
3637

3738
def set_problem(self, problem):
3839
"""Sets the problem, use any of the problems in Problems"""
40+
3941
self.problem = problem.name()
4042
self.problem_params = problem.params()
4143

4244

4345
def set_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"""
47+
4548
self.params[name] = value
4649

4750

4851
def set_vtu_export_path(self, path, bounda_only=False):
4952
"""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+
5054
self.export["vis_mesh"] = path
5155
self.export["vis_boundary_only"] = bounda_only
5256

5357

5458
def set_wireframe_export_path(self, path):
5559
"""Sets the path to export a wireframe of the mesh"""
60+
5661
self.export["wire_mesh"] = path
5762

5863

5964
def set_isolines_export_path(self, path):
6065
"""Sets the path to export the isolines of the solution"""
66+
6167
self.export["iso_mesh"] = path
6268

6369

6470
def set_solution_export_path(self, path):
6571
"""Sets the path to save the solution"""
72+
6673
self.export["solution"] = path
6774

6875

6976
def set_advanced_option(self, key, value):
7077
"""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+
7179
self.advanced_options[key] = value
7280

7381
def __str__(self):
7482
"""stringygied json description of this class, used to run the solver"""
83+
7584
tmp = dict(
7685
(key, value)
7786
for (key, value) in self.__dict__.items())
@@ -82,4 +91,5 @@ def __str__(self):
8291

8392
def serialize(self):
8493
"""stringygied json description of this class, used to run the solver"""
94+
8595
return str(self)

0 commit comments

Comments
 (0)