@@ -20,6 +20,7 @@ PROGRAM HORSES3DMainNS
2020 use InterpolationMatrices , only: Initialize_InterpolationMatrices, Finalize_InterpolationMatrices
2121 use ProblemFileFunctions
2222 use BoundaryConditions , only: DestructBoundaryConditions
23+ use PartitionedMeshClass
2324#ifdef _HAS_MPI_
2425 use mpi
2526#endif
@@ -34,13 +35,17 @@ PROGRAM HORSES3DMainNS
3435 TYPE ( DGSem ) :: sem
3536 TYPE ( TimeIntegrator_t ) :: timeIntegrator
3637 LOGICAL :: success, saveGradients, saveSensor, saveLES, saveSource
38+ logical :: generateMonitor = .TRUE.
39+ logical :: optimizePartitionLevel= .FALSE.
40+ logical :: isMLRK= .FALSE.
3741 integer :: initial_iteration
3842 INTEGER :: ierr
3943 real (kind= RP) :: initial_time
4044 character (len= LINE_LENGTH) :: solutionFileName
4145 integer , allocatable :: Nx(:), Ny(:), Nz(:)
4246 integer :: Nmax
4347
48+
4449 call SetSolver(NAVIERSTOKES_SOLVER)
4550!
4651! -----------------------------------------
@@ -96,21 +101,51 @@ PROGRAM HORSES3DMainNS
96101 call InitializeNodalStorage (controlVariables ,Nmax)
97102 call Initialize_InterpolationMatrices(Nmax)
98103
104+ ! MPI Partition option for MLRK time integeration
105+ if ((MPI_Process % doMPIAction).and. (trim (controlVariables % stringValueForKey(' explicit method' , requestedLength = LINE_LENGTH)) == ' multi level rk3' )) then
106+
107+ isMLRK = .TRUE. ! The time integration is Multi-Level RK
108+
109+ if ( controlVariables % ContainsKey(" optimized partition" ) ) then
110+ optimizePartitionLevel = controlVariables % LogicalValueForKey (" optimized partition" )
111+ end if
112+
113+ if (optimizePartitionLevel) generateMonitor = .FALSE. ! Do not generate monitor for the first construction of sem as it will be reconstruct
114+ end if
115+
116+ ! Construct DGSEM library
99117 call sem % construct ( controlVariables = controlVariables, &
100118 Nx_ = Nx, Ny_ = Ny, Nz_ = Nz, &
101- success = success)
102-
103- call Initialize_SpaceAndTimeMethods(controlVariables, sem)
104-
105- IF (.NOT. success) error stop " Mesh reading error"
106- IF (.NOT. success) error stop " Boundary condition specification error"
107- CALL UserDefinedFinalSetup(sem % mesh, thermodynamics, dimensionless, refValues)
119+ success = success, generateMonitor = generateMonitor)
108120!
109121! -------------------------
110122! Set the initial condition
111123! -------------------------
112124!
113- call sem % SetInitialCondition(controlVariables, initial_iteration, initial_time)
125+ call UserDefinedFinalSetup(sem % mesh, thermodynamics, dimensionless, refValues)
126+ call sem % SetInitialCondition(controlVariables, initial_iteration, initial_time)
127+ !
128+ ! ----------------------------------------------
129+ ! Reconstruct for MLRK explicit time step method
130+ ! ----------------------------------------------
131+ !
132+ if (isMLRK .and. optimizePartitionLevel .and. MPI_Process % doMPIAction) then
133+ call sem % reconstruct ( controlVariables = controlVariables, &
134+ Nx_ = Nx, Ny_ = Ny, Nz_ = Nz, &
135+ success = success)
136+ call UserDefinedFinalSetup(sem % mesh, thermodynamics, dimensionless, refValues)
137+ call sem % SetInitialCondition(controlVariables, initial_iteration, initial_time)
138+ end if
139+ !
140+ ! -----------------------------
141+ ! Initialize the discretization
142+ ! -----------------------------
143+ !
144+ call Initialize_SpaceAndTimeMethods(controlVariables, sem)
145+
146+ IF (.NOT. success) error stop " Mesh reading error"
147+ IF (.NOT. success) error stop " Boundary condition specification error"
148+
114149 !
115150 ! -------------------
116151 ! Build the particles
0 commit comments