[cig-commits] r15146 - in short/3D/PyLith/trunk: . examples/3d/hex8 libsrc/bc libsrc/meshio libsrc/topology modulesrc/bc pylith pylith/bc tests/1d/line2 tests/1d/line3 tests/2d/quad4 unittests/libtests/bc unittests/libtests/bc/data unittests/pytests/bc unittests/pytests/bc/data
brad at geodynamics.org
brad at geodynamics.org
Mon Jun 8 16:06:11 PDT 2009
Author: brad
Date: 2009-06-08 16:06:06 -0700 (Mon, 08 Jun 2009)
New Revision: 15146
Added:
short/3D/PyLith/trunk/modulesrc/bc/BoundaryConditionPoints.i
short/3D/PyLith/trunk/modulesrc/bc/PointForce.i
short/3D/PyLith/trunk/modulesrc/bc/TimeDependent.i
short/3D/PyLith/trunk/modulesrc/bc/TimeDependentPoints.i
short/3D/PyLith/trunk/pylith/bc/PointForce.py
short/3D/PyLith/trunk/pylith/bc/TimeDependent.py
short/3D/PyLith/trunk/pylith/bc/ZeroDispDB.py
short/3D/PyLith/trunk/unittests/pytests/bc/data/tri3_disp.spatialdb
short/3D/PyLith/trunk/unittests/pytests/bc/data/tri3_tractions.spatialdb
Removed:
short/3D/PyLith/trunk/pylith/bc/FixedDOFDB.py
short/3D/PyLith/trunk/unittests/pytests/bc/data/tri3-tractions.spatialdb
short/3D/PyLith/trunk/unittests/pytests/bc/data/tri3.spatialdb
Modified:
short/3D/PyLith/trunk/TODO
short/3D/PyLith/trunk/examples/3d/hex8/dislocation.cfg
short/3D/PyLith/trunk/examples/3d/hex8/fixeddisp_shear.spatialdb
short/3D/PyLith/trunk/examples/3d/hex8/gravity.cfg
short/3D/PyLith/trunk/examples/3d/hex8/gravity_istress.cfg
short/3D/PyLith/trunk/examples/3d/hex8/savageprescott.cfg
short/3D/PyLith/trunk/examples/3d/hex8/shearxy.cfg
short/3D/PyLith/trunk/libsrc/bc/DirichletBC.cc
short/3D/PyLith/trunk/libsrc/bc/DirichletBC.hh
short/3D/PyLith/trunk/libsrc/bc/DirichletBC.icc
short/3D/PyLith/trunk/libsrc/bc/DirichletBoundary.cc
short/3D/PyLith/trunk/libsrc/bc/DirichletBoundary.hh
short/3D/PyLith/trunk/libsrc/bc/PointForce.cc
short/3D/PyLith/trunk/libsrc/bc/TimeDependent.cc
short/3D/PyLith/trunk/libsrc/bc/TimeDependentPoints.cc
short/3D/PyLith/trunk/libsrc/bc/TimeDependentPoints.hh
short/3D/PyLith/trunk/libsrc/meshio/CellFilterAvg.cc
short/3D/PyLith/trunk/libsrc/meshio/VertexFilterVecNorm.cc
short/3D/PyLith/trunk/libsrc/topology/Field.cc
short/3D/PyLith/trunk/libsrc/topology/Field.hh
short/3D/PyLith/trunk/modulesrc/bc/DirichletBC.i
short/3D/PyLith/trunk/modulesrc/bc/Makefile.am
short/3D/PyLith/trunk/modulesrc/bc/bc.i
short/3D/PyLith/trunk/pylith/Makefile.am
short/3D/PyLith/trunk/pylith/bc/DirichletBC.py
short/3D/PyLith/trunk/pylith/bc/DirichletBoundary.py
short/3D/PyLith/trunk/pylith/bc/Neumann.py
short/3D/PyLith/trunk/pylith/bc/__init__.py
short/3D/PyLith/trunk/tests/1d/line2/axialextension.cfg
short/3D/PyLith/trunk/tests/1d/line2/axialextension_disp.spatialdb
short/3D/PyLith/trunk/tests/1d/line2/dislocation.cfg
short/3D/PyLith/trunk/tests/1d/line3/axialextension.cfg
short/3D/PyLith/trunk/tests/1d/line3/axialextension_disp.spatialdb
short/3D/PyLith/trunk/tests/1d/line3/dislocation.cfg
short/3D/PyLith/trunk/tests/2d/quad4/axialsheardisp.cfg
short/3D/PyLith/trunk/tests/2d/quad4/axialsheardisp_gendb.py
short/3D/PyLith/trunk/unittests/libtests/bc/Makefile.am
short/3D/PyLith/trunk/unittests/libtests/bc/TestDirichletBC.cc
short/3D/PyLith/trunk/unittests/libtests/bc/TestDirichletBC.hh
short/3D/PyLith/trunk/unittests/libtests/bc/TestDirichletBCMulti.cc
short/3D/PyLith/trunk/unittests/libtests/bc/TestDirichletBoundary.cc
short/3D/PyLith/trunk/unittests/libtests/bc/TestTimeDependentPoints.cc
short/3D/PyLith/trunk/unittests/libtests/bc/TestTimeDependentPoints.hh
short/3D/PyLith/trunk/unittests/libtests/bc/data/DirichletDataMultiTet4.cc
short/3D/PyLith/trunk/unittests/libtests/bc/data/hex8_disp.spatialdb
short/3D/PyLith/trunk/unittests/libtests/bc/data/line2_disp.spatialdb
short/3D/PyLith/trunk/unittests/libtests/bc/data/quad4_disp.spatialdb
short/3D/PyLith/trunk/unittests/libtests/bc/data/tet4_disp.spatialdb
short/3D/PyLith/trunk/unittests/libtests/bc/data/tet4_disp2.spatialdb
short/3D/PyLith/trunk/unittests/libtests/bc/data/tet4_vel2.spatialdb
short/3D/PyLith/trunk/unittests/libtests/bc/data/tri3_disp.spatialdb
short/3D/PyLith/trunk/unittests/libtests/bc/data/tri3_disp2.spatialdb
short/3D/PyLith/trunk/unittests/libtests/bc/data/tri3_vel.spatialdb
short/3D/PyLith/trunk/unittests/libtests/bc/data/tri3_vel2.spatialdb
short/3D/PyLith/trunk/unittests/pytests/bc/TestDirichletBC.py
short/3D/PyLith/trunk/unittests/pytests/bc/TestNeumann.py
short/3D/PyLith/trunk/unittests/pytests/bc/data/Makefile.am
Log:
Updated DirichletBC to general time-dependent formulation. Updated tests and some examples accordingly (not all examples updated).
Modified: short/3D/PyLith/trunk/TODO
===================================================================
--- short/3D/PyLith/trunk/TODO 2009-06-08 22:00:14 UTC (rev 15145)
+++ short/3D/PyLith/trunk/TODO 2009-06-08 23:06:06 UTC (rev 15146)
@@ -7,11 +7,6 @@
field split
Brad
- time-dependent BC
- TimeDependent::~TimeDependent
- Field
- replace newSection(chart, fiberDim) with newSection(field, fiberDim)
- choose points to set fiberDim based on other field
field split (setup fields)
symmetric matrix (use in examples, testing)
full-scale testing
@@ -181,22 +176,10 @@
libsrc/materials
Generalized Maxwell materials
- DirichletBC (Python) - rate == None -> dbRate == 0
- DirichletBoundary (Python) - rate == None -> dbRate == 0
-
Cleanup SlipTimeFn tests (refactor test/initialize stuff)
6. Memory model [Matt]
-7. 2-D Plane strain Maxwell viscoelastic rheology [Charles]
-
-8. 2-D Plane strain Generalized Maxwell viscoelastic rheology [Charles]
-
-9. 2-D Power-law rheology [Charles]
- 2D viscoelastic models for plane strain
-
-10. Initial stress, strain, state variables for inelastic models [Charles]
-
11. Savage-Presscott benchmark [Charles]
12. Analytic BC for reverse-slip benchmark [Charles or Brad]
@@ -226,8 +209,19 @@
-- Release (v1.4) --
+-- Release (v1.5) --
+
+7. 2-D Plane strain Maxwell viscoelastic rheology [Charles]
+
+8. 2-D Plane strain Generalized Maxwell viscoelastic rheology [Charles]
+
+9. 2-D Power-law rheology [Charles]
+ 2D viscoelastic models for plane strain
+
+10. Initial stress, strain, state variables for inelastic models [Charles]
+
+
Modularize output? [Matt]
- "field_dimensioned" is prefered to "field"
Fault friction
Modified: short/3D/PyLith/trunk/examples/3d/hex8/dislocation.cfg
===================================================================
--- short/3D/PyLith/trunk/examples/3d/hex8/dislocation.cfg 2009-06-08 22:00:14 UTC (rev 15145)
+++ short/3D/PyLith/trunk/examples/3d/hex8/dislocation.cfg 2009-06-08 23:06:06 UTC (rev 15146)
@@ -46,17 +46,17 @@
[pylithapp.timedependent.bc.x_pos]
fixed_dof = [0, 1]
label = 11
-db.label = Dirichlet BC on +x
+db_initial.label = Dirichlet BC on +x
[pylithapp.timedependent.bc.x_neg]
fixed_dof = [0, 1]
label = 12
-db.label = Dirichlet BC on -x
+db_initial.label = Dirichlet BC on -x
[pylithapp.timedependent.bc.z_neg]
fixed_dof = [2]
label = 16
-db.label = Dirichlet BC on -z
+db_initial.label = Dirichlet BC on -z
# ----------------------------------------------------------------------
# faults
Modified: short/3D/PyLith/trunk/examples/3d/hex8/fixeddisp_shear.spatialdb
===================================================================
--- short/3D/PyLith/trunk/examples/3d/hex8/fixeddisp_shear.spatialdb 2009-06-08 22:00:14 UTC (rev 15145)
+++ short/3D/PyLith/trunk/examples/3d/hex8/fixeddisp_shear.spatialdb 2009-06-08 23:06:06 UTC (rev 15146)
@@ -11,7 +11,7 @@
#SPATIAL.ascii 1
SimpleDB {
num-values = 3
- value-names = dof-0 dof-1 dof-2
+ value-names = displacement-x displacement-y displacement-z
value-units = m m m
num-locs = 2
data-dim = 1 // locations form a line
Modified: short/3D/PyLith/trunk/examples/3d/hex8/gravity.cfg
===================================================================
--- short/3D/PyLith/trunk/examples/3d/hex8/gravity.cfg 2009-06-08 22:00:14 UTC (rev 15145)
+++ short/3D/PyLith/trunk/examples/3d/hex8/gravity.cfg 2009-06-08 23:06:06 UTC (rev 15146)
@@ -19,7 +19,7 @@
bc = [x_pos,x_neg,y_pos,y_neg,z_neg]
# Use gravity for this problem.
-use_gravity = true
+use_gravity = True
[pylithapp.timedependent.implicit]
# Set the output to an array of 2 output managers.
@@ -47,27 +47,27 @@
[pylithapp.timedependent.bc.x_pos]
fixed_dof = [0]
label = 11
-db.label = Dirichlet BC on +x
+db_initial.label = Dirichlet BC on +x
[pylithapp.timedependent.bc.x_neg]
fixed_dof = [0]
label = 12
-db.label = Dirichlet BC on -x
+db_initial.label = Dirichlet BC on -x
[pylithapp.timedependent.bc.y_pos]
fixed_dof = [1]
label = 13
-db.label = Dirichlet BC on +y
+db_initial.label = Dirichlet BC on +y
[pylithapp.timedependent.bc.y_neg]
fixed_dof = [1]
label = 14
-db.label = Dirichlet BC on -y
+db_initial.label = Dirichlet BC on -y
[pylithapp.timedependent.bc.z_neg]
fixed_dof = [2]
label = 15
-db.label = Dirichlet BC on -z
+db_initial.label = Dirichlet BC on -z
# ----------------------------------------------------------------------
# output
@@ -83,10 +83,10 @@
# Give basename for VTK output of state variables.
[pylithapp.timedependent.materials.elastic.output]
-cell_filter = pylith.meshio.CellFilterAvg
+cell_filter = pylith.meshio.CellFilterAvgMesh
writer.filename = gravity-statevars-elastic.vtk
[pylithapp.timedependent.materials.viscoelastic.output]
cell_info_fields = [density,mu,lambda,maxwell_time]
-cell_filter = pylith.meshio.CellFilterAvg
+cell_filter = pylith.meshio.CellFilterAvgMesh
writer.filename = gravity-statevars-viscoelastic.vtk
Modified: short/3D/PyLith/trunk/examples/3d/hex8/gravity_istress.cfg
===================================================================
--- short/3D/PyLith/trunk/examples/3d/hex8/gravity_istress.cfg 2009-06-08 22:00:14 UTC (rev 15145)
+++ short/3D/PyLith/trunk/examples/3d/hex8/gravity_istress.cfg 2009-06-08 23:06:06 UTC (rev 15146)
@@ -60,27 +60,27 @@
[pylithapp.timedependent.bc.x_pos]
fixed_dof = [0]
label = 11
-db.label = Dirichlet BC on +x
+db_initial.label = Dirichlet BC on +x
[pylithapp.timedependent.bc.x_neg]
fixed_dof = [0]
label = 12
-db.label = Dirichlet BC on -x
+db_initial.label = Dirichlet BC on -x
[pylithapp.timedependent.bc.y_pos]
fixed_dof = [1]
label = 13
-db.label = Dirichlet BC on +y
+db_initial.label = Dirichlet BC on +y
[pylithapp.timedependent.bc.y_neg]
fixed_dof = [1]
label = 14
-db.label = Dirichlet BC on -y
+db_initial.label = Dirichlet BC on -y
[pylithapp.timedependent.bc.z_neg]
fixed_dof = [2]
label = 15
-db.label = Dirichlet BC on -z
+db_initial.label = Dirichlet BC on -z
# ----------------------------------------------------------------------
# output
Modified: short/3D/PyLith/trunk/examples/3d/hex8/savageprescott.cfg
===================================================================
--- short/3D/PyLith/trunk/examples/3d/hex8/savageprescott.cfg 2009-06-08 22:00:14 UTC (rev 15145)
+++ short/3D/PyLith/trunk/examples/3d/hex8/savageprescott.cfg 2009-06-08 23:06:06 UTC (rev 15146)
@@ -57,27 +57,27 @@
[pylithapp.timedependent.bc.x_pos]
fixed_dof = [0, 1]
label = 11
-db.label = Dirichlet BC on +x
-rate_db = spatialdata.spatialdb.UniformDB
-rate_db.label = Dirichlet rate BC on +x
-rate_db.values = [dof-0,dof-1]
+db_initial.label = Dirichlet BC on +x
+db_rate = spatialdata.spatialdb.UniformDB
+db_rate.label = Dirichlet rate BC on +x
+db_rate.values = [displacement-rate-x,displacement-rate-y,rate-start-time]
# Velocity of -1.0 cm/yr (-3.1688087814028952e-10 m/s)
-rate_db.data = [0.0,-3.1688087814028952e-10]
+db_rate.data = [0.0,-3.1688087814028952e-10,0.0]
[pylithapp.timedependent.bc.x_neg]
fixed_dof = [0, 1]
label = 12
-db.label = Dirichlet BC on -x
-rate_db = spatialdata.spatialdb.UniformDB
-rate_db.label = Dirichlet rate BC on -x
-rate_db.values = [dof-0,dof-1]
+db_initial.label = Dirichlet BC on -x
+db_rate = spatialdata.spatialdb.UniformDB
+db_rate.label = Dirichlet rate BC on -x
+db_rate.values = [displacement-rate-x,displacement-rate-y,rate-start-time]
# Velocity of +1.0 cm/yr (+3.1688087814028952e-10 m/s)
-rate_db.data = [0.0,+3.1688087814028952e-10]
+db_rate.data = [0.0,+3.1688087814028952e-10,0.0]
[pylithapp.timedependent.bc.z_neg]
fixed_dof = [2]
label = 16
-db.label = Dirichlet BC on -z
+db_initial.label = Dirichlet BC on -z
# ----------------------------------------------------------------------
# faults
Modified: short/3D/PyLith/trunk/examples/3d/hex8/shearxy.cfg
===================================================================
--- short/3D/PyLith/trunk/examples/3d/hex8/shearxy.cfg 2009-06-08 22:00:14 UTC (rev 15145)
+++ short/3D/PyLith/trunk/examples/3d/hex8/shearxy.cfg 2009-06-08 23:06:06 UTC (rev 15146)
@@ -43,23 +43,23 @@
[pylithapp.timedependent.bc.x_pos]
fixed_dof = [0, 1]
label = 11
-db = spatialdata.spatialdb.SimpleDB
-db.label = Dirichlet BC on +x
-db.iohandler.filename = fixeddisp_shear.spatialdb
+db_initial = spatialdata.spatialdb.SimpleDB
+db_initial.label = Dirichlet BC on +x
+db_initial.iohandler.filename = fixeddisp_shear.spatialdb
[pylithapp.timedependent.bc.x_neg]
fixed_dof = [0, 1]
label = 12
-db = spatialdata.spatialdb.SimpleDB
-db.label = Dirichlet BC on -x
-db.iohandler.filename = fixeddisp_shear.spatialdb
+db_initial = spatialdata.spatialdb.SimpleDB
+db_initial.label = Dirichlet BC on -x
+db_initial.iohandler.filename = fixeddisp_shear.spatialdb
[pylithapp.timedependent.bc.z_neg]
fixed_dof = [2]
label = 15
-db = spatialdata.spatialdb.SimpleDB
-db.label = Dirichlet BC on -z
-db.iohandler.filename = fixeddisp_shear.spatialdb
+db_initial = spatialdata.spatialdb.SimpleDB
+db_initial.label = Dirichlet BC on -z
+db_initial.iohandler.filename = fixeddisp_shear.spatialdb
# ----------------------------------------------------------------------
# output
Modified: short/3D/PyLith/trunk/libsrc/bc/DirichletBC.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/bc/DirichletBC.cc 2009-06-08 22:00:14 UTC (rev 15145)
+++ short/3D/PyLith/trunk/libsrc/bc/DirichletBC.cc 2009-06-08 23:06:06 UTC (rev 15146)
@@ -14,9 +14,9 @@
#include "DirichletBC.hh" // implementation of object methods
-#include "pylith/topology/Field.hh" // USES Field
#include "pylith/topology/Mesh.hh" // USES Mesh
-#include "spatialdata/spatialdb/SpatialDB.hh" // USES SpatialDB
+#include "pylith/topology/Field.hh" // USES Field
+#include "pylith/topology/Fields.hh" // USES Fields
#include "spatialdata/geocoords/CoordSys.hh" // USES CoordSys
#include "spatialdata/units/Nondimensional.hh" // USES Nondimensional
@@ -33,9 +33,7 @@
// ----------------------------------------------------------------------
// Default constructor.
-pylith::bc::DirichletBC::DirichletBC(void) :
- _tRef(0.0),
- _dbRate(0)
+pylith::bc::DirichletBC::DirichletBC(void)
{ // constructor
} // constructor
@@ -43,36 +41,22 @@
// Destructor.
pylith::bc::DirichletBC::~DirichletBC(void)
{ // destructor
- _dbRate = 0; // Don't manage memory
} // destructor
// ----------------------------------------------------------------------
-// Set indices of fixed degrees of freedom.
-void
-pylith::bc::DirichletBC::fixedDOF(const int* flags,
- const int size)
-{ // fixedDOF
- if (size > 0)
- assert(0 != flags);
-
- _fixedDOF.resize(size);
- for (int i=0; i < size; ++i)
- _fixedDOF[i] = flags[i];
-} // fixedDOF
-
-// ----------------------------------------------------------------------
// Initialize boundary condition.
void
pylith::bc::DirichletBC::initialize(const topology::Mesh& mesh,
const double upDir[3])
{ // initialize
- const int numFixedDOF = _fixedDOF.size();
- if (0 == numFixedDOF)
+ if (0 == _bcDOF.size())
return;
_getPoints(mesh);
- _setupQueryDatabases();
- _queryDatabases(mesh);
+
+ assert(0 != _normalizer);
+ const double lengthScale = _normalizer->lengthScale();
+ _queryDatabases(mesh, lengthScale, "displacement");
} // initialize
// ----------------------------------------------------------------------
@@ -80,7 +64,7 @@
void
pylith::bc::DirichletBC::setConstraintSizes(const topology::Field<topology::Mesh>& field)
{ // setConstraintSizes
- const int numFixedDOF = _fixedDOF.size();
+ const int numFixedDOF = _bcDOF.size();
if (0 == numFixedDOF)
return;
@@ -124,7 +108,7 @@
void
pylith::bc::DirichletBC::setConstraints(const topology::Field<topology::Mesh>& field)
{ // setConstraints
- const int numFixedDOF = _fixedDOF.size();
+ const int numFixedDOF = _bcDOF.size();
if (0 == numFixedDOF)
return;
@@ -148,12 +132,12 @@
const int numPrevious = _offsetLocal[iPoint];
for (int iDOF=0; iDOF < numPrevious; ++iDOF)
for (int jDOF=0; jDOF < numFixedDOF; ++jDOF)
- if (allFixedDOF[iDOF] == _fixedDOF[jDOF]) {
+ if (allFixedDOF[iDOF] == _bcDOF[jDOF]) {
std::ostringstream msg;
msg << "Found multiple constraints on degrees of freedom at\n"
<< "point while setting up constraints for DirichletBC\n"
<< "boundary condition '" << _label << "'.\n"
- << "Degree of freedom " << _fixedDOF[jDOF]
+ << "Degree of freedom " << _bcDOF[jDOF]
<< " is already constrained by another Dirichlet BC.";
throw std::runtime_error(msg.str());
} // if
@@ -161,7 +145,7 @@
// Add in the ones for this DirichletBC BC
for (int iDOF=0; iDOF < numFixedDOF; ++iDOF) {
assert(_offsetLocal[iPoint]+iDOF < numTotalConstrained);
- allFixedDOF[_offsetLocal[iPoint]+iDOF] = _fixedDOF[iDOF];
+ allFixedDOF[_offsetLocal[iPoint]+iDOF] = _bcDOF[iDOF];
} // for
// Fill in rest of values not yet set (will be set by
@@ -193,30 +177,33 @@
pylith::bc::DirichletBC::setField(const double t,
const topology::Field<topology::Mesh>& field)
{ // setField
- const int numFixedDOF = _fixedDOF.size();
+ const int numFixedDOF = _bcDOF.size();
if (0 == numFixedDOF)
return;
- const ALE::Obj<RealSection>& section = field.section();
- assert(!section.isNull());
- const ALE::Obj<SieveMesh>& sieveMesh = field.mesh().sieveMesh();
- assert(!sieveMesh.isNull());
+ // Calculate spatial and temporal variation of value for BC.
+ _calculateValue(t);
const int numPoints = _points.size();
+
+ double_array valueVertex(numFixedDOF);
+ const ALE::Obj<RealSection>& valueSection =
+ _parameters->get("value").section();
+ assert(!valueSection.isNull());
+
+ const ALE::Obj<RealSection>& section = field.section();
+ assert(!section.isNull());
const int fiberDimension =
(numPoints > 0) ? section->getFiberDimension(_points[0]) : 0;
- double_array allValues(fiberDimension);
+ double_array fieldVertex(fiberDimension);
+
for (int iPoint=0; iPoint < numPoints; ++iPoint) {
const SieveMesh::point_type point = _points[iPoint];
- assert(fiberDimension == section->getFiberDimension(point));
- section->restrictPoint(point, &allValues[0], allValues.size());
+ section->restrictPoint(point, &fieldVertex[0], fieldVertex.size());
+ valueSection->restrictPoint(point, &valueVertex[0], valueVertex.size());
for (int iDOF=0; iDOF < numFixedDOF; ++iDOF)
- allValues[_fixedDOF[iDOF]] = _valuesInitial[iPoint*numFixedDOF+iDOF];
- if (t > _tRef && 0 != _dbRate)
- for (int iDOF=0; iDOF < numFixedDOF; ++iDOF)
- allValues[_fixedDOF[iDOF]] +=
- (t-_tRef) * _valuesRate[iPoint*numFixedDOF+iDOF];
- section->updatePointAll(_points[iPoint], &allValues[0]);
+ fieldVertex[_bcDOF[iDOF]] = valueVertex[iDOF];
+ section->updatePointAll(_points[iPoint], &fieldVertex[0]);
} // for
} // setField
@@ -229,174 +216,49 @@
{ // setFieldIncr
assert(_useSolnIncr);
- const int numFixedDOF = _fixedDOF.size();
+ const int numFixedDOF = _bcDOF.size();
if (0 == numFixedDOF)
return;
- if (0 == _dbRate) // no rate dependence -> no increment in field
+
+ // no temporal change -> no increment in field
+ if (0 == _dbRate && 0 == _dbChange)
return;
- const ALE::Obj<RealSection>& section = field.section();
- assert(!section.isNull());
- const ALE::Obj<SieveMesh>& sieveMesh = field.mesh().sieveMesh();
- assert(!sieveMesh.isNull());
+ // Calculate spatial and temporal variation of value for BC.
+ _calculateValueIncr(t0, t1);
const int numPoints = _points.size();
- const int fiberDimension =
- (numPoints > 0) ? section->getFiberDimension(_points[0]) : 0;
- double_array allValues(fiberDimension);
- // Account for when rate dependence begins.
- double tIncr = 0.0;
- if (t0 > _tRef) // rate dependence for t0 to t1
- tIncr = t1 - t0;
- else if (t1 > _tRef) // rate dependence for tRef to t1
- tIncr = t1 - _tRef;
- else
- tIncr = 0.0; // no rate dependence for t0 to t1
+ double_array valueVertex(numFixedDOF);
+ const ALE::Obj<RealSection>& valueSection =
+ _parameters->get("value").section();
+ assert(!valueSection.isNull());
+ const ALE::Obj<RealSection>& section = field.section();
+ assert(!section.isNull());
+ const int fiberDimension =
+ (numPoints > 0) ? section->getFiberDimension(_points[0]) : 0;
+ double_array fieldVertex(fiberDimension);
+
for (int iPoint=0; iPoint < numPoints; ++iPoint) {
const SieveMesh::point_type point = _points[iPoint];
- assert(fiberDimension == section->getFiberDimension(point));
- section->restrictPoint(point, &allValues[0], allValues.size());
+ section->restrictPoint(point, &fieldVertex[0], fieldVertex.size());
+ valueSection->restrictPoint(point, &valueVertex[0], valueVertex.size());
for (int iDOF=0; iDOF < numFixedDOF; ++iDOF)
- allValues[_fixedDOF[iDOF]] = tIncr * _valuesRate[iPoint*numFixedDOF+iDOF];
- section->updatePointAll(_points[iPoint], &allValues[0]);
+ fieldVertex[_bcDOF[iDOF]] = valueVertex[iDOF];
+ section->updatePointAll(_points[iPoint], &fieldVertex[0]);
} // for
+
} // setFieldIncr
// ----------------------------------------------------------------------
-// Get mesh labels for points associated with Dirichlet BC.
+// Verify configuration is acceptable.
void
-pylith::bc::DirichletBC::_getPoints(const topology::Mesh& mesh)
-{ // _getPoints
- typedef topology::Mesh::IntSection::chart_type chart_type;
+pylith::bc::DirichletBC::verifyConfiguration(const topology::Mesh& mesh) const
+{ // verifyConfiguration
+ BoundaryCondition::verifyConfiguration(mesh);
+ TimeDependent::verifyConfiguration(mesh);
+} // verifyConfiguration
- const ALE::Obj<SieveMesh>& sieveMesh = mesh.sieveMesh();
- assert(!sieveMesh.isNull());
- const ALE::Obj<SieveMesh::int_section_type>& groupField =
- sieveMesh->getIntSection(_label);
- if (groupField.isNull()) {
- std::ostringstream msg;
- msg << "Could not find group of points '" << _label << "' in mesh.";
- throw std::runtime_error(msg.str());
- } // if
- assert(!groupField.isNull());
- const chart_type& chart = groupField->getChart();
- const chart_type::const_iterator& chartEnd = chart.end();
- const int numPoints = groupField->size();
- _points.resize(numPoints);
- int i = 0;
- for(chart_type::const_iterator c_iter = chart.begin();
- c_iter != chartEnd;
- ++c_iter)
- if (groupField->getFiberDimension(*c_iter))
- _points[i++] = *c_iter;
-} // _getPoints
-
-// ----------------------------------------------------------------------
-// Setup initial and rate of change databases for querying.
-void
-pylith::bc::DirichletBC::_setupQueryDatabases(void)
-{ // _setupQueryDatabases
- assert(0 != _db);
-
- const int numFixedDOF = _fixedDOF.size();
- char** valueNames = (numFixedDOF > 0) ? new char*[numFixedDOF] : 0;
- for (int i=0; i < numFixedDOF; ++i) {
- std::ostringstream name;
- name << "dof-" << _fixedDOF[i];
- const int size = 1 + name.str().length();
- valueNames[i] = new char[size];
- strcpy(valueNames[i], name.str().c_str());
- } // for
-
- // Setup initial database.
- _db->open();
- _db->queryVals(const_cast<const char**>(valueNames), numFixedDOF);
-
- // Setup rate database, if provided.
- if (0 != _dbRate) {
- _dbRate->open();
- _dbRate->queryVals((const char**) valueNames, numFixedDOF);
- } // if
- for (int i=0; i < numFixedDOF; ++i) {
- delete[] valueNames[i]; valueNames[i] = 0;
- } // for
- delete[] valueNames; valueNames = 0;
-} // _setupQueryDatabases
-
-// ----------------------------------------------------------------------
-// Query initial and rate of change databases for values.
-void
-pylith::bc::DirichletBC::_queryDatabases(const topology::Mesh& mesh)
-{ // _queryDatabases
- assert(0 != _db);
-
- const ALE::Obj<SieveMesh>& sieveMesh = mesh.sieveMesh();
- assert(!sieveMesh.isNull());
-
- const ALE::Obj<RealSection>& coordinates =
- sieveMesh->getRealSection("coordinates");
- assert(!coordinates.isNull());
-
- const spatialdata::geocoords::CoordSys* cs = mesh.coordsys();
- assert(0 != cs);
- const int spaceDim = cs->spaceDim();
-
- assert(0 != _normalizer);
- const double lengthScale = _normalizer->lengthScale();
- const double velocityScale =
- _normalizer->lengthScale() / _normalizer->timeScale();
-
- const int numPoints = _points.size();
- const int numFixedDOF = _fixedDOF.size();
- _valuesInitial.resize(numPoints*numFixedDOF);
- if (0 != _dbRate)
- _valuesRate.resize(numPoints*numFixedDOF);
-
- double_array queryValues(numFixedDOF);
- double_array vCoordsGlobal(spaceDim);
- for (int iPoint=0; iPoint < numPoints; ++iPoint) {
- // Get coordinates of vertex
- coordinates->restrictPoint(_points[iPoint],
- &vCoordsGlobal[0], vCoordsGlobal.size());
- _normalizer->dimensionalize(&vCoordsGlobal[0], vCoordsGlobal.size(),
- lengthScale);
- int err = _db->query(&queryValues[0], numFixedDOF,
- &vCoordsGlobal[0], vCoordsGlobal.size(), cs);
- if (err) {
- std::ostringstream msg;
- msg << "Could not find initial values at (";
- for (int i=0; i < spaceDim; ++i)
- msg << " " << vCoordsGlobal[i];
- msg << ") using spatial database " << _db->label() << ".";
- throw std::runtime_error(msg.str());
- } // if
- for (int iDOF=0; iDOF < numFixedDOF; ++iDOF)
- _valuesInitial[numFixedDOF*iPoint+iDOF] =
- _normalizer->nondimensionalize(queryValues[iDOF], lengthScale);
-
- if (0 != _dbRate) {
- err = _dbRate->query(&queryValues[0], numFixedDOF,
- &vCoordsGlobal[0], vCoordsGlobal.size(), cs);
- if (err) {
- std::ostringstream msg;
- msg << "Could not find rate values at (";
- for (int i=0; i < spaceDim; ++i)
- msg << " " << vCoordsGlobal[i];
- msg << ") using spatial database " << _dbRate->label() << ".";
- throw std::runtime_error(msg.str());
- } // if
- for (int iDOF=0; iDOF < numFixedDOF; ++iDOF)
- _valuesRate[numFixedDOF*iPoint+iDOF] =
- _normalizer->nondimensionalize(queryValues[iDOF], velocityScale);
- } // if
- } // for
- _db->close();
- if (0 != _dbRate)
- _dbRate->close();
-} // _queryDatabases
-
-
// End of file
Modified: short/3D/PyLith/trunk/libsrc/bc/DirichletBC.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/bc/DirichletBC.hh 2009-06-08 22:00:14 UTC (rev 15145)
+++ short/3D/PyLith/trunk/libsrc/bc/DirichletBC.hh 2009-06-08 23:06:06 UTC (rev 15146)
@@ -20,13 +20,13 @@
#define pylith_bc_dirichletbc_hh
// Include directives ---------------------------------------------------
-#include "BoundaryCondition.hh" // ISA BoundaryCondition
+#include "TimeDependentPoints.hh" // ISA TimeDependentPoints
#include "pylith/feassemble/Constraint.hh" // ISA Constraint
-#include "pylith/utils/array.hh" // HASA std::vector, double_array, int_array
+#include "pylith/utils/array.hh" // HASA int_array
// DirichletBC ------------------------------------------------------
-class pylith::bc::DirichletBC : public BoundaryCondition,
+class pylith::bc::DirichletBC : public TimeDependentPoints,
public feassemble::Constraint
{ // class DirichletBC
friend class TestDirichletBC; // unit testing
@@ -40,31 +40,6 @@
/// Destructor.
~DirichletBC(void);
- /** Set database for rate of change of values.
- *
- * @param db Spatial database
- */
- void dbRate(spatialdata::spatialdb::SpatialDB* const db);
-
- /** Set indices of fixed degrees of freedom.
- *
- * Note: all points associated with boundary condition has same
- * degrees of freedom fixed.
- *
- * Example: [0, 1] to fix x and y degrees of freedom in Cartesian system.
- *
- * @param flags Array of indices of fixed degrees of freedom.
- * @param size Size of array
- */
- void fixedDOF(const int* flags,
- const int size);
-
- /** Set time at which rate of change begins.
- *
- * @param t Reference time.
- */
- void referenceTime(const double t);
-
/** Initialize boundary condition.
*
* @param mesh PETSc mesh
@@ -103,50 +78,34 @@
const double t1,
const topology::Field<topology::Mesh>& field);
- // PROTECTED METHODS //////////////////////////////////////////////////
-protected :
-
- /** Get mesh labels for points associated with Dirichlet BC.
+ /** Verify configuration is acceptable.
*
- * @param mesh Finite-element mesh.
+ * @param mesh Finite-element mesh
*/
- void _getPoints(const topology::Mesh& mesh);
+ void verifyConfiguration(const topology::Mesh& mesh) const;
- /// Setup initial and rate of change databases for querying.
- void _setupQueryDatabases(void);
+ // PROTECTED METHODS //////////////////////////////////////////////////
+protected :
- /** Query initial and rate of change databases for values.
+ /** Get manager of scales used to nondimensionalize problem.
*
- * @param mesh Finite-element mesh.
+ * @returns Nondimensionalizer.
*/
- void _queryDatabases(const topology::Mesh& mesh);
+ const spatialdata::units::Nondimensional& _getNormalizer(void) const;
- // NOT IMPLEMENTED ////////////////////////////////////////////////////
-private :
-
- /// Not implemented
- DirichletBC(const DirichletBC& m);
-
- /// Not implemented
- const DirichletBC& operator=(const DirichletBC& m);
-
// PROTECTED MEMBERS //////////////////////////////////////////////////
protected :
- double _tRef; /// Time when rate of change for values begins.
- double_array _valuesInitial; ///< Initial values at points.
- double_array _valuesRate; ///< Rate of change of values at points.
-
- int_array _points; ///< Points for BC
- int_array _fixedDOF; ///< Indices of fixed degrees of freedom
-
/// Offset in list of fixed DOF at point to get to fixed DOF
/// associated with this DirichletBC boundary condition.
int_array _offsetLocal;
- /// Spatial database with parameters for rate of change values.
- spatialdata::spatialdb::SpatialDB* _dbRate;
+ // NOT IMPLEMENTED ////////////////////////////////////////////////////
+private :
+ DirichletBC(const DirichletBC&); ///< Not implemented
+ const DirichletBC& operator=(const DirichletBC&); ///< Not implemented
+
}; // class DirichletBC
#include "DirichletBC.icc" // inline methods
Modified: short/3D/PyLith/trunk/libsrc/bc/DirichletBC.icc
===================================================================
--- short/3D/PyLith/trunk/libsrc/bc/DirichletBC.icc 2009-06-08 22:00:14 UTC (rev 15145)
+++ short/3D/PyLith/trunk/libsrc/bc/DirichletBC.icc 2009-06-08 23:06:06 UTC (rev 15146)
@@ -14,19 +14,15 @@
#error "DirichletBC.icc can only be included from DirichletBC.hh"
#endif
-// Set database for boundary condition parameters.
+#include <cassert> // USES assert()
+
+// Get manager of scales used to nondimensionalize problem.
inline
-void
-pylith::bc::DirichletBC::dbRate(spatialdata::spatialdb::SpatialDB* const db) {
- _dbRate = db;
+const spatialdata::units::Nondimensional&
+pylith::bc::DirichletBC::_getNormalizer(void) const {
+ assert(0 != _normalizer);
+ return *_normalizer;
}
-// Set time at which rate of change begins.
-inline
-void
-pylith::bc::DirichletBC::referenceTime(const double t) {
- _tRef = t;
-} // referenceTime
-
// End of file
Modified: short/3D/PyLith/trunk/libsrc/bc/DirichletBoundary.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/bc/DirichletBoundary.cc 2009-06-08 22:00:14 UTC (rev 15145)
+++ short/3D/PyLith/trunk/libsrc/bc/DirichletBoundary.cc 2009-06-08 23:06:06 UTC (rev 15146)
@@ -48,16 +48,10 @@
pylith::bc::DirichletBoundary::initialize(const topology::Mesh& mesh,
const double upDir[3])
{ // initialize
- const int numFixedDOF = _fixedDOF.size();
- if (0 == numFixedDOF)
- return;
+ DirichletBC::initialize(mesh, upDir);
_boundaryMesh = new topology::SubMesh(mesh, _label.c_str());
assert(0 != _boundaryMesh);
-
- _getPoints(mesh);
- _setupQueryDatabases();
- _queryDatabases(mesh);
} // initialize
// ----------------------------------------------------------------------
@@ -66,84 +60,168 @@
pylith::bc::DirichletBoundary::vertexField(const char* name,
const topology::SolutionFields& fields)
{ // getVertexField
+ assert(0 != _normalizer);
+ const double lengthScale = _normalizer->lengthScale();
+ const double timeScale = _normalizer->timeScale();
+ const double rateScale = lengthScale / timeScale;
+
+ if (0 == strcasecmp(name, "initial"))
+ return _bufferVector("initial", "initial_displacement", lengthScale);
+ else if (0 == strcasecmp(name, "rate-of-change"))
+ return _bufferVector("rate", "initial_velocity", rateScale);
+ else if (0 == strcasecmp(name, "change-in-value"))
+ return _bufferVector("change", "displacement_change", lengthScale);
+ else if (0 == strcasecmp(name, "rate-start-time"))
+ return _bufferScalar("rate-start-time", "velocity_start_time", timeScale);
+ else if (0 == strcasecmp(name, "change-start-time"))
+ return _bufferScalar("change-start-time", "change_start_time", timeScale);
+ else {
+ std::ostringstream msg;
+ msg
+ << "Unknown field '" << name << "' requested for Dirichlet boundary BC '"
+ << _label << "'.";
+ throw std::runtime_error(msg.str());
+ } // else
+
+ // Satisfy return value (should never reach here)
+ return _fields->get("null");
+} // getVertexField
+
+// ----------------------------------------------------------------------
+// Get vertex vector field with BC information.
+const pylith::topology::Field<pylith::topology::SubMesh>&
+pylith::bc::DirichletBoundary::_bufferVector(const char* name,
+ const char* label,
+ const double scale)
+{ // _bufferVector
typedef topology::SubMesh::SieveMesh SieveMesh;
typedef topology::SubMesh::RealSection RealSection;
- assert(0 != name);
assert(0 != _boundaryMesh);
- assert(0 != _normalizer);
+ assert(0 != _parameters);
+ if (_parameters->hasField(name)) {
+ std::ostringstream msg;
+ msg << "Parameters for field '" << label << " not provided in "
+ << "Dirichlet BC '" << _label << "'.";
+ throw std::runtime_error(msg.str());
+ } // if
+
+ if (0 == _fields)
+ _fields =
+ new topology::Fields<topology::Field<topology::SubMesh> >(*_boundaryMesh);
+ assert(0 != _fields);
+
const ALE::Obj<SieveMesh>& sieveMesh = _boundaryMesh->sieveMesh();
assert(!sieveMesh.isNull());
- const ALE::Obj<SieveMesh::label_sequence>& vertices =
- sieveMesh->depthStratum(0);
- assert(!vertices.isNull());
-
const spatialdata::geocoords::CoordSys* cs = _boundaryMesh->coordsys();
assert(0 != cs);
const int fiberDim = cs->spaceDim();
- double_array values(fiberDim);
const int numPoints = _points.size();
- const int numFixedDOF = _fixedDOF.size();
+ const int numFixedDOF = _bcDOF.size();
- if (0 == _fields) {
- _fields =
- new topology::Fields<topology::Field<topology::SubMesh> >(*_boundaryMesh);
- assert(0 != _fields);
- _fields->add("output buffer", "temporary_buffer");
+ double_array bufferVertex(fiberDim);
+ if (!_fields->hasField("buffer (vector)")) {
+ _fields->add("buffer (vector)", "buffer");
topology::Field<topology::SubMesh>& buffer =
- _fields->get("output buffer");
- buffer.newSection(vertices, fiberDim);
+ _fields->get("buffer (vector)");
+ buffer.newSection(topology::FieldBase::VERTICES_FIELD, fiberDim);
buffer.allocate();
- buffer.addDimensionOkay(true);
- buffer.vectorFieldType(topology::Field<topology::SubMesh>::VECTOR);
} // if
-
topology::Field<topology::SubMesh>& buffer =
- _fields->get("output buffer");
- if (0 == strcasecmp(name, "initial")) {
- buffer.label("bc_displacement");
- buffer.vectorFieldType(topology::Field<topology::SubMesh>::VECTOR);
- buffer.scale(_normalizer->lengthScale());
- buffer.zero();
- const ALE::Obj<RealSection>& section = buffer.section();
+ _fields->get("buffer (vector)");
+ buffer.label(label);
+ buffer.scale(scale);
+ buffer.vectorFieldType(topology::FieldBase::VECTOR);
+ buffer.zero();
+ const ALE::Obj<RealSection>& bufferSection = buffer.section();
+ assert(!bufferSection.isNull());
- for (int iPoint=0; iPoint < numPoints; ++iPoint) {
- const SieveMesh::point_type point = _points[iPoint];
- assert(fiberDim == section->getFiberDimension(point));
- for (int iDOF=0; iDOF < numFixedDOF; ++iDOF)
- values[_fixedDOF[iDOF]] = _valuesInitial[iPoint*numFixedDOF+iDOF];
- section->updatePointAll(_points[iPoint], &values[0]);
- } // for
- } else if (0 == strcasecmp(name, "rate-of-change")) {
- buffer.label("bc_velocity");
- buffer.vectorFieldType(topology::Field<topology::SubMesh>::VECTOR);
- assert(0 != _normalizer->timeScale());
- const double velocityScale =
- _normalizer->lengthScale() / _normalizer->timeScale();
- buffer.scale(velocityScale);
- buffer.zero();
- const ALE::Obj<RealSection>& section = buffer.section();
+ double_array parameterVertex(numFixedDOF);
+ const ALE::Obj<RealSection>& parameterSection =
+ _parameters->get(name).section();
+ assert(!parameterSection.isNull());
+
+ for (int iPoint=0; iPoint < numPoints; ++iPoint) {
+ const SieveMesh::point_type point = _points[iPoint];
+ bufferVertex = 0.0;
- for (int iPoint=0; iPoint < numPoints; ++iPoint) {
- const SieveMesh::point_type point = _points[iPoint];
- assert(fiberDim == section->getFiberDimension(point));
- for (int iDOF=0; iDOF < numFixedDOF; ++iDOF)
- values[_fixedDOF[iDOF]] = _valuesRate[iPoint*numFixedDOF+iDOF];
- section->updatePointAll(_points[iPoint], &values[0]);
- } // for
- } else {
+ parameterSection->restrictPoint(point, ¶meterVertex[0],
+ parameterVertex.size());
+
+ for (int iDOF=0; iDOF < numFixedDOF; ++iDOF)
+ bufferVertex[_bcDOF[iDOF]] = parameterVertex[iDOF];
+ assert(fiberDim == bufferSection->getFiberDimension(point));
+ bufferSection->updatePointAll(point, &bufferVertex[0]);
+ } // for
+
+ return buffer;
+} // _bufferVector
+
+// ----------------------------------------------------------------------
+// Get vertex scalar field with BC information.
+const pylith::topology::Field<pylith::topology::SubMesh>&
+pylith::bc::DirichletBoundary::_bufferScalar(const char* name,
+ const char* label,
+ const double scale)
+{ // _bufferScalar
+ typedef topology::SubMesh::SieveMesh SieveMesh;
+ typedef topology::SubMesh::RealSection RealSection;
+
+ assert(0 != _boundaryMesh);
+ assert(0 != _parameters);
+
+ if (_parameters->hasField(name)) {
std::ostringstream msg;
- msg
- << "Unknown field '" << name << "' requested for Dirichlet boundary BC '"
- << _label << "'.";
+ msg << "Parameters for field '" << label << " not provided in "
+ << "Dirichlet BC '" << _label << "'.";
throw std::runtime_error(msg.str());
- } // else
+ } // if
+
+ if (0 == _fields)
+ _fields =
+ new topology::Fields<topology::Field<topology::SubMesh> >(*_boundaryMesh);
+ assert(0 != _fields);
+
+ const ALE::Obj<SieveMesh>& sieveMesh = _boundaryMesh->sieveMesh();
+ assert(!sieveMesh.isNull());
+ const int numPoints = _points.size();
+ const int fiberDim = 1;
+
+ if (!_fields->hasField("buffer (scalar)")) {
+ _fields->add("buffer (scalar)", "buffer");
+ topology::Field<topology::SubMesh>& buffer =
+ _fields->get("buffer (scalar)");
+ buffer.newSection(topology::FieldBase::VERTICES_FIELD, fiberDim);
+ buffer.allocate();
+ } // if
+ topology::Field<topology::SubMesh>& buffer =
+ _fields->get("buffer (scalar)");
+ buffer.label(label);
+ buffer.scale(scale);
+ buffer.vectorFieldType(topology::FieldBase::SCALAR);
+ buffer.zero();
+ const ALE::Obj<RealSection>& bufferSection = buffer.section();
+ assert(!bufferSection.isNull());
+
+ const ALE::Obj<RealSection>& parameterSection =
+ _parameters->get(name).section();
+ assert(!parameterSection.isNull());
+
+ for (int iPoint=0; iPoint < numPoints; ++iPoint) {
+ const SieveMesh::point_type point = _points[iPoint];
+
+ assert(1 == bufferSection->getFiberDimension(point));
+ assert(1 == parameterSection->getFiberDimension(point));
+ bufferSection->updatePointAll(point,
+ parameterSection->restrictPoint(point));
+ } // for
+
return buffer;
-} // getVertexField
+} // _bufferScalar
// End of file
Modified: short/3D/PyLith/trunk/libsrc/bc/DirichletBoundary.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/bc/DirichletBoundary.hh 2009-06-08 22:00:14 UTC (rev 15145)
+++ short/3D/PyLith/trunk/libsrc/bc/DirichletBoundary.hh 2009-06-08 23:06:06 UTC (rev 15146)
@@ -61,14 +61,34 @@
vertexField(const char* name,
const topology::SolutionFields& fields);
- // NOT IMPLEMENTED ////////////////////////////////////////////////////
+ // PRIVATE METHODS ////////////////////////////////////////////////////
private :
- /// Not implemented
- DirichletBoundary(const DirichletBoundary& m);
+ /** Get vertex vector field with BC information.
+ *
+ * @param name Name of parameter field.
+ * @param label Label for buffer field.
+ * @param scale Scale used to dimensionalize field.
+ *
+ * @returns Field over vertices.
+ */
+ const topology::Field<topology::SubMesh>&
+ _bufferVector(const char* name,
+ const char* label,
+ const double scale);
- /// Not implemented
- const DirichletBoundary& operator=(const DirichletBoundary& m);
+ /** Get vertex scalar field with BC information.
+ *
+ * @param name Name of parameter field.
+ * @param label Label for buffer field.
+ * @param scale Scale used to dimensionalize field.
+ *
+ * @returns Field over vertices.
+ */
+ const topology::Field<topology::SubMesh>&
+ _bufferScalar(const char* name,
+ const char* label,
+ const double scale);
// PRIVATE MEMBERS ////////////////////////////////////////////////////
private :
@@ -78,6 +98,15 @@
/// Fields manager (holds temporary field for output).
topology::Fields<topology::Field<topology::SubMesh> >* _fields;
+ // NOT IMPLEMENTED ////////////////////////////////////////////////////
+private :
+
+ /// Not implemented
+ DirichletBoundary(const DirichletBoundary&);
+
+ /// Not implemented
+ const DirichletBoundary& operator=(const DirichletBoundary&);
+
}; // class DirichletBoundary
#include "DirichletBoundary.icc" // inline methods
Modified: short/3D/PyLith/trunk/libsrc/bc/PointForce.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/bc/PointForce.cc 2009-06-08 22:00:14 UTC (rev 15145)
+++ short/3D/PyLith/trunk/libsrc/bc/PointForce.cc 2009-06-08 23:06:06 UTC (rev 15146)
@@ -15,6 +15,7 @@
#include "PointForce.hh" // implementation of object methods
#include "pylith/topology/Field.hh" // USES Field
+#include "pylith/topology/Fields.hh" // USES Fields
#include "spatialdata/geocoords/CoordSys.hh" // USES CoordSys
#include "spatialdata/units/Nondimensional.hh" // USES Nondimensional
@@ -45,13 +46,12 @@
pylith::bc::PointForce::initialize(const topology::Mesh& mesh,
const double upDir[3])
{ // initialize
- assert(0 != _normalizer);
-
if (0 == _bcDOF.size())
return;
_getPoints(mesh);
+ assert(0 != _normalizer);
const double lengthScale = _normalizer->lengthScale();
const double pressureScale = _normalizer->pressureScale();
const double forceScale = pressureScale * lengthScale * lengthScale;
Modified: short/3D/PyLith/trunk/libsrc/bc/TimeDependent.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/bc/TimeDependent.cc 2009-06-08 22:00:14 UTC (rev 15145)
+++ short/3D/PyLith/trunk/libsrc/bc/TimeDependent.cc 2009-06-08 23:06:06 UTC (rev 15146)
@@ -35,11 +35,6 @@
// Destructor.
pylith::bc::TimeDependent::~TimeDependent(void)
{ // destructor
-#if 0
- if (0 != _dbTimeHistory)
- _dbTimeHistory->close();
-#endif
-
_dbInitial = 0; // TODO: Use shared pointers
_dbRate = 0; // TODO: Use shared pointers
_dbChange = 0; // TODO: Use shared pointers
Modified: short/3D/PyLith/trunk/libsrc/bc/TimeDependentPoints.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/bc/TimeDependentPoints.cc 2009-06-08 22:00:14 UTC (rev 15145)
+++ short/3D/PyLith/trunk/libsrc/bc/TimeDependentPoints.cc 2009-06-08 23:06:06 UTC (rev 15146)
@@ -246,66 +246,55 @@
const int numBCDOF = _bcDOF.size();
const double timeScale = _getNormalizer().timeScale();
- const ALE::Obj<RealSection>& changeSection = (0 != _dbChange) ?
+ const ALE::Obj<RealSection>& initialSection = (0 != _dbInitial) ?
+ _parameters->get("initial").section() : 0;
+ const ALE::Obj<RealSection>& rateSection = ( 0 != _dbRate) ?
+ _parameters->get("rate").section() : 0;
+ const ALE::Obj<RealSection>& rateTimeSection = (0 != _dbRate) ?
+ _parameters->get("rate time").section() : 0;
+ const ALE::Obj<RealSection>& changeSection = ( 0 != _dbChange) ?
_parameters->get("change").section() : 0;
- const ALE::Obj<RealSection>& changeTimeSection = (0 != _dbChange) ?
+ const ALE::Obj<RealSection>& changeTimeSection = ( 0 != _dbChange) ?
_parameters->get("change time").section() : 0;
- // Contribution from initial value
- if (0 != _dbInitial) {
- double_array values(numBCDOF);
- const ALE::Obj<RealSection>& initialSection =
- _parameters->get("initial").section();
- assert(!initialSection.isNull());
-
- for (int iPoint=0; iPoint < numPoints; ++iPoint) {
- const int p_bc = _points[iPoint]; // Get point label
-
- initialSection->restrictPoint(p_bc, &values[0], values.size());
- valueSection->updateAddPoint(p_bc, &values[0]);
- } // for
- } // if
-
- // Contribution from rate of change of value
- if (0 != _dbRate) {
- double_array values(numBCDOF);
- double tRate = 0.0;
- const ALE::Obj<RealSection>& rateSection =
- _parameters->get("rate").section();
- assert(!rateSection.isNull());
- const ALE::Obj<RealSection>& rateTimeSection =
- _parameters->get("rate time").section();
- assert(!rateTimeSection.isNull());
-
- for (int iPoint=0; iPoint < numPoints; ++iPoint) {
- const int p_bc = _points[iPoint]; // Get point label
-
- rateSection->restrictPoint(p_bc, &values[0], values.size());
+ double_array valuesVertex(numBCDOF);
+ double_array bufferVertex(numBCDOF);
+ for (int iPoint=0; iPoint < numPoints; ++iPoint) {
+ const int p_bc = _points[iPoint]; // Get point label
+
+ valuesVertex = 0.0;
+
+ // Contribution from initial value
+ if (0 != _dbInitial) {
+ assert(!initialSection.isNull());
+ initialSection->restrictPoint(p_bc,
+ &bufferVertex[0], bufferVertex.size());
+ valuesVertex += bufferVertex;
+ } // if
+
+ // Contribution from rate of change of value
+ if (0 != _dbRate) {
+ assert(!rateSection.isNull());
+ assert(!rateTimeSection.isNull());
+ double tRate = 0.0;
+
+ rateSection->restrictPoint(p_bc, &bufferVertex[0], bufferVertex.size());
rateTimeSection->restrictPoint(p_bc, &tRate, 1);
if (t > tRate) { // rate of change integrated over time
- values *= (t - tRate);
- valueSection->updateAddPoint(p_bc, &values[0]);
+ bufferVertex *= (t - tRate);
+ valuesVertex += bufferVertex;
} // if
- } // for
- } // if
-
- // Contribution from change of value
- if (0 != _dbChange) {
- double_array values(numBCDOF);
- double tChange = 0.0;
- const ALE::Obj<RealSection>& changeSection =
- _parameters->get("change").section();
- assert(!changeSection.isNull());
- const ALE::Obj<RealSection>& changeTimeSection =
- _parameters->get("change time").section();
- assert(!changeTimeSection.isNull());
+ } // if
+
+ // Contribution from change of value
+ if (0 != _dbChange) {
+ assert(!changeSection.isNull());
+ assert(!changeTimeSection.isNull());
+ double tChange = 0.0;
- for (int iPoint=0; iPoint < numPoints; ++iPoint) {
- const int p_bc = _points[iPoint]; // Get point label
-
- changeSection->restrictPoint(p_bc, &values[0], values.size());
+ changeSection->restrictPoint(p_bc, &bufferVertex[0], bufferVertex.size());
changeTimeSection->restrictPoint(p_bc, &tChange, 1);
- if (t > tChange) { // change in value over time
+ if (t >= tChange) { // change in value over time
double scale = 1.0;
if (0 != _dbTimeHistory) {
double tDim = t - tChange;
@@ -313,17 +302,136 @@
const int err = _dbTimeHistory->query(&scale, tDim);
if (0 != err) {
std::ostringstream msg;
- msg << "Error querying for time '" << tDim << "' in time history database "
+ msg << "Error querying for time '" << tDim
+ << "' in time history database "
<< _dbTimeHistory->label() << ".";
throw std::runtime_error(msg.str());
} // if
} // if
- values *= scale;
- valueSection->updateAddPoint(p_bc, &values[0]);
+ bufferVertex *= scale;
+ valuesVertex += bufferVertex;
} // if
- } // for
- } // if
+ } // if
+
+ valueSection->updateAddPoint(p_bc, &valuesVertex[0]);
+ } // for
} // _calculateValue
+// ----------------------------------------------------------------------
+// Calculate increment in temporal and spatial variation of value over
+// the list of points.
+void
+pylith::bc::TimeDependentPoints::_calculateValueIncr(const double t0,
+ const double t1)
+{ // _calculateValueIncr
+ assert(0 != _parameters);
+ const ALE::Obj<RealSection>& valueSection =
+ _parameters->get("value").section();
+ assert(!valueSection.isNull());
+ valueSection->zero();
+
+ const int numPoints = _points.size();
+ const int numBCDOF = _bcDOF.size();
+ const double timeScale = _getNormalizer().timeScale();
+
+ const ALE::Obj<RealSection>& rateSection = ( 0 != _dbRate) ?
+ _parameters->get("rate").section() : 0;
+ const ALE::Obj<RealSection>& rateTimeSection = (0 != _dbRate) ?
+ _parameters->get("rate time").section() : 0;
+ const ALE::Obj<RealSection>& changeSection = ( 0 != _dbChange) ?
+ _parameters->get("change").section() : 0;
+ const ALE::Obj<RealSection>& changeTimeSection = ( 0 != _dbChange) ?
+ _parameters->get("change time").section() : 0;
+
+ double_array valuesVertex(numBCDOF);
+ double_array bufferVertex(numBCDOF);
+ for (int iPoint=0; iPoint < numPoints; ++iPoint) {
+ const int p_bc = _points[iPoint]; // Get point label
+
+ valuesVertex = 0.0;
+
+ // No contribution from initial value
+
+ // Contribution from rate of change of value
+ if (0 != _dbRate) {
+ assert(!rateSection.isNull());
+ assert(!rateTimeSection.isNull());
+ double tRate = 0.0;
+
+ rateSection->restrictPoint(p_bc, &bufferVertex[0], bufferVertex.size());
+ rateTimeSection->restrictPoint(p_bc, &tRate, 1);
+
+ // Account for when rate dependence begins.
+ double tIncr = 0.0;
+ if (t0 > tRate) // rate dependence for t0 to t1
+ tIncr = t1 - t0;
+ else if (t1 > tRate) // rate dependence for tRef to t1
+ tIncr = t1 - tRate;
+ else
+ tIncr = 0.0; // no rate dependence for t0 to t1
+
+ bufferVertex *= tIncr;
+ valuesVertex += bufferVertex;
+ } // if
+
+ // Contribution from change of value
+ if (0 != _dbChange) {
+ assert(!changeSection.isNull());
+ assert(!changeTimeSection.isNull());
+ double tChange = 0.0;
+
+ changeSection->restrictPoint(p_bc, &bufferVertex[0], bufferVertex.size());
+ changeTimeSection->restrictPoint(p_bc, &tChange, 1);
+ if (t0 >= tChange) { // increment is after change starts
+ double scale0 = 1.0;
+ double scale1 = 1.0;
+ if (0 != _dbTimeHistory) {
+ double tDim = t0 - tChange;
+ _getNormalizer().dimensionalize(&tDim, 1, timeScale);
+ int err = _dbTimeHistory->query(&scale0, tDim);
+ if (0 != err) {
+ std::ostringstream msg;
+ msg << "Error querying for time '" << tDim
+ << "' in time history database "
+ << _dbTimeHistory->label() << ".";
+ throw std::runtime_error(msg.str());
+ } // if
+ tDim = t1 - tChange;
+ _getNormalizer().dimensionalize(&tDim, 1, timeScale);
+ err = _dbTimeHistory->query(&scale1, tDim);
+ if (0 != err) {
+ std::ostringstream msg;
+ msg << "Error querying for time '" << tDim
+ << "' in time history database "
+ << _dbTimeHistory->label() << ".";
+ throw std::runtime_error(msg.str());
+ } // if
+ } // if
+ bufferVertex *= scale1 - scale0;
+ valuesVertex += bufferVertex;
+ } else if (t1 >= tChange) { // increment spans when change starts
+ double scale1 = 1.0;
+ if (0 != _dbTimeHistory) {
+ double tDim = t1 - tChange;
+ _getNormalizer().dimensionalize(&tDim, 1, timeScale);
+ int err = _dbTimeHistory->query(&scale1, tDim);
+ if (0 != err) {
+ std::ostringstream msg;
+ msg << "Error querying for time '" << tDim
+ << "' in time history database "
+ << _dbTimeHistory->label() << ".";
+ throw std::runtime_error(msg.str());
+ } // if
+ } // if
+ bufferVertex *= scale1;
+ valuesVertex += bufferVertex;
+ } // if/else
+ } // if
+
+ valueSection->updateAddPoint(p_bc, &valuesVertex[0]);
+ } // for
+} // _calculateValueIncr
+
+
// End of file
Modified: short/3D/PyLith/trunk/libsrc/bc/TimeDependentPoints.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/bc/TimeDependentPoints.hh 2009-06-08 22:00:14 UTC (rev 15145)
+++ short/3D/PyLith/trunk/libsrc/bc/TimeDependentPoints.hh 2009-06-08 23:06:06 UTC (rev 15146)
@@ -78,6 +78,15 @@
*/
void _calculateValue(const double t);
+ /** Calculate increment in spatial and temporal variation of value
+ * over the list of points.
+ *
+ * @param t0 Time when increment begins.
+ * @param t1 Time when increment ends.
+ */
+ void _calculateValueIncr(const double t0,
+ const double t1);
+
// NOT IMPLEMENTED ////////////////////////////////////////////////////
private :
Modified: short/3D/PyLith/trunk/libsrc/meshio/CellFilterAvg.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/meshio/CellFilterAvg.cc 2009-06-08 22:00:14 UTC (rev 15145)
+++ short/3D/PyLith/trunk/libsrc/meshio/CellFilterAvg.cc 2009-06-08 23:06:06 UTC (rev 15146)
@@ -93,11 +93,11 @@
if (0 == _fieldAvg) {
_fieldAvg = new field_type(fieldIn.mesh());
assert(0 != _fieldAvg);
- _fieldAvg->newSection(sectionIn->getChart(), fiberDim);
+ _fieldAvg->newSection(fieldIn, fiberDim);
_fieldAvg->allocate();
} else if (_fieldAvg->chartSize() != cells->size()*fiberDim) {
_fieldAvg->clear();
- _fieldAvg->newSection(sectionIn->getChart(), fiberDim);
+ _fieldAvg->newSection(fieldIn, fiberDim);
_fieldAvg->allocate();
} // else
Modified: short/3D/PyLith/trunk/libsrc/meshio/VertexFilterVecNorm.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/meshio/VertexFilterVecNorm.cc 2009-06-08 22:00:14 UTC (rev 15145)
+++ short/3D/PyLith/trunk/libsrc/meshio/VertexFilterVecNorm.cc 2009-06-08 23:06:06 UTC (rev 15146)
@@ -76,7 +76,7 @@
if (0 == _fieldVecNorm) {
_fieldVecNorm = new field_type(fieldIn.mesh());
_fieldVecNorm->label("vector norm");
- _fieldVecNorm->newSection(sectionIn->getChart(), fiberDimNorm);
+ _fieldVecNorm->newSection(fieldIn, fiberDimNorm);
_fieldVecNorm->allocate();
_fieldVecNorm->label(fieldIn.label());
Modified: short/3D/PyLith/trunk/libsrc/topology/Field.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/topology/Field.cc 2009-06-08 22:00:14 UTC (rev 15145)
+++ short/3D/PyLith/trunk/libsrc/topology/Field.cc 2009-06-08 23:06:06 UTC (rev 15146)
@@ -99,7 +99,7 @@
pylith::topology::Field<mesh_type>::newSection(void)
{ // newSection
ALE::MemoryLogger& logger = ALE::MemoryLogger::singleton();
- std::cout << "Making Field " << _label << " empty section" << std::endl;
+ //std::cout << "Making Field " << _label << " empty section" << std::endl;
logger.stagePush("Field");
_section = new RealSection(_mesh.comm(), _mesh.debug());
logger.stagePop();
@@ -117,7 +117,7 @@
typedef typename mesh_type::SieveMesh::point_type point_type;
ALE::MemoryLogger& logger = ALE::MemoryLogger::singleton();
- std::cout << "Making Field " << _label << " section type 1" << std::endl;
+ //std::cout << "Making Field " << _label << " section type 1" << std::endl;
logger.stagePush("Field");
if (fiberDim < 0) {
std::ostringstream msg;
@@ -152,7 +152,7 @@
typedef typename mesh_type::SieveMesh::point_type point_type;
ALE::MemoryLogger& logger = ALE::MemoryLogger::singleton();
- std::cout << "Making Field " << _label << " section type 1b" << std::endl;
+ //std::cout << "Making Field " << _label << " section type 1b" << std::endl;
logger.stagePush("Field");
if (fiberDim < 0) {
std::ostringstream msg;
@@ -177,34 +177,6 @@
} // newSection
// ----------------------------------------------------------------------
-// Create sieve section and set chart and fiber dimesion for a list of
-// points.
-template<typename mesh_type>
-void
-pylith::topology::Field<mesh_type>::newSection(const chart_type& chart,
- const int fiberDim)
-{ // newSection
- typedef typename mesh_type::SieveMesh::point_type point_type;
-
- ALE::MemoryLogger& logger = ALE::MemoryLogger::singleton();
- std::cout << "Making Field " << _label << " section type 1c" << std::endl;
- logger.stagePush("Field");
- if (fiberDim < 0) {
- std::ostringstream msg;
- msg << "Fiber dimension (" << fiberDim << ") for field '" << _label
- << "' must be nonnegative.";
- throw std::runtime_error(msg.str());
- } // if
-
- _section = new RealSection(_mesh.comm(), _mesh.debug());
- _section->setChart(chart);
- for(typename chart_type::const_iterator p_iter = chart.begin(); p_iter != chart.end(); ++p_iter) {
- _section->setFiberDimension(*p_iter, fiberDim);
- }
- logger.stagePop();
-} // newSection
-
-// ----------------------------------------------------------------------
// Create sieve section and set chart and fiber dimesion.
template<typename mesh_type>
void
@@ -236,13 +208,19 @@
const int fiberDim)
{ // newSection
ALE::MemoryLogger& logger = ALE::MemoryLogger::singleton();
- std::cout << "Making Field " << _label << " section type 2" << std::endl;
+ //std::cout << "Making Field " << _label << " section type 2" << std::endl;
logger.stagePush("Field");
if (_section.isNull()) {
logger.stagePop();
newSection();
logger.stagePush("Field");
} // if
+ if (fiberDim < 0) {
+ std::ostringstream msg;
+ msg << "Fiber dimension (" << fiberDim << ") for field '" << _label
+ << "' must be nonnegative.";
+ throw std::runtime_error(msg.str());
+ } // if
const ALE::Obj<RealSection>& srcSection = src.section();
if (!srcSection.isNull()) {
@@ -258,7 +236,7 @@
_section->setFiberDimension(*c_iter, fiberDim);
} // if
- std::cout << "Done making Field " << _label << " section type 2" << std::endl;
+ //std::cout << "Done making Field " << _label << " section type 2" << std::endl;
logger.stagePop();
} // newSection
@@ -269,7 +247,7 @@
pylith::topology::Field<mesh_type>::cloneSection(const Field& src)
{ // cloneSection
ALE::MemoryLogger& logger = ALE::MemoryLogger::singleton();
- std::cout << "Making Field " << _label << " section type 3" << std::endl;
+ //std::cout << "Making Field " << _label << " section type 3" << std::endl;
logger.stagePush("Field");
_vecFieldType = src._vecFieldType;
_scale = src._scale;
Modified: short/3D/PyLith/trunk/libsrc/topology/Field.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/topology/Field.hh 2009-06-08 22:00:14 UTC (rev 15145)
+++ short/3D/PyLith/trunk/libsrc/topology/Field.hh 2009-06-08 23:06:06 UTC (rev 15146)
@@ -157,15 +157,6 @@
void newSection(const ALE::Obj<label_sequence>& points,
const int fiberDim);
- /** Create sieve section and set chart and fiber dimesion for
- * sequence of points.
- *
- * @param chart Points over which to define section.
- * @param dim Fiber dimension for section.
- */
- void newSection(const chart_type& chart,
- const int fiberDim);
-
/** Create sieve section and set chart and fiber dimesion for a list
* of points.
*
Added: short/3D/PyLith/trunk/modulesrc/bc/BoundaryConditionPoints.i
===================================================================
--- short/3D/PyLith/trunk/modulesrc/bc/BoundaryConditionPoints.i (rev 0)
+++ short/3D/PyLith/trunk/modulesrc/bc/BoundaryConditionPoints.i 2009-06-08 23:06:06 UTC (rev 15146)
@@ -0,0 +1,40 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ----------------------------------------------------------------------
+//
+
+/** @file modulesrc/bc/BoundaryConditionPoints.i
+ *
+ * @brief Python interface to C++ BoundaryConditionPoints object.
+ */
+
+namespace pylith {
+ namespace bc {
+
+ class pylith::bc::BoundaryConditionPoints : public BoundaryCondition
+ { // class BoundaryCondition
+
+ // PUBLIC METHODS /////////////////////////////////////////////////
+ public :
+
+ /// Default constructor.
+ BoundaryConditionPoints(void);
+
+ /// Destructor.
+ virtual
+ ~BoundaryConditionPoints(void);
+
+ }; // class BoundaryConditionPoints
+
+ } // bc
+} // pylith
+
+
+// End of file
Modified: short/3D/PyLith/trunk/modulesrc/bc/DirichletBC.i
===================================================================
--- short/3D/PyLith/trunk/modulesrc/bc/DirichletBC.i 2009-06-08 22:00:14 UTC (rev 15145)
+++ short/3D/PyLith/trunk/modulesrc/bc/DirichletBC.i 2009-06-08 23:06:06 UTC (rev 15146)
@@ -18,7 +18,7 @@
namespace pylith {
namespace bc {
- class DirichletBC : public BoundaryCondition,
+ class DirichletBC : public TimeDependentPoints,
public pylith::feassemble::Constraint
{ // class DirichletBC
@@ -31,36 +31,6 @@
/// Destructor.
~DirichletBC(void);
- /** Set database for rate of change of values.
- *
- * @param db Spatial database
- */
- void dbRate(spatialdata::spatialdb::SpatialDB* const db);
-
- /** Set indices of fixed degrees of freedom.
- *
- * Note: all points associated with boundary condition has same
- * degrees of freedom fixed.
- *
- * Example: [0, 1] to fix x and y degrees of freedom in Cartesian system.
- *
- * @param flags Array of indices of fixed degrees of freedom.
- * @param size Size of array.
- */
- %apply(int* INPLACE_ARRAY1, int DIM1) {
- (const int* flags,
- const int size)
- };
- void fixedDOF(const int* flags,
- const int size);
- %clear(const int* flags, const int size);
-
- /** Set time at which rate of change begins.
- *
- * @param t Reference time.
- */
- void referenceTime(const double t);
-
/** Initialize boundary condition.
*
* @param mesh PETSc mesh
@@ -100,6 +70,15 @@
const double t1,
const pylith::topology::Field<pylith::topology::Mesh>& field);
+ // PROTECTED METHODS //////////////////////////////////////////////
+ protected :
+
+ /** Get manager of scales used to nondimensionalize problem.
+ *
+ * @returns Nondimensionalizer.
+ */
+ const spatialdata::units::Nondimensional& _getNormalizer(void) const;
+
}; // class DirichletBC
} // bc
Modified: short/3D/PyLith/trunk/modulesrc/bc/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/modulesrc/bc/Makefile.am 2009-06-08 22:00:14 UTC (rev 15145)
+++ short/3D/PyLith/trunk/modulesrc/bc/Makefile.am 2009-06-08 23:06:06 UTC (rev 15146)
@@ -20,10 +20,14 @@
swig_sources = \
bc.i \
BoundaryCondition.i \
+ BoundaryConditionPoints.i \
+ TimeDependent.i \
+ TimeDependentPoints.i \
DirichletBC.i \
DirichletBoundary.i \
AbsorbingDampers.i \
Neumann.i \
+ PointForce.i \
../feassemble/Constraint.i \
../feassemble/Quadrature.i \
../feassemble/Integrator.i
Added: short/3D/PyLith/trunk/modulesrc/bc/PointForce.i
===================================================================
--- short/3D/PyLith/trunk/modulesrc/bc/PointForce.i (rev 0)
+++ short/3D/PyLith/trunk/modulesrc/bc/PointForce.i 2009-06-08 23:06:06 UTC (rev 15146)
@@ -0,0 +1,73 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ----------------------------------------------------------------------
+//
+
+/** @file modulesrc/bc/PointForce.i
+ *
+ * @brief Python interface to C++ PointForce object.
+ */
+
+namespace pylith {
+ namespace bc {
+
+ class pylith::bc::PointForce : public TimeDependentPoints,
+ public pylith::feassemble::Integrator<pylith::feassemble::Quadrature<pylith::topology::Mesh> >
+ { // class PointForce
+
+ // PUBLIC METHODS /////////////////////////////////////////////////
+ public :
+
+ /// Default constructor.
+ PointForce(void);
+
+ /// Destructor.
+ ~PointForce(void);
+
+ /** Initialize boundary condition.
+ *
+ * @param mesh PETSc mesh
+ * @param upDir Vertical direction (somtimes used in 3-D problems).
+ */
+ void initialize(const pylith::topology::Mesh& mesh,
+ const double upDir[3]);
+
+ /** Integrate contributions to residual term (r) for operator.
+ *
+ * @param residual Field containing values for residual
+ * @param t Current time
+ * @param fields Solution fields
+ */
+ void integrateResidualAssembled(pylith::topology::Field<pylith::topology::Mesh>* residual,
+ const double t,
+ pylith::topology::SolutionFields* const fields);
+
+ /** Verify configuration is acceptable.
+ *
+ * @param mesh Finite-element mesh
+ */
+ void verifyConfiguration(const pylith::topology::Mesh& mesh) const;
+
+ // PROTECTED METHODS //////////////////////////////////////////////////
+ protected :
+
+ /** Get manager of scales used to nondimensionalize problem.
+ *
+ * @returns Nondimensionalizer.
+ */
+ const spatialdata::units::Nondimensional& _getNormalizer(void) const;
+
+ }; // class PointForce
+
+ } // bc
+} // pylith
+
+
+// End of file
Added: short/3D/PyLith/trunk/modulesrc/bc/TimeDependent.i
===================================================================
--- short/3D/PyLith/trunk/modulesrc/bc/TimeDependent.i (rev 0)
+++ short/3D/PyLith/trunk/modulesrc/bc/TimeDependent.i 2009-06-08 23:06:06 UTC (rev 15146)
@@ -0,0 +1,106 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ----------------------------------------------------------------------
+//
+
+/** @file modulesrc/bc/TimeDependent.i
+ *
+ * @brief Python interface to C++ TimeDependent object.
+ */
+
+namespace pylith {
+ namespace bc {
+
+ class pylith::bc::TimeDependent
+ { // class TimeDependent
+
+ // PUBLIC METHODS /////////////////////////////////////////////////
+ public :
+
+ /// Default constructor.
+ TimeDependent(void);
+
+ /// Destructor.
+ ~TimeDependent(void);
+
+
+ /** Set indices of degrees of freedom associated with BC.
+ *
+ * Note: Forces at all points are applied to the same degrees of freedom.
+ *
+ * Example: [0, 1] to apply forces to x and y degrees of freedom in
+ * Cartesian system.
+ *
+ * @param flags Array of indices for degrees of freedom for forces.
+ * @param size Size of array
+ */
+ %apply(int* INPLACE_ARRAY1, int DIM1) {
+ (const int* flags,
+ const int size)
+ };
+ void bcDOF(const int* flags,
+ const int size);
+ %clear(const int* flags, const int size);
+
+ /** Set database for initial values.
+ *
+ * @param db Spatial database
+ */
+ void dbInitial(spatialdata::spatialdb::SpatialDB* const db);
+
+ /** Set database for rate of change of values.
+ *
+ * @param db Spatial database
+ */
+ void dbRate(spatialdata::spatialdb::SpatialDB* const db);
+
+ /** Set database for change in values.
+ *
+ * @param db Spatial database
+ */
+ void dbChange(spatialdata::spatialdb::SpatialDB* const db);
+
+ /** Set database for temporal evolution of change in value.
+ *
+ * @param db Time history database.
+ */
+ void dbTimeHistory(spatialdata::spatialdb::TimeHistory* const db);
+
+ /** Verify configuration is acceptable.
+ *
+ * @param mesh Finite-element mesh
+ */
+ virtual
+ void verifyConfiguration(const pylith::topology::Mesh& mesh) const;
+
+ // PROTECTED METHODS //////////////////////////////////////////////////
+ protected :
+
+ /** Get label of boundary condition surface.
+ *
+ * @returns Label of surface (from mesh generator).
+ */
+ virtual
+ const char* _getLabel(void) const = 0;
+
+ /** Get manager of scales used to nondimensionalize problem.
+ *
+ * @returns Nondimensionalizer.
+ */
+ virtual
+ const spatialdata::units::Nondimensional& _getNormalizer(void) const = 0;
+
+ }; // class TimeDependent
+
+ } // bc
+} // pylith
+
+
+// End of file
Added: short/3D/PyLith/trunk/modulesrc/bc/TimeDependentPoints.i
===================================================================
--- short/3D/PyLith/trunk/modulesrc/bc/TimeDependentPoints.i (rev 0)
+++ short/3D/PyLith/trunk/modulesrc/bc/TimeDependentPoints.i 2009-06-08 23:06:06 UTC (rev 15146)
@@ -0,0 +1,49 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ----------------------------------------------------------------------
+//
+
+/** @file modulesrc/bc/TimeDependentPoints.i
+ *
+ * @brief Python interface to C++ TimeDependentPoints object.
+ */
+
+namespace pylith {
+ namespace bc {
+
+ class pylith::bc::TimeDependentPoints : public BoundaryConditionPoints,
+ public TimeDependent
+ { // class TimeDependentPoints
+
+ // PUBLIC METHODS /////////////////////////////////////////////////
+ public :
+
+ /// Default constructor.
+ TimeDependentPoints(void);
+
+ /// Destructor.
+ ~TimeDependentPoints(void);
+
+ // PROTECTED METHODS //////////////////////////////////////////////
+ protected :
+
+ /** Get label of boundary condition surface.
+ *
+ * @returns Label of surface (from mesh generator).
+ */
+ const char* _getLabel(void) const;
+
+ }; // class TimeDependentPoints
+
+ } // bc
+} // pylith
+
+
+// End of file
Modified: short/3D/PyLith/trunk/modulesrc/bc/bc.i
===================================================================
--- short/3D/PyLith/trunk/modulesrc/bc/bc.i 2009-06-08 22:00:14 UTC (rev 15145)
+++ short/3D/PyLith/trunk/modulesrc/bc/bc.i 2009-06-08 23:06:06 UTC (rev 15146)
@@ -16,10 +16,14 @@
// Header files for module C++ code
%{
#include "pylith/bc/BoundaryCondition.hh"
+#include "pylith/bc/BoundaryConditionPoints.hh"
+#include "pylith/bc/TimeDependent.hh"
+#include "pylith/bc/TimeDependentPoints.hh"
#include "pylith/bc/DirichletBC.hh"
#include "pylith/bc/DirichletBoundary.hh"
#include "pylith/bc/AbsorbingDampers.hh"
#include "pylith/bc/Neumann.hh"
+#include "pylith/bc/PointForce.hh"
%}
%include "exception.i"
@@ -49,13 +53,18 @@
%include "../feassemble/Integrator.i" // ISA Integrator
// template instantiation
+%template(MeshIntegrator) pylith::feassemble::Integrator<pylith::feassemble::Quadrature<pylith::topology::Mesh> >;
%template(SubMeshIntegrator) pylith::feassemble::Integrator<pylith::feassemble::Quadrature<pylith::topology::SubMesh> >;
%include "BoundaryCondition.i"
+%include "BoundaryConditionPoints.i"
+%include "TimeDependent.i"
+%include "TimeDependentPoints.i"
%include "DirichletBC.i"
%include "DirichletBoundary.i"
%include "AbsorbingDampers.i"
%include "Neumann.i"
+%include "PointForce.i"
// End of file
Modified: short/3D/PyLith/trunk/pylith/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/pylith/Makefile.am 2009-06-08 22:00:14 UTC (rev 15145)
+++ short/3D/PyLith/trunk/pylith/Makefile.am 2009-06-08 23:06:06 UTC (rev 15146)
@@ -20,8 +20,10 @@
bc/BoundaryCondition.py \
bc/DirichletBC.py \
bc/DirichletBoundary.py \
- bc/FixedDOFDB.py \
bc/Neumann.py \
+ bc/PointForce.py \
+ bc/TimeDependent.py \
+ bc/ZeroDispDB.py \
faults/__init__.py \
faults/BruneSlipFn.py \
faults/ConstRateSlipFn.py \
Modified: short/3D/PyLith/trunk/pylith/bc/DirichletBC.py
===================================================================
--- short/3D/PyLith/trunk/pylith/bc/DirichletBC.py 2009-06-08 22:00:14 UTC (rev 15145)
+++ short/3D/PyLith/trunk/pylith/bc/DirichletBC.py 2009-06-08 23:06:06 UTC (rev 15146)
@@ -18,28 +18,15 @@
## Factory: boundary_condition
from BoundaryCondition import BoundaryCondition
+from TimeDependent import TimeDependent
from pylith.feassemble.Constraint import Constraint
from bc import DirichletBC as ModuleDirichletBC
-def validateDOF(value):
- """
- Validate list of fixed degrees of freedom.
- """
- try:
- size = len(value)
- num = map(int, value)
- for v in num:
- if v < 0:
- raise ValueError
- except:
- raise ValueError, \
- "'fixed_dof' must be a zero based list of indices of fixed " \
- "degrees of freedom."
- return num
-
-
# DirichletBC class
-class DirichletBC(BoundaryCondition, Constraint, ModuleDirichletBC):
+class DirichletBC(BoundaryCondition,
+ TimeDependent,
+ Constraint,
+ ModuleDirichletBC):
"""
Python object for managing a DirichletBC (prescribed displacements)
boundary condition.
@@ -49,42 +36,16 @@
# INVENTORY //////////////////////////////////////////////////////////
- class Inventory(BoundaryCondition.Inventory):
- """
- Python object for managing BoundaryCondition facilities and properties.
- """
-
- ## @class Inventory
- ## Python object for managing BoundaryCondition facilities and properties.
- ##
- ## \b Properties
- ## @li \b fixed_dof Indices of fixed DOF (0=1st DOF, 1=2nd DOF, etc).
- ## @li \b reference_t Reference time for rate of change of values.
- ##
- ## \b Facilities
- ## @li \b initial_db Database of parameters for initial values.
- ## @li \b rate_db Database of parameters for rate of change of values.
+ import pyre.inventory
- import pyre.inventory
+ # Override default values for TimeDependent db_initial facility
+ # with ZeroDispDB.
+ from ZeroDispDB import ZeroDispDB
+ dbInitial = pyre.inventory.facility("db_initial", factory=ZeroDispDB,
+ family="spatial_database")
+ dbInitial.meta['tip'] = "Database of parameters for initial values."
+
- fixedDOF = pyre.inventory.list("fixed_dof", default=[],
- validator=validateDOF)
- fixedDOF.meta['tip'] = "Indices of fixed DOF (0=1st DOF, 1=2nd DOF, etc)."
-
- from pyre.units.time import s
- tRef = pyre.inventory.dimensional("reference_t", default=0.0*s)
- tRef.meta['tip'] = "Reference time for rate of change of values."
-
- from FixedDOFDB import FixedDOFDB
- db = pyre.inventory.facility("db", factory=FixedDOFDB,
- family="spatial_database")
- db.meta['tip'] = "Database of parameters for initial values."
-
- dbRate = pyre.inventory.facility("rate_db", factory=FixedDOFDB,
- family="spatial_database")
- dbRate.meta['tip'] = "Database of parameters for rate of change of values."
-
-
# PUBLIC METHODS /////////////////////////////////////////////////////
def __init__(self, name="dirichletbc"):
@@ -103,10 +64,6 @@
"""
BoundaryCondition.preinitialize(self, mesh)
Constraint.preinitialize(self, mesh)
- self.dbRate(self.inventory.dbRate)
- import numpy
- fixedDOF = numpy.array(self.inventory.fixedDOF, dtype=numpy.int32)
- self.fixedDOF(fixedDOF)
return
@@ -130,12 +87,7 @@
logEvent = "%sinit" % self._loggingPrefix
self._logger.eventBegin(logEvent)
- timeScale = normalizer.timeScale()
- tRef = normalizer.nondimensionalize(self.inventory.tRef, timeScale)
- self.referenceTime(tRef)
-
self.normalizer(normalizer)
-
BoundaryCondition.initialize(self, totalTime, numTimeSteps, normalizer)
self._logger.eventEnd(logEvent)
@@ -149,6 +101,7 @@
Setup members using inventory.
"""
BoundaryCondition._configure(self)
+ TimeDependent._configure(self)
return
Modified: short/3D/PyLith/trunk/pylith/bc/DirichletBoundary.py
===================================================================
--- short/3D/PyLith/trunk/pylith/bc/DirichletBoundary.py 2009-06-08 22:00:14 UTC (rev 15145)
+++ short/3D/PyLith/trunk/pylith/bc/DirichletBoundary.py 2009-06-08 23:06:06 UTC (rev 15146)
@@ -18,7 +18,6 @@
## Factory: boundary_condition
from DirichletBC import DirichletBC
-from DirichletBC import validateDOF
from bc import DirichletBoundary as ModuleDirichletBoundary
# DirichletBoundary class
@@ -64,7 +63,12 @@
self._loggingPrefix = "DiBC "
self.availableFields = \
{'vertex': \
- {'info': ["initial", "rate-of-change"],
+ {'info': ["initial",
+ "rate-of-change",
+ "change-in-value",
+ "rate-start-time",
+ "change-start-time",
+ ],
'data': []},
'cell': \
{'info': [],
Deleted: short/3D/PyLith/trunk/pylith/bc/FixedDOFDB.py
===================================================================
--- short/3D/PyLith/trunk/pylith/bc/FixedDOFDB.py 2009-06-08 22:00:14 UTC (rev 15145)
+++ short/3D/PyLith/trunk/pylith/bc/FixedDOFDB.py 2009-06-08 23:06:06 UTC (rev 15146)
@@ -1,82 +0,0 @@
-#!/usr/bin/env python
-#
-# ----------------------------------------------------------------------
-#
-# Brad T. Aagaard
-# U.S. Geological Survey
-#
-# <LicenseText>
-#
-# ----------------------------------------------------------------------
-#
-
-## @file pylith/bc/FixedDOFDB.py
-##
-## @brief Python object for spatial database with uniform zero values
-## for degrees of freedom.
-##
-## Factory: spatial_database
-
-from spatialdata.spatialdb.UniformDB import UniformDB
-
-# FixedDOFDB class
-class FixedDOFDB(UniformDB):
- """
- Python object for spatial database with uniform zero values for
- degrees of freedom.
-
- Factory: spatial_database
- """
-
- # INVENTORY //////////////////////////////////////////////////////////
-
- class Inventory(UniformDB.Inventory):
- """
- Python object for managing FixedDOFDB facilities and properties.
- """
-
- ## @class Inventory
- ## Python object for managing FixedDOFDB facilities and properties.
- ##
- ## \b Properties
- ## @li None
- ##
- ## \b Facilities
- ## @li none
-
- import pyre.inventory
-
- values = ["dof-0", "dof-1", "dof-2"]
- data = [0.0, 0.0, 0.0]
-
-
- # PUBLIC METHODS /////////////////////////////////////////////////////
-
- def __init__(self, name="fixeddofdb"):
- """
- Constructor.
- """
- UniformDB.__init__(self, name)
- return
-
-
- # PRIVATE METHODS ////////////////////////////////////////////////////
-
- def _configure(self):
- """
- Set members based on inventory.
- """
- UniformDB._configure(self)
- return
-
-
-# FACTORIES ////////////////////////////////////////////////////////////
-
-def spatial_database():
- """
- Factory associated with FixedDOFDB.
- """
- return FixedDOFDB()
-
-
-# End of file
Modified: short/3D/PyLith/trunk/pylith/bc/Neumann.py
===================================================================
--- short/3D/PyLith/trunk/pylith/bc/Neumann.py 2009-06-08 22:00:14 UTC (rev 15145)
+++ short/3D/PyLith/trunk/pylith/bc/Neumann.py 2009-06-08 23:06:06 UTC (rev 15146)
@@ -122,15 +122,9 @@
Integrator.initialize(self, totalTime, numTimeSteps, normalizer)
BoundaryCondition.initialize(self, totalTime, numTimeSteps, normalizer)
- #from pylith.topology.Mesh import Mesh
- #self.boundaryMesh = Mesh()
- #self.boundaryMesh.initialize(self.mesh.coordsys)
- #self.cppHandle.boundaryMesh(self.boundaryMesh.cppHandle)
+ self.output.initialize(normalizer, self.bcQuadrature)
+ self.output.writeInfo()
- #if None != self.output:
- # self.output.initialize(normalizer, self.quadrature)
- # self.output.writeInfo()
-
self._logger.eventEnd(logEvent)
return
@@ -139,7 +133,7 @@
"""
Get mesh associated with data fields.
"""
- return (self.boundaryMesh, None, None)
+ return (self.boundaryMesh(), None, None)
def getCellField(self, name, fields=None):
@@ -147,10 +141,10 @@
Get vertex field.
"""
if None == fields:
- (field, fieldType) = self.cellField(name)
+ field = self.cellField(name)
else:
- (field, fieldType) = self.cellField(name, fields)
- return (field, fieldType)
+ field = self.cellField(name, fields)
+ return field
# PRIVATE METHODS ////////////////////////////////////////////////////
Added: short/3D/PyLith/trunk/pylith/bc/PointForce.py
===================================================================
--- short/3D/PyLith/trunk/pylith/bc/PointForce.py (rev 0)
+++ short/3D/PyLith/trunk/pylith/bc/PointForce.py 2009-06-08 23:06:06 UTC (rev 15146)
@@ -0,0 +1,111 @@
+#!/usr/bin/env python
+#
+# ----------------------------------------------------------------------
+#
+# Brad T. Aagaard
+# U.S. Geological Survey
+#
+# <LicenseText>
+#
+# ----------------------------------------------------------------------
+#
+
+## @file pylith/bc/PointForce.py
+##
+## @brief Python object for managing a point force boundary condition
+## with a set of points.
+##
+## Factory: boundary_condition
+
+from BoundaryCondition import BoundaryCondition
+from TimeDependent import TimeDependent
+from pylith.feassemble.Integrator import Integrator
+from bc import PointForce as ModulePointForce
+
+# PointForce class
+class PointForce(BoundaryCondition,
+ TimeDependent,
+ Integrator,
+ ModulePointForce):
+ """
+ Python object for managing a point force boundary condition.
+
+ Factory: boundary_condition
+ """
+
+ # PUBLIC METHODS /////////////////////////////////////////////////////
+
+ def __init__(self, name="dirichletbc"):
+ """
+ Constructor.
+ """
+ BoundaryCondition.__init__(self, name)
+ Integrator.__init__(self)
+ self._loggingPrefix = "DiBC "
+ return
+
+
+ def preinitialize(self, mesh):
+ """
+ Do pre-initialization setup.
+ """
+ BoundaryCondition.preinitialize(self, mesh)
+ Integrator.preinitialize(self, mesh)
+ return
+
+
+ def verifyConfiguration(self):
+ """
+ Verify compatibility of configuration.
+ """
+ logEvent = "%sverify" % self._loggingPrefix
+ self._logger.eventBegin(logEvent)
+
+ BoundaryCondition.verifyConfiguration(self, self.mesh)
+
+ self._logger.eventEnd(logEvent)
+ return
+
+
+ def initialize(self, totalTime, numTimeSteps, normalizer):
+ """
+ Initialize PointForce boundary condition.
+ """
+ logEvent = "%sinit" % self._loggingPrefix
+ self._logger.eventBegin(logEvent)
+
+ Integrator.initialize(self, totalTime, numTimeSteps, normalizer)
+ BoundaryCondition.initialize(self, totalTime, numTimeSteps, normalizer)
+
+ self._logger.eventEnd(logEvent)
+ return
+
+
+ # PRIVATE METHODS ////////////////////////////////////////////////////
+
+ def _configure(self):
+ """
+ Setup members using inventory.
+ """
+ BoundaryCondition._configure(self)
+ return
+
+
+ def _createModuleObj(self):
+ """
+ Create handle to corresponding C++ object.
+ """
+ ModulePointForce.__init__(self)
+ return
+
+
+# FACTORIES ////////////////////////////////////////////////////////////
+
+def boundary_condition():
+ """
+ Factory associated with PointForce.
+ """
+ return PointForce()
+
+
+# End of file
Added: short/3D/PyLith/trunk/pylith/bc/TimeDependent.py
===================================================================
--- short/3D/PyLith/trunk/pylith/bc/TimeDependent.py (rev 0)
+++ short/3D/PyLith/trunk/pylith/bc/TimeDependent.py 2009-06-08 23:06:06 UTC (rev 15146)
@@ -0,0 +1,141 @@
+#!/usr/bin/env python
+#
+# ----------------------------------------------------------------------
+#
+# Brad T. Aagaard
+# U.S. Geological Survey
+#
+# <LicenseText>
+#
+# ----------------------------------------------------------------------
+#
+
+## @file pylith/bc/TimeDependent.py
+##
+## @brief Python abstract base class for managing a boundary condition
+## with time dependent paramters.
+##
+## This implementation of a time dependent boundary condition creates
+## a parameter with the form:
+## u(x) = u0(x) + v0(x)*(t-tv(x)) + du(x)*a(t-tu(x))
+## where
+## u0(x) is the initial value given by a spatial database,
+## v0(x) is the rate of change given by a spatial database,
+## tv(x) is the start time for the rate of change given by a spatial database,
+## du(x) is the change in value given by a spatial database,
+## tu(x) is the start time for the change in value given by a spatial datasse,
+## a(t) is a time history given by a temporal database.
+
+from pyre.components.Component import Component
+from bc import TimeDependent as ModuleTimeDependent
+
+from pylith.utils.NullComponent import NullComponent
+
+
+def validateDOF(value):
+ """
+ Validate list of fixed degrees of freedom.
+ """
+ try:
+ size = len(value)
+ num = map(int, value)
+ for v in num:
+ if v < 0:
+ raise ValueError
+ except:
+ raise ValueError, \
+ "'fixed_dof' must be a zero based list of indices of fixed " \
+ "degrees of freedom."
+ return num
+
+
+# TimeDependent class
+class TimeDependent(Component, ModuleTimeDependent):
+ """
+ Python abstract base class for managing a boundary condition with
+ time dependent paramters.
+
+ This implementation of a time dependent boundary condition creates a
+ parameter with the form:
+
+ u(x) = u0(x) + v0(x)*(t-tv(x)) + du(x)*a(t-tu(x))
+
+ where
+ u0(x) is the initial value given by a spatial database,
+ v0(x) is the rate of change given by a spatial database,
+ tv(x) is the start time for the rate of change given by a spatial database,
+ du(x) is the change in value given by a spatial database,
+ tu(x) is the start time for the change in value given by a spatial datasse,
+ a(t) is a time history given by a temporal database.
+
+ Factory: boundary_condition
+ """
+
+ # INVENTORY //////////////////////////////////////////////////////////
+
+ import pyre.inventory
+
+ bcDOF = pyre.inventory.list("fixed_dof", default=[],
+ validator=validateDOF)
+ bcDOF.meta['tip'] = "Indices of boundary condition DOF " \
+ "(0=1st DOF, 1=2nd DOF, etc)."
+
+ from spatialdata.spatialdb.SimpleDB import SimpleDB
+ dbInitial = pyre.inventory.facility("db_initial", factory=SimpleDB,
+ family="spatial_database")
+ dbInitial.meta['tip'] = "Database with initial values."
+
+ dbRate = pyre.inventory.facility("db_rate", factory=NullComponent,
+ family="spatial_database")
+ dbRate.meta['tip'] = "Database with rate of change values."
+
+ dbChange = pyre.inventory.facility("db_change", factory=NullComponent,
+ family="spatial_database")
+ dbChange.meta['tip'] = "Database with temporal change in values."
+
+ thChange = pyre.inventory.facility("th_change", factory=NullComponent,
+ family="temporal_database")
+ thChange.meta['tip'] = "Database with time history."
+
+
+ # PUBLIC METHODS /////////////////////////////////////////////////////
+
+ def __init__(self, name="timedependent"):
+ """
+ Constructor.
+ """
+ Component.__init__(self, name, facility="time_dependent")
+ return
+
+
+ # PRIVATE METHODS ////////////////////////////////////////////////////
+
+ def _configure(self):
+ """
+ Setup members using inventory.
+ """
+ Component._configure(self)
+
+ import numpy
+ bcDOF = numpy.array(self.inventory.bcDOF, dtype=numpy.int32)
+ ModuleTimeDependent.bcDOF(self, bcDOF)
+
+ if isinstance(self.inventory.dbChange, NullComponent):
+ if not isinstance(self.inventory.thChange, NullComponent):
+ raise ValueError("Cannot provide a time history temporal database "
+ "without a change in value spatial database "
+ "for time dependent boundary condition '%s'." % \
+ self.label)
+
+ if not isinstance(self.inventory.dbInitial, NullComponent):
+ ModuleTimeDependent.dbInitial(self, self.inventory.dbInitial)
+ if not isinstance(self.inventory.dbRate, NullComponent):
+ ModuleTimeDependent.dbRate(self, self.inventory.dbRate)
+ if not isinstance(self.inventory.dbChange, NullComponent):
+ ModuleTimeDependent.dbChange(self, self.inventory.dbChange)
+ if not isinstance(self.inventory.thChange, NullComponent):
+ ModuleTimeDependent.thChange(self, self.inventory.thChange)
+ return
+
+
+# End of file
Copied: short/3D/PyLith/trunk/pylith/bc/ZeroDispDB.py (from rev 15138, short/3D/PyLith/trunk/pylith/bc/FixedDOFDB.py)
===================================================================
--- short/3D/PyLith/trunk/pylith/bc/ZeroDispDB.py (rev 0)
+++ short/3D/PyLith/trunk/pylith/bc/ZeroDispDB.py 2009-06-08 23:06:06 UTC (rev 15146)
@@ -0,0 +1,82 @@
+#!/usr/bin/env python
+#
+# ----------------------------------------------------------------------
+#
+# Brad T. Aagaard
+# U.S. Geological Survey
+#
+# <LicenseText>
+#
+# ----------------------------------------------------------------------
+#
+
+## @file pylith/bc/ZeroDispDB.py
+##
+## @brief Python object for spatial database with uniform zero
+## displacements for degrees of freedom.
+##
+## Factory: spatial_database
+
+from spatialdata.spatialdb.UniformDB import UniformDB
+
+# ZeroDispDB class
+class ZeroDispDB(UniformDB):
+ """
+ Python object for spatial database with uniform zero displacements
+ for degrees of freedom.
+
+ Factory: spatial_database
+ """
+
+ # INVENTORY //////////////////////////////////////////////////////////
+
+ class Inventory(UniformDB.Inventory):
+ """
+ Python object for managing ZeroDispDB facilities and properties.
+ """
+
+ ## @class Inventory
+ ## Python object for managing ZeroDispDB facilities and properties.
+ ##
+ ## \b Properties
+ ## @li None
+ ##
+ ## \b Facilities
+ ## @li none
+
+ import pyre.inventory
+
+ values = ["displacement-x", "displacement-y", "displacement-z"]
+ data = [0.0, 0.0, 0.0]
+
+
+ # PUBLIC METHODS /////////////////////////////////////////////////////
+
+ def __init__(self, name="fixeddofdb"):
+ """
+ Constructor.
+ """
+ UniformDB.__init__(self, name)
+ return
+
+
+ # PRIVATE METHODS ////////////////////////////////////////////////////
+
+ def _configure(self):
+ """
+ Set members based on inventory.
+ """
+ UniformDB._configure(self)
+ return
+
+
+# FACTORIES ////////////////////////////////////////////////////////////
+
+def spatial_database():
+ """
+ Factory associated with ZeroDispDB.
+ """
+ return ZeroDispDB()
+
+
+# End of file
Property changes on: short/3D/PyLith/trunk/pylith/bc/ZeroDispDB.py
___________________________________________________________________
Name: svn:mergeinfo
+
Modified: short/3D/PyLith/trunk/pylith/bc/__init__.py
===================================================================
--- short/3D/PyLith/trunk/pylith/bc/__init__.py 2009-06-08 22:00:14 UTC (rev 15145)
+++ short/3D/PyLith/trunk/pylith/bc/__init__.py 2009-06-08 23:06:06 UTC (rev 15146)
@@ -16,10 +16,12 @@
__all__ = ['AbsorbingDampers',
'BoundaryCondition',
+ 'TimeDependent',
'DirichletBC',
'DirichletBoundary',
- 'FixedDOFDB',
'Neumann',
+ 'PointForce',
+ 'ZeroDispDB',
]
Modified: short/3D/PyLith/trunk/tests/1d/line2/axialextension.cfg
===================================================================
--- short/3D/PyLith/trunk/tests/1d/line2/axialextension.cfg 2009-06-08 22:00:14 UTC (rev 15145)
+++ short/3D/PyLith/trunk/tests/1d/line2/axialextension.cfg 2009-06-08 23:06:06 UTC (rev 15146)
@@ -58,9 +58,9 @@
[axialextension.timedependent.bc.bc]
fixed_dof = [0]
label = end points
-db = spatialdata.spatialdb.SimpleDB
-db.label = Dirichlet BC
-db.iohandler.filename = axialextension_disp.spatialdb
+db_initial = spatialdata.spatialdb.SimpleDB
+db_initial.label = Dirichlet BC
+db_initial.iohandler.filename = axialextension_disp.spatialdb
# ----------------------------------------------------------------------
# PETSc
Modified: short/3D/PyLith/trunk/tests/1d/line2/axialextension_disp.spatialdb
===================================================================
--- short/3D/PyLith/trunk/tests/1d/line2/axialextension_disp.spatialdb 2009-06-08 22:00:14 UTC (rev 15145)
+++ short/3D/PyLith/trunk/tests/1d/line2/axialextension_disp.spatialdb 2009-06-08 23:06:06 UTC (rev 15146)
@@ -1,7 +1,7 @@
#SPATIAL.ascii 1
SimpleDB {
num-values = 1
- value-names = dof-0
+ value-names = displacement-x
value-units = m
num-locs = 2
data-dim = 1
Modified: short/3D/PyLith/trunk/tests/1d/line2/dislocation.cfg
===================================================================
--- short/3D/PyLith/trunk/tests/1d/line2/dislocation.cfg 2009-06-08 22:00:14 UTC (rev 15145)
+++ short/3D/PyLith/trunk/tests/1d/line2/dislocation.cfg 2009-06-08 23:06:06 UTC (rev 15146)
@@ -60,9 +60,9 @@
[dislocation.timedependent.bc.bc]
fixed_dof = [0]
label = end points
-db = spatialdata.spatialdb.SimpleDB
-db.label = Dirichlet BC
-db.iohandler.filename = axialextension_disp.spatialdb
+db_initial = spatialdata.spatialdb.SimpleDB
+db_initial.label = Dirichlet BC
+db_initial.iohandler.filename = axialextension_disp.spatialdb
# ----------------------------------------------------------------------
# faults
Modified: short/3D/PyLith/trunk/tests/1d/line3/axialextension.cfg
===================================================================
--- short/3D/PyLith/trunk/tests/1d/line3/axialextension.cfg 2009-06-08 22:00:14 UTC (rev 15145)
+++ short/3D/PyLith/trunk/tests/1d/line3/axialextension.cfg 2009-06-08 23:06:06 UTC (rev 15146)
@@ -59,9 +59,9 @@
[axialextension.timedependent.bc.bc]
fixed_dof = [0]
label = end points
-db = spatialdata.spatialdb.SimpleDB
-db.label = Dirichlet BC
-db.iohandler.filename = axialextension_disp.spatialdb
+db_initial = spatialdata.spatialdb.SimpleDB
+db_initial.label = Dirichlet BC
+db_initial.iohandler.filename = axialextension_disp.spatialdb
# ----------------------------------------------------------------------
# PETSc
Modified: short/3D/PyLith/trunk/tests/1d/line3/axialextension_disp.spatialdb
===================================================================
--- short/3D/PyLith/trunk/tests/1d/line3/axialextension_disp.spatialdb 2009-06-08 22:00:14 UTC (rev 15145)
+++ short/3D/PyLith/trunk/tests/1d/line3/axialextension_disp.spatialdb 2009-06-08 23:06:06 UTC (rev 15146)
@@ -1,7 +1,7 @@
#SPATIAL.ascii 1
SimpleDB {
num-values = 1
- value-names = dof-0
+ value-names = displacement-x
value-units = m
num-locs = 2
data-dim = 1
Modified: short/3D/PyLith/trunk/tests/1d/line3/dislocation.cfg
===================================================================
--- short/3D/PyLith/trunk/tests/1d/line3/dislocation.cfg 2009-06-08 22:00:14 UTC (rev 15145)
+++ short/3D/PyLith/trunk/tests/1d/line3/dislocation.cfg 2009-06-08 23:06:06 UTC (rev 15146)
@@ -59,9 +59,9 @@
[dislocation.timedependent.bc.bc]
fixed_dof = [0]
label = end points
-db = spatialdata.spatialdb.SimpleDB
-db.label = Dirichlet BC
-db.iohandler.filename = axialextension_disp.spatialdb
+db_initial = spatialdata.spatialdb.SimpleDB
+db_initial.label = Dirichlet BC
+db_initial.iohandler.filename = axialextension_disp.spatialdb
# ----------------------------------------------------------------------
# faults
Modified: short/3D/PyLith/trunk/tests/2d/quad4/axialsheardisp.cfg
===================================================================
--- short/3D/PyLith/trunk/tests/2d/quad4/axialsheardisp.cfg 2009-06-08 22:00:14 UTC (rev 15145)
+++ short/3D/PyLith/trunk/tests/2d/quad4/axialsheardisp.cfg 2009-06-08 23:06:06 UTC (rev 15146)
@@ -58,30 +58,30 @@
[pylithapp.timedependent.bc.x_pos]
fixed_dof = [0]
label = 20
-db = spatialdata.spatialdb.SimpleDB
-db.label = Dirichlet BC +x edge
-db.iohandler.filename = axialshear_disp.spatialdb
+db_initial = spatialdata.spatialdb.SimpleDB
+db_initial.label = Dirichlet BC +x edge
+db_initial.iohandler.filename = axialshear_disp.spatialdb
[pylithapp.timedependent.bc.x_neg]
fixed_dof = [0]
label = 21
-db = spatialdata.spatialdb.SimpleDB
-db.label = Dirichlet BC -x edge
-db.iohandler.filename = axialshear_disp.spatialdb
+db_initial = spatialdata.spatialdb.SimpleDB
+db_initial.label = Dirichlet BC -x edge
+db_initial.iohandler.filename = axialshear_disp.spatialdb
[pylithapp.timedependent.bc.y_pos]
fixed_dof = [1]
label = 22
-db = spatialdata.spatialdb.SimpleDB
-db.label = Dirichlet BC +y edge
-db.iohandler.filename = axialshear_disp.spatialdb
+db_initial = spatialdata.spatialdb.SimpleDB
+db_initial.label = Dirichlet BC +y edge
+db_initial.iohandler.filename = axialshear_disp.spatialdb
[pylithapp.timedependent.bc.y_neg]
fixed_dof = [1]
label = 23
-db = spatialdata.spatialdb.SimpleDB
-db.label = Dirichlet BC -y edge
-db.iohandler.filename = axialshear_disp.spatialdb
+db_initial = spatialdata.spatialdb.SimpleDB
+db_initial.label = Dirichlet BC -y edge
+db_initial.iohandler.filename = axialshear_disp.spatialdb
# ----------------------------------------------------------------------
# PETSc
Modified: short/3D/PyLith/trunk/tests/2d/quad4/axialsheardisp_gendb.py
===================================================================
--- short/3D/PyLith/trunk/tests/2d/quad4/axialsheardisp_gendb.py 2009-06-08 22:00:14 UTC (rev 15145)
+++ short/3D/PyLith/trunk/tests/2d/quad4/axialsheardisp_gendb.py 2009-06-08 23:06:06 UTC (rev 15146)
@@ -53,10 +53,10 @@
data = {'locs': xy,
'coordsys': cs,
'data_dim': 2,
- 'values': [{'name': "dof-0",
+ 'values': [{'name': "displacement-x",
'units': "m",
'data': numpy.ravel(disp[:,0])},
- {'name': "dof-1",
+ {'name': "displacement-y",
'units': "m",
'data': numpy.ravel(disp[:,1])}]}
Modified: short/3D/PyLith/trunk/unittests/libtests/bc/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/bc/Makefile.am 2009-06-08 22:00:14 UTC (rev 15145)
+++ short/3D/PyLith/trunk/unittests/libtests/bc/Makefile.am 2009-06-08 23:06:06 UTC (rev 15146)
@@ -82,11 +82,6 @@
TestAbsorbingDampersQuad4.hh \
TestAbsorbingDampersTet4.hh \
TestAbsorbingDampersHex8.hh \
- TestDirichletBoundary.hh \
- TestDirichletBoundaryTri3.hh \
- TestDirichletBoundaryQuad4.hh \
- TestDirichletBoundaryTet4.hh \
- TestDirichletBoundaryHex8.hh \
TestDirichletBC.hh \
TestDirichletBCLine2.hh \
TestDirichletBCLine2b.hh \
@@ -97,6 +92,11 @@
TestDirichletBCMulti.hh \
TestDirichletBCMultiTri3.hh \
TestDirichletBCMultiTet4.hh \
+ TestDirichletBoundary.hh \
+ TestDirichletBoundaryTri3.hh \
+ TestDirichletBoundaryQuad4.hh \
+ TestDirichletBoundaryTet4.hh \
+ TestDirichletBoundaryHex8.hh \
TestNeumann.hh \
TestNeumannLine2.hh \
TestNeumannTri3.hh \
Modified: short/3D/PyLith/trunk/unittests/libtests/bc/TestDirichletBC.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/bc/TestDirichletBC.cc 2009-06-08 22:00:14 UTC (rev 15145)
+++ short/3D/PyLith/trunk/unittests/libtests/bc/TestDirichletBC.cc 2009-06-08 23:06:06 UTC (rev 15146)
@@ -20,6 +20,7 @@
#include "pylith/topology/Mesh.hh" // USES Mesh
#include "pylith/topology/Field.hh" // USES Field
+#include "pylith/topology/Fields.hh" // USES Fields
#include "pylith/meshio/MeshIOAscii.hh" // USES MeshIOAscii
#include "spatialdata/geocoords/CSCart.hh" // USES CSCart
@@ -59,22 +60,6 @@
} // testConstructor
// ----------------------------------------------------------------------
-// Test fixedDOF()
-void
-pylith::bc::TestDirichletBC::testFixedDOF(void)
-{ // testfixedDOF
- DirichletBC bc;
-
- const size_t numDOF = 4;
- const int fixedDOF[] = { 0, 2, 3, 5 };
- bc.fixedDOF(fixedDOF, numDOF);
-
- CPPUNIT_ASSERT_EQUAL(numDOF, bc._fixedDOF.size());
- for (int i=0; i < numDOF; ++i)
- CPPUNIT_ASSERT_EQUAL(fixedDOF[i], bc._fixedDOF[i]);
-} // testFixedDOF
-
-// ----------------------------------------------------------------------
// Test initialize().
void
pylith::bc::TestDirichletBC::testInitialize(void)
@@ -99,18 +84,39 @@
CPPUNIT_ASSERT_EQUAL(_data->constrainedPoints[i]+offset, bc._points[i]);
} // if
- // Check values
- const size_t size = numPoints * numFixedDOF;
- CPPUNIT_ASSERT_EQUAL(size, bc._valuesInitial.size());
- const double tolerance = 1.0e-06;
- for (int i=0; i < size; ++i)
- CPPUNIT_ASSERT_DOUBLES_EQUAL(_data->valuesInitial[i], bc._valuesInitial[i],
- tolerance);
-
- CPPUNIT_ASSERT_EQUAL(size, bc._valuesRate.size());
- for (int i=0; i < size; ++i)
- CPPUNIT_ASSERT_DOUBLES_EQUAL(_data->valueRate, bc._valuesRate[i],
- tolerance);
+ if (numFixedDOF > 0) {
+ // Check values
+ CPPUNIT_ASSERT(0 != bc._parameters);
+ const ALE::Obj<RealSection>& initialSection =
+ bc._parameters->get("initial").section();
+ CPPUNIT_ASSERT(!initialSection.isNull());
+
+ const double tolerance = 1.0e-06;
+ for (int i=0; i < numPoints; ++i) {
+ const int p_value = _data->constrainedPoints[i]+offset;
+ CPPUNIT_ASSERT_EQUAL(numFixedDOF,
+ initialSection->getFiberDimension(p_value));
+ const double* valuesInitial = initialSection->restrictPoint(p_value);
+ for (int iDOF=0; iDOF < numFixedDOF; ++iDOF)
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(_data->valuesInitial[i*numFixedDOF+iDOF],
+ valuesInitial[iDOF], tolerance);
+ } // for
+
+ // Check rate of change
+ const ALE::Obj<RealSection>& rateSection =
+ bc._parameters->get("rate").section();
+ CPPUNIT_ASSERT(!rateSection.isNull());
+
+ for (int i=0; i < numPoints; ++i) {
+ const int p_value = _data->constrainedPoints[i]+offset;
+ CPPUNIT_ASSERT_EQUAL(numFixedDOF,
+ rateSection->getFiberDimension(p_value));
+ const double* valuesRate = rateSection->restrictPoint(p_value);
+ for (int iDOF=0; iDOF < numFixedDOF; ++iDOF)
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(_data->valueRate,
+ valuesRate[iDOF], tolerance);
+ } // for
+ } // if
} // testInitialize
// ----------------------------------------------------------------------
@@ -462,20 +468,26 @@
db.queryType(spatialdata::spatialdb::SimpleDB::NEAREST);
spatialdata::spatialdb::UniformDB dbRate("TestDirichletBC rate");
- const char* names[] = { "dof-0", "dof-1", "dof-2" };
- const double values[] = { _data->valueRate,
- _data->valueRate,
- _data->valueRate };
- const int numValues = 3;
+ const int numValues = 4;
+ const char* names[] = {
+ "displacement-rate-x",
+ "displacement-rate-y",
+ "displacement-rate-z",
+ "rate-start-time"};
+ const double values[numValues] = {
+ _data->valueRate,
+ _data->valueRate,
+ _data->valueRate,
+ _data->tRef,
+ };
dbRate.setData(names, values, numValues);
const double upDir[] = { 0.0, 0.0, 1.0 };
bc->label(_data->label);
- bc->db(&db);
+ bc->dbInitial(&db);
bc->dbRate(&dbRate);
- bc->referenceTime(_data->tRef);
- bc->fixedDOF(_data->fixedDOF, _data->numFixedDOF);
+ bc->bcDOF(_data->fixedDOF, _data->numFixedDOF);
bc->initialize(*mesh, upDir);
} // _initialize
Modified: short/3D/PyLith/trunk/unittests/libtests/bc/TestDirichletBC.hh
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/bc/TestDirichletBC.hh 2009-06-08 22:00:14 UTC (rev 15145)
+++ short/3D/PyLith/trunk/unittests/libtests/bc/TestDirichletBC.hh 2009-06-08 23:06:06 UTC (rev 15146)
@@ -40,8 +40,9 @@
// CPPUNIT TEST SUITE /////////////////////////////////////////////////
CPPUNIT_TEST_SUITE( TestDirichletBC );
+
CPPUNIT_TEST( testConstructor );
- CPPUNIT_TEST( testFixedDOF );
+
CPPUNIT_TEST_SUITE_END();
// PUBLIC METHODS /////////////////////////////////////////////////////
@@ -56,9 +57,6 @@
/// Test constructor.
void testConstructor(void);
- /// Test fixedDOF().
- void testFixedDOF(void);
-
/// Test initialize().
void testInitialize(void);
Modified: short/3D/PyLith/trunk/unittests/libtests/bc/TestDirichletBCMulti.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/bc/TestDirichletBCMulti.cc 2009-06-08 22:00:14 UTC (rev 15145)
+++ short/3D/PyLith/trunk/unittests/libtests/bc/TestDirichletBCMulti.cc 2009-06-08 23:06:06 UTC (rev 15146)
@@ -303,10 +303,9 @@
const double upDir[] = { 0.0, 0.0, 1.0 };
bcA->label(_data->labelA);
- bcA->db(&db);
+ bcA->dbInitial(&db);
bcA->dbRate(&dbRate);
- bcA->referenceTime(_data->tRefA);
- bcA->fixedDOF(_data->fixedDOFA, _data->numFixedDOFA);
+ bcA->bcDOF(_data->fixedDOFA, _data->numFixedDOFA);
bcA->initialize(*mesh, upDir);
// Setup boundary condition B
@@ -317,10 +316,9 @@
dbRate.ioHandler(&dbIORate);
bcB->label(_data->labelB);
- bcB->db(&db);
+ bcB->dbInitial(&db);
bcB->dbRate(&dbRate);
- bcB->referenceTime(_data->tRefB);
- bcB->fixedDOF(_data->fixedDOFB, _data->numFixedDOFB);
+ bcB->bcDOF(_data->fixedDOFB, _data->numFixedDOFB);
bcB->initialize(*mesh, upDir);
// Setup boundary condition C
@@ -332,10 +330,9 @@
dbRate.ioHandler(&dbIORate);
bcC->label(_data->labelC);
- bcC->db(&db);
+ bcC->dbInitial(&db);
bcC->dbRate(&dbRate);
- bcC->referenceTime(_data->tRefC);
- bcC->fixedDOF(_data->fixedDOFC, _data->numFixedDOFC);
+ bcC->bcDOF(_data->fixedDOFC, _data->numFixedDOFC);
bcC->initialize(*mesh, upDir);
} // if
} // _initialize
Modified: short/3D/PyLith/trunk/unittests/libtests/bc/TestDirichletBoundary.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/bc/TestDirichletBoundary.cc 2009-06-08 22:00:14 UTC (rev 15145)
+++ short/3D/PyLith/trunk/unittests/libtests/bc/TestDirichletBoundary.cc 2009-06-08 23:06:06 UTC (rev 15146)
@@ -73,12 +73,14 @@
const int numFixedDOF = _data->numFixedDOF;
const size_t numBoundary = _data->numConstrainedPts;
+
// Check vertices in boundary mesh
const ALE::Obj<SieveMesh>& sieveMesh = bc._boundaryMesh->sieveMesh();
const ALE::Obj<SieveMesh::label_sequence>& vertices =
sieveMesh->depthStratum(0);
const SieveMesh::label_sequence::iterator verticesEnd = vertices->end();
+ // Check cells
const int offset = numCells;
if (numFixedDOF > 0) {
int i = 0;
@@ -89,19 +91,6 @@
} // for
CPPUNIT_ASSERT_EQUAL(int(numBoundary), i);
} // if
-
- // Check values
- const size_t size = numBoundary * numFixedDOF;
- CPPUNIT_ASSERT_EQUAL(size, bc._valuesInitial.size());
- const double tolerance = 1.0e-06;
- for (int i=0; i < size; ++i)
- CPPUNIT_ASSERT_DOUBLES_EQUAL(_data->valuesInitial[i], bc._valuesInitial[i],
- tolerance);
-
- CPPUNIT_ASSERT_EQUAL(size, bc._valuesRate.size());
- for (int i=0; i < size; ++i)
- CPPUNIT_ASSERT_DOUBLES_EQUAL(_data->valueRate, bc._valuesRate[i],
- tolerance);
} // testInitialize
// ----------------------------------------------------------------------
@@ -130,20 +119,27 @@
db.queryType(spatialdata::spatialdb::SimpleDB::NEAREST);
spatialdata::spatialdb::UniformDB dbRate("TestDirichletBoundary rate");
- const char* names[] = { "dof-0", "dof-1", "dof-2" };
- const double values[] = { _data->valueRate,
- _data->valueRate,
- _data->valueRate };
- const int numValues = 3;
+ const int numValues = 4;
+ const char* names[numValues] = {
+ "displacement-rate-x",
+ "displacement-rate-y",
+ "displacement-rate-z",
+ "rate-start-time",
+ };
+ const double values[numValues] = {
+ _data->valueRate,
+ _data->valueRate,
+ _data->valueRate,
+ _data->tRef,
+ };
dbRate.setData(names, values, numValues);
const double upDir[] = { 0.0, 0.0, 1.0 };
bc->label(_data->label);
- bc->db(&db);
+ bc->dbInitial(&db);
bc->dbRate(&dbRate);
- bc->referenceTime(_data->tRef);
- bc->fixedDOF(_data->fixedDOF, _data->numFixedDOF);
+ bc->bcDOF(_data->fixedDOF, _data->numFixedDOF);
bc->initialize(*mesh, upDir);
} // _initialize
Modified: short/3D/PyLith/trunk/unittests/libtests/bc/TestTimeDependentPoints.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/bc/TestTimeDependentPoints.cc 2009-06-08 22:00:14 UTC (rev 15145)
+++ short/3D/PyLith/trunk/unittests/libtests/bc/TestTimeDependentPoints.cc 2009-06-08 23:06:06 UTC (rev 15146)
@@ -68,6 +68,7 @@
};
const double tValue = 2.2;
+ const double tValue2 = 2.6;
const double valuesRate[npointsIn*numBCDOF] = {
-0.34, -0.17,
0.56, 0.42,
@@ -80,6 +81,22 @@
1.3*0.98, 1.4*0.98,
0.0, 0.0,
};
+ const double valuesIncrInitial[npointsIn*numBCDOF] = {
+ 0.0, 0.0,
+ 0.0, 0.0,
+ };
+ const double valuesIncrRate[npointsIn*numBCDOF] = {
+ -0.08, -0.04,
+ 0.16, 0.12,
+ };
+ const double valuesIncrChange[npointsIn*numBCDOF] = {
+ 0.0, 0.0,
+ 1.7, 1.6,
+ };
+ const double valuesIncrChangeTH[npointsIn*numBCDOF] = {
+ 1.3*-0.04, 1.4*-0.04,
+ 1.7*0.98, 1.6*0.98,
+ };
// Check values in section against expected values.
static
@@ -255,6 +272,7 @@
CPPUNIT_ASSERT(!changeTimeSection.isNull());
_TestTimeDependentPoints::_checkValues(_TestTimeDependentPoints::changeTime,
1, changeTimeSection, timeScale);
+ th.close();
} // testQueryDatabases
// ----------------------------------------------------------------------
@@ -467,6 +485,225 @@
} // testCalculateValueAll
// ----------------------------------------------------------------------
+// Test _calculateValueIncr() with initial value.
+void
+pylith::bc::TestTimeDependentPoints::testCalculateValueIncrInitial(void)
+{ // testCalculateValueIncrInitial
+ CPPUNIT_ASSERT(0 != _mesh);
+ CPPUNIT_ASSERT(0 != _bc);
+
+ spatialdata::spatialdb::SimpleDB dbInitial("TestTimeDependentPoints _queryDatabases");
+ spatialdata::spatialdb::SimpleIOAscii dbInitialIO;
+ dbInitialIO.filename("data/tri3_force.spatialdb");
+ dbInitial.ioHandler(&dbInitialIO);
+ dbInitial.queryType(spatialdata::spatialdb::SimpleDB::NEAREST);
+
+ _bc->dbInitial(&dbInitial);
+
+ const double pressureScale = _TestTimeDependentPoints::pressureScale;
+ const double lengthScale = _TestTimeDependentPoints::lengthScale;
+ const double timeScale = _TestTimeDependentPoints::timeScale;
+ const double forceScale = pressureScale * lengthScale * lengthScale;
+ const char* fieldName = "force";
+ _bc->_queryDatabases(*_mesh, forceScale, fieldName);
+ const double t0 = _TestTimeDependentPoints::tValue / timeScale;
+ const double t1 = _TestTimeDependentPoints::tValue2 / timeScale;
+ _bc->_calculateValueIncr(t0, t1);
+
+ const double tolerance = 1.0e-06;
+ const int numBCDOF = _TestTimeDependentPoints::numBCDOF;
+ CPPUNIT_ASSERT(0 != _bc->_parameters);
+
+ // Check values.
+ const ALE::Obj<RealSection>& valueSection =
+ _bc->_parameters->get("value").section();
+ CPPUNIT_ASSERT(!valueSection.isNull());
+ _TestTimeDependentPoints::_checkValues(_TestTimeDependentPoints::valuesIncrInitial,
+ numBCDOF, valueSection, forceScale);
+} // testCalculateValueIncrInitial
+
+// ----------------------------------------------------------------------
+// Test _calculateValueIncr() with rate.
+void
+pylith::bc::TestTimeDependentPoints::testCalculateValueIncrRate(void)
+{ // testCalculateValueIncrRate
+ CPPUNIT_ASSERT(0 != _mesh);
+ CPPUNIT_ASSERT(0 != _bc);
+
+ spatialdata::spatialdb::SimpleDB dbRate("TestTimeDependentPoints _queryDatabases");
+ spatialdata::spatialdb::SimpleIOAscii dbRateIO;
+ dbRateIO.filename("data/tri3_force_rate.spatialdb");
+ dbRate.ioHandler(&dbRateIO);
+ dbRate.queryType(spatialdata::spatialdb::SimpleDB::NEAREST);
+
+ _bc->dbRate(&dbRate);
+
+ const double pressureScale = _TestTimeDependentPoints::pressureScale;
+ const double lengthScale = _TestTimeDependentPoints::lengthScale;
+ const double timeScale = _TestTimeDependentPoints::timeScale;
+ const double forceScale = pressureScale * lengthScale * lengthScale;
+ const char* fieldName = "force";
+ _bc->_queryDatabases(*_mesh, forceScale, fieldName);
+ const double t0 = _TestTimeDependentPoints::tValue / timeScale;
+ const double t1 = _TestTimeDependentPoints::tValue2 / timeScale;
+ _bc->_calculateValueIncr(t0, t1);
+
+ const double tolerance = 1.0e-06;
+ const int numBCDOF = _TestTimeDependentPoints::numBCDOF;
+ CPPUNIT_ASSERT(0 != _bc->_parameters);
+
+ // Check values.
+ const ALE::Obj<RealSection>& valueSection =
+ _bc->_parameters->get("value").section();
+ CPPUNIT_ASSERT(!valueSection.isNull());
+ _TestTimeDependentPoints::_checkValues(_TestTimeDependentPoints::valuesIncrRate,
+ numBCDOF, valueSection, forceScale);
+} // testCalculateValueIncrRate
+
+// ----------------------------------------------------------------------
+// Test _calculateValueIncr() with temporal change.
+void
+pylith::bc::TestTimeDependentPoints::testCalculateValueIncrChange(void)
+{ // testCalculateValueIncrChange
+ CPPUNIT_ASSERT(0 != _mesh);
+ CPPUNIT_ASSERT(0 != _bc);
+
+ spatialdata::spatialdb::SimpleDB dbChange("TestTimeDependentPoints _queryDatabases");
+ spatialdata::spatialdb::SimpleIOAscii dbChangeIO;
+ dbChangeIO.filename("data/tri3_force_change.spatialdb");
+ dbChange.ioHandler(&dbChangeIO);
+ dbChange.queryType(spatialdata::spatialdb::SimpleDB::NEAREST);
+
+ _bc->dbChange(&dbChange);
+
+ const double pressureScale = _TestTimeDependentPoints::pressureScale;
+ const double lengthScale = _TestTimeDependentPoints::lengthScale;
+ const double timeScale = _TestTimeDependentPoints::timeScale;
+ const double forceScale = pressureScale * lengthScale * lengthScale;
+ const char* fieldName = "force";
+ _bc->_queryDatabases(*_mesh, forceScale, fieldName);
+ const double t0 = _TestTimeDependentPoints::tValue / timeScale;
+ const double t1 = _TestTimeDependentPoints::tValue2 / timeScale;
+ _bc->_calculateValueIncr(t0, t1);
+
+ const double tolerance = 1.0e-06;
+ const int numBCDOF = _TestTimeDependentPoints::numBCDOF;
+ CPPUNIT_ASSERT(0 != _bc->_parameters);
+
+ // Check values.
+ const ALE::Obj<RealSection>& valueSection =
+ _bc->_parameters->get("value").section();
+ CPPUNIT_ASSERT(!valueSection.isNull());
+ _TestTimeDependentPoints::_checkValues(_TestTimeDependentPoints::valuesIncrChange,
+ numBCDOF, valueSection, forceScale);
+} // testCalculateValueIncrChange
+
+// ----------------------------------------------------------------------
+// Test _calculateValueIncr() with temporal change w/time history.
+void
+pylith::bc::TestTimeDependentPoints::testCalculateValueIncrChangeTH(void)
+{ // testCalculateValueIncrChangeTH
+ CPPUNIT_ASSERT(0 != _bc);
+
+ spatialdata::spatialdb::SimpleDB dbChange("TestTimeDependentPoints _queryDatabases");
+ spatialdata::spatialdb::SimpleIOAscii dbChangeIO;
+ dbChangeIO.filename("data/tri3_force_change.spatialdb");
+ dbChange.ioHandler(&dbChangeIO);
+ dbChange.queryType(spatialdata::spatialdb::SimpleDB::NEAREST);
+
+ spatialdata::spatialdb::TimeHistory th("TestTimeDependentPoints _queryDatabases");
+ th.filename("data/tri3_force.timedb");
+
+ _bc->dbChange(&dbChange);
+ _bc->dbTimeHistory(&th);
+
+ const double pressureScale = _TestTimeDependentPoints::pressureScale;
+ const double lengthScale = _TestTimeDependentPoints::lengthScale;
+ const double timeScale = _TestTimeDependentPoints::timeScale;
+ const double forceScale = pressureScale * lengthScale * lengthScale;
+ const char* fieldName = "force";
+ _bc->_queryDatabases(*_mesh, forceScale, fieldName);
+ const double t0 = _TestTimeDependentPoints::tValue / timeScale;
+ const double t1 = _TestTimeDependentPoints::tValue2 / timeScale;
+ _bc->_calculateValueIncr(t0, t1);
+
+ const double tolerance = 1.0e-06;
+ const int numBCDOF = _TestTimeDependentPoints::numBCDOF;
+ CPPUNIT_ASSERT(0 != _bc->_parameters);
+
+ // Check values.
+ const ALE::Obj<RealSection>& valueSection =
+ _bc->_parameters->get("value").section();
+ CPPUNIT_ASSERT(!valueSection.isNull());
+ _TestTimeDependentPoints::_checkValues(_TestTimeDependentPoints::valuesIncrChangeTH,
+ numBCDOF, valueSection, forceScale);
+} // testCalculateValueIncrChangeTH
+
+// ----------------------------------------------------------------------
+// Test _calculateValueIncr() with initial, rate, and temporal change w/time history.
+void
+pylith::bc::TestTimeDependentPoints::testCalculateValueIncrAll(void)
+{ // testCalculateValueIncrAll
+ CPPUNIT_ASSERT(0 != _mesh);
+ CPPUNIT_ASSERT(0 != _bc);
+
+ spatialdata::spatialdb::SimpleDB dbInitial("TestTimeDependentPoints _queryDatabases");
+ spatialdata::spatialdb::SimpleIOAscii dbInitialIO;
+ dbInitialIO.filename("data/tri3_force.spatialdb");
+ dbInitial.ioHandler(&dbInitialIO);
+ dbInitial.queryType(spatialdata::spatialdb::SimpleDB::NEAREST);
+
+ spatialdata::spatialdb::SimpleDB dbRate("TestTimeDependentPoints _queryDatabases");
+ spatialdata::spatialdb::SimpleIOAscii dbRateIO;
+ dbRateIO.filename("data/tri3_force_rate.spatialdb");
+ dbRate.ioHandler(&dbRateIO);
+ dbRate.queryType(spatialdata::spatialdb::SimpleDB::NEAREST);
+
+ spatialdata::spatialdb::SimpleDB dbChange("TestTimeDependentPoints _queryDatabases");
+ spatialdata::spatialdb::SimpleIOAscii dbChangeIO;
+ dbChangeIO.filename("data/tri3_force_change.spatialdb");
+ dbChange.ioHandler(&dbChangeIO);
+ dbChange.queryType(spatialdata::spatialdb::SimpleDB::NEAREST);
+
+ spatialdata::spatialdb::TimeHistory th("TestTimeDependentPoints _queryDatabases");
+ th.filename("data/tri3_force.timedb");
+
+ _bc->dbInitial(&dbInitial);
+ _bc->dbRate(&dbRate);
+ _bc->dbChange(&dbChange);
+ _bc->dbTimeHistory(&th);
+
+ const double pressureScale = _TestTimeDependentPoints::pressureScale;
+ const double lengthScale = _TestTimeDependentPoints::lengthScale;
+ const double timeScale = _TestTimeDependentPoints::timeScale;
+ const double forceScale = pressureScale * lengthScale * lengthScale;
+ const char* fieldName = "force";
+ _bc->_queryDatabases(*_mesh, forceScale, fieldName);
+ const double t0 = _TestTimeDependentPoints::tValue / timeScale;
+ const double t1 = _TestTimeDependentPoints::tValue2 / timeScale;
+ _bc->_calculateValueIncr(t0, t1);
+
+ const double tolerance = 1.0e-06;
+ const int numBCDOF = _TestTimeDependentPoints::numBCDOF;
+ CPPUNIT_ASSERT(0 != _bc->_parameters);
+
+ // Check values.
+ const int npoints = _TestTimeDependentPoints::npointsIn;
+ double_array valuesE(npoints*numBCDOF);
+ for (int i=0; i < valuesE.size(); ++i)
+ valuesE[i] =
+ _TestTimeDependentPoints::valuesIncrInitial[i] +
+ _TestTimeDependentPoints::valuesIncrRate[i] +
+ _TestTimeDependentPoints::valuesIncrChangeTH[i];
+
+ const ALE::Obj<RealSection>& valueSection =
+ _bc->_parameters->get("value").section();
+ CPPUNIT_ASSERT(!valueSection.isNull());
+ _TestTimeDependentPoints::_checkValues(&valuesE[0],
+ numBCDOF, valueSection, forceScale);
+} // testCalculateValueIncrAll
+
+// ----------------------------------------------------------------------
// Check values in section against expected values.
void
pylith::bc::_TestTimeDependentPoints::_checkValues(const double* valuesE,
Modified: short/3D/PyLith/trunk/unittests/libtests/bc/TestTimeDependentPoints.hh
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/bc/TestTimeDependentPoints.hh 2009-06-08 22:00:14 UTC (rev 15145)
+++ short/3D/PyLith/trunk/unittests/libtests/bc/TestTimeDependentPoints.hh 2009-06-08 23:06:06 UTC (rev 15146)
@@ -48,6 +48,11 @@
CPPUNIT_TEST( testCalculateValueChange );
CPPUNIT_TEST( testCalculateValueChangeTH );
CPPUNIT_TEST( testCalculateValueAll );
+ CPPUNIT_TEST( testCalculateValueIncrInitial );
+ CPPUNIT_TEST( testCalculateValueIncrRate );
+ CPPUNIT_TEST( testCalculateValueIncrChange );
+ CPPUNIT_TEST( testCalculateValueIncrChangeTH );
+ CPPUNIT_TEST( testCalculateValueIncrAll );
CPPUNIT_TEST_SUITE_END();
@@ -81,9 +86,26 @@
/// Test _calculateValue() with temporal change w/time history.
void testCalculateValueChangeTH(void);
- /// Test _calculateValue() with initial, rate, and temporal change w/time history.
+ /// Test _calculateValue() with initial, rate, and temporal change
+ /// w/time history.
void testCalculateValueAll(void);
+ /// Test _calculateValueIncr() with initial value.
+ void testCalculateValueIncrInitial(void);
+
+ /// Test _calculateValueIncr() with rate.
+ void testCalculateValueIncrRate(void);
+
+ /// Test _calculateValueIncr() with temporal change.
+ void testCalculateValueIncrChange(void);
+
+ /// Test _calculateValueIncr() with temporal change w/time history.
+ void testCalculateValueIncrChangeTH(void);
+
+ /// Test _calculateValueIncr() with initial, rate, and temporal change
+ /// w/time history.
+ void testCalculateValueIncrAll(void);
+
// PRIVATE MEMBERS ////////////////////////////////////////////////////
private :
Modified: short/3D/PyLith/trunk/unittests/libtests/bc/data/DirichletDataMultiTet4.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/bc/data/DirichletDataMultiTet4.cc 2009-06-08 22:00:14 UTC (rev 15145)
+++ short/3D/PyLith/trunk/unittests/libtests/bc/data/DirichletDataMultiTet4.cc 2009-06-08 23:06:06 UTC (rev 15146)
@@ -50,7 +50,7 @@
* 1: 11.0
* 2: 22.0
* 3: 33.0
- * tRef = 0.0.0
+ * tRef = 0.0
* Rate of change of values
* 1: 10.0
* 2: 20.0
Modified: short/3D/PyLith/trunk/unittests/libtests/bc/data/hex8_disp.spatialdb
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/bc/data/hex8_disp.spatialdb 2009-06-08 22:00:14 UTC (rev 15145)
+++ short/3D/PyLith/trunk/unittests/libtests/bc/data/hex8_disp.spatialdb 2009-06-08 23:06:06 UTC (rev 15146)
@@ -1,7 +1,7 @@
#SPATIAL.ascii 1
SimpleDB {
num-values = 3
- value-names = dof-0 dof-1 dof-2
+ value-names = displacement-x displacement-y displacement-z
value-units = m m m
num-locs = 4
data-dim = 1
Modified: short/3D/PyLith/trunk/unittests/libtests/bc/data/line2_disp.spatialdb
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/bc/data/line2_disp.spatialdb 2009-06-08 22:00:14 UTC (rev 15145)
+++ short/3D/PyLith/trunk/unittests/libtests/bc/data/line2_disp.spatialdb 2009-06-08 23:06:06 UTC (rev 15146)
@@ -1,7 +1,7 @@
#SPATIAL.ascii 1
SimpleDB {
num-values = 1
- value-names = dof-0
+ value-names = displacement-x
value-units = m
num-locs = 2
data-dim = 1
Modified: short/3D/PyLith/trunk/unittests/libtests/bc/data/quad4_disp.spatialdb
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/bc/data/quad4_disp.spatialdb 2009-06-08 22:00:14 UTC (rev 15145)
+++ short/3D/PyLith/trunk/unittests/libtests/bc/data/quad4_disp.spatialdb 2009-06-08 23:06:06 UTC (rev 15146)
@@ -1,7 +1,7 @@
#SPATIAL.ascii 1
SimpleDB {
num-values = 2
- value-names = dof-0 dof-1
+ value-names = displacement-x displacement-y
value-units = m m
num-locs = 3
data-dim = 2
Modified: short/3D/PyLith/trunk/unittests/libtests/bc/data/tet4_disp.spatialdb
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/bc/data/tet4_disp.spatialdb 2009-06-08 22:00:14 UTC (rev 15145)
+++ short/3D/PyLith/trunk/unittests/libtests/bc/data/tet4_disp.spatialdb 2009-06-08 23:06:06 UTC (rev 15146)
@@ -1,7 +1,7 @@
#SPATIAL.ascii 1
SimpleDB {
num-values = 2
- value-names = dof-1 dof-2
+ value-names = displacement-y displacement-z
value-units = m m
num-locs = 1
data-dim = 0
Modified: short/3D/PyLith/trunk/unittests/libtests/bc/data/tet4_disp2.spatialdb
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/bc/data/tet4_disp2.spatialdb 2009-06-08 22:00:14 UTC (rev 15145)
+++ short/3D/PyLith/trunk/unittests/libtests/bc/data/tet4_disp2.spatialdb 2009-06-08 23:06:06 UTC (rev 15146)
@@ -1,7 +1,7 @@
#SPATIAL.ascii 1
SimpleDB {
num-values = 3
- value-names = dof-0 dof-1 dof-2
+ value-names = displacement-x displacement-y displacement-z
value-units = m m m
num-locs = 5
data-dim = 3
Modified: short/3D/PyLith/trunk/unittests/libtests/bc/data/tet4_vel2.spatialdb
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/bc/data/tet4_vel2.spatialdb 2009-06-08 22:00:14 UTC (rev 15145)
+++ short/3D/PyLith/trunk/unittests/libtests/bc/data/tet4_vel2.spatialdb 2009-06-08 23:06:06 UTC (rev 15146)
@@ -1,8 +1,8 @@
#SPATIAL.ascii 1
SimpleDB {
- num-values = 3
- value-names = dof-0 dof-1 dof-2
- value-units = m m m
+ num-values = 4
+ value-names = displacement-rate-x displacement-rate-y displacement-rate-z rate-start-time
+ value-units = m m m s
num-locs = 5
data-dim = 3
space-dim = 3
@@ -11,8 +11,8 @@
space-dim = 3
}
}
- 0.0 0.0 0.0 1.0 99.9 -1.0
- 1.0 0.0 0.0 9.9 10.0 -9.9
- 0.0 1.0 0.0 2.0 20.0 -2.0
- 0.0 0.0 1.0 3.0 30.0 -3.0
--1.0 0.0 0.0 4.0 99.9 -9.9
+ 0.0 0.0 0.0 1.0 99.9 -1.0 0.0
+ 1.0 0.0 0.0 9.9 10.0 -9.9 0.0
+ 0.0 1.0 0.0 2.0 20.0 -2.0 0.0
+ 0.0 0.0 1.0 3.0 30.0 -3.0 0.0
+-1.0 0.0 0.0 4.0 99.9 -9.9 0.0
Modified: short/3D/PyLith/trunk/unittests/libtests/bc/data/tri3_disp.spatialdb
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/bc/data/tri3_disp.spatialdb 2009-06-08 22:00:14 UTC (rev 15145)
+++ short/3D/PyLith/trunk/unittests/libtests/bc/data/tri3_disp.spatialdb 2009-06-08 23:06:06 UTC (rev 15146)
@@ -1,7 +1,7 @@
#SPATIAL.ascii 1
SimpleDB {
num-values = 1
- value-names = dof-1
+ value-names = displacement-y
value-units = m
num-locs = 2
data-dim = 1
Modified: short/3D/PyLith/trunk/unittests/libtests/bc/data/tri3_disp2.spatialdb
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/bc/data/tri3_disp2.spatialdb 2009-06-08 22:00:14 UTC (rev 15145)
+++ short/3D/PyLith/trunk/unittests/libtests/bc/data/tri3_disp2.spatialdb 2009-06-08 23:06:06 UTC (rev 15146)
@@ -1,7 +1,7 @@
#SPATIAL.ascii 1
SimpleDB {
num-values = 1
- value-names = dof-0
+ value-names = displacement-x
value-units = m
num-locs = 2
data-dim = 1
Modified: short/3D/PyLith/trunk/unittests/libtests/bc/data/tri3_vel.spatialdb
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/bc/data/tri3_vel.spatialdb 2009-06-08 22:00:14 UTC (rev 15145)
+++ short/3D/PyLith/trunk/unittests/libtests/bc/data/tri3_vel.spatialdb 2009-06-08 23:06:06 UTC (rev 15146)
@@ -1,8 +1,8 @@
#SPATIAL.ascii 1
SimpleDB {
- num-values = 1
- value-names = dof-1
- value-units = m
+ num-values = 2
+ value-names = displacement-rate-y rate-start-time
+ value-units = m s
num-locs = 2
data-dim = 1
space-dim = 2
@@ -11,5 +11,5 @@
space-dim = 2
}
}
- 0.0 -1.0 0.2
- 1.0 0.0 0.8
+ 0.0 -1.0 0.2 3.2
+ 1.0 0.0 0.8 3.2
Modified: short/3D/PyLith/trunk/unittests/libtests/bc/data/tri3_vel2.spatialdb
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/bc/data/tri3_vel2.spatialdb 2009-06-08 22:00:14 UTC (rev 15145)
+++ short/3D/PyLith/trunk/unittests/libtests/bc/data/tri3_vel2.spatialdb 2009-06-08 23:06:06 UTC (rev 15146)
@@ -1,8 +1,8 @@
#SPATIAL.ascii 1
SimpleDB {
- num-values = 1
- value-names = dof-0
- value-units = m
+ num-values = 2
+ value-names = displacement-rate-x rate-start-time
+ value-units = m s
num-locs = 2
data-dim = 1
space-dim = 2
@@ -11,5 +11,5 @@
space-dim = 2
}
}
- 0.0 1.0 -0.4
- 1.0 0.0 0.2
+ 0.0 1.0 -0.4 0.4
+ 1.0 0.0 0.2 0.4
Modified: short/3D/PyLith/trunk/unittests/pytests/bc/TestDirichletBC.py
===================================================================
--- short/3D/PyLith/trunk/unittests/pytests/bc/TestDirichletBC.py 2009-06-08 22:00:14 UTC (rev 15145)
+++ short/3D/PyLith/trunk/unittests/pytests/bc/TestDirichletBC.py 2009-06-08 23:06:06 UTC (rev 15146)
@@ -166,25 +166,17 @@
Initialize DirichletBC boundary condition.
"""
from spatialdata.spatialdb.SimpleDB import SimpleDB
- db = SimpleDB()
- db.inventory.label = "TestDirichletBC tri3"
- db.inventory.iohandler.inventory.filename = "data/tri3.spatialdb"
- db.inventory.iohandler._configure()
- db._configure()
+ dbInitial = SimpleDB()
+ dbInitial.inventory.label = "TestDirichletBC tri3"
+ dbInitial.inventory.iohandler.inventory.filename = "data/tri3_disp.spatialdb"
+ dbInitial.inventory.iohandler._configure()
+ dbInitial._configure()
- from pylith.bc.FixedDOFDB import FixedDOFDB
- dbRate = FixedDOFDB()
- dbRate.inventory.label = "TestDirichletBC rate tri3"
- dbRate._configure()
-
from pylith.bc.DirichletBC import DirichletBC
bc = DirichletBC()
bc.inventory.label = "bc"
- bc.inventory.fixedDOF = [1]
- from pyre.units.time import second
- bc.inventory.tRef = -1.0*second
- bc.inventory.db = db
- bc.inventory.dbRate = dbRate
+ bc.inventory.bcDOF = [1]
+ bc.inventory.dbInitial = dbInitial
bc._configure()
from spatialdata.geocoords.CSCart import CSCart
Modified: short/3D/PyLith/trunk/unittests/pytests/bc/TestNeumann.py
===================================================================
--- short/3D/PyLith/trunk/unittests/pytests/bc/TestNeumann.py 2009-06-08 22:00:14 UTC (rev 15145)
+++ short/3D/PyLith/trunk/unittests/pytests/bc/TestNeumann.py 2009-06-08 23:06:06 UTC (rev 15146)
@@ -175,7 +175,7 @@
db = SimpleDB()
db._configure()
db.inventory.label = "TestNeumann tri3"
- db.inventory.iohandler.inventory.filename = "data/tri3-tractions.spatialdb"
+ db.inventory.iohandler.inventory.filename = "data/tri3_tractions.spatialdb"
db.inventory.iohandler._configure()
db._configure()
Modified: short/3D/PyLith/trunk/unittests/pytests/bc/data/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/unittests/pytests/bc/data/Makefile.am 2009-06-08 22:00:14 UTC (rev 15145)
+++ short/3D/PyLith/trunk/unittests/pytests/bc/data/Makefile.am 2009-06-08 23:06:06 UTC (rev 15146)
@@ -11,8 +11,8 @@
#
dist_noinst_DATA = \
- tri3.spatialdb \
- tri3-tractions.spatialdb \
+ tri3_disp.spatialdb \
+ tri3_tractions.spatialdb \
tri3.mesh \
elasticplanestrain.spatialdb
Deleted: short/3D/PyLith/trunk/unittests/pytests/bc/data/tri3-tractions.spatialdb
===================================================================
--- short/3D/PyLith/trunk/unittests/pytests/bc/data/tri3-tractions.spatialdb 2009-06-08 22:00:14 UTC (rev 15145)
+++ short/3D/PyLith/trunk/unittests/pytests/bc/data/tri3-tractions.spatialdb 2009-06-08 23:06:06 UTC (rev 15146)
@@ -1,14 +0,0 @@
-#SPATIAL.ascii 1
-SimpleDB {
- num-values = 2
- value-names = shear-traction normal-traction
- value-units = Pa Pa
- num-locs = 1
- data-dim = 0
- space-dim = 2
- cs-data = cartesian {
- to-meters = 1.0
- space-dim = 2
- }
-}
- 0.0 0.0 0.0 4.0e8
Deleted: short/3D/PyLith/trunk/unittests/pytests/bc/data/tri3.spatialdb
===================================================================
--- short/3D/PyLith/trunk/unittests/pytests/bc/data/tri3.spatialdb 2009-06-08 22:00:14 UTC (rev 15145)
+++ short/3D/PyLith/trunk/unittests/pytests/bc/data/tri3.spatialdb 2009-06-08 23:06:06 UTC (rev 15146)
@@ -1,15 +0,0 @@
-#SPATIAL.ascii 1
-SimpleDB {
- num-values = 1
- value-names = dof-1
- value-units = m
- num-locs = 2
- data-dim = 1
- space-dim = 2
- cs-data = cartesian {
- to-meters = 1.0
- space-dim = 2
- }
-}
- 0.0 -1.0 0.3
- 1.0 0.0 0.7
Copied: short/3D/PyLith/trunk/unittests/pytests/bc/data/tri3_disp.spatialdb (from rev 15138, short/3D/PyLith/trunk/unittests/pytests/bc/data/tri3.spatialdb)
===================================================================
--- short/3D/PyLith/trunk/unittests/pytests/bc/data/tri3_disp.spatialdb (rev 0)
+++ short/3D/PyLith/trunk/unittests/pytests/bc/data/tri3_disp.spatialdb 2009-06-08 23:06:06 UTC (rev 15146)
@@ -0,0 +1,15 @@
+#SPATIAL.ascii 1
+SimpleDB {
+ num-values = 1
+ value-names = displacement-y
+ value-units = m
+ num-locs = 2
+ data-dim = 1
+ space-dim = 2
+ cs-data = cartesian {
+ to-meters = 1.0
+ space-dim = 2
+ }
+}
+ 0.0 -1.0 0.3
+ 1.0 0.0 0.7
Property changes on: short/3D/PyLith/trunk/unittests/pytests/bc/data/tri3_disp.spatialdb
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: short/3D/PyLith/trunk/unittests/pytests/bc/data/tri3_tractions.spatialdb (from rev 15138, short/3D/PyLith/trunk/unittests/pytests/bc/data/tri3-tractions.spatialdb)
===================================================================
--- short/3D/PyLith/trunk/unittests/pytests/bc/data/tri3_tractions.spatialdb (rev 0)
+++ short/3D/PyLith/trunk/unittests/pytests/bc/data/tri3_tractions.spatialdb 2009-06-08 23:06:06 UTC (rev 15146)
@@ -0,0 +1,14 @@
+#SPATIAL.ascii 1
+SimpleDB {
+ num-values = 2
+ value-names = shear-traction normal-traction
+ value-units = Pa Pa
+ num-locs = 1
+ data-dim = 0
+ space-dim = 2
+ cs-data = cartesian {
+ to-meters = 1.0
+ space-dim = 2
+ }
+}
+ 0.0 0.0 0.0 4.0e8
Property changes on: short/3D/PyLith/trunk/unittests/pytests/bc/data/tri3_tractions.spatialdb
___________________________________________________________________
Name: svn:mergeinfo
+
More information about the CIG-COMMITS
mailing list