Skip to content

Generate FDM input files for H-Plane #87

@umesh-timalsina

Description

@umesh-timalsina

It might be necessary to generate input files for FDM execution. This is how swri does it when there's a wing in the design(Showing snippet just for wings)

 for i, x in enumerate(wingComponentNames):
            pi = i + 1
            fdIn.write("\n!   Wing (" + str(pi) + ") is component named: " + wingComponentNames[i] + "\n")
            chord = allProperties["Wing_CHORD"][3][i]
            span = allProperties["Wing_SPAN"][3][i]
            fdIn.write("   wing(" + str(pi) + ")%surface_area   = " + str(float(span) / 2.0 * float(chord)) + " \n")
            dcl_daoa_slope = allProperties["Wing_dCl_dAoA_Slope"][3][i]
            aoa_l0 = allProperties["Wing_AoA_L0"][3][i]
            fdIn.write("   wing(" + str(pi) + ")%a   = " + dcl_daoa_slope + " \n")
            fdIn.write("   wing(" + str(pi) + ")%C_L0   = " + str(-float(dcl_daoa_slope) * float(aoa_l0)) + " \n")
            fdIn.write("   wing(" + str(pi) + ")%C_Lmax   = " + allProperties["Wing_CL_Max"][3][i] + " \n")
            fdIn.write("   wing(" + str(pi) + ")%C_Lmin   = -" + allProperties["Wing_CL_Max"][3][i] + " \n")
            fdIn.write("   wing(" + str(pi) + ")%C_D0   = " + allProperties["Wing_CD_Min"][3][i] + " \n")
            fdIn.write(
                "   wing(" + str(pi) + ")%k   = " + str(1.0 / (3.14159 * 0.85 * float(span) / float(chord))) + " \n")
            fdIn.write("   wing(" + str(pi) + ")%C_Dfp   = 1 \n")
            fdIn.write("   wing(" + str(pi) + ")%bias1   = " + allProperties["Wing_Aileron_Bias"][3][i] + " \n")
            fdIn.write("   wing(" + str(pi) + ")%bias2   = " + allProperties["Wing_Flap_Bias"][3][i] + " \n")
            # TAB: 8/17/2021: Separate control channels for each wing 
            fdIn.write("   wing(" + str(pi) + ")%icontrol1 = " + str(num_propellers + (i*2) + 1) + " \n")
            fdIn.write("   wing(" + str(pi) + ")%icontrol2 = " + str(num_propellers + (i*2) + 2) + " \n")
            fdIn.write("   wing(" + str(pi) + ")%tau_a = " + str(0.4) + " \n")
            
            wingName = wingComponentNames[i]
            pointName = wingName + ".PNT0"
            p0 = pointDict[pointName]
            pointName = wingName + ".PNT1"
            p1 = pointDict[pointName]
            pointName = wingName + ".WING_CENTER_PT"
            pc = pointDict[pointName]
            fdIn.write("   wing(" + str(pi) + ")%x   = " + str(pc[0]) + "\n")
            fdIn.write("   wing(" + str(pi) + ")%y   = " + str(pc[1]) + "\n")
            fdIn.write("   wing(" + str(pi) + ")%z   = " + str(pc[2]) + "\n")

            vx = (p0[0] - p1[0])
            vy = (p0[1] - p1[1])
            vz = (p0[2] - p1[2])
            dd = math.sqrt(vx * vx + vy * vy + vz * vz)
            if dd > 0:
                vx = vx / dd
                vy = vy / dd * -1
                vz = vz / dd * -1

            fdIn.write("   wing(" + str(pi) + ")%nx   = " + str(vx) + "\n")
            fdIn.write("   wing(" + str(pi) + ")%ny   = " + str(vy) + "\n")
            fdIn.write("   wing(" + str(pi) + ")%nz   = " + str(vz) + "\n")

Metadata

Metadata

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions