-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
61 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
using BriefFiniteElementNet.Common; | ||
using BriefFiniteElementNet.Mathh; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Diagnostics; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace BriefFiniteElementNet.Elements | ||
{ | ||
public class DynamicUtil | ||
{ | ||
public CSparse.Storage.CompressedColumnStorage<double> K, M, C, Kr, Mr, Cr; | ||
|
||
public void GetMatrices(Model parent, LoadCase loadCase) | ||
{ | ||
var n = parent.Nodes.Count * 6; | ||
var dt = new double[n];//total delta | ||
|
||
ISolver solver; | ||
|
||
var sp = Stopwatch.StartNew(); | ||
|
||
|
||
var permCalculator = new CsparsenetQrDisplacementPermutationCalculator(); | ||
|
||
var perm = | ||
CalcUtil.GenerateP_Delta_Mpc(parent, loadCase, permCalculator); | ||
|
||
|
||
parent.Trace.Write(Common.TraceLevel.Info, "Calculating Displacement Permutation Matrix took {0} ms", sp.ElapsedMilliseconds); | ||
|
||
//var rd = perm.Item2; | ||
|
||
var pd = perm.Item1; | ||
|
||
//var todo = pd.ToDenseMatrix(); | ||
|
||
sp.Restart(); | ||
|
||
var kt = K = MatrixAssemblerUtil.AssembleFullStiffnessMatrix(parent);//total stiffness matrix, same for all load cases | ||
var mt = M = MatrixAssemblerUtil.AssembleFullMassMatrix(parent);//total mass matrix, same for all load cases | ||
var ct = C = MatrixAssemblerUtil.AssembleFullDampingMatrix(parent);//total damp matrix, same for all load cases | ||
|
||
|
||
parent.Trace.Write(Common.TraceLevel.Info, "Assemble Full Stiffness Matrix took {0} ms", sp.ElapsedMilliseconds); | ||
|
||
|
||
if (perm.Item1.RowCount > 0 && perm.Item1.RowCount > 0) | ||
{ | ||
var pf = pd.Transpose(); | ||
|
||
Kr = pf.Multiply(kt).Multiply(pd); | ||
Mr = pf.Multiply(mt).Multiply(pd); | ||
Cr = pf.Multiply(ct).Multiply(pd); | ||
} | ||
|
||
} | ||
} | ||
} |