-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from cadet/add-dead-end-filtration
Add dead end filtration
- Loading branch information
Showing
10 changed files
with
446 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
name: pipeline | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
- dev | ||
- add-dead-end-filtration | ||
- test_ci | ||
pull_request: | ||
|
||
|
||
jobs: | ||
test-job: | ||
runs-on: ubuntu-latest | ||
|
||
defaults: | ||
run: | ||
shell: bash -l {0} | ||
strategy: | ||
matrix: | ||
python-version: ["3.10", "3.11", "3.12"] | ||
|
||
env: | ||
CONDA_FILE: environment.yml | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Setup Conda Environment | ||
uses: conda-incubator/setup-miniconda@v3 | ||
with: | ||
miniforge-variant: Mambaforge | ||
miniforge-version: latest | ||
use-mamba: true | ||
activate-environment: cadpythonsim | ||
channels: conda-forge, | ||
|
||
- name: install conda env | ||
run: | | ||
mamba env update -n cadpythonsim -f ${{ env.CONDA_FILE }} | ||
- name: Install | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -e ./[testing] | ||
- name: Test | ||
run: | | ||
pytest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
name: ruff | ||
|
||
name: Ruff | ||
on: [ push, pull_request ] | ||
jobs: | ||
ruff: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: chartboost/ruff-action@v1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,3 +5,4 @@ __pycache__/ | |
debug* | ||
*.h5 | ||
*.egg-info | ||
.vscode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,8 @@ | ||
class NotInitializedError(Exception): | ||
"""Exception raised when a unit operation is not yet initialized.""" | ||
|
||
class CADETPythonSimError(Exception): | ||
"""Typical Exception for Error Handling""" | ||
pass | ||
|
||
class NotInitializedError(CADETPythonSimError): | ||
"""Exception raised when a unit operation is not yet initialized.""" | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
import numpy as np | ||
from CADETPythonSimulator.exception import CADETPythonSimError | ||
import warnings | ||
|
||
def calculate_residual_volume_cstr( | ||
V : float, | ||
V_dot : float, | ||
Q_in : float , | ||
Q_out : float | ||
) -> float: | ||
""" | ||
Calculates the residual equations of the volume of a cstr. | ||
Parameters | ||
---------- | ||
V : float | ||
Volume within the CSTR | ||
V_dot : float | ||
Volume change rate of the CSTR | ||
Q_in : float | ||
Volume entering the Unit | ||
Q_out : float | ||
Volume leaving the Unit | ||
Returns | ||
------- | ||
float | ||
Residual of the Flow equation of the CSTR with dimensions like the inpu | ||
""" | ||
|
||
if V < 0: | ||
raise CADETPythonSimError("V can't be less then zero") | ||
|
||
return V_dot - Q_in + Q_out | ||
|
||
def calculate_residual_concentration_cstr( | ||
c : np.ndarray, | ||
c_dot : np.ndarray, | ||
V : float, | ||
V_dot : float, | ||
Q_in : float, | ||
Q_out : float, | ||
c_in : np.ndarray | ||
) -> np.ndarray : | ||
""" | ||
Calculates the residual equations of the concentration of a cstr | ||
Parameters | ||
---------- | ||
c : np.ndarray | ||
Concentration | ||
c_dot : np.ndarray | ||
Changing of the concentration | ||
V : float | ||
Volume within the CSTR | ||
V_dot : float | ||
Volume change rate of the CSTR | ||
Q_in : float | ||
Volume entering the Unit | ||
Q_out : float | ||
Volume leaving the Unit | ||
c_in : np.ndarray | ||
Initial concentration | ||
""" | ||
if V < 0: | ||
raise CADETPythonSimError("V can't be less then zero") | ||
|
||
|
||
return c_dot * V + V_dot * c - Q_in * c_in + Q_out * c | ||
|
||
|
||
def calculate_residuals_visc_cstr(): | ||
""" | ||
Calculates the residual of the Viscosity equation of the CSTR | ||
""" | ||
warnings.warn("Viscosity of CSTR not yet implemented") | ||
|
||
return 0 | ||
|
||
|
||
def calculate_residual_def(): | ||
""" | ||
Calculates the residual equations fo a dead end filtration equation. | ||
""" | ||
raise NotImplementedError |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.