Skip to content

Commit

Permalink
clean up psi-omega example, pff
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.mcs.anl.gov/repos/nek5/examples@1019 24248562-e74d-0410-ab4b-d4d80c744c73
  • Loading branch information
fischer1 committed Apr 5, 2014
1 parent 64e809e commit 1764f1c
Showing 1 changed file with 73 additions and 11 deletions.
84 changes: 73 additions & 11 deletions eddy_psi_omega/psi_omega.usr
Original file line number Diff line number Diff line change
@@ -1,3 +1,70 @@
c-----------------------------------------------------------------------
c
c This case demonstrates how to use the Nek5000 convection-diffusion
c solver as a 2D Navier-Stokes solver using the streamfunction-vorticity
c (psi-omega) formulation.
c
c Basically, vorticity is advected and the streamfunction is derived by
c solving a Poisson equation. (The Poisson equation is not solved
c efficiently here, this is just a demonstration of some of the capabilities
c that users can develop with the userchk routine.)
c
c Details (below) of the particular example are from the "eddy" example.
c
c
c This case monitors the error for an exact 2D solution
c to the Navier-Stokes equations based on the paper of Walsh [1],
c with an additional translational velocity (u0,v0).
c
c The computational domain is [0,2pi]^2 with doubly-periodic
c boundary conditions.
c
c Walsh's solution consists of an array of vortices determined
c as a linear combinations of eigenfunctions of having form:
c
c cos(pi m x)cos(pi n y), cos(pi m x)sin(pi n y)
c sin(pi m x)cos(pi n y), sin(pi m x)sin(pi n y)
c
c and
c
c cos(pi k x)cos(pi l y), cos(pi k x)sin(pi l y)
c sin(pi k x)cos(pi l y), sin(pi k x)sin(pi l y)
c
c While there are constraints on admissible (m,n),(k,l)
c pairings, Walsh shows that there is a large class of
c possible pairings that give rise to very complex vortex
c patterns.
c
c Walsh's solution applies either to unsteady Stokes or
c unsteady Navier-Stokes. The solution is a non-translating
c decaying array of vortices that decays at the rate
c
c exp ( -4 pi^2 (m^2+n^2) visc time ),
c
c with (m^2+n^2) = (k^2+l^2). A nearly stationary state may
c be obtained by taking the viscosity to be extremely small,
c so the effective decay is negligible. This limit, however,
c leads to an unstable state, thus diminsishing the value of
c Walsh's solution as a high-Reynolds number test case.
c
c It is possible to extend Walsh's solution to a stable convectively-
c dominated case by simulating an array of vortices that translate
c at arbitrary speed by adding a constant to the initial velocity field.
c This approach provides a good test for convection-diffusion dynamics.
c In the current file set the translational velocity is specified as:
c
c U0 =[u0,v0] := [param(96),param(97)] ( in the .rea file )
c
c
c The approach can also be extended to incompressible MHD with non-unit
c magnetic Prandtl number Pm.
c
c [1] Owen Walsh, "Eddy Solutions of the Navier-Stokes Equations,"
c in The Navier-Stokes Equations II - Theory and Numerical Methods,
c Proceedings, Oberwolfach 1991, J.G. Heywood, K. Masuda,
c R. Rautmann, S.A. Solonnikov, Eds., Springer-Verlag, pp. 306--309
c (1992).
c
c-----------------------------------------------------------------------
subroutine uservp (ix,iy,iz,eg)
include 'SIZE'
Expand Down Expand Up @@ -40,10 +107,10 @@ c
common /exacu/ ue(lx1,ly1,lz1,lelt),ve(lx1,ly1,lz1,lelt)
common /exacd/ ud(lx1,ly1,lz1,lelt),vd(lx1,ly1,lz1,lelt)

common /xtream/ psi(lx1*ly1*lz1*lelt),
$ rhs(lx1*ly1*lz1*lelt),
$ h1 (lx1*ly1*lz1*lelt),
$ h2 (lx1*ly1*lz1*lelt),
common /xtream/ psi(lx1*ly1*lz1*lelt)
$ , rhs(lx1*ly1*lz1*lelt)
$ , h1 (lx1*ly1*lz1*lelt)
$ , h2 (lx1*ly1*lz1*lelt)

ifield = 2 ! for outpost

Expand All @@ -58,14 +125,9 @@ c Compute streamfunction from vorticity
call rone (h1 ,n)
call rzero(h2 ,n)

eps = 1.e-4
call add2s2(rhs,binvm1,eps,n)

ifield = 2
tol = param(22)
imsh = 2
write(6,12) istep,rhs(1),h1(1),h2(1),tmask(1,1,1,1,1),'RHS'
12 format(i5,1p4e14.6,1x,a3)
call hmholtz('psi ',psi,rhs,h1,h2,tmask,tmult,imsh,tol,200,1)

call dudxyz(vx,psi,rym1,sym1,tym1,jacm1,1,2) ! Inefficient, but
Expand Down Expand Up @@ -185,8 +247,8 @@ c-----------------------------------------------------------------------
enddo
enddo

c param(66) = 0
c param(67) = 0
param(66) = 0
param(67) = 0

return
end
Expand Down

0 comments on commit 1764f1c

Please sign in to comment.