Hello Wolfgang,
thanks for your reply.
I wonder whether the stiffness matrix could be converted to a matrix with
rows = cell_numbers and columns = cell_numbers.
I tried to write the gradient with rows = degree_of_freedom into with rows
= cell_numbers.
###################
for (unsigned int i = 0; i < solid_3d.solution_n.size(); ++i) {
solver_vector(i) = solid_3d.solution_n[i];
obj_det(i)= solid_3d.solution_n[i];
norm2_value+=std::pow(solid_3d.solution_n[i],2);
}
norm2_value=std::sqrt(norm2_value);
Eigen::VectorXd
solver_gradient=-1*(obj_det/norm2_value).transpose()*inv_dense_matrix*solver_vector*solver_vector.transpose()*100;
// the length of rows and columns in solver_gradient is respectively
equal to the number of degree of freedom
/*---------------------new update on degree of finite into
cells---------------- */
//change the length of rows and column into the number of cells//
Eigen::VectorXd
cell_gradients_solid(solid_3d.triangulation.n_active_cells());
FE_Q<dim> fe_tmp(parameters.poly_degree);
const QGauss<dim> qf_cell(parameters.quad_order);
const UpdateFlags uf_cell(update_gradients | update_JxW_values);
FEValues<dim> fe_values_ref_tmp(fe_tmp, qf_cell, uf_cell);
unsigned int cell_index_solid = 0;
double dof_value = 0;
double gradient_tmp = 0;
std::cout<<"***************************************"<<std::endl;
for (auto cell = solid_3d.dof_handler_ref.begin_active(); cell !=
solid_3d.dof_handler_ref.end(); ++cell) {
if (cell->is_locally_owned()) {
fe_values_ref_tmp.reinit(cell);
std::vector<dealii::types::global_dof_index>
local_dof_indices(solid_3d.dofs_per_cell) ;
cell->get_dof_indices(local_dof_indices);
for (unsigned int i = 0; i < local_dof_indices.size(); ++i) {
dealii::types::global_dof_index global_index =
local_dof_indices[i];
dof_value = solver_gradient(global_index);
gradient_tmp += dof_value;
dof_value=0;
}
cell_gradients_solid(cell_index_solid) = gradient_tmp;
gradient_tmp=0;
++cell_index_solid;
}
}
//change the length of rows and column into the number of cells
std::cout<<cell_gradients_solid<<std::endl;
###################
If the gradient could be converted from degree of freedom into a
cell_numbers, may I know if the stiffness matrix with length of degree of
freedom could be converted to a stiffness matrix with rows = cell_numbers
and columns = cell_numbers.
But I am not quite sure if the idea about converting from degree of freedom
into cell_numbers is mathematically correct.
If I have a wrong thought, please kindly provide hint and suggestions.
Best regards
Lance
Wolfgang Bangerth <[email protected]> 于2023年10月31日周二 01:32写道:
>
> On 10/30/23 15:54, Lance Zhang wrote:
> >
> > may I know how the stiffness matrix in global degrees of freedom could
> > be converted into stiffness matrix in global cells?
>
> Lance:
> How do you define "stiffness matrix in global cells" mathematically?
>
> Best
> W.
>
> --
> The deal.II project is located at http://www.dealii.org/
> For mailing list/forum options, see
> https://groups.google.com/d/forum/dealii?hl=en
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "deal.II User Group" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/dealii/1sVmdUIFY3k/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/dealii/b56b296b-14bf-46e0-bc39-da2f3b1de3b8%40colostate.edu
> .
>
--
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see
https://groups.google.com/d/forum/dealii?hl=en
---
You received this message because you are subscribed to the Google Groups
"deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/dealii/CADwW6P%3DRHcfEe63gDG5m23MZXPL8g%2BstczDEeUiZzAqwzFP8Jg%40mail.gmail.com.