Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
3e8ba47
add basic support for rotation changes
HahsFilip Jul 11, 2023
5fdc664
add translation
HahsFilip Jul 28, 2023
ba0e732
add example
HahsFilip Jul 28, 2023
e5fde5c
Merge branch 'develop' into py_wrapper_moving_wall
HahsFilip Jul 28, 2023
0368765
Merge branch 'develop' into py_wrapper_moving_wall
kursatyurt Jul 28, 2023
ce66598
remove unused imports
HahsFilip Jul 29, 2023
f8a76fe
Merge branch 'py_wrapper_moving_wall' of https://github.com/HahsFilip…
HahsFilip Jul 29, 2023
5d90c34
i hope the test will pass
HahsFilip Jul 29, 2023
7331adb
Apply suggestions from code review
pcarruscag Jul 30, 2023
eb21853
Apply suggestions from code review
pcarruscag Jul 30, 2023
269fbc0
Merge branch 'develop' into py_wrapper_moving_wall
HahsFilip Jul 30, 2023
c4a781d
Merge branch 'develop' into py_wrapper_moving_wall
pcarruscag Jul 30, 2023
99fece9
Merge branch 'develop' into py_wrapper_moving_wall
kursatyurt Aug 16, 2023
32dcd85
Apply suggestions from code review
pcarruscag Oct 26, 2023
0396de8
Merge branch 'develop' into py_wrapper_moving_wall
pcarruscag Oct 26, 2023
a7f4e92
chaged tests to remove numerical noise, remove unused lines, add name…
HahsFilip Nov 4, 2023
fc652dd
Merge branch 'develop' into py_wrapper_moving_wall
HahsFilip Nov 4, 2023
d0486c1
change fsi serial regression test
HahsFilip Nov 4, 2023
dfd8dab
Merge remote-tracking branch 'origin/py_wrapper_moving_wall' into py_…
HahsFilip Nov 4, 2023
00f9f14
Merge branch 'develop' into py_wrapper_moving_wall
HahsFilip Nov 9, 2023
4e36eee
more test changes
HahsFilip Nov 10, 2023
ca5f06c
Merge branch 'py_wrapper_moving_wall' of https://github.com/HahsFilip…
HahsFilip Nov 10, 2023
a009c2e
Revert "more test changes"
HahsFilip Nov 12, 2023
0adab08
Merge branch 'develop' into py_wrapper_moving_wall
kursatyurt Nov 17, 2023
d63931b
Merge branch 'develop' into py_wrapper_moving_wall
kursatyurt Nov 17, 2023
980551c
Merge branch 'develop' into py_wrapper_moving_wall
kursatyurt Dec 6, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions AUTHORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ Eduardo Molina
Edwin van der Weide
Ethan Alan Hereth
Florian Dittmann
Filip Hahs
Francesco Poli
Francisco D. Palacios
Gaurav Bansal
Expand Down
19 changes: 19 additions & 0 deletions Common/include/CConfig.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5910,6 +5910,15 @@ class CConfig {
*/
su2double GetMarkerTranslationRate(unsigned short iMarkerMoving, unsigned short iDim) const { return MarkerTranslation_Rate[3*iMarkerMoving + iDim];}

/*!
* \brief Set the translation rate of the marker.
* \param[in] iDim - spatial component
* \param[in] val - translational velocity
*/
void SetMarkerTranslationRate(unsigned short iMarkerMoving, unsigned short iDim, su2double val) {
MarkerTranslation_Rate[3 * iMarkerMoving + iDim] = val;
}

/*!
* \brief Get the rotation rate of the mesh.
* \param[in] iDim - spatial component
Expand All @@ -5933,6 +5942,16 @@ class CConfig {
*/
su2double GetMarkerRotationRate(unsigned short iMarkerMoving, unsigned short iDim) const { return MarkerRotation_Rate[3*iMarkerMoving + iDim];}

/*!
Comment thread
pcarruscag marked this conversation as resolved.
* \brief Set the rotation rate of the marker.
* \param[in] iMarkerMoving - Index of the moving marker (as specified in Marker_Moving)
* \param[in] iDim - spatial component
* \param[in] val - Rotational velocity
*/
void SetMarkerRotationRate(unsigned short iMarkerMoving, unsigned short iDim, su2double val) {
MarkerRotation_Rate[3 * iMarkerMoving + iDim] = val;
}

/*!
* \brief Get the pitching rate of the mesh.
* \param[in] iDim - spatial component
Expand Down
18 changes: 18 additions & 0 deletions SU2_CFD/include/drivers/CDriver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,24 @@ class CDriver : public CDriverBase {
*/
void SetRotationRate(passivedouble rot_x, passivedouble rot_y, passivedouble rot_z);

/*!
Comment thread
pcarruscag marked this conversation as resolved.
* \brief Set the moving wall marker rotation rates.
* \param[in] iMaker - Index of moving wall marker.
* \param[in] rot_x - Value of Angular velocity about x-axes.
* \param[in] rot_y - Value of Angular velocity about y-axes.
* \param[in] rot_z - Value of Angular velocity about z-axes.
*/
void SetMarkerRotationRate(unsigned short iMarker, passivedouble rot_x, passivedouble rot_y, passivedouble rot_z);

/*!
* \brief Set the moving wall marker translation rates.
* \param[in] iMaker - Index of moving wall marker.
* \param[in] vel_x - Value of velocity along x-axis.
* \param[in] vel_y - Value of velocity along y-axis.
* \param[in] vel_z - Value of velocity along z-axis.
*/
void SetMarkerTranslationRate(unsigned short iMarker, passivedouble vel_x, passivedouble vel_y, passivedouble vel_z);

/// \}
};

Expand Down
9 changes: 8 additions & 1 deletion SU2_CFD/src/iteration/CIteration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,11 @@ void CIteration::SetGrid_Movement(CGeometry** geometry, CSurfaceMovement* surfac
break;
}

if (config->GetSurface_Movement(AEROELASTIC) || config->GetSurface_Movement(AEROELASTIC_RIGID_MOTION)) {
if (config->GetSurface_Movement(AEROELASTIC) || config->GetSurface_Movement(AEROELASTIC_RIGID_MOTION) || config->GetSurface_Movement(MOVING_WALL)) {
/*--- Apply rigid mesh transformation to entire grid first, if necessary ---*/

if (IntIter == 0) {

if (Kind_Grid_Movement == AEROELASTIC_RIGID_MOTION) {
if (rank == MASTER_NODE) cout << endl << " Performing rigid mesh transformation." << endl;

Expand All @@ -110,6 +112,11 @@ void CIteration::SetGrid_Movement(CGeometry** geometry, CSurfaceMovement* surfac

grid_movement->UpdateMultiGrid(geometry, config);
}
if (config->GetSurface_Movement(MOVING_WALL)) {
for (auto iMGlevel = 0u; iMGlevel <= config->GetnMGLevels(); iMGlevel++) {
geometry[iMGlevel]->SetWallVelocity(config, iMGlevel == 0u);
}
}

}

Expand Down
12 changes: 12 additions & 0 deletions SU2_CFD/src/python_wrapper_structure.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,3 +163,15 @@ void CDriver::SetRotationRate(passivedouble rot_x, passivedouble rot_y, passived
main_config->SetRotation_Rate(2, rot_z);
}

void CDriver::SetMarkerRotationRate(unsigned short iMarker, passivedouble rot_x, passivedouble rot_y, passivedouble rot_z) {
config_container[selected_zone]->SetMarkerRotationRate(iMarker, 0, rot_x);
config_container[selected_zone]->SetMarkerRotationRate(iMarker, 1, rot_y);
config_container[selected_zone]->SetMarkerRotationRate(iMarker, 2, rot_z);
}

void CDriver::SetMarkerTranslationRate(unsigned short iMarker, passivedouble vel_x, passivedouble vel_y, passivedouble vel_z) {
config_container[selected_zone]->SetMarkerTranslationRate(iMarker, 0, vel_x);
config_container[selected_zone]->SetMarkerTranslationRate(iMarker, 1, vel_y);
config_container[selected_zone]->SetMarkerTranslationRate(iMarker, 2, vel_z);
}

6 changes: 3 additions & 3 deletions TestCases/hybrid_regression.py
Original file line number Diff line number Diff line change
Expand Up @@ -436,16 +436,16 @@ def main():
cavity.cfg_dir = "moving_wall/cavity"
cavity.cfg_file = "lam_cavity.cfg"
cavity.test_iter = 25
cavity.test_vals = [-5.627934, -0.164469, 0.052000, 2.547063]
cavity.test_vals = [-5.627868, -0.164404, 0.053310, 2.545839]
test_list.append(cavity)

# Spinning cylinder
spinning_cylinder = TestCase('spinning_cylinder')
spinning_cylinder.cfg_dir = "moving_wall/spinning_cylinder"
spinning_cylinder.cfg_file = "spinning_cylinder.cfg"
spinning_cylinder.test_iter = 25
spinning_cylinder.test_vals = [-8.001291, -2.607959, 1.501321, 1.488559]
spinning_cylinder.test_vals_aarch64 = [-8.001291, -2.607959, 1.501321, 1.488559]
spinning_cylinder.test_vals = [-8.006541, -2.609759, 1.495662, 1.486341]
spinning_cylinder.test_vals_aarch64 = [-8.006541, -2.609759, 1.495662, 1.486341]
test_list.append(spinning_cylinder)

######################################
Expand Down
4 changes: 2 additions & 2 deletions TestCases/parallel_regression.py
Original file line number Diff line number Diff line change
Expand Up @@ -925,15 +925,15 @@ def main():
cavity.cfg_dir = "moving_wall/cavity"
cavity.cfg_file = "lam_cavity.cfg"
cavity.test_iter = 25
cavity.test_vals = [-5.611007, -0.146826, 1.113206, 1.491678]
cavity.test_vals = [-5.610928, -0.146749, 1.114461, 1.490381]
test_list.append(cavity)

# Spinning cylinder
spinning_cylinder = TestCase('spinning_cylinder')
spinning_cylinder.cfg_dir = "moving_wall/spinning_cylinder"
spinning_cylinder.cfg_file = "spinning_cylinder.cfg"
spinning_cylinder.test_iter = 25
spinning_cylinder.test_vals = [-7.802803, -2.362844, 1.687705, 1.519676]
spinning_cylinder.test_vals = [-7.806016, -2.364954, 1.683365, 1.517059]
test_list.append(spinning_cylinder)

######################################
Expand Down
19 changes: 19 additions & 0 deletions TestCases/py_wrapper/rotating_cylinder/run.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import pysu2 # imports the SU2 wrapped module

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks 👍 to make a regression test from this you need to add it to parallel_regression.py

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add our license header to this file please (since it's also code).

from mpi4py import MPI
import numpy as np

comm = MPI.COMM_WORLD
rank = comm.Get_rank()
rotation_vector = np.linspace(0,20,10)
SU2Driver = pysu2.CSinglezoneDriver("spinning_cylinder.cfg",1, comm)

for i, rate in enumerate(rotation_vector):
SU2Driver.SetMarkerRotationRate(0,0,0,rate)
SU2Driver.Preprocess(i)
SU2Driver.Run()
SU2Driver.Postprocess()
SU2Driver.Output(i)
SU2Driver.Update()
SU2Driver.Finalize()


115 changes: 115 additions & 0 deletions TestCases/py_wrapper/rotating_cylinder/spinning_cylinder.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% SU2 configuration file %
% Case description: Laminar flow around a spinning cylinder %
% Author: Thomas D. Economon %
% Institution: Stanford University %
% Date: 2013.08.21 %
% File Version 7.5.1 "Blackbird" %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% ------------- DIRECT, ADJOINT, AND LINEARIZED PROBLEM DEFINITION ------------%
%
SOLVER= NAVIER_STOKES
KIND_TURB_MODEL= NONE
MATH_PROBLEM= DIRECT
RESTART_SOL= NO

% ----------- COMPRESSIBLE AND INCOMPRESSIBLE FREE-STREAM DEFINITION ----------%
%
MACH_NUMBER= 0.1
AOA= 0.0
SIDESLIP_ANGLE= 0.0
FREESTREAM_TEMPERATURE= 288.15
REYNOLDS_NUMBER= 200.0
REYNOLDS_LENGTH= 1.0

% ----------------------- DYNAMIC MESH DEFINITION -----------------------------%
%
SURFACE_MOVEMENT= MOVING_WALL
MACH_MOTION= 0.1
MARKER_MOVING= ( cylinder )
SURFACE_MOTION_ORIGIN= 0.5 0.0 0.0
SURFACE_ROTATION_RATE = 0.0 0.0 -199.0738

% ---------------------- REFERENCE VALUE DEFINITION ---------------------------%
%
REF_ORIGIN_MOMENT_X = 0.00
REF_ORIGIN_MOMENT_Y = 0.00
REF_ORIGIN_MOMENT_Z = 0.00
REF_LENGTH= 1.0
REF_AREA= 1.0

% -------------------- BOUNDARY CONDITION DEFINITION --------------------------%
%
MARKER_HEATFLUX= ( cylinder, 0.0 )
MARKER_FAR= ( farfield )
MARKER_PLOTTING= ( cylinder )
MARKER_MONITORING= ( cylinder )

% ------------- COMMON PARAMETERS DEFINING THE NUMERICAL METHOD ---------------%
%
NUM_METHOD_GRAD= WEIGHTED_LEAST_SQUARES
CFL_NUMBER= 100.0
CFL_ADAPT= NO
CFL_ADAPT_PARAM= ( 1.5, 0.5, 1.0, 100.0 )
ITER= 99999

% ----------------------- SLOPE LIMITER DEFINITION ----------------------------%
%
VENKAT_LIMITER_COEFF= 0.03
ADJ_SHARP_LIMITER_COEFF= 3.0
REF_SHARP_EDGES= 3.0
SENS_REMOVE_SHARP= NO

% ------------------------ LINEAR SOLVER DEFINITION ---------------------------%
%
LINEAR_SOLVER= FGMRES
LINEAR_SOLVER_PREC= LU_SGS
LINEAR_SOLVER_ERROR= 1E-4
LINEAR_SOLVER_ITER= 5

% -------------------------- MULTIGRID PARAMETERS -----------------------------%
%
MGLEVEL= 3
MGCYCLE= V_CYCLE
MG_PRE_SMOOTH= ( 1, 1, 1, 1 )
MG_POST_SMOOTH= ( 0, 0, 0, 0 )
MG_CORRECTION_SMOOTH= ( 0, 0, 0, 0 )
MG_DAMP_RESTRICTION= 0.5
MG_DAMP_PROLONGATION= 0.5

% -------------------- FLOW NUMERICAL METHOD DEFINITION -----------------------%
%
CONV_NUM_METHOD_FLOW= ROE
MUSCL_FLOW= YES
SLOPE_LIMITER_FLOW= NONE
JST_SENSOR_COEFF= ( 0.5, 0.02 )
TIME_DISCRE_FLOW= EULER_IMPLICIT

% --------------------------- CONVERGENCE PARAMETERS --------------------------%
%
CONV_RESIDUAL_MINVAL= -15
CONV_STARTITER= 10
CONV_CAUCHY_ELEMS= 100
CONV_CAUCHY_EPS= 1E-7

% ------------------------- INPUT/OUTPUT INFORMATION --------------------------%
%
MESH_FILENAME= mesh_cylinder_lam.su2
MESH_FORMAT= SU2
MESH_OUT_FILENAME= mesh_out.su2
SOLUTION_FILENAME= solution_flow.dat
SOLUTION_ADJ_FILENAME= solution_adj.dat
TABULAR_FORMAT= CSV
CONV_FILENAME= history
RESTART_FILENAME= restart_flow.dat
RESTART_ADJ_FILENAME= restart_adj.dat
VOLUME_FILENAME= flow
VOLUME_ADJ_FILENAME= adjoint
GRAD_OBJFUNC_FILENAME= of_grad.dat
SURFACE_FILENAME= surface_flow
SURFACE_ADJ_FILENAME= surface_adjoint
OUTPUT_WRT_FREQ= 100
SCREEN_OUTPUT= (INNER_ITER, RMS_DENSITY, RMS_ENERGY, LIFT, DRAG)
5 changes: 3 additions & 2 deletions TestCases/serial_regression.py
Original file line number Diff line number Diff line change
Expand Up @@ -750,15 +750,15 @@ def main():
cavity.cfg_dir = "moving_wall/cavity"
cavity.cfg_file = "lam_cavity.cfg"
cavity.test_iter = 25
cavity.test_vals = [-5.627934, -0.164470, 0.051972, 2.547039]
cavity.test_vals = [ -5.627868, -0.164405, 0.053283, 2.545817]
test_list.append(cavity)

# Spinning cylinder
spinning_cylinder = TestCase('spinning_cylinder')
spinning_cylinder.cfg_dir = "moving_wall/spinning_cylinder"
spinning_cylinder.cfg_file = "spinning_cylinder.cfg"
spinning_cylinder.test_iter = 25
spinning_cylinder.test_vals = [-7.889994, -2.469385, 1.708162, 1.670039]
spinning_cylinder.test_vals = [-7.892807, -2.467378, 1.702819, 1.669208]
test_list.append(spinning_cylinder)

######################################
Expand Down Expand Up @@ -1066,6 +1066,7 @@ def main():
airfoilRBF.cfg_dir = "fea_fsi/Airfoil_RBF"
airfoilRBF.cfg_file = "config.cfg"
airfoilRBF.test_iter = 1

airfoilRBF.test_vals = [1.000000, -2.786186, -4.977944]
airfoilRBF.tol = 0.0001
airfoilRBF.multizone = True
Expand Down
2 changes: 1 addition & 1 deletion externals/codi
Submodule codi updated 52 files
+0 −1 .clang-format
+0 −1 cmake/codipack-config.cmake
+0 −1 documentation/Changelog.md
+1 −3 include/codi.hpp
+4 −42 include/codi/config.h
+6 −6 include/codi/expressions/activeTypeBase.hpp
+0 −153 include/codi/expressions/activeTypeStatelessTape.hpp
+2 −2 include/codi/expressions/binaryExpression.hpp
+2 −3 include/codi/expressions/lhsExpressionInterface.hpp
+8 −148 include/codi/expressions/real/binaryOperators.hpp
+0 −232 include/codi/expressions/real/unaryOperators.hpp
+1 −1 include/codi/expressions/referenceActiveType.hpp
+1 −1 include/codi/expressions/unaryExpression.hpp
+3 −59 include/codi/misc/eventSystem.hpp
+5 −12 include/codi/misc/exceptions.hpp
+1 −1 include/codi/misc/macros.hpp
+0 −56 include/codi/misc/toConst.hpp
+36 −37 include/codi/tapes/data/chunk.hpp
+17 −17 include/codi/tapes/forwardEvaluation.hpp
+4 −12 include/codi/tapes/jacobianBaseTape.hpp
+4 −4 include/codi/tapes/jacobianLinearTape.hpp
+4 −8 include/codi/tapes/jacobianReuseTape.hpp
+4 −16 include/codi/tapes/primalValueBaseTape.hpp
+6 −6 include/codi/tapes/primalValueLinearTape.hpp
+3 −3 include/codi/tapes/primalValueReuseTape.hpp
+2 −2 include/codi/tools/algorithms.hpp
+0 −54 include/codi/tools/cuda/codiCUDA.hpp
+0 −53 include/codi/tools/cuda/cudaFunctionAttributes.hpp
+1 −1 include/codi/tools/data/hessian.hpp
+1 −1 include/codi/tools/data/jacobian.hpp
+61 −175 include/codi/tools/helpers/externalFunctionHelper.hpp
+520 −0 include/codi/tools/helpers/openMPExternalFunctionHelper.hpp
+18 −18 include/codi/tools/mpi/codiForwardMeDiPackTool.hpp
+22 −22 include/codi/tools/mpi/codiReverseMeDiPackTool.hpp
+3 −7 include/codi/tools/parallel/openmp/codiOpenMP.hpp
+9 −9 include/codi/tools/parallel/openmp/openMPAtomic.hpp
+0 −65 include/codi/tools/parallel/openmp/openMPSynchronization.hpp
+1 −1 include/codi/tools/parallel/openmp/openMPThreadInformation.hpp
+2 −8 include/codi/tools/parallel/parallelToolbox.hpp
+3 −6 include/codi/tools/parallel/readWriteMutex.hpp
+0 −75 include/codi/tools/parallel/synchronizationInterface.hpp
+0 −16 include/codi/tools/parallel/threadInformationInterface.hpp
+6 −12 include/codi/traits/numericLimits.hpp
+0 −1 tests/general/Makefile.drivers
+7 −4 tests/general/include/tests/expressions/testTwoArgumentExpr1.hpp
+1 −4 tests/general/include/tests/expressions/testTwoArgumentExpr2.hpp
+111 −36 tests/general/results/deriv0th/TwoArgumentExpr1.out
+0 −54 tests/general/results/deriv0th/TwoArgumentExpr2.out
+125 −50 tests/general/results/deriv1st/TwoArgumentExpr1.out
+0 −54 tests/general/results/deriv1st/TwoArgumentExpr2.out
+299 −0 tests/general/results/deriv2nd/TwoArgumentExpr1.out
+0 −216 tests/general/results/deriv2nd/TwoArgumentExpr2.out
2 changes: 1 addition & 1 deletion externals/mel
2 changes: 1 addition & 1 deletion subprojects/CoolProp
Submodule CoolProp updated 104 files