Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
dependencies/OpenCL
bubbleSim/data

# External tool files
*.cltracer


# User-specific files
*.rsuser
Expand All @@ -17,6 +20,9 @@ bubbleSim/data

# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
tools
traces


# Mono auto generated files
mono_crash.*
Expand Down
6 changes: 6 additions & 0 deletions bubbleSim.sln
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,18 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bubbleSim", "bubbleSim\bubb
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
bubbleSim test|x64 = bubbleSim test|x64
bubbleSim test|x86 = bubbleSim test|x86
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{82AF250D-0A19-4018-B80B-85345DF10DF0}.bubbleSim test|x64.ActiveCfg = bubbleSim test|x64
{82AF250D-0A19-4018-B80B-85345DF10DF0}.bubbleSim test|x64.Build.0 = bubbleSim test|x64
{82AF250D-0A19-4018-B80B-85345DF10DF0}.bubbleSim test|x86.ActiveCfg = bubbleSim test|Win32
{82AF250D-0A19-4018-B80B-85345DF10DF0}.bubbleSim test|x86.Build.0 = bubbleSim test|Win32
{82AF250D-0A19-4018-B80B-85345DF10DF0}.Debug|x64.ActiveCfg = Debug|x64
{82AF250D-0A19-4018-B80B-85345DF10DF0}.Debug|x64.Build.0 = Debug|x64
{82AF250D-0A19-4018-B80B-85345DF10DF0}.Debug|x86.ActiveCfg = Debug|Win32
Expand Down
20 changes: 6 additions & 14 deletions bubbleSim/bubble.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ PhaseBubble::PhaseBubble(numType t_initialRadius, numType t_initialSpeed,
numType gamma =
1.0 / std::exp((std::log1p((-t_initialSpeed * t_initialSpeed)) * 0.5));
numType gammaXspeed = t_initialSpeed * gamma;
m_bubble = Bubble{t_initialRadius, radius2, radius2, t_initialSpeed,
gamma, gammaXspeed, gamma};
m_bubble = Bubble{t_initialRadius, radius2, t_initialSpeed,
gamma, gammaXspeed};
m_bubble_copy = m_bubble;
m_bubbleBuffer =
cl::Buffer(cl_context, CL_MEM_READ_ONLY | CL_MEM_COPY_HOST_PTR,
Expand All @@ -48,13 +48,7 @@ numType PhaseBubble::calculateVolume() {
}

numType PhaseBubble::calculateEnergy() {
return calculateArea() * m_sigma / sqrt(1 - m_bubble.speed * m_bubble.speed) -
calculateVolume() * m_dV;
}
numType PhaseBubble::calculateRadiusAfterStep2(numType dt) {
m_bubble.radiusAfterStep2 =
pow(std::fma(m_bubble.speed, dt, m_bubble.radius), 2);
return m_bubble.radiusAfterStep2;
return calculateArea() * m_sigma * m_bubble.gamma - calculateVolume() * m_dV;
}

void PhaseBubble::evolveWall(numType dt, numType dP) {
Expand All @@ -64,20 +58,17 @@ void PhaseBubble::evolveWall(numType dt, numType dP) {
numType gammaChange;
numType sgn = ((0 < m_bubble.speed) - (m_bubble.speed < 0)); // sign of speed

if (m_bubble.gamma >= 10) {
newRadius = m_bubble.radius + dt * m_bubble.speed;
newRadius = m_bubble.radius + dt * m_bubble.speed;

if (m_bubble.gamma >= 20) {
gammaChange = (std::fma(m_dV, dt, dP) / m_sigma *
std::sqrt((m_bubble.gamma - 1) / m_bubble.gamma) -
2 * std::sqrt((m_bubble.gamma - 1) * m_bubble.gamma) /
m_bubble.radius * dt) *
sgn;
newGamma = m_bubble.gamma + gammaChange;
newSpeed = std::sqrt(1 - 1 / std::pow(newGamma, 2)) * sgn;

} else {
newRadius = m_bubble.radius + dt * m_bubble.speed;

numType velocityElement = std::fma(-m_bubble.speed, m_bubble.speed, 1);

newSpeed =
Expand All @@ -86,6 +77,7 @@ void PhaseBubble::evolveWall(numType dt, numType dP) {
2 * velocityElement * dt / m_bubble.radius;
newGamma = 1.0 / std::exp((std::log1p((-newSpeed * newSpeed)) * 0.5));
}

m_bubble.radius = newRadius;
m_bubble.speed = newSpeed;
m_bubble.gamma = newGamma;
Expand Down
4 changes: 0 additions & 4 deletions bubbleSim/bubble.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,11 @@
typedef struct Bubble {
cl_numType radius;
cl_numType radius2; // Squared
cl_numType radiusAfterStep2; // (radius + speed * dt)^2

cl_numType speed;

cl_numType gamma;
cl_numType gammaXspeed; // gamma * speed
cl_numType gamma_dynamic;
} Bubble;

class PhaseBubble {
Expand All @@ -21,7 +19,6 @@ class PhaseBubble {
numType getGamma() { return m_bubble.gamma; }
numType getGammaSpeed() { return m_bubble.gammaXspeed; }
numType getRadius2() { return m_bubble.radius2; }
numType getRadiusAfterDt2() { return m_bubble.radiusAfterStep2; }
numType getdV() { return m_dV; }
numType getSigma() { return m_sigma; }
numType getInitialRadius() { return m_initialRadius; }
Expand All @@ -32,7 +29,6 @@ class PhaseBubble {
void evolveWall(numType dt, numType dP);
numType calculateArea();
numType calculateVolume();
numType calculateRadiusAfterStep2(numType dt);
numType calculateEnergy();

cl::Buffer& getBubbleBuffer() { return m_bubbleBuffer; }
Expand Down
66 changes: 66 additions & 0 deletions bubbleSim/bubbleSim.vcxproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="bubbleSim test|Win32">
<Configuration>bubbleSim test</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="bubbleSim test|x64">
<Configuration>bubbleSim test</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
Expand Down Expand Up @@ -65,6 +73,12 @@
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='bubbleSim test|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
Expand All @@ -78,6 +92,12 @@
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='bubbleSim test|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
Expand All @@ -93,12 +113,18 @@
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='bubbleSim test|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='bubbleSim test|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
Expand All @@ -108,6 +134,11 @@
<IntDir>$(SolutionDir)\bin\intermediates\$(Platform)\$(Configuration)\</IntDir>
<EnableClangTidyCodeAnalysis>false</EnableClangTidyCodeAnalysis>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='bubbleSim test|Win32'">
<OutDir>$(SolutionDir)\bin\$(Platform)\$(Configuration)\</OutDir>
<IntDir>$(SolutionDir)\bin\intermediates\$(Platform)\$(Configuration)\</IntDir>
<EnableClangTidyCodeAnalysis>false</EnableClangTidyCodeAnalysis>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<OutDir>$(SolutionDir)\bin\$(Platform)\$(Configuration)\</OutDir>
<IntDir>$(SolutionDir)\bin\intermediates\$(Platform)\$(Configuration)\</IntDir>
Expand All @@ -118,6 +149,11 @@
<IntDir>$(SolutionDir)\bin\intermediates\$(Platform)\$(Configuration)\</IntDir>
<EnableClangTidyCodeAnalysis>false</EnableClangTidyCodeAnalysis>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='bubbleSim test|x64'">
<OutDir>$(SolutionDir)\bin\$(Platform)\$(Configuration)\</OutDir>
<IntDir>$(SolutionDir)\bin\intermediates\$(Platform)\$(Configuration)\</IntDir>
<EnableClangTidyCodeAnalysis>false</EnableClangTidyCodeAnalysis>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<OutDir>$(SolutionDir)\bin\$(Platform)\$(Configuration)\</OutDir>
<IntDir>$(SolutionDir)\bin\intermediates\$(Platform)\$(Configuration)\</IntDir>
Expand All @@ -138,6 +174,21 @@
<AdditionalLibraryDirectories>$(SolutionDir)\dependencies\OpenCL\lib;</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='bubbleSim test|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<AdditionalIncludeDirectories>$(SolutionDir)\dependencies\OpenCL\include; $(SolutionDir)\dependencies\json</AdditionalIncludeDirectories>
<LanguageStandard>stdcpp17</LanguageStandard>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalLibraryDirectories>$(SolutionDir)\dependencies\OpenCL\lib;</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
Expand Down Expand Up @@ -172,6 +223,21 @@
<AdditionalLibraryDirectories>$(SolutionDir)\dependencies\OpenCL\lib;</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='bubbleSim test|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<AdditionalIncludeDirectories>$(SolutionDir)\dependencies\OpenCL\include; $(SolutionDir)\dependencies\json</AdditionalIncludeDirectories>
<LanguageStandard>stdcpp17</LanguageStandard>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalLibraryDirectories>$(SolutionDir)\dependencies\OpenCL\lib;</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
Expand Down
97 changes: 53 additions & 44 deletions bubbleSim/bubbleSim.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -16,81 +16,90 @@
<Filter Include="Kernels">
<UniqueIdentifier>{ad3d76ba-6f94-404f-bc5d-04c6fe891d8f}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\Objects">
<UniqueIdentifier>{ead60fb0-b85b-4979-a0a9-ef637c5cf283}</UniqueIdentifier>
</Filter>
<Filter Include="Header Files\Objects">
<UniqueIdentifier>{0187af86-67e0-4ada-9316-2c50a6d1db91}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\Generators">
<UniqueIdentifier>{70c9ae99-7764-4421-ad94-5ac76b6b096b}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\Streamers">
<UniqueIdentifier>{a5c559dd-9d80-4aef-a16b-8988be73efcd}</UniqueIdentifier>
<Filter Include="Physics">
<UniqueIdentifier>{065cebb1-beb8-4e96-9821-6f828b7743fa}</UniqueIdentifier>
</Filter>
<Filter Include="Physics\Bubble">
<UniqueIdentifier>{8271bb38-eced-4c45-837f-66505dc396ac}</UniqueIdentifier>
</Filter>
<Filter Include="Physics\Dynamics">
<UniqueIdentifier>{25677fb9-0349-4027-b7fb-4c5eac0b861c}</UniqueIdentifier>
</Filter>
<Filter Include="Physics\Particles">
<UniqueIdentifier>{6c4c2689-9937-4d27-8cef-7ffb46d3e1fa}</UniqueIdentifier>
</Filter>
<Filter Include="Stream">
<UniqueIdentifier>{fc07c3d0-554a-4313-8c45-36b30388084b}</UniqueIdentifier>
</Filter>
<Filter Include="Config">
<UniqueIdentifier>{e2bc3991-b791-4914-8ca2-bb079843d4d7}</UniqueIdentifier>
</Filter>
<Filter Include="Header Files\Streamers">
<UniqueIdentifier>{729ee2fd-1b8b-46ac-87ea-9dccda36f30d}</UniqueIdentifier>
<Filter Include="OpenCL">
<UniqueIdentifier>{d00f1d28-f39c-485c-bc09-b2ad361e7fee}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="simulation.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="source.h">
<Filter>Header Files</Filter>
<ClInclude Include="random_number.hpp">
<Filter>Source Files\Generators</Filter>
</ClInclude>
<ClInclude Include="base.h">
<ClInclude Include="timestep.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="opencl_kernels.h">
<Filter>Header Files</Filter>
<ClInclude Include="objects.h">
<Filter>Physics</Filter>
</ClInclude>
<ClInclude Include="bubble.h">
<Filter>Header Files\Objects</Filter>
<Filter>Physics\Bubble</Filter>
</ClInclude>
<ClInclude Include="particle.h">
<Filter>Header Files\Objects</Filter>
<ClInclude Include="collision.h">
<Filter>Physics\Dynamics</Filter>
</ClInclude>
<ClInclude Include="objects.h">
<Filter>Header Files\Objects</Filter>
<ClInclude Include="particle.h">
<Filter>Physics\Particles</Filter>
</ClInclude>
<ClInclude Include="random_number.hpp">
<Filter>Source Files\Generators</Filter>
<ClInclude Include="datastreamer.h">
<Filter>Stream</Filter>
</ClInclude>
<ClInclude Include="config_reader.hpp">
<Filter>Header Files</Filter>
<Filter>Config</Filter>
</ClInclude>
<ClInclude Include="collision.h">
<Filter>Header Files</Filter>
<ClInclude Include="opencl_kernels.h">
<Filter>OpenCL</Filter>
</ClInclude>
<ClInclude Include="datastreamer.h">
<Filter>Header Files\Streamers</Filter>
<ClInclude Include="simulation.h">
<Filter>Physics\Dynamics</Filter>
</ClInclude>
<ClInclude Include="timestep.h">
<Filter>Header Files</Filter>
<ClInclude Include="source.h">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="base.h">
<Filter>Source Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="simulation.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="source.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="opencl_kernels.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="bubble.cpp">
<Filter>Source Files\Objects</Filter>
</ClCompile>
<ClCompile Include="particle.cpp">
<Filter>Source Files\Objects</Filter>
<Filter>Physics\Bubble</Filter>
</ClCompile>
<ClCompile Include="collision.cpp">
<Filter>Source Files</Filter>
<Filter>Physics\Dynamics</Filter>
</ClCompile>
<ClCompile Include="particle.cpp">
<Filter>Physics\Particles</Filter>
</ClCompile>
<ClCompile Include="datastreamer.cpp">
<Filter>Source Files\Streamers</Filter>
<Filter>Stream</Filter>
</ClCompile>
<ClCompile Include="opencl_kernels.cpp">
<Filter>OpenCL</Filter>
</ClCompile>
<ClCompile Include="simulation.cpp">
<Filter>Physics\Dynamics</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
Expand Down
Loading