Code Monkey home page Code Monkey logo

octree-mg's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

octree-mg's Issues

how is the 2:1 balance implemented

Hi

According to the paper on this code, 2:1 balance is imposed. Could you please whice subroutine implemented the 2:1 balance?

Thanks

ghost cell update

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`

add topic tags

I suggest adding the topics pde, quadtree, octtree, multigrid, mpi in the About section

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.