49 Commits

Author SHA1 Message Date
Grzegorz Kowal
35fb0cac4f There is no need for importing the block_data structure. 2009-09-29 15:37:31 -03:00
Grzegorz Kowal
671985874f Improve block prolongation and add support for 3D.
MESH STRUCTURE, REFINEMENT

 - subroutine prolong_block() has been completely rewritten; now it
   supports 2D and 3D boxes, and the calculation of bounds for the
   expanded array is automated now
2009-09-29 15:32:58 -03:00
Grzegorz Kowal
1fdf2b72ae Improve block restriction and add support for 3D.
MESH STRUCTURE, DEREFINEMENT

 - subroutine restrict_block() has been completely rewritten; now it
   supports 2D and 3D boxes, and the calculation of bounds for
   source and destination arrays is automated
2009-09-29 15:12:19 -03:00
Grzegorz Kowal
4953cfbe22 Fix dimensions of the neigh field. Use better vars naming.
FIXES

 - the field neigh of meta blocks structure must use ndims, nsides, and
   nfaces variables

BLOCK STRUCTURE

 - use pmeta and pdata names for ponters to meta and data blocks,
   respectively; this helps reading the code

HOSTS

 - turn on DEBUG
2009-09-26 14:27:47 -03:00
Grzegorz Kowal
5074834673 Implement MPI auto balancing.
MESH STRUCTURE, MPI

 - implement auto balancing, which resends the blocks to the neighboring
   processors in order to keep the same number of data blocks on each
   processor
2009-09-26 01:51:44 -03:00
Grzegorz Kowal
03568cd974 Fix the initial balancing of the blocks.
MESH STRUCTURE, MPI

 - correct the initial division of the geometry, so each process is
   attached to the same number of blocks; blocks at the top level are
   allowed to be attached to different processors even if they are
   children of the same block
2009-09-26 00:39:41 -03:00
Grzegorz Kowal
ee413ffee6 After moving derefined blocks, set their cpu flags. 2009-09-26 00:14:23 -03:00
Grzegorz Kowal
8173d8e603 Move derefined blocks to the same processor.
MESH STRUCTURE, MPI

 - if the child blocks are selected to be derefined and lay on different
   processors, move them all to the processor of the parent block
2009-09-26 00:10:32 -03:00
Grzegorz Kowal
2a25d369c1 Improve the initial block division between processes.
BLOCK STRUCTURE, MPI

 - in the best division calculation use the number of data blocs only,
   but if the blocks are at the top level and have the same parent
   pack then together in the same process
2009-09-25 20:35:38 -03:00
Grzegorz Kowal
8104ee5775 Keep data blocks of leafs only.
MESH STRUCTURES

 - since blocks which are not leafs are not used to calculate the fields
   evolution, we don't need to keep their data blocks allocated; these
   changes allocated the parent data block only for blocks which are
   derefined, and deallocates data block of a block selected for
   refinement; in the case of many blocks and many refinement levels
   these modifications safe a substantial amount of memory
2009-09-25 19:24:02 -03:00
Grzegorz Kowal
06188d42fa Clean up and comments in init_mesh() and refine_mesh(). 2009-09-22 19:32:57 -03:00
Grzegorz Kowal
24da24004f Improve "blast" problem, add initial domain generation.
PROBLEMS

 - implement the blast problem in a similar way to the one implemented
   in GODUNOV code

 - generate initial domain of 2x3 blocks at the lowest level; it should
   be generalized to any dimension of blocks

MESH STRUCTURE

 - add new variable rdims(1:3) specifying dimensions of the initial
   blocks structure at lowest level

 - improve calculation of the effective resolution, and spatial
   increments
2009-09-22 17:30:53 -03:00
Grzegorz Kowal
6198a0f5c5 Remove old block structures and related code. 2009-09-21 19:02:05 -03:00
Grzegorz Kowal
0924f90bd7 Implement mesh update uniprocessors and MPI-friendly.
MESH STRUCTURE

 - subroutine mesh_update() performs refinement/derefinement of blocks
   using new structures of meta and data blocks; it is implemented for
   to be MPI friendly as well

 - update subroutine derefine_block() to use new structures of meta and
   data blocks

 - update subroutines restrict_block() and prolong_block() to use new
   meta and data structures
2009-09-21 16:57:34 -03:00
Grzegorz Kowal
ac188d32e4 Divide blocks among processors. Initial work on boundaries.
BLOCK STRUCTURE: MPI

 - divide initial block structure between all processors and remove
   non-local data blocks

DATA I/O

 - dump the total number of blocks and the number of data blocks

BOUNDARY CONDITIONS

 - initial work on the boundary condition for new structure of blocks
2009-09-14 19:15:21 -03:00
Grzegorz Kowal
7aff1ecd90 Remove junk comments from subroutine init_mesh(). 2009-09-14 18:19:27 -03:00
Grzegorz Kowal
71d334aedb Make the subroutine refine_block() works correctly.
MESH STRUCTURE

 - with new meta and data block structures the refinement of a block
   works correctly now
 - increase and decrease the number of blocks while allocated and
   dealocated, respectively
2009-09-13 22:58:55 -03:00
Grzegorz Kowal
7827e60f30 Rework subroutine refine_block() to use new meta and data blocks. 2009-09-11 21:52:18 -03:00
Grzegorz Kowal
66b3cfc176 Extend bounds for criterion calculation and remove junk.
REFINEMENT

 - move the bounds for the criterion calculation by one cell out of the
   domain, so we catch the refinement before it gradients enter the
   block

MAINTANCE

 - remove junk code from the update_mesh subroutine
2009-09-09 14:21:46 -03:00
Grzegorz Kowal
0f34a18cf6 Calculate number of blocks more precisely. 2009-08-22 13:51:40 -03:00
Grzegorz Kowal
3c74c9a8ea More work on the block refinement.
The initial block mesh refinement seems to be optimized now. However,
more work in the MPI version is required, e.g. refine blocks on all CPUs
until the number of blocks exceeds some number dependent on the number
of CPUs. From that point refine independently on each CPU.

The initial work on the mesh update has been done too, but the processes
do not exchange block information.
2009-05-18 22:46:19 +02:00
Grzegorz Kowal
1b718dea86 Selecting blocks for refinement/derefinement with MPI.
This next approach to select blocks for refinement/derefinement with MPI
seems to be working. Moreover, it is simple and efficient, however,
there might be still some room for improvements.
2009-01-08 00:08:52 -06:00
Grzegorz Kowal
c216adb422 First approach to implement MPI refinement.
It seems to be pretty complex. So far I collect blocks selected for
refinement which have neighbors laying on other processors. Using this I
set the neighbors from other processors for refinement if required. The
remaining things are the neighbors update after refinement and MPI
version of derefinement.
2009-01-03 22:49:04 -06:00
Grzegorz Kowal
c686e301fc Fix boundary update and reduce the next time step over all CPUs.
The boundary conditions finally works when using MPI with arbitrary
number of processors. This is however a dirty hack. Has to be done in a
better way later, since now it may be very tricky to generalize the code
to 3D.

The next time step should be reduced to the minimum value over all
processes. This has been added in subroutine 'evolution' now.

The block structure contains a new field %pos which specifies the
position of the child block in its parent.
2009-01-02 20:18:57 -06:00
Grzegorz Kowal
90182faf2b Merge branch 'mpi' of /home/kowal/Web/godunov-amr into mpi 2008-12-28 17:28:16 -06:00
Grzegorz Kowal
20837eb739 Divide the initial blocks between processes.
The blocks of initial mesh are now divided between all processes. The
procedure updates also the %cpu field of all neighbors according to the
number of process they are running at.

The subroutine 'deallocate_block' takes care about the plist pointer
now. It also allows for the flexible removal of any block, even from the
middle of the list by updating fields %next and %prev of the previous
and next blocks, respectively.

In addition, we now store the %cpu field of each block in the HDF5 files
too.
2008-12-28 13:09:14 -06:00
Grzegorz Kowal
82843c43f4 Add TODO about the way of refinement with MPI. 2008-12-23 11:46:26 -06:00
Grzegorz Kowal
a07f970b5d Add TODO about the way of refinement with MPI. 2008-12-22 16:15:27 -06:00
Grzegorz Kowal
2719b0b451 Merge branch 'master' into mpi
Conflicts:

	src/mesh.F90
2008-12-22 16:08:51 -06:00
Grzegorz Kowal
0626f616cb Add problem specific domain initialization.
The domain initialization is performed in the problem.F90 now. This will
allow a user to initialize his own domain according to the defined
problem. Since the initialization in problem-dependent we don't need the
subroutine allocate_blocks anymore.
2008-12-22 15:34:02 -06:00
Grzegorz Kowal
1f581e9610 Add new module for MPI handling.
A new 'mpitools' module has been added. This module contains subroutines
to initialize, deinitialize and handle MPI communication. This initial
version can now initialize and deinitialize parallelization. It does not
support full parallelization yet.
2008-12-22 14:57:31 -06:00
Grzegorz Kowal
e0213bcca5 Change type of the field 'child' to blockref. 2008-12-19 17:24:36 -06:00
Grzegorz Kowal
f64bbd7e5e Use field neigh to assign and refer to neighbors.
We use the field 'neigh' instead of the field 'pneigh'. The field
'neigh' is of the type of 'blockref' which simplifies the reference to
the neighbors blocks when using MPI. Each reference contains two fields:
cpu and id. In MPI version we cannot use pointers stored in pneigh, but
using blockref structures we can refer to the blocks belonging to other
processors.
2008-12-19 16:36:07 -06:00
Grzegorz Kowal
c977c610ff Introduce new type of block reference by cpu and id.
The new type 'blockref' is a reference to a block by two integer
numbers, the first points to the cpu that block is running, and the
second one is the block identificator.
2008-12-19 00:19:44 -06:00
Grzegorz Kowal
1aa75ac2ef Change the leaf field of the block to be logical.
This change should speed up a bit the conditions, since it is faster
than the character comparisons.
2008-12-19 00:02:05 -06:00
Grzegorz Kowal
a9c9cef27e Cosmetic changes to the block pointer type definition. 2008-12-18 22:51:08 -06:00
Grzegorz Kowal
f673596f20 Refinement based on density. More cleanups. 2008-12-13 22:41:37 -06:00
Grzegorz Kowal
b39673bf85 Fixed generation of dx, dy, and dz.
The generation of dx, dy, dz for each level didn't include the base
grid, i.e. they were 2 times larger. Now it is fixed. Also plenty of
minor corrections in different places.
2008-12-13 21:05:51 -06:00
Grzegorz Kowal
7bc74a39d9 Initial version of refinement/derefinement is working.
It looks like the refining and derefining work more or less, at least
without interrupting the execution. Nevertheless, there are still some
artifacts, like the lack of symmetry after some time or not efficient
derefining of the mesh. This could be cause by the solver, however.

The refinement criterion is computed using pressure now.
2008-12-13 15:08:18 -06:00
Grzegorz Kowal
936420c599 New module to handle the boundary conditions.
The subroutine 'boundary' sweeps over all leaf blocks. For each block it
sweeps over its neighbors and performs update of the boundaries. This is
an initial version yet, it supports only neighboring blocks of the same
level of refinement.
2008-12-09 20:37:31 -06:00
Grzegorz Kowal
6d38fe6476 Added CFL condition and calculation of the new time step.
The function to calculate the maximum speed in the block has been added.
This function is used to determine the maximum speed globally, which is
next used to estimate the next time step.
2008-12-09 14:51:33 -06:00
Grzegorz Kowal
c48f30bd20 Update sweeps over direction calculating dU.
We compute dFdx contribution along each direction and update total dU.
Apart from that I've added generation of coordinate variables, like dx,
dxi, etc. in the mesh module. The next step is to implement the HLL
solver.
2008-12-08 20:03:01 -06:00
Grzegorz Kowal
e75cc33c1f Replaced pointer pfirst with plist. Improved formatting.
I replaced the pointer 'pfirst' pointing to the first element of the
list of blocks with 'plist'. I improved formatting of the informations
printed during the initial mesh generation.
2008-12-07 12:56:00 -06:00
Grzegorz Kowal
4ed091a899 Clean up a couple of lines. 2008-12-06 23:54:19 -06:00
Grzegorz Kowal
937f96aee2 The initial refinement completed.
I've added 'Z' configuration of the refined block, completed 'N', 'C',
'D', and 'U' configurations. Implemented pointers to the neighbors
correctly. Finally, I've implemented correct initial geometry
generation, by selection of the blocks to refine, their neightbors if of
the lower level, and finally performing the actual refinement.
2008-12-06 20:11:36 -06:00
Grzegorz Kowal
ae7b169f7a Problem initialization for refined blocks implemented.
Now, after refining a block, an initialization of children blocks is
performed, as well as the refinement checking.
2008-12-05 14:43:43 -06:00
Grzegorz Kowal
00690ce344 Block refinement implemented.
Subroutine to refine a selected block has been implemented. This
subroutine creates 4 new blocks, and inserts them before the parent
block. It fills all block arguments like parent, neighbors, leaf flags,
bounds, next and previous pointers, etc.
2008-12-05 14:04:12 -06:00
Grzegorz Kowal
301619e296 Added a subroutine to check refinement criterion.
A new subroutine 'check_ref' to check the refinement criterion has been
added. I've added also a structure of the initial refinement of the
mesh.
2008-11-29 22:19:02 -06:00
Grzegorz Kowal
532cdf7b7e Generation of the initial mesh and problem setup.
Implemented the generation of initial blocks in N-configuration with
proper ataching to the list, pointer, neighbors and bounds
initialization, as well as the initial problem setup. Two new files has
been added: mesh.F90 - hadling the adaptive mesh structure, and
problem.F90 - handling the problem initialization.
2008-11-11 16:12:26 -06:00