Example #1
0
def prematrix(diffop_or_string, mwe_left, mwe_right, mwe_mid=None, ignore_jumps=True):
    diffop = _the_diffop(diffop_or_string)
    log.log(15, "Creating prematrix for XXX")
    opt_mid = []
    if mwe_mid:
        opt_mid = [mwe_mid]
    return ocaml.raw_make_prematrix(diffop, mwe_left, mwe_right, opt_mid, ignore_jumps)
Example #2
0
    else:
        return -0.5


# We need an empty source field for the laplace solver:

cofield_drho_by_dt = ocaml.raw_make_cofield(
    mwe_drho_by_dt, [], ""  # do not sample a function  # petsc name - auto-generated if "".
)

prematrix_laplace = ocaml.raw_make_prematrix(
    diffop_laplace,
    mwe_drho_by_dt,
    mwe_phi,
    [mwe_sigma],  # opt. middle field
    True,
    # ^ ignore_jumps:
    # don't do the calculations
    # for surface divergency-like matrix element contributions.
    # We do not need them here.
)


prematrix_grad_phi = ocaml.raw_make_prematrix(diffop_grad_phi, mwe_J, mwe_phi, [mwe_sigma], True)

code_recompute_conductivity = """
double len2_J, sprod_HJ, cos2;
double len2_H=H_x*H_x+H_y*H_y;

len2_J=J(0)*J(0)+J(1)*J(1);
sprod_HJ=H_x*J(0)+H_y*J(1);