Skip to content

Commit

Permalink
Update BicubicInterpolation.C
Browse files Browse the repository at this point in the history
Include ddy_dx1_dx2 mixed derivative in the sample2ndDerivative function
  • Loading branch information
Silverwing747 authored Feb 6, 2025
1 parent e38948c commit a78912e
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion framework/src/utils/BicubicInterpolation.C
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,27 @@ BicubicInterpolation::sample2ndDerivative(Real x1, Real x2, unsigned int deriv_v
return sample_deriv;
}

// Take mixed derivative along x1 and x2 axes
// Note: sum from i = 1 and j = 1 as the first terms are zero
else if (deriv_var == 3)
{
Real sample_deriv = 0.0;
for (const auto i : make_range(1, 4))
for (const auto j : make_range(1, 4))
sample_deriv += i * j * _bicubic_coeffs[x1l][x2l][i][j] * MathUtils::pow(t, i - 1) *
MathUtils::pow(u, j - 1);

Real d1 = _x1[x1u] - _x1[x1l];
Real d2 = _x2[x2u] - _x2[x2l];

if (!MooseUtils::absoluteFuzzyEqual(d1, Real(0.0)) && !MooseUtils::absoluteFuzzyEqual(d2, Real(0.0)))
sample_deriv /= (d1 * d2);

return sample_deriv;
}

else
mooseError("deriv_var must be either 1 or 2 in BicubicInterpolation");
mooseError("deriv_var must be either 1, 2 or 3 in BicubicInterpolation");
}

void
Expand Down

0 comments on commit a78912e

Please sign in to comment.