PODImodels 0.0.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 RUAN, SHENHUI
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,211 @@
1
+ Metadata-Version: 2.4
2
+ Name: PODImodels
3
+ Version: 0.0.3
4
+ Summary: A py package to create ROM utilizing PODI method
5
+ Author-email: Shenhui_Ruan <shenhui.ruan@kit.edu>
6
+ Requires-Python: >=3.8
7
+ Description-Content-Type: text/markdown
8
+ License-File: LICENSE
9
+ Requires-Dist: numpy
10
+ Requires-Dist: scikit-learn
11
+ Requires-Dist: scipy
12
+ Requires-Dist: pyvista
13
+ Requires-Dist: torch
14
+ Dynamic: license-file
15
+
16
+ # PODImodels
17
+
18
+ [![PyPI version](https://badge.fury.io/py/PODImodels.svg)](https://badge.fury.io/py/PODImodels)
19
+ [![Python 3.8+](https://img.shields.io/badge/python-3.8+-blue.svg)](https://www.python.org/downloads/)
20
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
21
+
22
+ **PODImodels** (Proper Orthogonal Decomposition-based Interpolation Models) is a Python package for creating Reduced-Order Models (ROM) using POD combined with various machine learning techniques. It provides a unified framework for reduced-order modeling of high-dimensional field data, particularly useful for computational fluid dynamics and other physics-based simulations.
23
+
24
+ ## Features
25
+
26
+ - **Multiple Interpolation Methods**: Support for Linear Regression, Ridge Regression, Gaussian Process Regression (GPR), Radial Basis Functions (RBF), and Artificial Neural Networks (ANN)
27
+ - **Flexible Modeling Approaches**: Choose between direct field prediction or POD coefficient interpolation
28
+ - **Easy-to-Use API**: Scikit-learn-inspired interface with `fit()` and `predict()` methods
29
+ - **Built-in Scaling**: Optional data normalization for improved model performance
30
+ - **Extensible Architecture**: Abstract base class for implementing custom interpolation models
31
+
32
+ ## Installation
33
+
34
+ Install PODImodels using pip:
35
+
36
+ ```bash
37
+ pip install PODImodels
38
+ ```
39
+
40
+ For development installation:
41
+
42
+ ```bash
43
+ git clone https://github.com/Ruansh233/PODImodels.git
44
+ cd PODImodels
45
+ pip install -e .
46
+ ```
47
+
48
+ ## Requirements
49
+
50
+ - Python >= 3.8
51
+ - numpy
52
+ - scikit-learn
53
+ - scipy
54
+ - pyvista
55
+ - torch
56
+
57
+ All dependencies will be automatically installed with the package.
58
+
59
+ ## Quick Start
60
+
61
+ ```python
62
+ import numpy as np
63
+ from PODImodels import PODGPR, fieldsRBF
64
+
65
+ # Prepare your data
66
+ # parameters: (n_samples, n_parameters)
67
+ # field_snapshots: (n_samples, n_field_points)
68
+ parameters = np.random.rand(100, 3)
69
+ field_snapshots = np.random.rand(100, 10000)
70
+
71
+ # Example 1: POD with Gaussian Process Regression
72
+ model = PODGPR(rank=15, with_scaler_x=True, with_scaler_y=True)
73
+ model.fit(parameters, field_snapshots)
74
+ predictions = model.predict(new_parameters)
75
+
76
+ # Example 2: Direct field prediction with Radial Basis Functions
77
+ model = fieldsRBF(kernel='thin_plate_spline', degree=2)
78
+ model.fit(parameters, field_snapshots)
79
+ field_prediction = model.predict(test_parameters)
80
+ ```
81
+
82
+ ## Available Models
83
+
84
+ PODImodels provides two categories of models:
85
+
86
+ 1. **Direct Field Models** (`fields*`): Learn direct mapping from parameters to field values
87
+ 2. **POD Coefficient Models** (`POD*`): Learn mapping from parameters to POD coefficients (more efficient for large fields)
88
+
89
+ ### Linear Regression Models
90
+ - `fieldsLinear`: Direct field prediction using linear regression
91
+ - `PODLinear`: POD coefficient prediction using linear regression
92
+ - `fieldsRidge`: Direct field prediction using Ridge regression
93
+ - `PODRidge`: POD coefficient prediction using Ridge regression
94
+
95
+ ### Gaussian Process Regression Models
96
+ - `fieldsGPR`: Direct field prediction using Gaussian Process Regression
97
+ - `PODGPR`: POD coefficient prediction using Gaussian Process Regression
98
+ - `fieldsRidgeGPR`: Field prediction with Ridge regularization and GPR
99
+ - `PODRidgeGPR`: POD coefficient prediction with Ridge regularization and GPR
100
+
101
+ ### Radial Basis Function Models
102
+ - `fieldsRBF`: Direct field prediction using Radial Basis Function interpolation
103
+ - `PODRBF`: POD coefficient prediction using Radial Basis Function interpolation
104
+ - `fieldsRidgeRBF`: Field prediction with Ridge regularization and RBF
105
+ - `PODRidgeRBF`: POD coefficient prediction with Ridge regularization and RBF
106
+
107
+ ### Neural Network Models
108
+ - `PODANN`: POD coefficient prediction using Artificial Neural Networks
109
+
110
+ ## Usage Examples
111
+
112
+ ### Example 1: POD-GPR for CFD Field Reconstruction
113
+
114
+ ```python
115
+ from PODImodels import PODGPR
116
+ import numpy as np
117
+
118
+ # Load your simulation data
119
+ # X: Design parameters (e.g., Reynolds number, geometry params)
120
+ # Y: Field snapshots (e.g., velocity, pressure fields)
121
+ X_train = np.load('parameters.npy') # shape: (n_samples, n_params)
122
+ Y_train = np.load('fields.npy') # shape: (n_samples, n_points)
123
+
124
+ # Initialize model with 20 POD modes
125
+ model = PODGPR(rank=20, with_scaler_x=True, with_scaler_y=True)
126
+
127
+ # Train the model
128
+ model.fit(X_train, Y_train)
129
+
130
+ # Predict new fields
131
+ X_test = np.array([[100, 0.5, 1.2]]) # New parameter set
132
+ Y_pred = model.predict(X_test)
133
+ ```
134
+
135
+ ### Example 2: Direct Field Interpolation with RBF
136
+
137
+ ```python
138
+ from PODImodels import fieldsRBF
139
+
140
+ # Initialize RBF model
141
+ model = fieldsRBF(
142
+ kernel='thin_plate_spline',
143
+ degree=2,
144
+ with_scaler_x=True
145
+ )
146
+
147
+ # Train and predict
148
+ model.fit(X_train, Y_train)
149
+ Y_pred = model.predict(X_test)
150
+ ```
151
+
152
+ ### Example 3: Using Neural Networks
153
+
154
+ ```python
155
+ from PODImodels import PODANN
156
+
157
+ # Initialize ANN model
158
+ model = PODANN(
159
+ rank=15,
160
+ hidden_layers=[64, 32],
161
+ activation='relu',
162
+ epochs=100
163
+ )
164
+
165
+ model.fit(X_train, Y_train)
166
+ Y_pred = model.predict(X_test)
167
+ ```
168
+
169
+ ## Model Selection Guide
170
+
171
+ - **Linear/Ridge**: Fast, interpretable, works well for linear relationships
172
+ - **GPR**: Best for smooth, continuous fields with uncertainty quantification
173
+ - **RBF**: Excellent for scattered data interpolation
174
+ - **ANN**: Powerful for complex nonlinear relationships, requires more data
175
+
176
+ Choose **POD*** models when dealing with large field dimensions (>1000 points) for better computational efficiency.
177
+
178
+ ## Documentation
179
+
180
+ For detailed documentation and API reference, visit the [GitHub repository](https://github.com/Ruansh233/PODImodels).
181
+
182
+ ## Contributing
183
+
184
+ Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
185
+
186
+ ## Citation
187
+
188
+ If you use PODImodels in your research, please cite:
189
+
190
+ ```bibtex
191
+ @software{PODImodels2024,
192
+ author = {Ruan, Shenhui},
193
+ title = {PODImodels: POD-based Interpolation Models for Reduced-Order Modeling},
194
+ year = {2024},
195
+ url = {https://github.com/Ruansh233/PODImodels}
196
+ }
197
+ ```
198
+
199
+ ## License
200
+
201
+ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
202
+
203
+ ## Author
204
+
205
+ **Shenhui Ruan**
206
+ Email: shenhui.ruan@kit.edu
207
+ GitHub: [@Ruansh233](https://github.com/Ruansh233)
208
+
209
+ ## Acknowledgments
210
+
211
+ This package was developed for reduced-order modeling in computational physics applications, with a focus on CFD simulations.
@@ -0,0 +1,196 @@
1
+ # PODImodels
2
+
3
+ [![PyPI version](https://badge.fury.io/py/PODImodels.svg)](https://badge.fury.io/py/PODImodels)
4
+ [![Python 3.8+](https://img.shields.io/badge/python-3.8+-blue.svg)](https://www.python.org/downloads/)
5
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
6
+
7
+ **PODImodels** (Proper Orthogonal Decomposition-based Interpolation Models) is a Python package for creating Reduced-Order Models (ROM) using POD combined with various machine learning techniques. It provides a unified framework for reduced-order modeling of high-dimensional field data, particularly useful for computational fluid dynamics and other physics-based simulations.
8
+
9
+ ## Features
10
+
11
+ - **Multiple Interpolation Methods**: Support for Linear Regression, Ridge Regression, Gaussian Process Regression (GPR), Radial Basis Functions (RBF), and Artificial Neural Networks (ANN)
12
+ - **Flexible Modeling Approaches**: Choose between direct field prediction or POD coefficient interpolation
13
+ - **Easy-to-Use API**: Scikit-learn-inspired interface with `fit()` and `predict()` methods
14
+ - **Built-in Scaling**: Optional data normalization for improved model performance
15
+ - **Extensible Architecture**: Abstract base class for implementing custom interpolation models
16
+
17
+ ## Installation
18
+
19
+ Install PODImodels using pip:
20
+
21
+ ```bash
22
+ pip install PODImodels
23
+ ```
24
+
25
+ For development installation:
26
+
27
+ ```bash
28
+ git clone https://github.com/Ruansh233/PODImodels.git
29
+ cd PODImodels
30
+ pip install -e .
31
+ ```
32
+
33
+ ## Requirements
34
+
35
+ - Python >= 3.8
36
+ - numpy
37
+ - scikit-learn
38
+ - scipy
39
+ - pyvista
40
+ - torch
41
+
42
+ All dependencies will be automatically installed with the package.
43
+
44
+ ## Quick Start
45
+
46
+ ```python
47
+ import numpy as np
48
+ from PODImodels import PODGPR, fieldsRBF
49
+
50
+ # Prepare your data
51
+ # parameters: (n_samples, n_parameters)
52
+ # field_snapshots: (n_samples, n_field_points)
53
+ parameters = np.random.rand(100, 3)
54
+ field_snapshots = np.random.rand(100, 10000)
55
+
56
+ # Example 1: POD with Gaussian Process Regression
57
+ model = PODGPR(rank=15, with_scaler_x=True, with_scaler_y=True)
58
+ model.fit(parameters, field_snapshots)
59
+ predictions = model.predict(new_parameters)
60
+
61
+ # Example 2: Direct field prediction with Radial Basis Functions
62
+ model = fieldsRBF(kernel='thin_plate_spline', degree=2)
63
+ model.fit(parameters, field_snapshots)
64
+ field_prediction = model.predict(test_parameters)
65
+ ```
66
+
67
+ ## Available Models
68
+
69
+ PODImodels provides two categories of models:
70
+
71
+ 1. **Direct Field Models** (`fields*`): Learn direct mapping from parameters to field values
72
+ 2. **POD Coefficient Models** (`POD*`): Learn mapping from parameters to POD coefficients (more efficient for large fields)
73
+
74
+ ### Linear Regression Models
75
+ - `fieldsLinear`: Direct field prediction using linear regression
76
+ - `PODLinear`: POD coefficient prediction using linear regression
77
+ - `fieldsRidge`: Direct field prediction using Ridge regression
78
+ - `PODRidge`: POD coefficient prediction using Ridge regression
79
+
80
+ ### Gaussian Process Regression Models
81
+ - `fieldsGPR`: Direct field prediction using Gaussian Process Regression
82
+ - `PODGPR`: POD coefficient prediction using Gaussian Process Regression
83
+ - `fieldsRidgeGPR`: Field prediction with Ridge regularization and GPR
84
+ - `PODRidgeGPR`: POD coefficient prediction with Ridge regularization and GPR
85
+
86
+ ### Radial Basis Function Models
87
+ - `fieldsRBF`: Direct field prediction using Radial Basis Function interpolation
88
+ - `PODRBF`: POD coefficient prediction using Radial Basis Function interpolation
89
+ - `fieldsRidgeRBF`: Field prediction with Ridge regularization and RBF
90
+ - `PODRidgeRBF`: POD coefficient prediction with Ridge regularization and RBF
91
+
92
+ ### Neural Network Models
93
+ - `PODANN`: POD coefficient prediction using Artificial Neural Networks
94
+
95
+ ## Usage Examples
96
+
97
+ ### Example 1: POD-GPR for CFD Field Reconstruction
98
+
99
+ ```python
100
+ from PODImodels import PODGPR
101
+ import numpy as np
102
+
103
+ # Load your simulation data
104
+ # X: Design parameters (e.g., Reynolds number, geometry params)
105
+ # Y: Field snapshots (e.g., velocity, pressure fields)
106
+ X_train = np.load('parameters.npy') # shape: (n_samples, n_params)
107
+ Y_train = np.load('fields.npy') # shape: (n_samples, n_points)
108
+
109
+ # Initialize model with 20 POD modes
110
+ model = PODGPR(rank=20, with_scaler_x=True, with_scaler_y=True)
111
+
112
+ # Train the model
113
+ model.fit(X_train, Y_train)
114
+
115
+ # Predict new fields
116
+ X_test = np.array([[100, 0.5, 1.2]]) # New parameter set
117
+ Y_pred = model.predict(X_test)
118
+ ```
119
+
120
+ ### Example 2: Direct Field Interpolation with RBF
121
+
122
+ ```python
123
+ from PODImodels import fieldsRBF
124
+
125
+ # Initialize RBF model
126
+ model = fieldsRBF(
127
+ kernel='thin_plate_spline',
128
+ degree=2,
129
+ with_scaler_x=True
130
+ )
131
+
132
+ # Train and predict
133
+ model.fit(X_train, Y_train)
134
+ Y_pred = model.predict(X_test)
135
+ ```
136
+
137
+ ### Example 3: Using Neural Networks
138
+
139
+ ```python
140
+ from PODImodels import PODANN
141
+
142
+ # Initialize ANN model
143
+ model = PODANN(
144
+ rank=15,
145
+ hidden_layers=[64, 32],
146
+ activation='relu',
147
+ epochs=100
148
+ )
149
+
150
+ model.fit(X_train, Y_train)
151
+ Y_pred = model.predict(X_test)
152
+ ```
153
+
154
+ ## Model Selection Guide
155
+
156
+ - **Linear/Ridge**: Fast, interpretable, works well for linear relationships
157
+ - **GPR**: Best for smooth, continuous fields with uncertainty quantification
158
+ - **RBF**: Excellent for scattered data interpolation
159
+ - **ANN**: Powerful for complex nonlinear relationships, requires more data
160
+
161
+ Choose **POD*** models when dealing with large field dimensions (>1000 points) for better computational efficiency.
162
+
163
+ ## Documentation
164
+
165
+ For detailed documentation and API reference, visit the [GitHub repository](https://github.com/Ruansh233/PODImodels).
166
+
167
+ ## Contributing
168
+
169
+ Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
170
+
171
+ ## Citation
172
+
173
+ If you use PODImodels in your research, please cite:
174
+
175
+ ```bibtex
176
+ @software{PODImodels2024,
177
+ author = {Ruan, Shenhui},
178
+ title = {PODImodels: POD-based Interpolation Models for Reduced-Order Modeling},
179
+ year = {2024},
180
+ url = {https://github.com/Ruansh233/PODImodels}
181
+ }
182
+ ```
183
+
184
+ ## License
185
+
186
+ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
187
+
188
+ ## Author
189
+
190
+ **Shenhui Ruan**
191
+ Email: shenhui.ruan@kit.edu
192
+ GitHub: [@Ruansh233](https://github.com/Ruansh233)
193
+
194
+ ## Acknowledgments
195
+
196
+ This package was developed for reduced-order modeling in computational physics applications, with a focus on CFD simulations.
@@ -0,0 +1,26 @@
1
+ [build-system]
2
+ requires = ["setuptools"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "PODImodels"
7
+ authors = [
8
+ {name = "Shenhui_Ruan", email = "shenhui.ruan@kit.edu"}
9
+ ]
10
+ description = "A py package to create ROM utilizing PODI method"
11
+ version = "0.0.3"
12
+ readme = "README.md"
13
+ requires-python = ">=3.8"
14
+ dependencies = [
15
+ "numpy",
16
+ "scikit-learn",
17
+ "scipy",
18
+ "pyvista",
19
+ "torch"
20
+ ]
21
+
22
+ [tool.setuptools]
23
+ package-dir = {"" = "src"}
24
+
25
+ [tool.setuptools.packages.find]
26
+ where = ["src"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+