Example #1
0
def update_sigma(the_field_sigma):
    compute_grad_phi = ocaml.prematrix_to_applicator(
        [],  # interface_coeffs
        [the_field_sigma],
        "",
        prematrix_grad_phi)
    #
    #
    laplace_solver = ocaml.laplace_solver(
        [],  # if coeffs
        [(-1, 1, laplace_dbc)],  # dbcs
        [the_field_sigma],  # mid field
        "",  # Petsc name
        prematrix_laplace)
    #
    #
    result_field_phi = laplace_solver([], laplace_dbc_value,
                                      cofield_drho_by_dt)
    last_field_phi[0] = result_field_phi
    #
    #
    field_J = ocaml.cofield_to_field(
        [],
        compute_grad_phi(
            [],  # no target
            result_field_phi))
    #
    #
    # Next, let us compute the new condictivity by site-wise operation on
    # field_J. We just overwrite field_sigma:
    #
    recompute_conductivity = ocaml.site_wise_applicator(
        [mwe_sigma, mwe_J],  # all the fields we use
        [],
        ["H_x", "H_y", "sigma0", "alpha"],
        # all the names of extra parameters
        "",
        code_recompute_conductivity,
        True)
    #
    #
    recompute_conductivity([h_x, h_y, sigma0, alpha],
                           [the_field_sigma, field_J], [])
    return the_field_sigma
Example #2
0
def update_sigma(the_field_sigma):
    compute_grad_phi = ocaml.prematrix_to_applicator([], [the_field_sigma], "", prematrix_grad_phi)  # interface_coeffs
    #
    #
    laplace_solver = ocaml.laplace_solver(
        [],  # if coeffs
        [(-1, 1, laplace_dbc)],  # dbcs
        [the_field_sigma],  # mid field
        "",  # Petsc name
        prematrix_laplace,
    )
    #
    #
    result_field_phi = laplace_solver([], laplace_dbc_value, cofield_drho_by_dt)
    last_field_phi[0] = result_field_phi
    #
    #
    field_J = ocaml.cofield_to_field([], compute_grad_phi([], result_field_phi))  # no target
    #
    #
    # Next, let us compute the new condictivity by site-wise operation on
    # field_J. We just overwrite field_sigma:
    #
    recompute_conductivity = ocaml.site_wise_applicator(
        [mwe_sigma, mwe_J],  # all the fields we use
        [],
        ["H_x", "H_y", "sigma0", "alpha"],
        # all the names of extra parameters
        "",
        code_recompute_conductivity,
        True,
    )
    #
    #
    recompute_conductivity([h_x, h_y, sigma0, alpha], [the_field_sigma, field_J], [])
    return the_field_sigma
Example #3
0
def cofield_to_field(cofield, target=None, box_method=False):
    opt_target = []
    if target:
        opt_target = [target]
    return ocaml.cofield_to_field(opt_target, cofield, box_method)
Example #4
0
def cofield_to_field(cofield, target=None, box_method=False):
    opt_target = []
    if target:
        opt_target = [target]
    return ocaml.cofield_to_field(opt_target, cofield, box_method)