Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Plotting scripts git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk/doc@24259 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
- Loading branch information
Jan Silar
committed
Jan 28, 2015
1 parent
e961d21
commit 336a3e0
Showing
4 changed files
with
98 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,53 @@ | ||
%fileName = "eulerTests.Riemann1V_res.mat"; | ||
fileName = "conservationLaws.advection_res.mat"; | ||
%fileName = "eulerTests.Riemann1V"; | ||
%fileName = "conservationLaws.advectionCos"; | ||
fileName = "conservationLaws.advectionStep"; | ||
varName = "u["; | ||
load(fileName); | ||
xName = "x["; | ||
exactSol = str2func(strrep(fileName,'.','_')); | ||
load([fileName "_res.mat"]); | ||
nameT = transpose(name); | ||
indexes = []; | ||
indexesV = []; | ||
indexesX = []; | ||
for i = 1:size(name,2) | ||
if isequal(varName,nameT(i,1:size(varName,2))) | ||
indexes = [indexes i]; | ||
indexesV = [indexesV i]; | ||
end; | ||
if isequal(xName,nameT(i,1:size(xName,2))) | ||
indexesX = [indexesX i]; | ||
end; | ||
end; | ||
if size(indexesV) != size(indexesX) | ||
error("different sizes of X and variable") | ||
end; | ||
size(dataInfo); | ||
ar = dataInfo(1,indexesX) != 1; | ||
if ar | ||
error("some X isnt in data_1") | ||
end; | ||
ar = dataInfo(1,indexesV) != 2; | ||
if ar | ||
error("some var isnt in data_2") | ||
end; | ||
indexesX1 = dataInfo(2,indexesX); | ||
indexesV1 = dataInfo(2,indexesV); | ||
size(data_1) | ||
X = data_1(indexesX1,1); | ||
nSteps = size(data_2,2) | ||
nPlots = 10; | ||
nPlots = 5; | ||
h = figure(); | ||
|
||
|
||
|
||
for i = 1:nPlots | ||
nFrame = round(1 + (nSteps-1)/(nPlots-1)*(i-1) ) | ||
var = data_2(indexes,nFrame); | ||
plot(var); | ||
pause(1); | ||
nFrame = round(1 + (nSteps-1)/(nPlots-1)*(i-1) ) ; | ||
time = data_2(1,nFrame); | ||
var = data_2(indexesV,nFrame); | ||
varE = feval(exactSol,time,X); | ||
plot(X,var,X,varE); | ||
pause(0.1); | ||
end; | ||
saveas(h,[fileName ".png"],"png"); | ||
m = max(varE); | ||
err = sum(abs((varE - var)./max(m/100,varE).*(varE>m/100))) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,12 @@ | ||
fileName = "conservationLaws.Riemann1_res.mat"; | ||
%fileName = "conservationLaws.advection_res.mat"; | ||
varName = "rho"; | ||
%fileName = "eulerTests.Riemann1_res.mat"; | ||
%fileName = "conservationLaws.Riemann1_res.mat"; | ||
fileName = "conservationLaws.advection_res.mat"; | ||
varName = "u"; | ||
[nameT, data_2, N] = openMat(fileName); | ||
nPlots = 10; | ||
for i = 1:nPlots | ||
nFrame = round(1 + (N-1)/(nPlots-1)*(i-1) ) ; | ||
getTimeMat(nFrame, nameT, data_2) | ||
plot(getVarMat(varName, nFrame, nameT, data_2)); | ||
pause(1); | ||
pause(0.2); | ||
end; |