Giter Club home page Giter Club logo

multigrid_2d_poisson's Introduction

5.06.Multigrid2D

V-cycle Multigrid method for 2D Poisson Equation,代码写得很清楚,是非常好的学习材料

residual residual_log field

1)如何编译运行 rm -f a.out

gfortran -O3 poisson2d_MG.f90

./a.out

!----------------------! !Solver: !----------------------! isolver = 1 if (isolver.eq.0) then !Gauss-Seidel scheme call GS(nx,ny,dx,dy,f,u,tol) else call MG5(nx,ny,dx,dy,f,u,tol) end if

这个地方修改isolver = 0 可以转化成Gauss-Seidel迭代

3)

ireo = 2

if (ireo.eq.1) then !simply injection

do i=1,nxh-1
do j=1,nyh-1
	f(i,j) = r(2*i,2*j) 							  	
end do
end do

else if (ireo.eq.2) then !half-weight

do i=1,nxh-1
do j=1,nyh-1
	f(i,j) = 1.0d0/8.0d0*( 4.0d0*r(2*i,2*j) &
		 + 1.0d0*(r(2*i+1,2*j)+r(2*i-1,2*j)+r(2*i,2*j+1)+r(2*i,2*j-1)) )							  	
end do
end do

else !full-weight (trapezoidal)

do i=1,nxh-1 do j=1,nyh-1 f(i,j) = 1.0d0/16.0d0*( 4.0d0r(2i,2j) & + 2.0d0(r(2i+1,2j)+r(2i-1,2j)+r(2i,2j+1)+r(2i,2j-1)) & + 1.0d0*(r(2i+1,2j+1)+r(2i-1,2j-1)+r(2i-1,2j+1)+r(2i+1,2j-1))) end do end do

修改ireo可以换不现的f2c的插值方式,但是效果都差不多。

multigrid_2d_poisson's People

Contributors

omersan avatar gongchunye avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.