Commit c6d57cd9 authored by Elia Merzari's avatar Elia Merzari
Browse files

Merge branch 'compute-area-nek-expansion' into 'develop'

Compute area nek expansion

See merge request !18
parents de94a1c4 17eb21cf
...@@ -20,11 +20,13 @@ c----------------------------------------------------------------------- ...@@ -20,11 +20,13 @@ c-----------------------------------------------------------------------
return return
end end
c----------------------------------------------------------------------- c-----------------------------------------------------------------------
! Sets the force term in the momentum equation. Use this to set body
! forces such as gravity. Note that ffx, ffy, and ffz will later be
! multiplied by the density.
subroutine userf (ix,iy,iz,eg) subroutine userf (ix,iy,iz,eg)
include 'SIZE' include 'SIZE'
include 'TOTAL' include 'TOTAL'
include 'NEKUSE' include 'NEKUSE'
integer e,f,eg
ffx=0.0 ffx=0.0
ffy=0.0 ffy=0.0
ffz=0.0 ffz=0.0
...@@ -311,32 +313,35 @@ C======================================================================= ...@@ -311,32 +313,35 @@ C=======================================================================
integer e,f integer e,f
real*8 fmode(lx1,ly1,lz1,lelt), cache(lx1,ly1,lz1,lelt) real*8 fmode(lx1,ly1,lz1,lelt), cache(lx1,ly1,lz1,lelt)
real*8 sint, sint1 real*8 sint, sint1, sarea, sarea1
real*8 pi
pi=4.0*atan(1.0)
ntot=nx1*ny1*nz1*nelt ntot=nx1*ny1*nz1*nelt
zmin=glmin(zm1,ntot)
zmax=glmax(zm1,ntot)
call rzero(fmode,ntot) call rzero(fmode,ntot)
do i0=1,n_legendre do i0=1,n_legendre
do j0=1,m_fourier do j0=1,m_fourier
call nek_mode(fmode,i0,j0) call nek_mode(fmode,i0,j0)
sint1=0.0 sarea1=0.0
sint1= 0.0
do e=1,nelt do e=1,nelt
do f=1,6 do f=1,6
sint=0.0 sint=0.0
sarea=0.0
if (cbc(f,e,1).eq.'W ') then if (cbc(f,e,1).eq.'W ') then
call col3(cache,fmode,t,ntot) call col3(cache,fmode,t,ntot)
call surface_int(sint,sarea,cache,e,f) call surface_int(sint,sarea,cache,e,f)
sint1=sint1+sint sint1=sint1+sint
sarea1=sarea1+sarea
endif endif
enddo enddo
enddo enddo
call gop(sint1,wtmp,'+ ',1) call gop(sint1,wtmp,'+ ',1)
call gop(sarea1,wtmp,'+ ',1)
!
coeff_tij(i0,j0)=sint1*4.0*pi/sarea1
! !
coeff_tij(i0,j0)=sint1*2.0/(0.5*(zmax-zmin))
! Note that R=0.5 here!!!!
enddo enddo
enddo enddo
...@@ -535,40 +540,46 @@ c----------------------- ...@@ -535,40 +540,46 @@ c-----------------------
return return
end end
c----------------------------------------------------------------------- c-----------------------------------------------------------------------
! calculates Legendre polynomials using a recurrence relationship. If
! n > the maximum Legendre order, the function returns 0.0.
function pl_leg(x,n) function pl_leg(x,n)
!====================================== parameter (nl_max=100)
! calculates Legendre polynomials Pn(x)
! using the recurrence relation
! if n > 100 the function retuns 0.0
!======================================
real*8 pl,pl_leg real*8 pl,pl_leg
real*8 x real*8 x
real*8 pln(0:n) real*8 pln(0:n)
integer n, k integer n, k
pln(0) = 1.0 pln(0) = 1.0
pln(1) = x pln(1) = x
if (n.le.1) then if (n.le.1) then
pl = pln(n) pl = pln(n)
else else if (n.le.nl_max) then
do k=1,n-1 do k=1,n-1
pln(k+1)= pln(k+1) = ((2.0*k+1.0)*x*pln(k)-dble(k)*pln(k-1))/(dble(k+1))
& ((2.0*k+1.0)*x*pln(k)-dble(k)*pln(k-1))/(dble(k+1))
end do end do
pl = pln(n) pl = pln(n)
else
pl = 0.0
end if end if
pl_leg=pl*sqrt(dble(2*n+1)/2.0)
pl_leg = pl*sqrt(dble(2*n+1)/2.0)
return return
end end
!====================================== c-----------------------------------------------------------------------
! calculates Fourier polynomials Fn(x)
function fl_four(x,n) function fl_four(x,n)
real*8 fl_four,pi real*8 fl_four,pi
real*8 x, A real*8 x, A
integer n, k integer n, k
pi=4.0*atan(1.0) pi=4.0*atan(1.0)
A=1.0/sqrt(2*pi) A=1.0/sqrt(pi)
if (n.gt.0) A=1.0/sqrt(pi)
if (n.eq.0) A=1.0/sqrt(2*pi)
fl_four=A*cos(n*x) fl_four=A*cos(n*x)
c fl_four=1.0/sqrt(pi)
return return
end end
c----------------------------------------------------------------------- c-----------------------------------------------------------------------
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment