density = "density=1.;" the_mesh = nmesh.mesh(objects = [boxed_rings], cache_name="rings-mesh", a0=0.3, bounding_box=[[-10.0,-3.5],[10.0,3.5]], neigh_force_scale = 1., density = density, initial_settling_steps = 50, max_relaxation = 4, # callback=(my_function, N), # max_steps=677 max_steps=200 ) nfem.set_default_mesh(the_mesh) ##### Making the elements... ##### empty_element=ocaml.empty_element; # conductivity (scalar) element_sigma = nfem.make_element("sigma",[]); element_drho_by_dt= nfem.make_element("drho_by_dt",[]); element_phi = nfem.make_element("phi",[]); element_J = nfem.make_element("J",[2]); mwe_sigma = nfem.make_mwe("mwe_sigma", [(1,element_sigma)]) mwe_drho_by_dt = nfem.make_mwe("mwe_drho_by_dt",[(1,element_drho_by_dt)]) mwe_phi = nfem.make_mwe("mwe_phi", [(1,element_phi)]) mwe_J = nfem.make_mwe("mwe_J", [(1,element_J)])
ring = nmesh.difference( nmesh.ellipsoid([4.0, 4.0]), [nmesh.ellipsoid([2.5, 2.5])]) halfring = nmesh.intersect([ring, nmesh.box([-4.0, -0.0], [4.0, 4.0])]) the_mesh = nmesh.mesh( objects=[halfring], cache_name="halfring", a0=0.2, bounding_box=[[-4.0, -4], [4.0, 4.0]], neigh_force_scale=1., initial_settling_steps=50, max_relaxation=4, max_steps=400) nfem.set_default_mesh(the_mesh) the_mesh.save("themesh.nmesh") # conductivity (scalar) element_sigma = nfem.make_element("sigma", []) element_drho_by_dt = nfem.make_element("drho_by_dt", []) element_phi = nfem.make_element("phi", []) element_J = nfem.make_element("J", [2]) mwe_sigma = nfem.make_mwe("mwe_sigma", [(1, element_sigma)]) mwe_drho_by_dt = nfem.make_mwe("mwe_drho_by_dt", [(1, element_drho_by_dt)]) mwe_phi = nfem.make_mwe("mwe_phi", [(1, element_phi)]) mwe_J = nfem.make_mwe("mwe_J", [(1, element_J)]) diffop_laplace = nfem.diffop("-<d/dxj drho_by_dt|sigma|d/dxj phi>, j:2")
) mesh_3d = nmesh.mesh(objects = [double_disc_3d], cache_name="double-disc-3d", a0=0.4, bounding_box=[[-5.0,-5.0,-0.3],[5.0,5.0,0.3]], neigh_force_scale = 1., density = density, initial_settling_steps = 50, max_relaxation = 4, max_steps=500 ) # === The 2.5d computation === nfem.set_default_mesh(mesh_2d) ##### Making the elements... ##### elem2d_M = nfem.make_element("M",[3],dim=2); elem2d_H = nfem.make_element("H",[3],dim=2); elem2d_rho_M = nfem.make_element("rho_M",[],dim=2); elem2d_phi_M = nfem.make_element("phi_M",[],dim=2); mwe2d_M = nfem.make_mwe("mwe2d_M", [(1,elem2d_M)]) mwe2d_H = nfem.make_mwe("mwe2d_H", [(1,elem2d_H)]) mwe2d_rho_M = nfem.make_mwe("mwe2d_rho_M", [(1,elem2d_rho_M)]) mwe2d_phi_M = nfem.make_mwe("mwe2d_phi_M", [(1,elem2d_phi_M)]) #This is " $\ laplace -phi = =rho_M$ pmx2d_laplace=nfem.prematrix(diffop_laplace,mwe2d_rho_M,mwe2d_phi_M)