[Bf-blender-cvs] [a3efe489871] fluid-mantaflow: added cfl field to UI
Sebastián Barschkis
noreply at git.blender.org
Tue Jun 13 15:22:21 CEST 2017
Commit: a3efe4898713c83c4aa25f13d1dc865a1215f933
Author: Sebastián Barschkis
Date: Mon Jun 12 23:13:59 2017 +0200
Branches: fluid-mantaflow
https://developer.blender.org/rBa3efe4898713c83c4aa25f13d1dc865a1215f933
added cfl field to UI
adjustable cfl number lets users better control timesteps
===================================================================
M intern/mantaflow/intern/FLUID.cpp
M intern/mantaflow/intern/strings/shared_script.h
M release/scripts/startup/bl_ui/properties_physics_smoke.py
M source/blender/blenkernel/intern/smoke.c
M source/blender/makesdna/DNA_smoke_types.h
M source/blender/makesrna/intern/rna_smoke.c
===================================================================
diff --git a/intern/mantaflow/intern/FLUID.cpp b/intern/mantaflow/intern/FLUID.cpp
index abaa9b68596..e8b4f824bf9 100644
--- a/intern/mantaflow/intern/FLUID.cpp
+++ b/intern/mantaflow/intern/FLUID.cpp
@@ -586,6 +586,8 @@ std::string FLUID::getRealValue(const std::string& varName, SmokeModifierData *
else { ss << mResZ;}
} else if (varName == "DT_FACTOR")
ss << smd->domain->time_scale;
+ else if (varName == "CFL")
+ ss << smd->domain->cfl_condition;
else if (varName == "FPS")
ss << md->scene->r.frs_sec / md->scene->r.frs_sec_base;
else if (varName == "VORTICITY")
diff --git a/intern/mantaflow/intern/strings/shared_script.h b/intern/mantaflow/intern/strings/shared_script.h
index 22c6947010a..cbd7e3676cc 100644
--- a/intern/mantaflow/intern/strings/shared_script.h
+++ b/intern/mantaflow/intern/strings/shared_script.h
@@ -99,7 +99,7 @@ dt0_s$ID$ = dt_default_s$ID$ * (25.0 / fps_s$ID$) * dt_factor_s$ID$\n\
s$ID$.frameLength = dt0_s$ID$\n\
s$ID$.timestepMin = dt0_s$ID$ / 10\n\
s$ID$.timestepMax = dt0_s$ID$\n\
-s$ID$.cfl = 4.0\n\
+s$ID$.cfl = $CFL$\n\
s$ID$.timestep = (s$ID$.timestepMax+s$ID$.timestepMin)*0.5\n";
const std::string fluid_adaptive_time_stepping_high = "\n\
diff --git a/release/scripts/startup/bl_ui/properties_physics_smoke.py b/release/scripts/startup/bl_ui/properties_physics_smoke.py
index 93e775a886d..9f8f44b0e57 100644
--- a/release/scripts/startup/bl_ui/properties_physics_smoke.py
+++ b/release/scripts/startup/bl_ui/properties_physics_smoke.py
@@ -82,10 +82,13 @@ class PHYSICS_PT_smoke(PhysicButtonsPanel, Panel):
split = layout.split()
+ split.enabled = not domain.point_cache.is_baked
+
col = split.column()
col.label(text="Time:")
col.prop(domain, "time_scale", text="Scale")
col.prop(domain, "use_adaptive_stepping", text="Adaptive stepping")
+ col.prop(domain, "cfl_condition", text="CFL")
col = split.column()
if scene.use_gravity:
diff --git a/source/blender/blenkernel/intern/smoke.c b/source/blender/blenkernel/intern/smoke.c
index 34c6e239f04..ae6feaf268b 100644
--- a/source/blender/blenkernel/intern/smoke.c
+++ b/source/blender/blenkernel/intern/smoke.c
@@ -558,6 +558,7 @@ void smokeModifier_createType(struct SmokeModifierData *smd)
smd->domain->alpha = -0.001;
smd->domain->beta = 0.3;
smd->domain->time_scale = 1.0;
+ smd->domain->cfl_condition = 4.0;
smd->domain->vorticity = 0.2;
smd->domain->border_collisions = 0; // open domain
smd->domain->flags = MOD_SMOKE_DISSOLVE_LOG;
@@ -707,6 +708,7 @@ void smokeModifier_copy(struct SmokeModifierData *smd, struct SmokeModifierData
tsmd->domain->border_collisions = smd->domain->border_collisions;
tsmd->domain->vorticity = smd->domain->vorticity;
tsmd->domain->time_scale = smd->domain->time_scale;
+ tsmd->domain->cfl_condition = smd->domain->cfl_condition;
tsmd->domain->burning_rate = smd->domain->burning_rate;
tsmd->domain->flame_smoke = smd->domain->flame_smoke;
diff --git a/source/blender/makesdna/DNA_smoke_types.h b/source/blender/makesdna/DNA_smoke_types.h
index d015888bf6c..f1bbb972556 100644
--- a/source/blender/makesdna/DNA_smoke_types.h
+++ b/source/blender/makesdna/DNA_smoke_types.h
@@ -226,9 +226,9 @@ typedef struct SmokeDomainSettings {
/* show original meshes, preview or final sim */
short viewport_display_mode;
short render_display_mode;
- char pad5[4];
float time_scale;
+ float cfl_condition;
float vorticity;
int active_fields;
float active_color[3]; /* monitor color situation of simulation */
diff --git a/source/blender/makesrna/intern/rna_smoke.c b/source/blender/makesrna/intern/rna_smoke.c
index bb259b9ce12..c6f873d8f0c 100644
--- a/source/blender/makesrna/intern/rna_smoke.c
+++ b/source/blender/makesrna/intern/rna_smoke.c
@@ -875,6 +875,13 @@ static void rna_def_smoke_domain_settings(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Adaptive stepping", "Enable adaptive time-stepping");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_resetCache");
+ prop = RNA_def_property(srna, "cfl_condition", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "cfl_condition");
+ RNA_def_property_range(prop, 0.0, 10.0);
+ RNA_def_property_ui_range(prop, 0.0001, 10.0, 0.02, 5);
+ RNA_def_property_ui_text(prop, "CFL", "Maximal velocity per cell (higher value results in larger timesteps)");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_resetCache");
+
prop = RNA_def_property(srna, "vorticity", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "vorticity");
RNA_def_property_range(prop, 0.0, 4.0);
More information about the Bf-blender-cvs
mailing list