c c Signed distance for multiple spheres. c This simple function is only correct for non-overlapping c domains. c Use mutiple level set functions to model complex bodies! c c Copyright (C) 2003-2007 California Institute of Technology c Ralf Deiterding, ralf@amroc.net c c ===================================================== subroutine ls(maxmx,maxmy,maxmz,mbc,mx,my,mz,x,y,z, & dx,dy,dz,phi,t) c ===================================================== implicit double precision (a-h,o-z) c include "cuser.i" c dimension phi(1-mbc:maxmx+mbc, 1-mbc:maxmy+mbc, & 1-mbc:maxmz+mbc) dimension x(1-mbc:maxmx+mbc),y(1-mbc:maxmy+mbc), & z(1-mbc:maxmz+mbc) c do 60 i = 1-mbc, mx+mbc do 60 j = 1-mbc, my+mbc do 60 k = 1-mbc, mz+mbc phi(i,j,k) = dsqrt((x(i)-xm(1,1))**2 & +(y(j)-xm(2,1))**2+(z(k)-xm(3,1))**2) & - rd(1) do ns = 2, NSph phitest = dsqrt((x(i)-xm(1,ns))**2 & +(y(j)-xm(2,ns))**2+(z(k)-xm(3,ns))**2) & - rd(ns) if (dabs(phi(i,j,k)).ge.dabs(phitest)) & phi(i,j,k) = phitest enddo 60 continue c return end c