Skip to content

Commit

Permalink
test: Update core tests to account for new args in core.derivatives
Browse files Browse the repository at this point in the history
  • Loading branch information
adigitoleo committed Jun 6, 2024
1 parent 2f97aca commit ade34f3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
10 changes: 10 additions & 0 deletions tests/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ def test_shear_dudz(self, outdir):
fractions=np.array([1.0]),
strain_rate=np.array([[0, 0, 1], [0, 0, 0], [1, 0, 0]]),
velocity_gradient=np.array([[0, 0, 2], [0, 0, 0], [0, 0, 0]]),
deformation_gradient_spin=np.full((3, 3), np.nan),
stress_exponent=1.5,
deformation_exponent=3.5,
nucleation_efficiency=5,
Expand Down Expand Up @@ -87,6 +88,7 @@ def test_shear_dvdx(self, outdir):
fractions=np.array([1.0]),
strain_rate=np.array([[0, 1, 0], [1, 0, 0], [0, 0, 0]]),
velocity_gradient=np.array([[0, 0, 0], [2, 0, 0], [0, 0, 0]]),
deformation_gradient_spin=np.full((3, 3), np.nan),
stress_exponent=1.5,
deformation_exponent=3.5,
nucleation_efficiency=5,
Expand Down Expand Up @@ -173,6 +175,7 @@ def test_shear_dvdx_slip_010_100(self, outdir):
fractions=np.array([1.0]),
strain_rate=nondim_strain_rate,
velocity_gradient=nondim_velocity_gradient,
deformation_gradient_spin=np.full((3, 3), np.nan),
stress_exponent=1.5,
deformation_exponent=3.5,
nucleation_efficiency=5,
Expand Down Expand Up @@ -289,6 +292,7 @@ def test_shear_dudz_slip_001_100(self, outdir):
fractions=np.array([1.0]),
strain_rate=nondim_strain_rate,
velocity_gradient=nondim_velocity_gradient,
deformation_gradient_spin=np.full((3, 3), np.nan),
stress_exponent=1.5,
deformation_exponent=3.5,
nucleation_efficiency=5,
Expand Down Expand Up @@ -406,6 +410,7 @@ def test_shear_dwdx_slip_001_100(self, outdir):
fractions=np.array([1.0]),
strain_rate=nondim_strain_rate,
velocity_gradient=nondim_velocity_gradient,
deformation_gradient_spin=np.full((3, 3), np.nan),
stress_exponent=1.5,
deformation_exponent=3.5,
nucleation_efficiency=5,
Expand Down Expand Up @@ -523,6 +528,7 @@ def test_shear_dvdz_slip_010_001(self, outdir):
fractions=np.array([1.0]),
strain_rate=nondim_strain_rate,
velocity_gradient=nondim_velocity_gradient,
deformation_gradient_spin=np.full((3, 3), np.nan),
stress_exponent=1.5,
deformation_exponent=3.5,
nucleation_efficiency=5,
Expand Down Expand Up @@ -609,13 +615,15 @@ def test_shear_dvdx_circle_inplane(self, outdir):
[[0, 0, θ] for θ in initial_angles]
)
orientations_diff, fractions_diff = _core.derivatives(
regime=_core.DeformationRegime.matrix_dislocation,
phase=_core.MineralPhase.olivine,
fabric=_core.MineralFabric.olivine_A,
n_grains=360000,
orientations=initial_orientations.as_matrix(),
fractions=np.full(360000, 1 / 360000),
strain_rate=np.array([[0, 1, 0], [1, 0, 0], [0, 0, 0]]),
velocity_gradient=np.array([[0, 0, 0], [2, 0, 0], [0, 0, 0]]),
deformation_gradient_spin=np.full((3, 3), np.nan),
stress_exponent=1.5,
deformation_exponent=3.5,
nucleation_efficiency=5,
Expand Down Expand Up @@ -704,13 +712,15 @@ def test_shear_dvdx_circle_shearplane(self, outdir):
"zx", [[np.pi / 2, θ] for θ in initial_angles]
)
orientations_diff, fractions_diff = _core.derivatives(
regime=_core.DeformationRegime.matrix_dislocation,
phase=_core.MineralPhase.olivine,
fabric=_core.MineralFabric.olivine_A,
n_grains=360000,
orientations=initial_orientations.as_matrix(),
fractions=np.full(360000, 1 / 360000),
strain_rate=np.array([[0, 1, 0], [1, 0, 0], [0, 0, 0]]),
velocity_gradient=np.array([[0, 0, 0], [2, 0, 0], [0, 0, 0]]),
deformation_gradient_spin=np.full((3, 3), np.nan),
stress_exponent=1.5,
deformation_exponent=3.5,
nucleation_efficiency=5,
Expand Down
7 changes: 4 additions & 3 deletions tests/test_vortex_2d.py
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,7 @@ def _run(assert_each, orientations_init):
pool.starmap(_run, zip(assert_each_list, orientations_init_list))
):
mineral, resampled_texture, fig_objects = out
fig_objects[0].savefig(
_io.resolve_path(f"{out_basepath}_path_{i}.pdf")
)
if outdir is not None:
fig_objects[0].savefig(
_io.resolve_path(f"{out_basepath}_path_{i}.pdf")
)

0 comments on commit ade34f3

Please sign in to comment.