Skip to content

Commit 183c436

Browse files
committed
Adaptive Time Step test case and finor fix
1 parent 76f9a11 commit 183c436

22 files changed

Lines changed: 60701 additions & 4 deletions

.github/workflows/CI_parallel.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -930,6 +930,23 @@ jobs:
930930
mpiexec -n 64 ./horses3d.ns Actuator.control
931931
if: '!cancelled()'
932932

933+
#
934+
# 33) Cylinder with Adaptive Time Step and Reinforcement Learning p-adaptation
935+
# --------------------------------------------
936+
- name: Build Cylinder_AdaptiveTimeStep_pAdaptationRL
937+
working-directory: ./Solver/test/NavierStokes/Cylinder_AdaptiveTimeStep_pAdaptationRL/SETUP
938+
run: |
939+
source /opt/intel/oneapi/setvars.sh || true
940+
make MODE=${{matrix.mode}} COMPILER=${{matrix.compiler}} COMM=${{matrix.comm}} ENABLE_THREADS=${{matrix.enable_threads}} WITH_METIS=YES
941+
if: '!cancelled()'
942+
943+
- name: Run Cylinder_AdaptiveTimeStep_pAdaptationRL
944+
working-directory: ./Solver/test/NavierStokes/Cylinder_AdaptiveTimeStep_pAdaptationRL
945+
run: |
946+
source /opt/intel/oneapi/setvars.sh || true
947+
mpiexec -n 64 ./horses3d.ns Cylinder_AdaptiveTimeStep_pAdaptationRL.control
948+
if: '!cancelled()'
949+
933950
########################################################################
934951
####### PARTICLES ########
935952
########################################################################

.github/workflows/CI_sequential 2.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -786,3 +786,21 @@ jobs:
786786
./horses3d.ns Actuator.control
787787
if: '!cancelled()'
788788

789+
#
790+
# 33) Cylinder with Adaptive Time Step and Reinforcement Learning p-adaptation
791+
# --------------------------------------------
792+
793+
- name: Build Cylinder_AdaptiveTimeStep_pAdaptationRL
794+
working-directory: ./Solver/test/NavierStokes/Cylinder_AdaptiveTimeStep_pAdaptationRL/SETUP
795+
run: |
796+
source /opt/intel/oneapi/setvars.sh || true
797+
make MODE=${{matrix.mode}} COMPILER=${{matrix.compiler}} COMM=${{matrix.comm}} ENABLE_THREADS=${{matrix.enable_threads}} WITH_MKL=${{matrix.mkl}} WITH_HDF5=${{matrix.hdf5}}
798+
if: '!cancelled()'
799+
800+
- name: Run Cylinder_AdaptiveTimeStep_pAdaptationRL
801+
working-directory: ./Solver/test/NavierStokes/Cylinder_AdaptiveTimeStep_pAdaptationRL
802+
run: |
803+
source /opt/intel/oneapi/setvars.sh || true
804+
./horses3d.ns Cylinder_AdaptiveTimeStep_pAdaptationRL.control
805+
if: '!cancelled()'
806+

Solver/configure

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ TEST_CASES="./Euler/BoxAroundCircle \
7878
./NavierStokes/VirtualSurfaces_acoustics_pAdaptationRL \
7979
./NavierStokes/ActuatorLineInterpolation \
8080
./NavierStokes/ActuatorLineProjection \
81+
./NavierStokes/Cylinder_AdaptiveTimeStep_pAdaptationRL \
8182
./IncompressibleNS/Convergence \
8283
./IncompressibleNS/Kovasznay \
8384
./IncompressibleNS/TaylorGreen \

Solver/src/libs/mesh/HexMesh.f90

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5677,5 +5677,12 @@ subroutine HexMesh_DefineAcousticElements(self, observer, acoustic_sources, d_th
56775677
call acousticElementList % destruct
56785678
call aerodynamicElementList % destruct
56795679

5680+
safedeallocate(x)
5681+
safedeallocate(y)
5682+
safedeallocate(z)
5683+
safedeallocate(total_x)
5684+
safedeallocate(total_y)
5685+
safedeallocate(total_z)
5686+
56805687
end subroutine HexMesh_DefineAcousticElements
56815688
END MODULE HexMeshClass

Solver/test/Euler/Cylinder_ErrorEstimation_pAdaptationRL/SETUP/ProblemFile.f90

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -551,14 +551,14 @@ SUBROUTINE UserDefinedFinalize(mesh, time, iter, maxResidual &
551551
! -----------------------------------------------------------------
552552
!
553553
#if defined(NAVIERSTOKES)
554-
real(kind=RP), parameter :: final_time = 2.1612033407693628E-02_RP
554+
real(kind=RP), parameter :: final_time = 2.1411671281894955E-02_RP
555555
real(kind=RP), parameter :: residuals(5) = [3.6915729442307963E+01_RP, &
556-
9.986932111274236E+01_RP, &
556+
9.9869321112742355E+01_RP, &
557557
6.6650865615117439E+01_RP, &
558-
4.6033500893652303E-10_RP, &
558+
4.6926110637335003E-10_RP, &
559559
9.8887738522589393E+02_RP ]
560560
real(kind=RP), parameter :: cd = 6.3218210532607147E+04_RP
561-
real(kind=RP), parameter :: sensor(2) = [0.0E+00_RP, 1.3783879038143E-03_RP]
561+
real(kind=RP), parameter :: sensor(2) = [2.2766387006039312E-06_RP, 1.3793624835056054E-03_RP]
562562

563563
CALL initializeSharedAssertionsManager
564564
sharedManager => sharedAssertionsManager()
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
Flow equations = "NS"
2+
mesh file name = "MESH/cyl_circ.msh"
3+
Polynomial order = 3
4+
Number of time steps = 50
5+
Output Interval = 1
6+
Convergence tolerance = 1.d-10
7+
mach number = 0.2
8+
Reynolds number = 200.0
9+
AOA theta = 0.0
10+
AOA phi = 0.0
11+
solution file name = "RESULTS/Cylinder_Re200_test.hsol"
12+
save gradients with solution = .false.
13+
restart = .false.
14+
restart file name = "RESULTS/Cylinder_Re200_test.hsol"
15+
riemann solver = roe
16+
17+
simulation type = time-accurate
18+
final time = 1.0d0
19+
time integration = explicit
20+
explicit method = RK3
21+
22+
adaptive dt = .true.
23+
dt = 5.d-4
24+
dt adaptation step = 5.d-3
25+
minimum dt = 1.d-5
26+
maximum dt = 1.d-2
27+
28+
#define boundary cylinder
29+
type = NoSlipWall
30+
#end
31+
32+
#define boundary left__right
33+
type = FreeSlipWall
34+
#end
35+
36+
#define boundary inlet
37+
type = Inflow
38+
#end
39+
40+
#define boundary outlet
41+
type = Outflow
42+
#end
43+
44+
!-Adaptation-----------------------------------
45+
save sensor with solution = .true.
46+
47+
#define p-adaptation
48+
adaptation type = RL
49+
agent file = policy_padaptation/p_adaptation_policy
50+
tolerance = 5d-3
51+
Nmax = [6, 6, 6]
52+
Nmin = [2, 2, 2]
53+
adjust nz = .FALSE.
54+
restart files = .FALSE.
55+
order across faces = N*2/3
56+
mode = iteration
57+
interval = 1000
58+
threshold = 5 !Values higher than 100 leads to never adapting
59+
error estimation = .true.
60+
error type = avg
61+
error variable = u
62+
#end
63+
!---------------------------------------------
64+
65+
#define surface monitor 1
66+
Name = cyl-drag
67+
Marker = cylinder
68+
Variable = drag
69+
Direction = [1.0,0.0,0.0]
70+
Reference surface = 1.0
71+
#end
72+
73+
#define surface monitor 2
74+
Name = cyl-lift
75+
Marker = cylinder
76+
Variable = lift
77+
Direction = [0.0,1.0,0.0]
78+
Reference surface = 1.0
79+
#end
80+
81+
#define volume monitor 1
82+
Name = sensor
83+
Variable = sensor range
84+
#end

0 commit comments

Comments
 (0)