예제 #1
0
#!/usr/bin/env nsim

import nmesh, Numeric, math, time, sys
import nfem
import nfem.visual

nfem.set_default_dimension(2)
nfem.set_default_order(1)

# Simulation parameters
sigma0 = 1.0

print
"""
** Example: meshing half ring and compute current density for contacts at either side.
This is for possible collaboration with Uni Hamburg. **
"""

##### Creating the mesh #####

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.,
예제 #2
0
#!../bin/nmesh2

import nmesh, Numeric, math,time, sys
import nfem

nfem.set_default_dimension(2)
nfem.set_default_order(1)
#nfem.set_default_order(2)

# Simulation parameters

h_x=1.6
h_y=1.2

sigma0=1.0
#alpha=0.01
alpha=-0.1


print
"""
** Example: meshing four rings & solving the laplace equation
   for a space-dependent resistivity that depends on outer parameters

   (Presumably, we will encounter bugs at our first try)
**
"""

##### Creating the mesh #####

# For now, we use a very very simple mesh...