Hi Trevor etal,
 
 1. a(0:11) and b(0:12) have been replaced by scalars a0, a1, etc.
 
 2. all constant multiplies applied to the a and b coefficients have
been
 absorbed into new scalars; two_a2, three_a3, etc.
 
 3. There is now only one divide for the calculation of density plus the
 two density partial derivatives.  The requires saving 1/den into an
 array.
 
 These changes will be part of a new beta release of mom4 in a few days.
 For the meantime, below is the code for the density and its partial
 derivatives.  Please let me know if there is anything remaining that is
 a problem.
 
 I am not sure why the POP EOS calculation is so expensive.  Again,
 however, I suggest that the relative cost of any piece of code can be
 quite dependent on model size, physical parameterizations, compiler,
 processors, etc.  MOM4 may show similar inefficiency in the EOS for
 other configurations, yet we have not seen such at this point...
 
 Best,
  Steve
 
 -----------------------------------------------------------
 For density:
 
        do k=1,nk
           do j=jscomp-halo,jecomp+halo
              do i=iscomp-halo,iecomp+halo
 
                 t1  = theta(i,j,k)
                 t2  = t1*t1
 
                 s1  = salinity(i,j,k)
                 sp5 = sqrt(s1)
                 p1   = press(i,j,k)*bars2decibars
                 p1t1 = p1*t1
 
                 num = a0 + t1*(a1 + t1*(a2+a3*t1) )  &
                      + s1*(a4 + a5*t1  + a6*s1)        &
                      + p1*(a7 + a8*t2 + a9*s1 + p1*(a10+a11*t2))
 
                 den = b0 + t1*(b1 + t1*(b2 + t1*(b3 + t1*b4)))      &
                      + s1*(b5 + t1*(b6 + b7*t2) + sp5*(b8 + b9*t2)) &
                      + p1*(b10 + p1t1*(b11*t2 + b12*p1))
 
                 denr(i,j,k) = 1.0/(epsln+den)
 
                 density_field(i,j,k) = num*denr(i,j,k)
 
              enddo
           enddo
        enddo
 
 -------------------------------------------------------
 for density partial derivatives
 
        do k=1,nk
           do j=jscomp-halo,jecomp+halo
              do i=iscomp-halo,iecomp+halo
 
                 t1  = theta(i,j,k)
                 t2  = t1*t1
                 s1  = salinity(i,j,k)
                 sp5 = sqrt(s1)
 
                 p1   = press(i,j,k)*bars2decibars
                 p2   = p1*p1
                 p1t1 = p1*t1
 
                 dnum_dtheta = a1 + t1*(two_a2 + three_a3*t1) &
                      + a5*s1                                 &
                      + p1t1*(two_a8 + two_a11*p1)
                 dden_dtheta = b1 + t1*(two_b2 + t1*(three_b3 +
four_b4*t1)) &
                      + s1*(b6 + t1*(three_b7*t1 +
two_b9*sp5))              &
                      + p2*(three_b11*t2 + b12*p1)
 
                 dnum_dsalinity = a4 + a5*t1 + two_a6*s1 + a9*p1
                 dden_dsalinity = b5 + t1*(b6 + b7*t2) + sp5*(onep5_b8 +
onep5_b9*t2)
 
                 density_theta(i,j,k)    = denr(i,j,k)*(dnum_dtheta    -
rho(i,j,k)*dden_dtheta)
                 density_salinity(i,j,k) = denr(i,j,k)*(dnum_dsalinity -
rho(i,j,k)*dden_dsalinity)
 
              enddo
           enddo
        enddo
 

> > Hello again Stephen,
> >
> >      Thanks for the reply.  A couple more things.
> >
> >      The extra computer time taken for the full EOS versus the
> > linear one is amazingly little (2.2%).  Excuse my ignorance on
> > these things, but is your GFDL SGI-Origin of the massively
> > coupled PC variety of computer that has the characteristic
> > that divisions are about 15 times slower than a multiplication?
> >
> >      Assuming the factor of 15 for a division and a factor
> > of 30 for a square root, leaving those factors of 2*, 3*
> > and 1.5* in there is costing you 11 multiplications out
> > of a total (according to me) of 101+11 = 112.  I would
> > have thought that it was worth saving that 11/112 = 10%
> > of time in the EOS part of neutral physics.
> >
> >      The more major issue in my mind is why the NCAR POP
> > group tell me that the EOS takes 15% of their run time.
> > I will have to contact them again.
> >
> >      All the best,
> >
> >      Trevor
begin:vcard 
n:Griffies;Stephen
x-mozilla-html:FALSE
org:DOC/NOAA/OAR/GFDL
adr:;;;;;;
version:2.1
email;internet:[EMAIL PROTECTED]
title:Physical Scientist
x-mozilla-cpt:;-11168
fn:Stephen Griffies
end:vcard

Reply via email to