Hello Abbas,

Thanks for your reply.

I will take a look at the step13.

Howerver, I would like to know if the cell matrix transform seems like the 
process below:

    const Eigen::MatrixXd& cell_matrix,
    const Eigen::VectorXd& cell_youngs_modulus,
    const std::vector<int>& local_dof_indices,
    Eigen::MatrixXd& tangent_matrix,
    Eigen::VectorXd& global_youngs_modulus)

   const int N = cell_matrix.rows();
    const int M = tangent_matrix.rows();

    // Loop over the local degrees of freedom
    for (int i = 0; i < N; ++i) {
        const int global_i = local_dof_indices[i]; // Global index of the 
i-th local dof

        // Add the contribution of the i-th local dof to the global Young's 
modulus vector
        global_youngs_modulus(global_i) += cell_youngs_modulus(i);

        for (int j = 0; j < N; ++j) {
            const int global_j = local_dof_indices[j]; // Global index of 
the j-th local dof

            // Add the contribution of the (i,j)-th entry of the cell 
matrix multiplied by the i-th and j-th Young's modulus to the global 
tangent matrix
            tangent_matrix(global_i, global_j) += cell_matrix(i, j) * 
cell_youngs_modulus(i) * cell_youngs_modulus(j);
        }
    }

I am not quite sure if the assembly process for the global stiffness matrix 
is correct.

Best regards
Lance

On Tuesday, August 1, 2023 at 11:47:12 AM UTC+2 abbas.b...@gmail.com wrote:

> Lance, 
>
> I am not sure if I understood you correctly. 
> Maybe looking at the local_assemble_matrix() function in step:13 might 
> help. 
>
> Abbas
>
> On Tuesday, August 1, 2023 at 11:00:10 AM UTC+2 dim...@gmail.com wrote:
>
>> Hello dear group,
>>
>> I have one question which is about how to build global stiffness matrix 
>> with cell stiffness matrix.
>>
>> In our project,the density is a vector (actually we need a mu vector but 
>> in the code of deallii mu is a scalar)with different values,I would like to 
>> use the element of density vector to build cell matrix as written in the 
>> link below:
>>
>>  
>> https://www.dealii.org/current/doxygen/code-gallery/Quasi_static_Finite_strain_Compressible_Elasticity/cook_membrane.cc
>> (starting from line 1782)
>>
>> And finally the cell stiffness matrix is used to build global stiffness 
>> matrix,but I don' know how the global stiffness matrix is bulit with cell 
>> stiffness matrix.
>>
>>
>> https://www.dealii.org/current/doxygen/code-gallery/Quasi_static_Finite_strain_Compressible_Elasticity/cook_membrane.cc
>> (starting from line 1599)
>> //>>>>>>>>>>>>>>>>>>>>>>>>>>
>>      constraints.distribute_local_to_global(
>>         data.cell_matrix, 
>> data.cell_rhs,
>>         data.local_dof_indices,
>>         tangent_matrix, 
>> system_rhs);
>>     }
>>
>>
>> //<<<<<<<<<<<<<<<<<<<<<<<<<<<<
>>
>>
>> I have a idea that I use mu[0] to obtain the first cell_matrix and use 
>> mu[1] to get the second cell stiffness matrix ,step by step then I got 
>> final mu[m] to obtain the last cell stiffness matrix and in the end I use 
>> some function like  distribute_local_to_global to construct the global 
>> stiffness matrix,and system rhs and even the solutions.
>>
>>                I checked the code in 
>> AffineConstraints<number>::distribute_local_to_global 
>> <https://www.dealii.org/current/doxygen/deal.II/classAffineConstraints.html#a373fbdacd8c486e675b8d2bff8943192>.
>>  
>> (
>> https://www.dealii.org/current/doxygen/deal.II/affine__constraints_8h_source.html
>> )
>> But the hint information guides me to read the cm.templates.h file.
>> ewcfp I was a little confused ,I did not find the file from dealii lib. 
>> could anyone provide any information or hint? Thanks in advance!
>> Best regards
>> Lance
>> Could 
>>
>> I
>>
>

-- 
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 dealii+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dealii/0e042fbd-fab4-408e-a67e-a43f612c7490n%40googlegroups.com.

Reply via email to