mwe_drho_by_dt = ocaml.make_mwe("mwe_drho_by_dt", the_mesh.raw_mesh, [(0, empty_element), (1, element_drho_by_dt)]) mwe_phi = ocaml.make_mwe("mwe_phi", the_mesh.raw_mesh, [(0, empty_element), (1, element_phi)]) mwe_J = ocaml.make_mwe("mwe_J", the_mesh.raw_mesh, [(0, empty_element), (1, element_J)]) print "mwe_J: ", mwe_J sys.stdout.flush() # Our differential operators: diffop_laplace = ocaml.make_diffop("-<d/dxj drho_by_dt|sigma|d/dxj phi>, j:2") diffop_grad_phi = ocaml.make_diffop("<J(k)|sigma|d/dxk phi>, k:2") # Initial conductivity is spatially constant: def fun_sigma0(dof_name_indices, position): return sigma0 # Later on, we will modify this field: field_sigma = ocaml.raw_make_field( mwe_sigma, [fun_sigma0], "" # petsc name - auto-generated if "".
# though it's perhaps not a good idea here, # physically speaking. mwe_drho_by_dt = ocaml.make_mwe("mwe_drho_by_dt", the_mesh.raw_mesh, [(0, empty_element), (1, element_drho_by_dt)]) mwe_phi = ocaml.make_mwe("mwe_phi", the_mesh.raw_mesh, [(0, empty_element), (1, element_phi)]) mwe_J = ocaml.make_mwe("mwe_J", the_mesh.raw_mesh, [(0, empty_element), (1, element_J)]) print "mwe_J: ", mwe_J sys.stdout.flush() # Our differential operators: diffop_laplace = ocaml.make_diffop("-<d/dxj drho_by_dt|sigma|d/dxj phi>, j:2") diffop_grad_phi = ocaml.make_diffop("<J(k)|sigma|d/dxk phi>, k:2") # Initial conductivity is spatially constant: def fun_sigma0(dof_name_indices, position): return sigma0 # Later on, we will modify this field: field_sigma = ocaml.raw_make_field(mwe_sigma, [fun_sigma0], "") # petsc name - auto-generated if "". print "field_sigma: ", field_sigma print "Sigma at origin: ", ocaml.probe_field(field_sigma, "sigma", [0.0, 0.0])
def diffop(code): log.log(15, "Computing differential operator for %s " % str(code)) return ocaml.make_diffop(code)