Cube - Forward Calculation ************************** Forward Calculation takes the geometric factors, lattice structure and material characteristics as inputs to calculate the stress-strain curve, overall effective Young's modulus. ========== Conditions ========== Cube calculates the requested quantity through the stress-strain curve under condition of the sample block compressed by 2mm. In some cases, the plastic deformation may not be reached. The requested input and output are in SI unit. .. list-table:: :widths: 25 25 25 25 :header-rows: 1 * - Force - Displacement - Time - Stress * - Newton, N - Meter, m - Seconds, s - Pascal, Pa ========= Arguments ========= .. list-table:: :widths: 25 25 50 :header-rows: 1 * - Argument - Type - Description * - ``Lattice`` - string, single element list - Name of lattice requested * - ``Profile`` - string, single element list - Cross-sectional profile of the beam. Two options are available, "C" for the circle shape and "R" for Square shape. * - ``Material`` - string, single element list - Defines the base material of lattice structure. * - ``cmd`` - string, single element list - requested operations. * - ``Thk`` - float number, single element list - Thickness of the beam cross-sectional profile. Radius for "C", and width and length for the square shape "R". * - ``x`` - float number, single element list - unit cell length in x direction. * - ``y`` - float number, single element list - unit cell length in y direction. * - ``z`` - float number, single element list - unit cell length in z direction. The table below shows the possible selections of the parameter values. .. list-table:: :widths: 25 75 :header-rows: 1 * - Parameters - Values * - ``Lattice`` - ``PrimCubic``, ``BC``, ``BCCubic``, ``FCCubic``, ``EdgeOcta``, ``NaCL``, ``StarTet``, ``BCStarTet``, ``OctaTet``, ``Dodecahedron``, ``Tetrahedral`` * - ``Material`` - ``Ti64``, ``Inconl_718``, ``AlSi10Mg``, ``316L``, ``17-4_PH_SS_H900`` * - ``Profile`` - ``C``, ``R`` * - ``cmd`` - ``E``, ``StressStrainCurve``, ``MatCurve`` Note that, the profile value ``C`` denotes the circle shape, and ``R`` denotes the square shape. The key ``cmd`` controls the a series of requested operation as explained below. .. list-table:: :widths: 25 75 :header-rows: 1 * - ``cmd`` value - Description * - ``E`` - Calculating the Young's modulus * - ``StressStrainCurve`` - Obtaining the stress-strain curve of the given lattice geometric factor. Note the stress and strain are engineering stress and engineering strain, respectively. * - ``MatCurve`` - Obtaining the material information, such as the Yield Strength, Tensile Strength, that used in the calculation. ======= Returns ======= Returned fields are corresponding to the operation key ``cmd``, explained below. A general field ``Msg`` in all returned results contains error or successful information. .. list-table:: :widths: 25 25 25 25 :header-rows: 1 * - ``cmd`` value - Returned fields - Type - Description * - ``E`` - ``E`` - float, single element list - Young's modulus * - ``StressStrainCurve`` - ``Stress``, ``Strain`` - float, list - Element-wise corresponding stress and strain data points. * - ``MatCurve`` - ``Name``, ``Density``, ``PossionRatio``, ``YoungModulus``, ``YieldStress``, ``TensileStress``, ``RateElongation``, ``Stress``, ``Strain`` - float, single element list - Basic material constants used in Bleem Cube API calculation. The command ``MatCurve`` returns a JSON structure like below if the call was successful : .. code-block:: python { "MatData" : {"Name" : ..., "Density" : ..., ...}, "Msg" : "OK" } User can extract the material constants (e.g. ``Density``, ``PossionRatio`` etc.) from the variable ``MatData``. ======== Examples ======== The example JSON codes are as following. **Example 1: Calculating the elastic modulus for given geometric design of unit cell** Python code example: .. code-block:: python import requests, json # Endpoint url cube_url = "http://cube.bleemcube.com" # User token Token = "f3aa3c11-2817-4a73-993c-db9a62a0ada7" # Body data section includes all information and data for calculation. data = { "Lattice": ["FCCubic"], "Profile": ["C"], "Material": ["Ti64"], "cmd" : ["E"], "Thk": ["0.0005123"], "x": ["0.004"], "y": ["0.005"], "z": ["0.00675"] } # connects to API header = {"x-api-key":Token} r = requests.post(cube_url, data = json.dumps(data), headers=header) # convert returned bytes data to string responses = (r.content.decode("utf-8")).replace("\'","\"") # then convert string to dict re = json.loads(responses) print(re) User should get the returned solution: .. code-block:: python {'E': 13878707727.126333, 'Msg': 'OK'} **Example 2: obtain the stress-strain curve for given geometric design of unit cell** Python code structure refers to above example. Only dict variable :code:`data` needs to be updated as shown below: .. code-block:: python data = { "Lattice": ["FCCubic"], "Profile": ["R"], "Material": ["Ti64"], "cmd" : ["StressStrainCurve"], "Thk": ["0.0005123"], "x": ["0.02"], "y": ["0.02"], "z": ["0.04"] } The calculated stress-strain curve should be returned with the following structure: .. code-block:: python {'strain': [0.0, 0.00020100502512562814, 0.0004020100502512563, 0.0006030150753768845, 0.0008040201005025126, 0.0010050251256281406, 0.001206030150753769, 0.001407035175879397, 0.0016080402010050252, 0.0018090452261306533, 0.002010050251256281, 0.0022110552763819095, 0.002412060301507538, 0.0026130653266331657, 0.002814070351758794, 0.003015075376884422, 0.0032160804020100503, 0.003417085427135678, 0.0036180904522613066, 0.0038190954773869345, 0.004020100502512562, 0.004221105527638191, 0.004422110552763819, 0.004623115577889447, 0.004824120603015076, 0.005025125628140704, 0.0052261306532663315, 0.00542713567839196, 0.005628140703517588, 0.005829145728643216, 0.006030150753768844, 0.006231155778894473, 0.006432160804020101, 0.0066331658291457285, 0.006834170854271356, 0.007035175879396985, 0.007236180904522613, 0.007437185929648241, 0.007638190954773869, 0.007839195979899497, 0.008040201005025125, 0.008241206030150753, 0.008442211055276382, 0.00864321608040201, 0.008844221105527638, 0.009045226130653266, 0.009246231155778894, 0.009447236180904522, 0.009648241206030151, 0.009849246231155778, 0.010050251256281407, 0.010251256281407035, 0.010452261306532663, 0.010653266331658291, 0.01085427135678392, 0.011055276381909547, 0.011256281407035176, 0.011457286432160802, 0.011658291457286432, 0.01185929648241206, 0.012060301507537688, 0.012261306532663316, 0.012462311557788945, 0.012663316582914572, 0.012864321608040201, 0.013065326633165831, 0.013266331658291457, 0.013467336683417087, 0.013668341708542713, 0.013869346733668343, 0.01407035175879397, 0.014271356783919598, 0.014472361809045226, 0.014673366834170856, 0.014874371859296482, 0.015075376884422112, 0.015276381909547738, 0.015477386934673367, 0.015678391959798994, 0.015879396984924625, 0.01608040201005025, 0.01628140703517588, 0.016482412060301505, 0.016683417085427137, 0.016884422110552764, 0.017085427135678392, 0.01728643216080402, 0.017487437185929648, 0.017688442211055276, 0.017889447236180904, 0.018090452261306532, 0.01829145728643216, 0.018492462311557788, 0.018693467336683416, 0.018894472361809043, 0.019095477386934675, 0.019296482412060303, 0.01949748743718593, 0.019698492462311555, 0.019899497487437186, 0.020100502512562814, 0.020301507537688442, 0.02050251256281407, 0.0207035175879397, 0.020904522613065326, 0.021105527638190954, 0.021306532663316582, 0.021507537688442213, 0.02170854271356784, 0.021909547738693465, 0.022110552763819093, 0.022311557788944725, 0.022512562814070353, 0.02271356783919598, 0.022914572864321605, 0.023115577889447236, 0.023316582914572864, 0.023517587939698492, 0.02371859296482412, 0.02391959798994975, 0.024120603015075376, 0.024321608040201004, 0.02452261306532663, 0.024723618090452263, 0.02492462311557789, 0.025125628140703515, 0.025326633165829143, 0.025527638190954775, 0.025728643216080403, 0.02592964824120603, 0.026130653266331662, 0.026331658291457286, 0.026532663316582914, 0.026733668341708542, 0.026934673366834173, 0.0271356783919598, 0.027336683417085426, 0.027537688442211054, 0.027738693467336685, 0.027939698492462313, 0.02814070351758794, 0.028341708542713565, 0.028542713567839197, 0.028743718592964825, 0.028944723618090452, 0.02914572864321608, 0.02934673366834171, 0.029547738693467336, 0.029748743718592964, 0.029949748743718592, 0.030150753768844223, 0.03035175879396985, 0.030552763819095476, 0.030753768844221104, 0.030954773869346735, 0.031155778894472363, 0.03135678391959799, 0.031557788944723615, 0.03175879396984925, 0.03195979899497487, 0.0321608040201005, 0.032361809045226134, 0.03256281407035176, 0.03276381909547739, 0.03296482412060301, 0.033165829145728645, 0.03336683417085427, 0.0335678391959799, 0.03376884422110553, 0.03396984924623116, 0.034170854271356785, 0.03437185929648241, 0.03457286432160804, 0.03477386934673367, 0.034974874371859296, 0.035175879396984924, 0.03537688442211055, 0.03557788944723618, 0.03577889447236181, 0.035979899497487436, 0.036180904522613064, 0.03638190954773869, 0.03658291457286432, 0.03678391959798995, 0.036984924623115575, 0.03718592964824121, 0.03738693467336683, 0.03758793969849246, 0.03778894472361809, 0.03798994974874372, 0.03819095477386935, 0.03839195979899497, 0.038592964824120606, 0.03879396984924623, 0.03899497487437186, 0.03919597989949749, 0.03939698492462311, 0.039597989949748745, 0.03979899497487437, 0.04], 'stress': [1.6747057552066455e-08, 0.0012246622950274329, 89.48906212375269, 917373.7895687866, 1507190.7587064775, 1803945.3098392421, 2062201.218244202, 2357351.1739527592, 2695450.141992364, 3080665.418107499, 3494029.773776894, 3762194.3749847827, 4049296.011592898, 4356455.397273176, 4713606.97497668, 5123043.856720032, 5526445.144661027, 5780215.199547009, 6045638.177617991, 6323249.172026762, 6612311.590114975, 6914581.015233713, 7228748.573017013, 7555659.835502401, 7890384.367029398, 8232009.382605136, 8585848.82484912, 8954897.47605639, 9339809.079166956, 9741265.477190679, 10174958.260066306, 10537074.741739457, 10891375.552803261, 11238129.841075871, 11579189.355984518, 11944990.110876514, 12217002.320065452, 12496826.887252374, 12766240.101688081, 13041461.46892664, 13322616.204203298, 13595432.227154875, 13869972.628560083, 14147763.033653658, 14432475.566784956, 14723431.784958733, 15025478.506572971, 15308592.53327272, 15490046.618215488, 15673066.843673175, 15858512.563112332, 16045603.068641303, 16234437.707249863, 16425393.776191115, 16618563.916262938, 16814005.825494345, 17017215.121798053, 17221811.155112732, 17428867.023162466, 17635778.203791827, 17816169.266575016, 17998405.495200012, 18182505.76331217, 18368350.96589363, 18557231.88077995, 18733550.700605705, 18869690.68788365, 19008631.77805849, 19148906.370523155, 19291513.84663335, 19435183.362102255, 19578605.47036006, 19722216.631237347, 19874568.437039737, 19998773.26539788, 20123754.303787723, 20249516.403082807, 20376064.44447296, 20503607.657648433, 20632131.25243606, 20762620.79154944, 20907260.278831806, 21060544.75041087, 21214953.048302297, 21364104.86386664, 21513340.293213952, 21663618.18202801, 21814945.8122379, 21967330.51663888, 22120779.67924825, 22274340.499927223, 22428674.515773986, 22579117.115134038, 22732448.90010534, 22887694.96431559, 23044001.246039625, 23198118.296104405, 23347379.25013086, 23490797.635964565, 23644419.62829206, 23798155.956443463, 23950595.959316935, 24080397.032212283, 24205297.100238267, 24330961.209279824, 24456438.650576837, 24582563.192830093, 24712085.73927612, 24842812.22069318, 24974012.39050985, 25101221.672088295, 25229078.91527841, 25357587.420580577, 25486750.505305905, 25616571.503664747, 25747053.766847726, 25874505.003248263, 25992844.972528543, 26111726.183015916, 26231151.110138614, 26345226.15012519, 26389225.208228614, 26490793.90187836, 26597798.366190445, 26705197.635610513, 26813030.572619386, 26901612.651910022, 26977317.972442634, 27053026.611097734, 27125728.11721709, 27192012.002897907, 27256048.24737253, 27330066.538017426, 27408609.26625276, 27487377.71513031, 27566372.533337794, 27645594.371429395, 27725043.881828748, 27804721.718832694, 27884628.53861945, 27964764.999253638, 28045131.760690022, 28125729.48477998, 28206558.835278347, 28287620.477846112, 28368915.080057032, 28417396.634670503, 28472188.175085604, 28526512.237422332, 28585234.127828386, 28651714.653937478, 28718349.793450538, 28785139.905951194, 28852085.35185994, 28915837.68124124, 28979260.379726518, 29033719.98091131, 29080285.455389448, 29126925.613491792, 29173640.57499758, 29220430.45988132, 29267295.38830642, 29309900.11489298, 29350796.145850644, 29391749.2389392, 29432759.47377676, 29473826.930093307, 29514951.687730014, 29556133.826638717, 29597373.42688385, 29637069.720681693, 29655228.981467206, 29673399.36881681, 29691580.889548242, 29711552.887537118, 29735608.671795577, 29762611.49894926, 29789638.847298834, 29815689.648849405, 29841467.347409494, 29867267.332549203, 29893089.62353649, 29918934.23965684, 29944801.200211972, 29970690.524519194, 29996602.231914658, 30022536.341749165, 30046187.143718224, 30078178.896607537, 30111481.313346256, 30144820.602362286, 30178196.80448117, 30211609.960572064, 30245060.111550786, 30269983.803231627, 30289967.83485996, 30309965.059807345, 30329040.524766665, 30347014.3954905, 30353513.261210162], 'Msg': 'OK'} **Example 3: Requesting the material constants and information used in the Bleem Cube API** The variable :code:`data` is updated as: .. code-block:: python data = { "Lattice": ["FCCubic"], "Profile": ["C"], "Material": ["AlSi10Mg"], "cmd" : ["MatCurve"], } The outcomes are : .. code-block:: python {'MatData': {'Name': '3D printed AlSi10Mg (A), AS-BUILT Aluminum Alloy Material', 'Density': 2680.0, 'PossionRatio': 0.34, 'YoungModulus': 7300000000, 'YieldStress': 270000000, 'TensileStress': 480000000, 'RateElongation': 0.07, 'TrueStress_Plastic': [280526301.36986303, 301421218.9405397, 322587946.64649093, 344093779.0057656, 366025834.52776706, 388495217.988841, 411641746.11181974, 435639275.5954178, 460701672.8268496, 487089464.981754, 515117212.57100856, 545161643.8356165], 'TrueStrain_Plastic': [0.038245527593084444, 0.041767482001064324, 0.045685874262874106, 0.050120381964143194, 0.055214721729345634, 0.0611389520082186, 0.06809142355889007, 0.0763001687268071, 0.08602347720683742, 0.09754936844251662, 0.11119364820581798, 0.1272962409797362], 'units': 'Kg-m-S'}, 'Msg': 'OK'}