Example #1
0
 def solve(self):
     """Solve problem"""
     
     cfu.enableLogging()
     
     solver = cfslv.Plan2DSolver(self.mesh)
     
     solver.addBC(self.rect.leftId, 0.0)
     solver.addForceTotal(self.rect.topId, -10e5, dimension=2)
     
     self.results = solver.execute()       
     
     cfu.disableLogging()
Example #2
0
# -*- coding: utf-8 -*-
'''Example 10

The use case from the user manual. 
The example does not contain anything that is not covered in the previous examples.
'''

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...")
Example #3
0
The example does not contain anything that is not covered in the previous examples.
'''

import calfem.core as cfc
import calfem.geometry as cfg
import calfem.mesh as cfm
import calfem.vis as cfv
import calfem.utils as cfu

import numpy as np

from scipy.sparse import lil_matrix

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

cfu.enableLogging()

t = 0.2
v = 0.35
E1 = 2e9
E2 = 0.2e9
ptype = 1
ep = [ptype,t]
D1 = cfc.hooke(ptype, E1, v)
D2 = cfc.hooke(ptype, E2, v)

# Define marker constants instead of using numbers in the code

markE1 = 55
markE2 = 66
markFixed = 70