Skip to content

Commit

Permalink
Merge remote-tracking branch 'refs/remotes/origin/master' into Develop
Browse files Browse the repository at this point in the history
  • Loading branch information
guifranz committed Jun 7, 2017
2 parents 03c0c17 + 8342b96 commit a61adf7
Show file tree
Hide file tree
Showing 280 changed files with 34,545 additions and 2,682 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -272,3 +272,8 @@ Solutions/Linux/Nix.mk
Solutions/Linux/Config.mk
Solutions/Linux/MohidLand/MohidLand
Solutions/Linux/MohidWater/MohidWater
*.manifest
*.opendb
/Solutions/VisualStudio2015_IntelFortran16/MOHIDNumerics/MOHIDNumerics.VC.VC.opendb
*.db
*.db3
Binary file removed Desktop.ini
Binary file not shown.
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# MOHID - Water Modelling System

MOHID is short for Modelo Hidrodinâmico which is hydrodynamic model in Portuguese. MOHID is a three-dimensional water modelling system, developed by MARETEC (Marine and Environmental Technology Research Center) at Instituto Superior Técnico (IST) which belongs to Lisbon University.

## What is this repository?
This is the MOHID Water Modelling System OFFICIAL repository

## Overview
MOHID is a modular finite volumes water-modelling system written in ANSI-Fortran95 using an Object-oriented programming philosophy, integrating diverse mathematical models and supporting graphical user interfaces that manage all the pre- and post-processing.
MOHID allows the adoption of an integrated modelling philosophy, not only of processes (physical and biogeochemical), but also of different scales (allowing the use of nested models) and systems (estuaries and watersheds), due to the adoption of an object oriented programming philosophy.
The development of MOHID started back in 1985. Since that time a continuous development effort of new features has been maintained. Model updates and improvements were made available in a regular basis were used in the framework of many research and engineering projects.
All programs included in MOHID Water Modelling System are built on the top of one or more base libraries and the two core executables files can be found at the top of the pyramid:
* MOHID Water – Three-dimensional mathematical model to simulate surface water bodies.
* MOHID Land – Watershed mathematical model or Hydrological transport model designed to simulate drainage basin and aquifer;

Smaller utility programs are easily built on the top of the libraries, which are usually designed for pre or post-processing results of the models. This support tools are normally managed by graphical user interfaces which allow management of input data, control of program execution, and output results analysis, along with other pre- and post-processing operations.
The integration of MOHID’s different tools can be easily achieved since these tools are based on the same framework. This coupling can thus be used to study the water cycle and its associated processes in an integrated approach.

## Help, Bugs, Feedback
If you need help with MOHID, want to keep up with progress, chat with developers or ask any other questions about MOHID, you can hang out by mail: <[email protected]> or consult our [MOHID wiki](http://wiki.mohid.com). You can also subscribe to our [MOHID forum](http://forum.mohid.com). To report bugs, please create a GitHub issue or contact any developers. More information consult <http://www.mohid.com>

## License
GNU General Public License. See the [GNU General Public License](http://www.gnu.org/copyleft/gpl.html) web page for more information.
4 changes: 0 additions & 4 deletions README.txt

This file was deleted.

129 changes: 101 additions & 28 deletions Software/ConvertToHDF5/ModuleInterpolateGrids.F90
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ Module ModuleInterpolateGrids
integer :: ObjHorizontalGridReplaced = 0
logical :: Interpolation3D, InterpolateGrid3D, NewInterpolation
integer :: TypeOfInterpolation
logical :: InterpolationWindowAuto
type(T_Grid ) :: Father
type(T_Grid ) :: New
type(T_Grid ) :: Aux
Expand Down Expand Up @@ -400,7 +401,7 @@ subroutine ReadOptions(ClientNumber)
write(*,*) 'Unknown type of interpolation'
stop 'ReadOptions - ModuleInterpolateGrids - ERR110'
end if


!Aux4(1) = FillValueReal
!Aux4(2) = FillValueReal
Expand Down Expand Up @@ -467,7 +468,7 @@ subroutine ReadOptions(ClientNumber)
ClientModule = 'ConvertToHDF5', &
Default = .false., &
STAT = STAT_CALL)
if (STAT_CALL /= SUCCESS_) stop 'ReadOptions - ModuleInterpolateGrids - ERR155'
if (STAT_CALL /= SUCCESS_) stop 'ReadOptions - ModuleInterpolateGrids - ERR160'


call GetData(Me%NewInterpolation, &
Expand All @@ -477,8 +478,17 @@ subroutine ReadOptions(ClientNumber)
ClientModule = 'ConvertToHDF5', &
Default = .false., &
STAT = STAT_CALL)
if (STAT_CALL /= SUCCESS_) stop 'ReadOptions - ModuleInterpolateGrids - ERR150'
if (STAT_CALL /= SUCCESS_) stop 'ReadOptions - ModuleInterpolateGrids - ERR170'


call GetData(Me%InterpolationWindowAuto, &
Me%ObjEnterData, iflag, &
SearchType = FromBlock, &
keyword = 'INTERPOLATION_WINDOW_AUTO', &
Default = .true., &
ClientModule = 'ConvertToHDF5', &
STAT = STAT_CALL)
if (STAT_CALL /= SUCCESS_) stop 'ReadOptions - ModuleInterpolateGrids - ERR180'



Expand Down Expand Up @@ -2058,6 +2068,7 @@ subroutine ConstructNewGrid
logical :: exist
integer, dimension(:, :, :), pointer :: WaterPoints3D
real, dimension(:, :), pointer :: SurfaceElevation
real :: West, East, South, North

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

Expand Down Expand Up @@ -2092,7 +2103,7 @@ subroutine ConstructNewGrid
ActualTime = Me%BeginTime, &
STAT = STAT_CALL)
if(STAT_CALL .ne. SUCCESS_) stop 'ConstructNewGrid - ModuleInterpolateGrids - ERR05'

if(Me%Interpolation3D) then

call ConstructGeometry (GeometryID = Me%New%ObjGeometry, &
Expand Down Expand Up @@ -2122,19 +2133,35 @@ subroutine ConstructNewGrid
SurfaceElevation(:,:) = 0

call GetWaterPoints3D(Me%New%ObjMap, WaterPoints3D, STAT = STAT_CALL)
if (STAT_CALL /= SUCCESS_)stop 'Open_HDF5_OutPut_File - ModuleInterpolateGrids - ERR02'
if (STAT_CALL /= SUCCESS_)stop 'Open_HDF5_OutPut_File - ModuleInterpolateGrids - ERR09'

call ComputeInitialGeometry(GeometryID = Me%New%ObjGeometry, &
WaterPoints3D = WaterPoints3D, &
SurfaceElevation= SurfaceElevation, &
ActualTime = Me%BeginTime, &
STAT = STAT_CALL)
if(STAT_CALL .ne. SUCCESS_) stop 'ConstructNewGrid - ModuleInterpolateGrids - ERR06'
if(STAT_CALL .ne. SUCCESS_) stop 'ConstructNewGrid - ModuleInterpolateGrids - ERR10'

deallocate(SurfaceElevation)

endif

if (Me%InterpolationWindowAuto) then

call GetGridBorderLimits(Me%New%ObjHorizontalGrid, West, East, South, North, STAT = STAT_CALL)
if (STAT_CALL /= SUCCESS_) stop 'ConstructNewGrid - ModuleInterpolateGrids - ERR11'

! call GetSonWindow(Me%New%ObjHorizontalGrid, Me%Father%ObjHorizontalGrid, Me%Window, STAT = STAT_CALL)
! if (STAT_CALL /= SUCCESS_) stop 'ConstructNewGrid - ModuleInterpolateGrids - ERR12'

Me%InterpolWindow%Xmin = West
Me%InterpolWindow%Ymin = South
Me%InterpolWindow%Xmax = East
Me%InterpolWindow%Ymax = North

endif


end subroutine ConstructNewGrid

!------------------------------------------------------------------------
Expand Down Expand Up @@ -2189,7 +2216,7 @@ subroutine ConstructFatherGrid
call GetCheckDistortion(HorizontalGridID = Me%Father%ObjHorizontalGrid,&
Distortion = NotRegularGrid, &
STAT = STAT_CALL)
if (STAT_CALL /= SUCCESS_) stop 'ConstructFatherGrid - ModuleInterpolateGrids - ERR60'
if (STAT_CALL /= SUCCESS_) stop 'ConstructFatherGrid - ModuleInterpolateGrids - ERR60'

if (NotRegularGrid) then

Expand Down Expand Up @@ -2461,7 +2488,8 @@ subroutine FatherSonCommunication(NewGrid)
real :: AuxXorig, AuxYorig
logical :: Distorted
integer :: STAT_CALL, CoordType, CoordTypeSon
integer :: ReadCartCorners, ProjType
integer :: ProjType
logical :: ReadCartCorners
integer :: UTM, MIL_PORT, GEOG, SIMPLE_GEOG
integer :: GRID_COORD, NLRD
integer :: ObjHorizontalGrid
Expand Down Expand Up @@ -2538,7 +2566,7 @@ subroutine FatherSonCommunication(NewGrid)
XX = AuxX, &
YY = AuxY, &
Xorig = AuxXorig, &
Yorig = AuxYorig, &
Yorig = AuxYorig, &
Latitude = NewGridLat, &
Longitude = NewGridLong, &
ILB = Me%Father%WorkSize2D%ILB, &
Expand All @@ -2558,7 +2586,7 @@ subroutine FatherSonCommunication(NewGrid)
call UngetHorizontalGrid(Me%Father%ObjHorizontalGrid, &
AuxY, &
STAT = STAT_CALL)
if(STAT_CALL /= SUCCESS_) stop 'FatherSonCommunication - ModuleInterpolateGrids - ERR100'
if(STAT_CALL /= SUCCESS_) stop 'FatherSonCommunication - ModuleInterpolateGrids - ERR100'


Me%ObjHorizontalGridReplaced = Me%Father%ObjHorizontalGrid
Expand Down Expand Up @@ -3526,10 +3554,12 @@ subroutine Triangulator (FatherField, NewField, NewGrid)
!Local-----------------------------------------------------------------
real, dimension(:), pointer :: NodeX, NodeY, NodeZ
real :: AuxX, AuxY
real :: AuxXmin, AuxYmin
real :: AuxXmax, AuxYmax
integer :: STAT_CALL
integer :: NumberOfNodes, Count, i, j
integer :: ii, jj, di, dj, daux
logical :: FillOutsidePoints = .false.
!integer, dimension(:,: ), pointer :: WaterPoints2D

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

Expand All @@ -3545,31 +3575,74 @@ subroutine Triangulator (FatherField, NewField, NewGrid)

Count = 0

do j = Me%Father%WorkSize2D%JLB, Me%Father%WorkSize2D%JUB
do i = Me%Father%WorkSize2D%ILB, Me%Father%WorkSize2D%IUB
d1: do jj = Me%Father%WorkSize2D%JLB, Me%Father%WorkSize2D%JUB,3

daux = Me%Father%WorkSize2D%JUB - jj

if (daux < 0) then
stop 'Triangulator - ModuleInterpolateGrids - ERR10'
endif

AuxX = ((Me%Father%ConnectionX(i, j ) + Me%Father%ConnectionX(i+1, j ))/2. + &
(Me%Father%ConnectionX(i, j+1) + Me%Father%ConnectionX(i+1, j+1))/2.)/2.

AuxY = ((Me%Father%ConnectionY(i, j ) + Me%Father%ConnectionY(i+1, j ))/2. + &
(Me%Father%ConnectionY(i, j+1) + Me%Father%ConnectionY(i+1, j+1))/2.)/2.
if (daux < 2) then
dj = daux
else
dj = 2
endif

if (Me%Father%WaterPoints2D(i, j) == WaterPoint .and. &
AuxX > Me%InterpolWindow%Xmin .and. AuxX < Me%InterpolWindow%Xmax .and.&
AuxY > Me%InterpolWindow%Ymin .and. AuxY < Me%InterpolWindow%Ymax) then
d2: do ii = Me%Father%WorkSize2D%ILB, Me%Father%WorkSize2D%IUB,3

daux = Me%Father%WorkSize2D%IUB - ii

Count = Count + 1
if (daux < 0) then
stop 'Triangulator - ModuleInterpolateGrids - ERR20'
endif

if (daux < 2) then
di = daux
else
di = 2
endif

NodeX(Count) = AuxX
AuxXmax = maxval(Me%Father%ConnectionX(ii:ii+di+1,jj:jj+dj+1))
AuxXmin = minval(Me%Father%ConnectionX(ii:ii+di+1,jj:jj+dj+1))

NodeY(Count) = AuxY
AuxYmax = maxval(Me%Father%ConnectionY(ii:ii+di+1,jj:jj+dj+1))
AuxYmin = minval(Me%Father%ConnectionY(ii:ii+di+1,jj:jj+dj+1))

NodeZ(Count) = FatherField%Values2D(i, j)

endif
i1: if (AuxXmax >= Me%InterpolWindow%Xmin .and. AuxXmin <= Me%InterpolWindow%Xmax .and.&
AuxYmax >= Me%InterpolWindow%Ymin .and. AuxYmin <= Me%InterpolWindow%Ymax) then

enddo
enddo

d3: do j = jj, jj+dj
d4: do i = ii, ii+di

if (Me%Father%WaterPoints2D(i, j) /= WaterPoint) cycle


AuxX = ((Me%Father%ConnectionX(i, j ) + Me%Father%ConnectionX(i+1, j ))/2. + &
(Me%Father%ConnectionX(i, j+1) + Me%Father%ConnectionX(i+1, j+1))/2.)/2.

AuxY = ((Me%Father%ConnectionY(i, j ) + Me%Father%ConnectionY(i+1, j ))/2. + &
(Me%Father%ConnectionY(i, j+1) + Me%Father%ConnectionY(i+1, j+1))/2.)/2.



Count = Count + 1

NodeX(Count) = AuxX

NodeY(Count) = AuxY

NodeZ(Count) = FatherField%Values2D(i, j)

enddo d4
enddo d3

endif i1

enddo d2
enddo d1

NumberOfNodes = Count

Expand Down
30 changes: 28 additions & 2 deletions Software/ConvertToHDF5/ModuleNetCDFCF_2_HDF5MOHID.F90
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ Module ModuleNetCDFCF_2_HDF5MOHID
logical :: Accumulated2Step
logical :: FromDir2Vector
logical :: FromMeteo2Algebric
logical :: FromCartesian2Meteo
character(len=StringLength) :: DirX
character(len=StringLength) :: DirY
logical :: ComputeIntensity, Rotation, Beaufort, WaveBeaufort
Expand Down Expand Up @@ -2639,6 +2640,20 @@ subroutine ReadFieldOptions
STAT = STAT_CALL)
if (STAT_CALL /= SUCCESS_) stop 'ReadFieldOptions - ModuleNetCDFCF_2_HDF5MOHID - ERR2650'

call GetData(Me%Field(ip)%FromCartesian2Meteo, &
Me%ObjEnterData, iflag, &
SearchType = FromBlockInBlock, &
keyword = 'CARTESIAN_TO_METEO', &
default = .false., &
ClientModule = 'ModuleNetCDFCF_2_HDF5MOHID', &
STAT = STAT_CALL)
if (STAT_CALL /= SUCCESS_) stop 'ReadFieldOptions - ModuleNetCDFCF_2_HDF5MOHID - ERR2655'

if (Me%Field(ip)%FromMeteo2Algebric .and. Me%Field(ip)%FromCartesian2Meteo) then
write(*,*) "Options METEO_TO_ALGEBRIC and CARTESIAN_TO_METEO can not be both true"
stop 'ReadFieldOptions - ModuleNetCDFCF_2_HDF5MOHID - ERR2657'
endif


call GetData(Me%Field(ip)%ValueIn%diL, &
Me%ObjEnterData, iflag, &
Expand Down Expand Up @@ -6465,7 +6480,7 @@ subroutine WriteFieldHDF5(iP, iFinal)
Aux2D(i,j) = FillValueReal
else
!Direction property - from meteorological convention to algebric
if (Me%Field(iP)%FromMeteo2Algebric) then
if (Me%Field(iP)%FromMeteo2Algebric .or. Me%Field(iP)%FromCartesian2Meteo) then
Aux2D(i,j) = 270. - Aux2D(i,j)
endif
endif
Expand Down Expand Up @@ -6886,7 +6901,17 @@ subroutine WriteFieldNetCDF(iP, iFinal)
Field2D(j,i) = 270. - Field2D(j,i)
endif
enddo
enddo
enddo

do j = 1, WorkJUB
do i = 1, WorkIUB
Field2D(j,i)=Me%Field(iP)%Value2DOut(i,j)
!Direction property - from cartesian (or algebric) convention to meteorological
if (Me%Field(iP)%FromCartesian2Meteo) then
Field2D(j,i) = 270. - Field2D(j,i)
endif
enddo
enddo


call BuildAttributes(trim(Me%Field(iP)%ID%Name), NCDFName, LongName, StandardName, &
Expand Down Expand Up @@ -6921,6 +6946,7 @@ subroutine WriteFieldNetCDF(iP, iFinal)
enddo
enddo


call BuildAttributes(trim(Me%Field(iP)%DirX), NCDFName, LongName, StandardName, &
Units, ValidMin, ValidMax, &
MinValue, MaxValue, MissingValue, Float2D = Field2D)
Expand Down
Loading

0 comments on commit a61adf7

Please sign in to comment.