Example #1
0
# This example demonstrates periodic exchange.

import os, time, sys, math
import nmesh
import ocaml
import nfem, nfem.visual

execfile("../../interface/nsim/linalg_machine.py")

#ocaml.init_hlib("/home/fangohr/build/HLib-1.3/Library/.libs/libhmatrix-1.3.so")
ocaml.init_hlib("/home/tf/HLib-1.3/Library/.libs/libhmatrix-1.3.so")

#raw_mesh=ocaml.mesh_readfile("periodic/periodic.nmesh",False)
mesh = nmesh.load_ascii("periodic/periodic-1d-2.nmesh")
raw_mesh = mesh.raw_mesh

print "MESH: ", raw_mesh
sys.stdout.flush()

if ocaml.petsc_is_mpi():
    print "*** PARALLEL EXECUTION *** (not yet supported here!)"
    sys.exit(0)  # DDD add parallel support!

elem_phi = ocaml.make_element("phi", [], 1, 1)  # scalar element

mwe_phi = ocaml.make_mwe("phi", raw_mesh, [(0, ocaml.empty_element),
                                           (1, elem_phi)], [])
mwe_dphi_dt = ocaml.mwe_sibling(mwe_phi, "dphi_dt", "dphi_dt/phi",
                                [("phi", "dphi_dt")])
mwe_laplace_phi = ocaml.mwe_sibling(mwe_phi, "laplace_phi", "laplace_phi/phi",
                                    [("phi", "laplace_phi")])
Example #2
0
# This example demonstrates periodic exchange.

import os, time, sys, math
import nmesh
import ocaml
import nfem, nfem.visual

execfile("../../interface/nsim/linalg_machine.py")

# ocaml.init_hlib("/home/fangohr/build/HLib-1.3/Library/.libs/libhmatrix-1.3.so")
ocaml.init_hlib("/home/tf/HLib-1.3/Library/.libs/libhmatrix-1.3.so")

# raw_mesh=ocaml.mesh_readfile("periodic/periodic.nmesh",False)
mesh = nmesh.load_ascii("periodic/periodic-1d-2.nmesh")
raw_mesh = mesh.raw_mesh

print "MESH: ", raw_mesh
sys.stdout.flush()

if ocaml.petsc_is_mpi():
    print "*** PARALLEL EXECUTION *** (not yet supported here!)"
    sys.exit(0)  # DDD add parallel support!

elem_phi = ocaml.make_element("phi", [], 1, 1)  # scalar element

mwe_phi = ocaml.make_mwe("phi", raw_mesh, [(0, ocaml.empty_element), (1, elem_phi)], [])
mwe_dphi_dt = ocaml.mwe_sibling(mwe_phi, "dphi_dt", "dphi_dt/phi", [("phi", "dphi_dt")])
mwe_laplace_phi = ocaml.mwe_sibling(mwe_phi, "laplace_phi", "laplace_phi/phi", [("phi", "laplace_phi")])


def fun_phi0(dof_name, dof_pos):
Example #3
0
# This example demonstrates periodic exchange.

import os,time,sys,math
import nmesh
import ocaml
import nfem, nfem.visual

execfile("../../interface/nsim/linalg_machine.py")

#ocaml.init_hlib("/home/fangohr/build/HLib-1.3/Library/.libs/libhmatrix-1.3.so")
#ocaml.init_hlib("/home/tf/HLib-1.3/Library/.libs/libhmatrix-1.3.so")

mesh=nmesh.load_ascii("periodic/periodic.nmesh")
raw_mesh=mesh.raw_mesh

print "MESH: ",raw_mesh
sys.stdout.flush()

if ocaml.petsc_is_mpi():
    print "*** PARALLEL EXECUTION *** (not yet supported here!)"
    sys.exit(0) # DDD add parallel support!

    nr_nodes=ocaml.petsc_mpi_nr_nodes()
    nr_points=ocaml.mesh_nr_points(raw_mesh)
    z=nr_points/nr_nodes
    distrib = [int(round(z*(i+1)))-int(round(z*i)) for i in range(0,nr_nodes)]
    slack=nr_points-reduce(lambda x,y:x+y,distrib)
    distrib[0] = distrib[0] + slack
    print "*** RAW MESH %s *** DISTRIB %s ***" %(repr(raw_mesh),repr(distrib))
    ocaml.mesh_set_vertex_distribution(raw_mesh,distrib)
import os,time,sys,math
import nmesh
import ocaml
import nfem, nfem.visual

execfile("../../interface/nsim/linalg_machine.py")

#ocaml.init_hlib("/home/fangohr/build/HLib-1.3/Library/.libs/libhmatrix-1.3.so")
ocaml.init_hlib("/home/tf/HLib-1.3/Library/.libs/libhmatrix-1.3.so")

#raw_mesh=ocaml.mesh_readfile("periodic/periodic.nmesh",False)
#mesh=nmesh.load_ascii("periodic/periodic.nmesh")
#mesh=nmesh.load_ascii("periodic/periodic2.nmesh")
#mesh=nmesh.load_ascii("periodic/simple2d.nmesh")
mesh=nmesh.load_ascii("periodic/simple2d-split.nmesh")
raw_mesh=mesh.raw_mesh

print "MESH: ",raw_mesh
sys.stdout.flush()

if ocaml.petsc_is_mpi():
    print "*** PARALLEL EXECUTION *** (not yet supported here!)"
    sys.exit(0) # DDD add parallel support!

    nr_nodes=ocaml.petsc_mpi_nr_nodes()
    nr_points=ocaml.mesh_nr_points(raw_mesh)
    z=nr_points/nr_nodes
    distrib = [int(round(z*(i+1)))-int(round(z*i)) for i in range(0,nr_nodes)]
    slack=nr_points-reduce(lambda x,y:x+y,distrib)
    distrib[0] = distrib[0] + slack
Example #5
0
# This example demonstrates periodic exchange.

import os, time, sys, math
import nmesh
import ocaml
import nfem, nfem.visual

execfile("../../interface/nsim/linalg_machine.py")

#ocaml.init_hlib("/home/fangohr/build/HLib-1.3/Library/.libs/libhmatrix-1.3.so")
#ocaml.init_hlib("/home/tf/HLib-1.3/Library/.libs/libhmatrix-1.3.so")

mesh = nmesh.load_ascii("periodic/periodic.nmesh")
raw_mesh = mesh.raw_mesh

print "MESH: ", raw_mesh
sys.stdout.flush()

if ocaml.petsc_is_mpi():
    print "*** PARALLEL EXECUTION *** (not yet supported here!)"
    sys.exit(0)  # DDD add parallel support!

    nr_nodes = ocaml.petsc_mpi_nr_nodes()
    nr_points = ocaml.mesh_nr_points(raw_mesh)
    z = nr_points / nr_nodes
    distrib = [
        int(round(z * (i + 1))) - int(round(z * i))
        for i in range(0, nr_nodes)
    ]
    slack = nr_points - reduce(lambda x, y: x + y, distrib)
    distrib[0] = distrib[0] + slack