Skip to content

Commit

Permalink
fixed thix test missing default parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
aradermacher committed Sep 18, 2023
1 parent a1da5e8 commit 0674cfb
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ def parameter_description() -> dict[str, str]:
"igc": "Ideal gas constant",
"rho": "Density of concrete",
"g": "Gravitational acceleration",
"themal_cond": "Thermal conductivity",
"vol_heat_cap": "TODO",
"themal_cond": "effective thermal conductivity",
"vol_heat_cap": "volumetric heat capacity",
"Q_pot": "potential heat per weight of binder",
"Q_inf": "potential heat per concrete volume",
"B1": "numerical shape parameter for heat release function",
Expand Down Expand Up @@ -88,7 +88,7 @@ def default_parameters() -> tuple[Experiment, dict[str, pint.Quantity]]:
"igc": 8.3145 * ureg("J/K/mol"),
"rho": 2350.0 * ureg("kg/m^3"),
"g": 9.81 * ureg("m/s^2"),
"thermal_cond": 2.0 * ureg("W/(m^3*K)"),
"thermal_cond": 2.0 * ureg("W/(m^3*K)"), # TODO Check with Sjard
"vol_heat_cap": 2.4e6 * ureg("J/(m^3 * K)"),
# "Q_pot": 500e3 * ureg("J/kg"), only needed for postprocessing
"Q_inf": 144000000 * ureg("J/m^3"),
Expand All @@ -113,6 +113,7 @@ def default_parameters() -> tuple[Experiment, dict[str, pint.Quantity]]:
"dt": 1.0 * ureg("s"),
}
default_parameters["E_act"] = 5653.0 * default_parameters["igc"] * ureg("J/mol")
print("CHECK", default_parameters["E_act"])
return experiment, default_parameters

def compute_residuals(self) -> None:
Expand Down
7 changes: 1 addition & 6 deletions tests/finite_element_problem/test_am_layers.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,8 @@ def set_test_parameters(dim: int, mat_type: str = "thix") -> Parameters:
if dim == 2:
setup_parameters["stress_state"] = "plane_stress" * ureg("")

# default material parameters as start
if mat_type == "thix":
_, default_params = ConcreteAM.default_parameters(ConcreteThixElasticModel)
else:
raise ValueError(f"Unknown material type {mat_type}")
# default material parameters from material problem

setup_parameters.update(default_params)
if dim == 3:
setup_parameters["q_degree"] = 4 * ureg("")

Expand Down
11 changes: 4 additions & 7 deletions tests/finite_element_problem/test_linear_simple_cube.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@ def test_disp(dim: int) -> None:

@pytest.mark.parametrize("dim", [2, 3])
def test_strain_state_error(dim: int) -> None:
setup_parameters = SimpleCube.default_parameters()
# setup_parameters = SimpleCube.default_parameters()
setup_parameters = {} # use default parameters
setup_parameters["dim"] = dim * ureg("")
setup_parameters["strain_state"] = "wrong" * ureg("")
setup = SimpleCube(setup_parameters)
Expand All @@ -117,7 +118,8 @@ def test_strain_state_error(dim: int) -> None:
@pytest.mark.parametrize("dim", [2, 3])
@pytest.mark.parametrize("degree", [1, 2])
def test_multiaxial_strain(dim: int, degree: int) -> None:
setup_parameters = SimpleCube.default_parameters()
# setup_parameters = SimpleCube.default_parameters()
setup_parameters = {} # use default parameters
setup_parameters["dim"] = dim * ureg("")
setup_parameters["degree"] = degree * ureg("")
setup_parameters["strain_state"] = "multiaxial" * ureg("")
Expand Down Expand Up @@ -153,8 +155,3 @@ def test_multiaxial_strain(dim: int, degree: int) -> None:

assert result_corner == pytest.approx(target)
assert result_center == pytest.approx(target / 2)


# main
if __name__ == "__main__":
test_disp(2)
8 changes: 7 additions & 1 deletion tests/finite_element_problem/test_thermo_mechanical_cube.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,9 @@ def test_hydration_with_body_forces(dim: int):
parameters["rho"] = 2350 * ureg("kg/m^3") # in kg/m^3 density of concrete

parameters["density_binder"] = 1440 * ureg("kg/m^3") # in kg/m^3 density of the binder
# TODO Check with Sjard
parameters["thermal_cond"] = 2.0 * ureg(
"W/(m*K)"
"W/(m^3*K)"
) # effective thermal conductivity, approx in Wm^-3K^-1, concrete!
# self.specific_heat_capacity = 9000 # effective specific heat capacity in J kg⁻1 K⁻1
parameters["vol_heat_cap"] = 2.4e6 * ureg("J/(m^3 * K)") # volumetric heat cap J/(m3 K)
Expand Down Expand Up @@ -240,3 +241,8 @@ def test_hydration_with_body_forces(dim: int):
np.testing.assert_allclose(data["t"], t_list)
np.testing.assert_allclose(data["doh"].flatten(), np.array(doh_sensor.data).flatten(), rtol=1e-4)
np.testing.assert_allclose(data["E"].flatten(), np.array(E_sensor.data).flatten(), rtol=1e-4)


# main
if __name__ == "__main__":
test_hydration_with_body_forces(3)
16 changes: 8 additions & 8 deletions tests/finite_element_problem/test_thixotropy_uniaxial.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,11 @@ def test_disp(dim: int, degree: int):
# setting up the problem
experiment = SimpleCube(parameters)

# get default parameters and change accordingly to cases
# get description of parameters
des = ConcreteAM.parameter_description()
print(des)

_, default_params = ConcreteAM.default_parameters(ConcreteThixElasticModel)
parameters.update(default_params)
# use default parameters (default) and change accordingly to cases
parameters["degree"] = degree * ureg("")
if dim == 3:
parameters["q_degree"] = 4 * ureg("")
Expand Down Expand Up @@ -139,6 +138,7 @@ def check_disp_case(problem: ConcreteAM, dt: pint.Quantity, E_o_time: list[float

if problem.p["dim"] == 2:
# standard uniaxial checks for last time step
print("analytic_eps", analytic_eps, problem.p["nu"] * analytic_eps)
# strain in yy direction
assert problem.sensors["StrainSensor"].data[-1][-1] == pytest.approx(analytic_eps)
# strain in xx direction
Expand Down Expand Up @@ -195,8 +195,8 @@ def check_disp_case(problem: ConcreteAM, dt: pint.Quantity, E_o_time: list[float
assert E_o_time[-1] == pytest.approx(E_end)


# if __name__ == "__main__":
#
# test_disp(2, 2)
#
# # test_disp(3, 2)
if __name__ == "__main__":

test_disp(2, 2)

# test_disp(3, 1)

0 comments on commit 0674cfb

Please sign in to comment.