Beispiel #1
0
    def update(self):
        """
        Des.
        """

        SolidSolver.update(self)

        self.NativeSolid.updateSolution()
Beispiel #2
0
    def update(self):
        """
        Pushes back the current state in the past (previous state) before going to the next time step.
        """

        SolidSolver.update(self)

        self.__nextStep()
Beispiel #3
0
    def update(self):
        """
        Des.
        """

        SolidSolver.update(self)

        self.__nodalDomainDispNm2_X = self.__nodalDomainDispNm1_X.copy()
        self.__nodalDomainDispNm2_Y = self.__nodalDomainDispNm1_Y.copy()
        self.__nodalDomainDispNm2_Z = self.__nodalDomainDispNm1_Z.copy()
        self.__nodalDomainDispNm1_X = self.__nodalDomainDisp_X.copy()
        self.__nodalDomainDispNm1_Y = self.__nodalDomainDisp_Y.copy()
        self.__nodalDomainDispNm1_Z = self.__nodalDomainDisp_Z.copy()

        self.__nodalDomainTempNm2 = self.__nodalDomainTempNm1.copy()
        self.__nodalDomainTempNm1 = self.__nodalDomainTemp.copy()
Beispiel #4
0
    def __init__(self, _module, _computationType):
        print(
            "\n***************************** Initialize modal interface *****************************\n"
        )
        # load the python module and initialize modal solver
        module = __import__(_module)
        self.initModal(module.getParams())

        # get number of nodes
        self.nNodes = self.solver.nNodes
        self.nHaloNodes = 0
        self.nPhysicalNodes = self.nNodes - self.nHaloNodes

        # initialize
        SolidSolver.__init__(self)
        self.computationType = _computationType
        self.setInitialDisplacements()
        self.initRealTimeData()
    def __init__(self, config):  # You are free to add any arguments here
        """
        Des.
        """

        print '\n***************************** Initializing Example *****************************'

        #self.nNodes =                              # number of nodes (physical + ghost) at the f/s boundary
        #self.nHaloNode =                           # number of ghost nodes at the f/s boundary
        #self.nPhysicalNodes =                      # number of physical nodes at the f/s boundary

        SolidSolver.__init__(self)
        self.coreSolver = solidWrapper.solverDriver(config)

        self.__setCurrentState(
        )  # use to fill the arrays with initial nodal values
        self.nodalVel_XNm1 = self.nodalVel_X.copy()
        self.nodalVel_YNm1 = self.nodalVel_Y.copy()
        self.nodalVel_ZNm1 = self.nodalVel_Z.copy()

        self.initRealTimeData()
Beispiel #6
0
    def __init__(self, confFile, computationType):
        """
        Des.
        """

        self.NativeSolid = NativeSolid.NativeSolidSolver(confFile, True)
        self.computationType = computationType

        self.interfaceID = self.NativeSolid.getFSIMarkerID()
        self.nNodes = self.NativeSolid.getNumberOfSolidInterfaceNodes(
            self.interfaceID)
        self.nHaloNode = 0
        self.nPhysicalNodes = self.NativeSolid.getNumberOfSolidInterfaceNodes(
            self.interfaceID)

        SolidSolver.__init__(self)

        self.__setCurrentState()
        self.nodalVel_XNm1 = self.nodalVel_X.copy()
        self.nodalVel_YNm1 = self.nodalVel_Y.copy()
        self.nodalVel_ZNm1 = self.nodalVel_Z.copy()

        self.initRealTimeData()
Beispiel #7
0
    def __init__(self, testname, computationType):
        """
        des.
        """

        print '\n***************************** Initializing Metafor *****************************'

        # --- Load the Python module --- #
        self.testname = testname  # string (name of the module of the solid model)
        #load(self.testname)                # loads the python module and creates mtf/workspace
        exec("import %s" % self.testname)
        exec("module = %s" % self.testname)

        # --- Create an instance of Metafor --- #
        self.metafor = None  # link to Metafor objet
        p = {}  # parameters (todo)
        #self.metafor = instance(p)           # creates an instance of the metafor model
        self.metafor = module.getMetafor(p)
        self.realTimeExtractorsList = module.getRealTimeExtractorsList(
            self.metafor)
        p = module.params(p)

        # --- Internal variables --- #
        self.neverRun = True  # bool True until the first Metafor run is completed then False
        self.fnods = {}  # dict of interface nodes / prescribed forces
        self.Tnods = {}
        self.t1 = 0.0  # last reference time
        self.t2 = 0.0  # last calculated time
        self.nbFacs = 0  # number of existing Facs
        self.saveAllFacs = False  # True: the Fac corresponding to the end of the time step is conserved, False: Facs are erased at the end of each time step
        self.runOK = True
        self.computationType = computationType  # computation type : steady (default) or unsteady

        # --- Retrieves the f/s boundary and the related nodes --- #
        self.bndno = p['bndno']  # physical group of the f/s interface
        self.groupset = self.metafor.getDomain().getGeometry().getGroupSet()
        self.gr = self.groupset(self.bndno)
        self.nNodes = self.gr.getNumberOfMeshPoints()
        self.nHaloNode = 0
        self.nPhysicalNodes = self.gr.getNumberOfMeshPoints(
        )  # number of node at the f/s boundary

        # --- Builds a list (dict) of interface nodes and creates the nodal prescribed loads --- #
        loadingset = self.metafor.getDomain().getLoadingSet()
        for i in range(self.nPhysicalNodes):
            node = self.gr.getMeshPoint(i)
            no = node.getNo()
            fx = NLoad(self.t1, 0.0, self.t2, 0.0)
            fy = NLoad(self.t1, 0.0, self.t2, 0.0)
            fz = NLoad(self.t1, 0.0, self.t2, 0.0)
            Temp = NLoad(self.t1, 0.0, self.t2, 0.0)
            self.fnods[no] = (node, fx, fy, fz)
            self.Tnods[no] = (node, Temp)
            fctx = PythonOneParameterFunction(fx)
            fcty = PythonOneParameterFunction(fy)
            fctz = PythonOneParameterFunction(fz)
            fctTemp = PythonOneParameterFunction(Temp)
            loadingset.define(node, Field1D(TX, GF1), 1.0, fctx)
            loadingset.define(node, Field1D(TY, GF1), 1.0, fcty)
            loadingset.define(node, Field1D(TZ, GF1), 1.0, fctz)
            #loadingset.define(node, Field1D(TO, RE), 1.0, fctTemp, 0)
            #loadingset.define(node, Field1D(TO, AB), 1.0, fctTemp)

        # --- Create the array for external communication (displacement, velocity and velocity at the previous time step) --- #

        SolidSolver.__init__(self)

        self.__setCurrentState(True)
        self.nodalVel_XNm1 = self.nodalVel_X.copy()
        self.nodalVel_YNm1 = self.nodalVel_Y.copy()
        self.nodalVel_ZNm1 = self.nodalVel_Z.copy()

        self.initRealTimeData()

        # Last build operation
        self.metafor.getDomain().build(
        )  # NB: necessary to complete Metafor initialization!
Beispiel #8
0
    def __init__(self, testname, resolution, computationType, pythonFlag):
        """
        Des
        """

        self.testname = testname
        self.pythonFlag = pythonFlag
        self.computationType = computationType
        self.resolution = resolution
        self.currentDT = 1.0
        self.pathToGetDP = "/home/dthomas/InstalledSoftware/GetDP/bin/getdp"

        if self.pythonFlag:
            #from getdp import *
            GetDPSetNumber("Initialize", 1)
            GetDPSetNumber("OutputFiles", 1)
            GetDP(["getdp", self.testname, "-solve", self.resolution])
            GetDPPos = GetDPGetNumber("nodalPosition") #returns a std vector
            self.nNodes = int(GetDPPos[0])
            self.nHaloNode = 0
            self.nPhysicalNodes = int(GetDPPos[0])
            GetDPDomainDisp = GetDPGetNumber("nodalDisplacement")
            self.__nDomainNodes = int(GetDPDomainDisp[0])
            SolidSolver.__init__(self)
            self.nodalInterfIndex = self.__extractIndex(GetDPPos, 3)
            self.nodalDomainIndex = self.__extractIndex(GetDPDomainDisp, 3)
            self.nodalInitialPos_X = np.zeros(self.nPhysicalNodes)
            self.nodalInitialPos_Y = np.zeros(self.nPhysicalNodes)
            self.nodalInitialPos_Z = np.zeros(self.nPhysicalNodes)
            self.nodalInitialPos_X, self.nodalInitialPos_Y, self.nodalInitialPos_Z = self.__vecToVecArray(GetDPPos)
            self.__nodalDomainDisp_X = np.zeros(self.__nDomainNodes)
            self.__nodalDomainDisp_Y = np.zeros(self.__nDomainNodes)
            self.__nodalDomainDisp_Z = np.zeros(self.__nDomainNodes)
            self.__nodalDomainDispNm1_X = np.zeros(self.__nDomainNodes)
            self.__nodalDomainDispNm1_Y = np.zeros(self.__nDomainNodes)
            self.__nodalDomainDispNm1_Z = np.zeros(self.__nDomainNodes)
            self.__nodalDomainDispNm2_X = np.zeros(self.__nDomainNodes)
            self.__nodalDomainDispNm2_Y = np.zeros(self.__nDomainNodes)
            self.__nodalDomainDispNm2_Z = np.zeros(self.__nDomainNodes)
            self.__nodalDomainDispNm1_X, self.__nodalDomainDispNm1_Y, self.__nodalDomainDispNm1_Z = self.__vecToVecArray(GetDPGetNumber("nodalDisplacementNm1"))
            self.__nodalDomainDispNm2_X, self.__nodalDomainDispNm2_Y, self.__nodalDomainDispNm2_Z = self.__vecToVecArray(GetDPGetNumber("nodalDisplacementNm2"))
            self.__nodalDomainTemp = np.zeros(self.__nDomainNodes)
            self.__nodalDomainTempNm1 = np.zeros(self.__nDomainNodes)
            self.__nodalDomainTempNm2 = np.zeros(self.__nDomainNodes)
            if self.computationType == 'unsteady':
                self.__nodalDomainTemp = self.__vecToScalArray(GetDPGetNumber("nodalTemperatureNm0"))
                self.__nodalDomainTempNm1 = self.__vecToScalArray(GetDPGetNumber("nodalTemperatureNm1"))
                self.__nodalDomainTempNm2 = self.__vecToScalArray(GetDPGetNumber("nodalTemperatureNm2"))
            self.nodalLoads_X = np.zeros(self.nPhysicalNodes)
            self.nodalLoads_Y = np.zeros(self.nPhysicalNodes)
            self.nodalLoads_Z = np.zeros(self.nPhysicalNodes) 
            self.__setCurrentState(True)
            self.nodalVel_XNm1 = self.nodalVel_X.copy()
            self.nodalVel_YNm1 = self.nodalVel_Y.copy()
            self.nodalVel_ZNm1 = self.nodalVel_Z.copy()
        else:
            os.system(self.pathToGetDP +" {} -setnumber Initialize 1 -setnumber OutputFiles 1 -solve {}".format(self.testname, self.resolution))
            with open("nodalPosition.txt") as f:
                strings = f.readlines()
            self.nNodes = len(strings)-1
            self.nHaloNode = 0
            self.nPhysicalNodes = len(strings)-1
            with open("nodalDisplacement.txt") as f:
                strings = f.readlines()
            self.__nDomainNodes = len(strings)-1
            SolidSolver.__init__(self)
            self.nodalInterfIndex = self.__readIndex("nodalPosition.txt")
            self.nodalDomainIndex = self.__readIndex("nodalDisplacement.txt")
            self.nodalInitialPos_X = np.zeros(self.nPhysicalNodes)
            self.nodalInitialPos_Y = np.zeros(self.nPhysicalNodes)
            self.nodalInitialPos_Z = np.zeros(self.nPhysicalNodes)
            self.nodalInitialPos_X, self.nodalInitialPos_Y, self.nodalInitialPos_Z = self.__readFileToVec("nodalPosition.txt", self.nPhysicalNodes)
            self.__nodalDomainDisp_X = np.zeros(self.__nDomainNodes)
            self.__nodalDomainDisp_Y = np.zeros(self.__nDomainNodes)
            self.__nodalDomainDisp_Z = np.zeros(self.__nDomainNodes)
            self.__nodalDomainDispNm1_X = np.zeros(self.__nDomainNodes)
            self.__nodalDomainDispNm1_Y = np.zeros(self.__nDomainNodes)
            self.__nodalDomainDispNm1_Z = np.zeros(self.__nDomainNodes)
            self.__nodalDomainDispNm2_X = np.zeros(self.__nDomainNodes)
            self.__nodalDomainDispNm2_Y = np.zeros(self.__nDomainNodes)
            self.__nodalDomainDispNm2_Z = np.zeros(self.__nDomainNodes)
            self.__nodalDomainDispNm1_X, self.__nodalDomainDispNm1_Y, self.__nodalDomainDispNm1_Z = self.__readFileToVec("nodalDisplacementNm1.txt", self.__nDomainNodes)
            self.__nodalDomainDispNm2_X, self.__nodalDomainDispNm2_Y, self.__nodalDomainDispNm2_Z = self.__readFileToVec("nodalDisplacementNm2.txt", self.__nDomainNodes)
            self.__nodalDomainTemp = np.zeros(self.__nDomainNodes)
            self.__nodalDomainTempNm1 = np.zeros(self.__nDomainNodes)
            self.__nodalDomainTempNm2 = np.zeros(self.__nDomainNodes)
            if self.computationType == 'unsteady':
                self.__nodalDomainTemp = self.__readFileToScal("nodalTemperatureNm0.txt", self.__nDomainNodes)
                self.__nodalDomainTempNm1 = self.__readFileToScal("nodalTemperatureNm1.txt", self.__nDomainNodes)
                self.__nodalDomainTempNm2 = self.__readFileToScal("nodalTemperatureNm2.txt", self.__nDomainNodes)
            self.nodalLoads_X = np.zeros(self.nPhysicalNodes)
            self.nodalLoads_Y = np.zeros(self.nPhysicalNodes)
            self.nodalLoads_Z = np.zeros(self.nPhysicalNodes)
            self.__writeVecToFile("nodalHeatFlux.txt", np.zeros(self.nPhysicalNodes),  np.zeros(self.nPhysicalNodes), np.zeros(self.nPhysicalNodes), self.nodalInterfIndex)
            self.__setCurrentState(True)
            self.nodalVel_XNm1 = self.nodalVel_X.copy()
            self.nodalVel_YNm1 = self.nodalVel_Y.copy()
            self.nodalVel_ZNm1 = self.nodalVel_Z.copy()

        self.initRealTimeData()