Newer
Older
#ifndef TNLLINEARDIFFUSION_IMP_H
#define TNLLINEARDIFFUSION_IMP_H
#include <operators/diffusion/tnlLinearDiffusion.h>
template< typename MeshReal,
typename Device,
typename MeshIndex,
typename Real,
typename Index >
tnlString
tnlLinearDiffusion< tnlGrid< 1, MeshReal, Device, MeshIndex >, Real, Index >::
getType()
{
return tnlString( "tnlLinearDiffusion< " ) +
MeshType::getType() + ", " +
::getType< Real >() + ", " +
::getType< Index >() + " >";
}
typename MeshIndex,
typename Real,
typename Index >
template< typename Vector >
#ifdef HAVE_CUDA
__device__ __host__
#endif
void
tnlLinearDiffusion< tnlGrid< 1, MeshReal, Device, MeshIndex >, Real, Index >::
explicitUpdate( const RealType& time,
const RealType& tau,
const MeshType& mesh,
const IndexType cellIndex,
const CoordinatesType& coordinates,
Vector& u,
fu[ cellIndex ] = ( u[ mesh.getCellXPredecessor( cellIndex ) ]
- 2.0 * u[ cellIndex ]
+ u[ mesh.getCellXSuccessor( cellIndex ) ] ) * mesh.getHxSquareInverse();
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
template< typename MeshReal,
typename Device,
typename MeshIndex,
typename Real,
typename Index >
template< typename Vector >
#ifdef HAVE_CUDA
__device__ __host__
#endif
Real
tnlLinearDiffusion< tnlGrid< 1, MeshReal, Device, MeshIndex >, Real, Index >::
getValue( const MeshType& mesh,
const IndexType cellIndex,
Vector& u ) const
{
return ( u[ mesh.getCellXPredecessor( cellIndex ) ]
- 2.0 * u[ cellIndex ]
+ u[ mesh.getCellXSuccessor( cellIndex ) ] ) * mesh.getHxSquareInverse();
}
template< typename MeshReal,
typename Device,
typename MeshIndex,
typename Real,
typename Index >
tnlString
tnlLinearDiffusion< tnlGrid< 2, MeshReal, Device, MeshIndex >, Real, Index >::
getType()
{
return tnlString( "tnlLinearDiffusion< " ) +
MeshType::getType() + ", " +
::getType< Real >() + ", " +
::getType< Index >() + " >";
}
typename MeshIndex,
typename Real,
typename Index >
#ifdef HAVE_CUDA
__device__ __host__
#endif
void
tnlLinearDiffusion< tnlGrid< 2, MeshReal, Device, MeshIndex >, Real, Index >::
explicitUpdate( const RealType& time,
const RealType& tau,
const MeshType& mesh,
const IndexType cellIndex,
const CoordinatesType& coordinates,
Vector& u,
fu[ cellIndex ] = ( u[ mesh.getCellXPredecessor( cellIndex ) ]
- 2.0 * u[ cellIndex ]
+ u[ mesh.getCellXSuccessor( cellIndex ) ] ) * mesh.getHxSquareInverse() +
( u[ mesh.getCellYPredecessor( cellIndex ) ]
- 2.0 * u[ cellIndex ]
+ u[ mesh.getCellYSuccessor( cellIndex ) ] ) * mesh.getHySquareInverse();
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
template< typename MeshReal,
typename Device,
typename MeshIndex,
typename Real,
typename Index >
template< typename Vector >
#ifdef HAVE_CUDA
__device__ __host__
#endif
Real
tnlLinearDiffusion< tnlGrid< 2, MeshReal, Device, MeshIndex >, Real, Index >::
getValue( const MeshType& mesh,
const IndexType cellIndex,
Vector& u ) const
{
return ( u[ mesh.getCellXPredecessor( cellIndex ) ]
- 2.0 * u[ cellIndex ]
+ u[ mesh.getCellXSuccessor( cellIndex ) ] ) * mesh.getHxSquareInverse() +
( u[ mesh.getCellYPredecessor( cellIndex ) ]
- 2.0 * u[ cellIndex ]
+ u[ mesh.getCellYSuccessor( cellIndex ) ] ) * mesh.getHySquareInverse();
}
template< typename MeshReal,
typename Device,
typename MeshIndex,
typename Real,
typename Index >
tnlString
tnlLinearDiffusion< tnlGrid< 3, MeshReal, Device, MeshIndex >, Real, Index >::
getType()
{
return tnlString( "tnlLinearDiffusion< " ) +
MeshType::getType() + ", " +
::getType< Real >() + ", " +
::getType< Index >() + " >";
}
typename MeshIndex,
typename Real,
typename Index >
#ifdef HAVE_CUDA
__device__ __host__
#endif
void
tnlLinearDiffusion< tnlGrid< 3, MeshReal, Device, MeshIndex >, Real, Index >::
explicitUpdate( const RealType& time,
const RealType& tau,
const MeshType& mesh,
const IndexType cellIndex,
const CoordinatesType& coordinates,
Vector& u,
fu[ cellIndex ] = ( u[ mesh.getCellXPredecessor( cellIndex ) ]
- 2.0 * u[ cellIndex ]
+ u[ mesh.getCellXSuccessor( cellIndex ) ] ) * mesh.getHxSquareInverse() +
( u[ mesh.getCellYPredecessor( cellIndex ) ]
- 2.0 * u[ cellIndex ]
+ u[ mesh.getCellYSuccessor( cellIndex ) ] ) * mesh.getHySquareInverse() +
( u[ mesh.getCellZPredecessor( cellIndex ) ]
- 2.0 * u[ cellIndex ]
+ u[ mesh.getCellZSuccessor( cellIndex ) ] ) * mesh.getHzSquareInverse();
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
template< typename MeshReal,
typename Device,
typename MeshIndex,
typename Real,
typename Index >
template< typename Vector >
#ifdef HAVE_CUDA
__device__ __host__
#endif
Real
tnlLinearDiffusion< tnlGrid< 3, MeshReal, Device, MeshIndex >, Real, Index >::
getValue( const MeshType& mesh,
const IndexType cellIndex,
Vector& u ) const
{
return ( u[ mesh.getCellXPredecessor( cellIndex ) ]
- 2.0 * u[ cellIndex ]
+ u[ mesh.getCellXSuccessor( cellIndex ) ] ) * mesh.getHxSquareInverse() +
( u[ mesh.getCellYPredecessor( cellIndex ) ]
- 2.0 * u[ cellIndex ]
+ u[ mesh.getCellYSuccessor( cellIndex ) ] ) * mesh.getHySquareInverse() +
( u[ mesh.getCellZPredecessor( cellIndex ) ]
- 2.0 * u[ cellIndex ]
+ u[ mesh.getCellZSuccessor( cellIndex ) ] ) * mesh.getHzSquareInverse();
}