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

Merge branch 'revisions'

parents 80a60126 9be3e8d2
No related branches found
No related tags found
No related merge requests found
Showing
with 1148 additions and 11 deletions
...@@ -33,7 +33,7 @@ if( CMAKE_BUILD_TYPE STREQUAL "Debug") ...@@ -33,7 +33,7 @@ if( CMAKE_BUILD_TYPE STREQUAL "Debug")
set( LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/Debug/lib ) set( LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/Debug/lib )
set( EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/Debug/bin ) set( EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/Debug/bin )
set( debugExt -dbg ) set( debugExt -dbg )
set( CXX_FLAGS "${CXXFLAGS} -g ") set( CMAKE_CXX_FLAGS "${CXXFLAGS} -g ")
#AddCompilerFlag( "-g" ) #AddCompilerFlag( "-g" )
else() else()
set( PROJECT_BUILD_PATH ${PROJECT_SOURCE_DIR}/Release/src ) set( PROJECT_BUILD_PATH ${PROJECT_SOURCE_DIR}/Release/src )
......
* tnlBoundaryConditionsSetter was implemented
- it allows to set boundary conditions to given function
- in explicit solvers, it must be called explicitly now after calling tnlExplicitUpdater
2015-12-25 Tomas Oberhuber <tomas.oberhuber@fjfi.cvut.cz> 2015-12-25 Tomas Oberhuber <tomas.oberhuber@fjfi.cvut.cz>
* significant changes in grids * significant changes in grids
- the central structure is now grid entity rather than grid itself - the central structure is now grid entity rather than grid itself
......
TODO:
- implementovat tnlMixedGridBoundaryConditions, kde by se pro kazdou stranu gridu definoval jiny zvlastni typ
okrajovych podminek
- dalo by se tim resit i skladani zpetnych a doprednych diferenci u nelinearni difuze, kdy je potreba napr. dopredne diference
vycislit i na leve a dolni hranici 2D gridu
TODO:
- implementovat tuple pro snazsi a snad efektoivnejsi prenos dat na GPU
- nebylo by nutne definovat pomocne datove structury pro traverser
- data by se na hostu preskupila do souvisleho bloku dat a ten se prenesl najednou
TODO: TODO:
- zavest namespaces - zavest namespaces
...@@ -21,9 +33,6 @@ TODO: Mesh ...@@ -21,9 +33,6 @@ TODO: Mesh
* prejmenovat Tagy v topologies na Topology zrejme * prejmenovat Tagy v topologies na Topology zrejme
* zrusit tnlStorageTraits * zrusit tnlStorageTraits
TODO: v tnlMeshResolver se provadi preklad pro vsechny mozne sablonove parametry => prorezat
TODO: napsat FunctionDiscretizer pro jednotne rozhrani RightHandSide
TODO: implementace maticovych resicu TODO: implementace maticovych resicu
* Gaussova eliminace * Gaussova eliminace
......
...@@ -93,6 +93,11 @@ ${CMAKE} ${ROOT_DIR} \ ...@@ -93,6 +93,11 @@ ${CMAKE} ${ROOT_DIR} \
-DINSTANTIATE_INT=${INSTANTIATE_INT} \ -DINSTANTIATE_INT=${INSTANTIATE_INT} \
-DINSTANTIATE_LONG_INT=${INSTANTIATE_LONG_INT} -DINSTANTIATE_LONG_INT=${INSTANTIATE_LONG_INT}
if test $? != 0; then
echo "Error: cmake exited with error code."
exit 1
fi
if test ${CMAKE_ONLY} = "yes"; if test ${CMAKE_ONLY} = "yes";
then then
exit 1 exit 1
...@@ -101,10 +106,18 @@ fi ...@@ -101,10 +106,18 @@ fi
echo "Building ${BUILD} $TARGET using $BUILD_JOBS processors ..." echo "Building ${BUILD} $TARGET using $BUILD_JOBS processors ..."
make -j${BUILD_JOBS} ${VERBOSE} make -j${BUILD_JOBS} ${VERBOSE}
if test $? != 0; then
echo "Error: Build process failed."
exit 1
fi
if test WITH_TESTS = "yes"; if test WITH_TESTS = "yes";
then then
make -j${BUILD_JOBS} test make -j${BUILD_JOBS} test
if test $? != 0; then
echo "Error: Some test did not pass successfuly."
fi
fi fi
exit 0 exit 0
add_subdirectory( heat-equation ) add_subdirectory( heat-equation )
add_subdirectory( navier-stokes ) add_subdirectory( navier-stokes )
#add_subdirectory( mean-curvature-flow )
...@@ -67,7 +67,7 @@ class heatEquationSetter ...@@ -67,7 +67,7 @@ class heatEquationSetter
typedef tnlTestFunction< MeshType::meshDimensions, Real, Device > TestFunction; typedef tnlTestFunction< MeshType::meshDimensions, Real, Device > TestFunction;
typedef tnlHeatEquationEocRhs< ExactOperator, TestFunction > RightHandSide; typedef tnlHeatEquationEocRhs< ExactOperator, TestFunction > RightHandSide;
typedef tnlStaticVector < MeshType::meshDimensions, Real > Vertex; typedef tnlStaticVector < MeshType::meshDimensions, Real > Vertex;
typedef tnlDirichletBoundaryConditions< MeshType, TestFunction, Real, Index > BoundaryConditions; typedef tnlDirichletBoundaryConditions< MeshType, TestFunction, Dimensions, Real, Index > BoundaryConditions;
typedef tnlHeatEquationEocProblem< MeshType, BoundaryConditions, RightHandSide, ApproximateOperator > Solver; typedef tnlHeatEquationEocProblem< MeshType, BoundaryConditions, RightHandSide, ApproximateOperator > Solver;
SolverStarter solverStarter; SolverStarter solverStarter;
return solverStarter.template run< Solver >( parameters ); return solverStarter.template run< Solver >( parameters );
......
set( tnl_mean_curvature_flow_SOURCES
tnl-mean-curvature-flow.cpp
tnl-mean-curvature-flow-eoc.cpp
tnl-mean-curvature-flow.cu
tnl-mean-curvature-flow-eoc.cu )
IF( BUILD_CUDA )
CUDA_ADD_EXECUTABLE(tnl-mean-curvature-flow${debugExt} tnl-mean-curvature-flow.cu)
CUDA_ADD_EXECUTABLE(tnl-mean-curvature-flow-eoc-test${debugExt} tnl-mean-curvature-flow-eoc.cu)
target_link_libraries (tnl-mean-curvature-flow${debugExt} tnl${debugExt}-${tnlVersion} ${CUSPARSE_LIBRARY} )
target_link_libraries (tnl-mean-curvature-flow-eoc-test${debugExt} tnl${debugExt}-${tnlVersion} ${CUSPARSE_LIBRARY} )
ELSE( BUILD_CUDA )
ADD_EXECUTABLE(tnl-mean-curvature-flow${debugExt} tnl-mean-curvature-flow.cpp)
ADD_EXECUTABLE(tnl-mean-curvature-flow-eoc-test${debugExt} tnl-mean-curvature-flow-eoc.cpp)
target_link_libraries (tnl-mean-curvature-flow${debugExt} tnl${debugExt}-${tnlVersion} )
target_link_libraries (tnl-mean-curvature-flow-eoc-test${debugExt} tnl${debugExt}-${tnlVersion} )
ENDIF( BUILD_CUDA )
INSTALL( TARGETS tnl-mean-curvature-flow${debugExt}
tnl-mean-curvature-flow-eoc-test${debugExt}
RUNTIME DESTINATION bin
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE )
INSTALL( FILES tnl-run-mean-curvature-flow-eoc-test
tnl-run-mean-curvature-flow
tnl-run-mean-curvature-flow-contour-video
tnl-run-mean-curvature-flow-videos
${tnl_mean_curvature_flow_SOURCES}
DESTINATION share/tnl-${tnlVersion}/examples/mean-curvature-flow )
\ No newline at end of file
TNL_VERSION=0.1
TNL_INSTALL_DIR=${HOME}/local/lib
TNL_INCLUDE_DIR=${HOME}/local/include/tnl-${TNL_VERSION}
TARGET = mean-curvature-flow-eoc
INSTALL_DIR = ${HOME}/local
CXX = g++
CUDA_CXX = nvcc
CXX_FLAGS = -std=gnu++0x -I$(TNL_INCLUDE_DIR) -O0 -g
LD_FLAGS = -L$(TNL_INSTALL_DIR) -ltnl-dbg-0.1
SOURCES = tnl-mean-curvature-flow-eoc.cpp
HEADERS =
OBJECTS = tnl-mean-curvature-flow-eoc.o
DIST = $(SOURCES) Makefile
all: $(TARGET)
clean:
rm -f $(OBJECTS)
dist: $(DIST)
tar zcvf $(TARGET).tgz $(DIST)
install: $(TARGET)
cp $(TARGET) $(INSTALL_DIR)/bin
cp $(INSTALL_DIR)/share/tnl-0.1/examples/mean-curvature-flow
uninstall: $(TARGET)
rm -f $(INSTALL_DIR)/bin/$(TARGET)
rm -f $(INSTALL_DIR)/share/tnl-0.1/examples/mean-curvature-flow
$(TARGET): $(OBJECTS)
$(CXX) -o $(TARGET) $(OBJECTS) $(LD_FLAGS)
%.o: %.cpp $(HEADERS)
$(CXX) -c -o $@ $(CXX_FLAGS) $<
/***************************************************************************
tnl-mean-curvature-flow-eoc.cpp - description
-------------------
begin : Dec 29, 2015
copyright : (C) 2015 by oberhuber
email : tomas.oberhuber@fjfi.cvut.cz
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include "tnl-mean-curvature-flow-eoc.h"
/***************************************************************************
tnl-mean-curvature-flow-eoc.cu - description
-------------------
begin : Dec 29, 2015
copyright : (C) 2015 by oberhuber
email : tomas.oberhuber@fjfi.cvut.cz
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include "tnl-mean-curvature-flow-eoc.h"
/***************************************************************************
tnl-heat-equation-eoc.h - description
-------------------
begin : Nov 29, 2014
copyright : (C) 2014 by oberhuber
email : tomas.oberhuber@fjfi.cvut.cz
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef TNL_MEAN_CURVATURE_FLOW_EOC_H_
#define TNL_MEAN_CURVATURE_FLOW_EOC_H_
#include <solvers/tnlSolver.h>
#include <solvers/tnlFastBuildConfigTag.h>
#include <solvers/tnlBuildConfigTags.h>
#include <functions/tnlTestFunction.h>
#include <operators/tnlDirichletBoundaryConditions.h>
#include <operators/tnlNeumannBoundaryConditions.h>
#include <problems/tnlMeanCurvatureFlowEocRhs.h>
#include <problems/tnlMeanCurvatureFlowEocProblem.h>
#include <operators/diffusion/tnlExactNonlinearDiffusion.h>
#include <operators/diffusion/tnlNonlinearDiffusion.h>
#include <operators/operator-Q/tnlOneSideDiffOperatorQ.h>
#include <operators/operator-Q/tnlFiniteVolumeOperatorQ.h>
#include <operators/diffusion/tnlExactNonlinearDiffusion.h>
#include <operators/diffusion/nonlinear-diffusion-operators/tnlOneSideDiffNonlinearOperator.h>
#include <operators/diffusion/nonlinear-diffusion-operators/tnlFiniteVolumeNonlinearOperator.h>
#include <operators/geometric/tnlExactGradientNorm.h>
//typedef tnlDefaultConfigTag BuildConfig;
typedef tnlFastBuildConfig BuildConfig;
template< typename ConfigTag >
class meanCurvatureFlowEocConfig
{
public:
static void configSetup( tnlConfigDescription& config )
{
config.addDelimiter( "Mean Curvature Flow EOC settings:" );
config.addEntry< tnlString >( "numerical-scheme", "Numerical scheme for the solution approximation.", "fvm" );
config.addEntryEnum< tnlString >( "fdm" );
config.addEntryEnum< tnlString >( "fvm" );
config.addEntry< double >( "eps", "This sets a eps in operator Q.", 1.0 );
config.addDelimiter( "Tests setting::" );
tnlTestFunction< 3, double >::configSetup( config );
}
};
template< typename Real,
typename Device,
typename Index,
typename MeshType,
typename ConfigTag,
typename SolverStarter >
class meanCurvatureFlowEocSetter
{
public:
typedef Real RealType;
typedef Device DeviceType;
typedef Index IndexType;
typedef typename MeshType::VertexType Vertex;
enum { Dimensions = MeshType::meshDimensions };
static bool run( const tnlParameterContainer& parameters )
{
typedef tnlFiniteVolumeOperatorQ<MeshType, Real, Index, 0> OperatorQ;
typedef tnlFiniteVolumeNonlinearOperator<MeshType, OperatorQ, Real, Index > NonlinearOperator;
typedef tnlNonlinearDiffusion< MeshType, NonlinearOperator, Real, Index > ApproximateOperator;
typedef tnlExactNonlinearDiffusion< tnlExactGradientNorm< Dimensions >, Dimensions > ExactOperator;
typedef tnlTestFunction< MeshType::meshDimensions, Real, Device > TestFunction;
typedef tnlMeanCurvatureFlowEocRhs< ExactOperator, TestFunction, Dimensions > RightHandSide;
typedef tnlStaticVector < MeshType::meshDimensions, Real > Vertex;
typedef tnlDirichletBoundaryConditions< MeshType, TestFunction, Dimensions, Real, Index > BoundaryConditions;
typedef tnlMeanCurvatureFlowEocProblem< MeshType, BoundaryConditions, RightHandSide, ApproximateOperator > Solver;
SolverStarter solverStarter;
return solverStarter.template run< Solver >( parameters );
};
};
int main( int argc, char* argv[] )
{
tnlSolver< meanCurvatureFlowEocSetter, meanCurvatureFlowEocConfig, BuildConfig > solver;
if( ! solver. run( argc, argv ) )
return EXIT_FAILURE;
return EXIT_SUCCESS;
}
#endif /* TNL_MEAN_CURVATURE_FLOW_EOC_H_ */
/***************************************************************************
tnl-mean-cudvature-flow.cpp - description
-------------------
begin : Dec 29, 2015
copyright : (C) 2015 by Tomas Oberhuber
email : tomas.oberhuber@fjfi.cvut.cz
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include "tnl-mean-curvature-flow.h"
/***************************************************************************
tnl-mean-curvature-flow.cu - description
-------------------
begin : Dec 29, 2015
copyright : (C) 2015 by Tomas Oberhuber
email : tomas.oberhuber@fjfi.cvut.cz
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include "tnl-mean-curvature-flow.h"
/***************************************************************************
tnl-heat-equation.h - description
-------------------
begin : Nov 29, 2014
copyright : (C) 2014 by oberhuber
email : tomas.oberhuber@fjfi.cvut.cz
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef TNL_MEAN_CURVATIVE_FLOW_H_
#define TNL_MEAN_CURVATIVE_FLOW_H_
#include <solvers/tnlSolver.h>
#include <solvers/tnlFastBuildConfigTag.h>
#include <operators/diffusion/tnlLinearDiffusion.h>
#include <operators/tnlDirichletBoundaryConditions.h>
#include <operators/tnlNeumannBoundaryConditions.h>
#include <functions/tnlConstantFunction.h>
#include <problems/tnlMeanCurvatureFlowProblem.h>
#include <operators/diffusion/tnlOneSidedNonlinearDiffusion.h>
#include <operators/operator-Q/tnlOneSideDiffOperatorQ.h>
#include <operators/operator-Q/tnlFiniteVolumeOperatorQ.h>
#include <operators/diffusion/nonlinear-diffusion-operators/tnlFiniteVolumeNonlinearOperator.h>
#include <functions/tnlMeshFunction.h>
//typedef tnlDefaultConfigTag BuildConfig;
typedef tnlFastBuildConfig BuildConfig;
template< typename ConfigTag >
class meanCurvatureFlowConfig
{
public:
static void configSetup( tnlConfigDescription& config )
{
config.addDelimiter( "Mean Curvature Flow settings:" );
config.addEntry< tnlString >( "numerical-scheme", "Numerical scheme for the solution approximation.", "fvm" );
config.addEntryEnum< tnlString >( "fdm" );
config.addEntryEnum< tnlString >( "fvm" );
config.addEntry< tnlString >( "boundary-conditions-type", "Choose the boundary conditions type.", "dirichlet");
config.addEntryEnum< tnlString >( "dirichlet" );
config.addEntryEnum< tnlString >( "neumann" );
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 );
};
};
template< typename Real,
typename Device,
typename Index,
typename MeshType,
typename ConfigTag,
typename SolverStarter >
class meanCurvatureFlowSetter
{
public:
typedef Real RealType;
typedef Device DeviceType;
typedef Index IndexType;
typedef typename MeshType::VertexType Vertex;
enum { Dimensions = MeshType::meshDimensions };
static bool run( const tnlParameterContainer& parameters )
{
return setNumericalScheme( parameters );
}
static bool setNumericalScheme( const tnlParameterContainer& parameters )
{
const tnlString& numericalScheme = parameters.getParameter< tnlString >( "numerical-scheme" );
if( numericalScheme == "fdm" )
{
typedef tnlOneSideDiffOperatorQ<MeshType, Real, Index > QOperator;
typedef tnlOneSideNonlinearDiffusion<MeshType, QOperator, Real, Index > NonlinearOperator;
return setBoundaryConditions< NonlinearOperator, QOperator >( parameters );
}
if( numericalScheme == "fvm" )
{
typedef tnlFiniteVolumeOperatorQ<MeshType, Real, Index, 0> QOperator;
typedef tnlFiniteVolumeNonlinearOperator<MeshType, QOperator, Real, Index > NonlinearOperator;
return setBoundaryConditions< NonlinearOperator, QOperator >( parameters );
}
return false;
}
template< typename NonlinearOperator,
typename QOperator >
static bool setBoundaryConditions( const tnlParameterContainer& parameters )
{
typedef tnlOneSidedNonlinearDiffusion< MeshType, NonlinearOperator, Real, Index > ApproximateOperator;
typedef tnlConstantFunction< Dimensions, Real > RightHandSide;
typedef tnlStaticVector< MeshType::meshDimensions, Real > Vertex;
tnlString boundaryConditionsType = parameters.getParameter< tnlString >( "boundary-conditions-type" );
if( parameters.checkParameter( "boundary-conditions-constant" ) )
{
typedef tnlConstantFunction< Dimensions, Real > ConstantFunction;
if( boundaryConditionsType == "dirichlet" )
{
typedef tnlDirichletBoundaryConditions< MeshType, ConstantFunction, Dimensions, Real, Index > BoundaryConditions;
typedef tnlMeanCurvatureFlowProblem< MeshType, BoundaryConditions, RightHandSide, ApproximateOperator > Solver;
SolverStarter solverStarter;
return solverStarter.template run< Solver >( parameters );
}
typedef tnlNeumannBoundaryConditions< MeshType, ConstantFunction, Real, Index > BoundaryConditions;
typedef tnlMeanCurvatureFlowProblem< MeshType, BoundaryConditions, RightHandSide, ApproximateOperator > Solver;
SolverStarter solverStarter;
return solverStarter.template run< Solver >( parameters );
}
//typedef tnlVector< Real, Device, Index > VectorType;
typedef tnlMeshFunction< MeshType > MeshFunction;
if( boundaryConditionsType == "dirichlet" )
{
typedef tnlDirichletBoundaryConditions< MeshType, MeshFunction, Dimensions, Real, Index > BoundaryConditions;
typedef tnlMeanCurvatureFlowProblem< MeshType, BoundaryConditions, RightHandSide, ApproximateOperator > Solver;
SolverStarter solverStarter;
return solverStarter.template run< Solver >( parameters );
}
typedef tnlNeumannBoundaryConditions< MeshType, MeshFunction, Real, Index > BoundaryConditions;
typedef tnlMeanCurvatureFlowProblem< MeshType, BoundaryConditions, RightHandSide, ApproximateOperator > Solver;
SolverStarter solverStarter;
return solverStarter.template run< Solver >( parameters );
};
};
int main( int argc, char* argv[] )
{
tnlSolver< meanCurvatureFlowSetter, meanCurvatureFlowConfig, BuildConfig > solver;
if( ! solver. run( argc, argv ) )
return EXIT_FAILURE;
return EXIT_SUCCESS;
}
#endif /* TNL_MEAN_CURVATIVE_FLOW_H_ */
#!/bin/bash
dofSize=64
dimension=2;
proportions=1
analyticFunction="exp-bump"
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-init --mesh mesh.tnl \
--test-function ${analyticFunction} \
--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} \
tnl-mean-curvature-flow --time-discretisation explicit \
--boundary-conditions-type dirichlet \
--boundary-conditions-constant 0.5 \
--discrete-solver merson \
--snapshot-period 0.0005 \
--final-time 0.1 \
tnl-view --mesh mesh.tnl \
--input-files *.tnl \
seznam=`ls u-*.gplt`
for fname in $seznam ; do
echo "Drawing $fname"
gnuplot << EOF
set terminal unknown
#set view 33,33 #3D
#unset xtics
#unset ytics
#unset ztics
unset border
set output '$fname.png'
set yrange [-1.2:1.2]
set zrange [0.4:1.1]
set terminal png
set title "Numerical solution"
splot '$fname' with line
EOF
done
mencoder "mf://u-*.png" -mf fps=22 -o diffusion.avi -ovc lavc -lavcopts vcodec=mpeg4
#rm *.png
#rm *.tnl
#rm *.gplt
#!/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
#!/bin/bash
device="host"
dimensions="3D"
sizes3D="16 32 64"
testFunctions="exp-bump sin-wave sin-bumps"
snapshotPeriod=0.001
finalTime=0.01
timeDependence="cosine"
solverName="mean-curvature-flow-eoc"
#solverName="gdb --args tnl-heat-equation-eoc-test-dbg"
setupTestFunction()
{
testFunction=$1
# if test x${testFunction} = "xexp-bump";
# then
origin=2
proportions=2
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
# fi
}
setupGrid()
{
dimensions=$1
gridSize=$2
tnl-grid-setup --dimensions ${dimensions} \
--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()
{
testFunction=$1
tnl-init --test-function ${testFunction} \
--output-file exact-u.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 ${timeDependence} \
--snapshot-period ${snapshotPeriod} \
--final-time ${finalTime}
}
solve()
{
timeDiscretisation=$1
discreteSolver=$2
${solverName} --device ${device} \
--mesh mesh.tnl \
--initial-condition exact-u-00000.tnl \
--time-discretisation ${timeDiscretisation} \
--time-step 1 \
--time-step-order 2 \
--discrete-solver ${discreteSolver} \
--merson-adaptivity 1.0e-10 \
--sor-omega 1.95 \
--gmres-restarting 20 \
--min-iterations 50 \
--convergence-residue 1.0e-14 \
--test-function ${testFunction}\
--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 ${timeDependence} \
--snapshot-period ${snapshotPeriod} \
--final-time ${finalTime}
}
computeError()
{
tnl-diff --mesh mesh.tnl \
--input-files exact-u-*.tnl u-*.tnl \
--mode halves \
--snapshot-period ${snapshotPeriod} \
--output-file errors.txt \
--write-difference yes
}
runTest()
{
for testFunction in ${testFunctions};
do
mkdir -p ${testFunction}
cd ${testFunction}
setupTestFunction ${testFunction}
for dim in ${dimensions};
do
mkdir -p $dim
cd ${dim}
if test $dim = 1D;
then
sizes=$sizes1D
fi
if test $dim = 2D;
then
sizes=$sizes2D
fi
if test $dim = 3D;
then
sizes=$sizes3D
fi
lastSize=""
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 $dim $size
echo "========================================================================="
echo "=== WRITING THE EXACT SOLUTION ==="
echo "========================================================================="
setInitialCondition $testFunction
echo "========================================================================="
echo "=== STARTING THE SOLVER ==="
echo "========================================================================="
#solve explicit merson
solve semi-implicit gmres
mv computation-in-progress computation-done
fi
echo "========================================================================="
echo "=== COMPUTING THE ERROR ==="
echo "========================================================================="
computeError
echo "========================================================================="
echo "=== COMPUTING THE EOC ==="
echo "========================================================================="
if test ! x$lastSize = x;
then
tnl-err2eoc ../$lastSize/errors.txt errors.txt
fi
echo "========================================================================="
echo "=== COMPUTATION DONE ==="
echo "========================================================================="
cd ..
lastSize=$size
done
cd ..
done
cd ..
done
}
runTest
#!/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
...@@ -35,12 +35,12 @@ then ...@@ -35,12 +35,12 @@ then
mkdir Debug mkdir Debug
fi fi
cd Debug cd Debug
../build --root-dir=.. --build=Debug ${OPTIONS} if ../build --root-dir=.. --build=Debug ${OPTIONS};
if test $? != 0;
then then
make install
else
exit 1 exit 1
fi fi
make install
cd .. cd ..
fi fi
...@@ -51,12 +51,12 @@ then ...@@ -51,12 +51,12 @@ then
mkdir Release mkdir Release
fi fi
cd Release cd Release
../build --root-dir=.. --build=Release ${OPTIONS} if ../build --root-dir=.. --build=Release ${OPTIONS};
if test $? != 0;
then then
make install
else
exit 1 exit 1
fi fi
make install
cd .. cd ..
fi fi
......
...@@ -18,7 +18,9 @@ ...@@ -18,7 +18,9 @@
#include <ctype.h> #include <ctype.h>
#include <cstring> #include <cstring>
#include <stdio.h> #include <stdio.h>
#include "tnlParameterContainer.h" #include "tnlParameterContainer.h"
#include <core/tnlObject.h>
bool matob( const char* value, bool& ret_val ) bool matob( const char* value, bool& ret_val )
{ {
......
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