@@ -4411,15 +4411,17 @@ std::cout<<"Preparing interpolated solution for restart"<<std::endl;
4411
4411
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));
4412
4412
}
4413
4413
if ( !constraints.is_constrained(local_dof_indices[i]) &&
4414
- !(comp_dom.flags[local_dof_indices[i]] & transom_on_water) )
4414
+ !(comp_dom.flags[local_dof_indices[i]] & transom_on_water) &&
4415
+ !(comp_dom.flags[local_dof_indices[i]] & near_inflow))
4415
4416
{
4416
4417
unsigned int ii = local_dof_indices[i];
4417
4418
eta_res[ii] += loc_eta_res[i].val();
4418
4419
phi_res[ii] += loc_phi_res[i].val();
4419
4420
4420
4421
}
4421
4422
if ( !(constraints.is_constrained(local_dof_indices[i])) &&
4422
- !(comp_dom.flags[local_dof_indices[i]] & edge) )
4423
+ !(comp_dom.flags[local_dof_indices[i]] & edge) &&
4424
+ !(comp_dom.flags[local_dof_indices[i]] & near_inflow))
4423
4425
{
4424
4426
unsigned int ii = local_dof_indices[i];
4425
4427
x_smoothing_res[ii] += loc_x_smooth_res[i].val();
@@ -4619,10 +4621,10 @@ std::cout<<"Preparing interpolated solution for restart"<<std::endl;
4619
4621
RestartNonlinearProblemDiff rest_nonlin_prob_diff(*this,comp_dom,t,y,yp,jacobian_dot_matrix);
4620
4622
std::map<unsigned int,unsigned int> &map_diff = rest_nonlin_prob_diff.indices_map;
4621
4623
4622
- /*
4624
+
4623
4625
// these lines test the correctness of the jacobian for the
4624
4626
// restart (reduced) nonlinear problem
4625
-
4627
+ /*
4626
4628
Vector<double> restart_prob_solution(rest_nonlin_prob_diff.n_dofs());
4627
4629
Vector<double> restart_prob_residual(rest_nonlin_prob_diff.n_dofs());
4628
4630
for (std::map<unsigned int, unsigned int>::iterator it = map_diff.begin(); it != map_diff.end(); ++it)
@@ -4646,7 +4648,7 @@ std::cout<<"Preparing interpolated solution for restart"<<std::endl;
4646
4648
rest_nonlin_prob_diff.residual(restart_prob_residual,restart_prob_solution);
4647
4649
cout<<"----------Test---------"<<endl;
4648
4650
for (unsigned int i=0; i<rest_nonlin_prob_diff.n_dofs(); ++i)
4649
- if (fabs(restart_prob_residual(i)-delta_res(i)) > 1e-10 )
4651
+ if (fabs(restart_prob_residual(i)-delta_res(i)) > 1e-15 )
4650
4652
cout<<i<<" "<<delta_res(i)<<" vs "<<restart_prob_residual(i)<<" err "<<restart_prob_residual(i)-delta_res(i)<<" "<<sys_comp(i)<<endl;
4651
4653
delta_res*=-1;
4652
4654
delta_res.add(restart_prob_residual);
@@ -4681,9 +4683,9 @@ std::cout<<"Preparing interpolated solution for restart"<<std::endl;
4681
4683
//output_results(filename1, t, y, yp);
4682
4684
4683
4685
4684
-
4686
+ /*
4685
4687
// these lines test the jacobian of the DAE system
4686
- /*
4688
+
4687
4689
Vector<double> delta_y(this->n_dofs());
4688
4690
Vector<double> delta_res(this->n_dofs());
4689
4691
@@ -4969,11 +4971,11 @@ int FreeSurface<dim>::jacobian(const double t,
4969
4971
bem.solve_system(bem_phi, bem_dphi_dn, bem_bc);
4970
4972
4971
4973
/*
4972
- cout<<"44 !!!!!!"<<endl;
4973
- for (SparsityPattern::iterator col=jacobian_sparsity_pattern.begin(1484 ); col!=jacobian_sparsity_pattern.end(1484 ); ++col)
4974
+ cout<<"JACOBIANO !!!!!!"<<endl;
4975
+ for (SparsityPattern::iterator col=jacobian_sparsity_pattern.begin(80 ); col!=jacobian_sparsity_pattern.end(80 ); ++col)
4974
4976
{
4975
4977
unsigned int j = col->column();
4976
- cout<<j<<"("<<jacobian_matrix(1484 ,j)<<") ";
4978
+ cout<<j<<"("<<jacobian_matrix(80 ,j)<<") ";
4977
4979
}
4978
4980
cout<<endl;
4979
4981
//*/
@@ -5304,7 +5306,7 @@ int FreeSurface<dim>::residual_and_jacobian(const double t,
5304
5306
if (comp_dom.flags[i] & near_inflow)
5305
5307
{
5306
5308
working_map_points(3*i+2) = comp_dom.old_map_points(3*i+2);
5307
- jacobian_matrix.add (3*i+2,3*i+2,1.0);
5309
+ jacobian_matrix.set (3*i+2,3*i+2,1.0);
5308
5310
}
5309
5311
//cout<<"& "<<3*i<<" "<<3*i+1<<endl;
5310
5312
}
@@ -7035,26 +7037,29 @@ int FreeSurface<dim>::residual_and_jacobian(const double t,
7035
7037
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));
7036
7038
}
7037
7039
if ( !constraints.is_constrained(local_dof_indices[i]) &&
7038
- !(comp_dom.flags[local_dof_indices[i]] & transom_on_water))
7040
+ !(comp_dom.flags[local_dof_indices[i]] & transom_on_water) )
7039
7041
{
7040
7042
unsigned int ii = local_dof_indices[i];
7041
- eta_res[ii] += loc_eta_res[i].val();
7043
+ if (!(comp_dom.flags[local_dof_indices[i]] & near_inflow))
7044
+ eta_res[ii] += loc_eta_res[i].val();
7042
7045
phi_res[ii] += loc_phi_res[i].val();
7043
7046
//cout<<"* "<<cell<<" "<<local_dof_indices[i]<<" "<<loc_phi_res[i]<<endl;
7044
7047
for (unsigned int j=0;j<dofs_per_cell;++j)
7045
7048
{
7046
7049
unsigned int jj = local_dof_indices[j];
7047
- for (unsigned int k=0; k<dim; ++k)
7048
- jacobian_matrix.add(3*ii+2,
7049
- 3*jj+k,
7050
- loc_eta_res[i].fastAccessDx(3*j+k));
7051
- jacobian_matrix.add(3*ii+2,
7052
- jj+comp_dom.vector_dh.n_dofs(),
7053
- loc_eta_res[i].fastAccessDx(3*dofs_per_cell+j));
7054
- jacobian_matrix.add(3*ii+2,
7055
- jj+comp_dom.vector_dh.n_dofs()+comp_dom.dh.n_dofs(),
7056
- loc_eta_res[i].fastAccessDx(4*dofs_per_cell+j));
7057
-
7050
+ if (!(comp_dom.flags[local_dof_indices[i]] & near_inflow))
7051
+ {
7052
+ for (unsigned int k=0; k<dim; ++k)
7053
+ jacobian_matrix.add(3*ii+2,
7054
+ 3*jj+k,
7055
+ loc_eta_res[i].fastAccessDx(3*j+k));
7056
+ jacobian_matrix.add(3*ii+2,
7057
+ jj+comp_dom.vector_dh.n_dofs(),
7058
+ loc_eta_res[i].fastAccessDx(3*dofs_per_cell+j));
7059
+ jacobian_matrix.add(3*ii+2,
7060
+ jj+comp_dom.vector_dh.n_dofs()+comp_dom.dh.n_dofs(),
7061
+ loc_eta_res[i].fastAccessDx(4*dofs_per_cell+j));
7062
+ }
7058
7063
for (unsigned int k=0; k<dim; ++k)
7059
7064
jacobian_matrix.add(ii+comp_dom.vector_dh.n_dofs(),
7060
7065
3*jj+k,
@@ -7065,17 +7070,19 @@ int FreeSurface<dim>::residual_and_jacobian(const double t,
7065
7070
jacobian_matrix.add(ii+comp_dom.vector_dh.n_dofs(),
7066
7071
jj+comp_dom.vector_dh.n_dofs()+comp_dom.dh.n_dofs(),
7067
7072
loc_phi_res[i].fastAccessDx(4*dofs_per_cell+j));
7068
-
7069
- for (unsigned int k=0; k<dim; ++k)
7070
- jacobian_dot_matrix.add(3*ii+2,
7071
- 3*jj+k,
7072
- loc_eta_res[i].fastAccessDx(5*dofs_per_cell+3*j+k));
7073
- jacobian_dot_matrix.add(3*ii+2,
7074
- jj+comp_dom.vector_dh.n_dofs(),
7075
- loc_eta_res[i].fastAccessDx(8*dofs_per_cell+j));
7076
- jacobian_dot_matrix.add(3*ii+2,
7077
- jj+comp_dom.vector_dh.n_dofs()+comp_dom.dh.n_dofs(),
7078
- loc_eta_res[i].fastAccessDx(9*dofs_per_cell+j));
7073
+ if (!(comp_dom.flags[local_dof_indices[i]] & near_inflow))
7074
+ {
7075
+ for (unsigned int k=0; k<dim; ++k)
7076
+ jacobian_dot_matrix.add(3*ii+2,
7077
+ 3*jj+k,
7078
+ loc_eta_res[i].fastAccessDx(5*dofs_per_cell+3*j+k));
7079
+ jacobian_dot_matrix.add(3*ii+2,
7080
+ jj+comp_dom.vector_dh.n_dofs(),
7081
+ loc_eta_res[i].fastAccessDx(8*dofs_per_cell+j));
7082
+ jacobian_dot_matrix.add(3*ii+2,
7083
+ jj+comp_dom.vector_dh.n_dofs()+comp_dom.dh.n_dofs(),
7084
+ loc_eta_res[i].fastAccessDx(9*dofs_per_cell+j));
7085
+ }
7079
7086
for (unsigned int k=0; k<dim; ++k)
7080
7087
jacobian_dot_matrix.add(ii+comp_dom.vector_dh.n_dofs(),
7081
7088
3*jj+k,
@@ -7087,23 +7094,25 @@ int FreeSurface<dim>::residual_and_jacobian(const double t,
7087
7094
jj+comp_dom.vector_dh.n_dofs()+comp_dom.dh.n_dofs(),
7088
7095
loc_phi_res[i].fastAccessDx(9*dofs_per_cell+j));
7089
7096
}
7090
-
7091
- for (unsigned int k=0; k<dim; ++k)
7092
- jacobian_matrix.add(3*ii+2,
7093
- k+comp_dom.vector_dh.n_dofs()+comp_dom.dh.n_dofs()+comp_dom.dh.n_dofs(),
7094
- loc_eta_res[i].fastAccessDx(k+10*dofs_per_cell));
7095
- for (unsigned int k=0; k<dim; ++k)
7096
- jacobian_matrix.add(3*ii+2,
7097
- k+3+comp_dom.vector_dh.n_dofs()+comp_dom.dh.n_dofs()+comp_dom.dh.n_dofs(),
7098
- loc_eta_res[i].fastAccessDx(k+3+10*dofs_per_cell));
7099
- for (unsigned int k=0; k<dim; ++k)
7100
- jacobian_matrix.add(3*ii+2,
7101
- k+6+comp_dom.vector_dh.n_dofs()+comp_dom.dh.n_dofs()+comp_dom.dh.n_dofs(),
7102
- loc_eta_res[i].fastAccessDx(k+6+10*dofs_per_cell));
7103
- for (unsigned int k=0; k<4; ++k)
7104
- jacobian_matrix.add(3*ii+2,
7105
- k+9+comp_dom.vector_dh.n_dofs()+comp_dom.dh.n_dofs()+comp_dom.dh.n_dofs(),
7106
- loc_eta_res[i].fastAccessDx(k+9+10*dofs_per_cell));
7097
+ if (!(comp_dom.flags[local_dof_indices[i]] & near_inflow))
7098
+ {
7099
+ for (unsigned int k=0; k<dim; ++k)
7100
+ jacobian_matrix.add(3*ii+2,
7101
+ k+comp_dom.vector_dh.n_dofs()+comp_dom.dh.n_dofs()+comp_dom.dh.n_dofs(),
7102
+ loc_eta_res[i].fastAccessDx(k+10*dofs_per_cell));
7103
+ for (unsigned int k=0; k<dim; ++k)
7104
+ jacobian_matrix.add(3*ii+2,
7105
+ k+3+comp_dom.vector_dh.n_dofs()+comp_dom.dh.n_dofs()+comp_dom.dh.n_dofs(),
7106
+ loc_eta_res[i].fastAccessDx(k+3+10*dofs_per_cell));
7107
+ for (unsigned int k=0; k<dim; ++k)
7108
+ jacobian_matrix.add(3*ii+2,
7109
+ k+6+comp_dom.vector_dh.n_dofs()+comp_dom.dh.n_dofs()+comp_dom.dh.n_dofs(),
7110
+ loc_eta_res[i].fastAccessDx(k+6+10*dofs_per_cell));
7111
+ for (unsigned int k=0; k<4; ++k)
7112
+ jacobian_matrix.add(3*ii+2,
7113
+ k+9+comp_dom.vector_dh.n_dofs()+comp_dom.dh.n_dofs()+comp_dom.dh.n_dofs(),
7114
+ loc_eta_res[i].fastAccessDx(k+9+10*dofs_per_cell));
7115
+ }
7107
7116
for (unsigned int k=0; k<dim; ++k)
7108
7117
jacobian_matrix.add(ii+comp_dom.vector_dh.n_dofs(),
7109
7118
k+comp_dom.vector_dh.n_dofs()+comp_dom.dh.n_dofs()+comp_dom.dh.n_dofs(),
@@ -8112,8 +8121,7 @@ for (unsigned int i=0; i<this->n_dofs(); ++i)
8112
8121
{
8113
8122
unsigned int j = col->column();
8114
8123
//cout<<" "<<i<<" "<<j<<" "<<jacobian_matrix(i,j)+alpha*jacobian_dot_matrix(i,j)<<endl;
8115
- //if ( (j > (int)i-preconditioner_band) &&
8116
- // (j > (int)i+preconditioner_band) )
8124
+
8117
8125
jacobian_preconditioner_matrix.set(i,j,jacobian_matrix(i,j)+alpha*jacobian_dot_matrix(i,j));
8118
8126
}
8119
8127
0 commit comments