@@ -79,6 +79,7 @@ module StorageClass
7979 real (kind= RP), allocatable :: S_NSP(:,:,:,:) ! NSE Particles source term
8080 real (kind= RP), allocatable :: QbaseSponge(:,:,:,:) ! Base Flow State vector for sponges
8181 real (kind= RP), allocatable :: intensitySponge(:,:,:) ! Intensity for sponges
82+ real (kind= RP), allocatable :: QLowRK(:,:,:,:) ! NSE State vector solved with a lower order RK method (required for adaptive time-stepping)
8283#ifndef ACOUSTIC
8384 real (kind= RP), allocatable :: mu_NS(:,:,:,:) ! (mu, beta, kappa) artificial
8485 real (kind= RP), allocatable :: mu_turb_NS(:,:,:) ! mu of LES
@@ -791,6 +792,7 @@ elemental subroutine ElementStorage_Construct(self, Nx, Ny, Nz, computeGradients
791792!
792793#ifdef FLOW
793794 allocate ( self % QNS (1 :NCONS,0 :Nx,0 :Ny,0 :Nz) )
795+ allocate ( self % QLowRK(1 :NCONS,0 :Nx,0 :Ny,0 :Nz) )
794796 allocate (self % QbaseSponge(1 :NCONS,0 :Nx,0 :Ny,0 :Nz) )
795797 allocate (self % intensitySponge(0 :Nx,0 :Ny,0 :Nz) )
796798 allocate ( self % QdotNS(1 :NCONS,0 :Nx,0 :Ny,0 :Nz) )
@@ -877,6 +879,7 @@ elemental subroutine ElementStorage_Construct(self, Nx, Ny, Nz, computeGradients
877879 self % S_NS = 0.0_RP
878880 self % S_NSP = 0.0_RP
879881 self % QNS = 0.0_RP
882+ self % QLowRK = 0.0_RP
880883 self % QbaseSponge = 0.0_RP
881884 self % intensitySponge = 0.0_RP
882885 self % QDotNS = 0.0_RP
@@ -980,6 +983,7 @@ elemental subroutine ElementStorage_Assign(to, from)
980983
981984#ifdef FLOW
982985 to % QNS = from % QNS
986+ to % QLowRK = from % QLowRK
983987 to % QbaseSponge = from % QbaseSponge
984988 to % intensitySponge = from % intensitySponge
985989
@@ -1076,6 +1080,7 @@ elemental subroutine ElementStorage_Destruct(self)
10761080 safedeallocate(self % QDotNS)
10771081 safedeallocate(self % QbaseSponge)
10781082 safedeallocate(self % intensitySponge)
1083+ safedeallocate(self % QLowRK)
10791084
10801085 if ( allocated (self % PrevQ) ) then
10811086 num_prevSol = size (self % PrevQ)
@@ -1109,6 +1114,9 @@ elemental subroutine ElementStorage_Destruct(self)
11091114 ! if (self % anJacobian) then ! Not needed since there's only one variable (= one if)
11101115 safedeallocate(self % dF_dgradQ)
11111116 ! end if
1117+
1118+ ! Destruct statistics
1119+ call self % stats % destruct()
11121120#endif
11131121
11141122#ifdef CAHNHILLIARD
@@ -1139,6 +1147,18 @@ elemental subroutine ElementStorage_Destruct(self)
11391147
11401148 safedeallocate(self % PrevQ)
11411149
1150+ ! Deallocate RKSteps
1151+ ! ------------------
1152+ #ifdef MULTIPHASE
1153+ if ( allocated (self % RKSteps) ) then
1154+ do k = 1 , size (self % RKSteps)
1155+ safedeallocate(self % RKSteps(k) % K)
1156+ safedeallocate(self % RKSteps(k) % hatK)
1157+ end do
1158+ deallocate (self % RKSteps)
1159+ end if
1160+ #endif
1161+
11421162 end subroutine ElementStorage_Destruct
11431163#ifdef FLOW
11441164 pure subroutine ElementStorage_SetStorageToNS (self )
@@ -1271,6 +1291,7 @@ impure elemental subroutine ElementStorage_InterpolateSolution(this,other,nodes,
12711291 if (all (this % Nxyz == other % Nxyz)) then
12721292 other % Q = this % Q
12731293 other % QbaseSponge = this % QbaseSponge
1294+ other % QLowRK = this % QLowRK
12741295 else
12751296! $omp critical
12761297 call NodalStorage(this % Nxyz(1 )) % construct(nodes,this % Nxyz(1 ))
@@ -1319,6 +1340,15 @@ impure elemental subroutine ElementStorage_InterpolateSolution(this,other,nodes,
13191340 this % Q(1 :,0 :,0 :,0 :) = > this % QbaseSponge
13201341 other % Q(1 :,0 :,0 :,0 :) = > other % QbaseSponge
13211342
1343+ call Interp3DArrays (Nvars = NCONS , &
1344+ Nin = this % Nxyz , &
1345+ inArray = this % Q , &
1346+ Nout = other % Nxyz , &
1347+ outArray = other % Q )
1348+
1349+ this % Q(1 :,0 :,0 :,0 :) = > this % QLowRK
1350+ other % Q(1 :,0 :,0 :,0 :) = > other % QLowRK
1351+
13221352 call Interp3DArrays (Nvars = NCONS , &
13231353 Nin = this % Nxyz , &
13241354 inArray = this % Q , &
@@ -1763,9 +1793,9 @@ subroutine Statistics_Construct(self, no_of_variables, N)
17631793
17641794 end subroutine Statistics_Construct
17651795
1766- subroutine Statistics_Destruct (self )
1796+ pure subroutine Statistics_Destruct (self )
17671797 implicit none
1768- class(Statistics_t) :: self
1798+ class(Statistics_t), intent ( inout ) :: self
17691799
17701800 safedeallocate( self % data )
17711801
0 commit comments