Liebe Gitlab-Nutzerin, lieber Gitlab-Nutzer,
es ist nun möglich sich mittels des ZIH-Logins/LDAP an unserem Dienst anzumelden. Die Konten der externen Nutzer:innen sind über den Reiter "Standard" erreichbar.
Die Administratoren


Dear Gitlab user,
it is now possible to log in to our service using the ZIH login/LDAP. The accounts of external users can be accessed via the "Standard" tab.
The administrators

ElementUpdate_2d.cc 1.92 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12
//
// Software License for AMDiS
//
// Copyright (c) 2010 Dresden University of Technology 
// All rights reserved.
// Authors: Simon Vey, Thomas Witkowski et al.
//
// This file is part of AMDiS
//
// See also license.opensource.txt in the distribution.


13 14
#include "ElementUpdate_2d.h"

15 16
double ElementUpdate_2d::calcElementUpdate(const FixVec<WorldVector<double> *, VERTEX> &vert,
					   FixVec<double, VERTEX> &uhVal)
17
{
18 19 20 21 22 23 24 25 26 27
  WorldVector<double> &v0 = *(vert[0]);
  WorldVector<double> &v1 = *(vert[1]);
  WorldVector<double> &v2 = *(vert[2]);

  int dim = Global::getGeo(WORLD);
  for (int i = 0; i < dim; i++) {
    xhminusYh[i] = v2[i] - v0[i];
    zhminusYh[i] = v1[i] - v0[i];
    xhminusZh[i] = v2[i] - v1[i];
  }
28 29 30 31 32
  
  double norm_zhminusYh = sqrt(zhminusYh * zhminusYh);
  double norm_xhminusYh = sqrt(xhminusYh * xhminusYh);
  double norm_xhminusZh = sqrt(xhminusZh * xhminusZh);
  
33
  double delta = (uhVal[1] - uhVal[0]) / norm_zhminusYh; 
34
  double sP = xhminusYh * zhminusYh;
35
  double c_alpha = sP / (norm_xhminusYh * norm_zhminusYh);
36
  sP = xhminusZh * zhminusYh;
37
  double c_beta = -sP / (norm_xhminusZh * norm_zhminusYh);
38 39 40 41 42
  
  double update = 0;
  if (c_alpha <= delta) {
    update = uhVal[0] + norm_xhminusYh;
    //save barycentric coordinates for calculation of the velocity
43 44
    if (velExt != NULL)      
      velExt->setBarycentricCoords_2D(1,0,0);      
45 46 47
  } else if (delta <= -c_beta) {
    update = uhVal[1] + norm_xhminusZh;
    //save barycentric coordinates for calculation of the velocity
48 49
    if (velExt != NULL)      
      velExt->setBarycentricCoords_2D(0,1,0);      
50 51
  } else {
    update = uhVal[0] + 
52
      (c_alpha * delta + sqrt((1 - c_alpha * c_alpha) * (1 - delta * delta))) *
53 54
      norm_xhminusYh;
    //calculate and save barycentric coordinates for calculation of the velocity
55 56
    if (velExt != NULL)      
      velExt->calcBarycentricCoords_2D(delta, c_alpha, norm_zhminusYh, norm_xhminusYh);      
57 58 59 60
  }
  
  return update;
}