Skip to content
Snippets Groups Projects
Commit fa83b9b8 authored by schoen's avatar schoen
Browse files

deleted tabs

parent 0fa976cd
No related branches found
No related tags found
1 merge request!51Open source
...@@ -31,159 +31,153 @@ ...@@ -31,159 +31,153 @@
//! \author Martin Schoenherr //! \author Martin Schoenherr
//======================================================================================= //=======================================================================================
#include "AdvectionDiffusion/AdvectionDiffusion.h" #include "AdvectionDiffusion/AdvectionDiffusion.h"
#include "Parameter/Parameter.h"
#include "GPU/GPU_Interface.h"
#include "GPU/CudaMemoryManager.h" #include "GPU/CudaMemoryManager.h"
#include "GPU/GPU_Interface.h"
#include "Parameter/Parameter.h"
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
void initAD(SPtr<Parameter> para) void initAD(SPtr<Parameter> para)
{ {
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
// calculation of omega for diffusivity // calculation of omega for diffusivity
para->getParD()->omegaD = (real)2.0 / ((real)6.0 * para->getParD()->diffusivity + (real)1.0); para->getParD()->omegaD = (real)2.0 / ((real)6.0 * para->getParD()->diffusivity + (real)1.0);
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
para->getParD()->isEvenTimestep = true; para->getParD()->isEvenTimestep = true;
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
InitADdevice( InitADdevice(
para->getParD()->numberofthreads, para->getParD()->numberofthreads,
para->getParD()->neighborX, para->getParD()->neighborX,
para->getParD()->neighborY, para->getParD()->neighborY,
para->getParD()->neighborZ, para->getParD()->neighborZ,
para->getParD()->typeOfGridNode, para->getParD()->typeOfGridNode,
para->getParD()->concentration, para->getParD()->concentration,
para->getParD()->velocityX, para->getParD()->velocityX,
para->getParD()->velocityY, para->getParD()->velocityY,
para->getParD()->velocityZ, para->getParD()->velocityZ,
para->getParD()->numberOfNodes, para->getParD()->numberOfNodes,
para->getParD()->distributionsAD.f[0], para->getParD()->distributionsAD.f[0],
para->getParD()->isEvenTimestep); para->getParD()->isEvenTimestep);
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
para->getParD()->isEvenTimestep = false; para->getParD()->isEvenTimestep = false;
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
InitADdevice( InitADdevice(
para->getParD()->numberofthreads, para->getParD()->numberofthreads,
para->getParD()->neighborX, para->getParD()->neighborX,
para->getParD()->neighborY, para->getParD()->neighborY,
para->getParD()->neighborZ, para->getParD()->neighborZ,
para->getParD()->typeOfGridNode, para->getParD()->typeOfGridNode,
para->getParD()->concentration, para->getParD()->concentration,
para->getParD()->velocityX, para->getParD()->velocityX,
para->getParD()->velocityY, para->getParD()->velocityY,
para->getParD()->velocityZ, para->getParD()->velocityZ,
para->getParD()->numberOfNodes, para->getParD()->numberOfNodes,
para->getParD()->distributionsAD.f[0], para->getParD()->distributionsAD.f[0],
para->getParD()->isEvenTimestep); para->getParD()->isEvenTimestep);
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
CalcConcentration27( CalcConcentration27(
para->getParD()->numberofthreads, para->getParD()->numberofthreads,
para->getParD()->concentration, para->getParD()->concentration,
para->getParD()->typeOfGridNode, para->getParD()->typeOfGridNode,
para->getParD()->neighborX, para->getParD()->neighborX,
para->getParD()->neighborY, para->getParD()->neighborY,
para->getParD()->neighborZ, para->getParD()->neighborZ,
para->getParD()->numberOfNodes, para->getParD()->numberOfNodes,
para->getParD()->distributionsAD.f[0], para->getParD()->distributionsAD.f[0],
para->getParD()->isEvenTimestep); para->getParD()->isEvenTimestep);
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
void setInitialNodeValuesAD(SPtr<Parameter> para, SPtr<CudaMemoryManager> cudaMemoryManager) void setInitialNodeValuesAD(SPtr<Parameter> para, SPtr<CudaMemoryManager> cudaMemoryManager)
{ {
for (uint j = 1; j <= para->getParH()->numberOfNodes; j++) for (uint j = 1; j <= para->getParH()->numberOfNodes; j++) {
{ const real coordX = para->getParH()->coordinateX[j];
const real coordX = para->getParH()->coordinateX[j]; const real coordY = para->getParH()->coordinateY[j];
const real coordY = para->getParH()->coordinateY[j]; const real coordZ = para->getParH()->coordinateZ[j];
const real coordZ = para->getParH()->coordinateZ[j];
real concentration;
real dist=0;
// float rand_min=-0.01, rand_max=0.01; real concentration;
// float random = ((float) rand()) / (float) RAND_MAX; real dist = 0;
// float diff = rand_max - rand_min;
// float r = random * diff;
// dist = rand_min + r;
// call functor object with initial condition //float rand_min=-0.01, rand_max=0.01;
if (para->getInitialConditionAD()) //float random = ((float) rand()) / (float) RAND_MAX;
{ //float diff = rand_max - rand_min;
para->getInitialConditionAD()(coordX, coordY, coordZ, concentration, dist); //float r = random * diff;
} //dist = rand_min + r;
else
{
concentration = real(0.0);
}
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) void calcAD(SPtr<Parameter> para)
{ {
FactorizedCentralMomentsAdvectionDiffusionDeviceKernel( FactorizedCentralMomentsAdvectionDiffusionDeviceKernel(
para->getParD()->numberofthreads, para->getParD()->numberofthreads,
para->getParD()->omegaD, para->getParD()->omegaD,
para->getParD()->typeOfGridNode, para->getParD()->typeOfGridNode,
para->getParD()->neighborX, para->getParD()->neighborX,
para->getParD()->neighborY, para->getParD()->neighborY,
para->getParD()->neighborZ, para->getParD()->neighborZ,
para->getParD()->distributions.f[0], para->getParD()->distributions.f[0],
para->getParD()->distributionsAD.f[0], para->getParD()->distributionsAD.f[0],
para->getParD()->numberOfNodes, para->getParD()->numberOfNodes,
para->getParD()->forcing, para->getParD()->forcing,
para->getParD()->isEvenTimestep); para->getParD()->isEvenTimestep);
/*CentralMomentsAdvectionDiffusionDeviceKernel( /*CentralMomentsAdvectionDiffusionDeviceKernel(
para->getParD()->numberofthreads, para->getParD()->numberofthreads,
para->getParD()->omegaD, para->getParD()->omegaD,
para->getParD()->typeOfGridNode, para->getParD()->typeOfGridNode,
para->getParD()->neighborX, para->getParD()->neighborX,
para->getParD()->neighborY, para->getParD()->neighborY,
para->getParD()->neighborZ, para->getParD()->neighborZ,
para->getParD()->distributions.f[0], para->getParD()->distributions.f[0],
para->getParD()->distributionsAD.f[0], para->getParD()->distributionsAD.f[0],
para->getParD()->numberOfNodes, para->getParD()->numberOfNodes,
para->getParD()->forcing, para->getParD()->forcing,
para->getParD()->isEvenTimestep);*/ 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);
}
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) void printAD(SPtr<Parameter> para, SPtr<CudaMemoryManager> cudaMemoryManager)
{ {
CalcConcentration27( CalcConcentration27(
para->getParD()->numberofthreads, para->getParD()->numberofthreads,
para->getParD()->concentration, para->getParD()->concentration,
para->getParD()->typeOfGridNode, para->getParD()->typeOfGridNode,
para->getParD()->neighborX, para->getParD()->neighborX,
para->getParD()->neighborY, para->getParD()->neighborY,
para->getParD()->neighborZ, para->getParD()->neighborZ,
para->getParD()->numberOfNodes, para->getParD()->numberOfNodes,
para->getParD()->distributionsAD.f[0], para->getParD()->distributionsAD.f[0],
para->getParD()->isEvenTimestep); para->getParD()->isEvenTimestep);
cudaMemoryManager->cudaCopyConcentrationDeviceToHost(); cudaMemoryManager->cudaCopyConcentrationDeviceToHost();
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment