11 #include "libmesh/utility.h" 16 cubic(Real
x, Real x0, Real y0, Real y0p, Real x1, Real y1, Real y1p)
18 mooseAssert(x0 != x1,
"PorousFlowCubic: x0 cannot equal x1");
19 const Real d = x1 - x0;
20 const Real d2 = Utility::pow<2>(
d);
21 const Real mean = 0.5 * (x1 + x0);
22 const Real sq3 = 0.5 * std::sqrt(3.0) *
d;
23 const Real term1 = y0p * (
x - x0) * Utility::pow<2>(
x - x1) /
25 const Real term2 = y1p * (
x - x1) * Utility::pow<2>(
x - x0) /
27 const Real term3 = (
x - mean - sq3) * (
x - mean) * (
x - mean + sq3);
32 const Real term3_x0 = (x0 - mean - sq3) * (x0 - mean) * (x0 - mean + sq3);
33 const Real term3_x1 = (x1 - mean - sq3) * (x1 - mean) * (x1 - mean + sq3);
34 return (y0 * (term3 - term3_x1) + y1 * (term3_x0 - term3)) / (term3_x0 - term3_x1) + term1 +
39 dcubic(Real
x, Real x0, Real y0, Real y0p, Real x1, Real y1, Real y1p)
41 mooseAssert(x0 != x1,
"PorousFlowCubic: x0 cannot equal x1");
42 const Real d = x1 - x0;
43 const Real d2 = Utility::pow<2>(
d);
44 const Real mean = 0.5 * (x1 + x0);
45 const Real sq3 = 0.5 * std::sqrt(3.0) *
d;
46 const Real term1_prime = y0p * (Utility::pow<2>(
x - x1) + (
x - x0) * 2 * (
x - x1)) / d2;
47 const Real term2_prime = y1p * (Utility::pow<2>(
x - x0) + (
x - x1) * 2 * (
x - x0)) / d2;
48 const Real term3_prime =
49 3.0 * Utility::pow<2>(mean) - 6 * mean *
x - 0.75 * d2 + 3.0 * Utility::pow<2>(
x);
50 const Real term3_x0 = (x0 - mean - sq3) * (x0 - mean) * (x0 - mean + sq3);
51 const Real term3_x1 = (x1 - mean - sq3) * (x1 - mean) * (x1 - mean + sq3);
52 return (y0 - y1) * term3_prime / (term3_x0 - term3_x1) + term1_prime + term2_prime;
Real cubic(Real x, Real x0, Real y0, Real y0p, Real x1, Real y1, Real y1p)
Cubic function f(x) that satisfies f(x0) = y0 f'(x0) = y0p f(x1) = y1 f'(x1) = y1p.
const std::vector< double > x
Real dcubic(Real x, Real x0, Real y0, Real y0p, Real x1, Real y1, Real y1p)
Derivative of cubic function, f(x), with respect to x.
Utility to produce the value and derivative of a cubic function at a point.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real