From 2a589cf4dafaf0decba7e08e2adf1c8c08b22b63 Mon Sep 17 00:00:00 2001 From: kanschat Date: Thu, 24 May 2007 00:11:27 +0000 Subject: [PATCH] test Poisseuille flow git-svn-id: https://svn.dealii.org/trunk@14691 0785d39b-7218-0410-832d-ea1e28bc413d --- tests/base/Makefile | 3 +- tests/base/functions_01.cc | 112 ++++++++ tests/base/functions_01/cmp/generic | 406 ++++++++++++++++++++++++++++ 3 files changed, 520 insertions(+), 1 deletion(-) create mode 100644 tests/base/functions_01.cc create mode 100644 tests/base/functions_01/cmp/generic diff --git a/tests/base/Makefile b/tests/base/Makefile index a76e1a7885..f06a031d06 100644 --- a/tests/base/Makefile +++ b/tests/base/Makefile @@ -1,6 +1,6 @@ ############################################################ # $Id$ -# Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006 by the deal.II authors +# Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 by the deal.II authors ############################################################ ############################################################ @@ -47,6 +47,7 @@ tests_x = geometry_info_* \ data_out_base_povray \ data_out_base_tecplot \ data_out_base_vtk \ + functions_* \ function_parser \ utilities_* \ is_finite diff --git a/tests/base/functions_01.cc b/tests/base/functions_01.cc new file mode 100644 index 0000000000..1c01d6609f --- /dev/null +++ b/tests/base/functions_01.cc @@ -0,0 +1,112 @@ +//----------------------------------------------------------------------------- +// $Id$ +// Version: $Name$ +// +// Copyright (C) 2007 by the deal.II authors +// +// This file is subject to QPL and may not be distributed +// without copyright and license information. Please refer +// to the file deal.II/doc/license.html for the text and +// further information on this license. +// +//----------------------------------------------------------------------------- + +// Plot functions in library and check their consistency + +#include "../tests.h" +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + + + +template +void +check_function(const Function& f, + unsigned int sub, + std::ostream& out) +{ + // Prepare a vector with a single + // patch stretching over the cube + // [-1,1]^dim + std::vector > patches(1); + unsigned int vertex_number = 0; + for (unsigned int iz=0;iz < ((dim>2) ? 2 : 1) ;++iz) + for (unsigned int iy=0;iy < ((dim>1) ? 2 : 1) ;++iy) + for (unsigned int ix=0;ix < 2 ;++ix) + { + if (dim>0) patches[0].vertices[vertex_number](0) = -1. + 2.*ix; + if (dim>1) patches[0].vertices[vertex_number](1) = -1. + 2.*iy; + if (dim>2) patches[0].vertices[vertex_number](2) = -1. + 2.*iz; + ++vertex_number; + } + for (unsigned int i=0;i::faces_per_cell;++i) + patches[0].neighbors[i] = deal_II_numbers::invalid_unsigned_int; + patches[0].patch_index = 0; + patches[0].n_subdivisions = sub; + patches[0].points_are_available = false; + + vertex_number = 1; + for (unsigned int d=0;d > points(vertex_number); + const double h = 2./sub; + vertex_number = 0; + for (unsigned int iz=0;iz <= ((dim>2) ? sub : 0) ;++iz) + for (unsigned int iy=0;iy <= ((dim>1) ? sub : 0) ;++iy) + for (unsigned int ix=0;ix <= sub ;++ix) + { + if (dim>0) points[vertex_number](0) = -1.+ix*h; + if (dim>1) points[vertex_number](1) = -1.+iy*h; + if (dim>2) points[vertex_number](2) = -1.+iz*h; + ++vertex_number; + } + + std::vector > values(points.size(), Vector(f.n_components)); + f.vector_value_list(points, values); + for (unsigned int i=0;i names(f.n_components); + for (unsigned int i=0;i f(.8, 10.); + check_function(f, 4, logfile); + } + if (true) + { + Functions::PoisseuilleFlow<3> f(.8, 10.); + check_function(f, 4, logfile); + } +} diff --git a/tests/base/functions_01/cmp/generic b/tests/base/functions_01/cmp/generic new file mode 100644 index 0000000000..01fbcb7219 --- /dev/null +++ b/tests/base/functions_01/cmp/generic @@ -0,0 +1,406 @@ +object "vertices" class array type float rank 1 shape 2 items 25 data follows +-1 -1 +-0.5 -1 +0 -1 +0.5 -1 +1 -1 +-1 -0.5 +-0.5 -0.5 +0 -0.5 +0.5 -0.5 +1 -0.5 +-1 0 +-0.5 0 +0 0 +0.5 0 +1 0 +-1 0.5 +-0.5 0.5 +0 0.5 +0.5 0.5 +1 0.5 +-1 1 +-0.5 1 +0 1 +0.5 1 +1 1 +object "cells" class array type int rank 1 shape 4 items 16 data follows +0 5 1 6 +1 6 2 7 +2 7 3 8 +3 8 4 9 +5 10 6 11 +6 11 7 12 +7 12 8 13 +8 13 9 14 +10 15 11 16 +11 16 12 17 +12 17 13 18 +13 18 14 19 +15 20 16 21 +16 21 17 22 +17 22 18 23 +18 23 19 24 + +attribute "element type" string "quads" +attribute "ref" string "positions" +object "data" class array type float rank 1 shape 3 items 25 data follows + -0.5625 0 0.3125 + -0.5625 0 0.15625 + -0.5625 0 0 + -0.5625 0 -0.15625 + -0.5625 0 -0.3125 + 0.609375 0 0.3125 + 0.609375 0 0.15625 + 0.609375 0 0 + 0.609375 0 -0.15625 + 0.609375 0 -0.3125 + 1 0 0.3125 + 1 0 0.15625 + 1 0 0 + 1 0 -0.15625 + 1 0 -0.3125 + 0.609375 0 0.3125 + 0.609375 0 0.15625 + 0.609375 0 0 + 0.609375 0 -0.15625 + 0.609375 0 -0.3125 + -0.5625 0 0.3125 + -0.5625 0 0.15625 + -0.5625 0 0 + -0.5625 0 -0.15625 + -0.5625 0 -0.3125 +attribute "dep" string "positions" +object "deal data" class field +component "positions" value "vertices" +component "connections" value "cells" +component "data" value "data" +attribute +end +object "vertices" class array type float rank 1 shape 3 items 125 data follows +-1 -1 -1 +-0.5 -1 -1 +0 -1 -1 +0.5 -1 -1 +1 -1 -1 +-1 -0.5 -1 +-0.5 -0.5 -1 +0 -0.5 -1 +0.5 -0.5 -1 +1 -0.5 -1 +-1 0 -1 +-0.5 0 -1 +0 0 -1 +0.5 0 -1 +1 0 -1 +-1 0.5 -1 +-0.5 0.5 -1 +0 0.5 -1 +0.5 0.5 -1 +1 0.5 -1 +-1 1 -1 +-0.5 1 -1 +0 1 -1 +0.5 1 -1 +1 1 -1 +-1 -1 -0.5 +-0.5 -1 -0.5 +0 -1 -0.5 +0.5 -1 -0.5 +1 -1 -0.5 +-1 -0.5 -0.5 +-0.5 -0.5 -0.5 +0 -0.5 -0.5 +0.5 -0.5 -0.5 +1 -0.5 -0.5 +-1 0 -0.5 +-0.5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 11 36 +6 31 11 36 7 32 12 37 +7 32 12 37 8 33 13 38 +8 33 13 38 9 34 14 39 +10 35 15 40 11 36 16 41 +11 36 16 41 12 37 17 42 +12 37 17 42 13 38 18 43 +13 38 18 43 14 39 19 44 +15 40 20 45 16 41 21 46 +16 41 21 46 17 42 22 47 +17 42 22 47 18 43 23 48 +18 43 23 48 19 44 24 49 +25 50 30 55 26 51 31 56 +26 51 31 56 27 52 32 57 +27 52 32 57 28 53 33 58 +28 53 33 58 29 54 34 59 +30 55 35 60 31 56 36 61 +31 56 36 61 32 57 37 62 +32 57 37 62 33 58 38 63 +33 58 38 63 34 59 39 64 +35 60 40 65 36 61 41 66 +36 61 41 66 37 62 42 67 +37 62 42 67 38 63 43 68 +38 63 43 68 39 64 44 69 +40 65 45 70 41 66 46 71 +41 66 46 71 42 67 47 72 +42 67 47 72 43 68 48 73 +43 68 48 73 44 69 49 74 +50 75 55 80 51 76 56 81 +51 76 56 81 52 77 57 82 +52 77 57 82 53 78 58 83 +53 78 58 83 54 79 59 84 +55 80 60 85 56 81 61 86 +56 81 61 86 57 82 62 87 +57 82 62 87 58 83 63 88 +58 83 63 88 59 84 64 89 +60 85 65 90 61 86 66 91 +61 86 66 91 62 87 67 92 +62 87 67 92 63 88 68 93 +63 88 68 93 64 89 69 94 +65 90 70 95 66 91 71 96 +66 91 71 96 67 92 72 97 +67 92 72 97 68 93 73 98 +68 93 73 98 69 94 74 99 +75 100 80 105 76 101 81 106 +76 101 81 106 77 102 82 107 +77 102 82 107 78 103 83 108 +78 103 83 108 79 104 84 109 +80 105 85 110 81 106 86 111 +81 106 86 111 82 107 87 112 +82 107 87 112 83 108 88 113 +83 108 88 113 84 109 89 114 +85 110 90 115 86 111 91 116 +86 111 91 116 87 112 92 117 +87 112 92 117 88 113 93 118 +88 113 93 118 89 114 94 119 +90 115 95 120 91 116 96 121 +91 116 96 121 92 117 97 122 +92 117 97 122 93 118 98 123 +93 118 98 123 94 119 99 124 + +attribute "element type" string "cubes" +attribute "ref" string "positions" +object "data" class array type float rank 1 shape 4 items 125 data follows + -2.125 0 0 0.625 + -2.125 0 0 0.3125 + -2.125 0 0 0 + -2.125 0 0 -0.3125 + -2.125 0 0 -0.625 + -0.953125 0 0 0.625 + -0.953125 0 0 0.3125 + -0.953125 0 0 0 + -0.953125 0 0 -0.3125 + -0.953125 0 0 -0.625 + -0.5625 0 0 0.625 + -0.5625 0 0 0.3125 + -0.5625 0 0 0 + -0.5625 0 0 -0.3125 + -0.5625 0 0 -0.625 + -0.953125 0 0 0.625 + -0.953125 0 0 0.3125 + -0.953125 0 0 0 + -0.953125 0 0 -0.3125 + -0.953125 0 0 -0.625 + -2.125 0 0 0.625 + -2.125 0 0 0.3125 + -2.125 0 0 0 + -2.125 0 0 -0.3125 + -2.125 0 0 -0.625 + -0.953125 0 0 0.625 + -0.953125 0 0 0.3125 + -0.953125 0 0 0 + -0.953125 0 0 -0.3125 + -0.953125 0 0 -0.625 + 0.21875 0 0 0.625 + 0.21875 0 0 0.3125 + 0.21875 0 0 0 + 0.21875 0 0 -0.3125 + 0.21875 0 0 -0.625 + 0.609375 0 0 0.625 + 0.609375 0 0 0.3125 + 0.609375 0 0 0 + 0.609375 0 0 -0.3125 + 0.609375 0 0 -0.625 + 0.21875 0 0 0.625 + 0.21875 0 0 0.3125 + 0.21875 0 0 0 + 0.21875 0 0 -0.3125 + 0.21875 0 0 -0.625 + -0.953125 0 0 0.625 + -0.953125 0 0 0.3125 + -0.953125 0 0 0 + -0.953125 0 0 -0.3125 + -0.953125 0 0 -0.625 + -0.5625 0 0 0.625 + -0.5625 0 0 0.3125 + -0.5625 0 0 0 + -0.5625 0 0 -0.3125 + -0.5625 0 0 -0.625 + 0.609375 0 0 0.625 + 0.609375 0 0 0.3125 + 0.609375 0 0 0 + 0.609375 0 0 -0.3125 + 0.609375 0 0 -0.625 + 1 0 0 0.625 + 1 0 0 0.3125 + 1 0 0 0 + 1 0 0 -0.3125 + 1 0 0 -0.625 + 0.609375 0 0 0.625 + 0.609375 0 0 0.3125 + 0.609375 0 0 0 + 0.609375 0 0 -0.3125 + 0.609375 0 0 -0.625 + -0.5625 0 0 0.625 + -0.5625 0 0 0.3125 + -0.5625 0 0 0 + -0.5625 0 0 -0.3125 + -0.5625 0 0 -0.625 + -0.953125 0 0 0.625 + -0.953125 0 0 0.3125 + -0.953125 0 0 0 + -0.953125 0 0 -0.3125 + -0.953125 0 0 -0.625 + 0.21875 0 0 0.625 + 0.21875 0 0 0.3125 + 0.21875 0 0 0 + 0.21875 0 0 -0.3125 + 0.21875 0 0 -0.625 + 0.609375 0 0 0.625 + 0.609375 0 0 0.3125 + 0.609375 0 0 0 + 0.609375 0 0 -0.3125 + 0.609375 0 0 -0.625 + 0.21875 0 0 0.625 + 0.21875 0 0 0.3125 + 0.21875 0 0 0 + 0.21875 0 0 -0.3125 + 0.21875 0 0 -0.625 + -0.953125 0 0 0.625 + -0.953125 0 0 0.3125 + -0.953125 0 0 0 + -0.953125 0 0 -0.3125 + -0.953125 0 0 -0.625 + -2.125 0 0 0.625 + -2.125 0 0 0.3125 + -2.125 0 0 0 + -2.125 0 0 -0.3125 + -2.125 0 0 -0.625 + -0.953125 0 0 0.625 + -0.953125 0 0 0.3125 + -0.953125 0 0 0 + -0.953125 0 0 -0.3125 + -0.953125 0 0 -0.625 + -0.5625 0 0 0.625 + -0.5625 0 0 0.3125 + -0.5625 0 0 0 + -0.5625 0 0 -0.3125 + -0.5625 0 0 -0.625 + -0.953125 0 0 0.625 + -0.953125 0 0 0.3125 + -0.953125 0 0 0 + -0.953125 0 0 -0.3125 + -0.953125 0 0 -0.625 + -2.125 0 0 0.625 + -2.125 0 0 0.3125 + -2.125 0 0 0 + -2.125 0 0 -0.3125 + -2.125 0 0 -0.625 +attribute "dep" string "positions" +object "deal data" class field +component "positions" value "vertices" +component "connections" value "cells" +component "data" value "data" +attribute +end -- 2.39.5