Skip to content

Commit f8bb991

Browse files
committed
Allow MixedRK to work on specmesh
1 parent 50f7bcb commit f8bb991

1 file changed

Lines changed: 105 additions & 0 deletions

File tree

Solver/src/libs/discretization/DGSEMClass.f90

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ SUBROUTINE ConstructDGSem( self, meshFileName_, controlVariables, &
106106
use PartitionedMeshClass
107107
use MeshPartitioning
108108
use SurfaceMesh, only: surfacesMesh
109+
use FileReadingUtilities, only: getFileExtension
109110

110111
IMPLICIT NONE
111112
!
@@ -271,6 +272,12 @@ SUBROUTINE ConstructDGSem( self, meshFileName_, controlVariables, &
271272
! initialize the solution if the time stepping scheme is MixedRK, since Q is needed in the METIS partitioning
272273
if(trim(controlVariables % stringValueForKey('explicit method', requestedLength = LINE_LENGTH)) == 'MixedRK') then
273274
call self % mesh % CheckIfMeshIs2D(.true.)
275+
276+
! Contruction of face data in case of a specmesh
277+
if (trim(getFileExtension(trim(self % mesh % meshFileName)))=='mesh') then
278+
call ReadInitialSurfaceData(self, success)
279+
endif
280+
274281
call self % mesh % ConstructGeometry()
275282
call self % mesh % AllocateStorage(self % NDOF, controlVariables,computeGradients)
276283
call UserDefinedInitialCondition(self % mesh, FLUID_DATA_VARS)
@@ -1058,4 +1065,102 @@ subroutine hnRange(mesh, hnmin, hnmax)
10581065

10591066
end subroutine hnRange
10601067
!
1068+
1069+
subroutine ReadInitialSurfaceData(self, success)
1070+
1071+
use Utilities, only: UnusedUnit
1072+
use ElementConnectivityDefinitions
1073+
use NodeClass
1074+
implicit none
1075+
1076+
class(DGSem), intent(inout) :: self
1077+
logical, intent(inout) :: success
1078+
1079+
integer :: fUnit, fileStat
1080+
integer :: numberOfNodes, numberOfElements, bFaceOrder
1081+
integer :: numBFacePoints
1082+
integer :: faceFlags(FACES_PER_ELEMENT)
1083+
integer :: nodeIDs(NODES_PER_ELEMENT)
1084+
integer :: nodeMap(NODES_PER_FACE)
1085+
real(kind=RP) :: x(NDIM)
1086+
integer :: i, j, k, el
1087+
real(kind=RP), allocatable :: uNodes(:), vNodes(:)
1088+
real(kind=RP), allocatable :: values(:,:,:)
1089+
real(kind=RP) :: corners(NDIM, NODES_PER_ELEMENT)
1090+
character(len=LINE_LENGTH) :: names
1091+
1092+
real(kind=RP) , DIMENSION(2) :: uNodesFlat = [-1.0_RP,1.0_RP]
1093+
real(kind=RP) , DIMENSION(2) :: vNodesFlat = [-1.0_RP,1.0_RP]
1094+
real(kind=RP) , DIMENSION(3,2,2) :: valuesFlat
1095+
1096+
fUnit = UnusedUnit()
1097+
open(unit = fUnit, file = self % mesh % meshFileName, iostat = fileStat)
1098+
if (fileStat /= 0) then
1099+
print *, "Error opening file: ", self % mesh % meshFileName
1100+
success = .false.
1101+
return
1102+
end if
1103+
1104+
read(fUnit,*) numberOfNodes, numberOfElements, bFaceOrder
1105+
1106+
numBFacePoints = bFaceOrder + 1
1107+
allocate(uNodes(numBFacePoints))
1108+
allocate(vNodes(numBFacePoints))
1109+
allocate(values(3,numBFacePoints,numBFacePoints))
1110+
1111+
do i = 1, numBFacePoints
1112+
uNodes(i) = -cos((i - 1.0_RP) * PI / (numBFacePoints - 1.0_RP))
1113+
vNodes(i) = -cos((i - 1.0_RP) * PI / (numBFacePoints - 1.0_RP))
1114+
end do
1115+
1116+
do j = 1, numberOfNodes
1117+
read(fUnit,*) x
1118+
x = x / Lref
1119+
call ConstructNode(self % mesh % nodes(j), x, j)
1120+
end do
1121+
1122+
do el = 1, size(self % mesh % elements)
1123+
1124+
read(fUnit,*) nodeIDs
1125+
read(fUnit,*) faceFlags
1126+
1127+
if (maxval(faceFlags) == 0) then
1128+
do k = 1, NODES_PER_ELEMENT
1129+
corners(:,k) = self % mesh % nodes(nodeIDs(k)) % x
1130+
end do
1131+
self % mesh % elements(el) % SurfInfo % IsHex8 = .true.
1132+
self % mesh % elements(el) % SurfInfo % corners = corners
1133+
1134+
else
1135+
do k = 1, FACES_PER_ELEMENT
1136+
if (faceFlags(k) == 0) then
1137+
nodeMap = localFaceNode(:,k)
1138+
valuesFlat(:,1,1) = self % mesh % nodes(nodeIDs(nodeMap(1))) % x
1139+
valuesFlat(:,2,1) = self % mesh % nodes(nodeIDs(nodeMap(2))) % x
1140+
valuesFlat(:,2,2) = self % mesh % nodes(nodeIDs(nodeMap(3))) % x
1141+
valuesFlat(:,1,2) = self % mesh % nodes(nodeIDs(nodeMap(4))) % x
1142+
1143+
call self % mesh % elements(el) % SurfInfo % facePatches(k) % construct(uNodesFlat, vNodesFlat, valuesFlat)
1144+
1145+
else
1146+
do j = 1, numBFacePoints
1147+
do i = 1, numBFacePoints
1148+
read(fUnit,*) values(:,i,j)
1149+
end do
1150+
end do
1151+
1152+
values = values / Lref
1153+
call self % mesh % elements(el) % SurfInfo % facePatches(k) % construct(uNodes, vNodes, values)
1154+
end if
1155+
end do
1156+
end if
1157+
1158+
read(fUnit,*) names
1159+
end do
1160+
1161+
close(fUnit)
1162+
1163+
end subroutine ReadInitialSurfaceData
1164+
1165+
10611166
end module DGSEMClass

0 commit comments

Comments
 (0)