예제 #1
0
def InputRead(fname):

    if fname[-4:] == '.pro':
        props = fileParser(fname)
    else:
        props = fileParser(fname + '.pro')

    dataFileName = props.input

    nodes = NodeSet()
    nodes.readFromFile(dataFileName)

    elems = ElementSet(nodes, props)
    elems.readFromFile(dataFileName)

    dofs = DofSpace(elems)
    dofs.readFromFile(dataFileName)

    globdat = GlobalData(nodes, elems, dofs)

    globdat.readFromFile(dataFileName)

    globdat.active = True
    globdat.cycle = 0
    globdat.prefix = os.path.splitext(fname)[0]

    return props, globdat
예제 #2
0
def InputReader(argv):

    options, remainder = getopt.getopt(argv, 'a:k:v', ['all', 'author='])

    proFileName = argv[1]
    props = fileParser(proFileName)

    dataFileName = props.input

    nodes = NodeSet()
    nodes.readFromFile(dataFileName)

    elems = ElementSet(nodes, props)
    elems.readFromFile(dataFileName)

    dofs = DofSpace(elems)
    dofs.readFromFile(dataFileName)

    globdat = GlobalData(nodes, elems, dofs)

    globdat.readFromFile(dataFileName)

    globdat.active = True
    globdat.cycle = 0
    globdat.prefix = os.path.splitext(proFileName)[0]

    return props, globdat
예제 #3
0
def InputReader( argv ):

  options, remainder = getopt.getopt( argv , 'a:k:v', ['all','author='])

  proFileName  = argv[1]
  props        = fileParser( proFileName )

  dataFileName = props.input

  nodes = NodeSet()
  nodes.readFromFile( dataFileName )
  
  elems = ElementSet( nodes , props )
  elems.readFromFile( dataFileName )
  
  dofs = DofSpace( elems )
  dofs.readFromFile( dataFileName )

  globdat = GlobalData( nodes, elems, dofs ) 

  globdat.readFromFile( dataFileName )

  globdat.active = True
  globdat.cycle  = 0
  globdat.prefix = os.path.splitext(proFileName)[0]
	
  return props,globdat
예제 #4
0
def InputRead( fname , dname = None , parameters = None ):

  if dname is not None:
    with open(dname, 'rb') as f:
      data = pickle.load(f)
      props = data["props"]
  
  if fname is not None:
    if fname[-4:] == '.pro':
      props        = fileParser( fname )
    else:
      props        = fileParser( fname+'.pro')
    
  if parameters is not None:  
    for p in parameters:
      x = p.split("=")
      props.store(x[0],x[1])
      
  if dname is not None:
    return props,data["globdat"]

  dataFileName = props.input

  logger = setLogger( props )

  nodes = NodeSet()
  nodes.readFromFile( dataFileName )
  logger.info(nodes)
  
  elems = ElementSet( nodes , props )
  elems.readFromFile( dataFileName )
  logger.info(elems)  
  
  dofs = DofSpace( elems )
  dofs.readFromFile( dataFileName )

  globdat = GlobalData( nodes, elems, dofs ) 

  globdat.readFromFile( dataFileName )

  globdat.active = True
  globdat.prefix = os.path.splitext(fname)[0]
  
  globdat.contact = Contact( props )
  	
  return props,globdat
예제 #5
0
#DofSpace
from pyfem.fem.DofSpace import DofSpace

dofs = DofSpace(elements)

dofs.constrain(1, ['u', 'v'])
dofs.constrain(2, ['u', 'v'])
dofs.constrain(3, ['u', 'v'])

###################################
# Store in global data dictionary #
###################################

from pyfem.util.dataStructures import GlobalData

globdat = GlobalData(nodes, elements, dofs)

################################
# Solution procedure (Box 2.3) #
################################

from numpy import zeros, array
from pyfem.fem.Assembly import assembleTangentStiffness

#################################
# Step 1:                       #
# Initialize (Delta a)          #
#################################

a = globdat.state
Da = globdat.Dstate