!/*****************************************************************************/1! *2! * Elmer, A Finite Element Software for Multiphysical Problems3! *4! * Copyright 1st April 1995 - , CSC - IT Center for Science Ltd., Finland5! *6! * This library is free software; you can redistribute it and/or7! * modify it under the terms of the GNU Lesser General Public8! * License as published by the Free Software Foundation; either9! * version 2.1 of the License, or (at your option) any later version.10! *11! * This library is distributed in the hope that it will be useful,12! * but WITHOUT ANY WARRANTY; without even the implied warranty of13! * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU14! * Lesser General Public License for more details.15! *16! * You should have received a copy of the GNU Lesser General Public17! * License along with this library (in file ../LGPL-2.1); if not, write18! * to the Free Software Foundation, Inc., 51 Franklin Street,19! * Fifth Floor, Boston, MA 02110-1301 USA20! *21! *****************************************************************************/22!23!/******************************************************************************24! *25! * Authors: fabien Gillet-Chaulet26! * Email: [email protected]27! * Web: http://elmerice.elmerfem.org28! *29! * Original Date: 3 May 202230! *31! ******************************************************************************/32!--------------------------------------------------------------------------------33!> Generic ElmerIce user function for geographic projections34!> Use ProjUtils in under elmerice/Utils35!--------------------------------------------------------------------------------36FUNCTION xy2Lon(Model,nodenumber,VarIn) RESULT(VarOut)37USE ProjUtils38implicit none39!-----------------40TYPE(Model_t) :: Model41INTEGER :: nodenumber42REAL(kind=dp) :: VarIn(2) !x,y43REAL(kind=dp) :: VarOut !Longitude44REAL(kind=dp) :: x,y,Lon,Lat4546x=VarIn(1)47y=VarIn(2)48CALL xy2LonLat(x,y,Lon,Lat)49VarOut=Lon5051End FUNCTION xy2Lon5253FUNCTION xy2Lat(Model,nodenumber,VarIn) RESULT(VarOut)54USE ProjUtils55implicit none56!-----------------57TYPE(Model_t) :: Model58INTEGER :: nodenumber59REAL(kind=dp) :: VarIn(2) !x,y60REAL(kind=dp) :: VarOut !Latitude61REAL(kind=dp) :: x,y,Lon,Lat6263x=VarIn(1)64y=VarIn(2)65CALL xy2LonLat(x,y,Lon,Lat)66VarOut=Lat6768End FUNCTION xy2Lat6970FUNCTION LonLat2x(Model,nodenumber,VarIn) RESULT(VarOut)71USE ProjUtils72implicit none73!-----------------74TYPE(Model_t) :: Model75INTEGER :: nodenumber76REAL(kind=dp) :: VarIn(2) !Lon,Lat77REAL(kind=dp) :: VarOut ! x78REAL(kind=dp) :: x,y,Lon,Lat7980Lon=VarIn(1)81Lat=VarIn(2)82CALL LonLat2xy(Lon,Lat,x,y)83VarOut=x8485End FUNCTION LonLat2x8687FUNCTION LonLat2y(Model,nodenumber,VarIn) RESULT(VarOut)88USE ProjUtils89implicit none90!-----------------91TYPE(Model_t) :: Model92INTEGER :: nodenumber93REAL(kind=dp) :: VarIn(2) !Lon,Lat94REAL(kind=dp) :: VarOut !y95REAL(kind=dp) :: x,y,Lon,Lat9697Lon=VarIn(1)98Lat=VarIn(2)99CALL LonLat2xy(Lon,Lat,x,y)100VarOut=y101102End FUNCTION LonLat2y103104105