Changeset ef94e7 for src/units


Ignore:
Timestamp:
Jul 4, 2012, 6:10:39 PM (13 years ago)
Author:
Julian Iseringhausen <isering@…>
Children:
0260d3
Parents:
290aa3
Message:

vmg: Fix force calculation.

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

Location:
src/units/particle
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • src/units/particle/comm_mpi_particle.cpp

    r290aa3 ref94e7  
    218218    for (vmg_int j=0; j<size_receive[i]; ++j) {
    219219      p[recv_buffer_index[i][j]] = recv_buffer_float[i][4*j];
    220       std::memcpy(&f[recv_buffer_index[i][j]], &recv_buffer_float[i][4*j+1], 3*sizeof(vmg_float));
     220      std::memcpy(&f[3*recv_buffer_index[i][j]], &recv_buffer_float[i][4*j+1], 3*sizeof(vmg_float));
    221221    }
    222222#endif
  • src/units/particle/interface_fcs.cpp

    r290aa3 ref94e7  
    221221  const Grid& grid = multigrid(multigrid.MaxLevel());
    222222
    223   int error_code;
     223  int error_code = 0;
    224224
    225225  if (!grid.Global().LocalSize().IsComponentwiseGreater(near_field_cells))
    226226    error_code = 1;
    227   else
    228     error_code = 0;
    229 
    230   error_code = MG::GetComm()->GlobalMax(error_code);
    231 
    232   return error_code;
     227
     228  return MG::GetComm()->GlobalMax(error_code);
    233229}
    234230
  • src/units/particle/interface_particles.cpp

    r290aa3 ref94e7  
    179179        for (p1=lc(i,j,k).begin(); p1!=lc(i,j,k).end(); ++p1) {
    180180
     181          // Interpolate long-range part of potential and electric field
    181182          ip.Evaluate(**p1);
     183
     184          // Subtract self-induced potential
    182185          (*p1)->Pot() -= (*p1)->Charge() * spl.GetAntiDerivativeAtZero();
    183           (*p1)->Field() *= 0.5;
    184186
    185187#ifdef DEBUG_OUTPUT
  • src/units/particle/interpolation.cpp

    r290aa3 ref94e7  
    3030#include "units/particle/particle.hpp"
    3131
     32#include "mg.hpp"
     33#include "comm/comm.hpp"
     34
    3235using namespace VMG;
    3336
     
    5457  Index i;
    5558
    56   const Index begin = index - deg/2 - 1;
     59  const Index begin = index - deg/2;
    5760
    5861  h = grid.Extent().MeshWidth();
     
    105108void Particle::Interpolation::Evaluate(Particle& p)
    106109{
    107  Vector offset;
     110  const Vector& pos = p.Pos();
     111  vmg_float& pot = p.Pot();
     112  Vector& field = p.Field();
    108113
    109  const Vector& pos = p.Pos();
    110  vmg_float& pot = p.Pot();
    111  Vector& field = p.Field();
     114  pot = 0.0;
     115  field = 0.0;
    112116
    113  pot = 0.0;
    114  field = 0.0;
    115 
     117  Vector offset = pos - pos_begin;
    116118  buffer[0] = 1.0;
    117   offset = pos - pos_begin;
    118   for (int i=1; i<deg_1; ++i) {
    119     buffer[i] = buffer[i-1] * offset;
    120     offset -= h;
    121   }
    122 
    123   offset = pos - pos_begin;
    124119  for (int i=0; i<deg; ++i) {
     120    buffer[i+1] = buffer[i] * offset;
    125121    for (int j=0; j<i; ++j)
    126122      buffer_diff[i][j] = buffer_diff[i-1][j] * offset;
     
    145141        field[2] -= _access_coeff(i, j, k+1) * buffer[i][0] * buffer[j][1] * buffer_diff[k][0][2];
    146142      }
    147 
    148143}
    149144
  • src/units/particle/particle.hpp

    r290aa3 ref94e7  
    4040{
    4141public:
     42  Particle() :
     43    x_(0.0),
     44    f_(0.0),
     45    q_(0.0),
     46    p_(0.0),
     47    rank_(-1),
     48    index_(-1)
     49  {}
     50
    4251  Particle(const vmg_float* x, const vmg_float& q) :
    4352    x_(x),
Note: See TracChangeset for help on using the changeset viewer.