Skip to content

Commit 4c900d7

Browse files
committed
Codeformat
1 parent 436384d commit 4c900d7

File tree

2 files changed

+8
-11
lines changed

2 files changed

+8
-11
lines changed

src/model/ValveTanh.cpp

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -45,24 +45,21 @@ void ValveTanh::update_solution(
4545
double Rmax = parameters[global_param_ids[ParamId::RMAX]];
4646
double steep = parameters[global_param_ids[ParamId::STEEPNESS]];
4747

48-
//Helper functions
48+
// Helper functions
4949
double fun_tanh = tanh(steep * (p_out - p_in));
5050
double fun_cosh = 0.5 * steep / pow(cosh(steep * (p_in - p_out)), 2);
51-
51+
5252
// Nonlinear terms
53-
system.C(global_eqn_ids[0]) =
54-
-0.5 * q_in * (Rmax - Rmin) * fun_tanh;
53+
system.C(global_eqn_ids[0]) = -0.5 * q_in * (Rmax - Rmin) * fun_tanh;
5554
system.C(global_eqn_ids[2]) = -0.5 * (1 + fun_tanh);
5655

5756
// Derivatives of non-linear terms
5857
system.dC_dy.coeffRef(global_eqn_ids[0], global_var_ids[0]) =
59-
0.5 * q_in * (Rmax - Rmin) * steep * (1.0 - pow(fun_tanh,2));
58+
0.5 * q_in * (Rmax - Rmin) * steep * (1.0 - pow(fun_tanh, 2));
6059
system.dC_dy.coeffRef(global_eqn_ids[0], global_var_ids[1]) =
6160
-0.5 * (Rmax - Rmin) * fun_tanh;
6261
system.dC_dy.coeffRef(global_eqn_ids[0], global_var_ids[2]) =
63-
-0.5 * q_in * (Rmax - Rmin) * steep * (1.0 - pow(fun_tanh,2));
64-
system.dC_dy.coeffRef(global_eqn_ids[2], global_var_ids[0]) =
65-
fun_cosh;
66-
system.dC_dy.coeffRef(global_eqn_ids[2], global_var_ids[2]) =
67-
-fun_cosh;
62+
-0.5 * q_in * (Rmax - Rmin) * steep * (1.0 - pow(fun_tanh, 2));
63+
system.dC_dy.coeffRef(global_eqn_ids[2], global_var_ids[0]) = fun_cosh;
64+
system.dC_dy.coeffRef(global_eqn_ids[2], global_var_ids[2]) = -fun_cosh;
6865
}

src/model/ValveTanh.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
* \f[
4040
* Q_{in}-Q_{out}=0
4141
* \f]
42-
*
42+
*
4343
* \f[
4444
* \text{valve\_status} = \frac{1}{2}\left(1+tanh\{k(P_{out}-P{in})\}\right)
4545
* \f]

0 commit comments

Comments
 (0)