[cig-commits] r6934 - short/3D/PyLith/trunk/pylith/problems
willic3 at geodynamics.org
willic3 at geodynamics.org
Mon May 21 13:39:54 PDT 2007
Author: willic3
Date: 2007-05-21 13:39:46 -0700 (Mon, 21 May 2007)
New Revision: 6934
Modified:
short/3D/PyLith/trunk/pylith/problems/Explicit.py
short/3D/PyLith/trunk/pylith/problems/Implicit.py
short/3D/PyLith/trunk/pylith/problems/TimeDependent.py
Log:
More work on Implicit problem. For now, I have also changed the
arguments to poststep, which meant changing Explicit.py and
TimeDependent.py. We can change back, if necessary.
Modified: short/3D/PyLith/trunk/pylith/problems/Explicit.py
===================================================================
--- short/3D/PyLith/trunk/pylith/problems/Explicit.py 2007-05-21 18:46:20 UTC (rev 6933)
+++ short/3D/PyLith/trunk/pylith/problems/Explicit.py 2007-05-21 20:39:46 UTC (rev 6934)
@@ -122,7 +122,7 @@
return dt
- def prestep(self):
+ def prestep(self, t, dt):
"""
Hook for doing stuff before advancing time step.
"""
Modified: short/3D/PyLith/trunk/pylith/problems/Implicit.py
===================================================================
--- short/3D/PyLith/trunk/pylith/problems/Implicit.py 2007-05-21 18:46:20 UTC (rev 6933)
+++ short/3D/PyLith/trunk/pylith/problems/Implicit.py 2007-05-21 20:39:46 UTC (rev 6934)
@@ -91,14 +91,16 @@
self._info.log("Creating fields and matrices.")
self.dispT = mesh.createRealSection("dispT", dimension)
- self.dispTpdt = mesh.createRealSection("dispTpdt", dimension)
+ self.dispTBctpdt = mesh.createRealSection("dispTBctpdt", dimension)
+ self.dispIncrement = mesh.createRealSection("dispIncrement", dimension)
self.residual = mesh.createRealSection("residual", dimension)
# Setup constraints
# STUFF GOES HERE
mesh.allocateRealSection(self.dispT)
- mesh.allocateRealSection(self.dispTpdt)
+ mesh.allocateRealSection(self.dispTBctpdt)
+ mesh.allocateRealSection(self.dispIncrement)
mesh.allocateRealSection(self.residual)
self.jacobian = mesh.createMatrix(self.residual)
@@ -106,11 +108,12 @@
self._info.log("Integrating Jacobian of operator.")
for integrator in self.integrators:
integrator.timeStep(dt)
- integrator.integrateJacobian(self.jacobian, self.dispT)
+ integrator.integrateJacobian(self.jacobian, self.dispTBctpdt)
import pylith.utils.petsc as petsc
petsc.mat_assemble(self.jacobian)
- self.solver.initialize(mesh, self.dispTpdt)
+ self.solver.initialize(mesh, self.dispIncrement)
+ # self.mesh = mesh
return
@@ -124,10 +127,20 @@
return dt
- def prestep(self):
+ def prestep(self, t, dt):
"""
Hook for doing stuff before advancing time step.
"""
+ # This will need to set dispTBctpdt to the BC at time step t+dt.
+ # Non-constrained DOF are unaffected and will be equal to their
+ # values from time step t.
+ # In this routine I also need to integrate the tractions for step
+ # t+dt, but I don't think the function for this is available yet.
+ # from pylith.bc.Dirichlet import Dirichlet
+
+ # dispbc = Dirichlet
+
+ # dispbc.setField(t+dt, self.dispTBctpdt, self.mesh)
self._info.log("WARNING: Implicit::prestep() not implemented.")
return
@@ -141,10 +154,10 @@
bindings.zeroRealSection(self.residual)
for integrator in self.integrators:
integrator.timeStep(dt)
- integrator.integrateResidual(self.residual, self.dispT)
+ integrator.integrateResidual(self.residual, self.dispTBctpdt)
self._info.log("Solving equations.")
- self.solver.solve(self.dispTpdt, self.jacobian, self.residual)
+ self.solver.solve(self.dispIncrement, self.jacobian, self.residual)
return
@@ -152,7 +165,16 @@
"""
Hook for doing stuff after advancing time step.
"""
- self.dispT = self.dispTpdt
+ # This should give us the total displacements for time step t+dt, which
+ # is renamed as time step t following the solve.
+ # The vector dispTBctpdt contains the displacements from time step t
+ # along with the displacement BC from time step t+dt. The displacement
+ # increments computed from the residual are then added to this to give us
+ # the total displacement field at time t+dt.
+ # Need a real way to do the operation below.
+ # It is commented out for now, and should be replaced with a call to PETSc.
+ # self.dispT = self.dispTBctpdt+self.dispIncrement
+ self.dispTBctpdt = self.dispT
return
Modified: short/3D/PyLith/trunk/pylith/problems/TimeDependent.py
===================================================================
--- short/3D/PyLith/trunk/pylith/problems/TimeDependent.py 2007-05-21 18:46:20 UTC (rev 6933)
+++ short/3D/PyLith/trunk/pylith/problems/TimeDependent.py 2007-05-21 20:39:46 UTC (rev 6934)
@@ -111,22 +111,22 @@
# Checkpoint if necessary
self.checkpointTimer.update(t)
- # Do stuff before advancing time step
- self._prestep()
-
# Get stable time step
dt = self.formulation.stableTimeStep()
if dt.value == 0.0:
# If formulation returns 0.0, use default time step
dt = self.dt
+ # Do stuff before advancing time step
+ self._prestep(t, dt)
+
# Advance in time
self._step(dt)
# Do stuff after advancing time step
self._poststep(t+dt)
- # Update time stamp
+ # Update time step
t += dt
return
@@ -160,11 +160,11 @@
return
- def _prestep(self):
+ def _prestep(self, t, dt):
"""
Hook for doing stuff before advancing time step.
"""
- self.formulation.prestep()
+ self.formulation.prestep(t, dt)
return
More information about the cig-commits
mailing list