Nodes of different colours represent the following:
Solid arrows point from a submodule to the (sub)module which it is
descended from. Dashed arrows point from a module or program unit to
modules which it uses.
Nodes of different colours represent the following:
Solid arrows point from a procedure to one which it calls. Dashed
arrows point from an interface to procedures which implement that interface.
This could include the module procedures in a generic interface or the
implementation in a submodule of an interface in a parent module.
Nodes of different colours represent the following:
Solid arrows point from a procedure to one which it calls. Dashed
arrows point from an interface to procedures which implement that interface.
This could include the module procedures in a generic interface or the
implementation in a submodule of an interface in a parent module.
Source Code
subroutine subtract_mean(mg,iv,include_ghostcells)use mpitype(mg_t),intent(inout)::mginteger,intent(in)::ivlogical,intent(in)::include_ghostcellsinteger::i,id,lvl,nc,ierrreal(dp)::sum_iv,mean_iv,volumenc=mg%box_sizesum_iv=get_sum(mg,iv)call mpi_allreduce(sum_iv,mean_iv,1,mpi_double,mpi_sum,mg%comm,ierr)! Divide by total grid volume to get meanvolume=nc**1*product(mg%dr(:,1))*size(mg%lvls(1)%ids)mean_iv=mean_iv/volumedo lvl=mg%lowest_lvl,mg%highest_lvlnc=mg%box_size_lvl(lvl)do i=1,size(mg%lvls(lvl)%my_ids)id=mg%lvls(lvl)%my_ids(i)if(include_ghostcells)thenmg%boxes(id)%cc(:,iv)=mg%boxes(id)%cc(:,iv)-mean_ivelsemg%boxes(id)%cc(1:nc,iv)=mg%boxes(id)%cc(1:nc,iv)-mean_ivend if end do end do end subroutine subtract_mean