Ignore:
Timestamp:
Apr 10, 2012, 1:55:49 PM (14 years ago)
Author:
Julian Iseringhausen <isering@…>
Children:
a40eea
Parents:
d24c2f
Message:

Merge recent changes of the vmg library into ScaFaCos.

Includes a fix for the communication problems on Jugene.

git-svn-id: https://svn.version.fz-juelich.de/scafacos/trunk@1666 5161e1c8-67bf-11de-9fd5-51895aff932f

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/interface/interface_fcs.cpp

    rd24c2f rac6d04  
    1717
    1818#include <mpi.h>
     19#ifdef HAVE_MARMOT
     20#include <enhancempicalls.h>
     21#include <sourceinfompicalls.h>
     22#endif
    1923
    2024#include "base/object.hpp"
     
    2226#include "comm/comm_mpi.hpp"
    2327#include "comm/domain_decomposition_mpi.hpp"
     28#include "comm/mpi/error_handler.hpp"
    2429#include "interface/interface_fcs.h"
    2530#include "interface/interface_particles.hpp"
    2631#include "level/level_operator_cs.hpp"
     32#include "level/level_operator_fas.hpp"
    2733#include "samples/discretization_poisson_fd.hpp"
     34#include "samples/discretization_poisson_fv.hpp"
    2835#include "samples/stencils.hpp"
    2936#include "samples/techniques.hpp"
     
    7077  VMGBackupSettings::mpi_comm = mpi_comm;
    7178
     79  MPI_Errhandler mpiErrorHandler;
     80  MPI_Comm_create_errhandler(VMG::MPI::ConvertToException, &mpiErrorHandler);
     81  MPI_Comm_set_errhandler(MPI_COMM_WORLD, mpiErrorHandler);
     82
    7283  const Boundary boundary(periodic[0] ? Periodic : Open,
    7384                          periodic[1] ? Periodic : Open,
     
    8596   * Register particle interface.
    8697   */
    87   Interface* interface = new VMG::InterfaceParticles(boundary, 2, level, Vector(box_offset), box_size, near_field_cells);
     98  Interface* interface;
     99  if (singular)
     100    interface = new InterfaceParticles(boundary, 2, level, Vector(box_offset), box_size, near_field_cells, 0, 1.0);
     101  else
     102    interface = new InterfaceParticles(boundary, 2, level, Vector(box_offset), box_size, near_field_cells, 2, 1.6);
    88103  MG::SetInterface(interface, comm);
    89104
    90105  /*
    91    * Use a finite difference discretization of the Poisson equation
    92    */
    93   Discretization* discretization = new DiscretizationPoissonFD();
     106   * Define discretization of the Poisson equation.
     107   * Finite volumes for locally refined grids and
     108   * finite differences otherwise.
     109   */
     110  Discretization* discretization;
     111  if (singular)
     112    discretization = new DiscretizationPoissonFD();
     113  else
     114    discretization = new DiscretizationPoissonFV();
    94115  discretization->Register("DISCRETIZATION");
    95116
     
    99120   * with a half-weight version once debugging is finished.
    100121   */
    101   LevelOperator* lop = new LevelOperatorCS(Stencils::RestrictionFullWeight, Stencils::InterpolationTrilinear);
     122  LevelOperator* lop;
     123  if (singular)
     124    lop = new LevelOperatorCS(Stencils::RestrictionFullWeight, Stencils::InterpolationTrilinear);
     125  else
     126    lop = new LevelOperatorFAS(Stencils::RestrictionFullWeight, Stencils::Injection, Stencils::InterpolationTrilinear);
    102127  lop->Register("LEVEL_OPERATOR");
    103128
     
    126151   */
    127152  if (singular)
    128     Techniques::SetCorrectionSchemePeriodic(2, level, gamma);
    129   else
    130     Techniques::SetCorrectionSchemeDirichlet(2, level, gamma);
     153    Techniques::SetCorrectionSchemePeriodic(interface->MinLevel(), interface->MaxLevel(), gamma);
     154  else
     155    Techniques::SetFullApproximationSchemeDirichlet(interface->MinLevel(), interface->MaxLevel(), gamma);
    131156
    132157  /*
     
    137162  new ObjectStorage<vmg_float>("PRECISION", precision);
    138163  new ObjectStorage<int>("MAX_ITERATION", max_iter);
    139 
    140164  new ObjectStorage<int>("PARTICLE_NEAR_FIELD_CELLS", near_field_cells);
    141165
     
    180204}
    181205
     206int VMG_fcs_check()
     207{
     208  const int& near_field_cells = MG::GetFactory().GetObjectStorageVal<int>("PARTICLE_NEAR_FIELD_CELLS");
     209  const Multigrid& multigrid = *MG::GetRhs();
     210  const Grid& grid = multigrid(multigrid.MaxLevel());
     211
     212  if (!grid.Global().LocalSize().IsComponentwiseGreater(near_field_cells))
     213    return 1;
     214
     215  return 0;
     216}
     217
    182218void VMG_fcs_run(vmg_float* x, vmg_float* q, vmg_float* p, vmg_float* f, vmg_int num_particles_local)
    183219{
Note: See TracChangeset for help on using the changeset viewer.