jannisteunissen / octree-mg Goto Github PK
View Code? Open in Web Editor NEWMPI geometric multigrid solver for quadtree/octree grids
MPI geometric multigrid solver for quadtree/octree grids
Hi
According to the paper on this code, 2:1 balance is imposed. Could you please whice subroutine implemented the 2:1 balance?
Thanks
Hi
Sorry to bother you again.
I am interested to build a simulation code for incompressible flow based on this library. In the simulation, all variables live in 'leaves', and the ghost cells are necessary for calculation (such as gradient) for interior cells. Since ghost cells do not have all neighboor cells avaiable, they cannot be calculated according the governing equations, but rely on interpolation from neighboor boxes. To interpolate, I tried calling mg_restrict
followed by mg_fill_ghost_cells
, but the ghost cells are not filled.
I then went back to experiment with the test example "test_refinement.f90". I revised this example so that the set_solution
is only done for the interior cells of leaves, and output the i_sol field in Tecplot format. The ghost cells are also zero from what I can see. The revised `set_solution' is attached in the following.
Could you please help? Thank you very much
==================
` subroutine set_solution(mg)
use mpi
type(mg_t), intent(inout) :: mg
integer :: n, id, lvl, nc
real(dp) :: r(NDIM), sol
integer ic, iwrk, i,j,k, irank, ierr
real(dp) x,y,z
do lvl = mg%lowest_lvl, mg%highest_lvl
nc = mg%box_size_lvl(lvl)
do n = 1, size(mg%lvls(lvl)%my_leaves)
id = mg%lvls(lvl)%my_leaves(n)
do KJI_DO(1, nc)
r = mg%boxes(id)%r_min + ([IJK] - 0.5_dp) * mg%dr(:, lvl)
sol = product(sin(2 * pi * n_modes * r))
mg%boxes(id)%cc(IJK, i_sol) = sol
end do; CLOSE_DO
end do
end do
! Set ghost cells for the solution. Because they depend on coarse-grid
! values, first restrict the solution.
call mg_restrict(mg, i_sol)
call mg_fill_ghost_cells(mg, i_sol)
if(mg%my_rank ==0) then
write(,) 'Writing Tecplot file'
open(1, file = 'out.dat', status = 'REPLACE')
write(1,*) 'Variables = x, y, z, u'
close(1)
end if
do irank = 0, mg%n_cpu-1
if(mg%my_rank == irank) then
open(1, file = 'out.dat', position="append", &
status="old", action="write")
do lvl = mg%lowest_lvl, mg%highest_lvl
nc = mg%box_size_lvl(lvl)
do n = 1, size(mg%lvls(lvl)%my_leaves)
id = mg%lvls(lvl)%my_leaves(n)
write(1,) 'zone i = ', nc+2, ' j = ', nc+2, ' k = ',nc+2
do k = 0, nc+1
do j = 0, nc+1
do i = 0, nc+1
x = mg%boxes(id)%r_min(1) + (real(i,8) - 0.5_dp) * mg%boxes(id)%dr(1)
y = mg%boxes(id)%r_min(2) + (real(j,8) - 0.5_dp) * mg%boxes(id)%dr(2)
z = mg%boxes(id)%r_min(3) + (real(k,8) - 0.5_dp) * mg%boxes(id)%dr(3)
write(1,) x, y, z, mg%boxes(id)%cc(i,j,k,i_sol)
end do
end do
end do
end do
end do
close(1)
end if
call MPI_Barrier( MPI_COMM_WORLD,ierr)
end do
end subroutine set_solution`
I suggest adding the topics pde
, quadtree
, octtree
, multigrid
, mpi
in the About section
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.