Skip to content
Snippets Groups Projects
Commit eb29b04a authored by Tomáš Oberhuber's avatar Tomáš Oberhuber
Browse files

Fixing the heat equation EOC test.

parent dd951870
No related branches found
No related tags found
No related merge requests found
...@@ -80,10 +80,7 @@ class heatEquationSolver ...@@ -80,10 +80,7 @@ class heatEquationSolver
protected: protected:
/*tnlSharedVector< RealType, DeviceType, IndexType > numericalSolution, tnlSharedVector< RealType, DeviceType, IndexType > solution;
exactSolution,
analyticLaplace,
numericalLaplace;*/
tnlExplicitUpdater< Mesh, DofVectorType, DifferentialOperator, BoundaryCondition, RightHandSide > explicitUpdater; tnlExplicitUpdater< Mesh, DofVectorType, DifferentialOperator, BoundaryCondition, RightHandSide > explicitUpdater;
......
...@@ -90,7 +90,7 @@ bindDofs( const MeshType& mesh, ...@@ -90,7 +90,7 @@ bindDofs( const MeshType& mesh,
DofVectorType& dofVector ) DofVectorType& dofVector )
{ {
const IndexType dofs = mesh.getNumberOfCells(); const IndexType dofs = mesh.getNumberOfCells();
this->numericalSolution.bind( dofVector.getData(), dofs ); this->solution.bind( dofVector.getData(), dofs );
} }
template< typename Mesh, template< typename Mesh,
...@@ -111,7 +111,7 @@ bool heatEquationSolver< Mesh,Diffusion,BoundaryCondition,RightHandSide > ...@@ -111,7 +111,7 @@ bool heatEquationSolver< Mesh,Diffusion,BoundaryCondition,RightHandSide >
const MeshType& mesh ) const MeshType& mesh )
{ {
const tnlString& initialConditionFile = parameters.GetParameter< tnlString >( "initial-condition" ); const tnlString& initialConditionFile = parameters.GetParameter< tnlString >( "initial-condition" );
if( ! this->numericalSolution.load( initialConditionFile ) ) if( ! this->solution.load( initialConditionFile ) )
{ {
cerr << "I am not able to load the initial condition from the file " << initialConditionFile << "." << endl; cerr << "I am not able to load the initial condition from the file " << initialConditionFile << "." << endl;
return false; return false;
...@@ -135,7 +135,7 @@ makeSnapshot( const RealType& time, ...@@ -135,7 +135,7 @@ makeSnapshot( const RealType& time,
tnlString fileName; tnlString fileName;
FileNameBaseNumberEnding( "u-", step, 5, ".tnl", fileName ); FileNameBaseNumberEnding( "u-", step, 5, ".tnl", fileName );
if( ! this->numericalSolution.save( fileName ) ) if( ! this->solution.save( fileName ) )
return false; return false;
return true; return true;
} }
...@@ -161,8 +161,8 @@ void heatEquationSolver< Mesh,Diffusion,BoundaryCondition,RightHandSide > ...@@ -161,8 +161,8 @@ void heatEquationSolver< Mesh,Diffusion,BoundaryCondition,RightHandSide >
explicitUpdater.template update< Mesh::Dimensions >( time, explicitUpdater.template update< Mesh::Dimensions >( time,
tau, tau,
mesh, mesh,
this->differentialOperator,
this->boundaryCondition, this->boundaryCondition,
this->operator,
this->rightHandSide, this->rightHandSide,
_u, _u,
_fu ); _fu );
......
...@@ -34,10 +34,10 @@ class tnlHeatEquationEocRhs ...@@ -34,10 +34,10 @@ class tnlHeatEquationEocRhs
return true; return true;
}; };
template< typename Real, template< typename Vertex,
typename Vertex > typename Real >
Real getValue( const Real& time, Real getValue( const Vertex& vertex,
const Vertex& vertex ) const Real& time )
{ {
return testFunction.getTimeDerivative( vertex, time ) - exactOperator.getValue( testFunction, vertex, time ); return testFunction.getTimeDerivative( vertex, time ) - exactOperator.getValue( testFunction, vertex, time );
}; };
......
...@@ -27,39 +27,6 @@ class tnlExplicitUpdaterTraversalUserData ...@@ -27,39 +27,6 @@ class tnlExplicitUpdaterTraversalUserData
{ {
public: public:
template< typename DifferentialOperator,
typename RightHandSide >
class tnlInteriorUpdater
{
public:
tnlInteriorUpdater( DifferentialOperator& differentialOperator,
RightHandSide& rightHandSide )
: differentialOperator( differentialOperator ),
rightHandSide( rightHandSide )
{
}
template< typename Mesh,
typename Index,
typename Coordinates,
typename DofVector >
void explicitUpdate( const Real& time,
const Real& tau,
const Mesh& mesh,
const Index index,
const Coordinates& coordinates,
DofVector& u,
DofVector& fu )
{
;
}
DifferentialOperator& differentialOperator;
RightHandSide& rightHandSide;
};
const Real &time, &tau; const Real &time, &tau;
DifferentialOperator& differentialOperator; DifferentialOperator& differentialOperator;
...@@ -143,7 +110,7 @@ class tnlExplicitUpdater ...@@ -143,7 +110,7 @@ class tnlExplicitUpdater
{ {
public: public:
template< int EntityDimension > template< int EntityDimensions >
void processEntity( const MeshType& mesh, void processEntity( const MeshType& mesh,
TraversalUserData& userData, TraversalUserData& userData,
const IndexType index ) const IndexType index )
...@@ -154,8 +121,8 @@ class tnlExplicitUpdater ...@@ -154,8 +121,8 @@ class tnlExplicitUpdater
index, index,
userData.u, userData.u,
userData.fu ); userData.fu );
userData.fu += rightHandSide.getValue( mesh.getEntityCenter< EntityDimensions >( index ), userData.fu[ index ] += userData.rightHandSide.getValue( mesh.getEntityCenter< EntityDimensions >( index ),
time ); userData.time );
} }
}; };
...@@ -203,6 +170,10 @@ class tnlExplicitUpdater< tnlGrid< Dimensions, Real, Device, Index >, ...@@ -203,6 +170,10 @@ class tnlExplicitUpdater< tnlGrid< Dimensions, Real, Device, Index >,
{ {
public: public:
/****
* TODO: This must be specialized for entities with different dimensions
* otherwise 'coordinates' would not make sense without knowing the orientation.
*/
template< int EntityDimension > template< int EntityDimension >
void processEntity( const MeshType& mesh, void processEntity( const MeshType& mesh,
TraversalUserData& userData, TraversalUserData& userData,
...@@ -238,8 +209,8 @@ class tnlExplicitUpdater< tnlGrid< Dimensions, Real, Device, Index >, ...@@ -238,8 +209,8 @@ class tnlExplicitUpdater< tnlGrid< Dimensions, Real, Device, Index >,
userData.u, userData.u,
userData.fu ); userData.fu );
userData.fu += rightHandSide.getValue( mesh.getEntityCenter< EntityDimensions >( coordinates ), userData.fu[ index ] += userData.rightHandSide.getValue( mesh.getCellCenter( coordinates ),
time ); userData.time );
} }
}; };
......
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