From 536e2fd41382d2c5a451f5c67f5f474f511c0ed3 Mon Sep 17 00:00:00 2001 From: graham Date: Wed, 24 Feb 2010 14:14:08 +0000 Subject: [PATCH] BUG: fvMotionSolver/pointPatchFields which store p0, the initial position of patch points. Adding autoMap and rmap functions to correctly handle p0 on decomposition and reconstruction. --- ...llatingDisplacementPointPatchVectorField.C | 26 ++++++++++ ...llatingDisplacementPointPatchVectorField.H | 16 +++++++ ...OscillatingVelocityPointPatchVectorField.C | 26 ++++++++++ ...OscillatingVelocityPointPatchVectorField.H | 16 +++++++ ...oscillatingVelocityPointPatchVectorField.C | 26 ++++++++++ ...oscillatingVelocityPointPatchVectorField.H | 16 +++++++ ...gidBodyDisplacementPointPatchVectorField.C | 48 +++++++++++++++---- ...gidBodyDisplacementPointPatchVectorField.H | 20 +++++++- 8 files changed, 184 insertions(+), 10 deletions(-) diff --git a/src/fvMotionSolver/pointPatchFields/derived/angularOscillatingDisplacement/angularOscillatingDisplacementPointPatchVectorField.C b/src/fvMotionSolver/pointPatchFields/derived/angularOscillatingDisplacement/angularOscillatingDisplacementPointPatchVectorField.C index 1b6a9e6d5a..2a29097f9d 100644 --- a/src/fvMotionSolver/pointPatchFields/derived/angularOscillatingDisplacement/angularOscillatingDisplacementPointPatchVectorField.C +++ b/src/fvMotionSolver/pointPatchFields/derived/angularOscillatingDisplacement/angularOscillatingDisplacementPointPatchVectorField.C @@ -123,6 +123,32 @@ angularOscillatingDisplacementPointPatchVectorField // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // +void angularOscillatingDisplacementPointPatchVectorField::autoMap +( + const pointPatchFieldMapper& m +) +{ + fixedValuePointPatchField::autoMap(m); + + p0_.autoMap(m); +} + + +void angularOscillatingDisplacementPointPatchVectorField::rmap +( + const pointPatchField& ptf, + const labelList& addr +) +{ + const angularOscillatingDisplacementPointPatchVectorField& aODptf = + refCast(ptf); + + fixedValuePointPatchField::rmap(aODptf, addr); + + p0_.rmap(aODptf.p0_, addr); +} + + void angularOscillatingDisplacementPointPatchVectorField::updateCoeffs() { if (this->updated()) diff --git a/src/fvMotionSolver/pointPatchFields/derived/angularOscillatingDisplacement/angularOscillatingDisplacementPointPatchVectorField.H b/src/fvMotionSolver/pointPatchFields/derived/angularOscillatingDisplacement/angularOscillatingDisplacementPointPatchVectorField.H index ed986cf2e0..6cb005940a 100644 --- a/src/fvMotionSolver/pointPatchFields/derived/angularOscillatingDisplacement/angularOscillatingDisplacementPointPatchVectorField.H +++ b/src/fvMotionSolver/pointPatchFields/derived/angularOscillatingDisplacement/angularOscillatingDisplacementPointPatchVectorField.H @@ -132,6 +132,22 @@ public: // Member functions + // Mapping functions + + //- Map (and resize as needed) from self given a mapping object + virtual void autoMap + ( + const pointPatchFieldMapper& + ); + + //- Reverse map the given pointPatchField onto this pointPatchField + virtual void rmap + ( + const pointPatchField&, + const labelList& + ); + + // Evaluation functions //- Update the coefficients associated with the patch field diff --git a/src/fvMotionSolver/pointPatchFields/derived/angularOscillatingVelocity/angularOscillatingVelocityPointPatchVectorField.C b/src/fvMotionSolver/pointPatchFields/derived/angularOscillatingVelocity/angularOscillatingVelocityPointPatchVectorField.C index 868cc70abb..aa84419f1f 100644 --- a/src/fvMotionSolver/pointPatchFields/derived/angularOscillatingVelocity/angularOscillatingVelocityPointPatchVectorField.C +++ b/src/fvMotionSolver/pointPatchFields/derived/angularOscillatingVelocity/angularOscillatingVelocityPointPatchVectorField.C @@ -123,6 +123,32 @@ angularOscillatingVelocityPointPatchVectorField // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // +void angularOscillatingVelocityPointPatchVectorField::autoMap +( + const pointPatchFieldMapper& m +) +{ + fixedValuePointPatchField::autoMap(m); + + p0_.autoMap(m); +} + + +void angularOscillatingVelocityPointPatchVectorField::rmap +( + const pointPatchField& ptf, + const labelList& addr +) +{ + const angularOscillatingVelocityPointPatchVectorField& aOVptf = + refCast(ptf); + + fixedValuePointPatchField::rmap(aOVptf, addr); + + p0_.rmap(aOVptf.p0_, addr); +} + + void angularOscillatingVelocityPointPatchVectorField::updateCoeffs() { if (this->updated()) diff --git a/src/fvMotionSolver/pointPatchFields/derived/angularOscillatingVelocity/angularOscillatingVelocityPointPatchVectorField.H b/src/fvMotionSolver/pointPatchFields/derived/angularOscillatingVelocity/angularOscillatingVelocityPointPatchVectorField.H index 6ca391228b..ff5a451563 100644 --- a/src/fvMotionSolver/pointPatchFields/derived/angularOscillatingVelocity/angularOscillatingVelocityPointPatchVectorField.H +++ b/src/fvMotionSolver/pointPatchFields/derived/angularOscillatingVelocity/angularOscillatingVelocityPointPatchVectorField.H @@ -132,6 +132,22 @@ public: // Member functions + // Mapping functions + + //- Map (and resize as needed) from self given a mapping object + virtual void autoMap + ( + const pointPatchFieldMapper& + ); + + //- Reverse map the given pointPatchField onto this pointPatchField + virtual void rmap + ( + const pointPatchField&, + const labelList& + ); + + // Evaluation functions //- Update the coefficients associated with the patch field diff --git a/src/fvMotionSolver/pointPatchFields/derived/oscillatingVelocity/oscillatingVelocityPointPatchVectorField.C b/src/fvMotionSolver/pointPatchFields/derived/oscillatingVelocity/oscillatingVelocityPointPatchVectorField.C index 412c9561a2..6b9d63630f 100644 --- a/src/fvMotionSolver/pointPatchFields/derived/oscillatingVelocity/oscillatingVelocityPointPatchVectorField.C +++ b/src/fvMotionSolver/pointPatchFields/derived/oscillatingVelocity/oscillatingVelocityPointPatchVectorField.C @@ -111,6 +111,32 @@ oscillatingVelocityPointPatchVectorField // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // +void oscillatingVelocityPointPatchVectorField::autoMap +( + const pointPatchFieldMapper& m +) +{ + fixedValuePointPatchField::autoMap(m); + + p0_.autoMap(m); +} + + +void oscillatingVelocityPointPatchVectorField::rmap +( + const pointPatchField& ptf, + const labelList& addr +) +{ + const oscillatingVelocityPointPatchVectorField& oVptf = + refCast(ptf); + + fixedValuePointPatchField::rmap(oVptf, addr); + + p0_.rmap(oVptf.p0_, addr); +} + + void oscillatingVelocityPointPatchVectorField::updateCoeffs() { if (this->updated()) diff --git a/src/fvMotionSolver/pointPatchFields/derived/oscillatingVelocity/oscillatingVelocityPointPatchVectorField.H b/src/fvMotionSolver/pointPatchFields/derived/oscillatingVelocity/oscillatingVelocityPointPatchVectorField.H index ec4892f621..b6f003540c 100644 --- a/src/fvMotionSolver/pointPatchFields/derived/oscillatingVelocity/oscillatingVelocityPointPatchVectorField.H +++ b/src/fvMotionSolver/pointPatchFields/derived/oscillatingVelocity/oscillatingVelocityPointPatchVectorField.H @@ -129,6 +129,22 @@ public: // Member functions + // Mapping functions + + //- Map (and resize as needed) from self given a mapping object + virtual void autoMap + ( + const pointPatchFieldMapper& + ); + + //- Reverse map the given pointPatchField onto this pointPatchField + virtual void rmap + ( + const pointPatchField&, + const labelList& + ); + + // Evaluation functions //- Update the coefficients associated with the patch field diff --git a/src/postProcessing/functionObjects/forces/pointPatchFields/derived/uncoupledSixDoFRigidBodyDisplacement/uncoupledSixDoFRigidBodyDisplacementPointPatchVectorField.C b/src/postProcessing/functionObjects/forces/pointPatchFields/derived/uncoupledSixDoFRigidBodyDisplacement/uncoupledSixDoFRigidBodyDisplacementPointPatchVectorField.C index d35eefd671..e8e9d4b628 100644 --- a/src/postProcessing/functionObjects/forces/pointPatchFields/derived/uncoupledSixDoFRigidBodyDisplacement/uncoupledSixDoFRigidBodyDisplacementPointPatchVectorField.C +++ b/src/postProcessing/functionObjects/forces/pointPatchFields/derived/uncoupledSixDoFRigidBodyDisplacement/uncoupledSixDoFRigidBodyDisplacementPointPatchVectorField.C @@ -48,7 +48,7 @@ uncoupledSixDoFRigidBodyDisplacementPointPatchVectorField : fixedValuePointPatchField(p, iF), motion_(), - p0_(p.localPoints()), + initialPoints_(p.localPoints()), rhoInf_(1.0) {} @@ -70,13 +70,13 @@ uncoupledSixDoFRigidBodyDisplacementPointPatchVectorField updateCoeffs(); } - if (dict.found("p0")) + if (dict.found("initialPoints")) { - p0_ = vectorField("p0", dict , p.size()); + initialPoints_ = vectorField("initialPoints", dict , p.size()); } else { - p0_ = p.localPoints(); + initialPoints_ = p.localPoints(); } } @@ -92,7 +92,7 @@ uncoupledSixDoFRigidBodyDisplacementPointPatchVectorField : fixedValuePointPatchField(ptf, p, iF, mapper), motion_(ptf.motion_), - p0_(ptf.p0_, mapper), + initialPoints_(ptf.initialPoints_, mapper), rhoInf_(ptf.rhoInf_) {} @@ -106,13 +106,42 @@ uncoupledSixDoFRigidBodyDisplacementPointPatchVectorField : fixedValuePointPatchField(ptf, iF), motion_(ptf.motion_), - p0_(ptf.p0_), + initialPoints_(ptf.initialPoints_), rhoInf_(ptf.rhoInf_) {} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // +void uncoupledSixDoFRigidBodyDisplacementPointPatchVectorField::autoMap +( + const pointPatchFieldMapper& m +) +{ + fixedValuePointPatchField::autoMap(m); + + initialPoints_.autoMap(m); +} + + +void uncoupledSixDoFRigidBodyDisplacementPointPatchVectorField::rmap +( + const pointPatchField& ptf, + const labelList& addr +) +{ + const uncoupledSixDoFRigidBodyDisplacementPointPatchVectorField& uSDoFptf = + refCast + < + const uncoupledSixDoFRigidBodyDisplacementPointPatchVectorField + >(ptf); + + fixedValuePointPatchField::rmap(uSDoFptf, addr); + + initialPoints_.rmap(uSDoFptf.initialPoints_, addr); +} + + void uncoupledSixDoFRigidBodyDisplacementPointPatchVectorField::updateCoeffs() { if (this->updated()) @@ -138,7 +167,10 @@ void uncoupledSixDoFRigidBodyDisplacementPointPatchVectorField::updateCoeffs() // Do not modify the accelerations, except with gravity, where available motion_.updateForce(gravity*motion_.mass(), vector::zero, t.deltaTValue()); - Field::operator=(motion_.currentPosition(p0_) - p0_); + Field::operator= + ( + motion_.currentPosition(initialPoints_) - initialPoints_ + ); fixedValuePointPatchField::updateCoeffs(); } @@ -153,7 +185,7 @@ void uncoupledSixDoFRigidBodyDisplacementPointPatchVectorField::write motion_.write(os); os.writeKeyword("rhoInf") << rhoInf_ << token::END_STATEMENT << nl; - p0_.writeEntry("p0", os); + initialPoints_.writeEntry("initialPoints", os); writeEntry("value", os); } diff --git a/src/postProcessing/functionObjects/forces/pointPatchFields/derived/uncoupledSixDoFRigidBodyDisplacement/uncoupledSixDoFRigidBodyDisplacementPointPatchVectorField.H b/src/postProcessing/functionObjects/forces/pointPatchFields/derived/uncoupledSixDoFRigidBodyDisplacement/uncoupledSixDoFRigidBodyDisplacementPointPatchVectorField.H index fb4177d104..a250601f3e 100644 --- a/src/postProcessing/functionObjects/forces/pointPatchFields/derived/uncoupledSixDoFRigidBodyDisplacement/uncoupledSixDoFRigidBodyDisplacementPointPatchVectorField.H +++ b/src/postProcessing/functionObjects/forces/pointPatchFields/derived/uncoupledSixDoFRigidBodyDisplacement/uncoupledSixDoFRigidBodyDisplacementPointPatchVectorField.H @@ -57,8 +57,8 @@ class uncoupledSixDoFRigidBodyDisplacementPointPatchVectorField //- Six dof motion object sixDoFRigidBodyMotion motion_; - //- Reference positions of points on the patch - pointField p0_; + //- Initial positions of points on the patch + pointField initialPoints_; //- Reference density required by the forces object for // incompressible calculations. Retained here to give @@ -136,6 +136,22 @@ public: // Member functions + // Mapping functions + + //- Map (and resize as needed) from self given a mapping object + virtual void autoMap + ( + const pointPatchFieldMapper& + ); + + //- Reverse map the given pointPatchField onto this pointPatchField + virtual void rmap + ( + const pointPatchField&, + const labelList& + ); + + // Evaluation functions //- Update the coefficients associated with the patch field