Skip to content

Commit

Permalink
update - IloadHandler
Browse files Browse the repository at this point in the history
  • Loading branch information
epsi1on committed Jul 9, 2024
1 parent b567583 commit 0efceb9
Show file tree
Hide file tree
Showing 10 changed files with 31 additions and 83 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,6 @@ public override ILoadHandler[] GetLoadHandlers()
return new ILoadHandler[] {

new LoadHandlers.ShaftHelper.Concentrated_UF_Handler(),
new LoadHandlers.ShaftHelper.GeneralHandler(),
};
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace BriefFiniteElementNet.ElementHelpers.LoadHandlers.EulerBernoulliBeamHe
/// </summary>
/// <remarks>
/// Imposed strain do not affect euler bernauly, output always zero so inherit from ZeroLoadHandler</remarks>
public class ImposedStrain_UF_NUF_Handler : ZeroLoadHandler
public class ImposedStrain_UF_NUF_Handler : ZeroForceLoadHandler
{
public override bool CanHandle(Element elm, IElementHelper hlpr, ElementalLoad load)
{
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

namespace BriefFiniteElementNet.ElementHelpers.LoadHandlers.TimoshenkoBeamHelper
{
public class ImposedStrain_UFNUF_Handler : ZeroLoadHandler
public class ImposedStrain_UFNUF_Handler : ZeroForceLoadHandler
{
/// <inheritdoc/>
public override bool CanHandle(Element elm, IElementHelper hlpr, ElementalLoad load)
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ namespace BriefFiniteElementNet.ElementHelpers.LoadHandlers
/// represents a zero load handler which it's output is always zero
/// for code reuse porpuse only
/// </summary>
public abstract class ZeroLoadHandler : ILoadHandler
public abstract class ZeroForceLoadHandler
: ILoadHandler
{
public abstract bool CanHandle(Element elm, IElementHelper hlpr, ElementalLoad load);

Expand All @@ -27,7 +28,7 @@ public Displacement GetLocalLoadDisplacementAt(Element elm, IElementHelper hlpr,

public object GetLocalLoadInternalForceAt(Element targetElement, IElementHelper hlpr, ElementalLoad load, IsoPoint loc)
{
return new CauchyStressTensor();//zero
return new Force();//zero
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,12 @@ public GeneralStressTensor GetLocalInternalStressAt(Element targetElement, Displ

public ILoadHandler[] GetLoadHandlers()
{
throw new NotImplementedException();
return new ILoadHandler[] {

new LoadHandlers.CstHelper.Concentrated_UF_Handler(),
new LoadHandlers.CstHelper.ImposedStrain_UF_Handler(),
new LoadHandlers.CstHelper.Uniform_UF_Handler(),
};
}
#endregion
}
Expand Down
17 changes: 10 additions & 7 deletions Sources/BriefFiniteElementNet/Elements/BarElement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -947,12 +947,14 @@ public Force GetExactInternalForceAt(double xi, LoadCase loadCase)
GetInternalForceAt(xi, loadCase);
//Force.Zero;

var fcs = new Dictionary<DoF, double>();
//var fcs = new Dictionary<DoF, double>();

//var buf = new FlatShellStressTensor();

var helpers = GetHelpers();

var vec = new double[6];

foreach (var load in this.Loads)
if (load.Case == loadCase)
foreach (var helper in helpers)
Expand All @@ -961,17 +963,18 @@ public Force GetExactInternalForceAt(double xi, LoadCase loadCase)

foreach (var fc in tns)
{
double existing;

fcs.TryGetValue(fc.Item1, out existing);
vec[(int)fc.Item1] += fc.Item2;

fcs[fc.Item1] = existing + fc.Item2;
//double existing;
//fcs.TryGetValue(fc.Item1, out existing);
//fcs[fc.Item1] = existing + fc.Item2;
}
}

var buff = new Force();
buff += approx;//TODO: maybe += approx !

buff += Force.FromVector(vec, 0);
/*
if (fcs.ContainsKey(DoF.Dx))
buff.Fx += fcs[DoF.Dx];
Expand All @@ -989,7 +992,7 @@ public Force GetExactInternalForceAt(double xi, LoadCase loadCase)
if (fcs.ContainsKey(DoF.Rz))
buff.Mz += fcs[DoF.Rz];

*/
return buff;
}

Expand Down
3 changes: 2 additions & 1 deletion Sources/TestingConsole/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,10 @@ static void Main(string[] args)
//new BarElementExactInternalDisplacement().TestEulerBernouly_diry();

//test();
tmp();
//tmp();
//BriefFiniteElementNet.Validation.GithubIssues.Issue183.Run();
//BriefFiniteElementNet.Validation.GithubIssues.Issue181.Run();
BriefFiniteElementNet.Validation.GithubIssues.Issue41.Run();

Console.Write("Done");

Expand Down
8 changes: 8 additions & 0 deletions Validation/Validation/GithubIssues/Issue41.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,21 @@ public static void Run()
el.Material = mat;
//el.Loads.Add(load1);
elementList.Add(el);

{
//var ld = new Loads.UniformLoad(loadCase1, Vector.K, 10, CoordinationSystem.Global);
//el.Loads.Add(ld);
}

}


BarElement el2 = new BarElement(nodeList[0], nodeList[21]); el2.Section = secAA; el2.Material = mat; elementList.Add(el2);
BarElement el3 = new BarElement(nodeList[10], nodeList[22]); el3.Section = secAA; el3.Material = mat; elementList.Add(el3);
BarElement el4 = new BarElement(nodeList[20], nodeList[23]); el4.Section = secAA; el4.Material = mat; elementList.Add(el4);



nodeList[21].Constraints = Constraints.MovementFixed & Constraints.FixedRX; // Constraints.FixedDX & Constraints.FixedDY & Constraints.FixedDZ & Constraints.FixedRY & Constraints.FixedRZ;
nodeList[22].Constraints = Constraints.FixedDZ & Constraints.FixedDY & Constraints.FixedRX; // z = vertical
nodeList[23].Constraints = Constraints.FixedDZ & Constraints.FixedDY & Constraints.FixedRX; // z = vertical
Expand Down

0 comments on commit 0efceb9

Please sign in to comment.