1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143
|
/***********************************************/
/**
* @file kernelPoisson.cpp
*
* @brief Poisson kernel (Potential).
* @see Kernel
*
* @author Torsten Mayer-Guerr
* @date 2003-09-20
*
*/
/***********************************************/
#include "base/import.h"
#include "classes/gravityfield/gravityfield.h"
#include "classes/kernel/kernel.h"
#include "classes/kernel/kernelPoisson.h"
/***********************************************/
Vector KernelPoisson::coefficients(Vector3d const &/*q*/, UInt degree) const
{
try
{
if(degree==INFINITYDEGREE)
throw(Exception("INFINITYDEGREE requested"));
Vector k(degree+1);
Double *kn = k.field();
for(UInt n=0; n<=degree; n++)
*kn++ = 1.0;
return k;
}
catch(std::exception &e)
{
GROOPS_RETHROW(e)
}
}
/***********************************************/
Vector KernelPoisson::inverseCoefficients(Vector3d const &/*p*/, UInt degree, Bool /*interior*/) const
{
try
{
if(degree==INFINITYDEGREE)
throw(Exception("INFINITYDEGREE requested"));
Vector k(degree+1);
Double *kn = k.field();
for(UInt n=0; n<=degree; n++)
*kn++ = 1.0;
return k;
}
catch(std::exception &e)
{
GROOPS_RETHROW(e)
}
}
/***********************************************/
Double KernelPoisson::kernel(Vector3d const &p, Vector3d const &q) const
{
Vector3d diff = p-q;
Double r = p.r();
Double R = q.r();
Double l = diff.r();
return R*(r*r-R*R)/(l*l*l);
}
/***********************************************/
Double KernelPoisson::radialDerivative(Vector3d const &p, Vector3d const &q) const
{
Vector3d diff = p-q;
Double r = p.r();
Double R = q.r();
Double l = diff.r();
Double cos_psi = (R*R+r*r-l*l)/(2*R*r);
Double dl_dr = (r-R*cos_psi)/l;
return R*(2*r*l-(r*r-R*R)*3*dl_dr)/(l*l*l*l);
}
/***********************************************/
Vector3d KernelPoisson::gradient(Vector3d const &p, Vector3d const &q) const
{
Vector3d diff = p-q;
Double r = p.r();
Double l = diff.r();
Double R = q.r();
return (2/(l*l*l)*p - 3*(r*r-R*R)/(l*l*l*l*l)*diff);
}
/***********************************************/
Tensor3d KernelPoisson::gradientGradient(const Vector3d &p, const Vector3d &q) const
{
Tensor3d tns;
// Vorausberechnungen
Vector3d diff = p-q;
Double r = p.r();
Double R = q.r();
Double l = diff.r();
Double l2 = l*l;
Double l3 = l2*l;
Double l5 = l3*l2;
Double l7 = l5*l2;
Double term = r*r-R*R;
tns.xx() = 2.0/l3 - 12.0*p.x()*diff.x()/l5 + 15*term*diff.x()*diff.x()/l7 - 3.0*term/l5;
tns.yy() = 2.0/l3 - 12.0*p.y()*diff.y()/l5 + 15*term*diff.y()*diff.y()/l7 - 3.0*term/l5;
tns.zz() = 2.0/l3 - 12.0*p.z()*diff.z()/l5 + 15*term*diff.z()*diff.z()/l7 - 3.0*term/l5;
tns.xy() = -6.0*(p.x()*diff.y()+p.y()*diff.x())/l5 + 15.0*term*diff.x()*diff.y()/l7;
tns.xz() = -6.0*(p.x()*diff.z()+p.z()*diff.x())/l5 + 15.0*term*diff.x()*diff.z()/l7;
tns.yz() = -6.0*(p.y()*diff.z()+p.z()*diff.y())/l5 + 15.0*term*diff.y()*diff.z()/l7;
return tns;
}
/***********************************************/
Double KernelPoisson::inverseKernel(Vector3d const &p, Vector3d const &q, const Kernel &kernel) const
{
// potential = K
return kernel.kernel(p, q);
}
/***********************************************/
Double KernelPoisson::inverseKernel(const Time &time, const Vector3d &p, const GravityfieldBase &field) const
{
return field.potential(time, p);
}
/***********************************************/
|