Skip to content

Commit 54aea88

Browse files
committed
Allow users to change the number of CSTRs in a PFR
1 parent f3488cf commit 54aea88

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

t3/utils/flux.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ def generate_flux(model_path: str,
3838
allowed_nodes: Optional[List[str]] = None,
3939
max_chemical_generations: Optional[int] = None,
4040
surface_names: Optional[List[str]] = None,
41+
n_cells: Optional[int] = 100,
4142
):
4243
"""
4344
Generate a flux diagram for a given model and composition.
@@ -75,6 +76,7 @@ def generate_flux(model_path: str,
7576
any node outside this list will not appear in the flux diagram.
7677
max_chemical_generations (Optional[int], optional): The maximal number of chemical generations to consider.
7778
surface_names (Optional[List[str]], optional): List of surface names to consider.
79+
n_cells (Optional[int], optional): The number of discrete CSTRs to simulate the PFR. Default: 100.
7880
7981
Structures:
8082
profiles: {<time in s>: {'P': <pressure in bar>,
@@ -96,6 +98,7 @@ def generate_flux(model_path: str,
9698
P=P,
9799
V=V,
98100
surface_names=surface_names,
101+
n_cells=n_cells,
99102
a_tol=a_tol,
100103
r_tol=r_tol,
101104
energy=energy,
@@ -148,6 +151,7 @@ def get_profiles_from_simulation(model_path: str,
148151
P: float,
149152
V: Optional[float] = None,
150153
surface_names: Optional[List[str]] = None,
154+
n_cells: Optional[int] = 100,
151155
a_tol: float = 1e-16,
152156
r_tol: float = 1e-10,
153157
energy: bool = False,
@@ -166,6 +170,7 @@ def get_profiles_from_simulation(model_path: str,
166170
V (Optional[float], optional): The reactor volume in cm^3, if relevant.
167171
surface_names (Optional[List[str]], optional): List of surface names to consider.
168172
Pass an empty list if there are no surfaces.
173+
n_cells (Optional[int], optional): The number of discrete CSTRs to simulate the PFR.
169174
reactor_type (str, optional): The reactor type. Supported reactor types are:
170175
'JSR': Jet stirred reactor, which is a CSTR with constant T/P/V
171176
'BatchP': An ideal gas constant pressure and constant volume batch reactor
@@ -208,7 +213,7 @@ def get_profiles_from_simulation(model_path: str,
208213
P=P,
209214
length=V * 1e-6 / 1.0,
210215
area=1.0, # m^2
211-
n_cells=10,
216+
n_cells=n_cells,
212217
surface_names=surface_names,
213218
a_tol=a_tol,
214219
r_tol=r_tol,
@@ -424,7 +429,7 @@ def run_pfr(model_path: str,
424429
P: float,
425430
length: float,
426431
area: float,
427-
n_cells: int = 10,
432+
n_cells: int = 100,
428433
surface_names: Optional[List[str]] = None,
429434
a_tol: float = 1e-16,
430435
r_tol: float = 1e-10,

0 commit comments

Comments
 (0)