Commit 004b0d87 authored by Marcus Mohr's avatar Marcus Mohr
Browse files

Starts a new terraneo module

As discussed in the last developer meeting it is time, in light of soon to
come extensions, to start with a separate terraneo module. This is intended
to house code specifically addressing the needs of running mantle convection
models with HyTeG.

This commit starts with the new module and relocates the
SphericalHarmonicsTool into it.
parent adba0cff
Pipeline #39538 passed with stages
in 149 minutes and 42 seconds
/*
* Copyright (c) 2017-2020 Nils Kohl.
* Copyright (c) 2017-2022 Nils Kohl, Marcus Mohr.
*
* This file is part of HyTeG
* (see https://i10git.cs.fau.de/hyteg/hyteg).
......@@ -43,7 +43,6 @@
#include "hyteg/memory/MemoryAllocation.hpp"
#include "hyteg/mesh/MeshInfo.hpp"
#include "hyteg/numerictools/CFDHelpers.hpp"
#include "hyteg/numerictools/SphericalHarmonicsTool.hpp"
#include "hyteg/p1functionspace/P1ConstantOperator.hpp"
#include "hyteg/p2functionspace/P2ConstantOperator.hpp"
#include "hyteg/p2functionspace/P2Function.hpp"
......@@ -71,6 +70,7 @@
#include "coupling_hyteg_convection_particles/MMOCTransport.hpp"
#include "sqlite/SQLite.h"
#include "terraneo/sphericalharmonics/SphericalHarmonicsTool.hpp"
namespace hyteg {
......@@ -78,6 +78,8 @@ using walberla::int_c;
using walberla::real_t;
using walberla::math::pi;
using terraneo::SphericalHarmonicsTool;
#if 0
static std::string getDateTimeID()
{
......@@ -209,7 +211,7 @@ void calculateStokesResiduals( const StokesOperator& A,
tmp.interpolate( 0, level, All );
r.interpolate( 0, level, All );
A.apply( x, tmp, level, Inner | NeumannBoundary | FreeslipBoundary );
r.assign( { 1.0, -1.0 }, { b, tmp }, level, Inner | NeumannBoundary | FreeslipBoundary );
r.assign( {1.0, -1.0}, {b, tmp}, level, Inner | NeumannBoundary | FreeslipBoundary );
residual = normL2Squared( r.uvw()[0], tmp.uvw()[0], Mu, level, Inner | NeumannBoundary | FreeslipBoundary );
residual += normL2Squared( r.uvw()[1], tmp.uvw()[1], Mu, level, Inner | NeumannBoundary | FreeslipBoundary );
if ( x.getStorage()->hasGlobalCells() )
......@@ -513,7 +515,7 @@ void runBenchmark( real_t cflMax,
for ( uint_t l = minLevel; l <= level; l++ )
{
outwardNormal.uvw().interpolate( { normalX, normalY, normalZ }, l );
outwardNormal.uvw().interpolate( {normalX, normalY, normalZ}, l );
}
if ( verbose )
......@@ -861,8 +863,8 @@ void runBenchmark( real_t cflMax,
MVelocity.apply( c, f.uvw()[2], l, All );
}
f.uvw().multElementwise( { f.uvw(), outwardNormal.uvw() }, l );
f.uvw().assign( { rayleighNumber }, { f.uvw() }, l, All );
f.uvw().multElementwise( {f.uvw(), outwardNormal.uvw()}, l );
f.uvw().assign( {rayleighNumber}, {f.uvw()}, l, All );
}
calculateStokesResiduals( *A, MVelocity, MPressure, u, f, level, stokesResidual, stokesTmp, residualU );
......@@ -986,16 +988,16 @@ void runBenchmark( real_t cflMax,
// advection
// start value for predictor
cPr.assign( { 1.0 }, { c }, level, All );
cPr.assign( {1.0}, {c}, level, All );
// let's just use the current velocity for the prediction
uLast.assign( { 1.0 }, { u }, level, All );
uLast.assign( {1.0}, {u}, level, All );
// diffusion
cPr.interpolate( initialTemperature, level, DirichletBoundary );
cOld.assign( { 1.0 }, { cPr }, level, All );
cOld.assign( {1.0}, {cPr}, level, All );
diffusionOperator.setDt( 0.5 * dt );
......@@ -1021,7 +1023,7 @@ void runBenchmark( real_t cflMax,
cPr.interpolate( initialTemperature, level, DirichletBoundary );
cOld.assign( { 1.0 }, { cPr }, level, All );
cOld.assign( {1.0}, {cPr}, level, All );
calculateDiffusionResidual(
diffusionSolver, diffusionOperator, L, MVelocity, cPr, cOld, q, cTmp, cTmp2, level, vCycleResidualCLast );
......@@ -1042,8 +1044,8 @@ void runBenchmark( real_t cflMax,
MVelocity.apply( cPr, f.uvw()[2], l, All );
}
f.uvw().multElementwise( { f.uvw(), outwardNormal.uvw() }, l );
f.uvw().assign( { rayleighNumber }, { f.uvw() }, l, All );
f.uvw().multElementwise( {f.uvw(), outwardNormal.uvw()}, l );
f.uvw().assign( {rayleighNumber}, {f.uvw()}, l, All );
}
calculateStokesResiduals( *A, MVelocity, MPressure, u, f, level, stokesResidual, stokesTmp, residualU );
......@@ -1073,7 +1075,7 @@ void runBenchmark( real_t cflMax,
c.interpolate( initialTemperature, level, DirichletBoundary );
cOld.assign( { 1.0 }, { c }, level, All );
cOld.assign( {1.0}, {c}, level, All );
calculateDiffusionResidual(
diffusionSolver, diffusionOperator, L, MVelocity, c, cOld, q, cTmp, cTmp2, level, vCycleResidualCLast );
......@@ -1095,7 +1097,7 @@ void runBenchmark( real_t cflMax,
c.interpolate( initialTemperature, level, DirichletBoundary );
cOld.assign( { 1.0 }, { c }, level, All );
cOld.assign( {1.0}, {c}, level, All );
calculateDiffusionResidual(
diffusionSolver, diffusionOperator, L, MVelocity, c, cOld, q, cTmp, cTmp2, level, vCycleResidualCLast );
......@@ -1117,8 +1119,8 @@ void runBenchmark( real_t cflMax,
MVelocity.apply( c, f.uvw()[2], l, All );
}
f.uvw().multElementwise( { f.uvw(), outwardNormal.uvw() }, l );
f.uvw().assign( { rayleighNumber }, { f.uvw() }, l, All );
f.uvw().multElementwise( {f.uvw(), outwardNormal.uvw()}, l );
f.uvw().assign( {rayleighNumber}, {f.uvw()}, l, All );
}
calculateStokesResiduals( *A, MVelocity, MPressure, u, f, level, stokesResidual, stokesTmp, residualU );
......@@ -1143,7 +1145,7 @@ void runBenchmark( real_t cflMax,
else
{
// use predicted value
c.assign( { 1.0 }, { cPr }, level, All );
c.assign( {1.0}, {cPr}, level, All );
db.setVariableEntry( "initial_residual_u_corrector", real_c( 0 ) );
db.setVariableEntry( "num_v_cycles_corrector", real_c( 0 ) );
......
/*
* Copyright (c) 2017-2020 Dominik Thoennes, Nils Kohl, Marcus Mohr.
* Copyright (c) 2017-2022 Dominik Thoennes, Nils Kohl, Marcus Mohr.
*
* This file is part of HyTeG
* (see https://i10git.cs.fau.de/hyteg/hyteg).
......@@ -44,13 +44,15 @@
#include "hyteg/functions/FunctionProperties.hpp"
#include "hyteg/geometry/IcosahedralShellMap.hpp"
#include "hyteg/mesh/MeshInfo.hpp"
#include "hyteg/numerictools/SphericalHarmonicsTool.hpp"
#include "hyteg/primitivestorage/PrimitiveStorage.hpp"
#include "hyteg/primitivestorage/SetupPrimitiveStorage.hpp"
#include "hyteg/primitivestorage/Visualization.hpp"
#include "hyteg/primitivestorage/loadbalancing/DistributedBalancer.hpp"
#include "hyteg/primitivestorage/loadbalancing/SimpleBalancer.hpp"
#include "terraneo/sphericalharmonics/SphericalHarmonicsTool.hpp"
using terraneo::SphericalHarmonicsTool;
using walberla::real_c;
using walberla::real_t;
using namespace hyteg;
......@@ -145,7 +147,7 @@ int main( int argc, char* argv[] )
std::shared_ptr< SphericalHarmonicsTool > sphTool = std::make_shared< SphericalHarmonicsTool >( lmax );
// describe eigenfunction
real_t besselRoot = roots[degree][nroot-1];
real_t besselRoot = roots[degree][nroot - 1];
std::function< real_t( const Point3D& ) > eigenFunction = [sphTool, degree, order, besselRoot, outerRad]( const Point3D& x ) {
real_t sph = sphTool->shconvert_eval( degree, order, x[0], x[1], x[2] );
real_t rad = std::sqrt( x[0] * x[0] + x[1] * x[1] + x[2] * x[2] );
......
/*
* Copyright (c) 2017-2019 Dominik Thoennes, Nils Kohl.
* Copyright (c) 2017-2022 Dominik Thoennes, Nils Kohl, Marcus Mohr.
*
* This file is part of HyTeG
* (see https://i10git.cs.fau.de/hyteg/hyteg).
......@@ -28,13 +28,15 @@
#include "hyteg/functions/FunctionProperties.hpp"
#include "hyteg/geometry/IcosahedralShellMap.hpp"
#include "hyteg/mesh/MeshInfo.hpp"
#include "hyteg/numerictools/SphericalHarmonicsTool.hpp"
#include "hyteg/primitivestorage/PrimitiveStorage.hpp"
#include "hyteg/primitivestorage/SetupPrimitiveStorage.hpp"
#include "hyteg/primitivestorage/Visualization.hpp"
#include "hyteg/primitivestorage/loadbalancing/DistributedBalancer.hpp"
#include "hyteg/primitivestorage/loadbalancing/SimpleBalancer.hpp"
#include "terraneo/sphericalharmonics/SphericalHarmonicsTool.hpp"
using terraneo::SphericalHarmonicsTool;
using walberla::real_c;
using walberla::real_t;
using namespace hyteg;
......
/*
* Copyright (c) 2020 Marcus Mohr
* Copyright (c) 2020 - 2022 Marcus Mohr
*
* This file is part of HyTeG
* (see https://i10git.cs.fau.de/hyteg/hyteg).
......@@ -50,7 +50,6 @@ This app implements the Stokes benchmark described in:
#include "hyteg/geometry/IcosahedralShellMap.hpp"
#include "hyteg/gridtransferoperators/P2toP2QuadraticProlongation.hpp"
#include "hyteg/mesh/MeshInfo.hpp"
#include "hyteg/numerictools/SphericalHarmonicsTool.hpp"
#include "hyteg/p1functionspace/P1ProjectNormalOperator.hpp"
#include "hyteg/p2functionspace/P2ProjectNormalOperator.hpp"
#include "hyteg/petsc/PETScBlockPreconditionedStokesSolver.hpp"
......@@ -65,10 +64,14 @@ This app implements the Stokes benchmark described in:
#include "hyteg/primitivestorage/loadbalancing/SimpleBalancer.hpp"
#include "hyteg/solvers/solvertemplates/StokesSolverTemplates.hpp"
#include "terraneo/sphericalharmonics/SphericalHarmonicsTool.hpp"
using walberla::real_c;
using walberla::real_t;
using namespace hyteg;
using terraneo::SphericalHarmonicsTool;
#include "bmark_tools.hpp"
// radii of spherical shell
......@@ -345,9 +348,9 @@ void runBenchmarkTests( std::shared_ptr< walberla::config::Config > cfg,
int main( int argc, char* argv[] )
{
#ifndef __APPLE__
#ifndef _MSC_VER
feenableexcept( FE_DIVBYZERO | FE_INVALID | FE_OVERFLOW );
#endif
#ifndef _MSC_VER
feenableexcept( FE_DIVBYZERO | FE_INVALID | FE_OVERFLOW );
#endif
#endif
walberla::Environment env( argc, argv );
......
......@@ -35,7 +35,6 @@
#include "hyteg/geometry/IcosahedralShellMap.hpp"
#include "hyteg/gridtransferoperators/P2toP2QuadraticProlongation.hpp"
#include "hyteg/mesh/MeshInfo.hpp"
#include "hyteg/numerictools/SphericalHarmonicsTool.hpp"
#include "hyteg/p2functionspace/P2ProjectNormalOperator.hpp"
#include "hyteg/p2functionspace/P2VectorFunction.hpp"
#include "hyteg/petsc/PETScBlockPreconditionedStokesSolver.hpp"
......
/*
* Copyright (c) 2017-2019 Dominik Thoennes, Nils Kohl.
* Copyright (c) 2017-2022 Dominik Thoennes, Nils Kohl, Marcus Mohr.
*
* This file is part of HyTeG
* (see https://i10git.cs.fau.de/hyteg/hyteg).
......@@ -29,7 +29,6 @@
#include "hyteg/functions/FunctionProperties.hpp"
#include "hyteg/geometry/IcosahedralShellMap.hpp"
#include "hyteg/mesh/MeshInfo.hpp"
#include "hyteg/numerictools/SphericalHarmonicsTool.hpp"
#include "hyteg/operators/VectorLaplaceOperator.hpp"
#include "hyteg/primitivestorage/PrimitiveStorage.hpp"
#include "hyteg/primitivestorage/SetupPrimitiveStorage.hpp"
......@@ -37,6 +36,9 @@
#include "hyteg/primitivestorage/loadbalancing/DistributedBalancer.hpp"
#include "hyteg/primitivestorage/loadbalancing/SimpleBalancer.hpp"
#include "terraneo/sphericalharmonics/SphericalHarmonicsTool.hpp"
using terraneo::SphericalHarmonicsTool;
using walberla::real_c;
using walberla::real_t;
using walberla::math::pi;
......
add_subdirectory( hyteg )
add_subdirectory( convection_particles )
add_subdirectory( coupling_hyteg_convection_particles )
add_subdirectory( terraneo )
target_sources( hyteg
PRIVATE
SphericalHarmonicsTool.cpp
CFDHelpers.hpp
SpectrumEstimation.hpp
SphericalHarmonicsTool.hpp
)
################################################################################
#
# Module for mantle convection simulations based on HyTeG
#
################################################################################
add_library( terraneo )
target_link_libraries( terraneo PUBLIC core hyteg )
# target_sources( terraneo )
add_subdirectory( sphericalharmonics )
target_sources( hyteg
PRIVATE
SphericalHarmonicsTool.cpp
SphericalHarmonicsTool.hpp
)
#include "hyteg/numerictools/SphericalHarmonicsTool.hpp"
#include "terraneo/sphericalharmonics/SphericalHarmonicsTool.hpp"
#include "core/debug/Debug.h"
#include "core/logging/Logging.h"
namespace hyteg {
namespace terraneo {
using walberla::real_c;
using walberla::uint_t;
......@@ -619,4 +619,4 @@ real_t SphericalHarmonicsTool::evalVSH( uint_t deg, int ord, real_t x, real_t y,
return retVal;
}
} // namespace hyteg
} // namespace terraneo
......@@ -3,7 +3,7 @@
#include "core/DataTypes.h"
namespace hyteg {
namespace terraneo {
using walberla::real_t;
using walberla::uint_t;
......@@ -268,4 +268,4 @@ class SphericalHarmonicsTool
real_t evalVSH( uint_t deg, int ord, real_t x, real_t y, real_t z, uint_t ind, uint_t comp );
};
} // namespace hyteg
} // namespace terraneo
Markdown is supported
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