68 Commits

Author SHA1 Message Date
Grzegorz Kowal
c72b862db4 Rename variable nblocks to mblocks.
BLOCK STRUCTURE

 - the global variable nblocks tells how many metablocks are allocated,
   thus its name is changed to mblocks;
 - remove unnecessary checking of the list allocation;
2010-12-01 09:23:03 -02:00
Grzegorz Kowal
aab8831bbf Update the copyright info and fix the length of separating lines. 2010-10-13 03:32:10 -03:00
Grzegorz Kowal
c182e08352 Set the initial coordinates and calculate them during the refinement. 2010-10-11 22:46:07 -03:00
Grzegorz Kowal
8757789042 Add the field 'coord' to meta block structure.
BLOCK STRUCTURE

 - add a new field 'coord' to store block coordinates in the units of
   the effective resolution;
 - add a subroutine metablock_set_coord() to set the block coordinates;
2010-10-11 02:10:47 -03:00
Grzegorz Kowal
a8dd14def4 Heavy reawrite of the I/O module.
IO

 - the subroutine write_data() is now a wrapper subroutine which call
   the subroutine writing in a supported file format; the file format is
   chosen at the time of compilation;
 - the subroutine write_data_h5() is a new subroutine taking care of
   initialization and storage data in the HDF5 format; depending on the
   file type it calls subroutines to create specific groups and store
   the right data;
 - new subroutines write_atrributes_h5(), write_coordinates_h5(),
   write_variables_h(), write_variables_full_h5(),
   write_metablocks_h5(), write_datablocks_h5(), and number of other
   supporting subroutines to store all data in the proper format for job
   restart, vizualization, and debugging;

MAKE

 - add option to enable/disable HDF5 file compression;
2010-10-11 01:39:15 -03:00
Grzegorz Kowal
d54b57e1eb Cosmetic change in subroutine allocate_datablock() in blocks.F90. 2010-09-18 11:44:46 +02:00
Grzegorz Kowal
b6dc6095ac Make GNU compiler happy and fix indexing of emf. 2010-09-18 11:42:09 +02:00
Grzegorz Kowal
ed88bc2526 First step of implementation of time advance using new method.
BLOCK STRUCTURE

 - add new array to the data block structure to store the electromotive
   force components; these components are located at the centers of cell
   edges, in this way the CT update of the staggered magnetic field
   component will be easier;

EVOLUTION

 - add new subroutine advance() which performs several steps in order to
   advance the solution in time by one-step update; the substeps are the
   updates of the numerical flux, the flux boundary, the advance in time
   the solution, the updates of mesh structure, and the boundaries of
   conserved variables, and finally the new time step estimation;

 - add new subroutine update_flux() to update the numerical fluxes
   stored in the data blocks;

SCHEME

 - add new subroutine numerical_flux() to calculate fluxes at the proper
   locations;

 - add new logical argument to HLL and HLLC in order to specify if the
   flux should be returned as a numerical flux or its derivative;
2010-07-27 19:26:15 -03:00
Grzegorz Kowal
a2a7fbf3c4 Add a field for storing fluxes in the blocks.
BLOCK STRUCTURE

 - add a multidimensional array to store the numerical fluxes in the
   block structure; it seems that this is necessary for the boundary
   update, since the fluxes should be synchronized between blocks at
   different levels;
2010-07-26 20:46:45 -03:00
Grzegorz Kowal
88761c9622 Implement FLUXCT integration of the induction equation.
SCHEME

  - implement Flux-CT scheme for the staggered magnetic field
    integration;

BLOCK STRUCTURE

  - use more space efficient storage of the variables, which means
    storing only staggered components of magnetic field; cell-centered
    components are calculated only when necessary;

EVOLUTION

  - remove loops in the field updates; operations are performed on the
    arrays;

BOUNDARY CONDITIONS

  - remove loops in the bnd_copy; operations are calculated on the whole
    array now;

INTERPOLATION

  - subroutine magtocen() has been rewritten to avoid problems with the
    array allocation; now as an argument we enter the array of all
    variables; subroutine uses indices for the face-centered and
    cell-centered magnetic field components internally;

MAKE

  - add flag defining Flux-CT scheme;

PROBLEM

  - use predefined array variables instead of allocated;
2010-02-28 18:35:57 -03:00
Grzegorz Kowal
98849f3369 Prepare code for central differencing scheme for magnetic field. 2010-02-22 12:01:58 -03:00
Grzegorz Kowal
beee9ee2d4 Initial support for the MHD equations.
VARIABLES

 - add indices for the magnetic field components, both face and cell
   centered

SOLVER, MHD

 - add support for the magnetohydrodynamic (MHD) equations to the
   subroutines cons2prim(), prim2cons()

 - add MHD flux and the fastest speed calculation in the subroutine
   fluxspeed()

 - include magnetosonic speed in the calculation of the maximum speed in
   the system required for estimation of the new time step

 - extend the HLL solver in subroutine hll() to support MHD

 - calculate the magnetic field update according to a CT scheme in the
   subroutine update()

INTERPOLATION

 - add subroutine magtocen() to interpolate cell centered magnetic field

EVOLUTION

 - add evolution of the magnetic field components in the evolve_euler()
   and evolve_rk2() time integration subroutines

 - also call the subroutine magtocen() in the right places

BOUNDARY CONDITIONS

 - support for magnetic field boundary update only in the case of blocks
   with the same level so far; later we need to include proper
   restriction and prolongation for the magnetic field to keep its
   divergence equal zero

PROBLEMS, BLAST

 - extend the blast problem to include the initial magnetic field

IO, HDF5

 - write down in a HDF5 file magnetic field components
2009-10-28 00:12:18 -02:00
Grzegorz Kowal
7bd227afda Implement Hilbert space filling curve for 3D. 2009-10-03 20:11:03 -03:00
Grzegorz Kowal
719b40c77d Rewrite write_data() using more efficient storage.
IO, HDF5

 - rewrite subroutine write_data() using more efficient storage,
   especially with compression; we are storing only the domain part of
   blocks and their primitive variables, which is selected by setting
   ftype='p'; storing restart files with all parameters will be done
   later

BLOCKS,

 - remove array c(:,:,:) from data_block which stored the values for
   refinement/derefinement estimations
2009-09-30 16:28:17 -03:00
Grzegorz Kowal
463be7ad77 Rewrite and add support for 3D to subroutine derefine_block(). 2009-09-29 17:19:26 -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
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
449975d9e7 Move bounds of the block to meta structure.
MESH STRUCTURE

 - move the bounds of the block (xmin, xmax, ...) from data to the meta
   structure; in this case we can deallocate data blocks without losing
   the information about it bounds
2009-09-25 11:41:19 -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
6198a0f5c5 Remove old block structures and related code. 2009-09-21 19:02:05 -03:00
Grzegorz Kowal
1ebcd50803 Fix nleafs counting and store it in HDF5 files. 2009-09-21 17:16:29 -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
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