Skip to content

Commit

Permalink
adds larsson3 metric
Browse files Browse the repository at this point in the history
  • Loading branch information
Mike Park authored and Mike Park committed Nov 10, 2022
1 parent 3623009 commit e3f1b74
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/ref_acceptance.c
Original file line number Diff line number Diff line change
Expand Up @@ -582,6 +582,11 @@ int main(int argc, char *argv[]) {
printf(" -ugawg polar-2 metric\n");
RSS(ref_metric_ugawg_node(ref_grid_node(ref_grid), 2), "p2");
}
if (strcmp(argv[2], "larrson3") == 0) {
metric_recognized = REF_TRUE;
printf(" -ugawg larrson3 metric\n");
RSS(ref_metric_ugawg_node(ref_grid_node(ref_grid), 3), "p2");
}
if (strcmp(argv[2], "ring") == 0) {
metric_recognized = REF_TRUE;
printf(" -ugawg ring metric\n");
Expand Down
20 changes: 19 additions & 1 deletion src/ref_metric.c
Original file line number Diff line number Diff line change
Expand Up @@ -309,10 +309,28 @@ REF_FCN REF_STATUS ref_metric_ugawg_node(REF_NODE ref_node, REF_INT version) {
ref_matrix_form_m(d, m);
RSS(ref_node_metric_set(ref_node, node, m), "set node met");
}

return REF_SUCCESS;
}

if (3 == version) {
each_ref_node_valid_node(ref_node, node) {
REF_DBL h = 1.0;
REF_DBL d;

y = ref_node_xyz(ref_node, 1, node);

d = MIN(y, 2 * h - y);
m[0] = pow(h, -2) * pow(0.088 + 0.042 * tanh(2.3 * d / h - 0.96), -2);
m[1] = 0.0;
m[2] = 0.0;
m[3] = pow(h, -2) * pow(0.0022 + 0.06 * tanh(3.4 * d / h), -2);
m[4] = 0.0;
m[5] = pow(h, -2) * pow(0.045 + 0.08 * tanh(1.2 * d / h - 0.24), -2);

RSS(ref_node_metric_set(ref_node, node, m), "set node met");
}
return REF_SUCCESS;
}
return REF_IMPLEMENT;
}

Expand Down

0 comments on commit e3f1b74

Please sign in to comment.