Commit 46715b6e authored by Tomáš Oberhuber's avatar Tomáš Oberhuber
Browse files

Implementing the heat equation EOC test.

parent b39882e1
Loading
Loading
Loading
Loading
+14 −24
Original line number Diff line number Diff line
set( tnl_heat_equation_SOURCES
               tnlZeroRightHandSide_impl.h
               tnlZeroRightHandSide.h
               tnlTimeFunction_impl.h
               tnlTimeFunction.h
     tnlHeatEquationEocRhs.h
               tnlRightHandSide_impl.h
               tnlRightHandSide.h
               tnlNeumannBoundaryConditions_impl.h
               tnlNeumannBoundaryConditions.h
               tnlDirichletBoundaryConditions_impl.h
               tnlDirichletBoundaryConditions.h
               tnlAnalyticSolution_impl.h
               tnlAnalyticSolution.h
               main.cpp
               tnl-heat-equation.cpp
               tnl-heat-equation-eoc.cpp
               heatEquationSolver_impl.h
               heatEquationSolver.h
               heatEquationSetter_impl.h
               heatEquationSetter.h
               heatEquationConfig.h )
               heatEquationEocRhs.h )
               
ADD_EXECUTABLE(tnl-heat-equation${debugExt} ${tnl_heat_equation_SOURCES})
target_link_libraries (tnl-heat-equation${debugExt} tnl${debugExt}-${tnlVersion} )
#ADD_EXECUTABLE(tnl-heat-equation${debugExt} tnl-heat-equation.cpp)
#target_link_libraries (tnl-heat-equation${debugExt} tnl${debugExt}-${tnlVersion} )

INSTALL( TARGETS tnl-heat-equation${debugExt}
ADD_EXECUTABLE(tnl-heat-equation-eoc-test${debugExt} tnl-heat-equation-eoc.cpp)
target_link_libraries (tnl-heat-equation-eoc-test${debugExt} tnl${debugExt}-${tnlVersion} )

INSTALL( TARGETS #tnl-heat-equation${debugExt}
                 tnl-heat-equation-eoc-test${debugExt}
         RUNTIME DESTINATION bin
         PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE )
        
INSTALL( FILES #Makefile
               run-init-mesh
               run-heat-equation-testy-laplace-konvergence
               run-heat-equation-testy-konvergence
               run-heat-equation
               heat-equation.cfg.desc
					debugging_parameters
					EOCtest
					EOCtest-adaptivity-cycle

INSTALL( FILES tnl-run-heat-equation-eoc-test
               tnl-run-heat-equation
         DESTINATION share/tnl-${tnlVersion}/examples/heat-equation )

examples/heat-equation/EOCtest

deleted100755 → 0
+0 −185
Original line number Diff line number Diff line
#!/bin/bash

LD_LIBRARY_PATH=/home/szekely/local/lib
export LD_LIBRARY_PATH

dimension=2
proportions=1
initDofSize=8
analyticFunction="sin-wave"
timeFunction="cosinus"
snapshotPeriod=0.05
finalTime=1
mersonAdaptivity=1.0e-5
numberOfIterations=8
#{8..1024dofs}
scale=2
origin=0

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

dofs=${initDofSize}

for ((i=1;i<=${numberOfIterations};i++))
do

tnl-grid-setup --dimensions ${dimension} \
               --proportions-x ${proportions} \
               --proportions-y ${proportions} \
               --proportions-z ${proportions} \
               --origin-x ${origin} \
               --origin-y ${origin} \
               --origin-z ${origin} \
               --size-x ${dofs} \
               --size-y ${dofs} \
               --size-z ${dofs} \

tnl-discrete --mesh mesh.tnl \
             --function ${analyticFunction} \
             --output-file u-ini.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} \

./heat-equation_AV --dimensions ${dimension} \
                --time-discretisation explicit \
                --discrete-solver merson \
		--merson-adaptivity ${mersonAdaptivity}\
                --time-function ${timeFunction}\
                --analytic-space-function ${analyticFunction}\
                --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} \
                --sigma ${sigma} \
                --snapshot-period ${snapshotPeriod} \
                --final-time ${finalTime} \
                --solution-convergence-test 1 \

rm u-ini.tnl

tnl-diff --mesh mesh.tnl \
         --input-files numericalSolution-*.tnl analyticSolution-*.tnl \
         --mode halves \
         --output-file ${dofs} \

rm *.tnl

dofs=$((${scale} * $dofs))

done

file="EOC-${analyticFunction}-${timeFunction}-${dimension}D-${finalTime}T-adaptivity${mersonAdaptivity}"

rm ${file}
echo -e "#\tL1 diff.\t\tEOC\t\tL2 diff.\t\tEOC\t\tLmax diff.\t\tEOC" >> ${file}

echo -e -n "${initDofSize}\t" >> ${file}
nactenyRadek=$( tail -1 ${initDofSize})
for zaznam  in ${nactenyRadek}
do

hodnota=$(echo $zaznam | sed 's/e/\*10\^/' | bc -l)
if [[ ${hodnota} =~ ^\. ]]; then
echo -e -n "0${hodnota}\t\t   \t\t" >> ${file}
else
echo -e -n "${hodnota}\t\t   \t\t" >> ${file}
fi

done
echo -e -n "\n" >> ${file}


${radek} >>  ${file}

soubor1=$((${initDofSize}/${scale}))
soubor2=${initDofSize}

for ((i=1;i<${numberOfIterations};i++))
do

soubor1=$((2 * $soubor1))
soubor2=$((2 * $soubor2))

IFS=' ' read -a posledniRadek1 <<< $(tail -1 $soubor1)
IFS=' ' read -a posledniRadek2 <<< $(tail -1 $soubor2)
#{pres specialni promenou IFS utvorime pole z retezce}

echo -e -n "${soubor2}\t" >> ${file}

for j in {0..2}
do

echo -e -n "${posledniRadek2[j]}\t\t" >> ${file}

prevedenyVyraz=$(echo "l((${posledniRadek2[$j]})/(${posledniRadek1[$j]}))/l(0.5)" | sed 's/e/\*10\^/g')
hodnota=$(echo "${prevedenyVyraz}" | bc -l)
hodnota=$(echo "scale=3; ${hodnota}/1" | bc)
#hodnota =$(echo "${prevedenyVyraz}" | bc -l)
#{g v retezci aby nahradilo vsechny vyskyty v souboru}
if [[ ${hodnota} =~ ^\. ]]; then
echo -e -n "0${hodnota}\t\t" >> ${file}
else
if [[ ${hodnota} =~ ^\-\. ]]; then
pom=$(echo "${hodnota}" | sed 's/-\./-0\./')
echo -e -n "${pom}\t\t" >> ${file}
else
echo -e -n "${hodnota}\t\t" >> ${file}
fi
fi

done

echo -e -n "\n" >> ${file}

done

echo -e -n "\n\n\n" >> ${file}

echo -e "PARAMETERS:\n" >> ${file}
echo -e " dimensions = ${dimension}\n proportions = ${proportions}\n analytic function = ${analyticFunction}\n time function = ${timeFunction}\n snapshot period = ${snapshotPeriod}\n final time = ${finalTime}\n adaptivity = ${mersonAdaptivity}\n origin = ${origin}\n\n" >> ${file}
echo -e " amplitude = ${amplitude}\n wave length = ${waveLength}\n wave length x = ${waveLengthX}\n wave length y = ${waveLengthY}\n wave length z = ${waveLengthZ=1.0}\n wave number = ${wavesNumber}\n waves number x = ${wavesNumberX}\n waves number y = ${wavesNumberY}\n waves number z = ${wavesNumberZ}\n phase = ${phase}\n phase x = ${phaseX}\n phase y = ${phaseY}\n phase z = ${phaseZ}\n sigma = ${sigma}" >> ${file}


soubor=$((${initDofSize}/${scale}))
for ((i=1;i<=${numberOfIterations};i++))
do

soubor=$((${soubor}*${scale}))
rm ${soubor}

done 
+0 −194
Original line number Diff line number Diff line
#!/bin/bash

LD_LIBRARY_PATH=/home/szekely/local/lib
export LD_LIBRARY_PATH

dimension=2
proportions=1
initDofSize=8
analyticFunction="exp-bump"
timeFunction="cosinus"
snapshotPeriod=0.01
finalTime=0.1
initMersonAdaptivity=1.0e-7
numberOfAdaptivityIter=2
adaptivityDiff=100
numberOfIterations=8
#{8..1024dofs}
scale=2
origin=0

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

dofs=${initDofSize}
mersonAdaptivity=${initMersonAdaptivity}

for ((k=1;k<=${numberOfAdaptivityIter};k++))
do
for ((i=1;i<=${numberOfIterations};i++))
do

tnl-grid-setup --dimensions ${dimension} \
               --proportions-x ${proportions} \
               --proportions-y ${proportions} \
               --proportions-z ${proportions} \
               --origin-x ${origin} \
               --origin-y ${origin} \
               --origin-z ${origin} \
               --size-x ${dofs} \
               --size-y ${dofs} \
               --size-z ${dofs} \

tnl-discrete --mesh mesh.tnl \
             --function ${analyticFunction} \
             --output-file u-ini.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} \

./heat-equation_AV --dimensions ${dimension} \
                --time-discretisation explicit \
                --discrete-solver merson \
		--merson-adaptivity ${mersonAdaptivity}\
                --time-function ${timeFunction}\
                --analytic-space-function ${analyticFunction}\
                --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} \
                --sigma ${sigma} \
                --snapshot-period ${snapshotPeriod} \
                --final-time ${finalTime} \
                --solution-convergence-test 1 \

rm u-ini.tnl

tnl-diff --mesh mesh.tnl \
         --input-files numericalSolution-*.tnl analyticSolution-*.tnl \
         --mode halves \
         --output-file ${dofs} \

rm *.tnl

dofs=$((${scale} * $dofs))

done

file="EOC-${analyticFunction}-${timeFunction}-${dimension}D-${finalTime}T-adaptivity${mersonAdaptivity}"

rm ${file}
echo -e "#\tL1 diff.\t\tEOC\t\tL2 diff.\t\tEOC\t\tLmax diff.\t\tEOC" >> ${file}

echo -e -n "${initDofSize}\t" >> ${file}
nactenyRadek=$( tail -1 ${initDofSize})
for zaznam  in ${nactenyRadek}
do

hodnota=$(echo $zaznam | sed 's/e/\*10\^/' | bc -l)
if [[ ${hodnota} =~ ^\. ]]; then
echo -e -n "0${hodnota}\t\t   \t\t" >> ${file}
else
echo -e -n "${hodnota}\t\t   \t\t" >> ${file}
fi

done
echo -e -n "\n" >> ${file}


${radek} >>  ${file}

soubor1=$((${initDofSize}/${scale}))
soubor2=${initDofSize}

for ((i=1;i<${numberOfIterations};i++))
do

soubor1=$((2 * $soubor1))
soubor2=$((2 * $soubor2))

IFS=' ' read -a posledniRadek1 <<< $(tail -1 $soubor1)
IFS=' ' read -a posledniRadek2 <<< $(tail -1 $soubor2)
#{pres specialni promenou IFS utvorime pole z retezce}

echo -e -n "${soubor2}\t" >> ${file}

for j in {0..2}
do

echo -e -n "${posledniRadek2[j]}\t\t" >> ${file}

prevedenyVyraz=$(echo "l((${posledniRadek2[$j]})/(${posledniRadek1[$j]}))/l(0.5)" | sed 's/e/\*10\^/g')
hodnota=$(echo "${prevedenyVyraz}" | bc -l)
hodnota=$(echo "scale=3; ${hodnota}/1" | bc)
#hodnota =$(echo "${prevedenyVyraz}" | bc -l)
#{g v retezci aby nahradilo vsechny vyskyty v souboru}
if [[ ${hodnota} =~ ^\. ]]; then
echo -e -n "0${hodnota}\t\t" >> ${file}
else
if [[ ${hodnota} =~ ^\-\. ]]; then
pom=$(echo "${hodnota}" | sed 's/-\./-0\./')
echo -e -n "${pom}\t\t" >> ${file}
else
echo -e -n "${hodnota}\t\t" >> ${file}
fi
fi

done

echo -e -n "\n" >> ${file}

done

echo -e -n "\n\n\n" >> ${file}

echo -e "PARAMETERS:\n" >> ${file}
echo -e " dimensions = ${dimension}\n proportions = ${proportions}\n analytic function = ${analyticFunction}\n time function = ${timeFunction}\n snapshot period = ${snapshotPeriod}\n final time = ${finalTime}\n adaptivity = ${mersonAdaptivity}\n origin = ${origin}\n\n" >> ${file}
echo -e " amplitude = ${amplitude}\n wave length = ${waveLength}\n wave length x = ${waveLengthX}\n wave length y = ${waveLengthY}\n wave length z = ${waveLengthZ=1.0}\n wave number = ${wavesNumber}\n waves number x = ${wavesNumberX}\n waves number y = ${wavesNumberY}\n waves number z = ${wavesNumberZ}\n phase = ${phase}\n phase x = ${phaseX}\n phase y = ${phaseY}\n phase z = ${phaseZ}\n sigma = ${sigma}" >> ${file}


soubor=$((${initDofSize}/${scale}))
for ((i=1;i<=${numberOfIterations};i++))
do

soubor=$((${soubor}*${scale}))
rm ${soubor}

done 

mersonAdaptivity=$(echo "(${mersonAdaptivity})/(${adaptivityDiff})" | sed 's/e/\*10\^/g' | bc -l)

done

examples/heat-equation/TOHLEPUST

deleted100755 → 0
+0 −87
Original line number Diff line number Diff line
#!/bin/bash

dofSize=64
dimension=2
proportions=1

analyticFunction="sin-wave"
timeFunction="cosinus"

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

tnl-grid-setup --dimensions ${dimension} \
               --proportions-x ${proportions} \
               --proportions-y ${proportions} \
               --proportions-z ${proportions} \
               --origin-x 0 \
               --origin-y 0 \
               --origin-z 0 \
               --size-x ${dofSize} \
               --size-y ${dofSize} \
               --size-z ${dofSize} \
               
tnl-discrete --mesh mesh.tnl \
             --function ${analyticFunction} \
             --output-file u-ini.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} \

./heat-equation --dimensions ${dimension} \
                --time-discretisation explicit \
                --discrete-solver merson \
                --time-function ${timeFunction}\
                --analytic-space-function ${analyticFunction}\
                --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} \
                --snapshot-period 0.05 \
                --final-time 1.0 \
                --solution-convergence-test 1 \

rm u-ini.tnl

tnl-diff --mesh mesh.tnl \
         --input-files numericalSolution-*.tnl analyticSolution-*.tnl \
         --mode halves \
         --output-file ${dofSize} \

cp 64 POSLI_MI_TOHLE
rm 64

rm *.tnl     
+0 −7
Original line number Diff line number Diff line
heat-equation --dimensions 3 --time-discretisation explicit --discrete-solver merson --time-function cosinus --analytic-space-function sin-wave --amplitude 1 --wave-length 1 --wave-length-x 1 --wave-length-y 1 --wave-length-z 1 --waves-number 0 --waves-number-x 0 --waves-number-y 0 --waves-number-z 0 --phase 0 --phase-x 0 --phase-y 0 --phase-z 0 --sigma 1 --snapshot-period 0.05 --final-time 1.0 --solution-convergence-test 1

tnl-discrete --mesh mesh.tnl --function sin-wave --output-file u-ini.tnl  --amplitude 1 --wave-length 1 --wave-length-x 1 --wave-length-y 1 --wave-length-z 1 --waves-number 0 --waves-number-x 0 --waves-number-y 0 --waves-number-z 0 --phase 0 --phase-x 0 --phase-y 0 --phase-z 0 --sigma 1

tnl-grid-setup --dimensions 3 --proportions-x 1 --proportions-y 1 --proportions-z 1 --origin-x 0 --origin-y 0 --origin-z 0 --size-x 2 --size-y 2 --size-z 2

Loading