Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
hyteg
hyteg
Commits
c4dce15e
Commit
c4dce15e
authored
Sep 30, 2021
by
Marcus Mohr
Browse files
Merge branch 'thoennes/remove-petscint'
Additionally replaces all matIdx_t by idx_t
parents
c8581361
48d53aef
Changes
149
Hide whitespace changes
Inline
Side-by-side
apps/2021-tokamak/Tokamak.cpp
View file @
c4dce15e
...
...
@@ -551,7 +551,7 @@ void tokamak( TokamakDomain tokamakDomain,
{
const
auto
relativeResidualToleranceCoarseGrid
=
1e-30
;
const
auto
absoluteResidualToleranceCoarseGrid
=
1e-12
;
const
auto
maxIterationsCoarseGrid
=
static_cast
<
PetscIn
t
>
(
solverSettings
.
maxCoarseGridSolverIterations
);
const
auto
maxIterationsCoarseGrid
=
static_cast
<
idx_
t
>
(
solverSettings
.
maxCoarseGridSolverIterations
);
auto
actualCoarseGridSolver
=
std
::
make_shared
<
PETScCGSolver
<
LaplaceOperator_T
>
>
(
storage
,
minLevel
,
...
...
apps/StokesFlowSolverComparison.cpp
View file @
c4dce15e
...
...
@@ -100,7 +100,7 @@ public:
storage_
(
storage
),
velocityUBC_
(
velocityUBC
),
velocityVBC_
(
velocityVBC
)
{
tmpRHS_
=
std
::
make_shared
<
Function_T
<
real_t
>
>
(
"tmpRHS"
,
storage
,
minLevel
,
maxLevel
);
numerator_
=
std
::
make_shared
<
Function_T
<
PetscIn
t
>
>
(
"numerator"
,
storage
,
minLevel
,
maxLevel
);
numerator_
=
std
::
make_shared
<
Function_T
<
idx_
t
>
>
(
"numerator"
,
storage
,
minLevel
,
maxLevel
);
}
void
solve
(
const
Operator_T
&
A
,
...
...
@@ -119,11 +119,11 @@ public:
}
private:
std
::
shared_ptr
<
Function_T
<
PetscInt
>
>
numerator_
;
std
::
shared_ptr
<
Function_T
<
real_t
>
>
tmpRHS_
;
std
::
shared_ptr
<
PrimitiveStorage
>
storage_
;
std
::
function
<
real_t
(
const
hyteg
::
Point3D
&
)
>
velocityUBC_
;
std
::
function
<
real_t
(
const
hyteg
::
Point3D
&
)
>
velocityVBC_
;
std
::
shared_ptr
<
Function_T
<
idx_t
>
>
numerator_
;
std
::
shared_ptr
<
Function_T
<
real_t
>
>
tmpRHS_
;
std
::
shared_ptr
<
PrimitiveStorage
>
storage_
;
std
::
function
<
real_t
(
const
hyteg
::
Point3D
&
)
>
velocityUBC_
;
std
::
function
<
real_t
(
const
hyteg
::
Point3D
&
)
>
velocityVBC_
;
#else
public:
PetscSolver
(
const
std
::
shared_ptr
<
hyteg
::
PrimitiveStorage
>
&
,
...
...
apps/annulus.cpp
View file @
c4dce15e
...
...
@@ -83,10 +83,10 @@ void solveProblem( std::shared_ptr< hyteg::PrimitiveStorage >& storage, uint_t l
opType
lapOp
(
storage
,
level
,
level
);
// determine indices and dimensions
funcType
<
PetscIn
t
>
enumerator
(
"enumerator"
,
storage
,
level
,
level
);
funcType
<
idx_
t
>
enumerator
(
"enumerator"
,
storage
,
level
,
level
);
enumerator
.
enumerate
(
level
);
typedef
typename
FunctionTrait
<
funcType
<
PetscIn
t
>
>::
Tag
enumTag
;
typedef
typename
FunctionTrait
<
funcType
<
idx_
t
>
>::
Tag
enumTag
;
uint_t
globalDoFs
=
numberOfGlobalDoFs
<
enumTag
>
(
*
storage
,
level
);
uint_t
localDoFs
=
numberOfLocalDoFs
<
enumTag
>
(
*
storage
,
level
);
...
...
apps/benchmarks/ElementwiseOps/PolarLaplacianBenchmark.cpp
View file @
c4dce15e
...
...
@@ -179,7 +179,7 @@ caseResult analyseCase( std::shared_ptr< PrimitiveStorage > storage,
funcType
&
u
,
funcType
&
error
)
{
typedef
typename
FunctionTrait
<
typename
funcType
::
template
FunctionType
<
PetscIn
t
>
>::
Tag
funcTag
;
typedef
typename
FunctionTrait
<
typename
funcType
::
template
FunctionType
<
idx_
t
>
>::
Tag
funcTag
;
// embed numeric solution in next finer space
embedInRefinedSpace
(
u
,
level
);
...
...
@@ -378,7 +378,7 @@ void solve_using_pimped_form( uint_t minLevel, uint_t maxLevel, bool outputVTK )
{
// perform some template magic
typedef
typename
opType
::
srcType
funcType
;
// typedef typename FunctionTrait< typename opType::srcType::template FunctionType<
PetscIn
t> >::Tag funcTag;
// typedef typename FunctionTrait< typename opType::srcType::template FunctionType<
idx_
t> >::Tag funcTag;
// generate annulus mesh in polar coordinates
real_t
rmin
=
1.0
;
...
...
apps/benchmarks/ElementwiseOps/StencilScalingBenchmark.cpp
View file @
c4dce15e
...
...
@@ -62,7 +62,7 @@ caseResult analyseCase( std::shared_ptr< PrimitiveStorage > storage,
const
funcType
&
u
,
funcType
&
error
)
{
typedef
typename
FunctionTrait
<
typename
funcType
::
template
FunctionType
<
PetscIn
t
>
>::
Tag
funcTag
;
typedef
typename
FunctionTrait
<
typename
funcType
::
template
FunctionType
<
idx_
t
>
>::
Tag
funcTag
;
// embed numeric solution in next finer space
P2toP2QuadraticProlongation
embeddor
;
...
...
apps/benchmarks/PetscCompare-2D-P2-Apply/PetscCompare-2D-P2-Apply.cpp
View file @
c4dce15e
...
...
@@ -111,7 +111,7 @@ int main( int argc, char* argv[] )
hyteg
::
P2Function
<
double
>
y
(
"y"
,
storage
,
level
,
level
);
hyteg
::
P2Function
<
double
>
z
(
"z"
,
storage
,
level
,
level
);
hyteg
::
P2Function
<
double
>
diff
(
"diff"
,
storage
,
level
,
level
);
hyteg
::
P2Function
<
PetscInt
>
numerator
(
"numerator"
,
storage
,
level
,
level
);
hyteg
::
P2Function
<
idx_t
>
numerator
(
"numerator"
,
storage
,
level
,
level
);
wcTimingTreeApp
.
stop
(
"Function allocation"
);
const
uint_t
totalDoFs
=
numberOfGlobalDoFs
<
hyteg
::
P2FunctionTag
>
(
*
storage
,
level
);
...
...
apps/benchmarks/PetscCompare-3D-P1-Apply/PetscCompare-3D-P1-Apply.cpp
View file @
c4dce15e
...
...
@@ -110,7 +110,7 @@ int main( int argc, char* argv[] )
hyteg
::
P1Function
<
double
>
y
(
"y"
,
storage
,
level
,
level
);
hyteg
::
P1Function
<
double
>
z
(
"z"
,
storage
,
level
,
level
);
hyteg
::
P1Function
<
double
>
diff
(
"diff"
,
storage
,
level
,
level
);
hyteg
::
P1Function
<
PetscInt
>
numerator
(
"numerator"
,
storage
,
level
,
level
);
hyteg
::
P1Function
<
idx_t
>
numerator
(
"numerator"
,
storage
,
level
,
level
);
wcTimingTreeApp
.
stop
(
"Function allocation"
);
const
uint_t
totalDoFs
=
numberOfGlobalDoFs
<
hyteg
::
P1FunctionTag
>
(
*
storage
,
level
);
...
...
apps/benchmarks/PetscCompare/PetscCompare.cpp
View file @
c4dce15e
...
...
@@ -114,7 +114,7 @@ int main( int argc, char* argv[] )
hyteg
::
P1Function
<
double
>
diff
(
"diff"
,
storage
,
level
,
level
);
x
.
interpolate
(
exact
,
level
,
hyteg
::
Inner
);
//hyteg::communication::syncFunctionBetweenPrimitives(x,level);
hyteg
::
P1Function
<
PetscInt
>
numerator
(
"numerator"
,
storage
,
level
,
level
);
hyteg
::
P1Function
<
idx_t
>
numerator
(
"numerator"
,
storage
,
level
,
level
);
hyteg
::
P1ConstantLaplaceOperator
mass
(
storage
,
level
,
level
);
// for (const auto & faceIT : storage->getFaces()) {
...
...
@@ -155,7 +155,7 @@ int main( int argc, char* argv[] )
// WALBERLA_CRITICAL_SECTION_START
// for (auto &edgeIT : storage->getEdges()) {
// auto edge = edgeIT.second;
// hyteg::vertexdof::macroedge::printFunctionMemory<
PetscIn
t >(level, *edge, numerator.getEdgeDataID());
// hyteg::vertexdof::macroedge::printFunctionMemory<
idx_
t >(level, *edge, numerator.getEdgeDataID());
// }
// WALBERLA_CRITICAL_SECTION_END
...
...
apps/stokesSphere/StokesSphere.cpp
View file @
c4dce15e
...
...
@@ -281,7 +281,7 @@ int main( int argc, char* argv[] )
}
#if 0
auto numerator = std::make_shared< hyteg::P1StokesFunction<
PetscIn
t > >( "numerator", storage, level, level );
auto numerator = std::make_shared< hyteg::P1StokesFunction<
idx_
t > >( "numerator", storage, level, level );
uint_t globalSize = 0;
const uint_t localSize = numerator->enumerate(level, globalSize);
PETScManager petscManager( &argc, &argv );
...
...
src/hyteg/boundary/BoundaryConditions.hpp
View file @
c4dce15e
...
...
@@ -21,7 +21,8 @@
#include "core/DataTypes.h"
#include "core/uid/all.h"
#include "hyteg/types/flags.hpp"
#include "hyteg/types/types.hpp"
namespace
hyteg
{
...
...
src/hyteg/composites/ConcatenatedOperator.hpp
View file @
c4dce15e
...
...
@@ -109,7 +109,7 @@ class ConcatenatedOperator : public Operator< typename OpType1::srcType, typenam
op1_
->
computeDiagonalOperatorValues
();
op2_
->
computeDiagonalOperatorValues
();
for
(
uint_t
level
=
op1_
->
getMinLevel
();
level
<=
op1_
->
getMaxLevel
();
level
+=
1
)
diagonalValues_
->
multElementwise
(
{
*
op1_
->
getDiagonalValues
(),
*
op2_
->
getDiagonalValues
()
},
level
,
All
);
diagonalValues_
->
multElementwise
(
{
*
op1_
->
getDiagonalValues
(),
*
op2_
->
getDiagonalValues
()},
level
,
All
);
}
/// Trigger (re)computation of inverse diagonal matrix entries (central operator weights)
...
...
@@ -123,10 +123,10 @@ class ConcatenatedOperator : public Operator< typename OpType1::srcType, typenam
op2_
->
computeDiagonalOperatorValues
();
for
(
uint_t
level
=
op1_
->
getMinLevel
();
level
<=
op1_
->
getMaxLevel
();
level
+=
1
)
{
inverseDiagonalValues_
->
multElementwise
(
{
*
op1_
->
getDiagonalValues
(),
*
op2_
->
getDiagonalValues
()
},
level
,
All
);
inverseDiagonalValues_
->
multElementwise
(
{
*
op1_
->
getDiagonalValues
(),
*
op2_
->
getDiagonalValues
()},
level
,
All
);
// invert:
inverseDiagonalValues_
->
interpolate
(
[](
auto
,
auto
val
)
{
return
1.
/
val
[
0
];
},
{
*
inverseDiagonalValues_
,
*
inverseDiagonalValues_
},
level
,
All
);
[](
auto
,
auto
val
)
{
return
1.
/
val
[
0
];
},
{
*
inverseDiagonalValues_
,
*
inverseDiagonalValues_
},
level
,
All
);
}
}
...
...
src/hyteg/composites/P1BlendingStokesOperator.hpp
View file @
c4dce15e
...
...
@@ -68,8 +68,8 @@ class P1BlendingStokesOperator : public Operator< P1StokesFunction< real_t >, P1
}
void
toMatrix
(
const
std
::
shared_ptr
<
SparseMatrixProxy
>&
mat
,
const
P1StokesFunction
<
matI
dx_t
>&
src
,
const
P1StokesFunction
<
matI
dx_t
>&
dst
,
const
P1StokesFunction
<
i
dx_t
>&
src
,
const
P1StokesFunction
<
i
dx_t
>&
dst
,
size_t
level
,
DoFType
flag
)
const
{
...
...
src/hyteg/composites/P1EpsilonStokesOperator.hpp
View file @
c4dce15e
...
...
@@ -60,8 +60,8 @@ class P1EpsilonStokesOperator : public Operator< P1StokesFunction< real_t >, P1S
}
void
toMatrix
(
const
std
::
shared_ptr
<
SparseMatrixProxy
>&
mat
,
const
P1StokesFunction
<
matI
dx_t
>&
src
,
const
P1StokesFunction
<
matI
dx_t
>&
dst
,
const
P1StokesFunction
<
i
dx_t
>&
src
,
const
P1StokesFunction
<
i
dx_t
>&
dst
,
size_t
level
,
DoFType
flag
)
const
{
...
...
src/hyteg/composites/P1StokesBlockLaplaceOperator.hpp
View file @
c4dce15e
...
...
@@ -45,8 +45,8 @@ class P1StokesBlockLaplaceOperator : public Operator< P1StokesFunction< real_t >
}
void
toMatrix
(
const
std
::
shared_ptr
<
SparseMatrixProxy
>&
mat
,
const
P1StokesFunction
<
matI
dx_t
>&
src
,
const
P1StokesFunction
<
matI
dx_t
>&
dst
,
const
P1StokesFunction
<
i
dx_t
>&
src
,
const
P1StokesFunction
<
i
dx_t
>&
dst
,
size_t
level
,
DoFType
flag
)
const
{
...
...
src/hyteg/composites/P1StokesBlockPreconditioner.hpp
View file @
c4dce15e
...
...
@@ -18,8 +18,8 @@ class P1StokesBlockPreconditioner : public Operator< P1StokesFunction< real_t >,
{}
void
toMatrix
(
const
std
::
shared_ptr
<
SparseMatrixProxy
>&
mat
,
const
P1StokesFunction
<
matI
dx_t
>&
src
,
const
P1StokesFunction
<
matI
dx_t
>&
dst
,
const
P1StokesFunction
<
i
dx_t
>&
src
,
const
P1StokesFunction
<
i
dx_t
>&
dst
,
size_t
level
,
DoFType
flag
)
const
{
...
...
src/hyteg/composites/P1StokesOperator.hpp
View file @
c4dce15e
...
...
@@ -84,8 +84,8 @@ class P1StokesOperator : public Operator< P1StokesFunction< real_t >, P1StokesFu
}
void
toMatrix
(
const
std
::
shared_ptr
<
SparseMatrixProxy
>&
mat
,
const
P1StokesFunction
<
matI
dx_t
>&
src
,
const
P1StokesFunction
<
matI
dx_t
>&
dst
,
const
P1StokesFunction
<
i
dx_t
>&
src
,
const
P1StokesFunction
<
i
dx_t
>&
dst
,
size_t
level
,
DoFType
flag
)
const
{
...
...
src/hyteg/composites/P2P1BlendingTaylorHoodStokesOperator.hpp
View file @
c4dce15e
...
...
@@ -26,68 +26,66 @@
#include "hyteg/mixedoperators/P2ToP1VariableOperator.hpp"
#include "hyteg/p2functionspace/P2VariableOperator.hpp"
namespace
hyteg
{
class
P2P1BlendingTaylorHoodStokesOperator
:
public
Operator
<
P2P1TaylorHoodFunction
<
real_t
>
,
P2P1TaylorHoodFunction
<
real_t
>>
class
P2P1BlendingTaylorHoodStokesOperator
:
public
Operator
<
P2P1TaylorHoodFunction
<
real_t
>
,
P2P1TaylorHoodFunction
<
real_t
>
>
{
public:
typedef
P2BlendingLaplaceOperator
VelocityOperator_T
;
P2P1BlendingTaylorHoodStokesOperator
(
const
std
::
shared_ptr
<
PrimitiveStorage
>&
storage
,
uint_t
minLevel
,
uint_t
maxLevel
)
:
Operator
(
storage
,
minLevel
,
maxLevel
)
,
A
(
storage
,
minLevel
,
maxLevel
)
,
div_x
(
storage
,
minLevel
,
maxLevel
)
,
div_y
(
storage
,
minLevel
,
maxLevel
)
,
div_z
(
storage
,
minLevel
,
maxLevel
)
,
divT_x
(
storage
,
minLevel
,
maxLevel
)
,
divT_y
(
storage
,
minLevel
,
maxLevel
)
,
divT_z
(
storage
,
minLevel
,
maxLevel
)
,
pspg_inv_diag_
(
storage
,
minLevel
,
maxLevel
)
,
hasGlobalCells_
(
storage
->
hasGlobalCells
())
P2P1BlendingTaylorHoodStokesOperator
(
const
std
::
shared_ptr
<
PrimitiveStorage
>&
storage
,
uint_t
minLevel
,
uint_t
maxLevel
)
:
Operator
(
storage
,
minLevel
,
maxLevel
)
,
A
(
storage
,
minLevel
,
maxLevel
)
,
div_x
(
storage
,
minLevel
,
maxLevel
)
,
div_y
(
storage
,
minLevel
,
maxLevel
)
,
div_z
(
storage
,
minLevel
,
maxLevel
)
,
divT_x
(
storage
,
minLevel
,
maxLevel
)
,
divT_y
(
storage
,
minLevel
,
maxLevel
)
,
divT_z
(
storage
,
minLevel
,
maxLevel
)
,
pspg_inv_diag_
(
storage
,
minLevel
,
maxLevel
)
,
hasGlobalCells_
(
storage
->
hasGlobalCells
()
)
{}
void
apply
(
const
P2P1TaylorHoodFunction
<
real_t
>&
src
,
const
P2P1TaylorHoodFunction
<
real_t
>&
dst
,
const
size_t
level
,
DoFType
flag
)
const
void
apply
(
const
P2P1TaylorHoodFunction
<
real_t
>&
src
,
const
P2P1TaylorHoodFunction
<
real_t
>&
dst
,
const
size_t
level
,
DoFType
flag
)
const
{
WALBERLA_CHECK
(
!
hasGlobalCells_
,
"Variable Stokes operator not implemented for 3D."
);
WALBERLA_CHECK
(
!
hasGlobalCells_
,
"Variable Stokes operator not implemented for 3D."
);
A
.
apply
(
src
.
uvw
[
0
],
dst
.
uvw
[
0
],
level
,
flag
,
Replace
);
divT_x
.
apply
(
src
.
p
,
dst
.
uvw
[
0
],
level
,
flag
,
Add
);
A
.
apply
(
src
.
uvw
[
0
],
dst
.
uvw
[
0
],
level
,
flag
,
Replace
);
divT_x
.
apply
(
src
.
p
,
dst
.
uvw
[
0
],
level
,
flag
,
Add
);
A
.
apply
(
src
.
uvw
[
1
],
dst
.
uvw
[
1
],
level
,
flag
,
Replace
);
divT_y
.
apply
(
src
.
p
,
dst
.
uvw
[
1
],
level
,
flag
,
Add
);
A
.
apply
(
src
.
uvw
[
1
],
dst
.
uvw
[
1
],
level
,
flag
,
Replace
);
divT_y
.
apply
(
src
.
p
,
dst
.
uvw
[
1
],
level
,
flag
,
Add
);
if
(
hasGlobalCells_
)
if
(
hasGlobalCells_
)
{
A
.
apply
(
src
.
uvw
[
2
],
dst
.
uvw
[
2
],
level
,
flag
,
Replace
);
divT_z
.
apply
(
src
.
p
,
dst
.
uvw
[
2
],
level
,
flag
,
Add
);
A
.
apply
(
src
.
uvw
[
2
],
dst
.
uvw
[
2
],
level
,
flag
,
Replace
);
divT_z
.
apply
(
src
.
p
,
dst
.
uvw
[
2
],
level
,
flag
,
Add
);
}
div_x
.
apply
(
src
.
uvw
[
0
],
dst
.
p
,
level
,
flag
,
Replace
);
div_y
.
apply
(
src
.
uvw
[
1
],
dst
.
p
,
level
,
flag
,
Add
);
div_x
.
apply
(
src
.
uvw
[
0
],
dst
.
p
,
level
,
flag
,
Replace
);
div_y
.
apply
(
src
.
uvw
[
1
],
dst
.
p
,
level
,
flag
,
Add
);
if
(
hasGlobalCells_
)
if
(
hasGlobalCells_
)
{
div_z
.
apply
(
src
.
uvw
[
2
],
dst
.
p
,
level
,
flag
,
Add
);
div_z
.
apply
(
src
.
uvw
[
2
],
dst
.
p
,
level
,
flag
,
Add
);
}
}
P2BlendingLaplaceOperator
A
;
P2ToP1BlendingDivxOperator
div_x
;
P2ToP1BlendingDivyOperator
div_y
;
P2ToP1BlendingDivzOperator
div_z
;
P1ToP2BlendingDivTxOperator
divT_x
;
P1ToP2BlendingDivTyOperator
divT_y
;
P1ToP2BlendingDivTzOperator
divT_z
;
P2BlendingLaplaceOperator
A
;
P2ToP1BlendingDivxOperator
div_x
;
P2ToP1BlendingDivyOperator
div_y
;
P2ToP1BlendingDivzOperator
div_z
;
P1ToP2BlendingDivTxOperator
divT_x
;
P1ToP2BlendingDivTyOperator
divT_y
;
P1ToP2BlendingDivTzOperator
divT_z
;
/// this operator is need in the uzawa smoother
// P1PSPGOperator pspg_;
P1PSPGInvDiagOperator
pspg_inv_diag_
;
bool
hasGlobalCells_
;
P1PSPGInvDiagOperator
pspg_inv_diag_
;
bool
hasGlobalCells_
;
};
}
// namespace hyteg
src/hyteg/composites/P2P1SurrogateTaylorHoodStokesOperator.hpp
View file @
c4dce15e
...
...
@@ -26,86 +26,88 @@
#include "hyteg/mixedoperators/P2ToP1SurrogateOperator.hpp"
#include "hyteg/p2functionspace/P2SurrogateOperator.hpp"
namespace
hyteg
{
class
P2P1SurrogateTaylorHoodStokesOperator
:
public
Operator
<
P2P1TaylorHoodFunction
<
real_t
>
,
P2P1TaylorHoodFunction
<
real_t
>
>
:
public
Operator
<
P2P1TaylorHoodFunction
<
real_t
>
,
P2P1TaylorHoodFunction
<
real_t
>
>
{
public:
typedef
P2SurrogateLaplaceOperator
VelocityOperator_T
;
P2P1SurrogateTaylorHoodStokesOperator
(
const
std
::
shared_ptr
<
PrimitiveStorage
>&
storage
,
uint_t
minLevel
,
uint_t
maxLevel
,
uint_t
interpolationLevel
)
:
Operator
(
storage
,
minLevel
,
maxLevel
)
,
A
(
storage
,
minLevel
,
maxLevel
,
interpolationLevel
)
,
div_x
(
storage
,
minLevel
,
maxLevel
,
interpolationLevel
)
,
div_y
(
storage
,
minLevel
,
maxLevel
,
interpolationLevel
)
,
div_z
(
storage
,
minLevel
,
maxLevel
)
,
divT_x
(
storage
,
minLevel
,
maxLevel
,
interpolationLevel
)
,
divT_y
(
storage
,
minLevel
,
maxLevel
,
interpolationLevel
)
,
divT_z
(
storage
,
minLevel
,
maxLevel
)
,
pspg_inv_diag_
(
storage
,
minLevel
,
maxLevel
)
,
hasGlobalCells_
(
storage
->
hasGlobalCells
())
P2P1SurrogateTaylorHoodStokesOperator
(
const
std
::
shared_ptr
<
PrimitiveStorage
>&
storage
,
uint_t
minLevel
,
uint_t
maxLevel
,
uint_t
interpolationLevel
)
:
Operator
(
storage
,
minLevel
,
maxLevel
)
,
A
(
storage
,
minLevel
,
maxLevel
,
interpolationLevel
)
,
div_x
(
storage
,
minLevel
,
maxLevel
,
interpolationLevel
)
,
div_y
(
storage
,
minLevel
,
maxLevel
,
interpolationLevel
)
,
div_z
(
storage
,
minLevel
,
maxLevel
)
,
divT_x
(
storage
,
minLevel
,
maxLevel
,
interpolationLevel
)
,
divT_y
(
storage
,
minLevel
,
maxLevel
,
interpolationLevel
)
,
divT_z
(
storage
,
minLevel
,
maxLevel
)
,
pspg_inv_diag_
(
storage
,
minLevel
,
maxLevel
)
,
hasGlobalCells_
(
storage
->
hasGlobalCells
()
)
{}
void
interpolateStencils
(
uint_t
polyDegree
)
void
interpolateStencils
(
uint_t
polyDegree
)
{
A
.
interpolateStencils
(
polyDegree
);
div_x
.
interpolateStencils
(
polyDegree
);
div_y
.
interpolateStencils
(
polyDegree
);
divT_x
.
interpolateStencils
(
polyDegree
);
divT_y
.
interpolateStencils
(
polyDegree
);
A
.
interpolateStencils
(
polyDegree
);
div_x
.
interpolateStencils
(
polyDegree
);
div_y
.
interpolateStencils
(
polyDegree
);
divT_x
.
interpolateStencils
(
polyDegree
);
divT_y
.
interpolateStencils
(
polyDegree
);
}
void
useDegree
(
uint_t
polyDegree
)
void
useDegree
(
uint_t
polyDegree
)
{
A
.
useDegree
(
polyDegree
);
div_x
.
useDegree
(
polyDegree
);
div_y
.
useDegree
(
polyDegree
);
divT_x
.
useDegree
(
polyDegree
);
divT_y
.
useDegree
(
polyDegree
);
A
.
useDegree
(
polyDegree
);
div_x
.
useDegree
(
polyDegree
);
div_y
.
useDegree
(
polyDegree
);
divT_x
.
useDegree
(
polyDegree
);
divT_y
.
useDegree
(
polyDegree
);
}
void
apply
(
const
P2P1TaylorHoodFunction
<
real_t
>&
src
,
const
P2P1TaylorHoodFunction
<
real_t
>&
dst
,
const
size_t
level
,
DoFType
flag
)
const
void
apply
(
const
P2P1TaylorHoodFunction
<
real_t
>&
src
,
const
P2P1TaylorHoodFunction
<
real_t
>&
dst
,
const
size_t
level
,
DoFType
flag
)
const
{
WALBERLA_CHECK
(
!
hasGlobalCells_
,
"Surrogate Stokes operator not implemented for 3D."
);
WALBERLA_CHECK
(
!
hasGlobalCells_
,
"Surrogate Stokes operator not implemented for 3D."
);
A
.
apply
(
src
.
uvw
[
0
],
dst
.
uvw
[
0
],
level
,
flag
,
Replace
);
divT_x
.
apply
(
src
.
p
,
dst
.
uvw
[
0
],
level
,
flag
,
Add
);
A
.
apply
(
src
.
uvw
[
0
],
dst
.
uvw
[
0
],
level
,
flag
,
Replace
);
divT_x
.
apply
(
src
.
p
,
dst
.
uvw
[
0
],
level
,
flag
,
Add
);
A
.
apply
(
src
.
uvw
[
1
],
dst
.
uvw
[
1
],
level
,
flag
,
Replace
);
divT_y
.
apply
(
src
.
p
,
dst
.
uvw
[
1
],
level
,
flag
,
Add
);
A
.
apply
(
src
.
uvw
[
1
],
dst
.
uvw
[
1
],
level
,
flag
,
Replace
);
divT_y
.
apply
(
src
.
p
,
dst
.
uvw
[
1
],
level
,
flag
,
Add
);
if
(
hasGlobalCells_
)
if
(
hasGlobalCells_
)
{
A
.
apply
(
src
.
uvw
[
2
],
dst
.
uvw
[
2
],
level
,
flag
,
Replace
);
divT_z
.
apply
(
src
.
p
,
dst
.
uvw
[
2
],
level
,
flag
,
Add
);
A
.
apply
(
src
.
uvw
[
2
],
dst
.
uvw
[
2
],
level
,
flag
,
Replace
);
divT_z
.
apply
(
src
.
p
,
dst
.
uvw
[
2
],
level
,
flag
,
Add
);
}
div_x
.
apply
(
src
.
uvw
[
0
],
dst
.
p
,
level
,
flag
,
Replace
);
div_y
.
apply
(
src
.
uvw
[
1
],
dst
.
p
,
level
,
flag
,
Add
);
div_x
.
apply
(
src
.
uvw
[
0
],
dst
.
p
,
level
,
flag
,
Replace
);
div_y
.
apply
(
src
.
uvw
[
1
],
dst
.
p
,
level
,
flag
,
Add
);
if
(
hasGlobalCells_
)
if
(
hasGlobalCells_
)
{
div_z
.
apply
(
src
.
uvw
[
2
],
dst
.
p
,
level
,
flag
,
Add
);
div_z
.
apply
(
src
.
uvw
[
2
],
dst
.
p
,
level
,
flag
,
Add
);
}
}
P2SurrogateLaplaceOperator
A
;
P2ToP1SurrogateDivxOperator
div_x
;
P2ToP1SurrogateDivyOperator
div_y
;
P2ToP1BlendingDivzOperator
div_z
;
P1ToP2SurrogateDivTxOperator
divT_x
;
P1ToP2SurrogateDivTyOperator
divT_y
;
P1ToP2BlendingDivTzOperator
divT_z
;
P2SurrogateLaplaceOperator
A
;
P2ToP1SurrogateDivxOperator
div_x
;
P2ToP1SurrogateDivyOperator
div_y
;
P2ToP1BlendingDivzOperator
div_z
;
P1ToP2SurrogateDivTxOperator
divT_x
;
P1ToP2SurrogateDivTyOperator
divT_y
;
P1ToP2BlendingDivTzOperator
divT_z
;
/// this operator is need in the uzawa smoother
// P1PSPGOperator pspg_;
P1PSPGInvDiagOperator
pspg_inv_diag_
;
bool
hasGlobalCells_
;
P1PSPGInvDiagOperator
pspg_inv_diag_
;
bool
hasGlobalCells_
;
};
}
// namespace hyteg
src/hyteg/composites/P2P1TaylorHoodBlockFunction.hpp
View file @
c4dce15e
...
...
@@ -30,7 +30,6 @@ template < typename value_t >
class
P2P1TaylorHoodBlockFunction
:
public
BlockFunction
<
value_t
>
{
public:
template
<
typename
VType
>
using
FunctionType
=
P2P1TaylorHoodBlockFunction
<
VType
>
;
...
...
src/hyteg/composites/P2P1TaylorHoodFunction.hpp
View file @
c4dce15e
...
...
@@ -56,7 +56,7 @@ class P2P1TaylorHoodFunction
:
uvw
(
_name
+
"_vector"
,
storage
,
minLevel
,
maxLevel
)
,
p
(
_name
+
"_p"
,
storage
,
minLevel
,
maxLevel
,
BoundaryCondition
::
createAllInnerBC
()
)
{
uvw
.
setBoundaryCondition
(
velocityBC
);
uvw
.
setBoundaryCondition
(
velocityBC
);
}
std
::
shared_ptr
<
PrimitiveStorage
>
getStorage
()
const
{
return
uvw
.
getStorage
();
}
...
...
@@ -211,14 +211,11 @@ class P2P1TaylorHoodFunction
BoundaryCondition
getPressureBoundaryCondition
()
const
{
return
p
.
getBoundaryCondition
();
}
void
setVelocityBoundaryCondition
(
BoundaryCondition
bc
)
{
uvw
.
setBoundaryCondition
(
bc
);
}
void
setVelocityBoundaryCondition
(
BoundaryCondition
bc
)
{
uvw
.
setBoundaryCondition
(
bc
);
}
void
setPressureBoundaryCondition
(
BoundaryCondition
bc
)
{
p
.
setBoundaryCondition
(
bc
);
}
template
<
typename
OtherFunctionValueType
>
template
<
typename
OtherFunctionValueType
>
void
copyBoundaryConditionFromFunction
(
const
P2P1TaylorHoodFunction
<
OtherFunctionValueType
>&
other
)
{
setVelocityBoundaryCondition
(
other
.
getVelocityBoundaryCondition
()
);
...
...
@@ -229,23 +226,23 @@ class P2P1TaylorHoodFunction
PressureFunction_T
p
;
};
inline
unsigned
long
long
p2p1localFunctionMemorySize
(
const
uint_t
&
level
,
const
std
::
shared_ptr
<
PrimitiveStorage
>
&
storage
)
inline
unsigned
long
long
p2p1localFunctionMemorySize
(
const
uint_t
&
level
,
const
std
::
shared_ptr
<
PrimitiveStorage
>&
storage
)
{
if
(
storage
->
hasGlobalCells
()
)
{
return
3
*
p2function
::
localFunctionMemorySize
(
level
,
storage
)
+
vertexDoFLocalFunctionMemorySize
(
level
,
storage
);
return
3
*
p2function
::
localFunctionMemorySize
(
level
,
storage
)
+
vertexDoFLocalFunctionMemorySize
(
level
,
storage
);
}
else
{
return
2
*
p2function
::
localFunctionMemorySize
(
level
,
storage
)
+
vertexDoFLocalFunctionMemorySize
(
level
,
storage
);
return
2
*
p2function
::
localFunctionMemorySize
(
level
,
storage
)
+
vertexDoFLocalFunctionMemorySize
(
level
,
storage
);
}
}
inline
unsigned
long
long
p2p1globalFunctionMemorySize
(
const
uint_t
&
level
,
const
std
::
shared_ptr
<
PrimitiveStorage
>
&
storage
)
inline
unsigned
long
long
p2p1globalFunctionMemorySize
(
const
uint_t
&
level
,
const
std
::
shared_ptr
<
PrimitiveStorage
>&
storage
)
{
const
auto
memLocal
=
p2p1localFunctionMemorySize
(
level
,
storage
);
const
auto
memLocal
=
p2p1localFunctionMemorySize
(
level
,
storage
);
const
auto
memGlobal
=
walberla
::
mpi
::
allReduce
(
memLocal
,
walberla
::
mpi
::
SUM
);
return
memGlobal
;
}
}
}
// namespace hyteg
Prev
1
2
3
4
5
…
8
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment