basicfem – main script

basicfem.py is the main script to execute the Basicfem solver.

basicfem.main()[source]

Main function to read in command line input, processing directories and run respective solvers. The script takes two argument – an input directory name and an output directory name. The input directory should locate in the local directory and needs to contain necessary txt files for basicfem solvers. It can also be an xlsx file that contains all the required input. The output directory will be generated if not exists, or being overwritten.

basicfem.plot_contour_batch(fem_result, scale_factor, output_path, plot_on_deformed=True)[source]

Generate all the contour plot available. Only used for 2d elements.

Parameters:
  • fem_result (BaseSolver) – A Solver object contains the analysis result.
  • scale_factor (float) – The deformation scale factor assigned in the param.
  • output_path (str) – The path to the output directory assigned by the user.
  • plot_on_deformed (bool) – Flag that determines if the contour is plotted on the deformed structures. Default is True.
basicfem.read_param(param_filename)[source]

Read the param file to set the solver related parameters.

The param file will either be an param.txt file inside the input directory, or the Param page inside the input xlsx file.

Parameters:param_filename (str) – The xlsx file name, or the processed path to the param.txt file.
Returns:The dictionary contains solver related paramters.
Return type:dict
basicfem.set_param_guide()[source]

Command line prompt to guide the users setting up parameters.

In the case when param file does not exist, this function will guide the users to provide the necessary paramters for solver. Note that this guide will keep most of the parameters default, only set those that is needed to be assigned for solver to run.

Returns:Parameters necessary for the solver.
Return type:tuple