Esempio n. 1
0
basisFunctions = IntegratedHierarchicBasisFunctions(
    polynomialOrder=polynomialOrder)
initialLoad = lambda x: load(time[0], x)
model.elements = [
    LinearHeatElement1D(
        capacity,
        conductivity, (i * length / nElements, (i + 1) * length / nElements),
        np.asarray(range(i * polynomialOrder, (i + 1) * polynomialOrder + 1)),
        initialLoad,
        basisFunctions=basisFunctions,
        integrationOrder=integrationOrder) for i in range(nElements)
]

# Integrate
model.allocateZeros()
model.integrate()

# Boundary conditions
leftBCID = model.addBoundaryCondition(
    DirichletBoundary(0, 0.0, lambda t: 0.0, penaltyValue=penaltyValue))

rightBCID = model.addBoundaryCondition(
    NeumannBoundary(nElements * polynomialOrder, length, referenceControl))

# Solve
model.updateTime(time[0])
initialSolution = np.zeros(model.size)
referenceTimeSeries = solveLinearHeat1D(time,
                                        initialSolution,
                                        model,
                                        theta=finiteDifferenceImplicity)
Esempio n. 2
0
 def integrate( self, *args, stiffness=True, mass=True, load=False, **kwargs ):
     self.resetMatrices( stiffness=stiffness, mass=mass, load=load )
     TransientFEModel.integrate(self,*args,stiffness=stiffness,mass=mass,load=load,**kwargs)
     if stiffness:
         for element in self.elements:
             element.integrateNonsymmetricStiffness(self.nonsymmetricStiffness)