Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added testcase for splitting generated code
- Loading branch information
1 parent
ffd20b2
commit 04ae07a
Showing
5 changed files
with
140 additions
and
4 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
50 changes: 50 additions & 0 deletions
50
simulation/libraries/3rdParty/ScalableTestSuite/Advection_N3200.mo
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 |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package Modelica "Modelica Standard Library - Version 3.2.1 (Build 4)" | ||
extends Modelica.Icons.Package; | ||
|
||
package Icons "Library of icons" | ||
extends Icons.Package; | ||
|
||
partial package ExamplesPackage "Icon for packages containing runnable examples" | ||
extends Modelica.Icons.Package; | ||
end ExamplesPackage; | ||
|
||
partial package Package "Icon for standard packages" end Package; | ||
end Icons; | ||
annotation(version = "3.2.1", versionBuild = 4, versionDate = "2013-08-14", dateModified = "2015-09-30 09:15:00Z"); | ||
end Modelica; | ||
|
||
package ScalableTestSuite "A library of scalable Modelica test models" | ||
package Thermal "Models from the thermal domain" | ||
package Advection "1D advection models" | ||
package Models | ||
model AdvectionReaction "Model of an advection process with chemical reaction" | ||
parameter Integer N = 10 "Number of volumes"; | ||
parameter Real mu = 1000 "Kinetic coefficient of the reaction"; | ||
constant Real alpha = 0.5 "Parameter of the reaction model"; | ||
Real u_in = 1 "Inlet concentration"; | ||
Real[N] u(each start = 0, each fixed = true) "Concentration at each volume outlet"; | ||
equation | ||
der(u[1]) = ((-u[1]) + 1) * N - mu * u[1] * (u[1] - alpha) * (u[1] - 1); | ||
for j in 2:N loop | ||
der(u[j]) = ((-u[j]) + u[j - 1]) * N - mu * u[j] * (u[j] - alpha) * (u[j] - 1); | ||
end for; | ||
end AdvectionReaction; | ||
end Models; | ||
|
||
package ScaledExperiments | ||
extends Modelica.Icons.ExamplesPackage; | ||
|
||
model AdvectionReaction_N_3200 | ||
extends Models.AdvectionReaction(N = 3200, mu = 16000); | ||
annotation(experiment(StopTime = 1, NumberOfIntervals = 5000, Tolerance = 1e-6)); | ||
end AdvectionReaction_N_3200; | ||
end ScaledExperiments; | ||
end Advection; | ||
end Thermal; | ||
annotation(version = "1.7.1"); | ||
end ScalableTestSuite; | ||
|
||
model AdvectionReaction_N_3200_total | ||
extends ScalableTestSuite.Thermal.Advection.ScaledExperiments.AdvectionReaction_N_3200; | ||
annotation(experiment(StopTime = 1, NumberOfIntervals = 5000, Tolerance = 1e-6)); | ||
end AdvectionReaction_N_3200_total; |
32 changes: 32 additions & 0 deletions
32
simulation/libraries/3rdParty/ScalableTestSuite/Advection_N3200.mos
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 |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// status: correct | ||
// This is a test for equationsPerFile compiling as it should | ||
|
||
loadFile("Advection_N3200.mo");getErrorString(); | ||
|
||
setCommandLineOptions("--daeMode=dynamic -d=nogen"); | ||
extraSimFlags := "-mei=4000 -daeMode -s=ida -idaLS=klu --equationsPerFile=200"; | ||
setCFlags(getCFlags() + " -Os"); | ||
|
||
file := "AdvectionReaction_N_3200_total_06inz_part2.c"; | ||
if regularFileExists(file) then | ||
print("Files not cleaned up properly: " + file); | ||
end if; | ||
translateModel(AdvectionReaction_N_3200_total);getErrorString(); | ||
if not regularFileExists(file) then | ||
print("Files not created properly: " + file); | ||
else | ||
print("OK"); | ||
end if; | ||
|
||
// Result: | ||
// true | ||
// "" | ||
// true | ||
// "-mei=4000 -daeMode -s=ida -idaLS=klu --equationsPerFile=200" | ||
// true | ||
// "AdvectionReaction_N_3200_total_06inz_part2.c" | ||
// | ||
// true | ||
// "" | ||
// OK | ||
// endResult |
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 |
---|---|---|
@@ -0,0 +1,50 @@ | ||
TEST = ../../../../rtest -v | ||
|
||
TESTFILES = \ | ||
Advection_N3200.mos \ | ||
|
||
# test that currently fail. Move up when fixed. | ||
# Run make failingtest | ||
FAILINGTESTFILES = \ | ||
|
||
# Dependency files that are not .mo .mos or Makefile | ||
# Add them here or they will be cleaned. | ||
DEPENDENCIES = \ | ||
ReferenceFiles \ | ||
*.mo \ | ||
*.mos \ | ||
Makefile \ | ||
|
||
CLEAN = `ls | grep -w -v -f deps.tmp` | ||
|
||
.PHONY : test clean getdeps failingtest | ||
|
||
test: | ||
@echo | ||
@echo Running tests... | ||
@echo | ||
@echo OPENMODELICAHOME=" $(OPENMODELICAHOME) " | ||
@$(TEST) $(TESTFILES) | ||
|
||
# Cleans all files that are not listed as dependencies | ||
clean: | ||
@echo $(DEPENDENCIES) | sed 's/ /\\|/g' > deps.tmp | ||
@rm -f $(CLEAN) | ||
|
||
# Run this if you want to list out the files (dependencies). | ||
# do it after cleaning and updating the folder | ||
# then you can get a list of file names (which must be dependencies | ||
# since you got them from repository + your own new files) | ||
# then add them to the DEPENDENCIES. You can find the | ||
# list in deps.txt | ||
getdeps: | ||
@echo $(DEPENDENCIES) | sed 's/ /\\|/g' > deps.tmp | ||
@echo $(CLEAN) | sed -r 's/deps.txt|deps.tmp//g' | sed 's/ / \\\n/g' > deps.txt | ||
@echo Dependency list saved in deps.txt. | ||
@echo Copy the list from deps.txt and add it to the Makefile @DEPENDENCIES | ||
|
||
failingtest: | ||
@echo | ||
@echo Running failing tests... | ||
@echo | ||
@$(TEST) $(FAILINGTESTFILES) |
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