ULD load for beam karambaCommon


I am trying to create a uniformly distributed block load for a beam element in c# with the KarambaCommon API

so far I could not find the documentation on how to construct this
I was able to make point loads and mesh loads but I couldn’t find any class to construct a ULD for a beam.

I found the “DistributedForceLoads” but not sure if this is the right constructor for what I want to do.
the test file below was helpful but I don’t understand the arguments are or what this constructor does as the docs are not available.

Any leads would be greatly helpful

thanks in advance!

Hello Moo,
I think that the easiest way to create a uniformly distributed block load for a beam element is with Karamba.Factories.Toolkit.

Down here an example of a simple beam model set up:

namespace Example
    using System.Collections.Generic;
    using System.Linq;
    using Karamba.Elements;
    using Karamba.Geometry;
    using Karamba.Loads;
    using Karamba.Utilities;
    using KarambaCommon;
    using NSubstitute.Exceptions;
    using NUnit.Framework;

    public class UldSetup
        public void UldBaseSetup()
            // Setup the model entities.
            var builder = new Toolkit();

            var defaultCrossSection = builder.CroSec.CircularHollow();

            var loads = new List<Load>
                builder.Load.ConstantForceLoad(Vector3.UnitZ, 10),

            var beamBuilder = builder.Part.LineToBeam(
                new Line3(new[] { Point3.Zero, new Point3(1, 0, 0) }),
                info: new MessageLogger(),
                out _);

            var supports = new[]
                builder.Support.Support(0, new[] { true, true, true, false, false, false }),
                builder.Support.Support(1, new[] { true, true, true, true, false, false }),

            // Assemble the model.
            var model = builder.Model.AssembleModel(
                info: out _,
                mass: out _,
                cog: out _,
                msg: out _,
                runtimeWarning: out _);

            // Run the analysis.
            model = builder.Algorithms.AnalyzeThI(model, out _, out _, out _, out _);

            // Retrieve results for the beam at the mid point.
            var beam = (ModelElementStraightLine)model.elems.First();
            var position = 0.5;

            var state = beam.GetElementState(model, model.lc_super_model_results, position);

            var nx = state.GetForce(BeamDofs.t_x);
            var vy = state.GetForce(BeamDofs.t_y);
            var vz = state.GetForce(BeamDofs.t_z);

            var mx = state.GetForce(BeamDofs.r_x);
            var my = state.GetForce(BeamDofs.r_y);
            var mz = state.GetForce(BeamDofs.r_z);

            var tx = state.GetGlobalDisplacement(BeamDofs.t_x);
            var ty = state.GetGlobalDisplacement(BeamDofs.t_y);
            var tz = state.GetGlobalDisplacement(BeamDofs.t_z);
            var rx = state.GetGlobalDisplacement(BeamDofs.r_x);
            var ry = state.GetGlobalDisplacement(BeamDofs.r_y);
            var rz = state.GetGlobalDisplacement(BeamDofs.r_z);




Thanks Enrico, I will give this a shot

so if i understood correctly you are suggesting to use ConstantForceLoad from the Tookit?

Yes, because the toolkit is already set up to retrieve ready to use entities for a K3D model