Skip to content
Snippets Groups Projects
Commit f32dffc8 authored by Nils Kohl's avatar Nils Kohl :full_moon_with_face:
Browse files

Added a dedicated P2Vector epsilon op blending test in 2D (testing combination...

Added a dedicated P2Vector epsilon op blending test in 2D (testing combination vectorspace + blending).
parent b3af983a
Branches
Tags
1 merge request!2Vector operators
Pipeline #66362 passed with warnings with stages
in 25 minutes and 47 seconds
...@@ -37,35 +37,6 @@ endfunction() ...@@ -37,35 +37,6 @@ endfunction()
# tests without blending # tests without blending
add_operator_test(FILE CurlCurl.cpp DEF TEST_ASSEMBLE FORM CurlCurl ABBR noopts GEN_ARGS --quad-degree 0 0)
add_operator_test(FILE CurlCurl.cpp FORM CurlCurl ABBR VIQ GEN_ARGS --quad-degree 0 0 -o MOVECONSTANTS VECTORIZE QUADLOOPS)
add_operator_test(FILE CurlCurl.cpp FORM CurlCurl ABBR CVIP GEN_ARGS --quad-degree 0 0 --loop-strategy CUBES -o MOVECONSTANTS VECTORIZE POLYCSE)
add_operator_test(FILE CurlCurlPlusMass.cpp DEF TEST_ASSEMBLE FORM CurlCurlPlusMass ABBR noopts GEN_ARGS --quad-degree 2 2) add_operator_test(FILE EpsilonVector.cpp DEF FORM Epsilon ABBR VecVIQT GEN_ARGS -s P2Vector -o MOVECONSTANTS QUADLOOPS TABULATE --quad-degree 2 2 --dimensions 2 LIBS constant_stencil_operator)
add_operator_test(FILE CurlCurlPlusMass.cpp FORM CurlCurlPlusMass ABBR VI GEN_ARGS --quad-degree 2 2 -o MOVECONSTANTS VECTORIZE) add_operator_test(FILE EpsilonVectorAnnulus.cpp DEF FORM Epsilon ABBR VecbVIQT GEN_ARGS -s P2Vector -b AnnulusMap -o MOVECONSTANTS QUADLOOPS TABULATE --quad-degree 2 2 --dimensions 2 LIBS constant_stencil_operator)
add_operator_test(FILE DiffusionP1.cpp DEF TEST_ASSEMBLE FORM Diffusion ABBR 1 GEN_ARGS -s P1 --quad-degree 0 0)
add_operator_test(FILE DiffusionP1.cpp FORM Diffusion ABBR 1VIP GEN_ARGS -s P1 --quad-degree 0 0 -o MOVECONSTANTS VECTORIZE POLYCSE)
add_operator_test(FILE DiffusionP1.cpp FORM Diffusion ABBR 1CVI GEN_ARGS -s P1 --quad-degree 0 0 --loop-strategy CUBES -o MOVECONSTANTS VECTORIZE)
add_operator_test(FILE DiffusionP2.cpp DEF TEST_ASSEMBLE FORM Diffusion ABBR 2 GEN_ARGS -s P2 --quad-degree 2 2)
add_operator_test(FILE DiffusionP1Vector.cpp DEF TEST_ASSEMBLE FORM Diffusion ABBR 1Vec GEN_ARGS -s P1Vector --quad-degree 0 0 LIBS mixed_operator)
add_operator_test(FILE DivKGrad.cpp DEF TEST_ASSEMBLE FORM DivKGrad ABBR noopts GEN_ARGS -s P2 --quad-degree 4 4)
add_operator_test(FILE DivKGrad.cpp FORM DivKGrad ABBR VIQ GEN_ARGS -s P2 --quad-degree 4 4 -o MOVECONSTANTS VECTORIZE QUADLOOPS )
add_operator_test(FILE DivKGrad.cpp DEF TEST_ASSEMBLE FORM DivKGrad ABBR IQT GEN_ARGS -s P2 --quad-degree 4 4 -o MOVECONSTANTS QUADLOOPS TABULATE )
add_operator_test(FILE Div.cpp DEF REF_OP=P2ToP1ElementwiseDivxOperator FORM Div_0 ABBR VIQT GEN_ARGS -s P2ToP1 -o MOVECONSTANTS QUADLOOPS TABULATE VECTORIZE --quad-degree 2 2)
add_operator_test(FILE DivT.cpp DEF REF_OP=P1ToP2ElementwiseDivTzOperator FORM DivT_2 ABBR VIQT GEN_ARGS -s P1ToP2 -o MOVECONSTANTS QUADLOOPS TABULATE VECTORIZE --quad-degree 2 2)
add_operator_test(FILE Epsilon.cpp DEF TEST_DIAG FORM=forms::p2_epsilonvar_0_0_affine_q4 FORM Epsilon_0_0 ABBR 00VIQT GEN_ARGS -s P2 -o MOVECONSTANTS QUADLOOPS TABULATE VECTORIZE --quad-degree 4 4 )
add_operator_test(FILE Epsilon.cpp DEF FORM=forms::p2_epsilonvar_2_1_affine_q4 FORM Epsilon_2_1 ABBR 21VIQT GEN_ARGS -s P2 -o MOVECONSTANTS QUADLOOPS TABULATE VECTORIZE --quad-degree 4 4 )
add_operator_test(FILE EpsilonVector.cpp DEF FORM Epsilon ABBR VecVIQT GEN_ARGS -s P2Vector -o MOVECONSTANTS QUADLOOPS TABULATE VECTORIZE --quad-degree 2 2 --dimensions 2 LIBS constant_stencil_operator)
# tests with blending
add_operator_test(FILE DiffusionP1Annulus.cpp DEF TEST_ASSEMBLE FORM Diffusion ABBR b2 GEN_ARGS -s P1 -b AnnulusMap --quad-rule hillion_07 yu_3)
add_operator_test(FILE DiffusionP1Annulus.cpp FORM Diffusion ABBR b2VIQT GEN_ARGS -s P1 -b AnnulusMap -o MOVECONSTANTS QUADLOOPS TABULATE VECTORIZE --quad-rule hillion_07 yu_3)
add_operator_test(FILE DiffusionP1IcosahedralShell.cpp FORM Diffusion ABBR b3VIQT GEN_ARGS -s P1 -b IcosahedralShellMap -o MOVECONSTANTS QUADLOOPS TABULATE VECTORIZE --quad-rule hillion_07 yu_3)
add_operator_test(FILE FullStokes.cpp DEF TEST_DIAG FORM=forms::p2_full_stokesvar_0_0_blending_q3 FORM FullStokes_0_0 ABBR 00b3VIQT GEN_ARGS -s P2 -b IcosahedralShellMap -o MOVECONSTANTS QUADLOOPS TABULATE VECTORIZE --quad-rule yu_3 yu_3)
add_operator_test(FILE FullStokes.cpp DEF FORM=forms::p2_full_stokesvar_2_1_blending_q3 FORM FullStokes_2_1 ABBR 21b3VIQT GEN_ARGS -s P2 -b IcosahedralShellMap -o MOVECONSTANTS QUADLOOPS TABULATE VECTORIZE --quad-rule yu_3 yu_3)
/*
* HyTeG Operator Generator
* Copyright (C) 2017-2024 Nils Kohl, Fabian Böhm, Daniel Bauer
*
* 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 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include <type_traits>
#include "core/DataTypes.h"
#include "hyteg/elementwiseoperators/P2ElementwiseOperator.hpp"
#include "constant_stencil_operator/P2ConstantEpsilonOperator.hpp"
#include "hyteg/forms/form_hyteg_generated/p2/p2_epsilonvar_affine_q4.hpp"
#include "hyteg/p2functionspace/P2Function.hpp"
#include "Epsilon/TestOpEpsilon.hpp"
#include "OperatorGenerationTest.hpp"
using namespace hyteg;
using walberla::real_t;
real_t k( const hyteg::Point3D& x )
{
// The operator also works with a non-constant viscosity.
// However, the reference operator seems to have such a low quadrature order that the difference between the
// reference and generated operator is relatively large.
// Under refinement that error vanishes, but not quickly enough that we can afford refinement in this (quick) test.
// For simplicity, the viscosity is therefore set to 1 here, such that the comparison succeeds (just blending, no var
// viscosity). Note that there is a dedicated test with a variable viscosity, but without blending.
return 1.0;
}
P2ElementwiseBlendingEpsilonOperator makeRefOp( std::shared_ptr< PrimitiveStorage > storage, uint_t minLevel, uint_t maxLevel )
{
return P2ElementwiseBlendingEpsilonOperator( storage, minLevel, maxLevel, k );
};
template < class Op >
Op makeTestOp( std::shared_ptr< PrimitiveStorage > storage, uint_t minLevel, uint_t maxLevel )
{
P2Function< real_t > k( "k", storage, minLevel, maxLevel );
for ( size_t lvl = minLevel; lvl <= maxLevel; ++lvl )
{
k.interpolate( ::k, lvl );
}
return Op( storage, minLevel, maxLevel, k );
};
int main( int argc, char* argv[] )
{
walberla::MPIManager::instance()->initializeMPI( &argc, &argv );
walberla::MPIManager::instance()->useWorldComm();
const uint_t level = 3;
real_t thresholdOverMachineEpsApply = 2e3;
real_t thresholdOverMachineEpsInvDiag = 9.0e6;
real_t thresholdOverMachineEpsAssembly = 360;
// Testing only 2D since generation of 3D operator just takes too long.
StorageSetup storageSetup(
"Annulus", MeshInfo::meshAnnulus( 1.0, 2.0, MeshInfo::CRISS, 12, 2 ), GeometryMap::Type::ANNULUS );
compareApply< P2ElementwiseBlendingEpsilonOperator, operatorgeneration::TestOpEpsilon >(
makeRefOp,
makeTestOp< operatorgeneration::TestOpEpsilon >,
level,
storageSetup,
storageSetup.description() + " Apply",
thresholdOverMachineEpsApply );
#ifdef TEST_DIAG
compareInvDiag< P2Function< real_t >, P2ElementwiseBlendingEpsilonOperator, operatorgeneration::TestOpEpsilon >(
makeRefOp,
makeTestOp< operatorgeneration::TestOpEpsilon >,
level,
storageSetup,
storageSetup.description() + " Inverse Diagonal",
thresholdOverMachineEpsInvDiag );
#endif
#ifdef TEST_ASSEMBLE
compareAssembledMatrix< P2ElementwiseBlendingEpsilonOperator, operatorgeneration::TestOpEpsilon >(
makeRefOp,
makeTestOp< operatorgeneration::TestOpEpsilon >,
level,
storageSetup,
storageSetup.description() + " Assembly",
thresholdOverMachineEpsAssembly );
#endif
return EXIT_SUCCESS;
}
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment