46 Commits

Author SHA1 Message Date
Grzegorz Kowal
f399274574 Finish implementing proper handling of boundary conditions for MPI.
BOUNDARY CONDITIONS

 - using a list of info blocks the implementation of boundary conditions
   for neighbor blocks laying on different processors is successfully
   completed; it is simpler and more clear than the previous
   implementation
2009-09-18 20:34:23 -03:00
Grzegorz Kowal
f8f6ea29a1 Continue work on the boundaries.
BOUNDARY CONDITIONS

 - blocks belonging to the same process can exchange boundaries now;
   blocks with neighbors from other processes still need to be updated

BLOCK STRUCTURE

 - a new structure block_info has been added which will be used for
   defining lists of blocks which have neighbors belonging to other
   processes; these lists will be later used to exchange block data
2009-09-18 17:43:48 -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
202ace1438 Add a few helper subroutines to set different block fields.
MESH STRUCTURE

 - add subroutines metablock_setleaf(), metablock_unsetleaf() to set and
   unset the leaf flag of a meta block
 - add subroutine metablock_setconfig() to set the config of a block
 - add subroutine metablock_setlevel() to set the refinement level of a
   block
2009-09-10 18:15:30 -03:00
Grzegorz Kowal
df071923c9 Add subroutine to associate meta and data blocks and to set bounds.
MESH STRUCTURE

 - add subroutine associate_blocks() to associate a pair of meta and
   data blocks
 - add subroutine datablock_setbounds() to set the geometry bounds for a
   given block
2009-09-10 17:46:36 -03:00
Grzegorz Kowal
10cef69f0c Add subroutines to allocate meta and data blocks.
MESH STRUCTURE

 - add subroutines allocate_metablock() and allocate_datablock()
   allocating new meta and data blocks in memory
 - add subroutines append_metablock() and append_datablock() appending
   the allocated block to the meta and data block lists
 - create root meta and data blocks in domain_default()
 - create two new pointers last_meta nad last_data pointing to the last
   blocks in the meta and data block lists
2009-09-10 17:25:28 -03:00
Grzegorz Kowal
a7a71c3c53 Add initialization and termination of the meta and data blocks.
MESH STRUCTURE

 - initialize meta and data block lists in init_blocks()
 - deallocate and nullify meta and data block lists in clear_blocks()
 - new subtourine deallocate_metablock() for meta block deallocation
 - new subroutine deallocate_datablock() for data block deallocation
2009-09-10 16:18:59 -03:00
Grzegorz Kowal
95f4a2a3ad Create new structures for block meta and data info.
MESH STRUCTURE

 - two types of structures are created:
     block_meta - structure storing metadata of each block
     block_data - structure storing geometry and variable information

 - two lists corresponding to stored objects of block_meta and
   block_data:
     list_meta - the list of objects of block_meta type is shared and
                 synchronized between processors
     list_data - the list of objects of block_data type is private for
                 each processors

 - corresponding pointers to both structures are created too
2009-09-09 16:49:28 -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
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
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
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
e0213bcca5 Change type of the field 'child' to blockref. 2008-12-19 17:24:36 -06:00
Grzegorz Kowal
e5878fc459 Remove references to the field 'pneigh'.
Since we now only use the field 'neigh' we don't need pointers stored in
'pneigh' anymore.
2008-12-19 16:46:17 -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
6fac1d38b2 Reorganization of the block subroutines.
Preparation of the block module for MPI support.
2008-12-18 23:47:58 -06:00
Grzegorz Kowal
a9c9cef27e Cosmetic changes to the block pointer type definition. 2008-12-18 22:51:08 -06:00
Grzegorz Kowal
9b4abbd520 Added control of refinement/derefinement criterions.
Now we can control the levels of refinement/derefinement criterion from
the config file. The bounds of the domains are stored in the HDF5 files
from now.
2008-12-16 22:34:54 -06:00
Grzegorz Kowal
136fcb1daa Implemented open and reflective boundary conditions. 2008-12-16 19:56:07 -06:00
Grzegorz Kowal
e56aee34c0 Play more with the refinements criterion. 2008-12-16 13:40:34 -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
be78017530 Initial mesh generation is periodic now.
Also, some fixes in the boundary code.
2008-12-09 21:42:01 -06:00
Grzegorz Kowal
e0f211743b Runge-Kutta 2nd order time integration implemented.
In addition, I've done some fixes to the problem initialization, and I
defined new variables igrids, jgrids, kgrids, which specify the
dimensions of the block.
2008-12-08 16:21:59 -06:00
Grzegorz Kowal
3f7aa0fbca Reorganize variable indices. 2008-12-08 15:36:58 -06:00
Grzegorz Kowal
1331044dee More reorganization of the compilation flags.
Now the source file can use some of the values defined in make files,
like NDIMS. The make files, i.e. makefile, make.default, and host files
are simpler and should be easier to manage.
2008-12-08 15:31:35 -06:00
Grzegorz Kowal
e16db21a1a Reorganization of compilation flags. 2008-12-08 13:59:57 -06:00
Grzegorz Kowal
b8d3c791a1 Store all variables in one array U.
One array U, which is a field in the BLOCK structure, stores all
variables. The number of variables is determined by the nvars parameter.
To access each variable we use variable index now, like idn, imx, imy,
mz, ien, etc.
2008-12-08 12:14:13 -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
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
6abf81e77e Add neighbors pointers.
Neighbors pointers allow for quick access to the neighbors. It means
that we don't need to waste CPU time for searching neighbors by IDs.
2008-12-05 15:13:16 -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
12bbf872c8 Reset the refinement flag while allocating a block. 2008-12-05 14:24:01 -06:00
Grzegorz Kowal
8c9877094f Set refinement level of refined blocks. 2008-12-05 14:22:02 -06:00
Grzegorz Kowal
603092368f Remove commented out junk. 2008-12-05 14:19:23 -06:00
Grzegorz Kowal
1cd5504a5a Use pointer array to specify children.
Usage of IDs to find children requires additional work, i.e. looking
through all blocks and comparing their IDs. Instead of IDs we use an
array of pointer for instantenous selection of children.
2008-12-05 14:13:21 -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
Grzegorz Kowal
5c2d0c00c9 New subroutines to allocate/deallocate a block.
The new subroutines take care of allocating and deallocating the space
for one block. Allocation uses dimensions provided by configuration
file. The block dimensions and number of ghost cells have been added to
config.F90 as well.
2008-11-07 00:10:09 -06:00
Grzegorz Kowal
750fe27334 Added initial versions of config and error modules.
Config module takes care of the configuration file 'config.in'. It
reads the file line by line, parsing each line and extracting the name
and value of parameter. Then it substitutes the parameter with a new
value.

Error module handles error, warning and informative messages. So far it
only prints information on the screen.

There is some improvments for comments formating as well.
2008-11-05 22:16:24 -06:00
Grzegorz Kowal
46c6605a3e Add initialization of fields for the first created block.
Initialization of fields like id, level, parent, children, neighbors for
the first created block has been added.
2008-11-05 21:07:03 -06:00
Grzegorz Kowal
847009aafb Initial implementation of block structure.
Block structure has been implemented. Blocks contain pointers to the next
and previous blocks. This easily allows to create block lists. Two
functions are implemented, one for creating initial structure of blocks
with lists, and the second for destroying all blocks from the list.

File 'blocks.F90' has been added to makefile too.
2008-11-04 21:00:50 -06:00