From d6455ed98086d2e19471b6da6ee105364c04b657 Mon Sep 17 00:00:00 2001 From: pvelissariou1 Date: Thu, 10 Feb 2022 14:11:27 -0600 Subject: [PATCH 1/2] added modifications from GLing --- atmesh.F90 | 130 ++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 95 insertions(+), 35 deletions(-) diff --git a/atmesh.F90 b/atmesh.F90 index 5f19129..aa2eefd 100644 --- a/atmesh.F90 +++ b/atmesh.F90 @@ -335,26 +335,36 @@ end subroutine fld_list_add !! @param clock an ESMF_Clock object !! @param rc return code ! - subroutine InitializeP2(model, importState, exportState, clock, rc) + SUBROUTINE InitializeP2(model, importState, exportState, clock, rc) type(ESMF_GridComp) :: model type(ESMF_State) :: importState, exportState type(ESMF_Clock) :: clock, driverClock integer, intent(out) :: rc - ! local variables - type(ESMF_TimeInterval) :: ATMESHTimeStep - type(ESMF_Field) :: field + ! local variables !Saeed added type(meshdata) :: mdataw type(ESMF_Mesh) :: ModelMesh,meshIn,meshOut type(ESMF_VM) :: vm - type(ESMF_Time) :: startTime integer :: localPet, petCount character(len=*),parameter :: subname='(ATMESH:RealizeFieldsProvidingGrid)' +!PV ======================================================= PV - for GL mods + real(ESMF_KIND_R8), pointer :: dataPtr_uwnd(:) + real(ESMF_KIND_R8), pointer :: dataPtr_vwnd(:) + real(ESMF_KIND_R8), pointer :: dataPtr_pres(:) + + type(ESMF_Time) :: currTime + type(ESMF_TimeInterval) :: timeStep + integer :: YY, MM, DD, H, M, S + character(len=128) :: timeStr + + type(ESMF_Clock) :: clock_tmp + type(ESMF_State) :: importState_tmp, exportState_tmp +!PV ======================================================= PV - for GL mods + rc = ESMF_SUCCESS - !print *,"ATMESH ..1.............................................. >> " !> \details Get current ESMF VM. call ESMF_VMGetCurrent(vm, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -362,13 +372,11 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) file=__FILE__)) & return ! bail out - !print *,"ATMESH ..2.............................................. >> " ! Get query local pet information for handeling global node information call ESMF_VMGet(vm, localPet=localPet, petCount=petCount, rc=rc) ! call ESMF_VMPrint(vm, rc=rc) - !print *,localPet,"< LOCAL pet, ATMESH ..3.............................................. >> " - !! Assign VM to mesh data type. + ! Assign VM to mesh data type. mdataw%vm = vm call construct_meshdata_from_netcdf(mdataw) @@ -382,22 +390,12 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) file=__FILE__)) & return ! bail out - meshIn = ModelMesh ! for now out same as in meshOut = meshIn mdataInw = mdataw mdataOutw = mdataw - !print *,"..................................................... >> " - !print *,"NumNd", mdataw%NumNd - !print *,"NumOwnedNd", mdataw%NumOwnedNd - !print *,"NumEl", mdataw%NumEl - !print *,"NumND_per_El", mdataw%NumND_per_El - !print *,"NumOwnedNd mdataOutw", mdataOutw%NumOwnedNd - - - call ATMESH_RealizeFields(importState, meshIn , mdataw, fldsToWav_num, fldsToWav, "ATMESH import", rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -410,27 +408,89 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) file=__FILE__)) & return ! bail out - !Init ATMesh -! ! query Component for the driverClock -! call NUOPC_ModelGet(model, driverClock=driverClock, rc=rc) -! if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & -! line=__LINE__, & -! file=__FILE__)) & -! return ! bail out +!PV ======================================================= PV - for GL mods + call NUOPC_ModelGet(model, importState=importState_tmp, & + exportState=exportState_tmp, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + call ESMF_ClockPrint(clock, options="currTime", & + preString="------>Advancing ATMESH from: ", rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + call ESMF_ClockGet(clock, currTime=currTime, timeStep=timeStep, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + call ESMF_TimePrint(currTime + timeStep, & + preString="------------------ATMESH-------------> to: ", rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + call ESMF_TimeGet(currTime, yy=YY, mm=MM, dd=DD, h=H, m=M, s=S, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + write(info, *) "ATMESH currTime = ", YY, "/", MM, "/", DD," ", H, ":", M, ":", S + call ESMF_LogWrite(info, ESMF_LOGMSG_INFO, line=__LINE__, file=__FILE__, rc=rc) - ! get the start time and current time out of the clock -! call ESMF_ClockGet(driverClock, startTime=startTime, rc=rc) -! if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & -! line=__LINE__, & -! file=__FILE__)) & -! return ! bail out + call ESMF_TimeGet(currTime, timeStringISOFrac=timeStr , rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out -! call read_atmesh_nc(startTime) + ! Get the data arrays + CALL read_atmesh_nc(currTime) + + !--- (FIELD 1): PACK and send u-x wind component + CALL State_GetFldPtr_(ST = exportState, fldName = 'izwh10m', fldPtr = dataPtr_uwnd, & + rc = rc, dump = .FALSE., timeStr = timeStr) + IF (ESMF_LogFoundError(rcToCheck = rc, msg = ESMF_LOGERR_PASSTHRU, & + line = __LINE__, & + file = __FILE__)) & + RETURN ! bail out + + ! Fill nodes for dataPtr_izwh10m vector + dataPtr_uwnd = UWND(:, 1) + + !--- (FIELD 2): PACK and send v-y wind component + CALL State_GetFldPtr_(ST = exportState,fldName = 'imwh10m', fldPtr = dataPtr_vwnd, & + rc = rc, dump = .FALSE., timeStr = timeStr) + IF (ESMF_LogFoundError(rcToCheck = rc, msg = ESMF_LOGERR_PASSTHRU, & + line = __LINE__, & + file = __FILE__)) & + RETURN ! bail out + + dataPtr_vwnd = VWND(:, 1) + + !--- (FIELD 3): PACK and send pmsl + CALL State_GetFldPtr_(ST = exportState, fldName = 'pmsl', fldPtr = dataPtr_pres, & + rc = rc,dump = .FALSE., timeStr = timeStr) + IF (ESMF_LogFoundError(rcToCheck = rc, msg = ESMF_LOGERR_PASSTHRU, & + line = __LINE__, & + file = __FILE__)) & + RETURN ! bail out + + ! Fill only owned nodes for dataPtr_pmsl vector + dataPtr_pres = PRES(:, 1) +!PV ======================================================= PV - for GL mods write(info,*) subname,' --- initialization phase 2 completed --- ' - !print *, subname,' --- initialization phase 2 completed --- ' call ESMF_LogWrite(info, ESMF_LOGMSG_INFO, line=__LINE__, file=__FILE__, rc=dbrc) - end subroutine + + END SUBROUTINE InitializeP2 !> Adds a set of fields to an ESMF_State object. Each field is wrapped From 086d7bc063a425ca7ada3988f9eea91f97045b31 Mon Sep 17 00:00:00 2001 From: Panagiotis Velissariou Date: Mon, 24 Oct 2022 16:37:51 -0500 Subject: [PATCH 2/2] fixed naming of wind exchange fields --- atmesh.F90 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/atmesh.F90 b/atmesh.F90 index aa2eefd..9d96780 100644 --- a/atmesh.F90 +++ b/atmesh.F90 @@ -258,8 +258,8 @@ subroutine ATMESH_FieldsSetup !--------- export fields from ATMESH ------------- call fld_list_add(num=fldsFrATM_num, fldlist=fldsFrATM, stdname="air_pressure_at_sea_level" , shortname= "pmsl" ) - call fld_list_add(num=fldsFrATM_num, fldlist=fldsFrATM, stdname="inst_zonal_wind_height10m" , shortname= "izwh10m" ) - call fld_list_add(num=fldsFrATM_num, fldlist=fldsFrATM, stdname="inst_merid_wind_height10m" , shortname= "imwh10m" ) + call fld_list_add(num=fldsFrATM_num, fldlist=fldsFrATM, stdname="eastward_wind_at_10m_height" , shortname= "izwh10m" ) + call fld_list_add(num=fldsFrATM_num, fldlist=fldsFrATM, stdname="northward_wind_at_10m_height" , shortname= "imwh10m" ) ! write(info,*) subname,' --- Passed--- ' !print *, subname,' --- Passed --- '