Ejemplo n.º 1
0
    def __init__ (self, file, workdir=''):
        """
        Constructor. Initializes the application.

        :param str file: Name of file
        :param str workdir: Optional parameter for working directory
        """
        super(OOFEM, self).__init__(file, workdir)
        dr = liboofem.OOFEMTXTDataReader(file)
        self.oofem_pb = liboofem.InstanciateProblem(dr,liboofem.problemMode._processor,0)
        self.oofem_pb.checkProblemConsistency()
        self.oofem_mesh = self.oofem_pb.giveDomain(1)
        self.mesh = None # MuPIF representation of oofem mesh

        print ("Imported %d node and %d elements" % (self.oofem_mesh.giveNumberOfDofManagers(), self.oofem_mesh.giveNumberOfElements()))
Ejemplo n.º 2
0
 def initialize(self,
                file='',
                workdir='',
                metaData={},
                validateMetaData=True,
                **kwargs):
     super(oofem_api, self).initialize(file=file,
                                       workdir=workdir,
                                       metaData=metaData,
                                       validateMetaData=validateMetaData,
                                       **kwargs)
     if self.file != "":
         print("OOFEM reading input file '%s'" % self.file)
         dr = liboofem.OOFEMTXTDataReader(self.file)
         self.transp_model = liboofem.InstanciateProblem(
             dr, liboofem.problemMode._processor, 0)
         self.transp_model.checkProblemConsistency()
         print(self.transp_model.giveClassName())
         active_m_step = self.transp_model.giveMetaStep(1)
         self.transp_model.initMetaStepAttributes(active_m_step)
         self.field_man = self.transp_model.giveContext().giveFieldManager()
Ejemplo n.º 3
0
from __future__ import print_function
import liboofem
import numpy as np

# Instantiate uniform field
ugrid = liboofem.UniformGridField()
# Set 2D geometry
ugrid.setGeometry(lo=(0, 0), hi=(1, 1), div=(2, 2))
# Set data: div is 2x2, hence 3x3=9 node grid with 9 values
ugrid.setValues([0, .5, 0, .5, 1, .5, 0, .5, .5])
#ugrid.setValues([15,15,15,15,15,15,15,15,15])
print(ugrid.evaluateAtPos((0.5, 0.2)))

dr = liboofem.OOFEMTXTDataReader("tmpatch05.in")
transpModel = liboofem.InstanciateProblem(dr, liboofem.problemMode._processor,
                                          0)
transpModel.checkProblemConsistency()

fieldMan = transpModel.giveContext().giveFieldManager()
timeStep = transpModel.giveCurrentStep()

#eField = transpModel.giveField(liboofem.FieldType.FT_Temperature,timeStep)
#fieldMan.registerField(eField,liboofem.FieldType.FT_TransportProblemUnknowns)

fieldMan.registerField(ugrid, liboofem.FieldType.FT_TemperatureAmbient)

print(fieldMan.giveRegisteredKeys())
print(fieldMan.giveField(liboofem.FieldType.FT_TemperatureAmbient))

transpModel.solveYourself()
transpModel.terminateAnalysis()