15 double covariant[3][3] = {
20 double contravariant[3][3] = {{0.0}};
22 PetscFunctionBeginUser;
27 PetscFunctionReturn(0);
35 const PetscReal J[3][3] = {
40 const PetscReal u[3] = {1.5, -2.0, 4.0};
41 PetscReal uc[3] = {0.0, 0.0, 0.0};
43 PetscFunctionBeginUser;
48 PetscFunctionReturn(0);
56 const PetscReal J[3][3] = {
61 const PetscReal u[3] = {2.0, 3.0, 4.0};
62 PetscReal uc[3] = {0.0, 0.0, 0.0};
64 PetscFunctionBeginUser;
69 PetscFunctionReturn(0);
77 const Cmpnts csi = {2.0, 0.0, 0.0};
78 const Cmpnts eta = {0.0, 3.0, 0.0};
79 const Cmpnts zet = {0.0, 0.0, 4.0};
80 double ni[3] = {0.0, 0.0, 0.0};
81 double nj[3] = {0.0, 0.0, 0.0};
82 double nk[3] = {0.0, 0.0, 0.0};
83 double Ai = 0.0, Aj = 0.0, Ak = 0.0;
85 PetscFunctionBeginUser;
99 PetscFunctionReturn(0);
107 const Cmpnts csi = {2.0, 0.0, 0.0};
108 const Cmpnts eta = {0.0, 3.0, 0.0};
109 const Cmpnts zet = {0.0, 0.0, 4.0};
110 double dx = 0.0, dy = 0.0, dz = 0.0;
112 PetscFunctionBeginUser;
117 PetscFunctionReturn(0);
134 ierr = PetscInitialize(&argc, &argv, NULL,
"PICurv metric tests");
139 ierr =
PicurvRunTests(
"unit-metric", cases,
sizeof(cases) /
sizeof(cases[0]));
145 ierr = PetscFinalize();
PetscErrorCode InvertCovariantMetricTensor(double covariantTensor[3][3], double contravariantTensor[3][3])
Inverts the 3x3 covariant metric tensor to obtain the contravariant metric tensor.
PetscErrorCode ComputeCellCharacteristicLengthScale(PetscReal ajc, Cmpnts csi, Cmpnts eta, Cmpnts zet, double *dx, double *dy, double *dz)
Computes characteristic length scales (dx, dy, dz) for a curvilinear cell.
PetscErrorCode CalculateFaceNormalAndArea(Cmpnts csi, Cmpnts eta, Cmpnts zet, double ni[3], double nj[3], double nk[3], double *Ai, double *Aj, double *Ak)
Computes the unit normal vectors and areas of the three faces of a computational cell.
PetscErrorCode MetricVelocityContravariant(const PetscReal J[3][3], PetscReal detJ, const PetscReal u[3], PetscReal uc[3])
Implementation of MetricVelocityContravariant().
static PetscErrorCode TestMetricVelocityContravariantScaledAxes(void)
Test-local routine.
int main(int argc, char **argv)
Entry point for this unit-test binary.
static PetscErrorCode TestInvertCovariantMetricTensorDiagonal(void)
Test-local routine.
static PetscErrorCode TestMetricVelocityContravariantIdentity(void)
Test-local routine.
static PetscErrorCode TestCalculateFaceNormalAndAreaAxisAligned(void)
Test-local routine.
static PetscErrorCode TestComputeCellCharacteristicLengthScaleAxisAligned(void)
Test-local routine.
PetscErrorCode PicurvAssertRealNear(PetscReal expected, PetscReal actual, PetscReal tol, const char *context)
Shared test-support routine.
PetscErrorCode PicurvRunTests(const char *suite_name, const PicurvTestCase *cases, size_t case_count)
Shared test-support routine.
C test module for PICurv.
Named test case descriptor consumed by PicurvRunTests.
A 3D point or vector with PetscScalar components.