idaholab / moose

Multiphysics Object Oriented Simulation Environment
https://www.mooseframework.org
GNU Lesser General Public License v2.1
1.71k stars 1.04k forks source link

Change MassMatrix kernel to only compute the mass matrix for a single variable #28436

Open TheGreatCid opened 3 weeks ago

TheGreatCid commented 3 weeks ago

Motivation

Right now MassMatrix needs to be invoked once per variable to fully populate the mass matrix. For example for 3D solid mechanics, there needs to be a MassMatrix kernel for disp_x, disp_y, and disp_z.

This works, but is unnecessary. The mass matrix could be calculated on one variable, and then the mass matrix values could be used to populate the DOFs corresponding to any other variables.

Design

Need to find a way to call the mass matrix calculation on a single variable, store the mass matrix, and then populate the DOFs of any other variables with the calculated values, rather than recalculating the mass matrix for each variable.

Impact

This should lead to speedups for any method using the MassMatrix with multiple variables.

lindsayad commented 3 weeks ago

I think it would be best to have profiling reveal this as a hot spot before doing any development for this. In general different variables can have different finite element families and orders making the mass matrix calculation for one invalid for another