示例#1
0
                def compute_total_current(the_field_sigma):

                    laplace_solver = nfem2.laplace_solver(
                        prematrix_laplace,
                        # boundary conditions are defined on objects 4 and 6
                        dirichlet_bcs=[(-1, 4, laplace_dbc),
                                       (-1, 6, laplace_dbc)],
                        mwe_mid=the_field_sigma)
                    compute_div_J = nfem2.prematrix_applicator(
                        prematrix_laplace, field_mid=the_field_sigma)

                    cofield_drho_by_dt = nfem2.make_cofield(mwe_drho_by_dt)

                    field_phi = laplace_solver(cofield_drho_by_dt,
                                               dbc_values=laplace_dbc_values)

                    compute_J = nfem2.prematrix_applicator(
                        prematrix_J, field_mid=the_field_sigma)

                    field_J = nfem2.cofield_to_field(compute_J(field_phi))

                    cofield_div_J = compute_div_J(field_phi)

                    field_div_J = nfem2.cofield_to_field(cofield_div_J)
                    current = accumulate_J_total([0.0, 0.0, 0.0, 0.0],
                                                 cofields=[cofield_div_J])

                    return current, field_phi, the_field_sigma, field_J
示例#2
0
def update_sigma(the_field_sigma, i):
    compute_J = nfem2.prematrix_applicator(prematrix_J,
                                           field_mid=the_field_sigma)
    laplace_solver = nfem2.laplace_solver(prematrix_laplace,
                                          dirichlet_bcs=[(-1, 1, laplace_dbc)],
                                          mwe_mid=the_field_sigma)
    cofield_drho_by_dt = nfem2.make_cofield(mwe_drho_by_dt)
    #
    field_phi = laplace_solver(cofield_drho_by_dt,
                               dbc_values=laplace_dbc_values)
    print "Before cofield_to_field -", time.time(), "\n"
    sys.stdout.flush()
    field_J = nfem2.cofield_to_field(compute_J(field_phi))
    print "After cofield_to_field -", time.time(), "\n"

    sys.stdout.flush()

    #print "field_J contents:", nfem2.data_doftypes(field_J)

    # XXX NOTE: we should be able to make an applicator that does the
    # cofield_to_field conversion automatically!
    #
    #
    # Next, let us compute the new condictivity by site-wise operation on
    # field_J. We just overwrite field_sigma:
    #
    recompute_conductivity([sigma0, alpha],
                           fields=[the_field_sigma, field_J, field_m])

    print "Refcount field_sigma:", ocaml.sys_refcount(the_field_sigma)
    return the_field_sigma
示例#3
0
def update_sigma(the_field_sigma, i):
    compute_J = nfem2.prematrix_applicator(prematrix_J, field_mid=the_field_sigma)
    laplace_solver = nfem2.laplace_solver(
        prematrix_laplace, dirichlet_bcs=[(-1, 1, laplace_dbc)], mwe_mid=the_field_sigma
    )
    cofield_drho_by_dt = nfem2.make_cofield(mwe_drho_by_dt)
    #
    field_phi = laplace_solver(cofield_drho_by_dt, dbc_values=laplace_dbc_values)
    print "Before cofield_to_field -", time.time(), "\n"
    sys.stdout.flush()
    field_J = nfem2.cofield_to_field(compute_J(field_phi))
    print "After cofield_to_field -", time.time(), "\n"

    sys.stdout.flush()

    # print "field_J contents:", nfem2.data_doftypes(field_J)

    # XXX NOTE: we should be able to make an applicator that does the
    # cofield_to_field conversion automatically!
    #
    #
    # Next, let us compute the new condictivity by site-wise operation on
    # field_J. We just overwrite field_sigma:
    #
    recompute_conductivity([sigma0, alpha], fields=[the_field_sigma, field_J, field_m])

    print "Refcount field_sigma:", ocaml.sys_refcount(the_field_sigma)
    return the_field_sigma
示例#4
0
                def compute_total_current(the_field_sigma):

                    laplace_solver=nfem2.laplace_solver(prematrix_laplace,
                                                        # boundary conditions are defined on objects 4 and 6
                                                        dirichlet_bcs=[(-1,4,laplace_dbc),(-1,6,laplace_dbc)],
                                                        mwe_mid=the_field_sigma)
                    compute_div_J=nfem2.prematrix_applicator(prematrix_laplace,
                                                             field_mid=the_field_sigma)

                    cofield_drho_by_dt=nfem2.make_cofield(mwe_drho_by_dt)

                    field_phi=laplace_solver(cofield_drho_by_dt,
                                             dbc_values=laplace_dbc_values)

                    compute_J=nfem2.prematrix_applicator(prematrix_J,
                                                         field_mid=the_field_sigma)

                    field_J = nfem2.cofield_to_field(compute_J(field_phi))

                    cofield_div_J=compute_div_J(field_phi)

                    field_div_J = nfem2.cofield_to_field(cofield_div_J)
                    current = accumulate_J_total([0.0,0.0,0.0,0.0],cofields=[cofield_div_J])

                    return current, field_phi, the_field_sigma, field_J
示例#5
0
def compute_total_current(the_field_sigma):
    laplace_solver = nfem2.laplace_solver(prematrix_laplace,
                                          dirichlet_bcs=[(-1, 1, laplace_dbc)],
                                          mwe_mid=the_field_sigma)
    compute_div_J = nfem2.prematrix_applicator(prematrix_laplace,
                                               field_mid=the_field_sigma)
    field_phi = laplace_solver(cofield_drho_by_dt,
                               dbc_values=laplace_dbc_values)

    cofield_div_J = compute_div_J(field_phi)
    return accumulate_J_total([0.0, 0.0, 0.0, 0.0], cofields=[cofield_div_J])
示例#6
0
def compute_total_current(the_field_sigma):
    laplace_solver=nfem2.laplace_solver(prematrix_laplace,
                                        dirichlet_bcs=[(-1,1,laplace_dbc)],
                                        mwe_mid=the_field_sigma)
    compute_div_J=nfem2.prematrix_applicator(prematrix_laplace,
                                             field_mid=the_field_sigma)
    field_phi=laplace_solver(cofield_drho_by_dt,
                             dbc_values=laplace_dbc_values)

    cofield_div_J=compute_div_J(field_phi)
    return accumulate_J_total([0.0,0.0,0.0,0.0],cofields=[cofield_div_J])
示例#7
0
                def update_sigma(the_field_sigma,i):
                    compute_J=nfem2.prematrix_applicator(prematrix_J,
                                                         field_mid=the_field_sigma)
                    laplace_solver=nfem2.laplace_solver(prematrix_laplace,
                                                        dirichlet_bcs=[(-1,4,laplace_dbc),(-1,6,laplace_dbc)],
                                                        mwe_mid=the_field_sigma)
                    cofield_drho_by_dt=nfem2.make_cofield(mwe_drho_by_dt)
                    #
                    field_phi = laplace_solver(cofield_drho_by_dt,
                                               dbc_values=laplace_dbc_values)

                    field_J = nfem2.cofield_to_field(compute_J(field_phi))

                    # Next, let us compute the new condictivity by site-wise operation on
                    # field_J. We just overwrite field_sigma:
                    recompute_conductivity([sigma0_Py,sigma0_Au,alpha],fields=[the_field_sigma,field_J,field_m])

                    return the_field_sigma
示例#8
0
                def update_sigma(the_field_sigma, i):
                    compute_J = nfem2.prematrix_applicator(
                        prematrix_J, field_mid=the_field_sigma)
                    laplace_solver = nfem2.laplace_solver(
                        prematrix_laplace,
                        dirichlet_bcs=[(-1, 4, laplace_dbc),
                                       (-1, 6, laplace_dbc)],
                        mwe_mid=the_field_sigma)
                    cofield_drho_by_dt = nfem2.make_cofield(mwe_drho_by_dt)
                    #
                    field_phi = laplace_solver(cofield_drho_by_dt,
                                               dbc_values=laplace_dbc_values)

                    field_J = nfem2.cofield_to_field(compute_J(field_phi))

                    # Next, let us compute the new condictivity by site-wise operation on
                    # field_J. We just overwrite field_sigma:
                    recompute_conductivity(
                        [sigma0_Py, sigma0_Au, alpha],
                        fields=[the_field_sigma, field_J, field_m])

                    return the_field_sigma