Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace format labels with strings #253

Merged
merged 42 commits into from
Feb 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
79c2b87
removed one label as example
sseraj Aug 25, 2022
cb66011
started format module
sseraj Aug 26, 2022
af38cfe
replaced some more labels in preprocessingAPI
sseraj Aug 26, 2022
f4d8730
converted remaining labels in preprocessingAPI
sseraj Aug 30, 2022
fd66cf9
added commented out format strings in adtLocalSearch
sseraj Oct 4, 2022
51a4328
removed labels in signals.F90
sseraj Oct 4, 2022
6add56f
replaced labels in utils.F90
sseraj Oct 5, 2022
8ac9536
removed label in coarseUtils.F90
sseraj Oct 5, 2022
0b03839
replaced labels in gridChecking.F90
sseraj Oct 5, 2022
489da6d
replaced labels in outputMod.F90
sseraj Oct 5, 2022
9fa6ba4
replaced labels in loadBalance.F90
sseraj Oct 5, 2022
0dce056
replaced some labels in readCGNSGrid.F90
sseraj Oct 5, 2022
0974864
more labels in readCGNSGrid
sseraj Oct 5, 2022
d3177f1
line breaks for complexify ceq
sseraj Oct 5, 2022
6c0ff37
print real load balance
sseraj Oct 5, 2022
c98f49e
more readCGNSGrid changes
sseraj Oct 5, 2022
7158732
finished readCGNSGrid
sseraj Oct 5, 2022
d55f4ca
replced labels in partitioning.F90
sseraj Oct 5, 2022
0de81c9
replaced labels in BCData.F90
sseraj Oct 5, 2022
a9875f8
stringOps labels
sseraj Oct 5, 2022
acc8505
tecplotIO labels
sseraj Oct 5, 2022
9315809
zipperMesh labels
sseraj Oct 5, 2022
7326928
actuatorRegion labels
sseraj Oct 5, 2022
b728b24
oversetAPI labels
sseraj Oct 5, 2022
a5f7217
initializeFlow labels
sseraj Oct 5, 2022
af8d694
variableReading labels
sseraj Oct 5, 2022
706b9d8
writeCGNSSurface labels
sseraj Oct 5, 2022
db3da7f
unused wallDistance labels
sseraj Oct 6, 2022
4cd5a16
adjointUtils label
sseraj Oct 6, 2022
9a246c1
adjointAPI labels
sseraj Oct 6, 2022
a8c9a06
solvers.F90 labels
sseraj Oct 6, 2022
06d222c
symm boundary angle real casting
sseraj Oct 6, 2022
eaa4111
merge main
sseraj Dec 16, 2022
1cbd1e6
skip bcdata error when using tapenade
sseraj Dec 16, 2022
fbe2224
moved additional part of bc error checking out of tapenade
anilyil Dec 19, 2022
bc4dc86
updated documentation in format module
sseraj Dec 21, 2022
5bfddbb
renamed format module to commonFormats
sseraj Dec 21, 2022
10b2a03
improved consistency
sseraj Dec 21, 2022
cf4c8ec
updated constants in adjointAPI
sseraj Jan 18, 2023
fa5740b
more Tapenade checks in BCData
sseraj Jan 18, 2023
71b3a14
move sci6 to module level in tecplotIO
sseraj Jan 18, 2023
d729491
print instead of write
sseraj Jan 18, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 12 additions & 11 deletions src/ADT/adtLocalSearch.F90
Original file line number Diff line number Diff line change
Expand Up @@ -2149,17 +2149,18 @@ subroutine minD2Hexa(xP,x1,x2,x3,x4,x5,x6,x7,x8,d2,chi,iErr)

! Print some stuff out to the screen for debugging purposes

!write(*,*)
!write(*,*) 'Results of minD2Hexa'
!write(*,20)'Point P = (',xP(1),xP(2),xP(3),' )'
!write(*,20)'Found point = (',x0,y0,z0,' )'
!write(*,20)'Parametric coordinates = (',chi(1),chi(2),chi(3),' )'
!write(*,30)'Minimum distance =',sqrt(d2)
!write(*,10)'Number of iterations =',itCount

10 format(a,1x,i3)
20 format(a,3f10.6,a)
30 format(a,f20.17,a)
! write(*,*)
! write(*,*) 'Results of minD2Hexa'
! write(*, coordinateFormat)'Point P = (',xP(1),xP(2),xP(3),' )'
! write(*, coordinateFormat)'Found point = (',x0,y0,z0,' )'
! write(*, coordinateFormat)'Parametric coordinates = (',chi(1),chi(2),chi(3),' )'
! write(*, distanceFormat)'Minimum distance =',sqrt(d2)
! write(*, iterationFormat)'Number of iterations =',itCount

! character(len=maxStringLen) :: iterationFormat = '(A, 1x, i3)'
! character(len=maxStringLen) :: coordinateFormat = '(A, 3f10.6, A)'
! character(len=maxStringLen) :: distanceFormat = '(A, f20.17, A)'

return

end subroutine minD2Hexa
Expand Down
48 changes: 13 additions & 35 deletions src/adjoint/adjointAPI.F90
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
module adjointAPI

use constants, only: realType, intType, alwaysRealType, adflow_real, mpi_max, mpi_sum, mpi_double_precision, &
mpi_integer, mpi_double_complex, mpi_wtime, maxStringLen, one, zero, NSEquations, RANSEquations

character(len=maxStringLen) :: timeFormat = "(A, 1X, F8.2)"
character(len=maxStringLen) :: exitFormat = "(1X, A, 1X, I5, 1X, A)"

contains
#ifndef USE_COMPLEX
subroutine computeMatrixFreeProductFwd(xvdot, extradot, wdot, bcDataValuesdot, useSpatial, &
useState, famLists, bcDataNames, bcDataValues, bcDataFamLists, bcVarsEmpty, dwdot, funcsDot, fDot, &
costSize, fSize, nTime)

! This is the main matrix-free forward mode computation
use constants
use adjointvars
use blockPointers, only : nDom
use communication, only : adflow_comm_world
Expand Down Expand Up @@ -91,7 +96,6 @@ end subroutine computeMatrixFreeProductFwd
subroutine computeMatrixFreeProductBwd(dwbar, funcsBar, fbar, useSpatial, useState, xvbar, &
extrabar, wbar, spatialSize, extraSize, stateSize, famLists, &
bcDataNames, bcDataValues, bcDataValuesbar, bcDataFamLists, BCVarsEmpty)
use constants
use communication, only : adflow_comm_world
use blockPointers, only : nDom, dwd, il, jl, kl
use inputTimeSpectral, only : nTimeIntervalsSpectral
Expand Down Expand Up @@ -180,7 +184,6 @@ subroutine computeMatrixFreeProductBwdFast(dwbar, wbar, stateSize)
! mode computation. It is intended to compute dRdw^T product
! ONLY. The main purpose is for fast matrix-vector products for the
! actual adjoint solve.
use constants
use inputPhysics, only : equations
use inputAdjoint, only : frozenTurbulence
use flowVarRefState, only : nw, nwf
Expand Down Expand Up @@ -267,7 +270,6 @@ subroutine solveAdjointForRHS(inVec, outVec, nDOF, relativeTolerance)
use inputADjoint
use adjointvars
use killsignals
use constants
use blockPointers
use inputTimeSpectral
use utils, only : EChk
Expand Down Expand Up @@ -351,7 +353,6 @@ subroutine solveDirectForRHS(inVec, outVec, nDOF, relativeTolerance)
use ADJointPETSc
use inputADjoint
use adjointVars
use constants
use killsignals
use blockPointers
use inputTimeSpectral
Expand Down Expand Up @@ -431,7 +432,6 @@ end subroutine solveDirectForRHS

subroutine saveADjointMatrix(fileName)

use constants
use ADjointPETSc, only: drdwt
use communication, only : adflow_comm_world
use utils, only : EChk
Expand Down Expand Up @@ -459,7 +459,6 @@ end subroutine saveADjointMatrix

subroutine saveAdjointPC(fileName)

use constants
use ADjointPETSc, only: drdwpret
use communication, only : adflow_comm_world
use utils, only : EChk
Expand Down Expand Up @@ -487,7 +486,6 @@ end subroutine saveAdjointPC

subroutine saveAdjointRHS(RHS, fileName, nstate)

use constants
use ADjointPETSc, only: psi_like1
use communication, only : adflow_comm_world
use utils, only : EChk
Expand Down Expand Up @@ -525,7 +523,6 @@ end subroutine saveAdjointRHS

subroutine spectralPrecscribedMotion(input, nin, dXv, nout)

use constants
use blockPointers, only : il, jl, kl, nDom
use section, only : sections, nSections
use inputTimeSpectral, only : nTimeIntervalsSpectral
Expand Down Expand Up @@ -625,7 +622,6 @@ end subroutine spectralPrecscribedMotion

subroutine setupAllResidualMatricesfwd

use constants
use ADjointPETSc, only : dRdwT
use communication, only : adflow_comm_world, myid
use inputADjoint, only : frozenTurbulence, useMatrixFreedRdw
Expand All @@ -647,7 +643,7 @@ subroutine setupAllResidualMatricesfwd

if (.not. useMatrixFreedRdw) then
if( myid ==0 ) then
write(*, 10) "Assembling State Residual Matrix in Forward mode..."
write(*, "(A)") "Assembling State Residual Matrix in Forward mode..."
end if
time(1) = mpi_wtime()
call setupStateResidualMatrix(drdwT, useAD, usePC, useTranspose, &
Expand All @@ -660,14 +656,10 @@ subroutine setupAllResidualMatricesfwd
call EChk(ierr, __FILE__, __LINE__)

if(myid ==0) then
write(*, 20) "Assembling State Residaul Matrices Fwd time (s) = ", timeAdj
write(*, timeFormat) "Assembling State Residaul Matrices Fwd time (s) = ", timeAdj
end if
end if

! Output formats.
10 format(a)
20 format(a, 1x, f8.2)

end subroutine setupAllResidualMatricesfwd

subroutine solveAdjoint(RHS, psi, checkSolution, nState)
Expand All @@ -678,8 +670,6 @@ subroutine solveAdjoint(RHS, psi, checkSolution, nState)
! are significant as they are used as the inital guess.
!

use constants, only : realType, intType, alwaysRealType, one, adflow_real, &
mpi_max, mpi_sum, mpi_double_precision, mpi_integer, mpi_double_complex
use ADjointPETSc, only : dRdwT, psi_like1, psi_like2, adjointKSP, &
adjResInit, adjResStart, adjResFinal

Expand Down Expand Up @@ -715,7 +705,7 @@ subroutine solveAdjoint(RHS, psi, checkSolution, nState)
! Send some feedback to screen.

if(myid ==0 .and. printTiming) &
write(*,10) "Solving ADjoint Transpose with PETSc..."
write(*, "(A)") "Solving ADjoint Transpose with PETSc..."

call cpu_time(time(1))

Expand Down Expand Up @@ -834,15 +824,13 @@ subroutine solveAdjoint(RHS, psi, checkSolution, nState)
! the norm of error and the number of iterations

if( myid ==0 .and. printTiming) then
write(*,20) "Solving ADjoint Transpose with PETSc time (s) =", timeAdj
write(*,30) "Norm of error =",norm,"Iterations =",adjConvIts
write(*, timeFormat) "Solving ADjoint Transpose with PETSc time (s) =", timeAdj
write(*, "(1X, A, 1X, ES10.4, 4X, A, 1X, I4)") "Norm of error =",norm,"Iterations =",adjConvIts
write(*,*) "------------------------------------------------"
if( adjConvIts.lt.0 ) then
write(*,40) "PETSc solver diverged after", -adjConvIts, &
"iterations..."
write(*, exitFormat) "PETSc solver diverged after", -adjConvIts, "iterations..."
else
write(*,40) "PETSc solver converged after", adjConvIts, &
"iterations."
write(*, exitFormat) "PETSc solver converged after", adjConvIts, "iterations."
endif
write(*,*) "------------------------------------------------"
endif
Expand Down Expand Up @@ -874,13 +862,6 @@ subroutine solveAdjoint(RHS, psi, checkSolution, nState)
adjointFailed = .True.
end if

! Output formats.

10 format(a)
20 format(a,1x,f8.2)
30 format(1x,a,1x,es10.4,4x,a,1x,i4)
40 format(1x,a,1x,i5,1x,a)
sseraj marked this conversation as resolved.
Show resolved Hide resolved

#endif

end subroutine solveAdjoint
Expand Down Expand Up @@ -1031,7 +1012,6 @@ subroutine dRdwTMatMult(A, vecX, vecY, ierr)
! dRdwT with a vector. Here we just call the much more broadly
! useful routine computeMatrixFreeProductBwdFast()

use constants
use communication
use blockPointers
use iteration
Expand Down Expand Up @@ -1076,7 +1056,6 @@ subroutine dRdwMatMult(A, vecX, vecY, ierr)
! dRdw with a vector. Here we just call the much more broadly
! useful routine computeMatrixFreeProductFwd()

use constants
use communication
use blockPointers
use iteration
Expand Down Expand Up @@ -1155,7 +1134,6 @@ subroutine createPETScVars
!
! Create the matrices/vectors that are required for the adjoint
!
use constants
use ADjointPETSc, only: dRdwT, dRdwPreT, &
adjointKSP, matfreectx, x_like, psi_like1, adjointPETScVarsAllocated
use ADjointVars
Expand Down
6 changes: 1 addition & 5 deletions src/adjoint/adjointUtils.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1344,15 +1344,11 @@ subroutine MyKSPMonitor(myKsp, n, rnorm, dummy, ierr)
! Write the residual norm to stdout every adjMonStep iterations.

if(mod(n, adjMonStep) ==0 ) then
if( myid==0 ) write(*, 10) n, rnorm
if( myid==0 ) write(*, "(I4, 1X, A, 1X, ES16.10)") n, 'KSP Residual norm', rnorm
end if

ierr = 0

! Output format.

10 format(i4, 1x, 'KSP Residual norm', 1x, es16.10)

end subroutine MyKSPMonitor

subroutine setupStandardKSP(kspObject, kspObjectType, gmresRestart, preConSide, &
Expand Down
Loading