Path: blob/devel/elmerice/UserFunctions/USF_IceProperties.F90
3196 views
!/*****************************************************************************/1! *2! * Elmer/Ice, a glaciological add-on to Elmer3! * http://elmerice.elmerfem.org4! *5! *6! * This program is free software; you can redistribute it and/or7! * modify it under the terms of the GNU General Public License8! * as published by the Free Software Foundation; either version 29! * of the License, or (at your option) any later version.10! *11! * This program 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 the14! * GNU General Public License for more details.15! *16! * You should have received a copy of the GNU General Public License17! * along with this program (in file fem/GPL-2); if not, write to the18! * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,19! * Boston, MA 02110-1301, USA.20! *21! *****************************************************************************/22! ******************************************************************************23! *24! *25! * Authors: Denis Cohen, Thomas Zwinger26! * Email:27! * Web: http://elmerice.elmerfem.org28! *29! Contains functions for material properties of ice:30! - IceConductivity_SI31! - IceConductivity_m_Mpa_a32! - IceCapacity_SI33! - IceCapacity_m_MPa_a34! - IcePressureMeltingPoint35!36MODULE IceProperties37USE DefUtils38USE Types3940IMPLICIT None4142CONTAINS4344!==============================================================================45FUNCTION GetIceConductivity(temp) RESULT(cond)46!==============================================================================474849IMPLICIT None50REAL(KIND=dp) :: temp, cond51525354cond = 9.828_dp*exp(-5.7d-03*temp)5556END FUNCTION GetIceConductivity5758!==============================================================================59FUNCTION GetIceCapacity(temp) RESULT(capac)60!==============================================================================6162USE DefUtils6364IMPLICIT None6566REAL(KIND=dp) :: temp, capac67686970capac = 146.3_dp + (7.253_dp * temp)71END FUNCTION GetIceCapacity7273!==============================================================================74FUNCTION GetIcePressureMeltingPoint(ClausiusClapeyron, press) RESULT(Tpmp)75!==============================================================================7677USE DefUtils7879IMPLICIT None8081REAL(KIND=dp) :: Tpmp, ClausiusClapeyron, press8283Tpmp = 273.15_dp - ClausiusClapeyron*MAX(press, 0.0_dp)8485END FUNCTION GetIcePressureMeltingPoint8687END MODULE IceProperties8889!==============================================================================90FUNCTION IceConductivity(Model, Node, temp) RESULT(cond)91!==============================================================================92USE IceProperties9394TYPE(Model_t) :: Model95INTEGER :: Node96REAL(KIND=dp) :: temp, cond9798REAL(KIND=dp) :: scalingfactor99TYPE(Element_t), POINTER :: Element100TYPE(ValueList_t), POINTER :: Material101LOGICAL :: Found102103Element => Model % CurrentElement104Material => GetMaterial(Element)105scalingfactor = GetConstReal(Material,"Heat Conductivity Scaling Factor",Found)106IF (.NOT.Found) scalingfactor = 1.0_dp107cond = scalingfactor * GetIceConductivity(temp)108END FUNCTION IceConductivity109110!==============================================================================111FUNCTION IceCapacity(Model, Node, temp) RESULT(capac)112!==============================================================================113USE IceProperties114115IMPLICIT None116117TYPE(Model_t) :: Model118INTEGER :: Node119REAL(KIND=dp) :: temp, capac120121REAL(KIND=dp) :: scalingfactor122TYPE(Element_t), POINTER :: Element123TYPE(ValueList_t), POINTER :: Material124LOGICAL :: Found125126Element => Model % CurrentElement127Material => GetMaterial(Element)128scalingfactor = GetConstReal(Material,"Heat Capacity Scaling Factor",Found)129IF (.NOT.Found) scalingfactor = 1.0_dp130capac = scalingfactor * GetIceCapacity(temp)131END FUNCTION IceCapacity132133!==============================================================================134FUNCTION IcePressureMeltingPoint(Model, Node, press) RESULT(Tpmp)135!==============================================================================136137USE IceProperties138139IMPLICIT None140141TYPE(Model_t) :: Model142INTEGER :: Node143REAL(KIND=dp) :: Tpmp, press144145INTEGER :: N146REAL(KIND=dp) :: ClausiusClapeyron, tmpoffset147TYPE(ValueList_t), POINTER :: Constants148LOGICAL :: FirstTime = .TRUE., GotIt, InCelsius149REAL(KIND=dp) :: scalingfactor=1.0_dp150TYPE(Element_t), POINTER :: Element151TYPE(ValueList_t), POINTER :: Material, BC152153SAVE FirstTime, ClausiusClapeyron154155Element => Model % CurrentElement156Material => GetMaterial(Element)157IF (.NOT.ASSOCIATED(Material)) THEN158BC => GetBC(Element)159IF (.NOT.ASSOCIATED(BC)) THEN160scalingfactor=1.0_dp161CALL INFO("IcePressureMeltingPoint", 'No "Pressure Scaling Factor" found - setting to 1.0',Level=9)162ELSE163scalingfactor = GetConstReal(BC,"Pressure Scaling Factor",GotIt)164END IF165ELSE166scalingfactor = GetConstReal(Material,"Pressure Scaling Factor",GotIt)167END IF168IF (.NOT.GotIt) scalingfactor = 1.0_dp169InCelsius = GetLogical(Material, "Pressure Melting Point Celsius", GotIt)170IF (InCelsius) THEN171tmpoffset = 273.15_dp172ELSE173tmpoffset = 0.0_dp174END IF175IF (FirstTime) THEN176FirstTime = .FALSE.177Constants => GetConstants()178IF (ASSOCIATED(Constants)) THEN179ClausiusClapeyron = GetConstReal( Constants, 'Clausius Clapeyron Constant', GotIt)180ELSE181GotIt=.FALSE.182ENDIF183IF (.NOT.GotIt) THEN184ClausiusClapeyron = 9.8d-08185CALL INFO("IcePressureMeltingPoint","No entry found for >Clausius Clapeyron Constant<.",Level=9)186CALL INFO("IcePressureMeltingPoint","Setting to 9.8d-08 (SI units)",Level=9)187END IF188END IF189Tpmp = GetIcePressureMeltingPoint(ClausiusClapeyron,scalingfactor*press) + tmpoffset190END FUNCTION IcePressureMeltingPoint191!==============================================================================192FUNCTION RelativeTemperature(Model, Node, InputArray) RESULT(Trel)193!==============================================================================194USE IceProperties195USE DefUtils196IMPLICIT None197198TYPE(Model_t) :: Model199INTEGER :: Node200REAL(KIND=dp) :: Trel, InputArray(2)201! ----202REAL(KIND=dp) :: press, Tabs, Tpmp, ClausiusClapeyron, tmpoffset, scalingfactor=1.0_dp203TYPE(Element_t), POINTER :: Element204TYPE(ValueList_t), POINTER :: Material, BC, Constants205LOGICAL :: CorrectRelTemp = .FALSE., GotIt, FirstTime = .TRUE., InCelsius = .FALSE.206207SAVE FirstTime, ClausiusClapeyron208209Tabs = InputArray(1)210press = InputArray(2)211Element => Model % CurrentElement212Material => GetMaterial(Element)213IF (.NOT.ASSOCIATED(Material)) THEN214BC => GetBC(Element)215IF (.NOT.ASSOCIATED(BC)) THEN216scalingfactor=1.0_dp217CALL INFO("IcePressureMeltingPoint", 'No "Pressure Scaling Factor" found - setting to 1.0',Level=9)218ELSE219scalingfactor = GetConstReal(BC,"Pressure Scaling Factor",GotIt)220END IF221ELSE222scalingfactor = GetConstReal(Material,"Pressure Scaling Factor",GotIt)223END IF224IF (.NOT.GotIt) scalingfactor = 1.0_dp225IF (FirstTime) THEN226FirstTime = .FALSE.227Constants => GetConstants()228CorrectRelTemp=ListGetLogical(Material,"Correct Relative Tempeature", GotIt)229IF (ASSOCIATED(Constants)) THEN230ClausiusClapeyron = GetConstReal( Constants, 'Clausius Clapeyron Constant', GotIt)231ELSE232GotIt=.FALSE.233ENDIF234IF (.NOT.GotIt) THEN235ClausiusClapeyron = 9.8d-08236CALL INFO("IcePressureMeltingPoint","No entry found for >Clausius Clapeyron Constant<.",Level=9)237CALL INFO("IcePressureMeltingPoint","Setting to 9.8d-08 (SI units)",Level=9)238END IF239END IF240241InCelsius = GetLogical(Material, "Pressure Melting Point Celsius", GotIt)242IF (InCelsius) THEN243tmpoffset = 273.15_dp244ELSE245tmpoffset = 0.0_dp246END IF247Tpmp = GetIcePressureMeltingPoint(ClausiusClapeyron,scalingfactor*press) + tmpoffset248Trel = Tabs - Tpmp249Element => Model % CurrentElement250Material => GetMaterial(Element)251IF (ASSOCIATED(Material)) THEN252CorrectRelTemp=ListGetLogical(Material,"Correct Relative Tempeature", GotIt)253IF (.NOT.GotIt) THEN254CorrectRelTemp=.FALSE.255ELSE IF (CorrectRelTemp) THEN256IF (FirstTime) THEN257CALL INFO("USF_IceProperties(IcePressureMeltingPoint)","Limiting Relative Temperature",Level=3)258FirstTime = .FALSE.259ENDIF260Trel = MIN(Trel, 0.0_dp)261ENDIF262ENDIF263END FUNCTION RelativeTemperature264!==============================================================================265FUNCTION ArrheniusFactor(Model, Node, InputArray) RESULT(ArrhF)266!==============================================================================267268USE IceProperties269270IMPLICIT None271272TYPE(Model_t) :: Model273INTEGER :: Node274REAL(KIND=dp) :: InputArray(2), Arrhf275276INTEGER :: N277REAL(KIND=dp) :: Temp, Pressure278REAL(KIND=dp) :: Tempoffset, GlenExponent, GlenEnhancementFactor, &279ClausiusClapeyron, GasConstant, LimitTemperature,&280Tpmp, Trel, scalingfactor, RateFactor(2), ActivationEnergy(2)281TYPE(ValueList_t), POINTER :: Constants282LOGICAL :: GotIt, InCelsius, ScaleRateFactor283TYPE(Element_t), POINTER :: Element284TYPE(ValueList_t), POINTER :: Material285286287288289Element => Model % CurrentElement290Material => GetMaterial(Element)291Constants => GetConstants()292293GasConstant = GetConstReal(Constants, "Gas Constant",GotIt)294IF (.NOT.GotIt) GasConstant = 8.314_dp295ClausiusClapeyron = GetConstReal( Constants, 'Clausius Clapeyron Constant', GotIt)296IF (.NOT.GotIt) THEN297ClausiusClapeyron = 9.8d-08298CALL INFO("IcePressureMeltingPoint","No entry found for >Clausius Clapeyron Constant<.",Level=5)299CALL INFO("IcePressureMeltingPoint","Setting to 9.8d-08 (SI units)",Level=5)300END IF301scalingfactor = GetConstReal(Material,"Pressure Scaling Factor",GotIt)302IF (.NOT.GotIt) scalingfactor = 1.0_dp303InCelsius = GetLogical(Material, "Temperature in Celsius", GotIt)304IF (InCelsius) THEN305Tempoffset = 0.0_dp306ELSE307Tempoffset = 273.15_dp308END IF309310Temp = InputArray(1) - Tempoffset311Pressure = InputArray(2)312313GlenExponent = GetConstReal(Material,"Glen Exponent",GotIt)314IF (.NOT.GotIt) THEN315CALL INFO("IceProperties(ArrheniusFactor)",&316'"Glen Exponent" not found. Setting to 3.0',Level=5)317GlenExponent = 3.0_dp318END IF319LimitTemperature = GetConstReal(Material,"Limit Temperature",GotIt)320IF (.NOT.GotIt) THEN321CALL INFO("IceProperties(ArrheniusFactor)",&322'"Limit Temperature" not found. Setting to -10.0',Level=5)323LimitTemperature = -10.0_dp324END IF325RateFactor(1) = GetConstReal(Material,"Rate Factor 1", GotIt)326IF (.NOT.GotIt) THEN327CALL INFO("IceProperties(ArrheniusFactor)",&328'"Rate Factor 1" not found. Setting to (SI value) 2.89165e-13',Level=5)329RateFactor(1) = 2.89165d-13330END IF331RateFactor(2) = GetConstReal(Material,"Rate Factor 2", GotIt)332IF (.NOT.GotIt) THEN333CALL INFO("IceProperties(ArrheniusFactor)",&334'"Rate Factor 2" not found. Setting to (SI value) 2.42736e-02',Level=5)335RateFactor(2) = 2.42736d-02336END IF337ScaleRateFactor = GetLogical(Material,"Scale Rate Factors",GotIt)338IF (ScaleRateFactor) RateFactor = RateFactor*(scalingfactor**GlenExponent)339340ActivationEnergy(1) = GetConstReal(Material,"Activation Energy 1", GotIt)341IF (.NOT.GotIt) THEN342CALL INFO("IceProperties(ArrheniusEnergy)",&343'"Activation Energy 1" not found. Setting to (SI value) 60.0e03',Level=5)344ActivationEnergy(1) = 60.0d03345END IF346ActivationEnergy(2) = GetConstReal(Material,"Activation Energy 2", GotIt)347IF (.NOT.GotIt) THEN348CALL INFO("IceProperties(ArrheniusEnergy)",&349'"Activation Energy 2" not found. Setting to (SI value) 115.0e3',Level=5)350ActivationEnergy(2) = 115.d03351END IF352353GlenEnhancementFactor = GetConstReal(Material,"Glen Enhancement Factor",GotIt)354IF (.NOT.GotIt) THEN355CALL INFO("IceProperties(ArrheniusEnergy)",&356'"Glen Enhancement Factor" not found. Setting to 1.0', Level=5)357GlenEnhancementFactor = 1.0_dp358END IF359360! need to scale pressure361Tpmp = GetIcePressureMeltingPoint(ClausiusClapeyron, scalingfactor * Pressure)362363Trel = MAX(MIN(Temp - Tpmp,0.0_dp),-60.0_dp)364IF (Trel<-10) THEN365Arrhf = RateFactor(1) * EXP( -ActivationEnergy(1)/( GasConstant* (273.15 + Trel)))366ELSE367Arrhf= RateFactor(2) * EXP( -ActivationEnergy(2)/( GasConstant* (273.15 + Trel)))368END IF369END FUNCTION ArrheniusFactor370371372