Пример #1
0
def test_manager_folder():
    test_folder = os.path.join(os.getcwd(), str(uuid.uuid4())[-6:])
    manager.start_run(
        nx=48,
        nv=512,
        nt=100,
        tmax=10,
        nu=0.0,
        w0=1.1598,
        k0=0.3,
        a0=1e-5,
        diagnostics=landau_damping.LandauDamping(),
        name="Landau Damping",
        mlflow_path=test_folder,
    )

    assert os.path.exists(test_folder)
    shutil.rmtree(test_folder)
Пример #2
0
def test_manager_folder():
    test_folder = os.path.join(os.getcwd(), str(uuid.uuid4())[-6:])
    all_params_dict = {
        "nx": 48,
        "xmin": 0.0,
        "xmax": 2.0 * np.pi / 0.3,
        "nv": 512,
        "vmax": 6.0,
        "nt": 1000,
        "tmax": 100,
        "nu": 0.0,
    }

    pulse_dictionary = {
        "first pulse": {
            "start_time": 0,
            "rise_time": 5,
            "flat_time": 10,
            "fall_time": 5,
            "a0": 1e-6,
            "k0": 0.3,
            "w0": 1.1598,
        }
    }

    params_to_log = ["k0"]

    manager.start_run(
        all_params=all_params_dict,
        pulse_dictionary=pulse_dictionary,
        diagnostics=landau_damping.LandauDamping(params_to_log),
        name="Landau Damping",
        mlflow_path=test_folder,
    )

    assert os.path.exists(test_folder)
    shutil.rmtree(test_folder)
Пример #3
0
        "nv": 512,
        "vmax": 6.0,
        "nt": 1000,
        "tmax": 100,
        "nu": 0.0,
    }

    pulse_dictionary = {
        "first pulse": {
            "start_time": 0,
            "rise_time": 5,
            "flat_time": 10,
            "fall_time": 5,
            "a0": 1e-6,
            "k0": 0.3,
        }
    }

    params_to_log = ["w0", "k0", "a0"]

    pulse_dictionary["first pulse"]["w0"] = np.real(
        z_function.get_roots_to_electrostatic_dispersion(
            wp_e=1.0, vth_e=1.0, k0=pulse_dictionary["first pulse"]["k0"]))

    manager.start_run(
        all_params=all_params_dict,
        pulse_dictionary=pulse_dictionary,
        diagnostics=landau_damping.LandauDamping(params_to_log),
        name="Landau Damping-test",
    )
Пример #4
0
def __run_integrated_landau_damping_test_and_return_damping_rate__(
    k0,
    fp_type,
    time_integrator,
    edfdv_integrator,
    vdfdx_integrator,
    backend,
):
    """
    This is the fully integrated flow for a Landau damping run

    :param k0:
    :param log_nu_over_nu_ld:
    :return:
    """
    all_params_dict = initializers.make_default_params_dictionary()
    all_params_dict = initializers.specify_epw_params_to_dict(
        k0=k0, all_params_dict=all_params_dict)
    all_params_dict = initializers.specify_collisions_to_dict(
        log_nu_over_nu_ld=None, all_params_dict=all_params_dict)
    all_params_dict["backend"]["core"] = backend

    try:
        all_params_dict["vlasov-poisson"]["time"] = time_integrator
        all_params_dict["vlasov-poisson"]["edfdv"] = edfdv_integrator
        all_params_dict["vlasov-poisson"]["vdfdx"] = vdfdx_integrator
        all_params_dict["fokker-planck"]["type"] = fp_type

        pulse_dictionary = {
            "first pulse": {
                "start_time": 0,
                "t_L": 6,
                "t_wL": 2.5,
                "t_R": 20,
                "t_wR": 2.5,
                "w0": all_params_dict["w_epw"],
                "a0": 1e-7,
                "k0": k0,
            }
        }

        mlflow_exp_name = "vlapy-unit-test"

        uris = {
            "tracking": "local",
        }

        that_run = manager.start_run(
            all_params=all_params_dict,
            pulse_dictionary=pulse_dictionary,
            diagnostics=landau_damping.LandauDamping(
                vph=all_params_dict["v_ph"],
                wepw=all_params_dict["w_epw"],
            ),
            uris=uris,
            name=mlflow_exp_name,
        )

        return (
            mlflow_helpers.get_this_metric_of_this_run("damping_rate",
                                                       that_run),
            all_params_dict["nu_ld"],
        )
    except NotImplementedError:
        return 0.0, 0.0
Пример #5
0
    pulse_dictionary = {
        "first pulse": {
            "start_time": 0,
            "t_L": 6,
            "t_wL": 2.5,
            "t_R": 25,
            "t_wR": 2.5,
            "w0": all_params_dict["w_epw"],
            "a0": 4e-2,
            "k0": k0,
        }
    }

    mlflow_exp_name = "non-linear electron plasma wave"

    uris = {
        "tracking": "local",
    }

    that_run = manager.start_run(
        all_params=all_params_dict,
        pulse_dictionary=pulse_dictionary,
        diagnostics=nlepw.NLEPW(
            vph=all_params_dict["v_ph"],
            wepw=all_params_dict["w_epw"],
        ),
        uris=uris,
        name=mlflow_exp_name,
    )
Пример #6
0
            "t_wL": 2.5,
            "t_R": 20,
            "t_wR": 2.5,
            "w0": all_params_dict["w_epw"],
            "a0": 1e-7,
            "k0": k0,
        }
    }

    mlflow_exp_name = "landau-damping"

    uris = {
        "tracking": "local",
    }

    that_run = manager.start_run(
        all_params=all_params_dict,
        pulse_dictionary=pulse_dictionary,
        diagnostics=landau_damping.LandauDamping(
            vph=all_params_dict["v_ph"],
            wepw=all_params_dict["w_epw"],
        ),
        uris=uris,
        name=mlflow_exp_name,
    )

    print(
        mlflow_helpers.get_this_metric_of_this_run("damping_rate", that_run),
        all_params_dict["nu_ld"],
    )
Пример #7
0
from vlapy import manager
from diagnostics import landau_damping

if __name__ == "__main__":

    manager.start_run(
        nx=48,
        nv=512,
        nt=1000,
        tmax=100,
        nu=0.001,
        w0=1.1598,
        k0=0.3,
        a0=1e-5,
        diagnostics=landau_damping.LandauDamping(),
        name="Landau Damping",
    )