diff --git a/examples/heat-equation/heatEquationSolver.h b/examples/heat-equation/heatEquationSolver.h index f388be485afd359d9c07e5a8b80967eaee84b6b2..fa7b5a604c78b30e8f9c7a580114e0b53fe9e208 100644 --- a/examples/heat-equation/heatEquationSolver.h +++ b/examples/heat-equation/heatEquationSolver.h @@ -80,10 +80,7 @@ class heatEquationSolver protected: - /*tnlSharedVector< RealType, DeviceType, IndexType > numericalSolution, - exactSolution, - analyticLaplace, - numericalLaplace;*/ + tnlSharedVector< RealType, DeviceType, IndexType > solution; tnlExplicitUpdater< Mesh, DofVectorType, DifferentialOperator, BoundaryCondition, RightHandSide > explicitUpdater; diff --git a/examples/heat-equation/heatEquationSolver_impl.h b/examples/heat-equation/heatEquationSolver_impl.h index 1b098edfc8b3784077e101b3ca7c9af4357cba41..31c0234d1b5ad1ae70940c3578d4a0c6c4b42efd 100644 --- a/examples/heat-equation/heatEquationSolver_impl.h +++ b/examples/heat-equation/heatEquationSolver_impl.h @@ -90,7 +90,7 @@ bindDofs( const MeshType& mesh, DofVectorType& dofVector ) { const IndexType dofs = mesh.getNumberOfCells(); - this->numericalSolution.bind( dofVector.getData(), dofs ); + this->solution.bind( dofVector.getData(), dofs ); } template< typename Mesh, @@ -111,7 +111,7 @@ bool heatEquationSolver< Mesh,Diffusion,BoundaryCondition,RightHandSide > const MeshType& mesh ) { 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; return false; @@ -135,7 +135,7 @@ makeSnapshot( const RealType& time, tnlString fileName; FileNameBaseNumberEnding( "u-", step, 5, ".tnl", fileName ); - if( ! this->numericalSolution.save( fileName ) ) + if( ! this->solution.save( fileName ) ) return false; return true; } @@ -161,8 +161,8 @@ void heatEquationSolver< Mesh,Diffusion,BoundaryCondition,RightHandSide > explicitUpdater.template update< Mesh::Dimensions >( time, tau, mesh, + this->differentialOperator, this->boundaryCondition, - this->operator, this->rightHandSide, _u, _fu ); diff --git a/examples/heat-equation/tnlHeatEquationEocRhs.h b/examples/heat-equation/tnlHeatEquationEocRhs.h index c118e1df24a5d6df6d191583be91027500214edc..d76ce11cecc4754b09b882bdd5bd2e95f3261d72 100644 --- a/examples/heat-equation/tnlHeatEquationEocRhs.h +++ b/examples/heat-equation/tnlHeatEquationEocRhs.h @@ -34,10 +34,10 @@ class tnlHeatEquationEocRhs return true; }; - template< typename Real, - typename Vertex > - Real getValue( const Real& time, - const Vertex& vertex ) + template< typename Vertex, + typename Real > + Real getValue( const Vertex& vertex, + const Real& time ) { return testFunction.getTimeDerivative( vertex, time ) - exactOperator.getValue( testFunction, vertex, time ); }; diff --git a/src/solvers/pde/tnlExplicitUpdater.h b/src/solvers/pde/tnlExplicitUpdater.h index 5abb031b8f4e71a1ff131f4385040f0c93ae633a..c156a702d4443ffd80ea05c4a7f9f69a1802cb60 100644 --- a/src/solvers/pde/tnlExplicitUpdater.h +++ b/src/solvers/pde/tnlExplicitUpdater.h @@ -27,39 +27,6 @@ class tnlExplicitUpdaterTraversalUserData { 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, τ DifferentialOperator& differentialOperator; @@ -143,7 +110,7 @@ class tnlExplicitUpdater { public: - template< int EntityDimension > + template< int EntityDimensions > void processEntity( const MeshType& mesh, TraversalUserData& userData, const IndexType index ) @@ -154,8 +121,8 @@ class tnlExplicitUpdater index, userData.u, userData.fu ); - userData.fu += rightHandSide.getValue( mesh.getEntityCenter< EntityDimensions >( index ), - time ); + userData.fu[ index ] += userData.rightHandSide.getValue( mesh.getEntityCenter< EntityDimensions >( index ), + userData.time ); } }; @@ -203,6 +170,10 @@ class tnlExplicitUpdater< tnlGrid< Dimensions, Real, Device, Index >, { public: + /**** + * TODO: This must be specialized for entities with different dimensions + * otherwise 'coordinates' would not make sense without knowing the orientation. + */ template< int EntityDimension > void processEntity( const MeshType& mesh, TraversalUserData& userData, @@ -238,8 +209,8 @@ class tnlExplicitUpdater< tnlGrid< Dimensions, Real, Device, Index >, userData.u, userData.fu ); - userData.fu += rightHandSide.getValue( mesh.getEntityCenter< EntityDimensions >( coordinates ), - time ); + userData.fu[ index ] += userData.rightHandSide.getValue( mesh.getCellCenter( coordinates ), + userData.time ); } };