[cig-commits] r15062 - in short/3D/PyLith/trunk: examples/bar_shearwave/hex8 examples/bar_shearwave/quad4 examples/bar_shearwave/tet4 examples/bar_shearwave/tri3 libsrc/problems modulesrc/problems pylith/problems
brad at geodynamics.org
brad at geodynamics.org
Tue May 26 15:29:51 PDT 2009
Author: brad
Date: 2009-05-26 15:29:50 -0700 (Tue, 26 May 2009)
New Revision: 15062
Modified:
short/3D/PyLith/trunk/examples/bar_shearwave/hex8/shearwave.cfg
short/3D/PyLith/trunk/examples/bar_shearwave/quad4/shearwave.cfg
short/3D/PyLith/trunk/examples/bar_shearwave/tet4/shearwave.cfg
short/3D/PyLith/trunk/examples/bar_shearwave/tri3/shearwave.cfg
short/3D/PyLith/trunk/libsrc/problems/SolverLinear.cc
short/3D/PyLith/trunk/libsrc/problems/SolverLinear.hh
short/3D/PyLith/trunk/modulesrc/problems/SolverLinear.i
short/3D/PyLith/trunk/pylith/problems/Explicit.py
short/3D/PyLith/trunk/pylith/problems/Implicit.py
short/3D/PyLith/trunk/pylith/problems/SolverLinear.py
Log:
Removed initial guess zero setting (not necessary with displacement increment forumulation). Fixed nondimensionalization bugs (need to set scales for displacement fields). Set nondimensionalization to wave propagation settings for dynamic problems.
Modified: short/3D/PyLith/trunk/examples/bar_shearwave/hex8/shearwave.cfg
===================================================================
--- short/3D/PyLith/trunk/examples/bar_shearwave/hex8/shearwave.cfg 2009-05-26 22:22:08 UTC (rev 15061)
+++ short/3D/PyLith/trunk/examples/bar_shearwave/hex8/shearwave.cfg 2009-05-26 22:29:50 UTC (rev 15062)
@@ -45,8 +45,8 @@
# Change to an explicit time stepping formulation
formulation = pylith.problems.Explicit
-# Reuse solution from previous time step as initial guess for next time step
-formulation.solver.initial_guess_zero = False
+# Nondimensionalize problem using wave propagation parameters.
+normalizer = spatialdata.units.NondimElasticDynamic
# Set bc to an array with 3 boundary conditions: 'x_neg', 'x_pos', and 'y_pos'.
bc = [x_pos,x_neg,y_pos]
Modified: short/3D/PyLith/trunk/examples/bar_shearwave/quad4/shearwave.cfg
===================================================================
--- short/3D/PyLith/trunk/examples/bar_shearwave/quad4/shearwave.cfg 2009-05-26 22:22:08 UTC (rev 15061)
+++ short/3D/PyLith/trunk/examples/bar_shearwave/quad4/shearwave.cfg 2009-05-26 22:29:50 UTC (rev 15062)
@@ -46,8 +46,8 @@
# Change to an explicit time stepping formulation
formulation = pylith.problems.Explicit
-# Reuse solution from previous time step as initial guess for next time step
-formulation.solver.initial_guess_zero = False
+# Nondimensionalize problem using wave propagation parameters.
+normalizer = spatialdata.units.NondimElasticDynamic
# Set bc to an array with 3 boundary conditions: 'x_neg', 'x_pos', and 'y_pos'.
bc = [x_pos,x_neg,y_pos]
Modified: short/3D/PyLith/trunk/examples/bar_shearwave/tet4/shearwave.cfg
===================================================================
--- short/3D/PyLith/trunk/examples/bar_shearwave/tet4/shearwave.cfg 2009-05-26 22:22:08 UTC (rev 15061)
+++ short/3D/PyLith/trunk/examples/bar_shearwave/tet4/shearwave.cfg 2009-05-26 22:29:50 UTC (rev 15062)
@@ -47,8 +47,8 @@
# Change to an explicit time stepping formulation
formulation = pylith.problems.Explicit
-# Reuse solution from previous time step as initial guess for next time step
-formulation.solver.initial_guess_zero = False
+# Nondimensionalize problem using wave propagation parameters.
+normalizer = spatialdata.units.NondimElasticDynamic
# Set bc to an array with 3 boundary conditions: 'x_neg', 'x_pos', and 'y_pos'.
bc = [x_pos,x_neg,y_pos]
Modified: short/3D/PyLith/trunk/examples/bar_shearwave/tri3/shearwave.cfg
===================================================================
--- short/3D/PyLith/trunk/examples/bar_shearwave/tri3/shearwave.cfg 2009-05-26 22:22:08 UTC (rev 15061)
+++ short/3D/PyLith/trunk/examples/bar_shearwave/tri3/shearwave.cfg 2009-05-26 22:29:50 UTC (rev 15062)
@@ -46,8 +46,8 @@
# Change to an explicit time stepping formulation
formulation = pylith.problems.Explicit
-# Reuse solution from previous time step as initial guess for next time step
-formulation.solver.initial_guess_zero = False
+# Nondimensionalize problem using wave propagation parameters.
+normalizer = spatialdata.units.NondimElasticDynamic
# Set bc to an array with 3 boundary conditions: 'x_neg', 'x_pos', and 'y_pos'.
bc = [x_pos,x_neg,y_pos]
Modified: short/3D/PyLith/trunk/libsrc/problems/SolverLinear.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/problems/SolverLinear.cc 2009-05-26 22:22:08 UTC (rev 15061)
+++ short/3D/PyLith/trunk/libsrc/problems/SolverLinear.cc 2009-05-26 22:29:50 UTC (rev 15062)
@@ -47,18 +47,6 @@
} // deallocate
// ----------------------------------------------------------------------
-// Set initial guess zero flag.
-void
-pylith::problems::SolverLinear::initialGuessZero(const bool value)
-{ // initialGuessZero
- assert(0 != _ksp);
-
- PetscTruth flag = (value) ? PETSC_FALSE : PETSC_TRUE;
- PetscErrorCode err = KSPSetInitialGuessNonzero(_ksp, flag);
- CHECK_PETSC_ERROR(err);
-} // initialGuessZero
-
-// ----------------------------------------------------------------------
// Initialize solver.
void
pylith::problems::SolverLinear::initialize(
@@ -76,6 +64,7 @@
CHECK_PETSC_ERROR(err);
} // if
err = KSPCreate(fields.mesh().comm(), &_ksp); CHECK_PETSC_ERROR(err);
+ err = KSPSetInitialGuessNonzero(_ksp, PETSC_FALSE); CHECK_PETSC_ERROR(err);
err = KSPSetFromOptions(_ksp); CHECK_PETSC_ERROR(err);
} // initialize
Modified: short/3D/PyLith/trunk/libsrc/problems/SolverLinear.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/problems/SolverLinear.hh 2009-05-26 22:22:08 UTC (rev 15061)
+++ short/3D/PyLith/trunk/libsrc/problems/SolverLinear.hh 2009-05-26 22:29:50 UTC (rev 15062)
@@ -44,13 +44,6 @@
/// Deallocate PETSc and local data structures.
void deallocate(void);
- /** Set initial guess zero flag.
- *
- * @param value True means use zero as initial guess, false means
- * use previous solution as initial guess.
- */
- void initialGuessZero(const bool value);
-
/** Initialize solver.
*
* @param fields Solution fields.
Modified: short/3D/PyLith/trunk/modulesrc/problems/SolverLinear.i
===================================================================
--- short/3D/PyLith/trunk/modulesrc/problems/SolverLinear.i 2009-05-26 22:22:08 UTC (rev 15061)
+++ short/3D/PyLith/trunk/modulesrc/problems/SolverLinear.i 2009-05-26 22:29:50 UTC (rev 15062)
@@ -34,13 +34,6 @@
/// Deallocate PETSc and local data structures.
void deallocate(void);
- /** Set initial guess zero flag.
- *
- * @param value True means use zero as initial guess, false means
- * use previous solution as initial guess.
- */
- void initialGuessZero(const bool value);
-
/** Initialize solver.
*
* @param fields Solution fields.
Modified: short/3D/PyLith/trunk/pylith/problems/Explicit.py
===================================================================
--- short/3D/PyLith/trunk/pylith/problems/Explicit.py 2009-05-26 22:22:08 UTC (rev 15061)
+++ short/3D/PyLith/trunk/pylith/problems/Explicit.py 2009-05-26 22:29:50 UTC (rev 15062)
@@ -78,13 +78,18 @@
self._debug.log(resourceUsageString())
# Set fields to zero
+ lengthScale = normalizer.lengthScale()
dispIncr = self.fields.get("dispIncr(t->t+dt)")
+ dispIncr.scale(lengthScale.value)
dispIncr.zero()
dispT = self.fields.get("disp(t)")
+ dispT.scale(lengthScale.value)
dispT.zero()
dispTmdt = self.fields.get("disp(t-dt)")
+ dispTmdt.scale(lengthScale.value)
dispTmdt.zero()
residual = self.fields.get("residual")
+ residual.scale(lengthScale.value)
residual.zero()
# Create Petsc vectors for fields involved in solve
residual.createVector()
Modified: short/3D/PyLith/trunk/pylith/problems/Implicit.py
===================================================================
--- short/3D/PyLith/trunk/pylith/problems/Implicit.py 2009-05-26 22:22:08 UTC (rev 15061)
+++ short/3D/PyLith/trunk/pylith/problems/Implicit.py 2009-05-26 22:29:50 UTC (rev 15062)
@@ -105,6 +105,7 @@
dispIncr.scale(lengthScale.value)
dispIncr.zero()
residual = self.fields.get("residual")
+ residual.scale(lengthScale.value)
residual.zero()
# Create Petsc vectors for fields involved in solve
residual.createVector()
Modified: short/3D/PyLith/trunk/pylith/problems/SolverLinear.py
===================================================================
--- short/3D/PyLith/trunk/pylith/problems/SolverLinear.py 2009-05-26 22:22:08 UTC (rev 15061)
+++ short/3D/PyLith/trunk/pylith/problems/SolverLinear.py 2009-05-26 22:29:50 UTC (rev 15062)
@@ -34,17 +34,13 @@
## Python object for managing SolverLinear facilities and properties.
##
## \b Properties
- ## @li \b initial_guess_zero Use zero for initial guess.
+ ## @li None
##
## \b Facilities
## @li None
import pyre.inventory
- guessZero = pyre.inventory.bool("initial_guess_zero", default=True)
- guessZero.meta['tip'] = "Use zero for initial guess."
-
-
# PUBLIC METHODS /////////////////////////////////////////////////////
def __init__(self, name="solverlinear"):
@@ -61,7 +57,6 @@
Initialize linear solver.
"""
ModuleSolverLinear.initialize(self, fields, jacobian, formulation)
- self.initialGuessZero(self.guessZero)
return
@@ -72,7 +67,6 @@
Set members based using inventory.
"""
Solver._configure(self)
- self.guessZero = self.inventory.guessZero
return
More information about the CIG-COMMITS
mailing list