File size: 3,776 Bytes
947d4a1
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
[
    {
        "id": "heatx_001",
        "input": "Design counter-flow heat exchanger for 50kW thermal load with water coolant",
        "reasoning": "[REQUIREMENTS_PARSE]\n- Heat load (Q): 50 kW\n- Coolant: Water\n- Type: Counter-flow tube-in-tube\n\n[PHYSICS_DERIVATION]\n\nStep 1: LMTD Calculation\nT_hot_in = 150°C, T_hot_out = 80°C\nT_cold_in = 20°C, T_cold_out = 60°C\n$\\Delta T_1 = 150 - 60 = 90°C$\n$\\Delta T_2 = 80 - 20 = 60°C$\n$LMTD = \\frac{90-60}{\\ln(90/60)} = 74.1°C$\n\nStep 2: Overall Heat Transfer\nU = 1500 W/(m²·K) (water-water)\n$A = \\frac{Q}{U \\cdot LMTD} = \\frac{50000}{1500 \\times 74.1} = 0.45$ m²\n\nStep 3: Tube Sizing\nInner tube: D_i = 20mm, D_o = 25mm\nOuter tube: D_i = 40mm\nLength: L = A/(π·D) = 7.2m\n\n[CONSTRAINT_VALIDATION]\n✓ Re_inner = 25000 > 10000 (turbulent)\n✓ Pressure drop = 0.5 bar < 1 bar limit",
        "output": "using PicoGK;\nusing System.Numerics;\n\nnamespace AlgoRythm.RedRock.HeatExchangers\n{\n    public class CounterFlowHX\n    {\n        const float INNER_TUBE_ID = 20.0f;\n        const float INNER_TUBE_OD = 25.0f;\n        const float OUTER_TUBE_ID = 40.0f;\n        const float OUTER_TUBE_OD = 45.0f;\n        const float LENGTH = 7200.0f;\n        \n        public static Voxels GenerateHeatExchanger()\n        {\n            Voxels voxHX = new Voxels();\n            Vector3 start = new Vector3(0,0,0);\n            Vector3 end = new Vector3(0,0,LENGTH);\n            \n            // Outer tube\n            Voxels outer = Voxels.voxSphere(start, OUTER_TUBE_OD/2);\n            Voxels outerInner = Voxels.voxSphere(start, OUTER_TUBE_ID/2);\n            outer.BoolSubtract(outerInner);\n            voxHX.BoolAdd(outer);\n            \n            // Inner tube\n            Voxels inner = Voxels.voxSphere(start, INNER_TUBE_OD/2);\n            Voxels innerInner = Voxels.voxSphere(start, INNER_TUBE_ID/2);\n            inner.BoolSubtract(innerInner);\n            voxHX.BoolAdd(inner);\n            \n            return voxHX;\n        }\n    }\n}"
    },
    {
        "id": "lattice_001",
        "input": "Generate gyroid lattice infill for lightweight structural component, 30% relative density",
        "reasoning": "[REQUIREMENTS_PARSE]\n- Lattice type: Gyroid (TPMS)\n- Relative density: 30%\n- Purpose: Structural lightweighting\n\n[PHYSICS_DERIVATION]\n\nStep 1: Gyroid Implicit Function\n$f(x,y,z) = \\sin(x)\\cos(y) + \\sin(y)\\cos(z) + \\sin(z)\\cos(x)$\n\nStep 2: Wall Thickness for 30% Density\nFor gyroid: $\\rho_{rel} = 0.5 + 0.5 \\cdot \\text{erf}(t/\\sigma)$\nSolving for ρ = 0.3: t = 0.8mm at 5mm unit cell\n\nStep 3: Unit Cell Period\n$\\lambda = 5$ mm (good for SLM printing)\nScaling factor: $k = 2\\pi/\\lambda$\n\n[CONSTRAINT_VALIDATION]\n✓ Wall thickness 0.8mm > 0.4mm (SLM min)\n✓ Cell size 5mm suitable for powder removal",
        "output": "using PicoGK;\nusing System.Numerics;\n\nnamespace AlgoRythm.RedRock.Lattices\n{\n    public class GyroidLattice : IImplicit\n    {\n        float m_fPeriod = 5.0f;\n        float m_fThickness = 0.8f;\n        \n        public float fValue(Vector3 vec)\n        {\n            float k = 2.0f * (float)Math.PI / m_fPeriod;\n            float x = vec.X * k;\n            float y = vec.Y * k;\n            float z = vec.Z * k;\n            \n            float gyroid = (float)(Math.Sin(x)*Math.Cos(y) + \n                                   Math.Sin(y)*Math.Cos(z) + \n                                   Math.Sin(z)*Math.Cos(x));\n            return gyroid - m_fThickness;\n        }\n        \n        public static Voxels GenerateGyroid(BBox3 bounds)\n        {\n            GyroidLattice lattice = new GyroidLattice();\n            return new Voxels(lattice, bounds);\n        }\n    }\n}"
    }
]