Giter Site home page Giter Site logo

Comments (1)

Martin15135215 avatar Martin15135215 commented on June 19, 2024

I forgot to add a support:

Now, the code is working without error.

import numpy as np
import calfem.core as cfc

# Topology matrix Edof
Edof = np.array([
    [1,2,3,4,5,6], # Element 1
    [1,2,3,7,8,9], # Element 2
    [1,2,3,10,11,12], # Element 3
])

K = np.matrix(np.zeros((12,12)))
f = np.matrix(np.zeros((12,1)))

# Area and E-Modulus
E =  1000000.0 # E-Modulus kN/m²
A = 0.001 # Area m²
ep = [E,A]

#Element coordinates
ex1 = np.array([0., 0.])  # Element 1
ex2 = np.array([0., -4.]) # Element 2
ex3 = np.array([0., -4.]) # Element 3

ey1 = np.array([0., 0.]) # Element 1
ey2 = np.array([0., 0.]) # Element 2
ey3 = np.array([0., 0.]) # Element 3

ez1 = np.array([3., 0.])  # Element 1
ez2 = np.array([3., 3.])  # Element 2
ez3 = np.array([3., 6.])  # Element 3


# Element stiffness matrices
Ke1 = cfc.bar3e(ex1,ey1,ez1,ep)
Ke2 = cfc.bar3e(ex2,ey2,ez2,ep)
Ke3 = cfc.bar3e(ex3,ey3,ez3,ep)

# Assemble Ke into K
cfc.assem(Edof[0,:],K,Ke1)
cfc.assem(Edof[1,:],K,Ke2)
cfc.assem(Edof[2,:],K,Ke3)

# prescribed displacements in bc
bc = np.array([2, # has also a support
    4,5,6,7,8,9,10,11,12])

f[1] = 100 # kN
f[2] = -100 # kN

a, r = cfc.solveq(K,f,bc)

from calfem-python.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.