Commit 4e5cba89 authored by Tomáš Oberhuber's avatar Tomáš Oberhuber
Browse files

Debugging the grid geometries.

parent 72e8f44a
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@
#include <schemes/euler/fvm/tnlLaxFridrichs.h>
#include <schemes/gradient/tnlCentralFDMGradient.h>
#include <schemes/diffusion/tnlLinearDiffusion.h>
#include <mesh/tnlLinearGridGeometry.h>

template< typename Mesh,
          typename EulerScheme >
@@ -58,6 +59,11 @@ class navierStokesSolver
   void writeProlog( tnlLogger& logger,
                     const tnlParameterContainer& parameters ) const;

   template< typename Geom >
   bool setMeshGeometry( Geom& geometry ) const;

   bool setMeshGeometry( tnlLinearGridGeometry< 2, RealType, DeviceType, IndexType >& geometry ) const;

   bool init( const tnlParameterContainer& parameters );

   bool setInitialCondition( const tnlParameterContainer& parameters );
+20 −0
Original line number Diff line number Diff line
@@ -62,6 +62,24 @@ navierStokesSolver< Mesh, EulerScheme > :: navierStokesSolver()
   this -> dofVector. setName( "navier-stokes-dof-vector" );
}

template< typename Mesh, typename EulerScheme >
   template< typename Geom >
bool navierStokesSolver< Mesh, EulerScheme > :: setMeshGeometry( Geom& geometry ) const
{
   return true;
}

template< typename Mesh, typename EulerScheme >
bool navierStokesSolver< Mesh, EulerScheme > :: setMeshGeometry( tnlLinearGridGeometry< 2, RealType, DeviceType, IndexType >& geometry ) const
{
   geometry. setNumberOfSegments( 3 );
   geometry. setSegmentData( 0, 0.0,  0.0,  1.0 );
   geometry. setSegmentData( 1, 0.5,  0.15, 0.85 );
   geometry. setSegmentData( 2, 1.0,  0.0,  1.0 );
   return true;
}


template< typename Mesh, typename EulerScheme >
bool navierStokesSolver< Mesh, EulerScheme > :: init( const tnlParameterContainer& parameters )
{
@@ -112,8 +130,10 @@ bool navierStokesSolver< Mesh, EulerScheme > :: init( const tnlParameterContaine
      return false;
   }
   this -> mesh. setDimensions( meshes. x(), meshes. y() );
   this -> setMeshGeometry( this -> mesh. getGeometry() );
   RealType hx = this -> mesh. getParametricStep(). x();
   RealType hy = this -> mesh. getParametricStep(). y();
   mesh. refresh();
   mesh. save( tnlString( "mesh.tnl" ) );

   /****
+11 −8
Original line number Diff line number Diff line
@@ -308,7 +308,7 @@ bool tnlArray< Element, Device, Index > :: save( tnlFile& file ) const
   if( ! file. write( &this -> size ) )
      return false;
#endif      
   if( ! file. write< Element, Device, Index >( this -> data, this -> size ) )
   if( this -> size != 0 && ! file. write< Element, Device, Index >( this -> data, this -> size ) )
   {
      cerr << "I was not able to WRITE tnlArray " << this -> getName()
           << " with size " << this -> getSize() << endl;
@@ -332,11 +332,13 @@ bool tnlArray< Element, Device, Index > :: load( tnlFile& file )
   if( ! file. read( &_size, 1 ) )
      return false;
#endif      
   if( _size <= 0 )
   if( _size < 0 )
   {
      cerr << "Error: The size " << _size << " of the file is not a positive number." << endl;
      cerr << "Error: The size " << _size << " of the file is not a positive number or zero." << endl;
      return false;
   }
   if( _size )
   {
      setSize( _size );
      if( ! file. read< Element, Device, Index >( this -> data, this -> size ) )
      {
@@ -344,6 +346,7 @@ bool tnlArray< Element, Device, Index > :: load( tnlFile& file )
              << " with size " << this -> getSize() << endl;
         return false;
      }
   }
   return true;
}

+266 −64

File changed.

Preview size limit exceeded, changes collapsed.

+32 −2

File changed.

Preview size limit exceeded, changes collapsed.

Loading