Skip to content
Snippets Groups Projects
Commit 997bd2f4 authored by Oliver Sander's avatar Oliver Sander Committed by sander@PCPOOL.MI.FU-BERLIN.DE
Browse files

getResultantForce for a given BoundaryPatch

[[Imported from SVN: r1471]]
parent d32786b9
No related branches found
No related tags found
No related merge requests found
...@@ -166,7 +166,7 @@ getLocalMatrix( EntityPointer &entity, ...@@ -166,7 +166,7 @@ getLocalMatrix( EntityPointer &entity,
Quaternion<double> q = Quaternion<double>::interpolate(localSolution[0].q, localSolution[1].q,quadPos[0]); Quaternion<double> q = Quaternion<double>::interpolate(localSolution[0].q, localSolution[1].q,quadPos[0]);
// Contains \partial q / \partial v^i_j at v = 0 // Contains \partial q / \partial v^i_j at v = 0
FixedArray<Quaternion<double>,3> dq_dvj; array<Quaternion<double>,3> dq_dvj;
Quaternion<double> dq_dvij_ds[2][3]; Quaternion<double> dq_dvij_ds[2][3];
for (int i=0; i<2; i++) for (int i=0; i<2; i++)
for (int j=0; j<3; j++) { for (int j=0; j<3; j++) {
...@@ -207,7 +207,7 @@ getLocalMatrix( EntityPointer &entity, ...@@ -207,7 +207,7 @@ getLocalMatrix( EntityPointer &entity,
} }
// Contains \parder d \parder v^i_j // Contains \parder d \parder v^i_j
FixedArray<FixedArray<FieldVector<double,3>, 3>, 3> dd_dvj; array<array<FieldVector<double,3>, 3>, 3> dd_dvj;
q.getFirstDerivativesOfDirectors(dd_dvj); q.getFirstDerivativesOfDirectors(dd_dvj);
// Contains \parder {dm}{v^i_j}{v^k_l} // Contains \parder {dm}{v^i_j}{v^k_l}
...@@ -454,9 +454,9 @@ assembleGradient(const std::vector<Configuration>& sol, ...@@ -454,9 +454,9 @@ assembleGradient(const std::vector<Configuration>& sol,
FieldVector<double,blocksize> referenceStrain = getStrain(referenceConfiguration_, it, quadPos); FieldVector<double,blocksize> referenceStrain = getStrain(referenceConfiguration_, it, quadPos);
// Contains \partial q / \partial v^i_j at v = 0 // Contains \partial q / \partial v^i_j at v = 0
FixedArray<Quaternion<double>,3> dq_dvj; array<Quaternion<double>,3> dq_dvj;
FixedArray<Quaternion<double>,3> dq_dvj_ds; array<Quaternion<double>,3> dq_dvj_ds;
for (int j=0; j<3; j++) { for (int j=0; j<3; j++) {
...@@ -470,7 +470,7 @@ assembleGradient(const std::vector<Configuration>& sol, ...@@ -470,7 +470,7 @@ assembleGradient(const std::vector<Configuration>& sol,
} }
// dd_dvij[k][i][j] = \parder {d_k} {v^i_j} // dd_dvij[k][i][j] = \parder {d_k} {v^i_j}
FixedArray<FixedArray<FieldVector<double,3>, 3>, 3> dd_dvj; array<array<FieldVector<double,3>, 3>, 3> dd_dvj;
hatq.getFirstDerivativesOfDirectors(dd_dvj); hatq.getFirstDerivativesOfDirectors(dd_dvj);
...@@ -781,39 +781,68 @@ Dune::FieldVector<double, 6> Dune::RodAssembler<GridType>::getStrain(const std:: ...@@ -781,39 +781,68 @@ Dune::FieldVector<double, 6> Dune::RodAssembler<GridType>::getStrain(const std::
template <class GridType> template <class GridType>
Dune::FieldVector<double,3> Dune::RodAssembler<GridType>:: Dune::FieldVector<double,3> Dune::RodAssembler<GridType>::
getResultantForce(const std::vector<Configuration>& sol) const getResultantForce(const BoundaryPatch<GridType>& boundary,
const std::vector<Configuration>& sol) const
{ {
const typename GridType::Traits::LeafIndexSet& indexSet = grid_->leafIndexSet(); const typename GridType::Traits::LeafIndexSet& indexSet = grid_->leafIndexSet();
if (sol.size()!=indexSet.size(gridDim)) if (sol.size()!=indexSet.size(gridDim))
DUNE_THROW(Exception, "Solution vector doesn't match the grid!"); DUNE_THROW(Exception, "Solution vector doesn't match the grid!");
// HARDWIRED: the leftmost point on the grid FieldVector<double,3> canonicalStress(0);
EntityPointer leftElement = grid_->template leafbegin<0>();
assert(leftElement->ileafbegin().boundary()); // Loop over the given boundary
ElementLeafIterator eIt = grid_->template leafbegin<0>();
ElementLeafIterator eEndIt = grid_->template leafend<0>();
double pos = 0; for (; eIt!=eEndIt; ++eIt) {
FieldVector<double, blocksize> strain = getStrain(sol, leftElement, pos); typename EntityType::LeafIntersectionIterator nIt = eIt->ileafbegin();
FieldVector<double, blocksize> referenceStrain = getStrain(referenceConfiguration_, leftElement, pos); typename EntityType::LeafIntersectionIterator nEndIt = eIt->ileafend();
FieldVector<double,3> localStress; for (; nIt!=nEndIt; ++nIt) {
for (int i=0; i<3; i++)
localStress[i] = (strain[i] - referenceStrain[i]) * A_[i];
// Transform stress given with respect to the basis given by the three directors to if (!boundary.contains(*eIt, nIt.numberInSelf()))
// the canonical basis of R^3 continue;
/** \todo Hardwired: Entry 0 is the leftmost entry! */
FieldMatrix<double,3,3> orientationMatrix;
sol[0].q.matrix(orientationMatrix);
FieldVector<double,3> canonicalStress(0); // //////////////////////////////////////////////
orientationMatrix.umv(localStress, canonicalStress); // Compute force across this boundary face
// //////////////////////////////////////////////
double pos = nIt.intersectionSelfLocal()[0];
FieldVector<double, blocksize> strain = getStrain(sol, eIt, pos);
FieldVector<double, blocksize> referenceStrain = getStrain(referenceConfiguration_, eIt, pos);
FieldVector<double,3> localStress;
for (int i=0; i<3; i++)
localStress[i] = (strain[i] - referenceStrain[i]) * A_[i];
// Transform stress given with respect to the basis given by the three directors to
// the canonical basis of R^3
/** \todo Hardwired: Entry 0 is the leftmost entry! */
FieldMatrix<double,3,3> orientationMatrix;
sol[0].q.matrix(orientationMatrix);
orientationMatrix.umv(localStress, canonicalStress);
// Reverse transformation to make sure we did the correct thing
// assert( std::abs(localStress[0]-canonicalStress*sol[0].q.director(0)) < 1e-6 );
// assert( std::abs(localStress[1]-canonicalStress*sol[0].q.director(1)) < 1e-6 );
// assert( std::abs(localStress[2]-canonicalStress*sol[0].q.director(2)) < 1e-6 );
}
// Reverse transformation to make sure we did the correct thing }
assert( std::abs(localStress[0]-canonicalStress*sol[0].q.director(0)) < 1e-6 );
assert( std::abs(localStress[1]-canonicalStress*sol[0].q.director(1)) < 1e-6 );
assert( std::abs(localStress[2]-canonicalStress*sol[0].q.director(2)) < 1e-6 );
return canonicalStress; return canonicalStress;
} }
template <class GridType>
Dune::FieldVector<double,3> Dune::RodAssembler<GridType>::
getResultantTorque(const BoundaryPatch<GridType>& boundary,
const std::vector<Configuration>& sol) const
{
#warning getResultantForce non implemented yet!
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment