c c Boundary conditions for ghost-fluid methods. c c Copyright (C) 2009 Oak Ridge National Laboratory c Ralf Deiterding, ralf@cacr.caltech.edu c c ----------------------------------------------------- c c Construction of reflective boundary conditions from c mirrored values and application in local patch c c ===================================================== subroutine ip3acrfl(q,mx,my,mz,lb,ub,meqn,nc,idx, & qex,xc,phi,vn,maux,auex,dx,time) c ===================================================== c implicit none c integer mx, my, mz, meqn, maux, nc, idx(3,nc), lb(3), & ub(3) double precision q(meqn,mx,my,mz), qex(meqn,nc), xc(3,nc), & phi(nc), vn(3,nc), auex(maux,nc), dx(3), time c c Local variables c integer i, j, k, n, stride, getindx double precision p, u, v, w, vl c stride = (ub(1) - lb(1))/(mx-1) c do 100 n = 1, nc i = getindx(idx(1,n), lb(1), stride) j = getindx(idx(2,n), lb(2), stride) k = getindx(idx(3,n), lb(3), stride) c p = qex(1,n) u = -qex(2,n) v = -qex(3,n) w = -qex(4,n) c c # Add boundary velocities if available if (maux.ge.3) then u = u + auex(1,n) v = v + auex(2,n) w = w + auex(3,n) endif c c # Construct normal velocity vector c # Tangential velocity remains unchanged vl = 2.d0*(u*vn(1,n)+v*vn(2,n)+w*vn(3,n)) u = qex(2,n) + vl*vn(1,n) v = qex(3,n) + vl*vn(2,n) w = qex(4,n) + vl*vn(3,n) c q(1,i,j,k) = p q(2,i,j,k) = u q(3,i,j,k) = v q(4,i,j,k) = w c 100 continue c return end c c ----------------------------------------------------- c c Injection of extrapolated values in local patch c c ===================================================== subroutine ip3acex(q,mx,my,mz,lb,ub,meqn,nc,idx, & qex,xc,phi,vn,maux,auex,dx,time) c ===================================================== c implicit none c integer mx, my, mz, meqn, maux, nc, idx(3,nc), lb(3), & ub(3) double precision q(meqn,mx,my,mz), qex(meqn,nc), xc(3,nc), & phi(nc), vn(3,nc), auex(maux,nc), dx(3), time c c Local variables c integer i, j, k, n, stride, getindx double precision p, u, v, w, vl c stride = (ub(1) - lb(1))/(mx-1) c do 100 n = 1, nc i = getindx(idx(1,n), lb(1), stride) j = getindx(idx(2,n), lb(2), stride) k = getindx(idx(3,n), lb(3), stride) c p = qex(1,n) u = qex(2,n) v = qex(3,n) w = qex(4,n) c c # Prescribe normal velocity vector vl = u*vn(1,n)+v*vn(2,n)+w*vn(3,n) u = vl*vn(1,n) v = vl*vn(2,n) w = vl*vn(3,n) c q(1,i,j,k) = p q(2,i,j,k) = u q(3,i,j,k) = v q(4,i,j,k) = w c 100 continue c return end c