Skip to content

Commit

Permalink
strain limiting line search adaptive eps window size
Browse files Browse the repository at this point in the history
  • Loading branch information
ryichando committed Dec 26, 2024
1 parent b063704 commit 926afa0
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 7 deletions.
2 changes: 1 addition & 1 deletion examples/hang.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"metadata": {},
"outputs": [],
"source": [
"param = app.session.param().set(\"dt\",0.01)\n",
"param = app.session.param().set(\"dt\",0.001)\n",
"param.set(\"strain-limit-eps\", 0.005).set(\"strain-limit-tau\", 0.005)\n",
"param.set(\"frames\",200)\n",
"param.dyn(\"gravity\").time(1).hold().time(1.1).change(9.8).time(2.0).change(-9.8);"
Expand Down
4 changes: 2 additions & 2 deletions src/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,10 @@ pub struct Args {
#[clap(long, default_value_t = 1024)]
pub ccd_max_iters: u32,

#[clap(long, default_value_t = 0.1)]
#[clap(long, default_value_t = 0.01)]
pub ccd_reduction: f32,

#[clap(long, default_value_t = 0.01)]
#[clap(long, default_value_t = 0.0025)]
pub ccd_reduction_eps: f32,

#[clap(long, default_value_t = 1e-2)]
Expand Down
5 changes: 1 addition & 4 deletions src/cpp/strainlimiting/strainlimiting.cu
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ float line_search(const DataSet &data, const Kinematic &kinematic,
const Mat3x2f dF = F1 - F0;
float gap = max_sigma - utility::svd3x2(F0).S.maxCoeff();
float target = max_sigma - param.ccd_reduction * gap;
float diff_eps = param.ccd_reduction_eps * gap;
if (utility::svd3x2(F0 + t * dF).S.maxCoeff() > target) {
float upper_t = t;
float lower_t = 0.0f;
Expand All @@ -126,9 +125,7 @@ float line_search(const DataSet &data, const Kinematic &kinematic,
upper_t = t;
}
if (lower_t > 0.0f) {
if (upper_t - lower_t < DT_MIN) {
break;
} else if (iter++ > param.binary_search_max_iter) {
if (upper_t - lower_t < param.ccd_reduction * lower_t) {
break;
}
}
Expand Down

0 comments on commit 926afa0

Please sign in to comment.