Пример #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)
Пример #2
0
	def endSimulation( self, step ):
		BaseSolver.endSimulation( self, step, self.t )

		# StGermain stuff
		self._context.Stg_Class_Delete()

		return
Пример #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)
Пример #4
0
	def newStep( self, t, step ):
		BaseSolver.newStep( self, t, step )

		# Coupler stuff
		if self.coupler:
			self.coupler.newStep()
		return
Пример #5
0
    def newStep(self, t, step):
        BaseSolver.newStep(self, t, step)

        # Coupler stuff
        if self.coupler:
            self.coupler.newStep()
        return
Пример #6
0
    def endSimulation(self, step):
        BaseSolver.endSimulation(self, step, self.t)

        # StGermain stuff
        self._context.Stg_Class_Delete()

        return
Пример #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
Пример #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
Пример #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
Пример #10
0
    def __init__(self):
        Solver.__init__(self, "rigid")

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

        return
Пример #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
Пример #12
0
    def __init__(self):
        Solver.__init__(self, "rigid")

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

        return
Пример #13
0
    def __init__(self):
        Solver.__init__(self, "pulse")

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

        self.generator = None

        return
Пример #14
0
    def __init__(self):
        Solver.__init__(self, "pulse")

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

        self.generator = None
        
        return
Пример #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
Пример #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
Пример #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
Пример #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
Пример #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
Пример #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
Пример #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
Пример #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
Пример #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
Пример #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
Пример #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 )
Пример #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)
Пример #27
0
 def applyBoundaryConditions(self):
     Solver.applyBoundaryConditions(self)
     self.coupler.exchangeBoundary()
     self.coupler.exchangeFields()
     return
Пример #28
0
 def _configure(self):
     Solver._configure(self)
     self.generator = self.inventory.generator
     return
Пример #29
0
 def publishState(self, directory):
     # NYI
     # self.coupler.publish()
     Solver.publishState(self, directory)
     return
Пример #30
0
 def launch(self, application):
     BaseSolver.launch(self, application)
     # Coupler stuff
     if self.coupler:
         self.coupler.launch(self)
     return
Пример #31
0
	def launch( self, application ):
		BaseSolver.launch( self, application )
		# Coupler stuff
		if self.coupler:
			self.coupler.launch( self )
		return
Пример #32
0
 def advance(self, dt):
     Solver.advance(self, dt)
     self.inventory.generator.advance(dt)
     return
Пример #33
0
 def publishState(self, directory):
     # NYI
     # self.coupler.publish()
     Solver.publishState(self, directory)
     return
Пример #34
0
 def applyBoundaryConditions(self):
     Solver.applyBoundaryConditions(self)
     self.coupler.exchangeBoundary()
     self.coupler.exchangeFields()
     return
Пример #35
0
 def _configure(self):
     Solver._configure(self)
     self.generator = self.inventory.generator
     return
Пример #36
0
 def advance(self, dt):
     Solver.advance(self, dt)
     self.inventory.generator.advance(dt)
     return