Cart3D CFD Interface
- class pysagas.cfd.cart3d.Cart3D[source]
- __init__(stl_files, aero_csh='aero.csh', input_cntl='input.cntl', freestream=None, verbosity=1, c3d_log_name='C3D_log', c3d_info_file=None, write_config_xml=True, ref_area=1.0, ref_length=1.0)[source]
Instantiate the Cart3D solver wrapper.
- Parameters:
stl_files (list[str]) – A list of filepaths to the STL files to intersect and simulate.
aero_csh (str) – The filepath to the reference aero.csh file. The default option will look in the current working directory.
c3d_log_name (str, optional) – The name to use for the Cart3D logfile. The default is C3D_log.
write_config_xml (bool, optional) – A boolean flag to write the Cart3D Config.xml file when running comp2tri. If the geometry may be perturbed to a state where one component is no longer part of the wetted surface, writing the comp2tri file can cause set-up issues, and so it can be beneficial to turn it off. The default is True.
input_cntl (str)
freestream (FlowState | None)
verbosity (int | None)
c3d_info_file (str)
ref_area (float | None)
ref_length (float | None)
- Return type:
None
- static _c3d_running(c3d_log_name, donefile)[source]
Watches the Cart3D log file to check for errors and return False if Cart3D has stopped running.
- Returns:
running (bool) – Whether Cart3D is still running.
error (str) – The error message, if an error has occured.
- Parameters:
c3d_log_name (str)
donefile (str)
- Return type:
bool
- static _edit_input_cntl(mach, aoa, original, new)[source]
Edits the Mach number and angle of attack in the input.cntl file.
- Parameters:
mach (float)
aoa (float)
original (str)
new (str)
- static _infer_adapt(aero_csh_fp)[source]
Returns the target adapt number by reading the aero.csh file.
- Parameters:
aero_csh_fp (str)
- Return type:
str
- _prepare_sim_dir(sim_dir_name)[source]
Prepares a new directory to run the simulation in.
- Parameters:
sim_dir_name (dir)
- save(name, attributes)[source]
Save the solution to VTK file format. Note that the geometry mesh must have been loaded from a parser which includes connectivity information (eg. PyMesh or TRI).
- Parameters:
name (str) – The filename prefix of the desired output file.
attributes (Dict[str, list]) – The attributes dictionary used to initialise the file writer. Note that this is not required when calling solve from a child FlowSolver.
- solve(freestream=None, mach=None, aoa=None)[source]
Run the flow solver.
- Parameters:
freestream (Flowstate, optional) – The free-stream flow state. The default is the freestream provided upon instantiation of the solver.
mach (float, optional) – The free-stream Mach number. The default is that specified in the freestream flow state.
aoa (float, optional) – The free-stream angle of attack. The default is that specified in the freestream flow state.
- Returns:
result – The flow results.
- Return type:
:raises Exception : when no freestream can be found.:
- solve_sens(sensitivity_filepath, freestream=None, mach=None, aoa=None)[source]
Run the flow solver to obtain sensitivity information.
- Parameters:
freestream (Flowstate, optional) – The free-stream flow state. The default is the freestream provided upon instantiation of the solver.
Mach (float, optional) – The free-stream Mach number. The default is that specified in the freestream flow state.
aoa (float, optional) – The free-stream angle of attack. The default is that specified in the freestream flow state.
sensitivity_filepath (str)
mach (float | None)
- Return type:
:raises Exception : when no freestream can be found.:
- property status
Returns the status of the wrapper.