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

Compile with -std=f2008 #228

Merged
merged 32 commits into from
Nov 6, 2022
Merged
Show file tree
Hide file tree
Changes from 30 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
2632887
updated make rule for F77 and F90 with std=f2008
ewu63 Aug 2, 2022
61d86fa
fixed tabs
ewu63 Aug 2, 2022
2bce52d
swapping around variable declaration orders
ewu63 Aug 2, 2022
2aa711c
use myisnan instead of non-standard isnan function from GCC
ewu63 Aug 3, 2022
ef3524a
fixed some string and format issues
ewu63 Aug 3, 2022
b716695
fixed some warnings
ewu63 Aug 3, 2022
3e55fa5
fix real/complex types
ewu63 Aug 3, 2022
92eb34b
Fixing type issues for t0
eirikurj Sep 12, 2022
7555d52
Fixing previously fixed string continuation
eirikurj Sep 12, 2022
6a343f8
Update obsolete string definitions
eirikurj Sep 12, 2022
0d4588b
Update myisnan to handle different types and to use more modern modul…
eirikurj Sep 12, 2022
cedeebd
More fixes
eirikurj Sep 12, 2022
d698477
Remove old Makefile
eirikurj Sep 12, 2022
92506e8
Update intel fortran flags
eirikurj Sep 12, 2022
886283f
More fixes for the intel compiler
eirikurj Sep 13, 2022
537ae3c
Updating linker flags
eirikurj Sep 13, 2022
51b61d5
Make new module compile without optimization
eirikurj Sep 20, 2022
e53ed50
Add new file
eirikurj Sep 20, 2022
cdbd7e2
Removing debug flags from config and unused flags
eirikurj Sep 27, 2022
38c72f3
Remove line continuation
eirikurj Sep 27, 2022
cb8c08c
Merge remote-tracking branch 'mdolab/modernize-fortran' into moderniz…
eirikurj Sep 28, 2022
06753a6
Merge remote-tracking branch 'mdolab/main' into modernize-fortran-noopt
eirikurj Oct 3, 2022
ce7e173
Updating build system build certain files without optimization
eirikurj Oct 3, 2022
daf8f36
Merge remote-tracking branch 'mdolab/main' into modernize-fortran
eirikurj Oct 3, 2022
6166bd8
get myisnan from the new module
sseraj Oct 3, 2022
8f6d8c0
Updating build files for complex
eirikurj Oct 3, 2022
20a353e
Merge pull request #233 from eirikurj/modernize-fortran-noopt
sseraj Oct 3, 2022
1a8fc3a
ran tapenade
sseraj Oct 3, 2022
986a5ec
remove whitespace
eirikurj Oct 7, 2022
f091a0d
Merge branch 'modernize-fortran' of github.com:mdolab/adflow into mod…
eirikurj Oct 7, 2022
5276d68
Merge branch 'main' into modernize-fortran
eirikurj Oct 11, 2022
2698301
Merge branch 'main' into modernize-fortran
ewu63 Nov 2, 2022
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
6 changes: 4 additions & 2 deletions config/defaults/config.LINUX_GFORTRAN.mk
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,10 @@ CGNS_INCLUDE_FLAGS=-I$(CGNS_HOME)/include
CGNS_LINKER_FLAGS=-L$(CGNS_HOME)/lib -lcgns

# ------- Define Compiler Flags ----------------------------------------
FF90_FLAGS = -DHAS_ISNAN -fPIC -fdefault-real-8 -fdefault-double-8 -g -O3 -march=native -ffast-math
C_FLAGS = -DHAS_ISNAN -O -fPIC -g
FF77_FLAGS = -fPIC -fdefault-real-8 -fdefault-double-8 -march=native
FF90_FLAGS = $(FF77_FLAGS) -std=f2008
FFXX_OPT_FLAGS = -O3 -ffast-math
C_FLAGS = -fPIC -O

# ------- Define Archiver and Flags -----------------------------------
AR = ar
Expand Down
8 changes: 5 additions & 3 deletions config/defaults/config.LINUX_INTEL.mk
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,18 @@ CGNS_INCLUDE_FLAGS=-I$(CGNS_HOME)/include
CGNS_LINKER_FLAGS=-L$(CGNS_HOME)/lib -lcgns

# ------- Define Compiler Flags ----------------------------------------
FF90_FLAGS = -DHAS_ISNAN -fPIC -r8 -O2 -g
C_FLAGS = -DHAS_ISNAN -O -fPIC
FF77_FLAGS = -fPIC -r8
FF90_FLAGS = $(FF77_FLAGS) -std08
FFXX_OPT_FLAGS = -O2
C_FLAGS = -fPIC -O

# ------- Define Archiver and Flags -----------------------------------
AR = ar
AR_FLAGS = -rvs

# ------- Define Linker Flags ------------------------------------------
LINKER = $(FF90)
LINKER_FLAGS = -nofor_main
LINKER_FLAGS = -nofor-main

# ------- Define Petsc Info ---
include ${PETSC_DIR}/lib/petsc/conf/variables
Expand Down
8 changes: 5 additions & 3 deletions config/defaults/config.LINUX_INTEL_SAFE.mk
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,18 @@ CGNS_INCLUDE_FLAGS=-I$(CGNS_HOME)/include
CGNS_LINKER_FLAGS=-L$(CGNS_HOME)/lib -lcgns

# ------- Define Compiler Flags ----------------------------------------
FF90_FLAGS = -DHAS_ISNAN -fPIC -r8 -O1 -g
C_FLAGS = -DHAS_ISNAN -O -fPIC
FF77_FLAGS = -fPIC -r8
FF90_FLAGS = $(FF77_FLAGS) -std08
FFXX_OPT_FLAGS = -O1
C_FLAGS = -fPIC -O

# ------- Define Archiver and Flags -----------------------------------
AR = ar
AR_FLAGS = -rvs

# ------- Define Linker Flags ------------------------------------------
LINKER = $(FF90)
LINKER_FLAGS = -nofor_main
LINKER_FLAGS = -nofor-main

# ------- Define Petsc Info ---
include ${PETSC_DIR}/lib/petsc/conf/variables
Expand Down
6 changes: 4 additions & 2 deletions config/defaults/config.OSX_GFORTRAN.mk
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,10 @@ CGNS_INCLUDE_FLAGS=-I$(CGNS_HOME)/include
CGNS_LINKER_FLAGS=-L$(CGNS_HOME)/lib -lcgns

# ------- Define Compiler Flags ----------------------------------------
FF90_FLAGS = -DHAS_ISNAN -fPIC -fdefault-real-8 -fdefault-double-8 -g -O3 -march=native -ffast-math
C_FLAGS = -DHAS_ISNAN -O -fPIC -g
FF77_FLAGS = -fPIC -fdefault-real-8 -fdefault-double-8 -march=native
FF90_FLAGS = $(FF77_FLAGS) -std=f2008
FFXX_OPT_FLAGS = -O3 -ffast-math
C_FLAGS = -fPIC -O

# ------- Define Archiver and Flags -----------------------------------
AR = ar
Expand Down
67 changes: 36 additions & 31 deletions src/NKSolver/NKSolvers.F90
Original file line number Diff line number Diff line change
Expand Up @@ -680,18 +680,19 @@ end subroutine NKStep
subroutine LSCubic(x, f, g, y, w, fnorm, ynorm, gnorm, nfevals, flag, lambda)

use constants
use utils, only : EChk, myisnan
use utils, only : EChk
use genericISNAN, only : myisnan
use communication, only : myid
use initializeFlow, only : setUniformFlow
use iteration, only : totalR0
implicit none

! Input/Output
Vec x, f, g, y, w
!x - current iterate
!f - residual evaluated at x
!y - search direction
!w - work vector -> On output, new iterate
!x - current iterate
!f - residual evaluated at x
!y - search direction
!w - work vector -> On output, new iterate
!g - residual evaluated at new iterate y

real(kind=alwaysrealType) :: fnorm, gnorm, ynorm
Expand Down Expand Up @@ -768,10 +769,10 @@ subroutine LSCubic(x, f, g, y, w, fnorm, ynorm, gnorm, nfevals, flag, lambda)
! order of magnitude or more.

hadANan = .False.
if (isnan(gnorm) .or. turbRes2 > 2.0*turbRes1) then
if (myisnan(gnorm) .or. turbRes2 > 2.0*turbRes1) then
! Special testing for nans

if (isnan(gnorm)) then
if (myisnan(gnorm)) then
hadANan = .True.
call setUniformFlow()
lambda = 0.5
Expand All @@ -798,7 +799,7 @@ subroutine LSCubic(x, f, g, y, w, fnorm, ynorm, gnorm, nfevals, flag, lambda)

nfevals = nfevals + 1

if (isnan(gnorm)) then
if (myisnan(gnorm)) then
! Just reset the flow, adjust the step back and keep
! going
call setUniformFlow()
Expand Down Expand Up @@ -914,7 +915,7 @@ subroutine LSCubic(x, f, g, y, w, fnorm, ynorm, gnorm, nfevals, flag, lambda)
lambda = lambdatemp
end if

if (isnan(lambda)) then
if (myisnan(lambda)) then
flag = .False.
exit cubic_loop
end if
Expand Down Expand Up @@ -954,10 +955,10 @@ subroutine LSNone(x, f, g, y, w, nfevals, flag, step)

! Input/Output
Vec x, f, g, y, w
!x - current iterate
!f - residual evaluated at x
!y - search direction
!w - work vector -> On output, new iterate
!x - current iterate
!f - residual evaluated at x
!y - search direction
!w - work vector -> On output, new iterate
!g - residual evaluated at new iterate y

integer(kind=intType) :: nfevals
Expand Down Expand Up @@ -990,10 +991,10 @@ subroutine LSNM(x, f, g, y, w, fnorm, ynorm, gnorm, nfevals, flag, step)

! Input/Output
Vec x, f, g, y, w
!x - current iterate
!f - residual evaluated at x
!y - search direction
!w - work vector -> On output, new iterate
!x - current iterate
!f - residual evaluated at x
!y - search direction
!w - work vector -> On output, new iterate
!g - residual evaluated at new iterate y

real(kind=alwaysRealType) :: fnorm, gnorm, ynorm
Expand Down Expand Up @@ -1520,8 +1521,8 @@ subroutine setInfo(info, iSize)
use utils, only : setPointers
implicit none

real(kind=realType), intent(in), dimension(iSize) :: info
integer(kind=intType), intent(in) :: iSize
real(kind=realType), intent(in), dimension(iSize) :: info
integer(kind=intType) :: nn, counter, i, j, k, l, sps
! Determine the size of a flat array needed to store w, P, ( and
! rlv, rev if necessary) with full double halos.
Expand Down Expand Up @@ -1566,8 +1567,8 @@ subroutine getInfo(info, iSize)

implicit none

real(kind=realType), intent(out), dimension(iSize) :: info
integer(kind=intType), intent(in) :: iSize
real(kind=realType), intent(out), dimension(iSize) :: info
integer(kind=intType) :: nn, counter, i, j, k, l, sps
! Determine the size of a flat array needed to store w, P, ( and
! rlv, rev if necessary) with full double halos.
Expand Down Expand Up @@ -3063,7 +3064,8 @@ subroutine physicalityCheckANK(lambdaP)
use blockPointers, only : ndom, il, jl, kl
use flowVarRefState, only : nw, nwf, nt1, nt2
use inputtimespectral, only : nTimeIntervalsSpectral
use utils, only : setPointers, EChk, myisnan
use utils, only : setPointers, EChk
use genericISNAN, only : myisnan
use communication, only : ADflow_comm_world
implicit none

Expand Down Expand Up @@ -3234,7 +3236,7 @@ subroutine physicalityCheckANK(lambdaP)
call EChk(ierr,__FILE__,__LINE__)

! Make sure that we did not get any NaN's in the process
if (isnan(lambdaL)) then
if (myisnan(lambdaL)) then
lambdaL = zero
end if

Expand All @@ -3260,7 +3262,8 @@ subroutine physicalityCheckANKTurb(lambdaP)
use blockPointers, only : ndom, il, jl, kl
use flowVarRefState, only : nw, nwf, nt1,nt2
use inputtimespectral, only : nTimeIntervalsSpectral
use utils, only : setPointers, EChk, myisnan
use utils, only : setPointers, EChk
use genericISNAN, only : myisnan
use communication, only : ADflow_comm_world
implicit none

Expand Down Expand Up @@ -3358,7 +3361,7 @@ subroutine physicalityCheckANKTurb(lambdaP)
call EChk(ierr,__FILE__,__LINE__)

! Make sure that we did not get any NaN's in the process
if (isnan(lambdaL)) then
if (myisnan(lambdaL)) then
lambdaL = zero
end if

Expand Down Expand Up @@ -3389,7 +3392,8 @@ subroutine ANKTurbSolveKSP
use inputTimeSpectral, only : nTimeIntervalsSpectral
use inputDiscretization, only : approxSA, orderturb
use iteration, only : approxTotalIts, totalR0, totalR, currentLevel
use utils, only : EChk, setPointers, myisnan
use utils, only : EChk, setPointers
use genericISNAN, only : myisnan
use solverUtils, only : computeUTau
use NKSolver, only : getEwTol
use BCRoutines, only : applyAllBC, applyAllBC_block
Expand Down Expand Up @@ -3555,7 +3559,7 @@ subroutine ANKTurbSolveKSP
! initialize this outside the ls
LSFailed = .False.

if ((unsteadyNorm > totalRTurb*ANK_unstdyLSTol .or. isnan(unsteadyNorm))) then
if ((unsteadyNorm > totalRTurb*ANK_unstdyLSTol .or. myisnan(unsteadyNorm))) then
! The unsteady residual is too high or we have a NAN. Do a
! backtracking line search until we get a residual that is lower.

Expand Down Expand Up @@ -3585,7 +3589,7 @@ subroutine ANKTurbSolveKSP
call VecNorm(rVecTurb, NORM_2, unsteadyNorm, ierr)
call EChk(ierr, __FILE__, __LINE__)

if (unsteadyNorm > totalRTurb*ANK_unstdyLSTol .or. isnan(unsteadyNorm)) then
if (unsteadyNorm > totalRTurb*ANK_unstdyLSTol .or. myisnan(unsteadyNorm)) then

! Restore back to the original wVec
call VecAXPY(wVecTurb, lambdaTurb, deltaWTurb, ierr)
Expand All @@ -3600,7 +3604,7 @@ subroutine ANKTurbSolveKSP
end if
end do backtrack

if (LSFailed .or. isnan(unsteadyNorm)) then
if (LSFailed .or. myisnan(unsteadyNorm)) then
! the line search wasn't much help.

if (ANK_CFL > ANK_CFLMin) then
Expand Down Expand Up @@ -3670,7 +3674,8 @@ subroutine ANKStep(firstCall)
use inputTimeSpectral, only : nTimeIntervalsSpectral
use inputDiscretization, only : lumpedDiss, approxSA, orderturb
use iteration, only : approxTotalIts, totalR0, totalR, stepMonitor, linResMonitor, currentLevel, iterType
use utils, only : EChk, setPointers, myisnan
use utils, only : EChk, setPointers
use genericISNAN, only : myisnan
use turbAPI, only : turbSolveDDADI
use solverUtils, only : computeUTau
use adjointUtils, only : referenceShockSensor
Expand Down Expand Up @@ -3976,7 +3981,7 @@ subroutine ANKStep(firstCall)
! initialize this outside the ls
LSFailed = .False.

if ((unsteadyNorm > unsteadyNorm_old*ANK_unstdyLSTol .or. isnan(unsteadyNorm))) then
if ((unsteadyNorm > unsteadyNorm_old*ANK_unstdyLSTol .or. myisnan(unsteadyNorm))) then
! The unsteady residual is too high or we have a NAN. Do a
! backtracking line search until we get a residual that is lower.

Expand Down Expand Up @@ -4006,7 +4011,7 @@ subroutine ANKStep(firstCall)
call VecNorm(rVec, NORM_2, unsteadyNorm, ierr)
call EChk(ierr, __FILE__, __LINE__)

if (unsteadyNorm > unsteadyNorm_old*ANK_unstdyLSTol .or. isnan(unsteadyNorm)) then
if (unsteadyNorm > unsteadyNorm_old*ANK_unstdyLSTol .or. myisnan(unsteadyNorm)) then

! Restore back to the original wVec
call VecAXPY(wVec, lambda, deltaW, ierr)
Expand All @@ -4021,7 +4026,7 @@ subroutine ANKStep(firstCall)
end if
end do backtrack

if (LSFailed .or. isnan(unsteadyNorm)) then
if (LSFailed .or. myisnan(unsteadyNorm)) then
! the line search wasn't much help.

if (ANK_CFL > ANK_CFLMin) then
Expand Down
82 changes: 0 additions & 82 deletions src/adjoint/ADFirstAidKit/Makefile

This file was deleted.

Loading