* Use `-DCMAKE_BUILD_TYPE=debug` if you would like to build the code for debugging purposes. By default the make files will be configured for the release build.
* If you wish to build the GUI execute `cmake .. -DFEA_BUILD_GUI=ON -DCMAKE_PREFIX_PATH="/path/to/Qt"`
5. On Linux run `make` in the terminal from the build directory to build all the targets. On Windows the solution file will be located in the build directory. Open the solution file in Visual Studio and compile.
## Introduction ##
This contains a C++ implementation of 3D Euler-Bernoulli beam element formulation.
An analysis can be formulated in C++, through a command line interface via a config file, or using the graphical user interface.
### Method 1: Using C++ ###
An analysis consists of the `fea::Job` as well as any boundary conditions (`fea::BC`), prescribed nodal forces (`fea::Force`), and ties (`fea::Tie`).
The latter of which ties to nodes together via a linear springs between all translational and rotational degrees of freedom.
The `fea::Options` struct can be used to request results of the analysis be written to disk as well as modify various aspect of the analysis.
#### Forming the job ####
The job defines the nodal coordinates in \f$(x, y, z)\f$ space,
the nodes that are connected to form beam elements, and the elemental properties.
The nodal coordinates are formed as a vector of `fea::Node`'s where each node simply contains the \f$(x, y, z)\f$ coordinates of the point.
An element contains the 2 nodal indices that are connected to form the element as well as the associated properties of the element.
The properties must define the extensional stiffness, \f$EA\f$, bending stiffness parallel to the local z-axis \f$EI_{z}\f$,
bending stiffness parallel to the local y-axis\f$EI_{y}\f$, the torsional stiffness, \f$GJ\f$, and a vector pointing along the beam elements local y-axis.
An example forming a simple job with a single element is shown below.
Boundary conditions are applied by specifying the index of the node, the degree of freedom, and the prescribed value.
The index of the node is simply the index the node occurs in the node list. The degree of freedom can be defined using the `fea::DOF` enum or by specifying the integer associated with the degree of freedom explicitly. There are 6 degrees of freedom per node meaning valid integers associated with degrees of freedom are between 0 and 5. The associations for degrees of freedom are defined as
* 0 = displacement along the global x-axis.
* 1 = displacement along the global y-axis.
* 2 = displacement along the global z-axis.
* 3 = rotation about the global x-axis.
* 4 = rotation about the global y-axis.
* 5 = rotation about the global z-axis.
Continuing the example from above, we can fix all degrees of freedom of the node at the origin using the following code:
By default submitting an analysis to the `fea::solve` function will not save the results.
The outputs must be requested using the `fea::Options` struct. Using the appropriate member variables nodal displacements, nodal forces, and the forces associated with ties can be saved to a CSV file.
The name of the file the output is saved to is also set in the options as well as the delimiter used when writing the data to disk.
Additionally, the `fea::Options` struct has the ability to set the epsilon value on nodal forces and displacements.
After the analysis if the magnitude of the displacement is below the epsilon value, it will be set to 0.0.
The default is `1.0e-14`. A summary of the analysis can be saved to a text file using the `save_report` and `report_filename` member variables of `fea::Options`.
If the `verbose` member is set to `true` informational messages regarding the current step and time taken on previous steps of the analysis will be written to `std::cout`. An example of customizing the analysis with the options struct is shown below:
Once the analysis has been setup, it can be solved using the `fea::solve` function. This functions takes as input the job, boundary conditions,
prescribed nodal forces, ties (discussed below), and options. `fea::solve` will solve the analysis, save the requested files, and return a summary of the analysis.
The `fea::Summary` object can return a report of the analysis in the form of a string using the `fea::Summary::fullReport()` function, and member variables `fea::Summary::nodal_forces`, `fea::Summary::nodal_displacements`, and `fea::Summary::tie_forces` contain the results of the analysis.
The use of a JSON document avoids the need to set each of these options using command line options, which can become tedious when running multiple jobs.
The "nodes", "elems", and "props" keys are required. Keys "bcs", "forces", and "ties" are optional--if not provided the analysis will assume none were prescribed.
If the "options" key is not provided the analysis will run with the default options.
Any of all of the "options" keys presented above can be used to customize the analysis.
If a key is not provided the default value is used in its place.
See the Formatting CSV Files section below for how the CSV files should be created.
### Method 3: Using the GUI ###
A simple graphical user interface can be used to set up an analysis.
Internally, the GUI creates the JSON file used by the CLI (see above) without the need to write the file by hand.
The program then saves a temporary configuration file and submits it to the command line application.
This requires that the command line application has been compiled and is located in the same directory as the GUI.
To open the GUI navigate to the build folder and open the fea_gui executable located in the `bin` directory.
The first set of buttons allows the path to the CSV files to be set, and the second set of controls customizes the options.
Once the files and options have been configured, clicking the submit button will run the analysis.
## Formatting CSV files ##
All CSV file must be comma delimited with no spaces between values, i.e. one row of the nodal coordinates file might resemble `1.0,2.0,3.0`.
The file indicated by the value of "nodes" should be in the format: