Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
V
VirtualFluids
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
iRMB
VirtualFluids
Commits
fa83b9b8
Commit
fa83b9b8
authored
3 years ago
by
schoen
Browse files
Options
Downloads
Patches
Plain Diff
deleted tabs
parent
0fa976cd
No related branches found
No related tags found
1 merge request
!51
Open source
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/gpu/VirtualFluids_GPU/AdvectionDiffusion/AdvectionDiffusion.cpp
+119
-125
119 additions, 125 deletions
...rtualFluids_GPU/AdvectionDiffusion/AdvectionDiffusion.cpp
with
119 additions
and
125 deletions
src/gpu/VirtualFluids_GPU/AdvectionDiffusion/AdvectionDiffusion.cpp
+
119
−
125
View file @
fa83b9b8
...
...
@@ -31,159 +31,153 @@
//! \author Martin Schoenherr
//=======================================================================================
#include
"AdvectionDiffusion/AdvectionDiffusion.h"
#include
"Parameter/Parameter.h"
#include
"GPU/GPU_Interface.h"
#include
"GPU/CudaMemoryManager.h"
#include
"GPU/GPU_Interface.h"
#include
"Parameter/Parameter.h"
////////////////////////////////////////////////////////////////////////////////
void
initAD
(
SPtr
<
Parameter
>
para
)
{
//////////////////////////////////////////////////////////////////////////
// calculation of omega for diffusivity
para
->
getParD
()
->
omegaD
=
(
real
)
2.0
/
((
real
)
6.0
*
para
->
getParD
()
->
diffusivity
+
(
real
)
1.0
);
//////////////////////////////////////////////////////////////////////////
para
->
getParD
()
->
isEvenTimestep
=
true
;
//////////////////////////////////////////////////////////////////////////
InitADdevice
(
para
->
getParD
()
->
numberofthreads
,
para
->
getParD
()
->
neighborX
,
para
->
getParD
()
->
neighborY
,
para
->
getParD
()
->
neighborZ
,
para
->
getParD
()
->
typeOfGridNode
,
para
->
getParD
()
->
concentration
,
para
->
getParD
()
->
velocityX
,
para
->
getParD
()
->
velocityY
,
para
->
getParD
()
->
velocityZ
,
para
->
getParD
()
->
numberOfNodes
,
para
->
getParD
()
->
distributionsAD
.
f
[
0
],
para
->
getParD
()
->
isEvenTimestep
);
//////////////////////////////////////////////////////////////////////////
para
->
getParD
()
->
isEvenTimestep
=
false
;
//////////////////////////////////////////////////////////////////////////
InitADdevice
(
para
->
getParD
()
->
numberofthreads
,
para
->
getParD
()
->
neighborX
,
para
->
getParD
()
->
neighborY
,
para
->
getParD
()
->
neighborZ
,
para
->
getParD
()
->
typeOfGridNode
,
para
->
getParD
()
->
concentration
,
para
->
getParD
()
->
velocityX
,
para
->
getParD
()
->
velocityY
,
para
->
getParD
()
->
velocityZ
,
para
->
getParD
()
->
numberOfNodes
,
para
->
getParD
()
->
distributionsAD
.
f
[
0
],
para
->
getParD
()
->
isEvenTimestep
);
//////////////////////////////////////////////////////////////////////////
CalcConcentration27
(
para
->
getParD
()
->
numberofthreads
,
para
->
getParD
()
->
concentration
,
para
->
getParD
()
->
typeOfGridNode
,
para
->
getParD
()
->
neighborX
,
para
->
getParD
()
->
neighborY
,
para
->
getParD
()
->
neighborZ
,
para
->
getParD
()
->
numberOfNodes
,
para
->
getParD
()
->
distributionsAD
.
f
[
0
],
para
->
getParD
()
->
isEvenTimestep
);
//////////////////////////////////////////////////////////////////////////
// calculation of omega for diffusivity
para
->
getParD
()
->
omegaD
=
(
real
)
2.0
/
((
real
)
6.0
*
para
->
getParD
()
->
diffusivity
+
(
real
)
1.0
);
//////////////////////////////////////////////////////////////////////////
para
->
getParD
()
->
isEvenTimestep
=
true
;
//////////////////////////////////////////////////////////////////////////
InitADdevice
(
para
->
getParD
()
->
numberofthreads
,
para
->
getParD
()
->
neighborX
,
para
->
getParD
()
->
neighborY
,
para
->
getParD
()
->
neighborZ
,
para
->
getParD
()
->
typeOfGridNode
,
para
->
getParD
()
->
concentration
,
para
->
getParD
()
->
velocityX
,
para
->
getParD
()
->
velocityY
,
para
->
getParD
()
->
velocityZ
,
para
->
getParD
()
->
numberOfNodes
,
para
->
getParD
()
->
distributionsAD
.
f
[
0
],
para
->
getParD
()
->
isEvenTimestep
);
//////////////////////////////////////////////////////////////////////////
para
->
getParD
()
->
isEvenTimestep
=
false
;
//////////////////////////////////////////////////////////////////////////
InitADdevice
(
para
->
getParD
()
->
numberofthreads
,
para
->
getParD
()
->
neighborX
,
para
->
getParD
()
->
neighborY
,
para
->
getParD
()
->
neighborZ
,
para
->
getParD
()
->
typeOfGridNode
,
para
->
getParD
()
->
concentration
,
para
->
getParD
()
->
velocityX
,
para
->
getParD
()
->
velocityY
,
para
->
getParD
()
->
velocityZ
,
para
->
getParD
()
->
numberOfNodes
,
para
->
getParD
()
->
distributionsAD
.
f
[
0
],
para
->
getParD
()
->
isEvenTimestep
);
//////////////////////////////////////////////////////////////////////////
CalcConcentration27
(
para
->
getParD
()
->
numberofthreads
,
para
->
getParD
()
->
concentration
,
para
->
getParD
()
->
typeOfGridNode
,
para
->
getParD
()
->
neighborX
,
para
->
getParD
()
->
neighborY
,
para
->
getParD
()
->
neighborZ
,
para
->
getParD
()
->
numberOfNodes
,
para
->
getParD
()
->
distributionsAD
.
f
[
0
],
para
->
getParD
()
->
isEvenTimestep
);
}
////////////////////////////////////////////////////////////////////////////////
void
setInitialNodeValuesAD
(
SPtr
<
Parameter
>
para
,
SPtr
<
CudaMemoryManager
>
cudaMemoryManager
)
{
for
(
uint
j
=
1
;
j
<=
para
->
getParH
()
->
numberOfNodes
;
j
++
)
{
const
real
coordX
=
para
->
getParH
()
->
coordinateX
[
j
];
const
real
coordY
=
para
->
getParH
()
->
coordinateY
[
j
];
const
real
coordZ
=
para
->
getParH
()
->
coordinateZ
[
j
];
real
concentration
;
real
dist
=
0
;
for
(
uint
j
=
1
;
j
<=
para
->
getParH
()
->
numberOfNodes
;
j
++
)
{
const
real
coordX
=
para
->
getParH
()
->
coordinateX
[
j
];
const
real
coordY
=
para
->
getParH
()
->
coordinateY
[
j
];
const
real
coordZ
=
para
->
getParH
()
->
coordinateZ
[
j
];
// float rand_min=-0.01, rand_max=0.01;
// float random = ((float) rand()) / (float) RAND_MAX;
// float diff = rand_max - rand_min;
// float r = random * diff;
// dist = rand_min + r;
real
concentration
;
real
dist
=
0
;
// call functor object with initial condition
if
(
para
->
getInitialConditionAD
())
{
para
->
getInitialConditionAD
()(
coordX
,
coordY
,
coordZ
,
concentration
,
dist
);
}
else
{
concentration
=
real
(
0.0
);
}
//float rand_min=-0.01, rand_max=0.01;
//float random = ((float) rand()) / (float) RAND_MAX;
//float diff = rand_max - rand_min;
//float r = random * diff;
//dist = rand_min + r;
para
->
getParH
()
->
concentration
[
j
]
=
concentration
;
// call functor object with initial condition
if
(
para
->
getInitialConditionAD
())
{
para
->
getInitialConditionAD
()(
coordX
,
coordY
,
coordZ
,
concentration
,
dist
);
}
else
{
concentration
=
real
(
0.0
);
}
}
para
->
getParH
()
->
concentration
[
j
]
=
concentration
;
}
cudaMemoryManager
->
cudaCopyConcentrationHostToDevice
();
cudaMemoryManager
->
cudaCopyConcentrationHostToDevice
();
}
////////////////////////////////////////////////////////////////////////////////
void
calcAD
(
SPtr
<
Parameter
>
para
)
{
FactorizedCentralMomentsAdvectionDiffusionDeviceKernel
(
para
->
getParD
()
->
numberofthreads
,
para
->
getParD
()
->
omegaD
,
para
->
getParD
()
->
typeOfGridNode
,
para
->
getParD
()
->
neighborX
,
para
->
getParD
()
->
neighborY
,
para
->
getParD
()
->
neighborZ
,
para
->
getParD
()
->
distributions
.
f
[
0
],
para
->
getParD
()
->
distributionsAD
.
f
[
0
],
para
->
getParD
()
->
numberOfNodes
,
para
->
getParD
()
->
forcing
,
para
->
getParD
()
->
isEvenTimestep
);
para
->
getParD
()
->
numberofthreads
,
para
->
getParD
()
->
omegaD
,
para
->
getParD
()
->
typeOfGridNode
,
para
->
getParD
()
->
neighborX
,
para
->
getParD
()
->
neighborY
,
para
->
getParD
()
->
neighborZ
,
para
->
getParD
()
->
distributions
.
f
[
0
],
para
->
getParD
()
->
distributionsAD
.
f
[
0
],
para
->
getParD
()
->
numberOfNodes
,
para
->
getParD
()
->
forcing
,
para
->
getParD
()
->
isEvenTimestep
);
/*CentralMomentsAdvectionDiffusionDeviceKernel(
para->getParD()->numberofthreads,
para->getParD()->omegaD,
para->getParD()->typeOfGridNode,
para->getParD()->neighborX,
para->getParD()->neighborY,
para->getParD()->neighborZ,
para->getParD()->distributions.f[0],
para->getParD()->distributionsAD.f[0],
para->getParD()->numberOfNodes,
para->getParD()->forcing,
para->getParD()->isEvenTimestep);*/
if
(
para
->
getParD
()
->
numberOfSlipBCnodes
>
1
)
{
ADSlipVelDevComp
(
para
->
getParD
()
->
numberofthreads
,
para
->
getParD
()
->
slipBC
.
NormalX
,
para
->
getParD
()
->
slipBC
.
NormalY
,
para
->
getParD
()
->
slipBC
.
NormalZ
,
para
->
getParD
()
->
distributions
.
f
[
0
],
para
->
getParD
()
->
distributionsAD
.
f
[
0
],
para
->
getParD
()
->
slipBC
.
k
,
para
->
getParD
()
->
slipBC
.
q27
[
0
],
para
->
getParD
()
->
numberOfSlipBCnodes
,
para
->
getParD
()
->
omegaD
,
para
->
getParD
()
->
neighborX
,
para
->
getParD
()
->
neighborY
,
para
->
getParD
()
->
neighborZ
,
para
->
getParD
()
->
numberOfNodes
,
para
->
getParD
()
->
isEvenTimestep
);
}
para->getParD()->numberofthreads,
para->getParD()->omegaD,
para->getParD()->typeOfGridNode,
para->getParD()->neighborX,
para->getParD()->neighborY,
para->getParD()->neighborZ,
para->getParD()->distributions.f[0],
para->getParD()->distributionsAD.f[0],
para->getParD()->numberOfNodes,
para->getParD()->forcing,
para->getParD()->isEvenTimestep);*/
if
(
para
->
getParD
()
->
numberOfSlipBCnodes
>
1
)
{
ADSlipVelDevComp
(
para
->
getParD
()
->
numberofthreads
,
para
->
getParD
()
->
slipBC
.
NormalX
,
para
->
getParD
()
->
slipBC
.
NormalY
,
para
->
getParD
()
->
slipBC
.
NormalZ
,
para
->
getParD
()
->
distributions
.
f
[
0
],
para
->
getParD
()
->
distributionsAD
.
f
[
0
],
para
->
getParD
()
->
slipBC
.
k
,
para
->
getParD
()
->
slipBC
.
q27
[
0
],
para
->
getParD
()
->
numberOfSlipBCnodes
,
para
->
getParD
()
->
omegaD
,
para
->
getParD
()
->
neighborX
,
para
->
getParD
()
->
neighborY
,
para
->
getParD
()
->
neighborZ
,
para
->
getParD
()
->
numberOfNodes
,
para
->
getParD
()
->
isEvenTimestep
);
}
}
////////////////////////////////////////////////////////////////////////////////
void
printAD
(
SPtr
<
Parameter
>
para
,
SPtr
<
CudaMemoryManager
>
cudaMemoryManager
)
{
CalcConcentration27
(
para
->
getParD
()
->
numberofthreads
,
para
->
getParD
()
->
concentration
,
para
->
getParD
()
->
typeOfGridNode
,
para
->
getParD
()
->
neighborX
,
para
->
getParD
()
->
neighborY
,
para
->
getParD
()
->
neighborZ
,
para
->
getParD
()
->
numberOfNodes
,
para
->
getParD
()
->
distributionsAD
.
f
[
0
],
para
->
getParD
()
->
isEvenTimestep
);
CalcConcentration27
(
para
->
getParD
()
->
numberofthreads
,
para
->
getParD
()
->
concentration
,
para
->
getParD
()
->
typeOfGridNode
,
para
->
getParD
()
->
neighborX
,
para
->
getParD
()
->
neighborY
,
para
->
getParD
()
->
neighborZ
,
para
->
getParD
()
->
numberOfNodes
,
para
->
getParD
()
->
distributionsAD
.
f
[
0
],
para
->
getParD
()
->
isEvenTimestep
);
cudaMemoryManager
->
cudaCopyConcentrationDeviceToHost
();
cudaMemoryManager
->
cudaCopyConcentrationDeviceToHost
();
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment