@@ -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}
0 commit comments