JaRMoS  1.1
Java Reduced Model Simulations
 All Classes Namespaces Files Functions Variables Enumerator Groups Pages
AffineFunctions.java
Go to the documentation of this file.
1 package models.rbm_advec_tc;
2 
6 
15 
20  public double get_SCM_LB(double[] p) {
21  double p_min = p[0];
22 
23  for (int i = 1; i < p.length; i++) {
24  if (p[i] < p_min) {
25  p_min = p[i];
26  }
27  }
28 
29  return 1.;// p_min;
30  }
31 
32  // ///////////// Implementation of new IAffineFunctions interface
36  public int[] getQl() {
37  return new int[] { 1 };
38  }
39 
43  public int getQf() {
44  return 6;
45  }
46 
50  public int getQa() {
51  return 2;
52  }
53 
54  // ///////// Implementation of new ITransient interface
55 
59  public int getQm() {
60  return 1;
61  }
62 
66  @Override
67  public double thetaQm(int i, double[] p, double t) {
68  return 1.;
69  }
70 
74  @Override
75  public boolean isTimeDependentL() {
76  return false;
77  }
78 
82  @Override
83  public boolean isTimeDependentA() {
84  return false;
85  }
86 
90  @Override
91  public boolean isTimeDependentM() {
92  return false;
93  }
94 
98  @Override
99  public int getNumOutputs() {
100  return 1;
101  }
102 
106  @Override
107  public double thetaQl(int k, int i, double[] p, double t) {
108  if ((k < 0) || (k > getQl().length - 1)) {
109  throw new RuntimeException("Input parameter is invalid in evaluateL()," + " k = " + k
110  + " but get_n_outputs() = " + getQl());
111  }
112 
113  if ((i < 0) || (i > getQl()[i] - 1)) {
114  throw new RuntimeException("Input parameter is invalid in evaluateL()," + " q_l = " + i
115  + " but get_Q_l(i) = " + getQl()[i]);
116  }
117 
118  return 1;
119  }
120 
124  @Override
125  public double thetaQf(int i, double[] p, double t) {
126  if ((i < 0) || (i > getQf() - 1)) {
127  throw new RuntimeException("Input parameter is invalid in evaluateF()," + " i = " + i
128  + " but get_n_F_functions() = " + getQf());
129  }
130 
131  switch (i) {
132  case 0:
133  return 0;
134  case 1:
135  return 0;
136  case 2:
137  return p[0];
138  case 3:
139  return p[1];
140  case 4:
141  return 0;
142  case 5:
143  return 0;
144  default:
145  throw new Error("Should not reach here");
146  }
147  }
148 
152  @Override
153  public double thetaQa(int i, double[] p, double t) {
154  if ((i < 0) || (i > getQa() - 1)) {
155  throw new RuntimeException("Input parameter is invalid in evaluateA()," + " i = " + i
156  + " but get_n_A_functions() = " + getQa());
157  }
158 
159  switch (i) {
160  case 0:
161  return p[0];
162  case 1:
163  return p[1];
164  default:
165  throw new Error("Should not reach here");
166  }
167  }
168 
172  @Override
173  public int getQu0() {
174  return 3;
175  }
176 
180  @Override
181  public double thetaQu0(int i, double[] p) {
182  switch (i) {
183  case 0:
184  return 0;
185  case 1:
186  return 1;
187  case 2:
188  return 0;
189  default:
190  throw new Error("Should not reach here");
191  }
192  }
193 }
Affine coefficient functions for time-independent advection/diffusion problem.
Interface for AffineFunctions in unsteady rb systems.
Definition: ITransient.java:12
Base interface for any affine functions used as an externally loaded class.
double thetaQa(int i, double[] p, double t)
double thetaQu0(int i, double[] p)
double thetaQl(int k, int i, double[] p, double t)
double thetaQf(int i, double[] p, double t)
double thetaQm(int i, double[] p, double t)
Interface for affinely decomposed initial value conditions.