[mpas-developers] two more if statements

Michael Duda duda at ucar.edu
Thu Oct 28 16:55:47 MDT 2010


Hi, Mark. 

I also agree that the tests in both of the sections you've identified 
below should also be safe to remove. In both cases below, iEdge or eoe
may indeed reference an edge outside the local block, but this reference
would have been switched to the index of the "garbage edge" during 
domain setup, and we expect that the values from the garbage edge should
never influence the values of owned cells/edges/vertices. Please feel free
to eliminate these if-tests, too, and thanks for taking such a careful
look through the code!

Cheers,
Michael


On Thu, Oct 28, 2010 at 04:23:33PM -0600, Mark Petersen wrote:
> 
> Here are two more places to remove if statements, where they have remained 
> in the sw and ocean core but have already been removed from the hyd_atm 
> core.  Again, I think they are unnecessary.  If everyone agrees, I will 
> update the sw and ocean cores
> 
> ************ old, in sw:
>        !
>        ! Compute pv at the edges
>        !   ( this computes pv_edge at all edges bounding real cells and distance-1 ghost cells )
>        !
>        pv_edge(:,:) = 0.0
>        do iVertex = 1,nVertices
>          do i=1,grid % vertexDegree
>            iEdge = edgesOnVertex(i,iVertex)
>            if(iEdge <= nEdges) then
>              do k=1,nVertLevels
>                pv_edge(k,iEdge) =  pv_edge(k,iEdge)  + 0.5 * pv_vertex(k,iVertex)
>              enddo
>            endif
>          end do
>        end do
> 
> ********** newer, in current hyd_atm_core:
>        !
>        ! Compute pv at the edges
>        !   ( this computes pv_edge at all edges bounding real cells )
>        !
>        pv_edge(:,:) = 0.0
>        do iVertex = 1,nVertices
>          do i=1,grid % vertexDegree
>             iEdge = edgesOnVertex(i,iVertex)
>             do k=1,nVertLevels
>                pv_edge(k,iEdge) =  pv_edge(k,iEdge)  + 0.5 * pv_vertex(k,iVertex)
>             end do
>          end do
>        end do
> 
> *********************************************************************
> ************ old, in sw:
>        ! Compute v (tangential) velocities
>        !
>        v(:,:) = 0.0
>        do iEdge = 1,nEdges
>           do i=1,nEdgesOnEdge(iEdge)
>              eoe = edgesOnEdge(i,iEdge)
>              if (eoe <= nEdges) then
>                 do k = 1,nVertLevels
>                   v(k,iEdge) = v(k,iEdge) + weightsOnEdge(i,iEdge) * u(k, eoe)
>                end do
>              end if
>           end do
>        end do
> 
> ********** newer, in current hyd_atm_core:
>        !
>        ! Compute v (tangential) velocities
>        !
>        v(:,:) = 0.0
>        do iEdge = 1,nEdges
>           do i=1,nEdgesOnEdge(iEdge)
>              eoe = edgesOnEdge(i,iEdge)
>              do k = 1,nVertLevels
>                 v(k,iEdge) = v(k,iEdge) + weightsOnEdge(i,iEdge) * u(k, eoe)
>              end do
>           end do
>        end do
> 
> 
> _______________________________________________
> mpas-developers mailing list
> mpas-developers at mailman.ucar.edu
> http://mailman.ucar.edu/mailman/listinfo/mpas-developers


More information about the mpas-developers mailing list