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 @@
//! \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();
}
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