Skip to content

Commit 0925a7e

Browse files
authored
Merge branch 'develop' into fix_damping_mass_outlet
2 parents 0da6ece + 1c6ce32 commit 0925a7e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+11333
-3171
lines changed

.github/workflows/codeql.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
3535
- name: Configure (cpp)
3636
if: ${{ matrix.language == 'cpp' }}
37-
run: ./meson.py build --optimization=1
37+
run: ./meson.py setup build --optimization=1
3838

3939
- name: Initialize CodeQL
4040
uses: github/codeql-action/init@v3

.github/workflows/regression.yml

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,12 @@ jobs:
5454
key: ${{ matrix.config_set }}-${{ github.sha }}
5555
restore-keys: ${{ matrix.config_set }}
5656
- name: Pre Cleanup
57-
uses: docker://ghcr.io/su2code/su2/build-su2:240320-1536
57+
uses: docker://ghcr.io/su2code/su2/build-su2:250717-1402
5858
with:
5959
entrypoint: /bin/rm
6060
args: -rf install install_bin.tgz src ccache ${{ matrix.config_set }}
6161
- name: Build
62-
uses: docker://ghcr.io/su2code/su2/build-su2:240320-1536
62+
uses: docker://ghcr.io/su2code/su2/build-su2:250717-1402
6363
with:
6464
args: -b ${{github.ref}} -f "${{matrix.flags}}"
6565
- name: Compress binaries
@@ -70,7 +70,7 @@ jobs:
7070
name: ${{ matrix.config_set }}
7171
path: install_bin.tgz
7272
- name: Post Cleanup
73-
uses: docker://ghcr.io/su2code/su2/build-su2:240320-1536
73+
uses: docker://ghcr.io/su2code/su2/build-su2:250717-1402
7474
with:
7575
entrypoint: /bin/rm
7676
args: -rf install install_bin.tgz src ccache ${{ matrix.config_set }}
@@ -97,12 +97,12 @@ jobs:
9797
key: ${{ matrix.config_set }}-${{ github.sha }}
9898
restore-keys: ${{ matrix.config_set }}
9999
- name: Pre Cleanup
100-
uses: docker://ghcr.io/su2code/su2/build-su2-tsan:240320-1536
100+
uses: docker://ghcr.io/su2code/su2/build-su2-tsan:250717-1402
101101
with:
102102
entrypoint: /bin/rm
103103
args: -rf install install_bin.tgz src ccache ${{ matrix.config_set }}
104104
- name: Build
105-
uses: docker://ghcr.io/su2code/su2/build-su2-tsan:240320-1536
105+
uses: docker://ghcr.io/su2code/su2/build-su2-tsan:250717-1402
106106
with:
107107
args: -b ${{github.ref}} -f "${{matrix.flags}}"
108108
- name: Compress binaries
@@ -113,7 +113,7 @@ jobs:
113113
name: ${{ matrix.config_set }}
114114
path: install_bin.tgz
115115
- name: Post Cleanup
116-
uses: docker://ghcr.io/su2code/su2/build-su2-tsan:240320-1536
116+
uses: docker://ghcr.io/su2code/su2/build-su2-tsan:250717-1402
117117
with:
118118
entrypoint: /bin/rm
119119
args: -rf install install_bin.tgz src ccache ${{ matrix.config_set }}
@@ -137,12 +137,12 @@ jobs:
137137
key: ${{ matrix.config_set }}-${{ github.sha }}
138138
restore-keys: ${{ matrix.config_set }}
139139
- name: Pre Cleanup
140-
uses: docker://ghcr.io/su2code/su2/build-su2-asan:240320-1536
140+
uses: docker://ghcr.io/su2code/su2/build-su2-asan:250717-1402
141141
with:
142142
entrypoint: /bin/rm
143143
args: -rf install install_bin.tgz src ccache ${{ matrix.config_set }}
144144
- name: Build
145-
run: docker run --rm --cap-add SYS_PTRACE -v $(pwd):${{ github.workspace }} -w ${{ github.workspace }} ghcr.io/su2code/su2/build-su2-asan:240320-1536 -b ${{github.ref}} -f "${{matrix.flags}}"
145+
run: docker run --rm --cap-add SYS_PTRACE -v $(pwd):${{ github.workspace }} -w ${{ github.workspace }} ghcr.io/su2code/su2/build-su2-asan:250717-1402 -b ${{github.ref}} -f "${{matrix.flags}}"
146146
- name: Compress binaries
147147
run: tar -zcvf install_bin.tgz install/*
148148
- name: Upload Binaries
@@ -151,7 +151,7 @@ jobs:
151151
name: ${{ matrix.config_set }}
152152
path: install_bin.tgz
153153
- name: Post Cleanup
154-
uses: docker://ghcr.io/su2code/su2/build-su2-asan:240320-1536
154+
uses: docker://ghcr.io/su2code/su2/build-su2-asan:250717-1402
155155
with:
156156
entrypoint: /bin/rm
157157
args: -rf install install_bin.tgz src ccache ${{ matrix.config_set }}
@@ -182,7 +182,7 @@ jobs:
182182
tag: OMP
183183
steps:
184184
- name: Pre Cleanup
185-
uses: docker://ghcr.io/su2code/su2/test-su2:240320-1536
185+
uses: docker://ghcr.io/su2code/su2/test-su2:250717-1402
186186
with:
187187
entrypoint: /bin/rm
188188
args: -rf install install_bin.tgz src ccache ${{ matrix.config_set }}
@@ -208,12 +208,12 @@ jobs:
208208
chmod a+x $BIN_FOLDER/*
209209
ls -lahR $BIN_FOLDER
210210
- name: Run Tests in Container
211-
uses: docker://ghcr.io/su2code/su2/test-su2:240320-1536
211+
uses: docker://ghcr.io/su2code/su2/test-su2:250717-1402
212212
with:
213213
# -t <Tutorials-branch> -c <Testcases-branch>
214214
args: -b ${{github.ref}} -t develop -c develop -s ${{matrix.testscript}}
215215
- name: Cleanup
216-
uses: docker://ghcr.io/su2code/su2/test-su2:240320-1536
216+
uses: docker://ghcr.io/su2code/su2/test-su2:250717-1402
217217
with:
218218
entrypoint: /bin/rm
219219
args: -rf install install_bin.tgz src ccache ${{ matrix.config_set }}
@@ -231,7 +231,7 @@ jobs:
231231
tag: TagNoMPI
232232
steps:
233233
- name: Pre Cleanup
234-
uses: docker://ghcr.io/su2code/su2/test-su2:240320-1536
234+
uses: docker://ghcr.io/su2code/su2/test-su2:250717-1402
235235
with:
236236
entrypoint: /bin/rm
237237
args: -rf install install_bin.tgz src ccache ${{ matrix.config_set }}
@@ -257,12 +257,12 @@ jobs:
257257
chmod a+x $BIN_FOLDER/*
258258
ls -lahR $BIN_FOLDER
259259
- name: Run Tests in Container
260-
uses: docker://ghcr.io/su2code/su2/test-su2:240320-1536
260+
uses: docker://ghcr.io/su2code/su2/test-su2:250717-1402
261261
with:
262262
# -t <Tutorials-branch> -c <Testcases-branch>
263263
args: -b ${{github.ref}} -t develop -c develop -s ${{matrix.testscript}} -a "--tapetests"
264264
- name: Cleanup
265-
uses: docker://ghcr.io/su2code/su2/test-su2:240320-1536
265+
uses: docker://ghcr.io/su2code/su2/test-su2:250717-1402
266266
with:
267267
entrypoint: /bin/rm
268268
args: -rf install install_bin.tgz src ccache ${{ matrix.config_set }}
@@ -277,7 +277,7 @@ jobs:
277277
testscript: ['hybrid_regression.py', 'hybrid_regression_AD.py']
278278
steps:
279279
- name: Pre Cleanup
280-
uses: docker://ghcr.io/su2code/su2/test-su2-tsan:240320-1536
280+
uses: docker://ghcr.io/su2code/su2/test-su2-tsan:250717-1402
281281
with:
282282
entrypoint: /bin/rm
283283
args: -rf install install_bin.tgz src ccache ${{ matrix.config_set }}
@@ -303,12 +303,12 @@ jobs:
303303
chmod a+x $BIN_FOLDER/*
304304
ls -lahR $BIN_FOLDER
305305
- name: Run Tests in Container
306-
uses: docker://ghcr.io/su2code/su2/test-su2-tsan:240320-1536
306+
uses: docker://ghcr.io/su2code/su2/test-su2-tsan:250717-1402
307307
with:
308308
# -t <Tutorials-branch> -c <Testcases-branch>
309309
args: -b ${{github.ref}} -t develop -c develop -s ${{matrix.testscript}} -a "--tsan"
310310
- name: Cleanup
311-
uses: docker://ghcr.io/su2code/su2/test-su2-tsan:240320-1536
311+
uses: docker://ghcr.io/su2code/su2/test-su2-tsan:250717-1402
312312
with:
313313
entrypoint: /bin/rm
314314
args: -rf install install_bin.tgz src ccache ${{ matrix.config_set }}
@@ -322,7 +322,7 @@ jobs:
322322
testscript: ['serial_regression.py', 'serial_regression_AD.py']
323323
steps:
324324
- name: Pre Cleanup
325-
uses: docker://ghcr.io/su2code/su2/test-su2-asan:240320-1536
325+
uses: docker://ghcr.io/su2code/su2/test-su2-asan:250717-1402
326326
with:
327327
entrypoint: /bin/rm
328328
args: -rf install install_bin.tgz src ccache ${{ matrix.config_set }}
@@ -348,12 +348,12 @@ jobs:
348348
chmod a+x $BIN_FOLDER/*
349349
ls -lahR $BIN_FOLDER
350350
- name: Run Tests in Container
351-
uses: docker://ghcr.io/su2code/su2/test-su2-asan:240320-1536
351+
uses: docker://ghcr.io/su2code/su2/test-su2-asan:250717-1402
352352
with:
353353
# -t <Tutorials-branch> -c <Testcases-branch>
354354
args: -b ${{github.ref}} -t develop -c develop -s ${{matrix.testscript}} -a "--asan"
355355
- name: Cleanup
356-
uses: docker://ghcr.io/su2code/su2/test-su2-asan:240320-1536
356+
uses: docker://ghcr.io/su2code/su2/test-su2-asan:250717-1402
357357
with:
358358
entrypoint: /bin/rm
359359
args: -rf install install_bin.tgz src ccache ${{ matrix.config_set }}
@@ -374,7 +374,7 @@ jobs:
374374
tag: MPI
375375
steps:
376376
- name: Pre Cleanup
377-
uses: docker://ghcr.io/su2code/su2/test-su2:240320-1536
377+
uses: docker://ghcr.io/su2code/su2/test-su2:250717-1402
378378
with:
379379
entrypoint: /bin/rm
380380
args: -rf install install_bin.tgz src ccache ${{ matrix.config_set }}
@@ -435,11 +435,11 @@ jobs:
435435
echo $PWD
436436
ls -lahR
437437
- name: Run Unit Tests
438-
uses: docker://ghcr.io/su2code/su2/test-su2:240320-1536
438+
uses: docker://ghcr.io/su2code/su2/test-su2:250717-1402
439439
with:
440440
entrypoint: install/bin/${{matrix.testdriver}}
441441
- name: Post Cleanup
442-
uses: docker://ghcr.io/su2code/su2/test-su2:240320-1536
442+
uses: docker://ghcr.io/su2code/su2/test-su2:250717-1402
443443
with:
444444
entrypoint: /bin/rm
445445
args: -rf install install_bin.tgz src ccache ${{ matrix.config_set }}

.github/workflows/release-management.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
key: ${{ matrix.os_bin }}-${{ github.sha }}
3636
restore-keys: ${{ matrix.os_bin }}
3737
- name: Build
38-
uses: docker://ghcr.io/su2code/su2/build-su2-cross:230813-0103
38+
uses: docker://ghcr.io/su2code/su2/build-su2-cross:250717-1402
3939
with:
4040
args: -b ${{ github.sha }} -f "${{matrix.flags}}"
4141
- name: Create Archive

Common/include/CConfig.hpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -707,6 +707,7 @@ class CConfig {
707707
Wrt_Restart_Overwrite, /*!< \brief Overwrite restart files or append iteration number.*/
708708
Wrt_Surface_Overwrite, /*!< \brief Overwrite surface output files or append iteration number.*/
709709
Wrt_Volume_Overwrite, /*!< \brief Overwrite volume output files or append iteration number.*/
710+
PyCustomSource, /*!< \brief Use a user-defined custom source term .*/
710711
Restart_Flow; /*!< \brief Restart flow solution for adjoint and linearized problems. */
711712
unsigned short nMarker_Monitoring, /*!< \brief Number of markers to monitor. */
712713
nMarker_Designing, /*!< \brief Number of markers for the objective function. */
@@ -3088,6 +3089,12 @@ class CConfig {
30883089
*/
30893090
unsigned short GetnMarker_PyCustom(void) const { return nMarker_PyCustom; }
30903091

3092+
/*!
3093+
* \brief Get the Python custom source term activation.
3094+
* \return Custom source term is active or not.
3095+
*/
3096+
bool GetPyCustomSource(void) const { return PyCustomSource; }
3097+
30913098
/*!
30923099
* \brief Get the total number of moving markers.
30933100
* \return Total number of moving markers.

Common/include/basic_types/ad_structure.hpp

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,12 @@ inline void StartRecording() {}
5252
* \brief Pause the recording of the operations and involved variables.
5353
* If called, all operations occuring after the call will not be stored on the computational graph.
5454
*/
55-
inline void PauseRecording() {}
55+
inline bool PauseRecording() { return false; }
5656

5757
/*!
5858
* \brief Resume the recording of the operations and variables after the recording had been paused.
5959
*/
60-
inline void ResumeRecording() {}
60+
inline void ResumeRecording(bool wasActive) { (void)wasActive; }
6161

6262
/*!
6363
* \brief Stops the recording of the operations and variables.
@@ -413,9 +413,19 @@ FORCEINLINE void ResetInput(su2double& data) { data = data.getValue(); }
413413

414414
FORCEINLINE void StartRecording() { AD::getTape().setActive(); }
415415

416-
FORCEINLINE void PauseRecording() { AD::getTape().setPassive(); }
416+
FORCEINLINE bool PauseRecording() {
417+
if (AD::getTape().isActive()) {
418+
AD::getTape().setPassive();
419+
return true;
420+
}
421+
return false;
422+
}
417423

418-
FORCEINLINE void ResumeRecording() { AD::getTape().setActive(); }
424+
FORCEINLINE void ResumeRecording(bool wasActive) {
425+
if (wasActive) {
426+
AD::getTape().setActive();
427+
}
428+
}
419429

420430
FORCEINLINE void StopRecording() { AD::getTape().setPassive(); }
421431

Common/include/containers/CPyWrapperMatrixView.hpp

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@
5555
/*! \brief Gets the value for a (row, column) pair. */ \
5656
passivedouble operator()(unsigned long row, unsigned long col) const { return Get(row, col); } \
5757
\
58+
/*! \brief Gets the values for a row of the matrix. */ \
59+
std::vector<passivedouble> operator()(unsigned long row) const { return Get(row); } \
60+
\
5861
/*! \brief Gets the value for a (row, column) pair. */ \
5962
passivedouble Get(unsigned long row, unsigned long col) const { return SU2_TYPE::GetValue(Access(row, col)); } \
6063
\
@@ -163,3 +166,77 @@ class CPyWrapperMarkerMatrixView {
163166
/*--- Use the macro to generate the interface. ---*/
164167
PY_WRAPPER_MATRIX_INTERFACE
165168
};
169+
170+
/*!
171+
* \class CPyWrapper3DMatrixView
172+
* \ingroup PySU2
173+
* \brief This class wraps C3DDoubleMatrix for the python wrapper matrix interface.
174+
* It is generaly used to wrap access to solver gradients defined for the entire volume.
175+
*/
176+
class CPyWrapper3DMatrixView {
177+
protected:
178+
static_assert(su2activematrix::IsRowMajor, "");
179+
su2double* data_ = nullptr;
180+
unsigned long rows_ = 0, cols_ = 0, dims_ = 0;
181+
std::string name_;
182+
bool read_only_ = false;
183+
184+
/*--- Define the functions required by the interface macro. ---*/
185+
inline const su2double& Access(unsigned long row, unsigned long col, unsigned long dim) const {
186+
if (row > rows_ || col > cols_ || dim > dims_) SU2_MPI::Error(name_ + " out of bounds", "CPyWrapper3DMatrixView");
187+
return data_[row * (cols_ * dims_) + col * dims_ + dim];
188+
}
189+
inline su2double& Access(unsigned long row, unsigned long col, unsigned long dim) {
190+
if (read_only_) SU2_MPI::Error(name_ + " is read-only", "CPyWrapper3DMatrixView");
191+
const auto& const_me = *this;
192+
return const_cast<su2double&>(const_me.Access(row, col, dim));
193+
}
194+
195+
public:
196+
CPyWrapper3DMatrixView() = default;
197+
198+
/*!
199+
* \brief Construct the view of the matrix.
200+
* \note "name" should be set to the variable name being returned to give better information to users.
201+
* \note "read_only" can be set to true to prevent the data from being modified.
202+
*/
203+
CPyWrapper3DMatrixView(C3DDoubleMatrix& mat, const std::string& name, bool read_only)
204+
: data_(mat.data()),
205+
rows_(mat.length()),
206+
cols_(mat.rows()),
207+
dims_(mat.cols()),
208+
name_(name),
209+
read_only_(read_only) {}
210+
211+
/*! \brief Returns the shape of the matrix. */
212+
std::vector<unsigned long> Shape() const { return {rows_, cols_, dims_}; }
213+
214+
/*! \brief Returns whether the data is read-only [true] or if it can be modified [false]. */
215+
bool IsReadOnly() const { return read_only_; }
216+
217+
/*! \brief Gets the value for a (row, column, dimension) triplet. */
218+
passivedouble operator()(unsigned long row, unsigned long col, unsigned long dim) const { return Get(row, col, dim); }
219+
220+
/*! \brief Gets the values for a row and column of the matrix. */
221+
std::vector<passivedouble> operator()(unsigned long row, unsigned long col) const { return Get(row, col); }
222+
223+
/*! \brief Gets the value for a (row, column, dimension) triplet. */
224+
passivedouble Get(unsigned long row, unsigned long col, unsigned long dim) const {
225+
return SU2_TYPE::GetValue(Access(row, col, dim));
226+
}
227+
228+
/*! \brief Gets the values for a row and column of the matrix. */
229+
std::vector<passivedouble> Get(unsigned long row, unsigned long col) const {
230+
std::vector<passivedouble> vals(dims_);
231+
for (unsigned long j = 0; j < dims_; ++j) vals[j] = Get(row, col, j);
232+
return vals;
233+
}
234+
/*! \brief Sets the value for a (row, column, dimension) triplet. This clears derivative information. */
235+
void Set(unsigned long row, unsigned long col, unsigned long dim, passivedouble val) { Access(row, col, dim) = val; }
236+
237+
/*! \brief Sets the values for a row and column of the matrix. */
238+
void Set(unsigned long row, unsigned long col, std::vector<passivedouble> vals) {
239+
unsigned long j = 0;
240+
for (const auto& val : vals) Set(row, col, j++, val);
241+
}
242+
};

Common/include/containers/container_decorators.hpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,11 @@ class C3DContainerDecorator {
165165
FORCEINLINE StaticContainer get(Int i, Index j = 0) const noexcept {
166166
return m_storage.template get<StaticContainer>(i, j * m_innerSz);
167167
}
168+
169+
/*!
170+
* \brief Raw data access, for Python wrapper.
171+
*/
172+
FORCEINLINE Scalar* data() { return m_storage.data(); }
168173
};
169174

170175
/*!

Common/include/geometry/dual_grid/CPoint.hpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,9 @@ class CPoint {
8282
su2activematrix Coord; /*!< \brief vector with the coordinates of the node. */
8383
su2activematrix
8484
Coord_Old; /*!< \brief Old coordinates vector for primal solution reloading for Disc.Adj. with dynamic grid. */
85-
su2activematrix Coord_Sum; /*!< \brief Sum of coordinates vector for geometry smoothing. */
86-
su2activematrix Coord_n; /*!< \brief Coordinates at time n for use with dynamic meshes. */
87-
su2activematrix Coord_n1; /*!< \brief Coordinates at time n-1 for use with dynamic meshes. */
88-
su2activematrix Coord_p1; /*!< \brief Coordinates at time n+1 for use with dynamic meshes. */
85+
su2activematrix Coord_n; /*!< \brief Coordinates at time n for use with dynamic meshes. */
86+
su2activematrix Coord_n1; /*!< \brief Coordinates at time n-1 for use with dynamic meshes. */
87+
su2activematrix Coord_p1; /*!< \brief Coordinates at time n+1 for use with dynamic meshes. */
8988

9089
su2activematrix GridVel; /*!< \brief Velocity of the grid for dynamic mesh cases. */
9190
CVectorOfMatrix GridVel_Grad; /*!< \brief Gradient of the grid velocity for dynamic meshes. */

Common/include/option_structure.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -550,7 +550,7 @@ enum ENUM_FLUIDMODEL {
550550
FLUID_MIXTURE = 9, /*!< \brief Species mixture model. */
551551
COOLPROP = 10, /*!< \brief Thermodynamics library. */
552552
FLUID_FLAMELET = 11, /*!< \brief lookup table (LUT) method for premixed flamelets. */
553-
DATADRIVEN_FLUID = 12, /*!< \brief multi-layer perceptron driven fluid model. */
553+
DATADRIVEN_FLUID = 12, /*!< \brief multi-layer perceptron driven fluid model. */
554554
};
555555
static const MapType<std::string, ENUM_FLUIDMODEL> FluidModel_Map = {
556556
MakePair("STANDARD_AIR", STANDARD_AIR)

0 commit comments

Comments
 (0)