Commit 28e7135b authored by Ondrej Szekely's avatar Ondrej Szekely
Browse files

ADDING NEW FUNCTIONS

parent 89e3727f
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -28,7 +28,7 @@
#include <problems/tnlMeanCurvatureFlowEocProblem.h>
#include <operators/diffusion/tnlExactNonlinearDiffusion.h>
#include <operators/diffusion/tnlNonlinearDiffusion.h>
#include <operators/operator-Q/tnlOneSideDiffOperatorQForGraph.h>
#include <operators/operator-Q/tnlOneSideDiffOperatorQ.h>
#include <operators/diffusion/tnlExactNonlinearDiffusion.h>
#include <operators/diffusion/nonlinear-diffusion-operators/tnlOneSideDiffNonlinearOperator.h>
#include <operators/operator-Q/tnlExactOperatorQ.h>
@@ -43,6 +43,7 @@ class meanCurvatureFlowEocConfig
      static void configSetup( tnlConfigDescription& config )
      {
         config.addDelimiter( "Mean Curvature Flow EOC settings:" );
         config.addEntry< double >( "eps", "This sets a eps in operator Q.", 1.0 );
         config.addDelimiter( "Tests setting::" );
         tnlTestFunction< 2, double >::configSetup( config );
      }
+4 −2
Original line number Diff line number Diff line
@@ -29,7 +29,7 @@
#include <functions/tnlConstantFunction.h>
#include <problems/tnlMeanCurvatureFlowProblem.h>
#include <operators/diffusion/tnlNonlinearDiffusion.h>
#include <operators/operator-Q/tnlOneSideDiffOperatorQForGraph.h>
#include <operators/operator-Q/tnlOneSideDiffOperatorQ.h>
#include <operators/diffusion/nonlinear-diffusion-operators/tnlOneSideDiffNonlinearOperator.h>

//typedef tnlDefaultConfigTag BuildConfig;
@@ -49,6 +49,8 @@ class meanCurvatureFlowConfig
         config.addEntry< tnlString >( "boundary-conditions-file", "File with the values of the boundary conditions.", "boundary.tnl" );
         config.addEntry< double >( "boundary-conditions-constant", "This sets a value in case of the constant boundary conditions." );
         config.addEntry< tnlString >( "initial-condition", "File with the initial condition.", "initial.tnl");
	 config.addEntry< double >( "right-hand-side-constant", "This sets a value in case of the constant right hand side.", 0.0 );
	 config.addEntry< double >( "eps", "This sets a eps in operator Q.", 1.0 );
      };
};

@@ -71,7 +73,7 @@ class meanCurvatureFlowSetter
   static bool run( const tnlParameterContainer& parameters )
   {
      enum { Dimensions = MeshType::Dimensions };
      typedef tnlOneSideDiffOperatorQForGraph<MeshType, Real, Index, 0> OperatorQ;
      typedef tnlOneSideDiffOperatorQ<MeshType, Real, Index, 0> OperatorQ;
      typedef tnlOneSideDiffNonlinearOperator<MeshType, OperatorQ, Real, Index > NonlinearOperator;
      typedef tnlNonlinearDiffusion< MeshType, NonlinearOperator, Real, Index > ApproximateOperator;
      typedef tnlConstantFunction< Dimensions, Real > RightHandSide;
+184 −0
Original line number Diff line number Diff line
#!/bin/bash

device="host"
sizes="16"
initFunctions="sin-bumps"
snapshotPeriod=0.001
finalTime=0.15
solverName="mean-curvature-flow"
boundaryCondition="neumann"
boundaryValue=0
minZ=-1
maxZ=1
contourHeight=0.3

spaceStep=$(expr 1/($sizes-2) | bc | sed 's/^\./0./')

setupInitFunction()
{
   initFunction=$1
      origin=0
      proportions=1
      amplitude=1.0
      waveLength=1.0
      waveLengthX=1.0
      waveLengthY=1.0
      waveLengthZ=1.0
      wavesNumber=0.0
      wavesNumberX=0.0
      wavesNumberY=0.0
      wavesNumberZ=0.0
      phase=0.0
      phaseX=0.0
      phaseY=0.0
      phaseZ=0.0
      sigma=1
}

setupGrid()
{
   gridSize=$1
   tnl-grid-setup --dimensions 2 \
                  --origin-x ${origin} \
                  --origin-y ${origin} \
                  --origin-z ${origin} \
                  --proportions-x ${proportions} \
                  --proportions-y ${proportions} \
                  --proportions-z ${proportions} \
                  --size-x ${gridSize} \
                  --size-y ${gridSize} \
                  --size-z ${gridSize} 
}

setInitialCondition()
{
   initFunction=$1
   tnl-init --test-function ${initFunction} \
	    --output-file initial.tnl \
            --amplitude ${amplitude} \
            --wave-length ${waveLength} \
            --wave-length-x ${waveLengthX} \
            --wave-length-y ${waveLengthY} \
            --wave-length-z ${waveLengthZ} \
            --waves-number ${wavesNumber} \
            --waves-number-x ${wavesNumberX} \
            --waves-number-y ${wavesNumberY} \
            --waves-number-z ${wavesNumberZ} \
            --phase ${phase} \
            --phase-x ${phaseX} \
            --phase-y ${phaseY} \
            --phase-z ${phaseZ} \
            --sigma ${sigma} \
            --time-dependence none
}

solve()
{
   timeDiscretisation=$1
   discreteSolver=$2
   ${solverName} --device ${device} \
                 --mesh mesh.tnl \
                 --initial-condition initial.tnl \
		--snapshot-period ${snapshotPeriod} \
                 --time-discretisation ${timeDiscretisation} \
                 --time-step 1 \
                 --time-step-order 2 \
                 --discrete-solver ${discreteSolver} \
                 --merson-adaptivity 1.0e-7 \
                 --sor-omega 1.95 \
                 --gmres-restarting 20 \
                 --min-iterations 20 \
                 --convergence-residue 1.0e-12 \
		 --boundary-conditions-type ${boundaryCondition} \
		 --boundary-conditions-constant ${boundaryValue} \
		 --final-time ${finalTime}
}

view()
{
   tnl-view --input-files u-*.tnl
   tnl-view --input-files initial.tnl
}

generate3DVid()
{
seznam=`ls u-*.gplt`
step=0
for fname in $seznam ; do
step=$((${step}+1))
time=$(expr $step*$snapshotPeriod | bc | sed 's/^\./0./')
echo "Drawing contour $fname"
gnuplot << EOF
set output '${fname}.png'
set xrange [${1}:${proportions}]
set yrange [${1}:${proportions}]
set zrange [${minZ}:${maxZ}]    
unset surface
set terminal png size 1200,600
set view map
set title 'Numerical solution - contour in height ${contourHeight} - T: ${time}'
set pm3d interpolate 100,100
set size square
set contour base
unset colorbox
set cntrparam levels discrete ${contourHeight}
splot '$fname' with pm3d notitle
EOF
done

mencoder "mf://u-*.png" -mf fps=4 -o mean_curvature_contour_${contourHeight}_$size.avi -ovc lavc -lavcopts vcodec=mpeg4

rm *.png
rm *.tnl         
rm *.gplt 
rm mesh.asy
rm computation-done
     
}

runTest()
{
   for initFunction in ${initFunctions};
   do
      cd ${initFunction}-videos
      setupInitFunction ${initFunction}
         
      for size in $sizes;
      do
          cd $size
          echo ""
          echo ""
          echo ""
          if test ! -f computation-done;
          then
             touch computation-in-progress
             echo "========================================================================="
             echo "===                   SETTING UP THE GRID                             ==="
             echo "========================================================================="
             setupGrid $size 
             echo "========================================================================="
             echo "===                WRITING THE EXACT SOLUTION                         ==="
             echo "========================================================================="
             setInitialCondition $initFunction
             echo "========================================================================="
             echo "===                   STARTING THE SOLVER                             ==="
             echo "========================================================================="
             solve explicit merson
             #solve semi-implicit gmres
             mv computation-in-progress computation-done
             echo "========================================================================="
             echo "===                     COMPUTATION DONE                              ==="            
             echo "========================================================================="
	     view
	     generate3DVid $origin $proportions
             cd ..
             lastSize=$size
          fi
         cd ..
      done
      cd ..
   done
}

runTest
 
+247 −0
Original line number Diff line number Diff line
#!/bin/bash

device="host"
sizes="64"
initFunctions="pseudoSquare"
snapshotPeriod=0.001
finalTime=0.1
solverName="mean-curvature-flow"
boundaryCondition="neumann"
boundaryValue=0
minZ=-3
maxZ=6
contourHeight=0
numberOfContours=8
numberOfInterpolations=10
eps=0.00001

setupInitFunction()
{
   initFunction=$1
      origin=-2
      proportions=4
      amplitude=1.0
      waveLength=1.0
      waveLengthX=1.0
      waveLengthY=1.0
      waveLengthZ=1.0
      wavesNumber=0.0
      wavesNumberX=0.0
      wavesNumberY=0.0
      wavesNumberZ=0.0
      phase=0.0
      phaseX=0.0
      phaseY=0.0
      phaseZ=0.0
      sigma=1.0
      diameter=0.6
      height=1.2
}

setupGrid()
{
   gridSize=$1
   tnl-grid-setup --dimensions 2 \
                  --origin-x ${origin} \
                  --origin-y ${origin} \
                  --origin-z ${origin} \
                  --proportions-x ${proportions} \
                  --proportions-y ${proportions} \
                  --proportions-z ${proportions} \
                  --size-x ${gridSize} \
                  --size-y ${gridSize} \
                  --size-z ${gridSize} 
}

setInitialCondition()
{
   initFunction=$1
   tnl-init --test-function ${initFunction} \
	    --output-file initial.tnl \
            --amplitude ${amplitude} \
            --wave-length ${waveLength} \
            --wave-length-x ${waveLengthX} \
            --wave-length-y ${waveLengthY} \
            --wave-length-z ${waveLengthZ} \
            --waves-number ${wavesNumber} \
            --waves-number-x ${wavesNumberX} \
            --waves-number-y ${wavesNumberY} \
            --waves-number-z ${wavesNumberZ} \
            --phase ${phase} \
            --phase-x ${phaseX} \
            --phase-y ${phaseY} \
            --phase-z ${phaseZ} \
            --sigma ${sigma} \
	    --diameter ${diameter} \
	    --height ${height} \
            --time-dependence none
}

solve()
{
   timeDiscretisation=$1
   discreteSolver=$2
   ${solverName} --device ${device} \
                 --mesh mesh.tnl \
                 --initial-condition initial.tnl \
		--snapshot-period ${snapshotPeriod} \
                 --time-discretisation ${timeDiscretisation} \
                 --time-step 1 \
                 --time-step-order 2 \
                 --discrete-solver ${discreteSolver} \
                 --merson-adaptivity 1.0e-7 \
                 --sor-omega 1.95 \
                 --gmres-restarting 20 \
                 --min-iterations 20 \
                 --convergence-residue 1.0e-12 \
		 --boundary-conditions-type ${boundaryCondition} \
		 --boundary-conditions-constant ${boundaryValue} \
		 --eps ${eps} \
		 --final-time ${finalTime}
}

view()
{
   tnl-view --input-files u-*.tnl
   tnl-view --input-files initial.tnl
}

generate3DVid()
{
domainEnd=$( expr ${origin}+${proportions} | bc | sed 's/^\./0./' | sed 's/^-\./-0./' )

seznam=`ls u-*.gplt`
step=0
for fname in $seznam ; do
time=$(expr $step*$snapshotPeriod | bc | sed 's/^\./0./')
echo "Drawing $fname"
gnuplot << EOF
set output '$fname.png'
set xrange [${1}:${domainEnd}]
set yrange [${1}:${domainEnd}]
set zrange [${minZ}:${maxZ}]    
set pm3d
unset surface
set terminal png size 1200,600
set cbrange [-1:1]
set view 22,33,0.8,3
set title 'Numerical solution - T: ${time}'
set pm3d interpolate ${numberOfInterpolations},${numberOfInterpolations}
splot '$fname' with pm3d notitle
EOF
step=$((${step}+1))
done

mencoder "mf://u-*.png" -mf fps=4 -o mean_curvature_$size.avi -ovc lavc -lavcopts vcodec=mpeg4
rm *.png

seznam=`ls u-*.gplt`
step=0
for fname in $seznam ; do
time=$(expr $step*$snapshotPeriod | bc | sed 's/^\./0./')
echo "Drawing map $fname"
gnuplot << EOF
set output '${fname}.png'
set xrange [${1}:${domainEnd}]
set yrange [${1}:${domainEnd}]
set zrange [${minZ}:${maxZ}]    
set pm3d
unset surface
set terminal png size 1200,600
set cbrange [-1:1]
set view map
set title 'Numerical solution - map - T: ${time}'
set pm3d interpolate 100,100
set size square
set contour base
set cntrparam levels ${numberOfContours}
splot '$fname' with pm3d notitle
EOF
step=$((${step}+1))
done

mencoder "mf://u-*.png" -mf fps=4 -o mean_curvature_map_$size.avi -ovc lavc -lavcopts vcodec=mpeg4
rm *.png

seznam=`ls u-*.gplt`
step=0
for fname in $seznam ; do
time=$(expr $step*$snapshotPeriod | bc | sed 's/^\./0./')
echo "Drawing contour $fname"
gnuplot << EOF
set output '${fname}.png'
set xrange [${1}:${domainEnd}]
set yrange [${1}:${domainEnd}]
set zrange [${minZ}:${maxZ}]    
unset surface
set terminal png size 1200,600
set view map
set title 'Numerical solution - contour in height ${contourHeight} - T: ${time}'
set pm3d interpolate 100,100
set size square
set contour base
unset colorbox
set cntrparam levels discrete ${contourHeight}
splot '$fname' with pm3d notitle
EOF
step=$((${step}+1))
done

mencoder "mf://u-*.png" -mf fps=4 -o mean_curvature_contour_${contourHeight}_$size.avi -ovc lavc -lavcopts vcodec=mpeg4

rm *.png
rm *.tnl         
rm *.gplt 
rm mesh.asy
rm computation-done
     
}

runTest()
{
   for initFunction in ${initFunctions};
   do
      mkdir -p ${initFunction}-videos
      cd ${initFunction}-videos
      setupInitFunction ${initFunction}
         
      for size in $sizes;
      do
          mkdir -p $size
          cd $size
          echo ""
          echo ""
          echo ""
          if test ! -f computation-done;
          then
             touch computation-in-progress
             echo "========================================================================="
             echo "===                   SETTING UP THE GRID                             ==="
             echo "========================================================================="
             setupGrid $size 
             echo "========================================================================="
             echo "===                WRITING THE EXACT SOLUTION                         ==="
             echo "========================================================================="
             setInitialCondition $initFunction
             echo "========================================================================="
             echo "===                   STARTING THE SOLVER                             ==="
             echo "========================================================================="
             solve explicit merson
             #solve semi-implicit gmres
             mv computation-in-progress computation-done
             echo "========================================================================="
             echo "===                     COMPUTATION DONE                              ==="            
             echo "========================================================================="
	     view
	     generate3DVid $origin $proportions
             cd ..
             lastSize=$size
          fi
         cd ..
      done
      cd ..
   done
}

runTest
 
+7 −1
Original line number Diff line number Diff line
ADD_SUBDIRECTORY( level_set_functions )

SET( headers tnlCylinderFunction.h
             tnlCylinderFunction_impl.h  
	     tnlFlowerpotFunction.h
             tnlFlowerpotFunction_impl.h 
	     tnlTwinsFunction.h
             tnlTwinsFunction_impl.h             
   )
   
INSTALL( FILES ${headers} DESTINATION include/tnl-${tnlVersion}/functions/initial_conditions )
Loading