Download and run “FEAtext.cpp” and “FEApixel.cpp”. Make some kind of changes to
ID: 3831587 • Letter: D
Question
Download and run “FEAtext.cpp” and “FEApixel.cpp”. Make some kind of changes to one or both of them and turn in the modified code and output.
1) Change the transfer function by using some other rules of physics like Bernoulli’s Principle or the Gas Laws. Or, just some unique rules you make up yourself.
2) Add some more blockages, or a more complex “maze” or “venturi” to simulate fluid flow in a more interesting way.
3) Extend the program to read in data from a large file, perhaps read a prepared bitmap.bmp file and use that to initialize a large map with blockages and initial Q sources. (Red could be blocked, Black could be Q). You could also use grayscale values to represent height, and use that to modify flow rates.
a. Write the intermediate and/or results back to a bitmap file! That would be way cool!
b. If you have an animated gif editor and know how to do that, compile a series of bmp’s into an animated gif.
4) Extend the program into a 3-Dimensional rectangular array.
5) Extend the program to use tetrahedral polygons (aka mesh, stl format, etc) instead of cubes. This may require a graph representation. Good luck with that!
6) Some other change(s), be creative!
“FEAtext.cpp” is below
“FEApixel.cpp” is below:
Explanation / Answer
#include #include #include #include using namespace std; HDC mydc; HWND myconsole; #define PIE YUMMY // its absolutely true #define MAX 100 // size of the matrix #define K 0.001F // proportionality constant (CAN ADJUST THIS) #define SEED 255 // an initial value in the middle of the matrix // the data // how much "stuff" is in each element float Q[MAX][MAX]; // 1 indicates that an element is blocked bool B[MAX][MAX]; // pixel output void drawQ() { for (int row = 0; rowRelated Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.