Esempio n. 1
0
    def launch(self, application):
        Solver.launch(self, application)

        # verify the machine layout
        layout = application.layout
        rank = layout.rank
        communicator = layout.communicator

        if not communicator:
            import journal
            journal.error(self.name).log("null communicator")
            return

        if communicator.size > 1:
            import journal
            journal.error(self.name).log("this is a single processor solver")
            return

        # save the communicator info
        self._fluidServer = rank
        self._solidServer = (rank + 1) % 2

        self.coupler = application.coupler

        # initial boundary synchronization with the fluid
        if self.inventory.syncOnInit:
            self.applyBoundaryConditions()
        else:
            raise "pulse requires options.syncBoundaryInitialization=true"

        from pyre.units.SI import second
        t, step = 0.0 * second, 0

        return (t, step)
Esempio n. 2
0
	def endSimulation( self, step ):
		BaseSolver.endSimulation( self, step, self.t )

		# StGermain stuff
		self._context.Stg_Class_Delete()

		return
Esempio n. 3
0
    def launch(self, application):
        Solver.launch(self, application)

        # verify the machine layout
        layout = application.layout  
        rank = layout.rank
        communicator = layout.communicator

        if not communicator:
            import journal
            journal.error(self.name).log("null communicator")
            return

        if communicator.size > 1:
            import journal
            journal.error(self.name).log("this is a single processor solver")
            return

        # save the communicator info
        self._fluidServer = rank
        self._solidServer = (rank + 1) % 2

        self.coupler = application.coupler

        # initial boundary synchronization with the fluid
        if self.inventory.syncOnInit:
            self.applyBoundaryConditions()
        else:
            raise "pulse requires options.syncBoundaryInitialization=true"
            
        from pyre.units.SI import second
        t, step = 0.0*second, 0

        return (t, step)
Esempio n. 4
0
	def newStep( self, t, step ):
		BaseSolver.newStep( self, t, step )

		# Coupler stuff
		if self.coupler:
			self.coupler.newStep()
		return
Esempio n. 5
0
    def newStep(self, t, step):
        BaseSolver.newStep(self, t, step)

        # Coupler stuff
        if self.coupler:
            self.coupler.newStep()
        return
Esempio n. 6
0
    def endSimulation(self, step):
        BaseSolver.endSimulation(self, step, self.t)

        # StGermain stuff
        self._context.Stg_Class_Delete()

        return
Esempio n. 7
0
	def initialize( self, application ):
		BaseSolver.initialize( self, application )

		# StGermain stuff
		self._dictionary = application._dictionary
		self.communicator = application.solverCommunicator
		if not application._context:
			application._context = application.BuildContext()
		self._context = application._context

		# StGermain build... required now... as in the coupled case we control the coupling-boundary and it needs to be
		# prepared first. Also The geometry needs to be set.
		self._context.Construct()
		self._context.Build()
		self._context.Initialise()

		# Coupler stuff
		try:
			application.inventory.coupler
		except AttributeError:
			pass
		else:
			self.myPlus = application.myPlus
			self.remotePlus = application.remotePlus
			self.exchanger = application.exchanger
			self.coupler = application.inventory.coupler
			if self.coupler:
				self.coupler.initialize( self )
		return
Esempio n. 8
0
    def initialize(self, application):
        BaseSolver.initialize(self, application)

        # StGermain stuff
        self._dictionary = application._dictionary
        self.communicator = application.solverCommunicator
        if not application._context:
            application._context = application.BuildContext()
        self._context = application._context

        # StGermain build... required now... as in the coupled case we control the coupling-boundary and it needs to be
        # prepared first. Also The geometry needs to be set.
        self._context.Construct()
        self._context.Build()
        self._context.Initialise()

        # Coupler stuff
        try:
            application.inventory.coupler
        except AttributeError:
            pass
        else:
            self.myPlus = application.myPlus
            self.remotePlus = application.remotePlus
            self.exchanger = application.exchanger
            self.coupler = application.inventory.coupler
            if self.coupler:
                self.coupler.initialize(self)
        return
Esempio n. 9
0
	def endTimestep( self, t, steps, done ):
		BaseSolver.endTimestep( self, t )

		# Coupler stuff
		if self.coupler:
			done = self.coupler.endTimestep( steps, done )

		return done
Esempio n. 10
0
    def __init__(self):
        Solver.__init__(self, "rigid")

        self.coupler = None
        self._fluidServer = None
        self._solidServer = None

        return
Esempio n. 11
0
    def endTimestep(self, t, steps, done):
        BaseSolver.endTimestep(self, t)

        # Coupler stuff
        if self.coupler:
            done = self.coupler.endTimestep(steps, done)

        return done
Esempio n. 12
0
    def __init__(self):
        Solver.__init__(self, "rigid")

        self.coupler = None
        self._fluidServer = None
        self._solidServer = None

        return
Esempio n. 13
0
    def __init__(self):
        Solver.__init__(self, "pulse")

        self.coupler = None
        self._fluidServer = None
        self._solidServer = None

        self.generator = None

        return
Esempio n. 14
0
    def __init__(self):
        Solver.__init__(self, "pulse")

        self.coupler = None
        self._fluidServer = None
        self._solidServer = None

        self.generator = None
        
        return
Esempio n. 15
0
    def publishState(self, directory):
        Solver.publishState(self, directory)

        # pRange = self.coupler.pressureRange()
        # self._monitorInfo.log("pressure range: (%g, %g) pascal" % pRange)

        # NYI
        # self.coupler.publish()

        Solver.publishState(self, directory)
        return
Esempio n. 16
0
    def advance(self, dt):
        BaseSolver.advance(self, dt)

        # For imposing Force Boundary condition in coupled case
        if self.coupler:
            self.coupler.preVSolverRun()

        # StGermain stuff
        self._context.Step(dt)

        return
Esempio n. 17
0
    def applyBoundaryConditions(self):
        Solver.applyBoundaryConditions(self)
    
        import mpi
        rank = mpi.world().rank

        self.coupler.exchangeBoundary()
        self.generator.updatePressure(self.coupler.boundary)
        self.coupler.exchangeFields()
    
        return
Esempio n. 18
0
	def advance( self, dt ):
		BaseSolver.advance( self, dt )

		# For imposing Force Boundary condition in coupled case
		if self.coupler:
		    self.coupler.preVSolverRun()

		# StGermain stuff
		self._context.Step( dt )

		return
Esempio n. 19
0
    def applyBoundaryConditions(self):
        Solver.applyBoundaryConditions(self)

        import mpi
        rank = mpi.world().rank

        self.coupler.exchangeBoundary()
        self.generator.updatePressure(self.coupler.boundary)
        self.coupler.exchangeFields()

        return
Esempio n. 20
0
    def publishState(self, directory):
        Solver.publishState(self, directory)

        # pRange = self.coupler.pressureRange()
        # self._monitorInfo.log("pressure range: (%g, %g) pascal" % pRange)

        # NYI
        # self.coupler.publish()

        Solver.publishState(self, directory)
        return
Esempio n. 21
0
    def stableTimestep(self):
        dt = self.inventory.timestep

        sink = self._fluidServer
        source = self._solidServer

        import pulse
        from pyre.units.time import second
        dt = pulse.timestep(sink, source, dt.value) * second

        Solver.stableTimestep(self, dt)
        return dt
Esempio n. 22
0
    def stableTimestep(self):
        dt = self.inventory.timestep
    
        sink = self._fluidServer
        source = self._solidServer
        
        import pulse
        from pyre.units.time import second
        dt = pulse.timestep(sink, source, dt.value) * second

        Solver.stableTimestep(self, dt)
        return dt
Esempio n. 23
0
	def __init__( self, name="solver", facility="solver" ):
		BaseSolver.__init__( self, name, facility )

		# StGermain stuff
		self._context = None
		self.communicator = None
		self._dictionary = None
		self.dt_prev = 0.0

		# Coupler stuff
		self.coupler = None
		self.exchanger = None
		self.myPlus = []
		self.remotePlus = []

		self.start_cpu_time = 0
		self.cpu_time = 0
		self.model_time = 0
		self.fptime = None
		return
Esempio n. 24
0
    def __init__(self, name="solver", facility="solver"):
        BaseSolver.__init__(self, name, facility)

        # StGermain stuff
        self._context = None
        self.communicator = None
        self._dictionary = None
        self.dt_prev = 0.0

        # Coupler stuff
        self.coupler = None
        self.exchanger = None
        self.myPlus = []
        self.remotePlus = []

        self.start_cpu_time = 0
        self.cpu_time = 0
        self.model_time = 0
        self.fptime = None
        return
Esempio n. 25
0
	def stableTimestep( self ):
		dt = self._context.Dt()
		if self.dt_prev > dt:
			dt = self.dt_prev
		else:
			self.dt_prev = dt

		# Coupler stuff
		if self.coupler:
			# negotiate with other solver(s)
			dt = self.coupler.stableTimestep( dt )

		return BaseSolver.stableTimestep( self, dt )
Esempio n. 26
0
    def stableTimestep(self):
        dt = self._context.Dt()
        if self.dt_prev > dt:
            dt = self.dt_prev
        else:
            self.dt_prev = dt

        # Coupler stuff
        if self.coupler:
            # negotiate with other solver(s)
            dt = self.coupler.stableTimestep(dt)

        return BaseSolver.stableTimestep(self, dt)
Esempio n. 27
0
 def applyBoundaryConditions(self):
     Solver.applyBoundaryConditions(self)
     self.coupler.exchangeBoundary()
     self.coupler.exchangeFields()
     return
Esempio n. 28
0
 def _configure(self):
     Solver._configure(self)
     self.generator = self.inventory.generator
     return
Esempio n. 29
0
 def publishState(self, directory):
     # NYI
     # self.coupler.publish()
     Solver.publishState(self, directory)
     return
Esempio n. 30
0
 def launch(self, application):
     BaseSolver.launch(self, application)
     # Coupler stuff
     if self.coupler:
         self.coupler.launch(self)
     return
Esempio n. 31
0
	def launch( self, application ):
		BaseSolver.launch( self, application )
		# Coupler stuff
		if self.coupler:
			self.coupler.launch( self )
		return
Esempio n. 32
0
 def advance(self, dt):
     Solver.advance(self, dt)
     self.inventory.generator.advance(dt)
     return
Esempio n. 33
0
 def publishState(self, directory):
     # NYI
     # self.coupler.publish()
     Solver.publishState(self, directory)
     return
Esempio n. 34
0
 def applyBoundaryConditions(self):
     Solver.applyBoundaryConditions(self)
     self.coupler.exchangeBoundary()
     self.coupler.exchangeFields()
     return
Esempio n. 35
0
 def _configure(self):
     Solver._configure(self)
     self.generator = self.inventory.generator
     return
Esempio n. 36
0
 def advance(self, dt):
     Solver.advance(self, dt)
     self.inventory.generator.advance(dt)
     return