Skip to content

Commit

Permalink
Merge pull request #9 from Mohid-Water-Modelling-System/master
Browse files Browse the repository at this point in the history
Fork Update
  • Loading branch information
JoaoBSobrinho authored Sep 10, 2018
2 parents 248d1c8 + b228734 commit e9e58a5
Show file tree
Hide file tree
Showing 12 changed files with 961 additions and 773 deletions.
6 changes: 3 additions & 3 deletions Software/ConvertToHDF5/ModuleWRFFormat.F90
Original file line number Diff line number Diff line change
Expand Up @@ -4037,12 +4037,12 @@ subroutine ConvertToMohidUnits(Field)

case('air temperature')

Field%Units = '�C'
Field%Units = 'ºC'
Field%Values2D = Field%Values2D - AbsoluteZero

case('air temperature_3D')

Field%Units = '�C'
Field%Units = 'ºC'
Field%Values3D = Field%Values3D - AbsoluteZero

case('wind velocity X')
Expand Down Expand Up @@ -4394,7 +4394,7 @@ end module ModuleWRFFormat

!----------------------------------------------------------------------------------------------------------
!MOHID Water Modelling System.
!Copyright (C) 1985, 1998, 2002, 2005. Instituto Superior T�cnico, Technical University of Lisbon.
!Copyright (C) 1985, 1998, 2002, 2005. Instituto Superior Técnico, Technical University of Lisbon.
!----------------------------------------------------------------------------------------------------------


Expand Down
38 changes: 19 additions & 19 deletions Software/MOHIDBase1/ModuleFunctions.F90
Original file line number Diff line number Diff line change
Expand Up @@ -3557,16 +3557,16 @@ end function OxygenSaturation

!Saturation Oxygen concentration [mol/lw]
!
!With the values of temperature (�C), this function calculates the
!With the values of temperature (ºC), this function calculates the
!saturation Oxygen concentration.
!
!Based in Henry's law (Metcalf & Eddy) Pedro Galv�o 2002
!Based in Henry's law (Metcalf & Eddy) Pedro Galvao 2002

real function OxygenSaturationHenry (Temperature)

!Arguments-------------------------------------------------------------

real, intent(IN) :: Temperature !�C
real, intent(IN) :: Temperature !ºC
!Local-----------------------------------------------------------------

real :: Henry
Expand Down Expand Up @@ -4380,12 +4380,12 @@ subroutine AngleFromFieldToGrid (AngleInReferential, Referential, GridAngle, Ang
!Local-----------------------------------------------------------------


!Nautical referential 0� is coming from N, 90�N from E, 180� from S, 270� from W
!Nautical referential is coming from N, 90ºN from E, 180º from S, 270º from W
if (Referential == NauticalReferential_) then

AngleOutGrid = 270. - AngleInReferential - GridAngle

!Current referential 0� is going to N, 90�N to E, 180� to S, 270� to W
!Current referential is going to N, 90ºN to E, 180º to S, 270º to W
else if (Referential == CurrentsReferential_) then

AngleOutGrid = 90. - AngleInReferential - GridAngle
Expand All @@ -4410,12 +4410,12 @@ subroutine AngleFromGridToField (AngleInGrid, Referential, GridAngle, AngleOutRe

!Local-----------------------------------------------------------------

!Nautical referential 0� is coming from N, 90�N from E, 180� from S, 270� from W
!Nautical referential is coming from N, 90ºN from E, 180º from S, 270º from W
if (Referential == NauticalReferential_) then

AngleOutReferential = AngleInGrid - 270. + GridAngle

!Current referential 0� is going to N, 90�N to E, 180� to S, 270� to W
!Current referential is going to N, 90ºN to E, 180º to S, 270º to W
else if (Referential == CurrentsReferential_) then

AngleOutReferential = AngleInGrid - 90. + GridAngle
Expand Down Expand Up @@ -7496,7 +7496,7 @@ real function SaturatedVaporPressure(Temperature)
!Local-----------------------------------------------------------------
real :: a = 6.108 ![mb]
real :: b = 17.27
real :: c = 237.2 ![�C] corrected! (from 273.2)
real :: c = 237.2 ![ºC] corrected! (from 273.2)

SaturatedVaporPressure = a * exp(b * Temperature / (Temperature + c))

Expand Down Expand Up @@ -8290,13 +8290,13 @@ subroutine polint(xa,ya,n,x,y,dy, STAT)
ns=i
dif=dift
endif
c(i)=ya(i) !and initialize the tableau of cs and ds.
c(i)=ya(i) !and initialize the tableau of c's and d's.
d(i)=ya(i)
enddo d1
y=ya(ns) !This is the initial approximation to y.
ns=ns-1
d3: do m=1,n-1 !For each column of the tableau,
d2: do i=1,n-m ! we loop over the current cs and ds and update them.
d2: do i=1,n-m ! we loop over the current c's and d's and update them.
ho=xa(i)-x
hp=xa(i+m)-x
w=c(i+1)-d(i)
Expand All @@ -8310,9 +8310,9 @@ subroutine polint(xa,ya,n,x,y,dy, STAT)
endif

endif
!This error can occur only if two input xas are (to within roundoff) identical.
!This error can occur only if two input xa's are (to within roundoff) identical.
den=w/den
d(i)=hp*den ! Here the cs and ds are updated.
d(i)=hp*den ! Here the c's and d's are updated.
c(i)=ho*den
enddo d2

Expand All @@ -8323,8 +8323,8 @@ subroutine polint(xa,ya,n,x,y,dy, STAT)
if (2*ns.lt.n-m)then !After each column in the tableau is completed, we decide
!which correction, c or d, we want to add to our accumulating
!value of y, i.e., which path to take through
!the tableauforking up or down. We do this in such a
!way as to take the most straight line route through the
!the tableau'forking up or down. We do this in such a
!way as to take the most "straight line" route through the
!tableau to its apex, updating ns accordingly to keep track
!of where we are. This route keeps the partial approximations
!centered (insofar as possible) on the target x. T he
Expand Down Expand Up @@ -10532,7 +10532,7 @@ real function SettlingVelPrimaryClarifier (Cx, Rh_i, Rf_i, v0max_i, v0_i)
!Begin-----------------------------------------------------


!Parameters - Hindering settling - PhD Thesis Tak�cs (2008)
!Parameters - Hindering settling - PhD Thesis Takacs (2008)
![m/day]
if (present(v0max_i)) then
v0max = v0max_i
Expand Down Expand Up @@ -10634,7 +10634,7 @@ real function SettlingVelSecondaryClarifier (Cx, WithCompression, SVI, Clarifica
![l/g]
Rf = Rf * 1000
else
!Parameters - Hindering settling - PhD Thesis Tak�cs (2008)
!Parameters - Hindering settling - PhD Thesis Takacs (2008)
![m/day]
v0max = 360
! 120 - 370
Expand Down Expand Up @@ -12085,7 +12085,7 @@ real function WaveBeaufortScale (Wave)

end function WaveBeaufortScale

!Convert amplitude and phase (degrees / 360�) in complex number (Sreal+ i * Simag)
!Convert amplitude and phase (degrees / 360º) in complex number (Sreal+ i * Simag)

subroutine AmpPhase_To_Complex (Amplitude, Phase, Sreal, Simag)

Expand All @@ -12099,7 +12099,7 @@ subroutine AmpPhase_To_Complex (Amplitude, Phase, Sreal, Simag)
end Subroutine AmpPhase_To_Complex


!Convert complex number (Sreal+ i * Simag) in amplitude and phase (degrees / 360�)
!Convert complex number (Sreal+ i * Simag) in amplitude and phase (degrees / 360º)
subroutine Complex_to_AmpPhase (Sreal,Simag,Amplitude,Phase)

!Arguments-------------------------------------------------------------
Expand Down Expand Up @@ -12465,5 +12465,5 @@ end module ModuleFunctions

!----------------------------------------------------------------------------------------------------------
!MOHID Water Modelling System.
!Copyright (C) 1985, 1998, 2002, 2005. Instituto Superior T�cnico, Technical University of Lisbon.
!Copyright (C) 1985, 1998, 2002, 2005. Instituto Superior Técnico, Technical University of Lisbon.
!----------------------------------------------------------------------------------------------------------
79 changes: 69 additions & 10 deletions Software/MOHIDBase1/ModuleHDF5.F90
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ Module ModuleHDF5
!++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
!++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

subroutine ConstructHDF5 (HDF5ID, FileName, Access, STAT)
subroutine ConstructHDF5 (HDF5ID, FileName, Access, HDF5Stop, STAT)
#ifdef _GUI_
!DEC$ IF DEFINED(_X86_)
!DEC$ ATTRIBUTES STDCALL, REFERENCE, ALIAS : '_ConstructHDF5@16' :: ConstructHDF5
Expand All @@ -262,11 +262,13 @@ subroutine ConstructHDF5 (HDF5ID, FileName, Access, STAT)
integer :: HDF5ID
character(len=*) :: FileName
integer :: Access
logical, intent(OUT), optional :: HDF5Stop
integer(4), optional :: STAT

!Local-----------------------------------------------------------------
integer(4) :: STAT_CALL
integer :: STAT_, ready_
logical :: HDF5Stop_

!Begin-----------------------------------------------------------------

Expand All @@ -282,32 +284,69 @@ subroutine ConstructHDF5 (HDF5ID, FileName, Access, STAT)
call Ready (HDF5ID, ready_)

if (ready_ .EQ. OFF_ERR_) then

if (present(HDF5Stop)) then
HDF5Stop_ = .false.
HDF5Stop = .false.
else
HDF5Stop_ = .true.
endif

!Allocates a new Instance
call AllocateInstance

!Initializes predefined datatypes
call h5open_f (STAT_CALL)
if (STAT_CALL /= SUCCESS_) stop 'ConstructHDF5 - ModuleHDF5 - ERR00'
if (STAT_CALL /= SUCCESS_) then
if (HDF5Stop_) then
stop 'ConstructHDF5 - ModuleHDF5 - ERR00'
else
HDF5Stop = .true.
endif
endif

!Open the file
if (Access == HDF5_CREATE_) then
call h5fcreate_f(trim(FileName), ACCESS_FLAGS = H5F_ACC_TRUNC_F, &
FILE_ID = Me%FileID, HDFERR = STAT_CALL)
if (STAT_CALL /= SUCCESS_) stop 'ConstructHDF5 - ModuleHDF5 - ERR01'
if (STAT_CALL /= SUCCESS_) then
if (HDF5Stop_) then
stop 'ConstructHDF5 - ModuleHDF5 - ERR01'
else
HDF5Stop = .true.
endif
endif

elseif (Access == HDF5_READ_) then
call h5fopen_f (trim(FileName), ACCESS_FLAGS = H5F_ACC_RDONLY_F, &
FILE_ID = Me%FileID, HDFERR = STAT_CALL)
if (STAT_CALL /= SUCCESS_) then
write(*,*) trim(FileName)
stop 'ConstructHDF5 - ModuleHDF5 - ERR02'
if (HDF5Stop_) then
write(*,*) trim(FileName)
stop 'ConstructHDF5 - ModuleHDF5 - ERR02'
else
HDF5Stop = .true.
endif
endif
elseif (Access == HDF5_READWRITE_) then
call h5fopen_f (trim(FileName), ACCESS_FLAGS = H5F_ACC_RDWR_F, &
FILE_ID = Me%FileID, HDFERR = STAT_CALL)
if (STAT_CALL /= SUCCESS_) stop 'ConstructHDF5 - ModuleHDF5 - ERR03'
if (STAT_CALL /= SUCCESS_) then
if (HDF5Stop_) then
stop 'ConstructHDF5 - ModuleHDF5 - ERR03'
else
HDF5Stop = .true.
endif
endif

else
if (STAT_CALL /= SUCCESS_) stop 'ConstructHDF5 - ModuleHDF5 - ERR04'
if (STAT_CALL /= SUCCESS_) then
if (HDF5Stop_) then
stop 'ConstructHDF5 - ModuleHDF5 - ERR04'
else
HDF5Stop = .true.
endif
endif
endif

nullify(Me%AuxMatrixes%DataR4_1D, Me%AuxMatrixes%DataR4_2D, Me%AuxMatrixes%DataR4_3D, &
Expand Down Expand Up @@ -4393,7 +4432,12 @@ subroutine HDF5ReadWindowR8_3D (HDF5ID, GroupName, Name,

!Opens the Group
call h5gopen_f (Me%FileID, GroupName, gr_id, STAT_CALL)
if (STAT_CALL /= SUCCESS_) stop 'HDF5ReadWindowR8_3D - ModuleHDF5 - ERR10'
if (STAT_CALL /= SUCCESS_) then
write(*,*) 'FileName = ', trim(Me%FileName)
write(*,*) 'GroupName = ', trim(GroupName)
stop 'HDF5ReadWindowR8_3D - ModuleHDF5 - ERR10'
endif



!Opens the DataSet
Expand Down Expand Up @@ -7523,7 +7567,7 @@ end subroutine HDF5UpdateGenericRealAttribute
!++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
!++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

subroutine KillHDF5 (HDF5ID, STAT)
subroutine KillHDF5 (HDF5ID, DoNotStop, STAT)
#ifdef _GUI_
!DEC$ IF DEFINED(_X86_)
!DEC$ ATTRIBUTES STDCALL, REFERENCE, ALIAS : '_KillHDF5@8' :: KillHDF5
Expand All @@ -7534,12 +7578,15 @@ subroutine KillHDF5 (HDF5ID, STAT)

!Arguments-------------------------------------------------------------
integer :: HDF5ID
logical, optional, intent(IN) :: DoNotStop
integer, optional :: STAT

!Local-----------------------------------------------------------------
integer :: STAT_, ready_
integer(4) :: STAT_CALL
integer :: nUsers
logical :: DoStop_


!----------------------------------------------------------------------

Expand All @@ -7552,9 +7599,21 @@ subroutine KillHDF5 (HDF5ID, STAT)
nUsers = DeassociateInstance(mHDF5_, Me%InstanceID)

if (nUsers == 0) then

DoStop_ = .true.

if (present(DoNotStop)) then
if (DoNotStop) then
DoStop_ = .false.
endif
endif

call h5fclose_f(Me%FileID, HDFERR = STAT_CALL)
if (STAT_CALL /= SUCCESS_) stop 'KillHDF5 - ModuleHDF5 - ERR01'
if (STAT_CALL /= SUCCESS_) then
if (DoStop_) then
stop 'KillHDF5 - ModuleHDF5 - ERR01'
endif
endif

call DeallocateAuxMatrixes

Expand Down
Loading

0 comments on commit e9e58a5

Please sign in to comment.