def test_coe_shift_ballast_viscous():
    r"""Test position change of centre of effort."""
    force = ballast_viscous(boatspeed=1.,
                            heel_angle=30.,
                            coe=(0.5, 0., -0.2),
                            bulb_length=0.37,
                            bulb_diameter=0.037,
                            bulb_wetted_area=0.02)
    assert -0.1 - 1e-6 <= force.py <= -0.1 + 1e-6
    force = ballast_viscous(boatspeed=1.,
                            heel_angle=-30.,
                            coe=(0.5, 0., -0.2),
                            bulb_length=0.37,
                            bulb_diameter=0.037,
                            bulb_wetted_area=0.02)
    assert 0.1 - 1e-6 <= force.py <= 0.1 + 1e-6

    force = ballast_viscous(boatspeed=1.,
                            heel_angle=60.,
                            coe=(0.5, 0., -0.2),
                            bulb_length=0.37,
                            bulb_diameter=0.037,
                            bulb_wetted_area=0.02)
    assert -0.1 - 1e-6 <= force.pz <= -0.1 + 1e-6
    force = ballast_viscous(boatspeed=1.,
                            heel_angle=-60.,
                            coe=(0.5, 0., -0.2),
                            bulb_length=0.37,
                            bulb_diameter=0.037,
                            bulb_wetted_area=0.02)
    assert -0.1 - 1e-6 <= force.pz <= -0.1 + 1e-6
def test_zero_wetted_area_ballast_viscous():
    r"""Zero wetted area."""
    with pytest.raises(ValueError):
        ballast_viscous(boatspeed=1.,
                        heel_angle=0.,
                        coe=(0.5, 0., -0.2),
                        bulb_length=0.37,
                        bulb_diameter=0.037,
                        bulb_wetted_area=0.)
def test_diameter_too_big_ballast_viscous():
    r"""Diameter too big."""
    with pytest.raises(ValueError):
        ballast_viscous(boatspeed=1.,
                        heel_angle=0.,
                        coe=(0.5, 0., -0.2),
                        bulb_length=0.37,
                        bulb_diameter=0.2,
                        bulb_wetted_area=0.02)
def test_negative_length_ballast_viscous():
    r"""Negative length."""
    with pytest.raises(ValueError):
        ballast_viscous(boatspeed=1.,
                        heel_angle=0.,
                        coe=(0.5, 0., -0.2),
                        bulb_length=-0.37,
                        bulb_diameter=0.037,
                        bulb_wetted_area=0.02)
def test_negative_transition_rn_ballast_viscous():
    r"""Negative transition reynolds."""
    with pytest.raises(ValueError):
        ballast_viscous(boatspeed=1.,
                        heel_angle=0.,
                        coe=(0.5, 0., -0.2),
                        bulb_length=0.37,
                        bulb_diameter=0.037,
                        bulb_wetted_area=0.02,
                        transition_reynolds_number=-100.)
def test_wrong_friction_line_ballast_viscous():
    r"""Friction line not a good value."""
    with pytest.raises(ValueError):
        ballast_viscous(boatspeed=1.,
                        heel_angle=0.,
                        coe=(0.5, 0., -0.2),
                        bulb_length=0.37,
                        bulb_diameter=0.037,
                        bulb_wetted_area=0.02,
                        turbulent_friction_line=
                        test_zero_kinematic_viscosity_ballast_viscous)
def test_resistance_sign_and_symmetry_ballast_viscous():
    r"""Test sign and symmetry."""
    force = ballast_viscous(boatspeed=1.,
                            heel_angle=30.,
                            coe=(0.5, 0., -0.2),
                            bulb_length=0.37,
                            bulb_diameter=0.037,
                            bulb_wetted_area=0.02)
    force1 = ballast_viscous(boatspeed=-1.,
                             heel_angle=30.,
                             coe=(0.5, 0., -0.2),
                             bulb_length=0.37,
                             bulb_diameter=0.037,
                             bulb_wetted_area=0.02)
    assert force.fx == -force1.fx
    assert force.fx < 0
def test_wrong_rho_water_ballast_viscous():
    r"""Rho water outside acceptable range."""
    with pytest.raises(ValueError):
        ballast_viscous(boatspeed=1.,
                        heel_angle=0.,
                        coe=(0.5, 0., -0.2),
                        bulb_length=0.37,
                        bulb_diameter=0.037,
                        bulb_wetted_area=0.02,
                        rho_water=900)
    with pytest.raises(ValueError):
        ballast_viscous(boatspeed=1.,
                        heel_angle=0.,
                        coe=(0.5, 0., -0.2),
                        bulb_length=0.37,
                        bulb_diameter=0.037,
                        bulb_wetted_area=0.02,
                        rho_water=1100)
def test_known_value_ballast_viscous():
    r"""Tests with different transition Reynolds."""
    bvra_2e5 = ballast_viscous(boatspeed=1.,
                               heel_angle=0.,
                               coe=(0.5, 0., -0.2),
                               bulb_length=0.37,
                               bulb_diameter=0.037,
                               bulb_wetted_area=0.02,
                               transition_reynolds_number=2e5)
    assert abs(bvra_2e5.fx) > abs(bvra.fx)
Example #10
0
                              average_chord=0.08,
                              thickness_to_chord=0.06,
                              wetted_area=2 * 0.02)
    force1 = appendage_viscous(boatspeed=-1.,
                               heel_angle=30.,
                               coe=(0.5, 0., -0.2),
                               average_chord=0.08,
                               thickness_to_chord=0.06,
                               wetted_area=2 * 0.02)
    assert force.fx == -force1.fx
    assert force.fx < 0


bvra = ballast_viscous(boatspeed=1.,
                       heel_angle=0.,
                       coe=(0.5, 0., -0.2),
                       bulb_length=0.37,
                       bulb_diameter=0.037,
                       bulb_wetted_area=0.02)


def test_known_value_ballast_viscous():
    r"""Tests with different transition Reynolds."""
    bvra_2e5 = ballast_viscous(boatspeed=1.,
                               heel_angle=0.,
                               coe=(0.5, 0., -0.2),
                               bulb_length=0.37,
                               bulb_diameter=0.037,
                               bulb_wetted_area=0.02,
                               transition_reynolds_number=2e5)
    assert abs(bvra_2e5.fx) > abs(bvra.fx)