Merge branch 'master' of github.com:JamesEMcClure/LBPM-WIA
This commit is contained in:
35
example/DropletCoalescence/Droplets.py
Normal file
35
example/DropletCoalescence/Droplets.py
Normal file
@@ -0,0 +1,35 @@
|
||||
import numpy
|
||||
import math
|
||||
|
||||
nx=400
|
||||
ny=200
|
||||
nz=200
|
||||
N=nx*ny*nz
|
||||
Radius=64
|
||||
|
||||
mesh=(nx,ny,nz)
|
||||
data=numpy.ones(mesh,dtype=numpy.int8)
|
||||
|
||||
#print(data)
|
||||
print("Create two droplets")
|
||||
print("Mesh size: "+repr(mesh))
|
||||
print("Droplet radius: "+repr(Radius))
|
||||
|
||||
gap = 6
|
||||
c1x = nx/2 - gap/2 - Radius
|
||||
c2x = nx/2 + gap/2 + Radius
|
||||
|
||||
# assign a bubble on each side
|
||||
for x in range(0,200):
|
||||
for y in range(0,ny):
|
||||
for z in range(0,nz):
|
||||
if math.sqrt((x-c1x)*(x-c1x)+(y-ny/2)*(y-ny/2)+(z-nz/2)*(z-nz/2) ) < Radius:
|
||||
data[x,y,z]=2
|
||||
|
||||
for x in range(200,nx):
|
||||
for y in range(0,ny):
|
||||
for z in range(0,nz):
|
||||
if math.sqrt((x-c2x)*(x-c2x)+(y-ny/2)*(y-ny/2)+(z-nz/2)*(z-nz/2) ) < Radius:
|
||||
data[x,y,z]=2
|
||||
|
||||
data.tofile("Droplets.raw")
|
||||
51
example/DropletCoalescence/input.db
Normal file
51
example/DropletCoalescence/input.db
Normal file
@@ -0,0 +1,51 @@
|
||||
MRT {
|
||||
timestepMax = 10000
|
||||
tau = 0.7
|
||||
F = 1e-05, 0, 0
|
||||
Restart = false
|
||||
din = 1.0
|
||||
dout = 1.0
|
||||
flux = 0.0
|
||||
}
|
||||
|
||||
Color {
|
||||
tauA = 0.7;
|
||||
tauB = 1.0;
|
||||
rhoA = 1.0;
|
||||
rhoB = 1.0;
|
||||
alpha = 5e-3;
|
||||
beta = 0.95;
|
||||
F = 0, 0, 0
|
||||
Restart = false
|
||||
timestepMax = 40000
|
||||
ComponentLabels = -2
|
||||
ComponentAffinity = -0.5
|
||||
}
|
||||
|
||||
Domain {
|
||||
Filename = "Droplets.raw"
|
||||
nproc = 1, 1, 2 // Number of processors (Npx,Npy,Npz)
|
||||
n = 200, 200, 200 // Size of local domain (Nx,Ny,Nz)
|
||||
N = 200, 200, 400 // size of the input image
|
||||
voxel_length = 1.0
|
||||
BC = 0 // Boundary condition type
|
||||
Sw = 0.15
|
||||
ReadType = "8bit"
|
||||
ReadValues = -2, 1, 2
|
||||
WriteValues = -2, 1, 2
|
||||
ComponentLabels = -2
|
||||
HistoryLabels = -2
|
||||
}
|
||||
|
||||
Analysis {
|
||||
analysis_interval = 1000 // Frequency to perform analysis
|
||||
subphase_analysis_interval = 5000 // Frequency to perform analysis
|
||||
restart_interval = 60000 // Frequency to write restart data
|
||||
visualization_interval = 100000 // Frequency to write visualization data
|
||||
restart_file = "Restart" // Filename to use for restart file (will append rank)
|
||||
N_threads = 4 // Number of threads to use
|
||||
load_balance = "independent" // Load balance method to use: "none", "default", "independent"
|
||||
}
|
||||
|
||||
Visualization {
|
||||
}
|
||||
@@ -34,15 +34,15 @@ int main( int argc, char **argv )
|
||||
// Load the input database
|
||||
auto db = std::make_shared<Database>( argv[1] );
|
||||
if (argc > 2) {
|
||||
SimulationMode = "development";
|
||||
SimulationMode = "legacy";
|
||||
}
|
||||
|
||||
if ( rank == 0 ) {
|
||||
printf( "********************************************************\n" );
|
||||
printf( "Running Color LBM \n" );
|
||||
printf( "********************************************************\n" );
|
||||
if (SimulationMode == "development")
|
||||
printf("**** DEVELOPMENT MODE ENABLED *************\n");
|
||||
if (SimulationMode == "legacy")
|
||||
printf("**** LEGACY MODE ENABLED *************\n");
|
||||
}
|
||||
// Initialize compute device
|
||||
int device = ScaLBL_SetDevice( rank );
|
||||
@@ -66,13 +66,16 @@ int main( int argc, char **argv )
|
||||
// structure and allocate variables
|
||||
ColorModel.Initialize(); // initializing the model will set initial conditions for variables
|
||||
|
||||
if (SimulationMode == "development"){
|
||||
if (SimulationMode == "legacy"){
|
||||
ColorModel.Run();
|
||||
}
|
||||
else {
|
||||
double MLUPS=0.0;
|
||||
int timestep = 0;
|
||||
bool ContinueSimulation = true;
|
||||
|
||||
/* Variables for simulation protocols */
|
||||
auto PROTOCOL = ColorModel.color_db->getWithDefault<std::string>( "protocol", "none" );
|
||||
auto PROTOCOL = ColorModel.color_db->getWithDefault<std::string>( "protocol", "default" );
|
||||
/* image sequence protocol */
|
||||
int IMAGE_INDEX = 0;
|
||||
int IMAGE_COUNT = 0;
|
||||
@@ -123,6 +126,7 @@ int main( int argc, char **argv )
|
||||
else{
|
||||
if (rank==0) printf("Finished simulating image sequence \n");
|
||||
ColorModel.timestep = ColorModel.timestepMax;
|
||||
ContinueSimulation = false;
|
||||
}
|
||||
}
|
||||
/*********************************************************/
|
||||
@@ -144,7 +148,7 @@ int main( int argc, char **argv )
|
||||
double speedB = sqrt(vB_x*vB_x + vB_y*vB_y + vB_z*vB_z);
|
||||
/* stop simulation if previous point was sufficiently close to the endpoint*/
|
||||
if (volA*speedA < ENDPOINT_THRESHOLD*volB*speedB) ContinueSimulation = false;
|
||||
if (ContinueSimulation){
|
||||
if (ContinueSimulation && SKIP_TIMESTEPS > 0 ){
|
||||
while (skip_time < SKIP_TIMESTEPS && fabs(SaturationChange) < fabs(FRACTIONAL_FLOW_INCREMENT) ){
|
||||
timestep += ANALYSIS_INTERVAL;
|
||||
if (PROTOCOL == "fractional flow") {
|
||||
@@ -173,9 +177,8 @@ int main( int argc, char **argv )
|
||||
/*********************************************************/
|
||||
}
|
||||
}
|
||||
else
|
||||
ColorModel.Run();
|
||||
|
||||
|
||||
|
||||
PROFILE_STOP( "Main" );
|
||||
auto file = db->getWithDefault<std::string>( "TimerFile", "lbpm_color_simulator" );
|
||||
auto level = db->getWithDefault<int>( "TimerLevel", 1 );
|
||||
|
||||
Reference in New Issue
Block a user