From 8e9bac064ec6c269ecba8f355febb3aa19bedeab Mon Sep 17 00:00:00 2001 From: holger <holger-grosshans@gmx.de> Date: Thu, 21 May 2020 09:40:04 +0200 Subject: [PATCH] modified: src/bc.f90 modified: src/fluid.f90 modified: src/momentum.f90 modified: src/particlesTransport.f90 modified: src/pre.f90 --- src/bc.f90 | 46 +++++++++++++++++++++++++------------- src/fluid.f90 | 1 + src/momentum.f90 | 3 +-- src/particlesTransport.f90 | 6 ++--- src/pre.f90 | 5 ++--- 5 files changed, 37 insertions(+), 24 deletions(-) diff --git a/src/bc.f90 b/src/bc.f90 index a27ae75..d323585 100644 --- a/src/bc.f90 +++ b/src/bc.f90 @@ -40,22 +40,7 @@ elseif (bcx.eq.'p') then ! done through the sync routines elseif (bcx.eq.'i') then - if (myid.eq.0) then - call random_number(random) - alpha=.5_pr - mm=0 - do j=jmin,jmax; do l=lmin,lmax - mm=mm+1 - if (bcy.eq.'w'.and.bcz.eq.'w') dist=delta-max(abs(yc(j)),abs(zc(l))) - if (bcy.eq.'w'.and.bcz.eq.'p') dist=delta-abs(yc(j)) - if (bcy.eq.'p'.and.bcz.eq.'w') dist=delta-abs(zc(l)) - do m=1,gc - u(imin-m,j,l)=ubulk0*dist/delta + (random(mm)-.5_pr)*alpha*ubulk - v(imin-m,:,:)=0._pr - w(imin-m,:,:)=0._pr - enddo - enddo; enddo - endif + ! see inflow routine if (myid.eq.nrprocs-1) then do 8 m=1,gc u(imax+m-1,:,:)=u(imax-1,:,:) @@ -114,6 +99,35 @@ return end +!#################################################################### +!> @author Holger Grosshans +!> @brief inflow boundary condition + subroutine inflow + use var + real(kind=pr),dimension(dimj*diml) :: random + real(kind=pr) :: & + alpha,dist + integer :: i,j,l,m,mm + + + call random_number(random) + alpha=.1_pr + mm=0 + do j=jmin,jmax; do l=lmin,lmax + mm=mm+1 + if (bcy.eq.'w'.and.bcz.eq.'w') dist=delta-max(abs(yc(j)),abs(zc(l))) + if (bcy.eq.'w'.and.bcz.eq.'p') dist=delta-abs(yc(j)) + if (bcy.eq.'p'.and.bcz.eq.'w') dist=delta-abs(zc(l)) + do m=1,gc + u(imin-m,j,l)=ubulk0*dist/delta + (random(mm)-.5_pr)*alpha*ubulk0 +! v(imin-m,j,l)=0._pr +! w(imin-m,j,l)=0._pr + enddo + enddo; enddo + + return + end + !#################################################################### !> @author Holger Grosshans diff --git a/src/fluid.f90 b/src/fluid.f90 index 669ea26..b96194d 100644 --- a/src/fluid.f90 +++ b/src/fluid.f90 @@ -9,6 +9,7 @@ call ddt call deferredCorrection + if ((bcx.eq.'i').and.(myid.eq.0)) call inflow do 1 it=1,itmax call momentum(err1) diff --git a/src/momentum.f90 b/src/momentum.f90 index 71d549d..b1e95c1 100644 --- a/src/momentum.f90 +++ b/src/momentum.f90 @@ -13,7 +13,7 @@ integer :: i,j,l err=0._pr - u1=0._pr; v1=0._pr; w1=0._pr + u1=u; v1=v; w1=w dum=0._pr; dvm=0._pr; dwm=0._pr @@ -46,7 +46,6 @@ dwa=abs(dw) if (dwm.lt.dwa) dwm=dwa endif - err=err+dua*dua+dva*dva+dwa*dwa diff --git a/src/particlesTransport.f90 b/src/particlesTransport.f90 index 9f459f9..6d27428 100644 --- a/src/particlesTransport.f90 +++ b/src/particlesTransport.f90 @@ -130,7 +130,7 @@ ((myid.eq.nrprocs-1).and.(xp(n).gt.xmax-radp(n)))) then up(n)=-up(n)*restRatio xp(n)=xpold+up(n)*dt - if (qpmax.gt.qp0) call chargeParticleWall(n,1) + if (qpmax.ne.qp0) call chargeParticleWall(n,1) endif elseif (bcx.eq.'i') then if (myid.eq.nrprocs-1) then @@ -150,7 +150,7 @@ vp(n)=-vp(n)*restRatio yp(n)=ypold+vp(n)*dt wcollnum(n)=wcollnum(n)+1 - if (qpmax.gt.qp0) call chargeParticleWall(n,2) + if (qpmax.ne.qp0) call chargeParticleWall(n,2) endif endif @@ -162,7 +162,7 @@ wp(n)=-wp(n)*restRatio zp(n)=zpold+wp(n)*dt wcollnum(n)=wcollnum(n)+1 - if (qpmax.gt.qp0) call chargeParticleWall(n,3) + if (qpmax.ne.qp0) call chargeParticleWall(n,3) endif endif diff --git a/src/pre.f90 b/src/pre.f90 index fd12f70..d95bb5e 100644 --- a/src/pre.f90 +++ b/src/pre.f90 @@ -133,7 +133,7 @@ write(20,'(a,es11.2e2)') & 'CFL number (-) = ', cfl write(20,'(a,2(es11.2e2))') & - 'initial bulk flow (m/s), pressure gradient (N/m**3) = ', ubulk,dpdx + 'in/initial flow (m/s), pressure gradient (N/m**3) = ', ubulk,dpdx write(20,'(a,2(es11.2e2))') & 'fluid density (kg/m**3), kinematic visc. (m**2/s) = ', & rhof,nuf @@ -455,8 +455,7 @@ if (bcy.eq.'w'.and.bcz.eq.'w') dist=delta-max(abs(yc(j)),abs(zc(l))) if (bcy.eq.'w'.and.bcz.eq.'p') dist=delta-abs(yc(j)) if (bcy.eq.'p'.and.bcz.eq.'w') dist=delta-abs(zc(l)) - u(i,j,l)=1._pr*ubulk*dist/delta + (random(m)-.5_pr)*alpha*ubulk -! u(i,j,l)=3._pr*ubulk*dist/delta + u(i,j,l)=ubulk*dist/delta + (random(m)-.5_pr)*alpha*ubulk enddo; enddo; enddo v=0._pr -- GitLab