FFD Source Code
ffd.ffd.Deform
Bases: ABC
This class implements an abstract Deform class.
Source code in aero_optim/ffd/ffd.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
|
__init__(dat_file: str, ncontrol: int, header: int = 2)
Instantiates the abstract Deform object.
Input
- dat_file (str): path to input_geometry.dat.
- ncontrol (int): the number of control points.
- header (int): the number of header lines in dat_file.
Inner
-
pts (np.ndarray): the geometry coordinates in the original referential.
pts = [[x0, y0, z0], [x1, y1, z1], ..., [xN, yN, zN]] where N is the number of points describing the geometry and (z0, ..., zN) are null or identical.
Source code in aero_optim/ffd/ffd.py
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
|
apply_ffd(Delta: np.ndarray) -> np.ndarray
abstractmethod
Returns a deformed profile.
Source code in aero_optim/ffd/ffd.py
62 63 64 65 66 |
|
write_ffd(profile: np.ndarray, Delta: np.ndarray, outdir: str, gid: int = 0, cid: int = 0) -> str
Writes the deformed geometry to file and returns /path/to/outdir/outfile.
- profile (np.ndarray): the deformed geometry coordinates to be written to outfile.
- Delta (np.ndarray): the deformation vector.
- outdir (str): the output directory (it is to be combined with outfile).
Source code in aero_optim/ffd/ffd.py
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
|
ffd.ffd.FFD_2D
Bases: Deform
This class implements a simple 2D FFD algorithm with deformation /y only.
For ncontrol = 2 i.e. 2 control points per side, the unperturbed lattice is:
P01 ----- P11 ---- P21 ---- P31
| |
| *************** |
| **** profile **** |
| *************** |
| |
P00 ----- P10 ---- P20 ---- P30
with (P00, P30, P01, P31) fixed.
Source code in aero_optim/ffd/ffd.py
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 |
|
__init__(dat_file: str, ncontrol: int, header: int = 2)
Instantiates the FFD_2D object.
Input
- dat_file (str): path to input_geometry.dat.
- ncontrol (int): the number of control points on each side of the lattice.
- header (int): the number of header lines in dat_file.
Inner
-
pts (np.ndarray): the geometry coordinates in the original referential.
pts = [[x0, y0, z0], [x1, y1, z1], ..., [xN, yN, zN]] where N is the number of points describing the geometry and (z0, ..., zN) are null or identical.
-
L (int): the number of control points in the x direction of each side of the lattice.
- M (int): the number of control points in the y direction of each side of the lattice.
- lat_pts (np.ndarray): the geometry coordinates in the lattice referential.
Source code in aero_optim/ffd/ffd.py
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 |
|
apply_ffd(Delta: np.ndarray) -> np.ndarray
Returns a new profile resulting from a perturbation Delta in the original referential.
- Delta (np.ndarray): the deformation vector. Delta = [dP10, dP20, ..., dP{nc}0, dP11, dP21, ..., dP{nc}1] with nc = ncontrol.
Source code in aero_optim/ffd/ffd.py
162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 |
|
build_lattice()
Builds a rectangle lattice with x1 as its origin.
Source code in aero_optim/ffd/ffd.py
113 114 115 116 117 118 119 120 121 122 |
|
dPij(i: int, j: int, Delta: np.ndarray) -> np.ndarray
Returns y-oriented displacement coordinates dPij from a 1D array Delta.
Source code in aero_optim/ffd/ffd.py
146 147 148 149 150 |
|
from_lat(pts: np.ndarray) -> np.ndarray
Returns lattice coordinates back in the original referential.
Source code in aero_optim/ffd/ffd.py
136 137 138 139 140 141 142 143 144 |
|
pad_Delta(Delta: np.ndarray) -> np.ndarray
Returns padded Delta = [0, dP10, dP20, ..., dP{nc}0, 0, 0, dP11, dP21, ..., dP{nc}1, 0] with nc = ncontrol.
- Delta (np.ndarray): the non-padded deformation vector.
Source code in aero_optim/ffd/ffd.py
152 153 154 155 156 157 158 159 160 |
|
to_lat(pts: np.ndarray) -> np.ndarray
Returns the coordinates projected in the lattices referential.
- pts (np.ndarray): the geometry coordinates in the original referential.
Source code in aero_optim/ffd/ffd.py
124 125 126 127 128 129 130 131 132 133 134 |
|
ffd.ffd.FFD_POD_2D
Bases: Deform
This class implements a 2D FFD-POD coupled class.
Source code in aero_optim/ffd/ffd.py
183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 |
|
__init__(dat_file: str, pod_ncontrol: int, ffd_ncontrol: int, ffd_dataset_size: int, ffd_bound: tuple[Any], header: int = 2, seed: int = 123)
Instantiates the FFD_POD_2D object.
Input
- dat_file (str): path to input_geometry.dat.
- pod_ncontrol (int): the number of POD control points.
- ffd_ncontrol (int): the number of FFD control points.
- ffd_dataset_size (int): the number of ffd profiles in the POD dataset.
- ffd_bound (tuple[Any]): the ffd dataset deformation boundaries.
- header (int): the number of header lines in dat_file.
- seed (int): seed for the POD dataset sampling.
Inner
-
pts (np.ndarray): the geometry coordinates in the original referential.
pts = [[x0, y0, z0], [x1, y1, z1], ..., [xN, yN, zN]] where N is the number of points describing the geometry and (z0, ..., zN) are null or identical.
-
ffd (FFD_2D): the ffd object used to build the POD dataset.
Source code in aero_optim/ffd/ffd.py
187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 |
|