Exemplo n.º 1
0
    def updateGeometry(self):
        """Update geometry from set parameters"""        
        rect = cfs.Rectangle(self.w, self.h, elementType=3, dofsPerNode=2, maxArea=self.maxArea)
        rect.t = self.t
        rect.v = self.v
        rect.E = self.E

        rect.ptype = 1
        rect.ep = [rect.ptype, rect.t]
        rect.D = cfc.hooke(rect.ptype, rect.E, rect.v)
        
        self.rect = rect
Exemplo n.º 2
0
import calfem.core as cfc
import calfem.vis as cfv
import calfem.utils as cfu
import calfem.shapes as cfs
import calfem.solver as cfslv

cfu.enableLogging()

# ---- General parameters ---------------------------------------------------

# Define marker constants instead of using numbers in the code

cfu.info("Creating rectangle")

rect = cfs.Rectangle(5.0, 1.0, elementType=3, dofsPerNode=2, maxArea=0.08)
rect.t = 0.2
rect.v = 0.35
rect.E = 2e9
rect.ptype = 1
rect.ep = [rect.ptype, rect.t]
rect.D = cfc.hooke(rect.ptype, rect.E, rect.v)

cfu.info("Creating mesh...")

mesh = cfs.ShapeMesh(rect)

# ---- Solve problem --------------------------------------------------------

solver = cfslv.Plan2DSolver(mesh)
Exemplo n.º 3
0
import calfem.shapes as cfs
import calfem.solver as cfslv

import numpy as np

import matplotlib.pyplot as plt

cfu.enableLogging()

# ---- General parameters ---------------------------------------------------

# Define marker constants instead of using numbers in the code

cfu.info("Creating rectangle")

rect = cfs.Rectangle(5.0, 1.0, element_type=2, dofs_per_node=1, max_area=0.08)

rect.t = 1
rect.ep = [rect.t, 1]

rect.D = np.diag([1.7, 1.7])

cfu.info("Creating mesh...")

mesh = cfs.ShapeMesh(rect)

# ---- Solve problem --------------------------------------------------------

solver = cfslv.Flow2DSolver(mesh)

solver.addBC(rect.left_id, 0.0)