sheet 4
This commit is contained in:
parent
c21fee7862
commit
65a23d88d6
67 changed files with 14385 additions and 0 deletions
16
sheet4/C/.vscode/c_cpp_properties.json
vendored
Normal file
16
sheet4/C/.vscode/c_cpp_properties.json
vendored
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
{
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Linux",
|
||||
"includePath": [
|
||||
"${workspaceFolder}/**"
|
||||
],
|
||||
"defines": [],
|
||||
"compilerPath": "/usr/bin/gcc",
|
||||
"cStandard": "c17",
|
||||
"cppStandard": "gnu++17",
|
||||
"intelliSenseMode": "linux-gcc-x64"
|
||||
}
|
||||
],
|
||||
"version": 4
|
||||
}
|
||||
0
sheet4/C/.vscode/c_cpp_properties.json:Zone.Identifier
vendored
Normal file
0
sheet4/C/.vscode/c_cpp_properties.json:Zone.Identifier
vendored
Normal file
6
sheet4/C/.vscode/settings.json
vendored
Normal file
6
sheet4/C/.vscode/settings.json
vendored
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"files.associations": {
|
||||
"ostream": "cpp",
|
||||
"iostream": "cpp"
|
||||
}
|
||||
}
|
||||
0
sheet4/C/.vscode/settings.json:Zone - Kopie - Kopie (2).Identifier
vendored
Normal file
0
sheet4/C/.vscode/settings.json:Zone - Kopie - Kopie (2).Identifier
vendored
Normal file
0
sheet4/C/.vscode/settings.json:Zone - Kopie - Kopie (2).Identifier:Zone.Identifier
vendored
Normal file
0
sheet4/C/.vscode/settings.json:Zone - Kopie - Kopie (2).Identifier:Zone.Identifier
vendored
Normal file
0
sheet4/C/.vscode/settings.json:Zone - Kopie - Kopie.Identifier
vendored
Normal file
0
sheet4/C/.vscode/settings.json:Zone - Kopie - Kopie.Identifier
vendored
Normal file
0
sheet4/C/.vscode/settings.json:Zone - Kopie - Kopie.Identifier:Zone.Identifier
vendored
Normal file
0
sheet4/C/.vscode/settings.json:Zone - Kopie - Kopie.Identifier:Zone.Identifier
vendored
Normal file
0
sheet4/C/.vscode/settings.json:Zone - Kopie.Identifier
vendored
Normal file
0
sheet4/C/.vscode/settings.json:Zone - Kopie.Identifier
vendored
Normal file
0
sheet4/C/.vscode/settings.json:Zone - Kopie.Identifier:Zone - Kopie - Kopie.Identifier
vendored
Normal file
0
sheet4/C/.vscode/settings.json:Zone - Kopie.Identifier:Zone - Kopie - Kopie.Identifier
vendored
Normal file
0
sheet4/C/.vscode/settings.json:Zone - Kopie.Identifier:Zone - Kopie.Identifier
vendored
Normal file
0
sheet4/C/.vscode/settings.json:Zone - Kopie.Identifier:Zone - Kopie.Identifier
vendored
Normal file
0
sheet4/C/.vscode/settings.json:Zone - Kopie.Identifier:Zone.Identifier
vendored
Normal file
0
sheet4/C/.vscode/settings.json:Zone - Kopie.Identifier:Zone.Identifier
vendored
Normal file
0
sheet4/C/.vscode/settings.json:Zone - Kopie.Identifier:Zone.Identifier:Zone.Identifier
vendored
Normal file
0
sheet4/C/.vscode/settings.json:Zone - Kopie.Identifier:Zone.Identifier:Zone.Identifier
vendored
Normal file
0
sheet4/C/.vscode/settings.json:Zone.Identifier
vendored
Normal file
0
sheet4/C/.vscode/settings.json:Zone.Identifier
vendored
Normal file
0
sheet4/C/.vscode/settings.json:Zone.Identifier:Zone.Identifier
vendored
Normal file
0
sheet4/C/.vscode/settings.json:Zone.Identifier:Zone.Identifier
vendored
Normal file
0
sheet4/C/.vscode/settings.json:Zone.Identifier:Zone.Identifier:Zone.Identifier
vendored
Normal file
0
sheet4/C/.vscode/settings.json:Zone.Identifier:Zone.Identifier:Zone.Identifier
vendored
Normal file
BIN
sheet4/C/C.pdf
Normal file
BIN
sheet4/C/C.pdf
Normal file
Binary file not shown.
2563
sheet4/C/Doxyfile
Normal file
2563
sheet4/C/Doxyfile
Normal file
File diff suppressed because it is too large
Load diff
32
sheet4/C/Makefile
Normal file
32
sheet4/C/Makefile
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
#
|
||||
# use GNU-Compiler tools
|
||||
COMPILER=GCC_
|
||||
# alternatively from the shell
|
||||
# export COMPILER=GCC_
|
||||
# or, alternatively from the shell
|
||||
# make COMPILER=GCC_
|
||||
|
||||
# use Intel compilers
|
||||
#COMPILER=ICC_
|
||||
|
||||
# use PGI compilers
|
||||
# COMPILER=PGI_
|
||||
|
||||
|
||||
SOURCES = main.cpp
|
||||
OBJECTS = $(SOURCES:.cpp=.o)
|
||||
|
||||
PROGRAM = main.${COMPILER}
|
||||
|
||||
# uncomment the next to lines for debugging and detailed performance analysis
|
||||
CXXFLAGS += -g
|
||||
LINKFLAGS += -g
|
||||
# do not use -pg with PGI compilers
|
||||
|
||||
ifndef COMPILER
|
||||
COMPILER=GCC_
|
||||
endif
|
||||
|
||||
include ../${COMPILER}default.mk
|
||||
$(PROGRAM): $(OBJECTS)
|
||||
$(CXX) $(CXXFLAGS) $(OBJECTS) -llapacke -lopenblas -o $(PROGRAM)
|
||||
51
sheet4/C/main.cpp
Normal file
51
sheet4/C/main.cpp
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <vector>
|
||||
#include <cmath>
|
||||
#include <lapacke.h>
|
||||
using namespace std;
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
unsigned int ns[5] = {10,20,30,40,70};
|
||||
int p = 70;
|
||||
int rhs = 1;
|
||||
for(unsigned int i = 0; i< sizeof(ns)/sizeof(ns[0]); i++)
|
||||
{
|
||||
int n=ns[i];
|
||||
unsigned int nodes = n+1;
|
||||
|
||||
vector<double> upperdiagonal(n,-n+p/2.0);
|
||||
vector<double> lowerdiagonal(n,-n-p/2.0);
|
||||
vector<double> diagonal(nodes,2*n);
|
||||
vector<double> F(nodes,0.0);
|
||||
upperdiagonal[0]=0.0;
|
||||
lowerdiagonal[n-1]=0.0;
|
||||
diagonal[0] = 1.0;
|
||||
diagonal[n] = 1.0;
|
||||
F[n] = 1.0;
|
||||
|
||||
//Tridiagonal
|
||||
LAPACKE_dgtsv(LAPACK_COL_MAJOR,nodes,rhs,lowerdiagonal.data(),diagonal.data(),upperdiagonal.data(),F.data(),nodes);
|
||||
|
||||
|
||||
cout << "Solution u_h at nodes x_0..x_" << n << ":\n";
|
||||
|
||||
for (unsigned int j = 0; j < nodes; ++j) {
|
||||
|
||||
double xi = double(j) /double(n);
|
||||
cout << "u_h(" << xi << ") = " << F[j] << "\n";
|
||||
// F will be overwritten with sol
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
From Methode der finiten Elemente fuer Ingenieure:
|
||||
small n approximates pu' not good espicially if n < p/2=35 therefor this oscillation (see plot) occurs.
|
||||
*/
|
||||
return 0;
|
||||
|
||||
|
||||
}
|
||||
180
sheet4/C/output.txt
Normal file
180
sheet4/C/output.txt
Normal file
|
|
@ -0,0 +1,180 @@
|
|||
Solution u_h at nodes x_0..x_10:
|
||||
u_h(0) = -3.51571e-17
|
||||
u_h(0.1) = -0.00786414
|
||||
u_h(0.2) = 0.00629131
|
||||
u_h(0.3) = -0.0191885
|
||||
u_h(0.4) = 0.0266752
|
||||
u_h(0.5) = -0.0558794
|
||||
u_h(0.6) = 0.0927188
|
||||
u_h(0.7) = -0.174758
|
||||
u_h(0.8) = 0.3067
|
||||
u_h(0.9) = -0.559925
|
||||
u_h(1) = 1
|
||||
Solution u_h at nodes x_0..x_20:
|
||||
u_h(0) = -3.2746e-17
|
||||
u_h(0.05) = -2.41868e-11
|
||||
u_h(0.1) = 6.44981e-11
|
||||
u_h(0.15) = -2.6068e-10
|
||||
u_h(0.2) = 9.31639e-10
|
||||
u_h(0.25) = -3.4402e-09
|
||||
u_h(0.3) = 1.25899e-08
|
||||
u_h(0.35) = -4.6187e-08
|
||||
u_h(0.4) = 1.69328e-07
|
||||
u_h(0.45) = -6.20895e-07
|
||||
u_h(0.5) = 2.27659e-06
|
||||
u_h(0.55) = -8.34752e-06
|
||||
u_h(0.6) = 3.06075e-05
|
||||
u_h(0.65) = -0.000112228
|
||||
u_h(0.7) = 0.000411501
|
||||
u_h(0.75) = -0.00150884
|
||||
u_h(0.8) = 0.00553241
|
||||
u_h(0.85) = -0.0202855
|
||||
u_h(0.9) = 0.0743802
|
||||
u_h(0.95) = -0.272727
|
||||
u_h(1) = 1
|
||||
Solution u_h at nodes x_0..x_30:
|
||||
u_h(0) = -6.65912e-18
|
||||
u_h(0.0333333) = -6.65912e-18
|
||||
u_h(0.0666667) = -6.65912e-18
|
||||
u_h(0.1) = -6.65912e-18
|
||||
u_h(0.133333) = -6.65912e-18
|
||||
u_h(0.166667) = -6.65912e-18
|
||||
u_h(0.2) = -6.65912e-18
|
||||
u_h(0.233333) = -6.65912e-18
|
||||
u_h(0.266667) = -6.65912e-18
|
||||
u_h(0.3) = -6.65912e-18
|
||||
u_h(0.333333) = -6.65907e-18
|
||||
u_h(0.366667) = -6.6598e-18
|
||||
u_h(0.4) = -6.65023e-18
|
||||
u_h(0.433333) = -6.77472e-18
|
||||
u_h(0.466667) = -5.1563e-18
|
||||
u_h(0.5) = -2.61958e-17
|
||||
u_h(0.533333) = 2.47317e-16
|
||||
u_h(0.566667) = -3.30835e-15
|
||||
u_h(0.6) = 4.29153e-14
|
||||
u_h(0.633333) = -5.57992e-13
|
||||
u_h(0.666667) = 7.25381e-12
|
||||
u_h(0.7) = -9.42996e-11
|
||||
u_h(0.733333) = 1.22589e-09
|
||||
u_h(0.766667) = -1.59366e-08
|
||||
u_h(0.8) = 2.07176e-07
|
||||
u_h(0.833333) = -2.69329e-06
|
||||
u_h(0.866667) = 3.50128e-05
|
||||
u_h(0.9) = -0.000455166
|
||||
u_h(0.933333) = 0.00591716
|
||||
u_h(0.966667) = -0.0769231
|
||||
u_h(1) = 1
|
||||
Solution u_h at nodes x_0..x_40:
|
||||
u_h(0) = -4.79093e-18
|
||||
u_h(0.025) = -4.79093e-18
|
||||
u_h(0.05) = -4.79093e-18
|
||||
u_h(0.075) = -4.79093e-18
|
||||
u_h(0.1) = -4.79093e-18
|
||||
u_h(0.125) = -4.79093e-18
|
||||
u_h(0.15) = -4.79093e-18
|
||||
u_h(0.175) = -4.79093e-18
|
||||
u_h(0.2) = -4.79093e-18
|
||||
u_h(0.225) = -4.79093e-18
|
||||
u_h(0.25) = -4.79093e-18
|
||||
u_h(0.275) = -4.79093e-18
|
||||
u_h(0.3) = -4.79093e-18
|
||||
u_h(0.325) = -4.79093e-18
|
||||
u_h(0.35) = -4.79093e-18
|
||||
u_h(0.375) = -4.79093e-18
|
||||
u_h(0.4) = -4.79093e-18
|
||||
u_h(0.425) = -4.79093e-18
|
||||
u_h(0.45) = -4.79093e-18
|
||||
u_h(0.475) = -4.79093e-18
|
||||
u_h(0.5) = -4.79093e-18
|
||||
u_h(0.525) = -4.79089e-18
|
||||
u_h(0.55) = -4.79026e-18
|
||||
u_h(0.575) = -4.78078e-18
|
||||
u_h(0.6) = -4.63869e-18
|
||||
u_h(0.625) = -2.50728e-18
|
||||
u_h(0.65) = 2.94639e-17
|
||||
u_h(0.675) = 5.09032e-16
|
||||
u_h(0.7) = 7.70256e-15
|
||||
u_h(0.725) = 1.15605e-13
|
||||
u_h(0.75) = 1.73415e-12
|
||||
u_h(0.775) = 2.60123e-11
|
||||
u_h(0.8) = 3.90184e-10
|
||||
u_h(0.825) = 5.85277e-09
|
||||
u_h(0.85) = 8.77915e-08
|
||||
u_h(0.875) = 1.31687e-06
|
||||
u_h(0.9) = 1.97531e-05
|
||||
u_h(0.925) = 0.000296296
|
||||
u_h(0.95) = 0.00444444
|
||||
u_h(0.975) = 0.0666667
|
||||
u_h(1) = 1
|
||||
Solution u_h at nodes x_0..x_70:
|
||||
u_h(0) = -1.30667e-17
|
||||
u_h(0.0142857) = -1.30667e-17
|
||||
u_h(0.0285714) = -1.30667e-17
|
||||
u_h(0.0428571) = -1.30667e-17
|
||||
u_h(0.0571429) = -1.30667e-17
|
||||
u_h(0.0714286) = -1.30667e-17
|
||||
u_h(0.0857143) = -1.30667e-17
|
||||
u_h(0.1) = -1.30667e-17
|
||||
u_h(0.114286) = -1.30667e-17
|
||||
u_h(0.128571) = -1.30667e-17
|
||||
u_h(0.142857) = -1.30667e-17
|
||||
u_h(0.157143) = -1.30667e-17
|
||||
u_h(0.171429) = -1.30667e-17
|
||||
u_h(0.185714) = -1.30667e-17
|
||||
u_h(0.2) = -1.30667e-17
|
||||
u_h(0.214286) = -1.30667e-17
|
||||
u_h(0.228571) = -1.30667e-17
|
||||
u_h(0.242857) = -1.30667e-17
|
||||
u_h(0.257143) = -1.30667e-17
|
||||
u_h(0.271429) = -1.30667e-17
|
||||
u_h(0.285714) = -1.30667e-17
|
||||
u_h(0.3) = -1.30667e-17
|
||||
u_h(0.314286) = -1.30667e-17
|
||||
u_h(0.328571) = -1.30667e-17
|
||||
u_h(0.342857) = -1.30666e-17
|
||||
u_h(0.357143) = -1.30664e-17
|
||||
u_h(0.371429) = -1.30657e-17
|
||||
u_h(0.385714) = -1.30637e-17
|
||||
u_h(0.4) = -1.30576e-17
|
||||
u_h(0.414286) = -1.30393e-17
|
||||
u_h(0.428571) = -1.29845e-17
|
||||
u_h(0.442857) = -1.282e-17
|
||||
u_h(0.457143) = -1.23265e-17
|
||||
u_h(0.471429) = -1.08459e-17
|
||||
u_h(0.485714) = -6.40428e-18
|
||||
u_h(0.5) = 6.92065e-18
|
||||
u_h(0.514286) = 4.68954e-17
|
||||
u_h(0.528571) = 1.6682e-16
|
||||
u_h(0.542857) = 5.26593e-16
|
||||
u_h(0.557143) = 1.60591e-15
|
||||
u_h(0.571429) = 4.84387e-15
|
||||
u_h(0.585714) = 1.45577e-14
|
||||
u_h(0.6) = 4.36994e-14
|
||||
u_h(0.614286) = 1.31124e-13
|
||||
u_h(0.628571) = 3.93399e-13
|
||||
u_h(0.642857) = 1.18022e-12
|
||||
u_h(0.657143) = 3.54069e-12
|
||||
u_h(0.671429) = 1.06221e-11
|
||||
u_h(0.685714) = 3.18663e-11
|
||||
u_h(0.7) = 9.55991e-11
|
||||
u_h(0.714286) = 2.86797e-10
|
||||
u_h(0.728571) = 8.60392e-10
|
||||
u_h(0.742857) = 2.58117e-09
|
||||
u_h(0.757143) = 7.74352e-09
|
||||
u_h(0.771429) = 2.32306e-08
|
||||
u_h(0.785714) = 6.96917e-08
|
||||
u_h(0.8) = 2.09075e-07
|
||||
u_h(0.814286) = 6.27225e-07
|
||||
u_h(0.828571) = 1.88168e-06
|
||||
u_h(0.842857) = 5.64503e-06
|
||||
u_h(0.857143) = 1.69351e-05
|
||||
u_h(0.871429) = 5.08053e-05
|
||||
u_h(0.885714) = 0.000152416
|
||||
u_h(0.9) = 0.000457247
|
||||
u_h(0.914286) = 0.00137174
|
||||
u_h(0.928571) = 0.00411523
|
||||
u_h(0.942857) = 0.0123457
|
||||
u_h(0.957143) = 0.037037
|
||||
u_h(0.971429) = 0.111111
|
||||
u_h(0.985714) = 0.333333
|
||||
u_h(1) = 1
|
||||
BIN
sheet4/C/plot.png
Normal file
BIN
sheet4/C/plot.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 49 KiB |
1826
sheet4/C/small_Doxyfile
Normal file
1826
sheet4/C/small_Doxyfile
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue