private IPoint Integrate(BoundaryElement <T> elem, T eta, List <Func <T, T, double> > derivateFunctions) { var derivates = derivateFunctions.Select(derivateFunction => Integrate(elem, eta, derivateFunction)).ToList(); return(CreatePoint(derivates)); }
public double IntegratedQdnx( BoundaryElement <T> integratedElement, BoundaryElement <T> elem2, List <Func <T, T, double> > derivateFunctions) { var derivate = Integrate(integratedElement, elem2.Center, derivateFunctions); return(derivate.ScalarMultiply(elem2.Normal)); }
protected override double CreateMatrixElement( BoundaryElement <T> elem1, BoundaryElement <T> elem2, ConditionType conditionType) { if (conditionType == ConditionType.Robin) { var IsExponental = true; if (IsExponental) { var enumerator = KirghoffTransformation.U0 * KirghoffTransformation.U0 * KirghoffTransformation.LAMDA0 * Integrator.Integrate(elem1, elem2.Center, FundamentalSolution); var denumerator = KirghoffTransformation.BETALAMDA * KirghoffTransformation.BETALAMDA * (U(elem2.Center, solution) + 1); return(KirghoffTransformation.Nuv(elem2.Center) * enumerator / denumerator - 0.5 * Kroneker(elem1, elem2) + Integrator.IntegratedQdnx(elem1, elem2, Derivates)); } else { var enumerator = Integrator.Integrate(elem1, elem2.Center, FundamentalSolution); var denumerator = Math.Sqrt( 1 + 2 * KirghoffTransformation.BETALAMDA * U(elem2.Center, solution) / (KirghoffTransformation.LAMDA0 * KirghoffTransformation.U0)); return(KirghoffTransformation.Nuv(elem2.Center) * enumerator / (KirghoffTransformation.LAMDA0 * denumerator) - 0.5 * Kroneker(elem1, elem2) + Integrator.IntegratedQdnx(elem1, elem2, Derivates)); } } else { return(0); } }
protected override double CreateVectorElement(BoundaryElement <Point3D> elem1, Func <Point3D, double> function, ConditionType conditionType) { switch (elem1.Bound.Name) { case BoundNumber.Bound12: return(-parameters.BPotential * functionsForSemiSpace.U1(elem1.Center, parameters.B) - parameters.APotential * functionsForSemiSpace.U1(elem1.Center, parameters.A)); case BoundNumber.Bound2: var fbBound2 = elem1.Normal.ScalarMultiply(FunctionsForSemiSpace.FSemiSpace(elem1.Normal, parameters.B)); var faBound2 = elem1.Normal.ScalarMultiply(FunctionsForSemiSpace.FSemiSpace(elem1.Normal, parameters.A)); return(-parameters.APotential * faBound2 - parameters.BPotential * fbBound2); case BoundNumber.Bound13: return(-parameters.BPotential * functionsForSemiSpace.U1(elem1.Center, parameters.B) - parameters.APotential * functionsForSemiSpace.U1(elem1.Center, parameters.A)); case BoundNumber.Bound3: var fbBound3 = elem1.Normal.ScalarMultiply(FunctionsForSemiSpace.FSemiSpace(elem1.Normal, parameters.B)); var faBound3 = elem1.Normal.ScalarMultiply(FunctionsForSemiSpace.FSemiSpace(elem1.Normal, parameters.A)); return(-parameters.APotential * faBound3 - parameters.BPotential * fbBound3); } return(base.CreateVectorElement(elem1, function, conditionType)); }
public double IntegratedQdny( BoundaryElement <T> integratedElement, BoundaryElement <T> elem2, List <Func <T, T, double> > derivateFunctions) { return(IntegratedQdny(integratedElement, elem2.Center, derivateFunctions)); }
protected override double CreateMatrixElement( BoundaryElement <T> elem1, BoundaryElement <T> elem2, ConditionType conditionType) { double sum = 1; switch (conditionType) { case ConditionType.Pow: var derivate2 = Integrator.Integrate(elem1, elem2.Center, Derivates); var enumerator = Integrator.Integrate(elem1, elem2.Center, FundamentalSolution); var denumerator = Math.Sqrt( 1 + 2 * KirghoffTransformation.BETALAMDA * sum / (KirghoffTransformation.LAMDA0 * KirghoffTransformation.U0)); return(KirghoffTransformation.Nuv(elem2.Center) * enumerator / (KirghoffTransformation.LAMDA0 * denumerator) - 0.5 * Kroneker(elem1, elem2) + derivate2.ScalarMultiply(elem1.Normal)); case ConditionType.Exp: return(0); } return(double.NaN); }
protected override double CreateMatrixElement(BoundaryElement <T> elem1, BoundaryElement <T> elem2, ConditionType conditionType) { switch (conditionType) { case ConditionType.Dirichlet: if (elem1.Bound.IsOuter && elem2.Bound.IsOuter) { return(Integrator.Integrate(elem1, elem2.Center, FundamentalSolution)); } if (elem1.Bound.IsOuter && !elem2.Bound.IsOuter) { return(Integrator.IntegratedQdnx(elem1, elem2, Derivates)); } if (!elem1.Bound.IsOuter && elem2.Bound.IsOuter) { return(Integrator.IntegratedQdny(elem1, elem2, Derivates)); } if (!elem1.Bound.IsOuter && !elem2.Bound.IsOuter) { return(lambda * Kroneker(elem1, elem2) + Integrator.IntegratedQdnxdny(elem1, elem2, Derivates)); } break; } return(double.NaN); }
public double Integrate(BoundaryElement <T> elem1, BoundaryElement <T> elem2, Func <T, T, double> f) { return (elem1.GetIntegrationPoints(n).Sum( p1 => elem2.GetIntegrationPoints(n + 2).Sum( p2 => p1.Weight * p2.Weight * p1.Jacobian * p2.Jacobian * f(p1.Point, p2.Point)))); }
protected override double CreateMatrixElement(BoundaryElement <T> elem1, BoundaryElement <T> elem2, ConditionType conditionType) { switch (conditionType) { case ConditionType.Dirichlet: return(Integrator.Integrate(elem1, elem2, FundamentalSolution)); } return(double.NaN); }
public double IntegratedQdny( BoundaryElement <T> integratedElement, T x, List <Func <T, T, double> > derivateFunctions) { var derivate = Integrate(integratedElement, x, derivateFunctions); return(-derivate.ScalarMultiply(integratedElement.Normal)); }
public double U(Point3D x, BoundaryElement <Point3D> elem, int boundNumber, int boundElem, int count) { if (elem.Bound.Name == BoundNumber.Bound12) { return(Integrator.Integrate(elem, x, functionsForSemiSpace.U1) * Solution[boundElem]); } if (elem.Bound.Name == BoundNumber.Bound13) { return(Integrator.Integrate(elem, x, functionsForSemiSpace.U1) * Solution[boundNumber * count + boundElem]); } return(0); }
public double IntegratedQdnxdny( BoundaryElement <T> integratedElement, BoundaryElement <T> elem2, List <Func <T, T, double> > derivateFunctions) { var derivStart = derivateFunctions.Select(df => df(elem2.Center, integratedElement.Points[0])).ToList(); var derivEnd = derivateFunctions.Select(df => df(elem2.Center, integratedElement.Points[1])).ToList(); var tangentialX = GetTangential(elem2.Normal as Point2D); var upper = CreatePoint(derivEnd).ScalarMultiply(tangentialX); var lower = CreatePoint(derivStart).ScalarMultiply(tangentialX); return(upper - lower); }
public double Integrate(BoundaryElement <T> elem, T eta, Func <T, T, double> f, bool etaOnElement = false) { if (etaOnElement && eta is Point2D) { // TODO : works properly only for f == Ln(|x-y|). Improve for derivates also. // TODO : this is harcode. It uses fact that eta = element.Center, and hence eta=(fi1(0), fi2(0)), where fi1, fi2 - interpolation functions. var t = 0; var etaY = elem.Yakobian(new Point1D(t)); var exactIntegralPart = GetExactPart(t); return(elem.GetIntegrationPoints(n).Sum(p => f(eta, p.Point) * (p.Jacobian - etaY)) - etaY * exactIntegralPart); } return(elem.GetIntegrationPoints(n).Sum(p => p.Weight * p.Jacobian * f(eta, p.Point))); }
protected override double CreateMatrixElement(BoundaryElement <T> elem1, BoundaryElement <T> elem2, ConditionType conditionType) { switch (conditionType) { case ConditionType.Dirichlet: return(Integrator.Integrate(elem1, elem2.Center, FundamentalSolution)); case ConditionType.Neumann: return(Integrator.IntegratedQdnx(elem1, elem2, Derivates)); case ConditionType.Robin: return(Integrator.Integrate(elem1, elem2.Center, FundamentalSolution) - Integrator.IntegratedQdnx(elem1, elem2, Derivates)); } return(double.NaN); }
protected override double CreateVectorElement(BoundaryElement <T> elem1, Func <T, double> function, ConditionType conditionType) { switch (conditionType) { case (ConditionType.Robin): { var IsExponental = true; if (IsExponental) { var ln = Math.Log( KirghoffTransformation.BETALAMDA / (KirghoffTransformation.LAMDA0 * KirghoffTransformation.U0) * U(elem1.Center, solution) + 1); return(KirghoffTransformation.Nuv(elem1.Center) * (KirghoffTransformation.U0 + (KirghoffTransformation.U0 / KirghoffTransformation.BETALAMDA) * ln) + Q(elem1.Center, solution) - KirghoffTransformation.Nuv(elem1.Center) * base.CreateVectorElement(elem1, function, conditionType)); } else { var sqrt = Math.Sqrt( 1 + 2 * KirghoffTransformation.BETALAMDA * U(elem1.Center, solution) / (KirghoffTransformation.LAMDA0 * KirghoffTransformation.U0)); return(KirghoffTransformation.Nuv(elem1.Center) * (KirghoffTransformation.U0 + KirghoffTransformation.U0 / KirghoffTransformation.BETALAMDA * (sqrt - 1)) + Q(elem1.Center, solution) - KirghoffTransformation.Nuv(elem1.Center) * base.CreateVectorElement(elem1, function, conditionType)); } break; } } return(0); }
protected override double CreateVectorElement(BoundaryElement <T> elem1, Func <T, double> function) { throw new NotImplementedException(); }
protected override double CreateMatrixElement(BoundaryElement <Point3D> elem1, BoundaryElement <Point3D> elem2, ConditionType conditionType) { if (elem1.Bound.Name == BoundNumber.Bound12 && elem2.Bound.Name == BoundNumber.Bound12) { return(Integrator.Integrate(elem1, elem2.Center, functionsForSemiSpace.U1)); } if (elem1.Bound.Name == BoundNumber.Bound12 && elem2.Bound.Name == BoundNumber.Bound2) { return(-Integrator.Integrate(elem1, elem2.Center, functionsForSemiSpace.U2)); } if (elem1.Bound.Name == BoundNumber.Bound12 && elem2.Bound.Name == BoundNumber.Bound13) { return(Integrator.Integrate(elem1, elem2.Center, functionsForSemiSpace.U1)); } if (elem1.Bound.Name == BoundNumber.Bound12 && elem2.Bound.Name == BoundNumber.Bound3) { return(0); } //2----------------------------------------------- if (elem1.Bound.Name == BoundNumber.Bound2 && elem2.Bound.Name == BoundNumber.Bound12) { return(Integrator.IntegratedQdnx(elem1, elem2, FunctionsForSemiSpace.Derivates)); } if (elem1.Bound.Name == BoundNumber.Bound2 && elem2.Bound.Name == BoundNumber.Bound2) { return(-Integrator.IntegratedQdnx(elem1, elem2, FunctionFactory.Derivates)); } if (elem1.Bound.Name == BoundNumber.Bound2 && elem2.Bound.Name == BoundNumber.Bound13) { return(Integrator.IntegratedQdnx(elem1, elem2, FunctionsForSemiSpace.Derivates)); } if (elem1.Bound.Name == BoundNumber.Bound2 && elem2.Bound.Name == BoundNumber.Bound3) { return(0); } //3----------------------------------------------- if (elem1.Bound.Name == BoundNumber.Bound13 && elem2.Bound.Name == BoundNumber.Bound12) { return(Integrator.Integrate(elem1, elem2.Center, functionsForSemiSpace.U1)); } if (elem1.Bound.Name == BoundNumber.Bound13 && elem2.Bound.Name == BoundNumber.Bound2) { return(0); } if (elem1.Bound.Name == BoundNumber.Bound13 && elem2.Bound.Name == BoundNumber.Bound13) { return(Integrator.Integrate(elem1, elem2.Center, functionsForSemiSpace.U1)); } if (elem1.Bound.Name == BoundNumber.Bound13 && elem2.Bound.Name == BoundNumber.Bound3) { return(-(Integrator.Integrate(elem1, elem2.Center, functionsForSemiSpace.U3))); } //4------------------------------------------------ if (elem1.Bound.Name == BoundNumber.Bound3 && elem2.Bound.Name == BoundNumber.Bound12) { return(Integrator.IntegratedQdnx(elem1, elem2, FunctionsForSemiSpace.Derivates)); } if (elem1.Bound.Name == BoundNumber.Bound3 && elem2.Bound.Name == BoundNumber.Bound2) { return(0); } if (elem1.Bound.Name == BoundNumber.Bound3 && elem2.Bound.Name == BoundNumber.Bound13) { return(Integrator.IntegratedQdnx(elem1, elem2, FunctionsForSemiSpace.Derivates)); } if (elem1.Bound.Name == BoundNumber.Bound3 && elem2.Bound.Name == BoundNumber.Bound3) { return(-Integrator.IntegratedQdnx(elem1, elem2, FunctionFactory.Derivates)); } throw new Exception("Invalid boundaries"); }
protected override double CreateVectorElement(BoundaryElement <T> elem1, Func <T, double> function, ConditionType conditionType) { return(transformation(base.CreateVectorElement(elem1, function, conditionType))); }
public double Integrate(BoundaryElement <T> elem, T eta, Func <T, double> f, Func <T, T, double> fundamental) { return(elem.GetIntegrationPoints(n).Sum(p => p.Weight * p.Jacobian * f(p.Point) * fundamental(eta, p.Point))); }
protected virtual double CreateVectorElement(BoundaryElement <T> elem1, Func <T, double> function, ConditionType conditionType) { return(function(elem1.Center) - InnerSourceImplact(elem1.Center)); }
protected override double CreateVectorElement(BoundaryElement <T> elem1, Func <T, double> function, ConditionType conditionType) { return(Integrator.Integrate(elem1, function)); }
protected abstract double CreateMatrixElement(BoundaryElement <T> elem1, BoundaryElement <T> elem2, ConditionType conditionType);
protected static int Kroneker(BoundaryElement <T> elem1, BoundaryElement <T> elem2) { return(elem1 == elem2 ? 1 : 0); }