private void TestCollocation2DSquareDerivativesInverse() { var nurbs = new NURBS2D(Element.Patch.DegreeKsi, Element.Patch.DegreeHeta, Element.Patch.KnotValueVectorKsi, Element.Patch.KnotValueVectorHeta, Element.CollocationPoint, Element.ControlPoints); var jacobianMatrix = Element.CalculateJacobianMatrix(Element, nurbs); var sq = Element.CalculateSquareDerivatives(jacobianMatrix); var sqInv = sq.Invert(); var expectedSquareDerivatives = new double[3, 3] { { 2.42826017963574e-05, 0.110366560012572, -0.00327413330725496 }, { 0.468499747934614, 3.27929736000920e-06, -0.00247899171968521 }, { 0.00337289086997935, 0.000601601835837063, -0.227400008576538 } }; for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { Assert.True(Utilities.AreValuesEqual(expectedSquareDerivatives[i, j], sqInv[i, j], 1e-9)); } } }
private void TestCollocation2DNaturalDerivatives() { var nurbs = new NURBS2D(Element.Patch.DegreeKsi, Element.Patch.DegreeHeta, Element.Patch.KnotValueVectorKsi, Element.Patch.KnotValueVectorHeta, Element.CollocationPoint, Element.ControlPoints); var jacobianMatrix = Element.CalculateJacobianMatrix(Element, nurbs); var inverseJacobian = jacobianMatrix.Invert(); var dR = Element.CalculateNaturalDerivatives(nurbs, inverseJacobian); var expectedDR = new double[2, 36] { { 3.47418786888943, -1.59491791717771, -1.92846834837001, -0.262652804419645, -0.0104203407760361, -0.000117390572122759, 5.76427956322017, -2.20935170808089, -2.99515321425408, -0.413066690606795, -0.0164721684944232, -0.000186122049081198, 1.52175109688758, -0.494894952798661, -0.749556897897653, -0.104514760021170, -0.00418745878312805, -4.74540731078801e-05, 0.122042978389101, -0.0335114676486208, -0.0572513769355071, -0.00806946895051393, -0.000324861058261046, -3.69313678800837e-06, 0.00349060169214760, -0.000797714074348734, -0.00156336549817325, -0.000222777392010279, -9.01347652676035e-06, -1.02821345353076e-07, 3.09627619179099e-05, -5.75274283568431e-06, -1.32602399879104e-05, -1.91088332929543e-06, -7.77177456175474e-08, -8.89844530737662e-10 }, { -14.6899577196008, -23.6027171162401, -6.10114669210320, -0.482148787388404, -0.0136528729506954, -0.000120341185874666, 5.95025364807184, 9.48302146819428, 2.43520240471957, 0.191291650045700, 0.00538599718314209, 4.72135418543246e-05, 7.70697694882454, 12.3498806809734, 3.18637140507299, 0.251441966498285, 0.00711188139478022, 6.26286759286379e-05, 1.04724339705292, 1.67951170481660, 0.433754517845223, 0.0342690083906348, 0.000970611606690962, 8.56041447935826e-06, 0.0411187405315767, 0.0659813482374857, 0.0170552607531285, 0.00134902549625684, 3.82629915071373e-05, 3.38008279628147e-07, 0.000456621219660495, 0.000733112513353756, 0.000189673945576838, 1.50219235325079e-05, 4.26749268235201e-07, 3.77666981044437e-09 } }; for (int i = 0; i < 2; i++) { for (int j = 0; j < 36; j++) { Assert.True(Utilities.AreValuesEqual(expectedDR[i, j], dR[i, j], 1e-9)); } } }
private void TestCollocation2DSquareDerivatives() { var nurbs = new NURBS2D(Element.Patch.DegreeKsi, Element.Patch.DegreeHeta, Element.Patch.KnotValueVectorKsi, Element.Patch.KnotValueVectorHeta, Element.CollocationPoint, Element.ControlPoints); var jacobianMatrix = Element.CalculateJacobianMatrix(Element, nurbs); var sq = Element.CalculateSquareDerivatives(jacobianMatrix); var expectedSquareDerivatives = new double[3, 3] { { 6.34261015249505e-05, 2.13464040366785, -0.0232716066452060 }, { 9.06142667611920, 0.000469658770689033, -0.130472656344461 }, { 0.0239735472619392, 0.0316631108365837, -4.39822756137908 } }; for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { Assert.True(Utilities.AreValuesEqual(expectedSquareDerivatives[i, j], sq[i, j], 1e-9)); } } }
private void TestCollocationNurbsSecondDerivativeValuesKsiHeta() { var nurbs = new NURBS2D(Element.Patch.DegreeKsi, Element.Patch.DegreeHeta, Element.Patch.KnotValueVectorKsi, Element.Patch.KnotValueVectorHeta, Element.CollocationPoint, Element.ControlPoints); var expectedDerivativeValues = new double[36] { 2149.06069562792, -855.679659372179, -1131.41851180411, -155.601159440793, -6.19685336718003, -0.0699551420991173, -865.026185216468, 343.957661160148, 455.302192175189, 62.6390378398084, 2.49553859812347, 0.0281831570096359, -1124.94078926736, 447.802849169456, 592.623022738136, 81.5687424249061, 3.25176820603158, 0.0367513151596485, -152.924336283433, 60.8966118912998, 80.6284890246988, 11.1062003057394, 0.443183114335965, 0.00501448815852712, -6.00537974270124, 2.39235602803926, 3.16964069157811, 0.437038071570744, 0.0174615737210826, 0.000197860634670657, -0.0666953348003726, 0.0265810606788613, 0.0352459529335453, 0.00486559242236938, 0.000194693484964216, 2.20993449225890e-06, }; for (int i = 0; i < 36; i++) { Assert.True(Utilities.AreValuesEqual(expectedDerivativeValues[i], nurbs.NurbsSecondDerivativeValueKsiHeta[i, 0], 1e-9)); } }
private void TestCollocationNurbsSecondDerivativeValuesHeta() { var nurbs = new NURBS2D(Element.Patch.DegreeKsi, Element.Patch.DegreeHeta, Element.Patch.KnotValueVectorKsi, Element.Patch.KnotValueVectorHeta, Element.CollocationPoint, Element.ControlPoints); var expectedDerivativeValues = new double[36] { 862.208137050026, -1110.45756959740, 136.328997697885, 104.674079793138, 7.13654935955457, 0.112241292397297, 1377.97431476070, -1774.88765607716, 217.939361457008, 167.378864564433, 11.4154822657559, 0.179608457853405, 353.141201313712, -454.943570485826, 55.8828518196742, 42.9408068708527, 2.93056192379451, 0.0461441889857859, 27.5774725355872, -35.5370170399551, 4.36749873086471, 3.35860520842093, 0.229436569225423, 0.00361675794316606, 0.769393594620336, -0.991807715542706, 0.121977213729529, 0.0938940837567214, 0.00642227274402007, 0.000101386093687283, 0.00666544852211772, -0.00859589210517978, 0.00105803642117494, 0.000815413616253236, 5.58573449277392e-05, 8.83328052933049e-07 }; for (int i = 0; i < 36; i++) { Assert.True(Utilities.AreValuesEqual(expectedDerivativeValues[i], nurbs.NurbsSecondDerivativeValueHeta[i, 0], 1e-9)); } }
public void TestShapeNurbs2DSecondDerivativeValuesKsiHeta() { var element = ShellElement; var nurbs2D = new NURBS2D(element, element.ControlPoints); for (var i = 0; i < 12; i++) { for (var j = 0; j < 12; j++) { Assert.True(Utilities.AreValuesEqual(_nurbsSecondDerivativesKsiHetaExpectedValues[i, j], nurbs2D.NurbsSecondDerivativeValueKsiHeta[i, j], Tolerance)); } } }
public void TestShapeNurbs2DDerivativeValuesKsi() { var element = Element; var nurbs2D = new NURBS2D(element, element.ControlPoints); for (var i = 0; i < 16; i++) { for (var j = 0; j < 16; j++) { Assert.True(Utilities.AreValuesEqual(_nurbsDerivativeKsiExpectedValues[i, j], nurbs2D.NurbsDerivativeValuesKsi[i, j], Tolerance)); } } }
public void TestShapeNurbs2DPartitionOfUnity() { var element = Element; var nurbs2D = new NURBS2D(element, element.ControlPoints); for (var p = 0; p < 16; p++) { var sum = 0.0; for (var f = 0; f < nurbs2D.NurbsValues.NumRows; f++) { sum += nurbs2D.NurbsValues[f, p]; } Assert.True(Utilities.AreValuesEqual(1.0, sum, Tolerance)); } }
private void TestCollocation2DHessian() { var nurbs = new NURBS2D(Element.Patch.DegreeKsi, Element.Patch.DegreeHeta, Element.Patch.KnotValueVectorKsi, Element.Patch.KnotValueVectorHeta, Element.CollocationPoint, Element.ControlPoints); var hessianMatrix = Element.CalculateHessian(Element, nurbs, 0); var expectedHessian = new double[3, 2] { { 2.16476793547675, 0.852779461353878 }, { 0.0426696295135573, 0.141574351233695 }, { -1.60009113818852, 3.47799425599668 } }; for (int i = 0; i < 3; i++) { for (int j = 0; j < 2; j++) { Assert.True(Utilities.AreValuesEqual(expectedHessian[i, j], hessianMatrix[i, j], 1e-9)); } } }
private void TestCollocation2DJacobian() { var nurbs = new NURBS2D(Element.Patch.DegreeKsi, Element.Patch.DegreeHeta, Element.Patch.KnotValueVectorKsi, Element.Patch.KnotValueVectorHeta, Element.CollocationPoint, Element.ControlPoints); var jacobian = Element.CalculateJacobianMatrix(Element, nurbs); var expectedJacobian = new double[2, 2] { { -0.00796405057272683, 1.46104086310680 }, { -3.01022037002596, 0.0216716120925286 } }; for (int i = 0; i < 2; i++) { for (int j = 0; j < 2; j++) { Assert.True(Utilities.AreValuesEqual(expectedJacobian[i, j], jacobian[i, j], 1e-9)); } } }
private void TestCollocationNurbsSecondDerivativeValuesKsi() { var nurbs = new NURBS2D(Element.Patch.DegreeKsi, Element.Patch.DegreeHeta, Element.Patch.KnotValueVectorKsi, Element.Patch.KnotValueVectorHeta, Element.CollocationPoint, Element.ControlPoints); var expectedDerivativeValues = new double[36] { 3423.75279424699, 5491.92182529329, 1417.70181859039, 111.895313455824, 3.16472375390534, 0.0278625715677653, -4415.73302894191, -7083.77323668510, -1828.95799921366, -144.392543462572, -4.08519884146217, -0.0359804611907119, 552.395840640308, 886.322219103121, 228.921689739867, 18.0823417720694, 0.511929507290087, 0.00451229290299885, 411.533530845430, 660.486326742618, 170.682865441969, 13.4924925147660, 0.382358417927473, 0.00337402631388489, 27.6278335032534, 44.3565583278856, 11.4705262901248, 0.907651135124908, 0.0257539743915116, 0.000227590908737324, 0.427265525131462, 0.686264485294914, 0.177613291879907, 0.0140711274235435, 0.000399858205299781, 3.53971871791393e-06, }; for (int i = 0; i < 36; i++) { Assert.True(Utilities.AreValuesEqual(expectedDerivativeValues[i], nurbs.NurbsSecondDerivativeValueKsi[i, 0], 1e-9)); } }
private void TestCollocationNurbsDerivativeValuesHeta() { var nurbs = new NURBS2D(Element.Patch.DegreeKsi, Element.Patch.DegreeHeta, Element.Patch.KnotValueVectorKsi, Element.Patch.KnotValueVectorHeta, Element.CollocationPoint, Element.ControlPoints); var expectedDerivativeValues = new double[36] { -10.7764261575829, 4.28954547313487, 5.67289302078282, 0.780193880617294, 0.0310716423001000, 0.000350763503953900, -17.2228001708165, 6.85614787894056, 9.06884597877821, 1.24756736468011, 0.0497015803820970, 0.000561291577019773, -4.41378353511934, 1.75738469144463, 2.32538524761845, 0.320061612345835, 0.0127592996624519, 0.000144204481880636, -0.344680806898117, 0.137274628716991, 0.181739420717421, 0.0250335444667664, 0.000998938093238302, 1.13026735705029e-05, -0.00961637092281610, 0.00383121734040580, 0.00507568966357562, 0.000699844600668407, 2.79617713550472e-05, 3.16840092575466e-07, -8.33090186918566e-05, 3.32047536770791e-05, 4.40267846956413e-05, 6.07772922226825e-06, 2.43195885572400e-07, 2.76047465571621e-09 }; for (int i = 0; i < 36; i++) { Assert.True(Utilities.AreValuesEqual(expectedDerivativeValues[i], nurbs.NurbsDerivativeValuesHeta[i, 0], 1e-9)); } }
private void TestCollocationNurbsDerivativeValuesKsi() { var nurbs = new NURBS2D(Element.Patch.DegreeKsi, Element.Patch.DegreeHeta, Element.Patch.KnotValueVectorKsi, Element.Patch.KnotValueVectorHeta, Element.CollocationPoint, Element.ControlPoints); var expectedDerivativeValues = new double[36] { -21.4902971135349, -34.4718321802253, -8.89866620951732, -0.702347300254383, -0.0198644171588461, -0.000174888485624470, 8.64765671172642, 13.8726772594869, 3.58178377490262, 0.282774601501794, 0.00800034715608075, 7.04631993527534e-05, 11.2480889505601, 18.0476216978275, 4.66138833688865, 0.368199348588330, 0.0104240984648629, 9.18809813721259e-05, 1.52909344026115, 2.45410211782634, 0.634189027990329, 0.0501326872556841, 0.00142069042947834, 1.25365276876252e-05, 0.0600483608277138, 0.0964077990130769, 0.0249308836131535, 0.00197275558582060, 5.59755779195311e-05, 4.94662782999498e-07, 0.000666895671883862, 0.00107115315439964, 0.000277226990376325, 2.19628624949327e-05, 6.24117067249048e-07, 5.52495568636568e-09, }; for (int i = 0; i < 36; i++) { Assert.True(Utilities.AreValuesEqual(expectedDerivativeValues[i], nurbs.NurbsDerivativeValuesKsi[i, 0], 1e-9)); } }
private void TestCollocationNurbsValues() { var nurbs = new NURBS2D(Element.Patch.DegreeKsi, Element.Patch.DegreeHeta, Element.Patch.KnotValueVectorKsi, Element.Patch.KnotValueVectorHeta, Element.CollocationPoint, Element.ControlPoints); var expectedValues = new double[36] { 0.107756491046876, 0.172848409497250, 0.0446196272052037, 0.00352170471035475, 9.96040156364557e-05, 8.76924569066375e-07, 0.172215582909445, 0.276270356282469, 0.0713301881900560, 0.00563137442349921, 0.000159324600280913, 1.40325424039367e-06, 0.0441346527160369, 0.0708142973873237, 0.0182901074420221, 0.00144472100564317, 4.09015227072497e-05, 3.60517704108796e-07, 0.00344655953090833, 0.00553151875569626, 0.00142945498376100, 0.000112998516978540, 3.20222035571125e-06, 2.82571933464716e-08, 9.61567751771517e-05, 0.000154379951879486, 3.99223781884040e-05, 3.15901737750138e-06, 8.96349373609439e-08, 7.92114511665978e-10, 8.33030115505995e-07, 1.33799464227073e-06, 3.46288694845191e-07, 2.74341649711324e-08, 7.79594672058808e-10, 6.90131105601209e-12, }; for (int i = 0; i < 36; i++) { Assert.True(Utilities.AreValuesEqual(expectedValues[i], nurbs.NurbsValues[i, 0], 1e-9)); } }
private void TestCollocation2DNaturalSecondDerivatives() { var nurbs = new NURBS2D(Element.Patch.DegreeKsi, Element.Patch.DegreeHeta, Element.Patch.KnotValueVectorKsi, Element.Patch.KnotValueVectorHeta, Element.CollocationPoint, Element.ControlPoints); var jacobianMatrix = Element.CalculateJacobianMatrix(Element, nurbs); var squareDerivatives = Element.CalculateSquareDerivatives(jacobianMatrix); var inverseJacobian = jacobianMatrix.Invert(); var dR = Element.CalculateNaturalDerivatives(nurbs, inverseJacobian); var hessianMatrix = Element.CalculateHessian(Element, nurbs, 0); var ddR = Element.CalculateNaturalSecondDerivatives(nurbs, hessianMatrix, dR, squareDerivatives); var expectedDDR = new double[3, 36] { { 88.2335831437404, -119.505955167848, 18.8302701221316, 12.0693740553013, 0.808164925342631, 0.0126190908235043, 154.724284830929, -197.204707619928, 22.5376695663091, 18.2677511126776, 1.25175938221591, 0.0197312788429839, 42.6235614868057, -51.7028418534275, 4.22675757562360, 4.47257578565579, 0.312813339681897, 0.00497276414998756, 3.54863847598925, -4.11226045574429, 0.220907486670591, 0.334576926801204, 0.0238794845927093, 0.000382833440896306, 0.105038606513179, -0.116491200572174, 0.00330592088722368, 0.00895036955848703, 0.000652185207602499, 1.05469277294500e-05, 0.000962133048511820, -0.00102212901953845, 5.00971639454230e-06, 7.43606226745050e-05, 5.53600016863964e-06, 9.03330287161375e-08, }, { 1600.90775117971, 2585.93188582269, 671.346629992730, 53.2649005843737, 1.51400418928175, 0.0133939584624100, -2074.81584518481, -3321.06195621426, -855.896726173209, -67.4568119711584, -1.90539772539023, -0.0167550678326542, 257.025103244050, 409.806390644625, 105.298428337080, 8.27762783772177, 0.233270778213823, 0.00204688714618250, 192.648911576717, 308.664188519336, 79.6537504329083, 6.28852824369768, 0.177988270646630, 0.00156872535430612, 12.9388953088588, 20.7501222407440, 5.36100632339471, 0.423850703693734, 0.0120166844216029, 0.000106108680256955, 0.200129129070908, 0.321168095452446, 0.0830637679754102, 0.00657633399403516, 0.000186763318487482, 1.65231149755316e-06, }, { -489.494070016594, 194.431782612362, 258.056869285444, 35.5416797178446, 1.41724247413502, 0.0160180548956297, 185.190946829277, -94.8844611253714, -106.542940892258, -14.3263919541961, -0.564038770631922, -0.00631586810305331, 263.394903176895, -89.2000033990269, -131.167855167361, -18.2249952952833, -0.728804373825343, -0.00824730781331645, 36.9595019671664, -10.3057367660306, -17.3935757870770, -2.44802377613172, -0.0984667985240082, -0.00111862268645221, 1.49037514272202, -0.342723546822060, -0.667995375932686, -0.0951189302412556, -0.00384653859600586, -4.38603822621534e-05, 0.0169599442127733, -0.00315522958209718, -0.00726085056072592, -0.00104593923958584, -4.25259198527444e-05, -4.86762558078115e-07 } }; for (int i = 0; i < 3; i++) { for (int j = 0; j < 36; j++) { Assert.True(Utilities.AreValuesEqual(expectedDDR[i, j], ddR[i, j], 1e-9)); } } }
private void TestCollocation2DddR3() { var nurbs = new NURBS2D(Element.Patch.DegreeKsi, Element.Patch.DegreeHeta, Element.Patch.KnotValueVectorKsi, Element.Patch.KnotValueVectorHeta, Element.CollocationPoint, Element.ControlPoints); var jacobianMatrix = Element.CalculateJacobianMatrix(Element, nurbs); var squareDerivatives = Element.CalculateSquareDerivatives(jacobianMatrix); var inverseJacobian = jacobianMatrix.Invert(); var dR = Element.CalculateNaturalDerivatives(nurbs, inverseJacobian); var hessianMatrix = Element.CalculateHessian(Element, nurbs, 0); var ddR2 = new double[3, nurbs.NurbsSecondDerivativeValueKsi.NumRows]; for (int i = 0; i < ddR2.GetLength(1); i++) { ddR2[0, i] = hessianMatrix[0, 0] * dR[0, i] + hessianMatrix[0, 1] * dR[1, i]; ddR2[1, i] = hessianMatrix[1, 0] * dR[0, i] + hessianMatrix[1, 1] * dR[1, i]; ddR2[2, i] = hessianMatrix[2, 0] * dR[0, i] + hessianMatrix[2, 1] * dR[1, i]; } var ddR3 = new double[3, nurbs.NurbsSecondDerivativeValueKsi.NumRows]; for (int i = 0; i < ddR2.GetLength(1); i++) { ddR3[0, i] = nurbs.NurbsSecondDerivativeValueKsi[i, 0] - ddR2[0, i]; ddR3[1, i] = nurbs.NurbsSecondDerivativeValueHeta[i, 0] - ddR2[1, i]; ddR3[2, i] = nurbs.NurbsSecondDerivativeValueKsiHeta[i, 0] - ddR2[2, i]; } var expectedDDR3 = new double[3, 36] { { 3428.75927797803, 5515.50236484899, 1427.07943762525, 112.875062408196, 3.19892426313487, 0.0282193194058928, -4433.28561061242, -7087.07742888891, -1824.55087816859, -143.661479525820, -4.05413348705436, -0.0356178128855668, 542.529251008904, 876.861827233464, 227.827034387759, 18.0941674285951, 0.514929517409880, 0.00456161151034683, 410.376268459018, 659.126618206284, 170.436904442933, 13.4807371358899, 0.382233949086744, 0.00337472095233623, 27.5852119432326, 44.3020176551260, 11.4593662375484, 0.906982975243831, 0.0257408565831967, 0.000227525246570192, 0.426809100739524, 0.685651755353896, 0.177480247177108, 0.0140624536546447, 0.000399662523172413, 3.53842435837496e-06, }, { 864.139615974603, -1107.04797567769, 137.275050612555, 104.753546992766, 7.13892688826536, 0.112263338634835, 1376.88595178743, -1776.13593647040, 217.722401334426, 167.369407975834, 11.4154226080259, 0.179609715385726, 351.985158496693, -456.670879846764, 55.4637266703440, 42.9096687436616, 2.92973374111487, 0.0461373472193411, 27.4240022023931, -35.7733628980449, 4.30853311144907, 3.35409791704109, 0.229313017217905, 0.00361570359281834, 0.763423292925049, -1.00111494394894, 0.119629334479884, 0.0937126021760722, 0.00641724028752521, 0.000101342627733095, 0.00659948149960499, -0.00869943656623366, 0.00103174926491151, 0.000813368433858544, 5.58002443643615e-05, 8.82831342691263e-07, }, { 2205.71130141894, -776.141558841396, -1113.28448376848, -154.344517152493, -6.16604224841230, -0.0697244317600459, -876.497760579035, 307.440602875033, 442.040054083740, 61.3127822286085, 2.45044916002302, 0.0277211363409050, -1149.31067038181, 404.058158070479, 580.341481943926, 80.5269955683888, 3.22033280770079, 0.0364575621426572, -156.371362914815, 55.0016584266562, 79.0282858822369, 10.9741010056404, 0.439287525442624, 0.00497880573069235, -6.14280520524933, 2.16159686264520, 3.10782106536483, 0.431989704512825, 0.0173140728724888, 0.000196520520292115, -0.0682339175385593, 0.0240220946555860, 0.0345650504478219, 0.00481028867112797, 0.000193084897984501, 2.19537542400338e-06 } }; for (int i = 0; i < ddR3.GetLength(0); i++) { for (int j = 0; j < ddR3.GetLength(1); j++) { Assert.True(Utilities.AreValuesEqual(expectedDDR3[i, j], ddR3[i, j], 1e-9)); } } }