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)
def endSimulation( self, step ): BaseSolver.endSimulation( self, step, self.t ) # StGermain stuff self._context.Stg_Class_Delete() return
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)
def newStep( self, t, step ): BaseSolver.newStep( self, t, step ) # Coupler stuff if self.coupler: self.coupler.newStep() return
def newStep(self, t, step): BaseSolver.newStep(self, t, step) # Coupler stuff if self.coupler: self.coupler.newStep() return
def endSimulation(self, step): BaseSolver.endSimulation(self, step, self.t) # StGermain stuff self._context.Stg_Class_Delete() return
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
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
def endTimestep( self, t, steps, done ): BaseSolver.endTimestep( self, t ) # Coupler stuff if self.coupler: done = self.coupler.endTimestep( steps, done ) return done
def __init__(self): Solver.__init__(self, "rigid") self.coupler = None self._fluidServer = None self._solidServer = None return
def endTimestep(self, t, steps, done): BaseSolver.endTimestep(self, t) # Coupler stuff if self.coupler: done = self.coupler.endTimestep(steps, done) return done
def __init__(self): Solver.__init__(self, "pulse") self.coupler = None self._fluidServer = None self._solidServer = None self.generator = None return
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
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
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
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
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
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
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
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 )
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)
def applyBoundaryConditions(self): Solver.applyBoundaryConditions(self) self.coupler.exchangeBoundary() self.coupler.exchangeFields() return
def _configure(self): Solver._configure(self) self.generator = self.inventory.generator return
def publishState(self, directory): # NYI # self.coupler.publish() Solver.publishState(self, directory) return
def launch(self, application): BaseSolver.launch(self, application) # Coupler stuff if self.coupler: self.coupler.launch(self) return
def launch( self, application ): BaseSolver.launch( self, application ) # Coupler stuff if self.coupler: self.coupler.launch( self ) return
def advance(self, dt): Solver.advance(self, dt) self.inventory.generator.advance(dt) return