JaRMoS  1.1
Java Reduced Model Simulations
 All Classes Namespaces Files Functions Variables Enumerator Groups Pages
TestRBSolve.java
Go to the documentation of this file.
1 
4 package rb.test;
5 
6 import static org.junit.Assert.assertTrue;
7 import static org.junit.Assert.fail;
14 
15 import org.junit.Test;
16 
17 import rb.RBContainer;
18 import rb.RBSystem;
19 
25 public class TestRBSolve {
26 
30  // @Test
31  public void testRBSolveJRB() {
32  FileModelManager f = new FileModelManager("models");
33  try {
34  f.useModel("rbm_advec");
35  } catch (ModelManagerException e) {
36  e.printStackTrace();
37  fail(e.getMessage());
38  }
39 
40  RBContainer rb = new RBContainer();
41  assertTrue(rb.loadModel(f));
42 
43  // Perform the solve
44  RBSystem s = rb.mRbSystem;
45  // double[] par = s.getParams().getRandomParam();
46  double[] par = new double[] { .5, .5 };
47  s.getParams().setCurrent(par);
48  s.computeRBSolution(4);
49  }
50 
54  // @Test
55  public void testRBSolveJRB_TimeConst() {
56  FileModelManager f = new FileModelManager("models");
57  try {
58  f.useModel("rbm_advec");
59  } catch (ModelManagerException e) {
60  e.printStackTrace();
61  fail(e.getMessage());
62  }
63 
64  RBContainer rb = new RBContainer();
65  assertTrue(rb.loadModel(f));
66 
67  // Perform the solve
68  RBSystem s = rb.mRbSystem;
69  // double[] par = s.getParams().getRandomParam();
70  double[] par = new double[] { .5, .5, .5 };
71  s.getParams().setCurrent(par);
72  s.computeRBSolution(4);
73 
74  SimulationResult sol = s.getSimulationResults();
75 
76  GeometryData g = new GeometryData();
77  g.loadModelGeometry(f);
78  VisualizationData d = new VisualizationData(g);
79  d.useResult(sol);
80  d.computeVisualFeatures(new ColorGenerator());
81  }
82 
86  @Test
87  public void testRBSolverbappmit() {
88  FileModelManager f = new FileModelManager("models");
89  try {
90  f.useModel("demo3");
91  } catch (ModelManagerException e) {
92  e.printStackTrace();
93  fail(e.getMessage());
94  }
95 
96  RBContainer rb = new RBContainer();
97  assertTrue(rb.loadModel(f));
98 
99  // Perform the solve
100  RBSystem s = rb.mRbSystem;
101  double[] par = s.getParams().getRandomParam();
102  // double[] par = new double[]{.5, .5};
103  s.getParams().setCurrent(par);
104  s.computeRBSolution(s.getNBF() / 2);
105 
106  SimulationResult res = s.getSimulationResults();
107  GeometryData g = rb.mRbSystem.getGeometry();
108  VisualizationData v = new VisualizationData(g);
109  v.useResult(res);
110 
111  v.computeVisualFeatures(new ColorGenerator());
112  }
113 
114 }
This class provides the Online stage for the reduced basis method for elliptic steady state problems...
Definition: RBSystem.java:54
Represents the results of a simulation.
Manages models loaded from the file system available via the java.io classes.
Base class for RB models and systems.
A container class for all model visual data.
This Exception gets thrown when an error occurs regarding the functionality of the ModelManager...
This is a container class for all geometry-related data of a reduced model.
The color generator is used to produce RGBA (RGB+Alpha) values from a given array of floats...