mdo_import_help

Wenn du dir nicht sicher bist, in welchem der anderen Foren du die Frage stellen sollst, dann bist du hier im Forum für allgemeine Fragen sicher richtig.
Antworten
Mirabelle1998
User
Beiträge: 4
Registriert: Sonntag 21. Juni 2020, 10:29

Hallo, ich bin eine neue Nutzerin,
und auch eine Python-Neuling, in der Hoffnung,
hier aus der Weisheit und Erfahrung anderer
Mitglieder viel zu lernen.

Nun, kennt jemand mdo_import_help ?
Ich versuche, einen Python-Code zu starten,
aber es scheitert immer wieder,
weil mdo_import_ Hilfe fehlt.

Danke, liebe Leute

Mirabelle la Terreur
__deets__
User
Beiträge: 14545
Registriert: Mittwoch 14. Oktober 2015, 14:29

Bitte zeig den Code den du da genau laufen lässt, und den Fehler als Ganzes. Und bitte mit den Code Tags (</> im vollständigen Editor)
Sirius3
User
Beiträge: 18272
Registriert: Sonntag 21. Oktober 2012, 17:20

Der einzige Treffer in Google ist der Doppelpost https://python-forum.io/Thread-mdo-import-help
Also das ist kein allgemein verfügbares Paket, sondern irgendetwas spezielles, da, kann man ohne mehr Kontext nicht helfen.
Mirabelle1998
User
Beiträge: 4
Registriert: Sonntag 21. Juni 2020, 10:29

__deets__ hat geschrieben: Sonntag 21. Juni 2020, 10:39 Bitte zeig den Code den du da genau laufen lässt, und den Fehler als Ganzes. Und bitte mit den Code Tags (</> im vollständigen Editor)
Vielen Dank !

Also, hier geht's, so sieht es bei mir (mit Spyder Python 3.7) :

Fehler (innerhalb Part 1.2 unten) :
from mdo_import_helper import *
exec(import_modules('pySpline', 'tripan', 'functions'))

ModuleNotFoundError :
No module named 'mdo_import_helper'

Code :

# =======================================================================================
# Aerodynamic Analysis of a Wing
# =======================================================================================
# A generic semi-tappered wing is used for this example
# =======================================================================================
# Aerodynamic Analysis With Tripan Flow Solver
# =======================================================================================
# Part 1 : Importing Standard Python Modules
import os, sys, string, pdb, copy, time, string, re, numpy, datetime
# Set the beginning of the timer for code
t0 = datetime.datetime.now()

# _______________________________________________________________________________________
# Part 1.1 : Importing External Python Modules and setting of broadcasting variable
from mpi4py import MPI
comm = MPI.COMM_WORLD

# _______________________________________________________________________________________
# Part 1.2 : Importing Extension modules and initializing 'comm' variables
from mdo_import_helper import *
exec(import_modules('pySpline', 'tripan', 'functions'))

# _______________________________________________________________________________________
# Part 1.3 : Defining the folder for the results output
prefix = './results'
for arg in sys.argv:
# Find the prefix from the command line arguments
m = re.match('(prefix=)(.*)', arg)
if m:
prefix = m.group(2)
# Create a new directory and broadcast it to everything
if os.path.isdir(prefix):
i = 1
while os.path.isdir(os.path.join(prefix, 'Aero_Analysis_Num%d'%(i))):
i = i+1
prefix = os.path.join(prefix, 'Aero_Analysis_Num%d'%(i))
os.mkdir(prefix)
prefix = prefix + os.sep
else:
print('Prefix is not a directory!')
prefix = MPI.COMM_WORLD.bcast(prefix, root=0)
print ('Using prefix = %s'%(prefix))

# =======================================================================================
# Part 2 : Defining The Functions to set up the Tripan Object
def setUpTriPanWing(comm, trifile='geo/wing.tripan', wakefile='geo/wing.edge'):
# Set up TriPan using the files
ndownstream = 100
sym_direction = 2 # Use symmetry about the z-axis
down_dist = 150.0
time_dependent = 0 # A steady state simulation
a_wake_dir = numpy.zeros(3)
b_wake_dir = numpy.zeros(3)
a_wake_dir[1] = 1.0
b_wake_dir[2] = 1.0
# Stretch the wake downstream
wake_history = tripan.WakeHistory(ndownstream, down_dist, tripan.WakeHistory.STRETCHED)
triPan = tripan.TriPanel(comm, trifile, wakefile, wake_history, time_dependent, ndownstream, a_wake_dir, b_wake_dir, sym_direction)
npanels = triPan.getNumPanels()
triPan.setPCSizes(1.5, 150*npanels)
print('TriPan panels', npanels)
return triPan

# =======================================================================================
# Part 3 : Core of the Script for Aerodynamic Analysis With Tripan Flow Solver
# _______________________________________________________________________________________
# Part 3.1 : Setting Up the Tripan Flow Solver
# Defining The Names for the Tripan Input Files
trifile = 'geo/wing_50x100.tripan'; wakefile = 'geo/wing_50x100.wake'
edgefile = 'geo/wing_50x100.edge';
# Set Up Tripan Object
triPan = setUpTriPanWing(comm, trifile=trifile, wakefile=wakefile)
edgeinfo = tripan.TriPanEdgeInfo(edgefile)
# Set Up Tripan Solver
n_flight_cons = 1
triOpt = tripan.TriPanOpt(triPan, n_flight_cons)

# _______________________________________________________________________________________
# Part 3.2 : Defining The Design Parameters for the Atmosphere properties
Semi_Span = 15/2
# Generic atmospheric conditions for 1000m , 25 m/s with MAC as reference length
Minf = 0.0743 # Incompressible Mach number
rho = 1.11164 # Air density kg/m^3
ainf = 336.4379 # Speed of sound m/s
alpha = (4.0/180.0)*numpy.pi # Angle of attack
Vinf = Minf*ainf # Air speed
Qinf = 0.5*rho*Vinf**2 # Dynamic Pressure

# _______________________________________________________________________________________
# Part 3.3 : Solving the Aerodynamic System
# Function to get the Wing Area to compute coefficients
area_func = tripan.TriPanProjectedArea()
Area_ref = area_func.evalFunction(triPan)
print('Area_Tripan = ', Area_ref)
# Setting the Load Case, the Wing Angle of Attack and Flight Condition
load_case = 0
alpha_num = 0
fcon = tripan.FlightCondition(rho, Minf, Vinf, alpha, alpha_num, load_case)
triOpt.addFlightCondition(0, fcon)
triOpt.setFlightCondition(0)
# Setting the options for the Generalized Minimal Residual Method (GMRES) Solver
gmres_iters = 60
max_iters = 5*gmres_iters
triOpt.setGMRESIters(gmres_iters, max_iters)
triOpt.monitor()
# Solve the aerodynamic problem
triOpt.solve()

# _______________________________________________________________________________________
# Part 3.4 : Setting Up the Solution Output Files
# Setting the names for the Output Files
obj_aero_name = prefix+'wing_obj_aero.dat'
tecplot_sol_name = prefix+'wing_tripan_solution.dat'
wake_sol_name = prefix+'wing_wake_file.dat'
load_file_name = 'load_data/wing_aero_load.dat'
lift_dist_name = prefix+'wing_lift_dist.dat'
# Generating Surface solution output
triOpt.writeAeroFile(obj_aero_name)
# Generating .dat Tacplot Visualization files
out_type = 1
triPan.writeSeqTecplotFile(tecplot_sol_name, -1.0, out_type)
triPan.writeWakeFile(wake_sol_name)
# Generating Load data
triPan.writeAeroForceFile(Winf, load_file_name)
# Generating lift distribution graph
Zloc = numpy.linspace(0.01, Semi_Span)
triPan.writeLiftDistribution(lift_dist_name, Zloc)
# Evaluation of aerodynamic functions
lift_func = tripan.TriPanLift()
drag_func = tripan.TriPanDrag()
lift = triOpt.evalAeroFunc(lift_func)
drag = triOpt.evalAeroFunc(drag_func)
# Writing some outputs for user visualization
print('Lift = ', lift*Qinf*2)
print('Drag = ', drag*Qinf*2)
print('CL = ', (lift/Area_ref)*2)
print('CD = ', (drag/Area_ref)*2)
final_time = datetime.datetime.now()-t0
print('Total time spent in the aerodynamic analysis: ', final_time)
Mirabelle1998
User
Beiträge: 4
Registriert: Sonntag 21. Juni 2020, 10:29

Sirius3 hat geschrieben: Sonntag 21. Juni 2020, 10:44 Der einzige Treffer in Google ist der Doppelpost https://python-forum.io/Thread-mdo-import-help
Also das ist kein allgemein verfügbares Paket, sondern irgendetwas spezielles, da, kann man ohne mehr Kontext nicht helfen.
Danke un jawohl, das ist richtig. Das war ich selbst auf Englisch geschrieben... Kontext ist jetzt verfügbar/hier sichtbar, Code, Feheler usw.
Benutzeravatar
__blackjack__
User
Beiträge: 14052
Registriert: Samstag 2. Juni 2018, 10:21
Wohnort: 127.0.0.1
Kontaktdaten:

@Mirabelle1998: Da fehlt Dir anscheinend ein Modul. Mehr kann man da jetzt auch nicht zu sagen.
“Vir, intelligence has nothing to do with politics!” — Londo Mollari
__deets__
User
Beiträge: 14545
Registriert: Mittwoch 14. Oktober 2015, 14:29

Das scheint ein Modul zu sein, dass in deinem Projet/Uni/Was-auch-immer entwickelt und verwendet wird. Denn zum Python Kern gehoert es nicht, und wie wir ja schon festgestellt haben, bist du auch die einzige, die damit ein Problem hat.

Ich wuerde mich da an einen Betreuer oder was auch immer wenden, oder nochmal die Dokumentation studieren, ob da diesbezueglich etwas erwaehnt wird - was man installieren muss, etc.
Mirabelle1998
User
Beiträge: 4
Registriert: Sonntag 21. Juni 2020, 10:29

Genau, das ist ganz richtig; ich habe auch nirgendwo beim Python-Universum etwas dazu gefunden.

Aber, ich werde sofort meinen Professor kontaktieren, sonst kann ich nicht weiter gehen, ohne Modul lauft's nicht das Ding.

Endlich, Vielen Dank wieder, ich danke euch weil das Problem/Geheimnis ist gelöst !
Antworten