From a90b19a1f85ff432fa522a42fb22db6d67b617f4 Mon Sep 17 00:00:00 2001 From: Andrea Mola Date: Mon, 28 Dec 2015 10:22:52 +0000 Subject: [PATCH] fixed a bug on the version that imposes water height at inflow git-svn-id: svn://svn.sissa.it/openship@567 958231e9-8e66-0410-a4a0-f664109d2741 --- include/restart_nonlinear_problem_diff.h | 1 + source/free_surface.cc | 116 ++++++++++++----------- waveBem.prm | 4 +- 3 files changed, 65 insertions(+), 56 deletions(-) diff --git a/include/restart_nonlinear_problem_diff.h b/include/restart_nonlinear_problem_diff.h index e7d102d..5ae90f3 100644 --- a/include/restart_nonlinear_problem_diff.h +++ b/include/restart_nonlinear_problem_diff.h @@ -68,6 +68,7 @@ public NewtonArgument if ( (comp_dom.flags[i] & water) && (comp_dom.flags[i] & near_boat)==0 && (comp_dom.flags[i] & transom_on_water)==0 && + (comp_dom.flags[i] & near_inflow)==0 && (comp_dom.vector_constraints.is_constrained(3*i+2))==0 ) { //cout<<"W "< &map_diff = rest_nonlin_prob_diff.indices_map; -/* + // these lines test the correctness of the jacobian for the // restart (reduced) nonlinear problem - +/* Vector restart_prob_solution(rest_nonlin_prob_diff.n_dofs()); Vector restart_prob_residual(rest_nonlin_prob_diff.n_dofs()); for (std::map::iterator it = map_diff.begin(); it != map_diff.end(); ++it) @@ -4646,7 +4648,7 @@ std::cout<<"Preparing interpolated solution for restart"< 1e-10) + if (fabs(restart_prob_residual(i)-delta_res(i)) > 1e-15) cout< delta_y(this->n_dofs()); Vector delta_res(this->n_dofs()); @@ -4969,11 +4971,11 @@ int FreeSurface::jacobian(const double t, bem.solve_system(bem_phi, bem_dphi_dn, bem_bc); /* - cout<<"44!!!!!!"<column(); - cout<::residual_and_jacobian(const double t, if (comp_dom.flags[i] & near_inflow) { working_map_points(3*i+2) = comp_dom.old_map_points(3*i+2); - jacobian_matrix.add(3*i+2,3*i+2,1.0); + jacobian_matrix.set(3*i+2,3*i+2,1.0); } //cout<<"& "<<3*i<<" "<<3*i+1<::residual_and_jacobian(const double t, loc_y_smooth_res[i] += loc_stiffness_matrix[i][j]*(y_displs[j]-(1-blend_factor)*comp_dom.old_map_points(3*local_dof_indices[j]+1)); } if ( !constraints.is_constrained(local_dof_indices[i]) && - !(comp_dom.flags[local_dof_indices[i]] & transom_on_water)) + !(comp_dom.flags[local_dof_indices[i]] & transom_on_water) ) { unsigned int ii = local_dof_indices[i]; - eta_res[ii] += loc_eta_res[i].val(); + if (!(comp_dom.flags[local_dof_indices[i]] & near_inflow)) + eta_res[ii] += loc_eta_res[i].val(); phi_res[ii] += loc_phi_res[i].val(); //cout<<"* "<::residual_and_jacobian(const double t, jacobian_matrix.add(ii+comp_dom.vector_dh.n_dofs(), jj+comp_dom.vector_dh.n_dofs()+comp_dom.dh.n_dofs(), loc_phi_res[i].fastAccessDx(4*dofs_per_cell+j)); - - for (unsigned int k=0; k::residual_and_jacobian(const double t, jj+comp_dom.vector_dh.n_dofs()+comp_dom.dh.n_dofs(), loc_phi_res[i].fastAccessDx(9*dofs_per_cell+j)); } - - for (unsigned int k=0; kn_dofs(); ++i) { unsigned int j = col->column(); //cout<<" "< (int)i-preconditioner_band) && - // (j > (int)i+preconditioner_band) ) + jacobian_preconditioner_matrix.set(i,j,jacobian_matrix(i,j)+alpha*jacobian_dot_matrix(i,j)); } diff --git a/waveBem.prm b/waveBem.prm index 0a999e1..b5f9080 100644 --- a/waveBem.prm +++ b/waveBem.prm @@ -156,8 +156,8 @@ subsection Boundary Conditions ID Numbers set Wall Surface 1 ID = 3 set Wall Surface 2 ID = 4 set Wall Surface 3 ID = 0 - set Inflow Surface 1 ID = 0 - set Inflow Surface 2 ID = 0 + set Inflow Surface 1 ID = 9 + set Inflow Surface 2 ID = 10 set Inflow Surface 3 ID = 0 set Pressure Surface ID = 0 set Free Surface Edge On Boat ID = 20