Пример #1
0
    def test3():
        from . import fem as fem
        from caid.cad_geometry import line, circle, bilinear
        import caid.cad_geometry as cg

        fe = fem.fem()

        geo1 = cg.cad_geometry(geo=line())
        geo2 = cg.cad_geometry(geo=circle())
        geo3 = cg.cad_geometry(geo=bilinear())

        PDE1 = pigasus(fem=fe, geometry=geo1)
        PDE2 = pigasus(fem=fe, geometry=geo2)
        PDE3 = pigasus(fem=fe, geometry=geo3)
Пример #2
0
try:
    ny = int(sys.argv[2])
except:
    ny = 31

try:
    px = int(sys.argv[3])
except:
    px = 2

try:
    py = int(sys.argv[4])
except:
    py = 2

geo = circle(radius=1. / sqrt(2), n=[nx, ny], p=[px, py])
#-----------------------------------

# ...
u_exact = lambda x, y: [-2.0 * log(x**2 + y**2 + 0.5)]
# ...

with context():

    PDE = poisson_picard(  geometry=geo \
                         , AllDirichlet=AllDirichlet )

    # ...
    print(">>> Solving using Picard <<<")
    # ...
    if PDE.Dirichlet:
Пример #3
0
from matplotlib import pyplot as plt
import numpy as np

# ... creates a unit square of degree (2,2) and 4 elements in each direction
from caid.cad_geometry import square
geo = square(n=[3,3], p=[2,2])
geo.plotMesh(MeshResolution=10)
plt.savefig("predefined_geometries_2d_square.png")
# ...

plt.clf()

# ... creates a unit circle of degree (2,2) and (8,4) elements in each direction
from caid.cad_geometry import circle
geo = circle(n=[7,3], p=[2,2])
geo.plotMesh(MeshResolution=10)
plt.savefig("predefined_geometries_2d_circle.png")
# ...

plt.clf()

# ... creates a unit quart_circle of degree (2,2) and 4 elements in each direction
from caid.cad_geometry import quart_circle
geo = quart_circle(n=[3,3], p=[2,2])
geo.plotMesh(MeshResolution=10)
plt.savefig("predefined_geometries_2d_quart_circle.png")
# ...

plt.clf()

# ... creates a unit annulus of degree (2,2) and 4 elements in each direction
Пример #4
0
# ...
geo.plotMesh()
# ...

# ... define the matplotlib grid
nrb = geo[0]
xmin = nrb.points[...,0].min() - 0.1 ; xmax = nrb.points[...,0].max() + 0.1
ymin = nrb.points[...,1].min() - 0.1 ; ymax = nrb.points[...,1].max() + 0.1
plt.xlim(xmin, xmax)
plt.ylim(ymin, ymax)

plt.savefig("transformations_2d_rotate.png") ; plt.clf()
# ...

# ... creates a unit circle of degree (2,2) and 4 elements in each direction
geo = circle(n=[3,3], p=[2,2])
# ...

# ... scaling with (2,4) in each direction
geo.scale(2., axis=0)
geo.scale(4., axis=1)
# ...

# ...
geo.plotMesh()
# ...

# ... define the matplotlib grid
nrb = geo[0]
xmin = nrb.points[...,0].min() - 0.1 ; xmax = nrb.points[...,0].max() + 0.1
ymin = nrb.points[...,1].min() - 0.1 ; ymax = nrb.points[...,1].max() + 0.1
Пример #5
0
# ... define the matplotlib grid
nrb = geo[0]
xmin = nrb.points[..., 0].min() - 0.1
xmax = nrb.points[..., 0].max() + 0.1
ymin = nrb.points[..., 1].min() - 0.1
ymax = nrb.points[..., 1].max() + 0.1
plt.xlim(xmin, xmax)
plt.ylim(ymin, ymax)

plt.savefig("transformations_2d_rotate.png")
plt.clf()
# ...

# ... creates a unit circle of degree (2,2) and 4 elements in each direction
geo = circle(n=[3, 3], p=[2, 2])
# ...

# ... scaling with (2,4) in each direction
geo.scale(2., axis=0)
geo.scale(4., axis=1)
# ...

# ...
geo.plotMesh()
# ...

# ... define the matplotlib grid
nrb = geo[0]
xmin = nrb.points[..., 0].min() - 0.1
xmax = nrb.points[..., 0].max() + 0.1
Пример #6
0
    # exact solution
    # ...
    C0 = 1.0

    # ... test 1
    rho0 = lambda x, y: 1.
    C1 = 0.616805883732
    t = 0.5
    rho1 = lambda x, y: (1. + 5 * exp(-50 * abs((x - 0.5 - t)**2 +
                                                (y - 0.5)**2 - 0.09)))
    # ...

    # ...
    if withTwoGrids:
        #        geo_H = square(n=n_H, p=p_H)
        geo_H = circle(radius=2.0, n=n_H, p=p_H)
        P = geo_H[0].points
        P[..., :2] += 1.
        geo_H[0].set_points(P)
#    geo_h = square(n=n_h, p=p_h)
    geo_h = circle(radius=2.0, n=n_h, p=p_h)
    P = geo_h[0].points
    P[..., :2] += 1.
    geo_h[0].set_points(P)
    # ...

    # ...
    adaptMesh = adaptiveMeshMA(geo_h,
                               geo_H=geo_H,
                               verbose=verbose,
                               bc_neumann=bc_neumann)
Пример #7
0
from matplotlib import pyplot as plt
import numpy as np

# ... creates a unit square of degree (2,2) and 4 elements in each direction
from caid.cad_geometry import square
geo = square(n=[3, 3], p=[2, 2])
geo.plotMesh(MeshResolution=10)
plt.savefig("predefined_geometries_2d_square.png")
# ...

plt.clf()

# ... creates a unit circle of degree (2,2) and (8,4) elements in each direction
from caid.cad_geometry import circle
geo = circle(n=[7, 3], p=[2, 2])
geo.plotMesh(MeshResolution=10)
plt.savefig("predefined_geometries_2d_circle.png")
# ...

plt.clf()

# ... creates a unit quart_circle of degree (2,2) and 4 elements in each direction
from caid.cad_geometry import quart_circle
geo = quart_circle(n=[3, 3], p=[2, 2])
geo.plotMesh(MeshResolution=10)
plt.savefig("predefined_geometries_2d_quart_circle.png")
# ...

plt.clf()

# ... creates a unit annulus of degree (2,2) and 4 elements in each direction
Пример #8
0
from pigasus.fem.field import *
from caid.cad_geometry import circle
import pylab as pl
import numpy as np

exp = np.exp
log = np.log
sqrt = np.sqrt

#-----------------------------------
nx = 31
ny = 31
px = 2
py = 2

geo = circle(n=[nx, ny], p=[px, py])
#-----------------------------------

#-----------------------------------
AllDirichlet = True
nu = 1.e-5
eta = 1.e-5
jj1 = 0.2
jj2 = 0.266

dt = 2.5e-2
niter = 100
nfreq = 10
t = 0.
#-----------------------------------