Skip to content

Commit 35bd6a4

Browse files
authored
Merge pull request #291 from loganoz/omarinoDev
Add speed of sound squared to Qbase in CAA solver
2 parents 6fea04d + d91ff1f commit 35bd6a4

10 files changed

Lines changed: 188 additions & 88 deletions

File tree

Solver/src/libs/discretization/DGSEMClass.f90

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,9 @@ SUBROUTINE ConstructDGSem( self, meshFileName_, controlVariables, &
144144
logical :: useWeightsPartition ! Partitioning mesh using DOF of elements as weights
145145
logical :: genMonitor
146146
logical :: isReconstruct=.false.
147-
real(kind=RP) :: QbaseUniform(1:NCONS)
147+
#if defined(ACOUSTIC)
148+
real(kind=RP) :: QbaseUniform(1:NCONSB)
149+
#endif
148150
character(len=*), parameter :: TWOD_OFFSET_DIR_KEY = "2d mesh offset direction"
149151
procedure(UserDefinedInitialCondition_f) :: UserDefinedInitialCondition
150152
#if (!defined(NAVIERSTOKES))
@@ -400,16 +402,16 @@ SUBROUTINE ConstructDGSem( self, meshFileName_, controlVariables, &
400402
!
401403
#if defined(ACOUSTIC)
402404
! start by default with no flow conditions
403-
QbaseUniform = [1.0_RP,0.0_RP,0.0_RP,0.0_RP,1.0_RP/(dimensionless % gammaM2)]
405+
QbaseUniform = [1.0_RP,0.0_RP,0.0_RP,0.0_RP,1.0_RP/(dimensionless % gammaM2),1.0_RP/POW2(dimensionless%Mach)]
404406
call self % mesh % SetUniformBaseFlow(QbaseUniform)
405-
call self % mesh % ProlongBaseSolutionToFaces(NCONS)
407+
call self % mesh % ProlongBaseSolutionToFaces(NCONSB)
406408
#ifdef _HAS_MPI_
407409
!$omp single
408-
call self % mesh % UpdateMPIFacesBaseSolution(NCONS)
410+
call self % mesh % UpdateMPIFacesBaseSolution(NCONSB)
409411
! not efficient, but only done once
410412
! we can wait for the communication with more computation in between, but will need to be in a different subroutine
411413
call mpi_barrier(MPI_COMM_WORLD, ierr)
412-
call self % mesh % GatherMPIFacesBaseSolution(NCONS)
414+
call self % mesh % GatherMPIFacesBaseSolution(NCONSB)
413415
!$omp end single
414416
#endif
415417
!

Solver/src/libs/discretization/HyperbolicDiscretizationClass.f90

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,11 @@ pure subroutine HyperbolicFlux0D_f(Q, F, rho_, Qbase)
3636
real(kind=RP), intent(in) :: Q(1:NCONS )
3737
real(kind=RP), intent(out) :: F(1:NCONS, 1:NDIM)
3838
real(kind=RP), intent(in), optional :: rho_
39+
#if defined(ACOUSTIC)
40+
real(kind=RP), intent(in), optional :: Qbase(1:NCONSB)
41+
#else
3942
real(kind=RP), intent(in), optional :: Qbase(1:NCONS)
43+
#endif
4044
end subroutine HyperbolicFlux0D_f
4145
end interface
4246
!

Solver/src/libs/mesh/HexElementClass.f90

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -952,6 +952,7 @@ subroutine HexElement_ProlongBaseSolutionToFaces(self, nEqn, fFR, fBK, fBOT, fR,
952952
spAxi => NodalStorage(N(1))
953953
spAeta => NodalStorage(N(2))
954954
spAzeta => NodalStorage(N(3))
955+
955956
!
956957
! *************************
957958
! Prolong solution to faces

Solver/src/libs/mesh/HexMesh.f90

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1514,7 +1514,7 @@ subroutine HexMesh_UpdateMPIFacesBaseSolution(self, nEqn)
15141514
do k = 1, nShared
15151515
domain = MPIfaces % listDomain(k)
15161516
if (MPIfaces % faces(domain) % no_of_faces > 0) then
1517-
call MPIfaces % faces(domain) % RecvQ(domain, nEqn, all_reqs(k))
1517+
call MPIfaces % faces(domain) % RecvQBase(domain, nEqn, all_reqs(k))
15181518
end if
15191519
end do
15201520
!
@@ -1542,7 +1542,7 @@ subroutine HexMesh_UpdateMPIFacesBaseSolution(self, nEqn)
15421542
thisSide = self % MPIfaces % faces(domain) % elementSide(mpifID)
15431543
associate(f => self % faces(fID))
15441544
do j = 0, f % Nf(2) ; do i = 0, f % Nf(1)
1545-
self % MPIfaces % faces(domain) % Qsend(counter:counter+nEqn-1) = f % storage(thisSide) % Qbase(:,i,j)
1545+
self % MPIfaces % faces(domain) % QBaseSend(counter:counter+nEqn-1) = f % storage(thisSide) % Qbase(:,i,j)
15461546
counter = counter + nEqn
15471547
end do ; end do
15481548
end associate
@@ -1552,7 +1552,7 @@ subroutine HexMesh_UpdateMPIFacesBaseSolution(self, nEqn)
15521552
! Send solution
15531553
! -------------
15541554
!
1555-
call MPIfaces % faces(domain) % SendQ(domain, nEqn, all_reqs(idx_send))
1555+
call MPIfaces % faces(domain) % SendQBase(domain, nEqn, all_reqs(idx_send))
15561556
idx_send = idx_send + 1
15571557
end do
15581558
!
@@ -1743,7 +1743,7 @@ subroutine HexMesh_GatherMPIFacesBaseSolution(self, nEqn)
17431743
thisSide = self % MPIfaces % faces(domain) % elementSide(mpifID)
17441744
associate(f => self % faces(fID))
17451745
do j = 0, f % Nf(2) ; do i = 0, f % Nf(1)
1746-
f % storage(otherSide(thisSide)) % Qbase(:,i,j) = self % MPIfaces % faces(domain) % Qrecv(counter:counter+nEqn-1)
1746+
f % storage(otherSide(thisSide)) % Qbase(:,i,j) = self % MPIfaces % faces(domain) % QBaseRecv(counter:counter+nEqn-1)
17471747
counter = counter + nEqn
17481748
end do ; end do
17491749
end associate
@@ -2544,7 +2544,7 @@ subroutine HexMesh_SetConnectivitiesAndLinkFaces(self,nodes,facesList)
25442544
#elif defined(MULTIPHASE)
25452545
call ConstructMPIFacesStorage(self % MPIfaces, NCONS, NCONS, MPI_NDOFS)
25462546
#elif defined(ACOUSTIC)
2547-
call ConstructMPIFacesStorage(self % MPIfaces, NCONS, NCONS, MPI_NDOFS)
2547+
call ConstructMPIFacesStorage(self % MPIfaces, NCONS, NCONS, MPI_NDOFS, NCONSB_in=NCONSB)
25482548
#endif
25492549

25502550
#endif
@@ -4041,15 +4041,15 @@ END SUBROUTINE HexMesh_LoadSolution
40414041
Subroutine HexMesh_SetUniformBaseFlow(self,Q_in)
40424042
Implicit None
40434043
CLASS(HexMesh) :: self
4044-
real(kind=RP), dimension(1:NCONS), intent(in) :: Q_in
4044+
real(kind=RP), dimension(1:NCONSB), intent(in) :: Q_in
40454045
!
40464046
! ---------------
40474047
! Local variables
40484048
! ---------------
40494049
INTEGER :: eID, eq
40504050

40514051
do eID = 1, size(self % elements)
4052-
do eq = 1,NCONS
4052+
do eq = 1,NCONSB
40534053
self % elements(eID) % storage % Qbase(eq,:,:,:) = Q_in(eq)
40544054
end do
40554055
end do

Solver/src/libs/mesh/StorageClass.f90

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -812,7 +812,7 @@ elemental subroutine ElementStorage_Construct(self, Nx, Ny, Nz, computeGradients
812812
ALLOCATE( self % S_SA (NCONS,0:Nx,0:Ny,0:Nz) )
813813
#endif
814814
#if defined (ACOUSTIC)
815-
ALLOCATE( self % Qbase (NCONS,0:Nx,0:Ny,0:Nz) )
815+
ALLOCATE( self % Qbase (NCONSB,0:Nx,0:Ny,0:Nz) )
816816
#endif
817817
if (computeGradients) then
818818
ALLOCATE( self % U_xNS (NGRAD,0:Nx,0:Ny,0:Nz) )
@@ -1406,7 +1406,7 @@ pure subroutine FaceStorage_Construct(self, NDIM, Nf, Nel, computeGradients, ana
14061406
ALLOCATE( self % QdotNS (NCONS,0:Nf(1),0:Nf(2)) )
14071407
end if
14081408
#if defined (ACOUSTIC)
1409-
ALLOCATE( self % Qbase (NCONS,0:Nf(1),0:Nf(2)) )
1409+
ALLOCATE( self % Qbase (NCONSB,0:Nf(1),0:Nf(2)) )
14101410
#endif
14111411
! Biggest Interface flux memory size is u\vec{n}
14121412
! ----------------------------------------------

0 commit comments

Comments
 (0)