Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • irmb/VirtualFluids
1 result
Show changes
Commits on Source (108)
Showing
with 250 additions and 217 deletions
......@@ -22,5 +22,5 @@
"runArgs": ["--gpus","all", // remove this line in case you have no gpus available
"--hostname=${localEnv:HOSTNAME}"], // HOSTNAME needs to be known by the vscode environment. It is probably necessary to add "export HOSTNAME=<hostname>" to the config file of your host machine's bash.
"image": "git.rz.tu-bs.de:4567/irmb/virtualfluids/ubuntu22_04:1.2"
"image": "git.rz.tu-bs.de:4567/irmb/virtualfluids/ubuntu22_04:1.3"
}
......@@ -27,7 +27,7 @@
# SPDX-FileCopyrightText: Copyright © VirtualFluids Project contributors, see AUTHORS.md in root folder
#
#=======================================================================================
image: git.rz.tu-bs.de:4567/irmb/virtualfluids/ubuntu22_04:1.2
image: git.rz.tu-bs.de:4567/irmb/virtualfluids/ubuntu22_04:1.3
stages:
- build
......
......@@ -125,3 +125,7 @@ if(NOT yaml-cpp_POPULATED)
FetchContent_Populate(yaml-cpp)
add_subdirectory(${yaml-cpp_SOURCE_DIR} ${yaml-cpp_BINARY_DIR})
endif()
# Metis
add_subdirectory(${VF_THIRD_DIR}/metis/metis-5.1.0)
target_compile_definitions(project_options INTERFACE VF_METIS)
\ No newline at end of file
......@@ -78,13 +78,11 @@ option(VF_RANGECHECK "Enable rangecheck in Release, if VF_NO_RANGECHECK is OFF"
include(CMake/ProjectSettings.cmake)
include(CMake/Packages.cmake)
add_subdirectory(src/logger)
add_subdirectory(src/basics)
add_subdirectory(src/parallel)
add_subdirectory(src/lbm)
if(VF_ENABLE_CPU)
include(cpu.cmake)
endif()
......
......@@ -30,7 +30,7 @@
# VirtualFluids Development Image:
# Ubuntu 22.04
FROM nvidia/cuda:12.2.0-devel-ubuntu22.04
FROM nvidia/cuda:12.4.1-devel-ubuntu22.04
# timezone
ARG TZ
......
......@@ -162,8 +162,8 @@ grid_builder.set_slip_boundary_condition(gpu.SideType.PZ, 0, 0, -1)
if read_precursor:
grid_builder.set_pressure_boundary_condition(gpu.SideType.PX, 0)
bc_factory.set_stress_boundary_condition(gpu.StressBC.StressPressureBounceBack)
bc_factory.set_slip_boundary_condition(gpu.SlipBC.SlipCompressibleTurbulentViscosity)
bc_factory.set_stress_boundary_condition(gpu.StressBC.StressBounceBackPressureCompressible)
bc_factory.set_slip_boundary_condition(gpu.SlipBC.SlipTurbulentViscosityCompressible)
bc_factory.set_pressure_boundary_condition(gpu.PressureBC.OutflowNonReflective)
if read_precursor:
bc_factory.set_precursor_boundary_condition(gpu.PrecursorBC.DistributionsPrecursor if use_distributions else gpu.PrecursorBC.VelocityPrecursor)
......@@ -181,36 +181,37 @@ para.set_outflow_pressure_correction_factor(0.0)
para.set_initial_condition_perturbed_log_law(u_star, z0, length[0], length[2], boundary_layer_height, velocity_ratio)
#%%
cuda_memory_manager = gpu.CudaMemoryManager(para)
smearing_width = 1.5*dx
blade_radius = 0.5*turbine_diameter
hub_height_velocity = get_velocity(turbine_height, u_star, kappa, z0)
rotor_speeds = np.ones(1)*tip_speed_ratio*hub_height_velocity/blade_radius
alm = gpu.ActuatorFarmStandalone(turbine_diameter, n_blade_nodes, turbine_positions_x, turbine_positions_y, turbine_positions_z, rotor_speeds, density, smearing_width, level, dt, dx)
alm = gpu.ActuatorFarmStandalone(para, cuda_memory_manager, turbine_diameter, n_blade_nodes, turbine_positions_x, turbine_positions_y, turbine_positions_z, rotor_speeds, density, smearing_width, level, dt, dx)
alm.enable_output("ALM", int(t_start_out_probe/dt), int(t_out_probe/dt) )
para.add_actuator(alm)
para.add_interactor(alm)
#%%
planar_average_probe = gpu.probes.PlanarAverageProbe("horizontalPlanes", para.get_output_path(), 0, int(t_start_tmp_averaging/dt), int(t_averaging/dt) , int(t_start_out_probe/dt), int(t_out_probe/dt), 'z')
planar_average_probe = gpu.probes.PlanarAverageProbe(para, cuda_memory_manager, "horizontalPlanes", para.get_output_path(), 0, int(t_start_tmp_averaging/dt), int(t_averaging/dt) , int(t_start_out_probe/dt), int(t_out_probe/dt), 'z')
planar_average_probe.add_all_available_statistics()
planar_average_probe.set_file_name_to_n_out()
para.add_probe(planar_average_probe)
para.add_sampler(planar_average_probe)
#%%
wall_model_probe = gpu.probes.WallModelProbe("wallModelProbe", para.get_output_path(), 0, int(t_start_tmp_averaging/dt), int(t_averaging/dt/4), int(t_start_out_probe/dt), int(t_out_probe/dt))
wall_model_probe = gpu.probes.WallModelProbe(para, cuda_memory_manager, "wallModelProbe", para.get_output_path(), 0, int(t_start_tmp_averaging/dt), int(t_averaging/dt/4), int(t_start_out_probe/dt), int(t_out_probe/dt))
wall_model_probe.add_all_available_statistics()
wall_model_probe.set_file_name_to_n_out()
wall_model_probe.set_force_output_to_stress(True)
if para.get_is_body_force():
wall_model_probe.set_evaluate_pressure_gradient(True)
para.add_probe(wall_model_probe)
para.add_sampler(wall_model_probe)
plane_locs = [100,]
if read_precursor: plane_locs.extend([1000, 1500, 2000, 2500, 0])
for n_probe, probe_pos in enumerate(plane_locs):
plane_probe = gpu.probes.PlaneProbe(f"planeProbe_{n_probe+1}", para.get_output_path(), int(t_start_averaging/dt), 10, int(t_start_out_probe/dt), int(t_out_probe/dt))
plane_probe = gpu.probes.PlaneProbe(para, cuda_memory_manager, f"planeProbe_{n_probe+1}", para.get_output_path(), int(t_start_averaging/dt), 10, int(t_start_out_probe/dt), int(t_out_probe/dt))
plane_probe.set_probe_plane(probe_pos, 0, 0, dx, length[1], length[2])
plane_probe.add_all_available_statistics()
para.add_probe(plane_probe)
para.add_sampler(plane_probe)
#%%
sim = gpu.Simulation(para, grid_builder, bc_factory, tm_factory, grid_scaling_factory)
#%%
......
......@@ -159,38 +159,39 @@ if read_precursor:
bc_factory.set_pressure_boundary_condition(gpu.PressureBC.OutflowNonReflective)
bc_factory.set_precursor_boundary_condition(gpu.PrecursorBC.DistributionsPrecursor if use_distributions else gpu.PrecursorBC.VelocityPrecursor)
bc_factory.set_stress_boundary_condition(gpu.StressBC.StressPressureBounceBack)
bc_factory.set_slip_boundary_condition(gpu.SlipBC.SlipBounceBack)
bc_factory.set_stress_boundary_condition(gpu.StressBC.StressBounceBackPressureCompressible)
bc_factory.set_slip_boundary_condition(gpu.SlipBC.SlipCompressible)
para.set_outflow_pressure_correction_factor(0.0);
#%%
para.set_initial_condition_perturbed_log_law(u_star, z0, length[0], length[2], boundary_layer_height, dx/dx)
cuda_memory_manager = gpu.CudaMemoryManager(para)
#%%
planar_average_probe = gpu.probes.PlanarAverageProbe("horizontalPlanes", para.get_output_path(), 0, int(t_start_tmp_averaging/dt), int(t_averaging/dt) , int(t_start_out_probe/dt), int(t_out_probe/dt), 'z')
planar_average_probe = gpu.probes.PlanarAverageProbe(para, cuda_memory_manager, "horizontalPlanes", para.get_output_path(), 0, int(t_start_tmp_averaging/dt), int(t_averaging/dt) , int(t_start_out_probe/dt), int(t_out_probe/dt), 'z')
planar_average_probe.add_all_available_statistics()
planar_average_probe.set_file_name_to_n_out()
para.add_probe(planar_average_probe)
para.add_sampler(planar_average_probe)
#%%
wall_model_probe = gpu.probes.WallModelProbe("wallModelProbe", para.get_output_path(), 0, int(t_start_tmp_averaging/dt), int(t_averaging/dt/4), int(t_start_out_probe/dt), int(t_out_probe/dt))
wall_model_probe = gpu.probes.WallModelProbe(para, cuda_memory_manager, "wallModelProbe", para.get_output_path(), 0, int(t_start_tmp_averaging/dt), int(t_averaging/dt/4), int(t_start_out_probe/dt), int(t_out_probe/dt))
wall_model_probe.add_all_available_statistics()
wall_model_probe.set_file_name_to_n_out()
wall_model_probe.set_force_output_to_stress(True)
if para.get_is_body_force():
wall_model_probe.set_evaluate_pressure_gradient(True)
para.add_probe(wall_model_probe)
para.add_sampler(wall_model_probe)
plane_locs = [100,]
if read_precursor: plane_locs.extend([1000, 1500, 2000, 2500, 0])
for n_probe, probe_pos in enumerate(plane_locs):
plane_probe = gpu.probes.PlaneProbe(f"planeProbe_{n_probe+1}", para.get_output_path(), int(t_start_averaging/dt), 10, int(t_start_out_probe/dt), int(t_out_probe/dt))
plane_probe = gpu.probes.PlaneProbe(para, cuda_memory_manager, f"planeProbe_{n_probe+1}", para.get_output_path(), int(t_start_averaging/dt), 10, int(t_start_out_probe/dt), int(t_out_probe/dt))
plane_probe.set_probe_plane(probe_pos, 0, 0, dx, length[1], length[2])
plane_probe.add_all_available_statistics()
para.add_probe(plane_probe)
para.add_sampler(plane_probe)
if write_precursor:
precursor_writer = gpu.PrecursorWriter("precursor", para.get_output_path() + precursor_directory, pos_x_precursor, 0,length[1], 0, length[2], t_start_precursor/dt, nTWritePrecursor, gpu.OutputVariable.Distributions if use_distributions else gpu.OutputVariable.Velocities)
para.add_probe(precursor_writer)
precursor_writer = gpu.PrecursorWriter(para, cuda_memory_manager, "precursor", para.get_output_path() + precursor_directory, pos_x_precursor, 0,length[1], 0, length[2], t_start_precursor/dt, nTWritePrecursor, gpu.OutputVariable.Distributions if use_distributions else gpu.OutputVariable.Velocities)
para.add_sampler(precursor_writer)
#%%
sim = gpu.Simulation(para, grid_builder, bc_factory, tm_factory, grid_scaling_factory)
......
......@@ -49,17 +49,19 @@
#include "gpu/core/BoundaryConditions/BoundaryConditionFactory.h"
#include "gpu/core/Calculation/Simulation.h"
#include "gpu/core/Cuda/CudaMemoryManager.h"
#include "gpu/core/DataStructureInitializer/GridProvider.h"
#include "gpu/core/DataStructureInitializer/GridReaderGenerator/GridGenerator.h"
#include "gpu/core/GridScaling/GridScalingFactory.h"
#include "gpu/core/Kernel/KernelTypes.h"
#include "gpu/core/Output/FileWriter.h"
#include "gpu/core/Parameter/Parameter.h"
#include "gpu/core/PreCollisionInteractor/Actuator/ActuatorFarmStandalone.h"
#include "gpu/core/PreCollisionInteractor/Probes/PlaneProbe.h"
#include "gpu/core/PreCollisionInteractor/Probes/PointProbe.h"
#include "gpu/core/PreCollisionInteractor/Probes/Probe.h"
#include "gpu/core/Samplers/Probe.h"
#include "gpu/core/TurbulenceModels/TurbulenceModelFactory.h"
//////////////////////////////////////////////////////////////////////////
const std::string defaultConfigFile = "actuatorline.cfg";
void run(const vf::basics::ConfigurationFile& config)
{
......@@ -174,12 +176,15 @@ void run(const vf::basics::ConfigurationFile& config)
gridBuilder->setPressureBoundaryCondition(SideType::PX, 0.0);
BoundaryConditionFactory bcFactory = BoundaryConditionFactory();
bcFactory.setVelocityBoundaryCondition(BoundaryConditionFactory::VelocityBC::VelocityWithPressureInterpolatedCompressible);
bcFactory.setVelocityBoundaryCondition(
BoundaryConditionFactory::VelocityBC::VelocityWithPressureInterpolatedCompressible);
bcFactory.setPressureBoundaryCondition(BoundaryConditionFactory::PressureBC::OutflowNonReflective);
SPtr<TurbulenceModelFactory> tmFactory = std::make_shared<TurbulenceModelFactory>(para);
tmFactory->readConfigFile(config);
auto cudaMemoryManager = std::make_shared<CudaMemoryManager>(para);
//////////////////////////////////////////////////////////////////////////
// add turbine
//////////////////////////////////////////////////////////////////////////
......@@ -192,9 +197,9 @@ void run(const vf::basics::ConfigurationFile& config)
const std::vector<real> rotorSpeeds { 2 * tipSpeedRatio * velocity / rotorDiameter };
SPtr<ActuatorFarmStandalone> actuatorFarm = std::make_shared<ActuatorFarmStandalone>(
rotorDiameter, actuatorNodesPerBlade, turbinePositionsX, turbinePositionsY, turbinePositionsZ, rotorSpeeds, density,
smearingWidth, level, deltaT, deltaX);
para->addActuator(actuatorFarm);
para, cudaMemoryManager, rotorDiameter, actuatorNodesPerBlade, turbinePositionsX, turbinePositionsY,
turbinePositionsZ, rotorSpeeds, density, smearingWidth, level, deltaT, deltaX);
para->addInteractor(actuatorFarm);
actuatorFarm->enableOutput("ActuatorLineForcesAndVelocities", timeStepStartOutProbe, timeStepOutProbe);
......@@ -206,42 +211,43 @@ void run(const vf::basics::ConfigurationFile& config)
for (size_t i = 0; i < planePositions.size(); i++) {
const std::string name = "planeProbe_" + std::to_string(i);
SPtr<PlaneProbe> planeProbe =
std::make_shared<PlaneProbe>(name, para->getOutputPath(), timeStepStartTemporalAveraging,
numberOfAvergingTimeSteps, timeStepStartOutProbe, timeStepOutProbe);
planeProbe->setProbePlane(turbinePositionsX[0] + planePositions[i], -0.5 * lengthY, -0.5 * lengthZ, deltaX, lengthY, lengthZ);
planeProbe->addStatistic(Statistic::Means);
planeProbe->addStatistic(Statistic::Variances);
planeProbe->addStatistic(Statistic::Instantaneous);
para->addProbe(planeProbe);
auto planeProbe =
std::make_shared<Probe>(para, cudaMemoryManager, para->getOutputPath(), name, timeStepStartTemporalAveraging,
numberOfAvergingTimeSteps, timeStepStartOutProbe, timeStepOutProbe, false, false);
planeProbe->addProbePlane(turbinePositionsX[0] + planePositions[i], -0.5 * lengthY, -0.5 * lengthZ, deltaX, lengthY,
lengthZ);
planeProbe->addStatistic(Probe::Statistic::Means);
planeProbe->addStatistic(Probe::Statistic::Variances);
planeProbe->addStatistic(Probe::Statistic::Instantaneous);
para->addSampler(planeProbe);
}
SPtr<PlaneProbe> planeProbeVertical =
std::make_shared<PlaneProbe>("planeProbeVertical", para->getOutputPath(), timeStepStartTemporalAveraging,
numberOfAvergingTimeSteps, timeStepStartOutProbe, timeStepOutProbe);
planeProbeVertical->setProbePlane(0, turbinePositionsY[0], -0.5 * lengthZ, lengthX, deltaX, lengthZ);
planeProbeVertical->addStatistic(Statistic::Means);
planeProbeVertical->addStatistic(Statistic::Variances);
planeProbeVertical->addStatistic(Statistic::Instantaneous);
para->addProbe(planeProbeVertical);
SPtr<PlaneProbe> planeProbeHorizontal =
std::make_shared<PlaneProbe>("planeProbeHorizontal", para->getOutputPath(), timeStepStartTemporalAveraging,
numberOfAvergingTimeSteps, timeStepStartOutProbe, timeStepOutProbe);
planeProbeHorizontal->setProbePlane(0, -0.5 * lengthY, turbinePositionsZ[0], lengthX, lengthY, deltaX);
planeProbeHorizontal->addStatistic(Statistic::Means);
planeProbeHorizontal->addStatistic(Statistic::Variances);
planeProbeHorizontal->addStatistic(Statistic::Instantaneous);
para->addProbe(planeProbeHorizontal);
auto planeProbeVertical = std::make_shared<Probe>(para, cudaMemoryManager, para->getOutputPath(), "planeProbeVertical",
timeStepStartTemporalAveraging, numberOfAvergingTimeSteps,
timeStepStartOutProbe, timeStepOutProbe, false, false);
planeProbeVertical->addProbePlane(0, turbinePositionsY[0], -0.5 * lengthZ, lengthX, deltaX, lengthZ);
planeProbeVertical->addStatistic(Probe::Statistic::Means);
planeProbeVertical->addStatistic(Probe::Statistic::Variances);
planeProbeVertical->addStatistic(Probe::Statistic::Instantaneous);
para->addSampler(planeProbeVertical);
auto planeProbeHorizontal = std::make_shared<Probe>(
para, cudaMemoryManager, para->getOutputPath(), "planeProbeHorizontal", timeStepStartTemporalAveraging,
numberOfAvergingTimeSteps, timeStepStartOutProbe, timeStepOutProbe, false, false);
planeProbeHorizontal->addProbePlane(0, -0.5 * lengthY, turbinePositionsZ[0], lengthX, lengthY, deltaX);
planeProbeHorizontal->addStatistic(Probe::Statistic::Means);
planeProbeHorizontal->addStatistic(Probe::Statistic::Variances);
planeProbeHorizontal->addStatistic(Probe::Statistic::Instantaneous);
para->addSampler(planeProbeHorizontal);
if (probePositionsX.size() > 0) {
SPtr<PointProbe> timeseriesProbe =
std::make_shared<PointProbe>("timeProbe", para->getOutputPath(), timeStepStartTemporalAveraging,
timeStepAverageTimeSeriesProbe, timeStepStartOutProbe, timeStepOutProbe, true);
auto timeseriesProbe = std::make_shared<Probe>(para, cudaMemoryManager, para->getOutputPath(), "timeProbe",
timeStepStartTemporalAveraging, timeStepAverageTimeSeriesProbe,
timeStepStartOutProbe, timeStepOutProbe, true, false);
timeseriesProbe->addProbePointsFromList(probePositionsX, probePositionsY, probePositionsZ);
timeseriesProbe->addStatistic(Statistic::Instantaneous);
timeseriesProbe->addStatistic(Statistic::Means);
para->addProbe(timeseriesProbe);
timeseriesProbe->addStatistic(Probe::Statistic::Instantaneous);
timeseriesProbe->addStatistic(Probe::Statistic::Means);
para->addSampler(timeseriesProbe);
}
//////////////////////////////////////////////////////////////////////////
......@@ -258,7 +264,7 @@ void run(const vf::basics::ConfigurationFile& config)
VF_LOG_INFO("smearingWidth [m] = {}", smearingWidth);
VF_LOG_INFO("tipSpeedRatio = {}", tipSpeedRatio);
Simulation simulation(para, gridBuilder, &bcFactory, tmFactory);
Simulation simulation(para, cudaMemoryManager, gridBuilder, &bcFactory, tmFactory);
simulation.run();
}
......@@ -266,7 +272,7 @@ int main(int argc, char* argv[])
{
try {
vf::logging::Logger::initializeLogger();
auto config = vf::basics::loadConfig(argc, argv, "./actuatorline.cfg");
auto config = vf::basics::loadConfig(argc, argv, defaultConfigFile);
run(config);
} catch (const std::exception& e) {
VF_LOG_WARNING("{}", e.what());
......
......@@ -56,17 +56,20 @@
#include "gpu/core/BoundaryConditions/BoundaryConditionFactory.h"
#include "gpu/core/Calculation/Simulation.h"
#include "gpu/core/Cuda/CudaMemoryManager.h"
#include "gpu/core/GridScaling/GridScalingFactory.h"
#include "gpu/core/Kernel/KernelTypes.h"
#include "gpu/core/Parameter/Parameter.h"
#include "gpu/core/PreCollisionInteractor/PrecursorWriter.h"
#include "gpu/core/PreCollisionInteractor/Probes/PlanarAverageProbe.h"
#include "gpu/core/PreCollisionInteractor/Probes/PlaneProbe.h"
#include "gpu/core/PreCollisionInteractor/Probes/WallModelProbe.h"
#include "gpu/core/Samplers/PrecursorWriter.h"
#include "gpu/core/Samplers/PlanarAverageProbe.h"
#include "gpu/core/Samplers/Probe.h"
#include "gpu/core/Samplers/WallModelProbe.h"
#include "gpu/core/TurbulenceModels/TurbulenceModelFactory.h"
using namespace vf::basics::constant;
const std::string defaultConfigFile = "abl.cfg";
void run(const vf::basics::ConfigurationFile& config)
{
const std::string simulationName("AtmosphericBoundaryLayer");
......@@ -95,7 +98,7 @@ void run(const vf::basics::ConfigurationFile& config)
const bool useDistributionsForPrecursor = config.getValue<bool>("UseDistributions", false);
std::string precursorDirectory = config.getValue<std::string>("PrecursorDirectory", "precursor/");
if(precursorDirectory.back() != '/')
if (precursorDirectory.back() != '/')
precursorDirectory += '/';
const int timeStepsWritePrecursor = config.getValue<int>("nTimestepsWritePrecursor", 10);
const real timeStartPrecursor = config.getValue<real>("tStartPrecursor", 36000.);
......@@ -171,18 +174,18 @@ void run(const vf::basics::ConfigurationFile& config)
const bool isLastSubDomain = isMultiGPU && (processID == numberOfProcesses - 1);
const bool isMidSubDomain = isMultiGPU && !(isFirstSubDomain || isLastSubDomain);
if (isFirstSubDomain){
if (isFirstSubDomain) {
xGridMax += overlap;
}
if (isFirstSubDomain && !usePrecursorInflow){
if (isFirstSubDomain && !usePrecursorInflow) {
xGridMin -= overlap;
}
if (isLastSubDomain){
if (isLastSubDomain) {
xGridMin -= overlap;
}
if (isLastSubDomain && !usePrecursorInflow){
if (isLastSubDomain && !usePrecursorInflow) {
xGridMax += overlap;
}
......@@ -328,24 +331,21 @@ void run(const vf::basics::ConfigurationFile& config)
//////////////////////////////////////////////////////////////////////////
// add probes
//////////////////////////////////////////////////////////////////////////
auto cudaMemoryManager = std::make_shared<CudaMemoryManager>(para);
if (!usePrecursorInflow && (isFirstSubDomain || !isMultiGPU)) {
const auto planarAverageProbe = std::make_shared<PlanarAverageProbe>(
"planarAverageProbe", para->getOutputPath(), timeStepStartAveraging, timeStepStartTemporalAveraging, timeStepAveraging,
timeStepStartOutProbe, timeStepOutProbe, 'z');
para, cudaMemoryManager, para->getOutputPath(), "planarAverageProbe", timeStepStartAveraging,
timeStepStartTemporalAveraging, timeStepAveraging, timeStepStartOutProbe, timeStepOutProbe, PlanarAverageProbe::PlaneNormal::z, true);
planarAverageProbe->addAllAvailableStatistics();
planarAverageProbe->setFileNameToNOut();
para->addProbe(planarAverageProbe);
para->addSampler(planarAverageProbe);
const auto wallModelProbe = std::make_shared<WallModelProbe>(
"wallModelProbe", para->getOutputPath(), timeStepStartAveraging, timeStepStartTemporalAveraging,
timeStepAveraging / 4, timeStepStartOutProbe, timeStepOutProbe);
para, cudaMemoryManager, para->getOutputPath(), "wallModelProbe", timeStepStartAveraging,
timeStepStartTemporalAveraging, timeStepAveraging / 4, timeStepStartOutProbe, timeStepOutProbe, false, true, true, para->getIsBodyForce());
wallModelProbe->addAllAvailableStatistics();
wallModelProbe->setFileNameToNOut();
wallModelProbe->setForceOutputToStress(true);
if (para->getIsBodyForce())
wallModelProbe->setEvaluatePressureGradient(true);
para->addProbe(wallModelProbe);
para->addSampler(wallModelProbe);
para->setHasWallModelMonitor(true);
}
......@@ -353,27 +353,27 @@ void run(const vf::basics::ConfigurationFile& config)
for (int iPlane = 0; iPlane < 3; iPlane++) {
const std::string name = "planeProbe" + std::to_string(iPlane);
const auto horizontalProbe =
std::make_shared<PlaneProbe>(name, para->getOutputPath(), timeStepStartAveraging, averagingTimestepsPlaneProbes,
timeStepStartOutProbe, timeStepOutProbe);
horizontalProbe->setProbePlane(c0o1, c0o1, iPlane * lengthZ / c4o1, lengthX, lengthY, deltaX);
std::make_shared<Probe>(para, cudaMemoryManager, para->getOutputPath(), name, timeStepStartAveraging,
averagingTimestepsPlaneProbes, timeStepStartOutProbe, timeStepOutProbe, false, false);
horizontalProbe->addProbePlane(c0o1, c0o1, iPlane * lengthZ / c4o1, lengthX, lengthY, deltaX);
horizontalProbe->addAllAvailableStatistics();
para->addProbe(horizontalProbe);
para->addSampler(horizontalProbe);
}
auto crossStreamPlane =
std::make_shared<PlaneProbe>("crossStreamPlane", para->getOutputPath(), timeStartAveraging / deltaT,
averagingTimestepsPlaneProbes, timeStepStartOutProbe, timeOutProbe / deltaT);
crossStreamPlane->setProbePlane(c1o2 * lengthX, c0o1, c0o1, deltaX, lengthY, lengthZ);
auto crossStreamPlane = std::make_shared<Probe>(para, cudaMemoryManager, para->getOutputPath(), "crossStreamPlane",
timeStepStartAveraging, averagingTimestepsPlaneProbes,
timeStepStartOutProbe, timeStepOutProbe, false, false);
crossStreamPlane->addProbePlane(c1o2 * lengthX, c0o1, c0o1, deltaX, lengthY, lengthZ);
crossStreamPlane->addAllAvailableStatistics();
para->addProbe(crossStreamPlane);
para->addSampler(crossStreamPlane);
if (usePrecursorInflow) {
auto streamwisePlane =
std::make_shared<PlaneProbe>("streamwisePlane", para->getOutputPath(), timeStartAveraging / deltaT,
averagingTimestepsPlaneProbes, timeStepStartOutProbe, timeOutProbe / deltaT);
streamwisePlane->setProbePlane(c0o1, c1o2 * lengthY, c0o1, lengthX, deltaX, lengthZ);
auto streamwisePlane = std::make_shared<Probe>(
para, cudaMemoryManager, para->getOutputPath(), "streamwisePlane", timeStepStartAveraging,
averagingTimestepsPlaneProbes, timeStepStartOutProbe, timeStepOutProbe, false, false);
streamwisePlane->addProbePlane(c0o1, c1o2 * lengthY, c0o1, lengthX, deltaX, lengthZ);
streamwisePlane->addAllAvailableStatistics();
para->addProbe(streamwisePlane);
para->addSampler(streamwisePlane);
}
if (writePrecursor) {
......@@ -381,9 +381,10 @@ void run(const vf::basics::ConfigurationFile& config)
const auto outputVariable =
useDistributionsForPrecursor ? OutputVariable::Distributions : OutputVariable::Velocities;
auto precursorWriter = std::make_shared<PrecursorWriter>(
"precursor", fullPrecursorDirectory, positionXPrecursorSamplingPlane, c0o1, lengthY, c0o1, lengthZ,
timeStepStartPrecursor, timeStepsWritePrecursor, outputVariable, maximumNumberOfTimestepsPerPrecursorFile);
para->addProbe(precursorWriter);
para, cudaMemoryManager, fullPrecursorDirectory, "precursor", positionXPrecursorSamplingPlane, c0o1, lengthY,
c0o1, lengthZ, timeStepStartPrecursor, timeStepsWritePrecursor, outputVariable,
maximumNumberOfTimestepsPerPrecursorFile);
para->addSampler(precursorWriter);
}
auto tmFactory = std::make_shared<TurbulenceModelFactory>(para);
......@@ -399,7 +400,7 @@ void run(const vf::basics::ConfigurationFile& config)
VF_LOG_INFO("Process ID {} is a mid subdomain");
printf("\n");
Simulation simulation(para, gridBuilder, &bcFactory, tmFactory, &scalingFactory);
Simulation simulation(para, cudaMemoryManager, gridBuilder, &bcFactory, tmFactory, &scalingFactory);
simulation.run();
}
......@@ -407,7 +408,7 @@ int main(int argc, char* argv[])
{
try {
vf::logging::Logger::initializeLogger();
auto config = vf::basics::loadConfig(argc, argv, "./abl.cfg");
auto config = vf::basics::loadConfig(argc, argv, defaultConfigFile);
run(config);
} catch (const std::exception& e) {
VF_LOG_WARNING("{}", e.what());
......
......@@ -51,8 +51,8 @@
#include "gpu/core/GridScaling/GridScalingFactory.h"
#include "gpu/core/Kernel/KernelTypes.h"
#include "gpu/core/Parameter/Parameter.h"
#include "gpu/core/PreCollisionInteractor/Probes/PlaneProbe.h"
#include "gpu/core/PreCollisionInteractor/Probes/PointProbe.h"
#include "gpu/core/Samplers/Probe.h"
#include "gpu/core/Cuda/CudaMemoryManager.h"
void run(const vf::basics::ConfigurationFile& config)
{
......@@ -92,8 +92,7 @@ void run(const vf::basics::ConfigurationFile& config)
auto gridBuilder = std::make_shared<MultipleGridBuilder>();
gridBuilder->addCoarseGrid(-3 * dSphere, -3 * dSphere, -3 * dSphere,
10 * dSphere, 3 * dSphere, 3 * dSphere, deltaX);
gridBuilder->addCoarseGrid(-3 * dSphere, -3 * dSphere, -3 * dSphere, 10 * dSphere, 3 * dSphere, 3 * dSphere, deltaX);
// add geometry: use primitive
// auto sphere = std::make_shared<Sphere>(0.0, 0.0, 0.0, dSphere / 2.0);
......@@ -160,27 +159,29 @@ void run(const vf::basics::ConfigurationFile& config)
// setup probe(s)
//////////////////////////////////////////////////////////////////////////
auto cudaMemoryManager = std::make_shared<CudaMemoryManager>(para);
const uint tStartAveraging = 0;
const uint tAveraging = 100;
const uint tStartOutProbe = 0;
const uint tOutProbe = para->getTimestepOut();
SPtr<PointProbe> pointProbe = std::make_shared<PointProbe>("pointProbe", para->getOutputPath(), tStartAveraging,
tAveraging, tStartOutProbe, tOutProbe);
SPtr<Probe> pointProbe = std::make_shared<Probe>(para, cudaMemoryManager, para->getOutputPath(), "pointProbe",
tStartAveraging, tAveraging, tStartOutProbe, tOutProbe, false, false);
std::vector<real> probeCoordsX = { 0.3, 0.5 };
std::vector<real> probeCoordsY = { 0.0, 0.0 };
std::vector<real> probeCoordsZ = { 0.0, 0.0 };
pointProbe->addProbePointsFromList(probeCoordsX, probeCoordsY, probeCoordsZ);
pointProbe->addStatistic(Statistic::Instantaneous);
pointProbe->addStatistic(Statistic::Means);
pointProbe->addStatistic(Statistic::Variances);
para->addProbe(pointProbe);
pointProbe->addStatistic(Probe::Statistic::Instantaneous);
pointProbe->addStatistic(Probe::Statistic::Means);
pointProbe->addStatistic(Probe::Statistic::Variances);
para->addSampler(pointProbe);
SPtr<PlaneProbe> planeProbe = std::make_shared<PlaneProbe>("planeProbe", para->getOutputPath(), tStartAveraging,
tAveraging, tStartOutProbe, tOutProbe);
planeProbe->setProbePlane(0.4, 0, 0, 0.3, 0.01, 0.1);
planeProbe->addStatistic(Statistic::Instantaneous);
para->addProbe(planeProbe);
SPtr<Probe> planeProbe = std::make_shared<Probe>(para, cudaMemoryManager, para->getOutputPath(), "planeProbe",
tStartAveraging, tAveraging, tStartOutProbe, tOutProbe, false, false);
planeProbe->addProbePlane(0.4, 0, 0, 0.3, 0.01, 0.1);
planeProbe->addStatistic(Probe::Statistic::Instantaneous);
para->addSampler(planeProbe);
//////////////////////////////////////////////////////////////////////////
// initial state of the flow field
......@@ -197,7 +198,7 @@ void run(const vf::basics::ConfigurationFile& config)
// run simulation
//////////////////////////////////////////////////////////////////////////
Simulation simulation(para, gridBuilder, &bcFactory, &scalingFactory);
Simulation simulation(para, cudaMemoryManager, gridBuilder, &bcFactory, &scalingFactory);
simulation.run();
}
......
......@@ -46,14 +46,11 @@ IF(${VF_CP_ENABLE_CATALYST})
target_compile_definitions(project_options INTERFACE VF_CATALYST)
ENDIF()
target_compile_definitions(project_options INTERFACE VF_METIS)
#############################################################
### Libraries ###
#############################################################
add_subdirectory(${VF_THIRD_DIR}/MuParser)
add_subdirectory(${VF_THIRD_DIR}/metis/metis-5.1.0)
add_subdirectory(src/cpu/core)
......
......@@ -45,12 +45,15 @@ from . import kernel as kernel
class PreCollisionInteractor:
def __init__(self, *args, **kwargs) -> None: ...
class Sampler:
def __init__(self, *args, **kwargs) -> None: ...
class FileCollection:
def __init__(self, *args, **kwargs) -> None: ...
class ActuatorFarm(PreCollisionInteractor):
def __init__(self, diameter: float, blade_radii: npt.NDArray[np.float32],turbine_positions_x: npt.NDArray[np.float32], turbine_positions_y: npt.NDArray[np.float32], turbine_positions_z: npt.NDArray[np.float32], density: float, smearing_width: float, level: int, delta_t: float, delta_x: float, use_host_arrays: bool) -> None: ...
def __init__(self, para: Parameter, cuda_memory_manager: CudaMemoryManager, diameter: float, blade_radii: npt.NDArray[np.float32],turbine_positions_x: npt.NDArray[np.float32], turbine_positions_y: npt.NDArray[np.float32], turbine_positions_z: npt.NDArray[np.float32], density: float, smearing_width: float, level: int, delta_t: float, delta_x: float, use_host_arrays: bool) -> None: ...
def update_forces_and_coordinates(self) -> None: ...
def get_all_blade_coords_x(self) -> npt.NDArray[np.float32]: ...
def get_all_blade_coords_x_device(self) -> int: ...
......@@ -117,7 +120,7 @@ class ActuatorFarm(PreCollisionInteractor):
def number_of_turbines(self) -> int: ...
class ActuatorFarmStandalone(ActuatorFarm):
def __init__(self, diameter: float, number_of_nodes_per_blade: int, turbine_positions_x: npt.NDArray[np.float32], turbine_positions_y: npt.NDArray[np.float32], turbine_positions_z: npt.NDArray[np.float32], rotor_speeds: npt.NDArray[np.float32], density: float, smearing_width: float, level: int, delta_t: float, delta_x: float) -> None: ...
def __init__(self, para: Parameter, cuda_memory_manager: CudaMemoryManager, diameter: float, number_of_nodes_per_blade: int, turbine_positions_x: npt.NDArray[np.float32], turbine_positions_y: npt.NDArray[np.float32], turbine_positions_z: npt.NDArray[np.float32], rotor_speeds: npt.NDArray[np.float32], density: float, smearing_width: float, level: int, delta_t: float, delta_x: float) -> None: ...
class BoundaryConditionFactory:
def __init__(self) -> None: ...
......@@ -183,11 +186,10 @@ class GridScalingFactory:
class NoSlipBC:
__members__: ClassVar[dict] = ... # read-only
NoSlip3rdMomentsCompressible: ClassVar[NoSlipBC] = ...
NoSlipDelayBounceBack: ClassVar[NoSlipBC] = ...
NoSlipBounceBack: ClassVar[NoSlipBC] = ...
NoSlipCompressible: ClassVar[NoSlipBC] = ...
NoSlipImplicitBounceBack: ClassVar[NoSlipBC] = ...
NoSlipIncompressible: ClassVar[NoSlipBC] = ...
NoSlipInterpolatedIncompressible: ClassVar[NoSlipBC] = ...
NoSlipInterpolatedCompressible: ClassVar[NoSlipBC] = ...
__entries: ClassVar[dict] = ...
def __init__(self, arg0: int) -> None: ...
def __eq__(self, arg0: object) -> bool: ...
......@@ -225,8 +227,8 @@ class Parameter:
def __init__(self, number_of_processes: int, my_ID: int) -> None: ...
@overload
def __init__(self, config_data: basics.ConfigurationFile) -> None: ...
def add_actuator(self, actuator: PreCollisionInteractor) -> None: ...
def add_probe(self, probe: PreCollisionInteractor) -> None: ...
def add_interactor(self, interactor: PreCollisionInteractor) -> None: ...
def add_sampler(self, sampler: Sampler) -> None: ...
def get_SGS_constant(self) -> float: ...
def get_density_ratio(self) -> float: ...
def get_force_ratio(self) -> float: ...
......@@ -275,7 +277,7 @@ class PrecursorBC:
__members__: ClassVar[dict] = ... # read-only
DistributionsPrecursor: ClassVar[PrecursorBC] = ...
NotSpecified: ClassVar[PrecursorBC] = ...
VelocityPrecursor: ClassVar[PrecursorBC] = ...
PrecursorNonReflectiveCompressible: ClassVar[PrecursorBC] = ...
__entries: ClassVar[dict] = ...
def __init__(self, arg0: int) -> None: ...
def __eq__(self, arg0: object) -> bool: ...
......@@ -289,8 +291,8 @@ class PrecursorBC:
def name(self) -> str: ...
class PrecursorWriter(PreCollisionInteractor):
def __init__(self, filename: str, output_path: str, x_pos: float, y_min: float, y_max: float, z_min: float, z_max: float, t_start_out: int, t_save: int, output_variable: OutputVariable, max_timesteps_per_file: int) -> None: ...
class PrecursorWriter(Sampler):
def __init__(self, para: Parameter, cuda_memory_manager: CudaMemoryManager, output_path: str, filename: str, x_pos: float, y_min: float, y_max: float, z_min: float, z_max: float, t_start_out: int, t_save: int, output_variable: OutputVariable, max_timesteps_per_file: int) -> None: ...
class PressureBC:
......@@ -298,8 +300,6 @@ class PressureBC:
NotSpecified: ClassVar[PressureBC] = ...
OutflowNonReflective: ClassVar[PressureBC] = ...
OutflowNonReflectivePressureCorrection: ClassVar[PressureBC] = ...
PressureEquilibrium: ClassVar[PressureBC] = ...
PressureEquilibrium2: ClassVar[PressureBC] = ...
PressureNonEquilibriumCompressible: ClassVar[PressureBC] = ...
PressureNonEquilibriumIncompressible: ClassVar[PressureBC] = ...
__entries: ClassVar[dict] = ...
......@@ -352,11 +352,8 @@ class Simulation:
class SlipBC:
__members__: ClassVar[dict] = ... # read-only
NotSpecified: ClassVar[SlipBC] = ...
SlipBounceBack: ClassVar[SlipBC] = ...
SlipCompressible: ClassVar[SlipBC] = ...
SlipCompressibleTurbulentViscosity: ClassVar[SlipBC] = ...
SlipIncompressible: ClassVar[SlipBC] = ...
SlipPressureCompressibleTurbulentViscosity: ClassVar[SlipBC] = ...
SlipTurbulentViscosityCompressible: ClassVar[SlipBC] = ...
__entries: ClassVar[dict] = ...
def __init__(self, arg0: int) -> None: ...
def __eq__(self, arg0: object) -> bool: ...
......@@ -373,9 +370,9 @@ class SlipBC:
class StressBC:
__members__: ClassVar[dict] = ... # read-only
NotSpecified: ClassVar[StressBC] = ...
StressBounceBack: ClassVar[StressBC] = ...
StressCompressible: ClassVar[StressBC] = ...
StressPressureBounceBack: ClassVar[StressBC] = ...
StressBounceBackCompressible: ClassVar[StressBC] = ...
StressBounceBackPressureCompressible: ClassVar[StressBC] = ...
__entries: ClassVar[dict] = ...
def __init__(self, arg0: int) -> None: ...
def __eq__(self, arg0: object) -> bool: ...
......@@ -422,10 +419,10 @@ class VTKFileCollection(FileCollection):
class VelocityBC:
__members__: ClassVar[dict] = ... # read-only
NotSpecified: ClassVar[VelocityBC] = ...
VelocityAndPressureCompressible: ClassVar[VelocityBC] = ...
VelocityCompressible: ClassVar[VelocityBC] = ...
VelocityIncompressible: ClassVar[VelocityBC] = ...
VelocitySimpleBounceBackCompressible: ClassVar[VelocityBC] = ...
VelocityBounceBack: ClassVar[VelocityBC] = ...
VelocityInterpolatedIncompressible: ClassVar[VelocityBC] = ...
VelocityInterpolatedCompressible: ClassVar[VelocityBC] = ...
VelocityWithPressureInterpolatedCompressible: ClassVar[VelocityBC] = ...
__entries: ClassVar[dict] = ...
def __init__(self, arg0: int) -> None: ...
def __eq__(self, arg0: object) -> bool: ...
......
......@@ -32,6 +32,7 @@ r"""
"""
from __future__ import annotations
from typing import ClassVar, List
from enum import Enum
import gpu
......@@ -62,30 +63,35 @@ class Statistic:
def name(self) -> str: ...
class Probe(gpu.PreCollisionInteractor):
class Probe(gpu.Sampler):
def __init__(self, *args, **kwargs) -> None: ...
def add_all_available_statistics(self) -> None: ...
def add_statistic(self, variable: Statistic) -> None: ...
def set_file_name_to_n_out(self) -> None: ...
class PlaneNormal(Enum):
X = ...
Y = ...
Z = ...
class PlanarAverageProbe(Probe):
def __init__(self, probe_name: str, output_path: str, t_start_avg: int, t_start_tmp_avg: int, t_avg: int, t_start_out: int, t_out: int, plane_normal: str) -> None: ...
def __init__(self, para: gpu.Parameter, cuda_memory_manager: gpu.CudaMemoryManager, probe_name: str, output_path: str, t_start_avg: int, t_start_tmp_avg: int, t_avg: int, t_start_out: int, t_out: int, plane_normal: PlaneNormal, average_every_timestep: bool) -> None: ...
class PlaneProbe(Probe):
def __init__(self, probe_name: str, output_path: str, t_start_avg: int, t_avg: int, t_start_out: int, t_out: int) -> None: ...
def __init__(self, para: gpu.Parameter, cuda_memory_manager: gpu.CudaMemoryManager, probe_name: str, output_path: str, t_start_avg: int, t_avg: int, t_start_out: int, t_out: int) -> None: ...
def set_probe_plane(self, pos_x: float, pos_y: float, pos_z: float, delta_x: float, delta_y: float, delta_z: float) -> None: ...
class PointProbe(Probe):
def __init__(self, probe_name: str, output_path: str, t_start_avg: int, t_avg: int, t_start_out: int, t_out: int, output_timeseries: bool) -> None: ...
def __init__(self, para: gpu.Parameter, cuda_memory_manager: gpu.CudaMemoryManager, probe_name: str, output_path: str, t_start_avg: int, t_avg: int, t_start_out: int, t_out: int, output_timeseries: bool) -> None: ...
def add_probe_point(self, point_coord_x: float, point_coord_y: float, point_coord_z: float) -> None: ...
def add_probe_points_from_list(self, point_coords_x: List[float], point_coords_y: List[float], point_coords_z: List[float]) -> None: ...
def add_probe_points_from_x_normal_plane(self, pos_x: float, pos0_y: float, pos0_z: float, pos1_y: float, pos1_z: float, n_y: int, n_z: int) -> None: ...
class WallModelProbe(Probe):
def __init__(self, probe_name: str, output_path: str, t_start_avg: int, t_start_tmp_avg: int, t_avg: int, t_start_out: int, t_out: int) -> None: ...
class WallModelProbe(gpu.Sampler):
def __init__(self, para: gpu.Parameter, cuda_memory_manager: gpu.CudaMemoryManager, probe_name: str, output_path: str, t_start_avg: int, t_start_tmp_avg: int, t_avg: int, t_start_out: int, t_out: int, average_every_timestep: bool, compute_temporal_averages: bool, output_stress: bool, evaluate_pressure_gradient: bool) -> None: ...
def set_evaluate_pressure_gradient(self, eval_press_grad: bool) -> None: ...
def set_force_output_to_stress(self, output_stress: bool) -> None: ...
......@@ -60,7 +60,7 @@ class TimeseriesProbeReader:
header_length += len(quant_line)
header_length += len(number_of_points_line)
quants = quant_line.decode().split(" ")[1:-1]
quants = list(map(lambda q: q[:-1], quant_line.decode().split(" ")[1:-1]))
n_quants = len(quants)
data = np.fromfile(self.file, dtype=np.float32, offset=header_length)
n_timesteps = len(data)//(n_quants*n_points+1)
......
......@@ -43,6 +43,7 @@
#include "submodules/actuator_farm.cpp"
#include "submodules/grid_scaling_factory.cpp"
#include "submodules/kernel.cpp"
#include "submodules/sampler.cpp"
namespace gpu_bindings
{
......@@ -55,6 +56,7 @@ PYBIND11_MODULE(gpu, m)
boundary_conditions::makeModule(m);
transient_bc_setter::makeModule(m);
cuda_memory_manager::makeModule(m);
sampler::makeModule(m);
probes::makeModule(m);
precursor_writer::makeModule(m);
grid_generator::makeModule(m);
......
......@@ -61,7 +61,9 @@ namespace actuator_farm
using arr = py::array_t<real, py::array::c_style>;
py::class_<ActuatorFarm, PreCollisionInteractor, PyActuatorFarm, std::shared_ptr<ActuatorFarm>>(parentModule, "ActuatorFarm", py::dynamic_attr())
.def(py::init< const real,
.def(py::init< SPtr<Parameter>,
SPtr<CudaMemoryManager>,
const real,
const std::vector<real>,
const std::vector<real>,
const std::vector<real>,
......@@ -71,7 +73,9 @@ namespace actuator_farm
const int,
const real,
const real,
const bool>(),
const bool>(),
py::arg("para"),
py::arg("cuda_memory_manager"),
py::arg("diameter"),
py::arg("blade_radii"),
py::arg("turbine_positions_x"),
......@@ -163,7 +167,9 @@ namespace actuator_farm
.def("set_turbine_azimuth", &ActuatorFarm::setTurbineAzimuth, py::arg("turbine"), py::arg("azimuth"));
py::class_<ActuatorFarmStandalone, ActuatorFarm, std::shared_ptr<ActuatorFarmStandalone>>(parentModule, "ActuatorFarmStandalone")
.def(py::init< const real,
.def(py::init< SPtr<Parameter>,
SPtr<CudaMemoryManager>,
const real,
const uint,
const std::vector<real>,
const std::vector<real>,
......@@ -173,7 +179,9 @@ namespace actuator_farm
const real,
const int,
const real,
const real>(),
const real>(),
py::arg("para"),
py::arg("cuda_memory_manager"),
py::arg("diameter"),
py::arg("number_of_nodes_per_blade"),
py::arg("turbine_positions_x"),
......
......@@ -38,7 +38,7 @@ namespace kernel
void makeModule(py::module_ &parentModule)
{
auto kernel_module = parentModule.def_submodule("Kernel", "Kernel types");
auto kernel_module = parentModule.def_submodule("kernel", "Kernel types");
auto compressible = kernel_module.def_submodule("compressible", "Compressible Kernel types");
auto incompressible = kernel_module.def_submodule("incompressible", "Incompressible Kernel types");
......
......@@ -132,8 +132,8 @@ namespace parameter
}
);
}, py::arg("u_star"), py::arg("z0"), py::arg("length_x"), py::arg("length_z"), py::arg("height"), py::arg("velocity_ratio"))
.def("add_actuator", &Parameter::addActuator, py::arg("actuator"))
.def("add_probe", &Parameter::addProbe, py::arg("probe"))
.def("add_interactor", &Parameter::addInteractor, py::arg("interactor"))
.def("add_sampler", &Parameter::addSampler, py::arg("sampler"))
.def("get_output_path", &Parameter::getOutputPath)
.def("get_output_prefix", &Parameter::getOutputPrefix)
.def("get_velocity", &Parameter::getVelocity)
......
......@@ -31,8 +31,8 @@
#include <pybind11/pybind11.h>
#include <pybind11/stl.h>
#include <pybind11/numpy.h>
#include <gpu/core/PreCollisionInteractor/PreCollisionInteractor.h>
#include <gpu/core/PreCollisionInteractor/PrecursorWriter.h>
#include <gpu/core/Samplers/Sampler.h>
#include <gpu/core/Samplers/PrecursorWriter.h>
namespace precursor_writer
{
......@@ -44,8 +44,10 @@ namespace precursor_writer
.value("Velocities", OutputVariable::Velocities)
.value("Distributions", OutputVariable::Distributions);
py::class_<PrecursorWriter, PreCollisionInteractor, std::shared_ptr<PrecursorWriter>>(parentModule, "PrecursorWriter")
.def(py::init < std::string,
py::class_<PrecursorWriter, Sampler, std::shared_ptr<PrecursorWriter>>(parentModule, "PrecursorWriter")
.def(py::init < SPtr<Parameter>,
SPtr<CudaMemoryManager>,
std::string,
std::string,
real,
real, real,
......@@ -53,8 +55,10 @@ namespace precursor_writer
uint, uint,
OutputVariable,
uint>(),
py::arg("para"),
py::arg("cuda_memory_manager"),
py::arg("output_path"),
py::arg("filename"),
py::arg("output_path"),
py::arg("x_pos"),
py::arg("y_min"), py::arg("y_max"),
py::arg("z_min"), py::arg("z_max"),
......
......@@ -30,12 +30,10 @@
//=======================================================================================
#include <pybind11/pybind11.h>
#include <pybind11/stl.h>
#include <gpu/core/PreCollisionInteractor/Probes/Probe.h>
#include <gpu/core/PreCollisionInteractor/Probes/PointProbe.h>
#include <gpu/core/PreCollisionInteractor/Probes/PlaneProbe.h>
#include <gpu/core/PreCollisionInteractor/Probes/WallModelProbe.h>
#include <gpu/core/PreCollisionInteractor/Probes/PlanarAverageProbe.h>
#include <gpu/core/PreCollisionInteractor/PreCollisionInteractor.h>
#include <gpu/core/Samplers/Probe.h>
#include <gpu/core/Samplers/WallModelProbe.h>
#include <gpu/core/Samplers/PlanarAverageProbe.h>
#include <gpu/core/Samplers/Sampler.h>
namespace probes
{
......@@ -45,61 +43,57 @@ namespace probes
{
py::module probeModule = parentModule.def_submodule("probes");
py::enum_<Statistic>(probeModule, "Statistic")
.value("Instantaneous", Statistic::Instantaneous)
.value("Means", Statistic::Means)
.value("Variances", Statistic::Variances)
.value("SpatialMeans", Statistic::SpatialMeans)
.value("SpatioTemporalMeans", Statistic::SpatioTemporalMeans)
.value("SpatialCovariances", Statistic::SpatialCovariances)
.value("SpatioTemporalCovariances", Statistic::SpatioTemporalCovariances)
.value("SpatialSkewness", Statistic::SpatialSkewness)
.value("SpatioTemporalSkewness", Statistic::SpatioTemporalSkewness)
.value("SpatialFlatness", Statistic::SpatialFlatness)
.value("SpatioTemporalFlatness", Statistic::SpatioTemporalFlatness);
py::module probeProbeModule = probeModule.def_submodule("Probe");
py::class_<Probe, PreCollisionInteractor, std::shared_ptr<Probe>>(probeModule, "Probe")
.def("add_statistic", &Probe::addStatistic, py::arg("variable"))
.def("set_file_name_to_n_out", &Probe::setFileNameToNOut)
.def("add_all_available_statistics", &Probe::addAllAvailableStatistics);
py::enum_<Probe::Statistic>(probeProbeModule, "Statistic")
.value("Instantaneous", Probe::Statistic::Instantaneous)
.value("Means", Probe::Statistic::Means)
.value("Variances", Probe::Statistic::Variances);
py::class_<PointProbe, Probe, std::shared_ptr<PointProbe>>(probeModule, "PointProbe")
.def(py::init<
py::class_<Probe, Sampler, std::shared_ptr<Probe>>(probeProbeModule, "Probe")
.def(py::init< SPtr<Parameter>,
SPtr<CudaMemoryManager>,
const std::string,
const std::string,
uint,
uint,
uint,
uint,
bool,
bool>(),
py::arg("para"),
py::arg("cuda_memory_manager"),
py::arg("probe_name"),
py::arg("output_path"),
py::arg("t_start_avg"),
py::arg("t_avg"),
py::arg("t_start_out"),
py::arg("t_out"),
py::arg("output_timeseries"))
.def("add_probe_point", &PointProbe::addProbePoint, py::arg("point_coord_x"), py::arg("point_coord_y"), py::arg("point_coord_z"))
.def("add_probe_points_from_list", &PointProbe::addProbePointsFromList, py::arg("point_coords_x"), py::arg("point_coords_y"), py::arg("point_coords_z"));
py::arg("output_timeseries"),
py::arg("average_every_timestep"))
.def("add_statistic", &Probe::addStatistic, py::arg("variable"))
.def("set_file_name_to_n_out", &Probe::setFileNameToNOut)
.def("add_all_available_statistics", &Probe::addAllAvailableStatistics)
.def("add_probe_point", &Probe::addProbePoint, py::arg("point_coord_x"), py::arg("point_coord_y"), py::arg("point_coord_z"))
.def("add_probe_points_from_list", &Probe::addProbePointsFromList, py::arg("point_coords_x"), py::arg("point_coords_y"), py::arg("point_coords_z"))
.def("set_probe_plane", &Probe::addProbePlane, py::arg("pos_x"), py::arg("pos_y"), py::arg("pos_z"), py::arg("delta_x"), py::arg("delta_y"), py::arg("delta_z"));
py::class_<PlaneProbe, Probe, std::shared_ptr<PlaneProbe>>(probeModule, "PlaneProbe")
.def(py::init<
const std::string,
const std::string,
uint,
uint,
uint,
uint>(),
py::arg("probe_name"),
py::arg("output_path"),
py::arg("t_start_avg"),
py::arg("t_avg"),
py::arg("t_start_out"),
py::arg("t_out"))
.def("set_probe_plane", &PlaneProbe::setProbePlane, py::arg("pos_x"), py::arg("pos_y"), py::arg("pos_z"), py::arg("delta_x"), py::arg("delta_y"), py::arg("delta_z"));
py::module planarAverageProbeModule = probeModule.def_submodule("PlanarAverageProbe");
py::class_<PlanarAverageProbe, Probe, std::shared_ptr<PlanarAverageProbe>>(probeModule, "PlanarAverageProbe")
.def(py::init<
py::enum_<PlanarAverageProbe::PlaneNormal>(planarAverageProbeModule, "PlaneNormal")
.value("x", PlanarAverageProbe::PlaneNormal::x)
.value("y", PlanarAverageProbe::PlaneNormal::y)
.value("z", PlanarAverageProbe::PlaneNormal::z);
py::enum_<PlanarAverageProbe::Statistic>(planarAverageProbeModule, "Statistic")
.value("Means", PlanarAverageProbe::Statistic::Means)
.value("Covariances", PlanarAverageProbe::Statistic::Covariances)
.value("Skewness", PlanarAverageProbe::Statistic::Skewness)
.value("Flatness", PlanarAverageProbe::Statistic::Flatness);
py::class_<PlanarAverageProbe, Sampler, std::shared_ptr<PlanarAverageProbe>>(planarAverageProbeModule, "PlanarAverageProbe")
.def(py::init< SPtr<Parameter>,
SPtr<CudaMemoryManager>,
const std::string,
const std::string,
uint,
......@@ -107,7 +101,10 @@ namespace probes
uint,
uint,
uint,
char>(),
PlanarAverageProbe::PlaneNormal,
bool>(),
py::arg("para"),
py::arg("cuda_memory_manager"),
py::arg("probe_name"),
py::arg("output_path"),
py::arg("t_start_avg"),
......@@ -115,27 +112,37 @@ namespace probes
py::arg("t_avg"),
py::arg("t_start_out"),
py::arg("t_out"),
py::arg("plane_normal"));
py::arg("plane_normal"),
py::arg("compute_time_averages"));
py::class_<WallModelProbe, Probe, std::shared_ptr<WallModelProbe>>(probeModule, "WallModelProbe")
.def(py::init<
py::class_<WallModelProbe, Sampler, std::shared_ptr<WallModelProbe>>(probeModule, "WallModelProbe")
.def(py::init< SPtr<Parameter>,
SPtr<CudaMemoryManager>,
const std::string,
const std::string,
uint,
uint,
uint,
uint,
uint>(),
uint,
bool,
bool,
bool,
bool>(),
py::arg("para"),
py::arg("cuda_memory_manager"),
py::arg("probe_name"),
py::arg("output_path"),
py::arg("t_start_avg"),
py::arg("t_start_tmp_avg"),
py::arg("t_avg"),
py::arg("t_start_out"),
py::arg("t_out"))
.def("set_force_output_to_stress", &WallModelProbe::setForceOutputToStress, py::arg("output_stress"))
.def("set_evaluate_pressure_gradient", &WallModelProbe::setEvaluatePressureGradient, py::arg("eval_press_grad"));
py::arg("t_out"),
py::arg("average_every_timestep"),
py::arg("compute_temporal_averages"),
py::arg("output_stress"),
py::arg("evaluate_pressure_gradient"));
return probeModule;
}
......