Skip to content
Snippets Groups Projects
Commit e93e8e91 authored by Hkorb's avatar Hkorb
Browse files

Merge branch 'python_bindings' into 'amd'

# Conflicts:
#   src/gpu/VirtualFluids_GPU/Calculation/UpdateGrid27.h
parents 441ba379 f57fdfec
No related branches found
No related tags found
1 merge request!84Python bindings, amd, actuator line
......@@ -8,10 +8,12 @@ class PlaneProbe : public Probe
public:
PlaneProbe(
const std::string _probeName,
const std::string _outputPath,
uint _tStartAvg,
uint _tStartOut,
uint _tOut
): Probe(_probeName,
): Probe(_probeName,
_outputPath,
_tStartAvg,
_tStartOut,
_tOut)
......
......@@ -8,10 +8,12 @@ class PointProbe: public Probe
public:
PointProbe(
const std::string _probeName,
const std::string _outputPath,
uint _tStartAvg,
uint _tStartOut,
uint _tOut
): Probe(_probeName,
): Probe(_probeName,
_outputPath,
_tStartAvg,
_tStartOut,
_tOut)
......
......@@ -18,6 +18,12 @@ std::vector<std::string> getPostProcessingVariableNames(PostProcessingVariable v
std::vector<std::string> varNames;
switch (variable)
{
case PostProcessingVariable::Instantaneous:
varNames.push_back("vx");
varNames.push_back("vy");
varNames.push_back("vz");
varNames.push_back("rho");
break;
case PostProcessingVariable::Means:
varNames.push_back("vx_mean");
varNames.push_back("vy_mean");
......@@ -42,6 +48,15 @@ __device__ void calculateQuantities(uint n, real* quantityArray, bool* quantitie
// also has extensions for higher order and covariances
real inv_n = 1/real(n);
if(quantities[int(PostProcessingVariable::Instantaneous)])
{
uint arrOff = quantityArrayOffsets[int(PostProcessingVariable::Instantaneous)];
quantityArray[(arrOff+0)*nPoints+node] = vx;
quantityArray[(arrOff+1)*nPoints+node] = vy;
quantityArray[(arrOff+2)*nPoints+node] = vz;
quantityArray[(arrOff+3)*nPoints+node] = rho;
}
if(quantities[int(PostProcessingVariable::Means)])
{
......@@ -136,7 +151,6 @@ __global__ void interpQuantities( uint* pointIndices,
}
void Probe::init(Parameter* para, GridProvider* gridProvider, CudaMemoryManager* cudaManager)
{
......@@ -158,13 +172,11 @@ void Probe::init(Parameter* para, GridProvider* gridProvider, CudaMemoryManager*
this->addProbeStruct(cudaManager, probeIndices_level,
distX_level, distY_level, distZ_level,
pointCoordsX_level, pointCoordsX_level, pointCoordsX_level,
pointCoordsX_level, pointCoordsY_level, pointCoordsZ_level,
level);
}
}
void Probe::addProbeStruct(CudaMemoryManager* cudaManager, std::vector<int>& probeIndices,
std::vector<real>& distX, std::vector<real>& distY, std::vector<real>& distZ,
std::vector<real>& pointCoordsX, std::vector<real>& pointCoordsY, std::vector<real>& pointCoordsZ,
......@@ -223,7 +235,6 @@ void Probe::addProbeStruct(CudaMemoryManager* cudaManager, std::vector<int>& pro
cudaManager->cudaCopyProbeQuantityArrayHtoD(this, level);
}
void Probe::interact(Parameter* para, CudaMemoryManager* cudaManager, int level, uint t)
{
......@@ -255,8 +266,6 @@ void Probe::free(Parameter* para, CudaMemoryManager* cudaManager)
}
}
void Probe::addPostProcessingVariable(PostProcessingVariable variable)
{
this->quantities[int(variable)] = true;
......@@ -296,7 +305,7 @@ void Probe::writeCollectionFile(Parameter* para, int t)
std::ofstream file;
file.open( filename + ".pvtu" );
file.open(this->outputPath + "/" + filename + ".pvtu" );
//////////////////////////////////////////////////////////////////////////
......@@ -370,6 +379,9 @@ void Probe::writeGridFiles(Parameter* para, int level, std::vector<std::string>&
switch(quantity)
{
case PostProcessingVariable::Instantaneous:
coeff = para->getVelocityRatio();
break;
case PostProcessingVariable::Means:
coeff = para->getVelocityRatio();
break;
......@@ -390,7 +402,7 @@ void Probe::writeGridFiles(Parameter* para, int level, std::vector<std::string>&
}
}
}}
WbWriterVtkXmlBinary::getInstance()->writeNodesWithNodeData(fnames[part], nodes, nodedatanames, nodedata);
WbWriterVtkXmlBinary::getInstance()->writeNodesWithNodeData(this->outputPath + "/" + fnames[part], nodes, nodedatanames, nodedata);
}
}
......@@ -405,4 +417,3 @@ std::vector<std::string> Probe::getVarNames()
}}
return varNames;
}
......@@ -12,6 +12,7 @@ enum class PostProcessingVariable{
// In writeGridFiles add lb->rw conversion factor
// In getPostProcessingVariableNames add names
// If new quantity depends on other quantities i.e. mean, catch in addPostProcessingVariable
Instantaneous,
Means,
Variances,
LAST,
......@@ -43,10 +44,12 @@ class Probe : public PreCollisionInteractor
public:
Probe(
const std::string _probeName,
const std::string _outputPath,
uint _tStartAvg,
uint _tStartOut,
uint _tOut
): probeName(_probeName),
outputPath(_outputPath),
tStartAvg(_tStartAvg),
tStartOut(_tStartOut),
tOut(_tOut),
......@@ -54,9 +57,10 @@ public:
{
assert("Output starts before averaging!" && tStartOut>=tStartAvg);
}
void init(Parameter* para, GridProvider* gridProvider, CudaMemoryManager* cudaManager);
void interact(Parameter* para, CudaMemoryManager* cudaManager, int level, uint t);
void free(Parameter* para, CudaMemoryManager* cudaManager);
void init(Parameter* para, GridProvider* gridProvider, CudaMemoryManager* cudaManager) override;
void interact(Parameter* para, CudaMemoryManager* cudaManager, int level, uint t) override;
void free(Parameter* para, CudaMemoryManager* cudaManager) override;
SPtr<ProbeStruct> getProbeStruct(int level){ return this->probeParams[level]; }
......@@ -80,9 +84,10 @@ private:
private:
const std::string probeName;
const std::string outputPath;
std::vector<SPtr<ProbeStruct>> probeParams;
bool quantities[int(PostProcessingVariable::LAST)];
bool quantities[int(PostProcessingVariable::LAST)] = {};
std::vector<std::string> fileNamesForCollectionFile;
std::vector<std::string> varNames;
......
......@@ -4,7 +4,7 @@ project(lbmCuda LANGUAGES CUDA CXX)
vf_add_library(NAME lbmCuda BUILDTYPE static PUBLIC_LINK basics FOLDER ../../lbm)
set_target_properties(lbmCuda PROPERTIES CUDA_SEPARABLE_COMPILATION ON)
set_target_properties(lbmCuda PROPERTIES CUDA_SEPARABLE_COMPILATION ON POSITION_INDEPENDENT_CODE ON)
set_source_files_properties(../KernelParameter.cpp PROPERTIES LANGUAGE CUDA)
......
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