JaRMoS  1.1
Java Reduced Model Simulations
 All Classes Namespaces Files Functions Variables Enumerator Groups Pages
QNTransientRBSystem.java
Go to the documentation of this file.
1 package rb;
2 
3 import jarmos.Log;
5 
6 import java.io.BufferedReader;
7 import java.io.IOException;
8 import java.lang.reflect.InvocationTargetException;
9 import java.lang.reflect.Method;
10 
11 import org.apache.commons.math.linear.Array2DRowRealMatrix;
12 import org.apache.commons.math.linear.ArrayRealVector;
13 import org.apache.commons.math.linear.DecompositionSolver;
14 import org.apache.commons.math.linear.LUDecompositionImpl;
15 import org.apache.commons.math.linear.RealMatrix;
16 import org.apache.commons.math.linear.RealVector;
17 
29 public class QNTransientRBSystem extends TransientRBSystem {
30 
31  // Logging tag
32  private static final String DEBUG_TAG = "QNTransientRBSystem";
33 
34  // The tolerance for the Newton solver
35  private double nonlinear_tolerance;
36 
37  // The maximum number of Newton iterations
38  private int n_newton_steps;
39 
40  // The nominal lower bound for the stability factor
41  private double nominal_rho_min;
42  private double nominal_rho_max;
43 
44  // The RB data for the trilinear form
45  protected double[][][] RB_trilinear_form;
46 
50  double[][][] Fq_C_representor_norms;
51  double[][][][] Mq_C_representor_norms;
52  double[][][][] Aq_C_representor_norms;
53  double[][][][] C_C_representor_norms;
54 
58  private double tau_prod_k;
59 
60  // Private member that we need in calling the SCM
61  private int _N_in_RB_solve;
62 
69  @Override
70  public double RB_solve(int N) {
71 
72  current_N = N;
73  _N_in_RB_solve = N;
74 
75  // Initialize tau_prod_k
76  tau_prod_k = 1.;
77 
78  if (N > getNBF()) {
79  throw new RuntimeException("ERROR: N cannot be larger than the number " + "of basis functions in RB_solve");
80  }
81  if (N == 0) {
82  throw new RuntimeException("ERROR: N must be greater than 0 in RB_solve");
83  }
84 
85  double dt = getdt();
86 
87  // First assemble the mass matrix
88  RealMatrix RB_mass_matrix_N = new Array2DRowRealMatrix(N, N);
89  for (int q_m = 0; q_m < getQm(); q_m++) {
90  RB_mass_matrix_N = RB_mass_matrix_N.add(RB_M_q_matrix[q_m].getSubMatrix(0, N - 1, 0, N - 1).scalarMultiply(
91  thetaQm(q_m)));
92  }
93 
94  RealMatrix RB_RHS_Aq_matrix = new Array2DRowRealMatrix(N, N);
95 
96  RealMatrix Base_RB_LHS_matrix = RB_mass_matrix_N.scalarMultiply(1. / dt);
97 
98  for (int q_a = 0; q_a < getQa(); q_a++) {
99  double cached_theta_q_a = thetaQa(q_a);
100  Base_RB_LHS_matrix = Base_RB_LHS_matrix.add(RB_A_q_vector[q_a].getSubMatrix(0, N - 1, 0, N - 1)
101  .scalarMultiply(getEulerTheta() * cached_theta_q_a));
102  RB_RHS_Aq_matrix = RB_RHS_Aq_matrix.add(RB_A_q_vector[q_a].getSubMatrix(0, N - 1, 0, N - 1).scalarMultiply(
103  -cached_theta_q_a));
104  }
105 
106  // Set system time level to 0
107  setTimeStep(0);
108 
109  // Initialize a vector to store our current Newton iterate
110  RealVector RB_u_bar = new ArrayRealVector(N);
111 
112  // and load the _k=0 data
113  RB_solution = RB_u_bar;
114  timestepRBSolutions[timestep] = RB_u_bar; // Should use .copy()
115  // here!
116 
117  double error_bound_sum = 0.;
118 
119  // Set error bound at _k=0
120  error_bound_all_k[timestep] = Math.sqrt(error_bound_sum);
121 
122  // Compute the outputs and associated error bounds at _k=0
123  for (int i = 0; i < getNumOutputs(); i++) {
124  RB_outputs_all_k[i][timestep] = 0.;
126  for (int q_l = 0; q_l < getQl(i); q_l++) {
127  RB_outputs_all_k[i][timestep] += thetaQl(i, q_l, 0)
128  * (RB_output_vectors[i][q_l].getSubVector(0, N).dotProduct(RB_solution));
129  }
131  }
132 
133  // Initialize a vector to store the solution from the old time-step
134  RealVector RB_u_old = new ArrayRealVector(N);
135 
136  // Initialize a vector to store the Newton increment, RB_delta_u
137  RealVector RB_delta_u = new ArrayRealVector(N);
138 
139  // Pre-compute eval_theta_c()
140  double cached_theta_c = eval_theta_c();
141 
142  for (int time_level = 1; time_level <= fTotalTimesteps; time_level++) {
143 
144  double t = time_level * getdt();
145 
146  setTimeStep(time_level); // update the member variable _k
147 
148  // Set RB_u_old to be the result of the previous Newton loop
149  RB_u_old = RB_u_bar.copy();
150 
151  // Now we begin the nonlinear loop
152  for (int l = 0; l < n_newton_steps; ++l) {
153  // Get u_euler_theta = euler_theta*RB_u_bar +
154  // (1-euler_theta)*RB_u_old
155  RealVector RB_u_euler_theta = RB_u_bar.mapMultiply(getEulerTheta()).add(
156  RB_u_old.mapMultiply(1. - getEulerTheta()));
157 
158  // Assemble the left-hand side for the RB linear system
159  RealMatrix RB_LHS_matrix = Base_RB_LHS_matrix.copy();
160 
161  // Add the trilinear term
162  for (int i = 0; i < N; i++) {
163  for (int j = 0; j < N; j++) {
164  double new_entry = RB_LHS_matrix.getEntry(i, j);
165  for (int n = 0; n < N; n++) {
166  new_entry += cached_theta_c * getEulerTheta() * RB_u_euler_theta.getEntry(n)
167  * (RB_trilinear_form[n][i][j] + RB_trilinear_form[j][i][n]);
168  }
169  RB_LHS_matrix.setEntry(i, j, new_entry);
170  }
171  }
172 
173  // Assemble the right-hand side for the RB linear system (the
174  // residual)
175  // First add forcing terms
176  RealVector RB_rhs = new ArrayRealVector(N);
177 
178  for (int q_f = 0; q_f < getQf(); q_f++) {
179  RB_rhs = RB_rhs.add(RB_F_q_vector[q_f].getSubVector(0, N).mapMultiply(thetaQf(q_f)));
180  }
181 
182  // Now add -1./dt * M * (RB_u_bar - RB_u_old)
183  RB_rhs = RB_rhs.add(RB_mass_matrix_N.operate(RB_u_bar).mapMultiply(-1. / dt));
184  RB_rhs = RB_rhs.add(RB_mass_matrix_N.operate(RB_u_old).mapMultiply(1. / dt));
185 
186  // Now add the Aq stuff
187  RB_rhs = RB_rhs.add(RB_RHS_Aq_matrix.operate(RB_u_euler_theta));
188 
189  // Finally add the trilinear term
190  for (int i = 0; i < N; i++) {
191  double new_entry = RB_rhs.getEntry(i);
192 
193  for (int j = 0; j < N; j++) {
194  double RB_u_euler_theta_j = RB_u_euler_theta.getEntry(j);
195 
196  for (int n = 0; n < N; n++) {
197  new_entry -= cached_theta_c * RB_u_euler_theta.getEntry(n) * RB_u_euler_theta_j
198  * RB_trilinear_form[n][i][j];
199  }
200  }
201  RB_rhs.setEntry(i, new_entry);
202  }
203 
204  DecompositionSolver solver = new LUDecompositionImpl(RB_LHS_matrix).getSolver();
205  RB_delta_u = solver.solve(RB_rhs);
206 
207  // update the Newton iterate
208  RB_u_bar = RB_u_bar.add(RB_delta_u);
209 
210  // Compute the l2 norm of RB_delta_u
211  double RB_delta_u_norm = RB_delta_u.getNorm();
212 
213  if (RB_delta_u_norm < nonlinear_tolerance) {
214  break;
215  }
216 
217  if ((l == (n_newton_steps - 1)) && (RB_delta_u_norm > nonlinear_tolerance)) {
218  throw new RuntimeException("RB Newton loop did not converge");
219  }
220  }
221 
222  // Load RB_solution into RB_solution_vector for residual computation
223  RB_solution = RB_u_bar;
224  old_RB_solution = RB_u_old;
225  timestepRBSolutions[timestep] = RB_u_bar; // should use copy
226  // here!
227 
228  double rho_LB = (mRbScmSystem == null) ? get_nominal_rho_LB() : get_SCM_lower_bound();
229 
230  // Evaluate the dual norm of the residual for RB_solution_vector
231  double epsilon_N = compute_residual_dual_norm(N);
232 
233  error_bound_sum += residual_scaling_numer(rho_LB) * Math.pow(epsilon_N, 2.);
234 
235  // store error bound at time-level _k
236  error_bound_all_k[timestep] = Math.sqrt(error_bound_sum / residual_scaling_denom(rho_LB));
237 
238  // Now compute the outputs and associated error bounds
239  for (int i = 0; i < getNumOutputs(); i++) {
240  RB_outputs_all_k[i][timestep] = 0.;
242  for (int q_l = 0; q_l < getQl(i); q_l++) {
243  RB_outputs_all_k[i][timestep] += thetaQl(i, q_l)
244  * (RB_output_vectors[i][q_l].getSubVector(0, N).dotProduct(RB_solution));
245  }
248  }
249  Log.d(DEBUG_TAG, "output = " + RB_outputs_all_k[0][timestep] + ", bound="
251  }
252 
253  // Now compute the L2 norm of the RB solution at time-level _K
254  // to normalize the error bound
255  // We reuse RB_rhs here
256  double final_RB_L2_norm = Math.sqrt(RB_mass_matrix_N.operate(RB_solution).dotProduct(RB_solution));
257 
258  return (return_rel_error_bound ? error_bound_all_k[fTotalTimesteps] / final_RB_L2_norm
260  }
261 
265  @Override
266  protected double residual_scaling_numer(double rho_LB) {
267  double tau_LB = (0.5 * rho_LB < 0.) ? 0.5 * rho_LB : 0.;
268 
269  return getdt() * tau_prod_k / (1. - tau_LB * getdt());
270  }
271 
275  @Override
276  protected double residual_scaling_denom(double rho_LB) {
277  double tau_LB = (0.5 * rho_LB < 0.) ? 0.5 * rho_LB : 0.;
278 
279  // Update tau_prod_k
280  tau_prod_k *= (1. + tau_LB * getdt()) / (1. - tau_LB * getdt());
281 
282  // and return it
283  return tau_prod_k;
284  }
285 
289  public void set_nonlinear_tolerance(double nonlinear_tolerance_in) {
290  nonlinear_tolerance = nonlinear_tolerance_in;
291  }
292 
296  public double get_nonlinear_tolerance() {
297  return nonlinear_tolerance;
298  }
299 
303  public void set_n_newton_steps(int n_newton_steps_in) {
304  n_newton_steps = n_newton_steps_in;
305  }
306 
310  public int get_n_newton_steps() {
311  return n_newton_steps;
312  }
313 
317  public double eval_theta_c() {
318 
319  Method meth;
320 
321  try {
322  Class<?> partypes[] = new Class[1];
323  partypes[0] = double[].class;
324 
325  meth = oldAffFcnCl.getMethod("evaluateC", partypes);
326  } catch (NoSuchMethodException nsme) {
327  throw new RuntimeException("getMethod for evaluateC failed", nsme);
328  }
329 
330  Double theta_val;
331  try {
332  Object arglist[] = new Object[1];
333  arglist[0] = getParams().getCurrent();
334 
335  Object theta_obj = meth.invoke(oldAffFcnObj, arglist);
336  theta_val = (Double) theta_obj;
337  } catch (IllegalAccessException iae) {
338  throw new RuntimeException(iae);
339  } catch (InvocationTargetException ite) {
340  throw new RuntimeException(ite.getCause());
341  }
342 
343  return theta_val.doubleValue();
344  }
345 
349  @Override
350  protected double compute_residual_dual_norm(int N) {
351  // Use the stored representor inner product values
352  // to evaluate the residual dual norm
353  double dt = getdt();
354 
355  double residual_norm_sq = 0.;
356 
357  // Use TransientRBSystem to compute all the linear terms
358  residual_norm_sq += Math.pow(super.uncached_compute_residual_dual_norm(N), 2.);
359 
360  // Now just need to add the terms involving the nonlinearity
361  RealVector RB_u_euler_theta = RB_solution.mapMultiply(getEulerTheta()).add(
362  old_RB_solution.mapMultiply(1. - getEulerTheta()));
363  RealVector mass_coeffs = RB_solution.subtract(old_RB_solution).mapMultiply(-1. / dt);
364 
365  // Pre-compute eval_theta_c()
366  double cached_theta_c = eval_theta_c();
367 
368  // All residual terms can be treated as positive quantities...
369  for (int q_f = 0; q_f < getQf(); q_f++) {
370  double cached_theta_q_f = thetaQf(q_f);
371  for (int n1 = 0; n1 < N; n1++) {
372  for (int j1 = 0; j1 < N; j1++) {
373  residual_norm_sq += 2. * cached_theta_q_f * cached_theta_c * RB_u_euler_theta.getEntry(n1)
374  * RB_u_euler_theta.getEntry(j1) * Fq_C_representor_norms[q_f][n1][j1];
375  }
376  }
377  }
378 
379  for (int q_m = 0; q_m < getQm(); q_m++) {
380  double cached_theta_q_m = thetaQm(q_m);
381  for (int i = 0; i < N; i++) {
382  for (int n1 = 0; n1 < N; n1++) {
383  for (int j1 = 0; j1 < N; j1++) {
384  residual_norm_sq += 2. * cached_theta_q_m * cached_theta_c * mass_coeffs.getEntry(i)
385  * RB_u_euler_theta.getEntry(n1) * RB_u_euler_theta.getEntry(j1)
386  * Mq_C_representor_norms[q_m][i][n1][j1];
387  }
388  }
389  }
390  }
391 
392  for (int q_a = 0; q_a < getQa(); q_a++) {
393  double cached_theta_q_a = thetaQa(q_a);
394  for (int i = 0; i < N; i++) {
395  for (int n1 = 0; n1 < N; n1++) {
396  for (int j1 = 0; j1 < N; j1++) {
397  residual_norm_sq += 2. * cached_theta_q_a * cached_theta_c * RB_u_euler_theta.getEntry(i)
398  * RB_u_euler_theta.getEntry(n1) * RB_u_euler_theta.getEntry(j1)
399  * Aq_C_representor_norms[q_a][i][n1][j1];
400  }
401  }
402  }
403  }
404 
405  for (int n1 = 0; n1 < N; n1++) {
406  for (int j1 = 0; j1 < N; j1++) {
407  double RB_u_euler_theta_1 = RB_u_euler_theta.getEntry(n1) * RB_u_euler_theta.getEntry(j1);
408 
409  for (int n2 = n1; n2 < N; n2++) {
410  int init_j2_index = (n2 == n1) ? j1 : 0;
411  for (int j2 = init_j2_index; j2 < N; j2++) {
412  double RB_u_euler_theta_2 = RB_u_euler_theta.getEntry(n2) * RB_u_euler_theta.getEntry(j2);
413 
414  double delta = ((n2 == n1) && (j2 == j1)) ? 1. : 2.;
415 
416  residual_norm_sq += delta * cached_theta_c * cached_theta_c * RB_u_euler_theta_1
417  * RB_u_euler_theta_2 * C_C_representor_norms[n1][j1][n2][j2];
418  }
419  }
420 
421  }
422  }
423 
424  if (residual_norm_sq < 0) {
425  // Sometimes this is negative due to rounding error,
426  // but this error shouldn't affect the error bound
427  // too much...
428  residual_norm_sq = Math.abs(residual_norm_sq);
429  }
430 
431  return Math.sqrt(residual_norm_sq);
432  }
433 
434  // Get/set the nominal rho min/max values, we typically read these
435  // in from the input file
436  public void set_nominal_rho_min(double nominal_rho_LB_in) {
437  nominal_rho_min = nominal_rho_LB_in;
438  }
439 
440  public void set_nominal_rho_max(double nominal_rho_LB_in) {
441  nominal_rho_max = nominal_rho_LB_in;
442  }
443 
444  public double get_nominal_rho_min() {
445  return nominal_rho_min;
446  }
447 
448  public double get_nominal_rho_max() {
449  return nominal_rho_max;
450  }
451 
455  public double get_nominal_rho_LB() {
456  double mu_min = getParams().getMinValue(0);
457  double mu_max = getParams().getMaxValue(0);
458  double current_mu = getParams().getCurrent()[0];
459  return (nominal_rho_max * (mu_max - current_mu) + nominal_rho_min * (current_mu - mu_min)) / (mu_max - mu_min);
460  }
461 
465  public double get_SCM_lower_bound() {
466 
467  if (mRbScmSystem != null) {
468  // Cast to a QNTransientSCMSystem
470 
471  // Tell the SCM system the number of basis functions
472  qnScmSystem.set_n_basis_functions(_N_in_RB_solve);
473 
474  // Create a parameter vector in which the current time-level
475  // is appended to current_parameters.
476  int np = getParams().getNumParams();
477  double[] params = new double[np + 1];
478  for (int i = 0; i < np; i++) {
479  params[i] = getParams().getCurrent()[i];
480  }
481  params[np] = timestep;
482 
483  // Set the parameter
484  qnScmSystem.sys.getParams().setCurrent(params);
485 
486  // Also, construct a vector storing the RB coefficients
487  RealVector RB_u_euler_theta = RB_solution.mapMultiply(getEulerTheta()).add(
488  old_RB_solution.mapMultiply(1. - getEulerTheta()));
489 
490  // Pass params and RB_u_euler_theta to the associated SCM system
491  qnScmSystem.set_current_RB_coeffs(RB_u_euler_theta);
492 
493  return mRbScmSystem.get_SCM_LB();
494  } else {
496  }
497  }
498 
503  @Override
504  public void readConfigurationRBAppMIT(GetPot infile) {
505  super.readConfigurationRBAppMIT(infile);
506 
507  double nonlinear_tolerance_in = infile.call("nonlinear_tolerance", 1.e-8);
508  set_nonlinear_tolerance(nonlinear_tolerance_in);
509 
510  int n_newton_steps_in = infile.call("n_newton_steps", 15);
511  set_n_newton_steps(n_newton_steps_in);
512 
513  double nominal_rho_min_in = infile.call("nominal_rho_min", 0);
514  set_nominal_rho_min(nominal_rho_min_in);
515 
516  double nominal_rho_max_in = infile.call("nominal_rho_max", 0);
517  set_nominal_rho_max(nominal_rho_max_in);
518 
519  Log.d(DEBUG_TAG, "QNTransientRBSystem parameters from " + Const.parameters_filename + ":");
520  Log.d(DEBUG_TAG, "Tolerance for Newton's method: " + get_nonlinear_tolerance());
521  Log.d(DEBUG_TAG, "Max number of Newton steps: " + get_n_newton_steps());
522  Log.d(DEBUG_TAG, "Nominal rho min: " + get_nominal_rho_min());
523  Log.d(DEBUG_TAG, "Nominal rho max: " + get_nominal_rho_max());
524  }
525 
529  @Override
530  public void loadOfflineData_rbappmit(AModelManager m) throws IOException {
531 
532  super.loadOfflineData_rbappmit(m);
533 
534  int n_bfs = getNBF();
535 
536  // Read in the trlinear form
537 
538  {
539  Log.d(DEBUG_TAG, "Starting read RB_trilinear_form.dat");
540 
541  String[] tokens;
542  {
543  BufferedReader reader = m.getBufReader("RB_trilinear_form.dat");
544 
545  String line = reader.readLine();
546  reader.close();
547  tokens = line.split(" ");
548  }
549 
550  // Set the size of the inner product matrix
551  RB_trilinear_form = new double[n_bfs][n_bfs][n_bfs];
552 
553  // Fill the array
554  int count = 0;
555  for (int i = 0; i < n_bfs; i++) {
556  for (int j = 0; j < n_bfs; j++) {
557  for (int l = 0; l < n_bfs; l++) {
558  RB_trilinear_form[i][j][l] = Double.parseDouble(tokens[count]);
559  count++;
560  }
561  }
562  }
563 
564  Log.d(DEBUG_TAG, "Finished reading RB_trilinear_form.dat");
565  }
566 
567  // Read in Fq_C representor norm data
568  {
569  String[] tokens;
570 
571  {
572  BufferedReader reader = m.getBufReader("Fq_C_norms.dat");
573  String line = reader.readLine();
574  reader.close();
575  tokens = line.split(" ");
576  }
577 
578  // Declare the array
579  Fq_C_representor_norms = new double[getQf()][n_bfs][n_bfs];
580 
581  // Fill it
582  int count = 0;
583  for (int q_f = 0; q_f < getQf(); q_f++)
584  for (int i = 0; i < n_bfs; i++) {
585  for (int j = 0; j < n_bfs; j++) {
586  Fq_C_representor_norms[q_f][i][j] = Double.parseDouble(tokens[count]);
587  count++;
588  }
589  }
590 
591  Log.d(DEBUG_TAG, "Finished reading Fq_C_norms.dat");
592  }
593 
594  // Read in M_M representor norm data
595  {
596  String[] tokens;
597  {
598  BufferedReader reader = m.getBufReader("Mq_C_norms.dat");
599 
600  tokens = reader.readLine().split(" ");
601  reader.close();
602  }
603 
604  // Declare the array
605  Mq_C_representor_norms = new double[getQm()][n_bfs][n_bfs][n_bfs];
606 
607  // Fill it
608  int count = 0;
609  for (int q_m = 0; q_m < getQm(); q_m++)
610  for (int i = 0; i < n_bfs; i++)
611  for (int j = 0; j < n_bfs; j++) {
612  for (int k = 0; k < n_bfs; k++) {
613  Mq_C_representor_norms[q_m][i][j][k] = Double.parseDouble(tokens[count]);
614  count++;
615  }
616  }
617 
618  Log.d(DEBUG_TAG, "Finished reading Mq_C_norms.dat");
619  }
620 
621  // Read in Aq_C representor norm data
622  {
623  BufferedReader reader = m.getBufReader("Aq_C_norms.dat");
624 
625  String[] tokens = reader.readLine().split(" ");
626  reader.close();
627  reader = null;
628 
629  // Declare the array
630  Aq_C_representor_norms = new double[getQa()][n_bfs][n_bfs][n_bfs];
631 
632  // Fill it
633  int count = 0;
634  for (int q_a = 0; q_a < getQa(); q_a++) {
635  for (int i = 0; i < n_bfs; i++) {
636  for (int n1 = 0; n1 < n_bfs; n1++) {
637  for (int j1 = 0; j1 < n_bfs; j1++) {
638  Aq_C_representor_norms[q_a][i][n1][j1] = Double.parseDouble(tokens[count]);
639  count++;
640  }
641  }
642  }
643  }
644  Log.d(DEBUG_TAG, "Finished reading Aq_C_norms.dat");
645  }
646 
647  // Read in C_C representor norm data
648  {
649  BufferedReader reader = m.getBufReader("C_C_norms.dat");
650 
651  String[] tokens = reader.readLine().split(" ");
652  reader.close();
653  reader = null;
654 
655  // Declare the array
656  C_C_representor_norms = new double[n_bfs][n_bfs][n_bfs][n_bfs];
657 
658  // Fill it
659  int count = 0;
660  for (int ii = 0; ii < n_bfs; ii++) {
661  for (int i = 0; i < n_bfs; i++) {
662  for (int n1 = 0; n1 < n_bfs; n1++) {
663  for (int j1 = 0; j1 < n_bfs; j1++) {
664  C_C_representor_norms[ii][i][n1][j1] = Double.parseDouble(tokens[count]);
665  count++;
666  }
667  }
668  }
669  }
670  Log.d(DEBUG_TAG, "Finished reading C_C_norms.dat");
671  }
672  }
673 }
int getNumOutputs()
Definition: RBSystem.java:612
double compute_output_dual_norm(int i, double t)
Compute the dual norm of the i^th output function at the current parameter value. ...
Definition: RBSystem.java:402
Base class for quadratically nonlinear RB systems including the SCM method for error bound computatio...
Utility helper class from rbAppMIT included for compatibility of rbAppMIT model loading.
Definition: GetPot.java:31
double compute_residual_dual_norm(int N)
Compute the dual norm of the residual for the solution saved in RB_solution_vector.
int current_N
Definition: RBSystem.java:80
double[][][] Fq_C_representor_norms
Vectors storing the residual representor inner products to be used in computing the residuals online...
This class provides the Online reduced basis functionality for linear parabolic problems.
double[][][][] C_C_representor_norms
void set_nominal_rho_min(double nominal_rho_LB_in)
int timestep
The current time-level, 0 &lt;= _k &lt;= _K.
void set_nonlinear_tolerance(double nonlinear_tolerance_in)
Set the nonlinear tolerance for Newton&#39;s method for both the truth and RB solves. ...
Parameters getParams()
Returns the system&#39;s parameters object.
Definition: RBSystem.java:621
double thetaQl(int k, int i)
Definition: RBSystem.java:1720
void loadOfflineData_rbappmit(AModelManager m)
Override read_offline_data_from_files in order to read in the data for the nonlinear problem...
boolean return_rel_error_bound
Boolean flag to indicate whether RB_solve returns an absolute or relative error bound.
Definition: RBSystem.java:209
double get_SCM_from_AffineFunction()
A private helper function to get the SCM from AffineFunctions in the case that SCM_TYPE = NONE...
Definition: RBSystem.java:518
double thetaQa(int q)
Evaluate theta_q_a (for the q^th bilinear form) at the current parameter.
Definition: RBSystem.java:1681
RealVector old_RB_solution
RBSystem has a member RB_solution, we also need old_RB_solution here.
double thetaQf(int i)
Definition: RBSystem.java:1700
This class serves as base class for accessing various types of models at different locations...
double residual_scaling_denom(double rho_LB)
Override appropriate for quadratically nonlinear error bounds.
RealMatrix[] RB_M_q_matrix
Dense matrices for the RB computations.
double[][][][] Aq_C_representor_norms
RealVector[] timestepRBSolutions
The solution coefficients at each time level from the most recent RB_solve.
int getQf()
TODO: if all affine_functions implement the IAffineFunctions interface, just call the getQf method of...
Definition: RBSystem.java:638
double residual_scaling_numer(double rho_LB)
Override appropriate for quadratically nonlinear error bounds.
Object oldAffFcnObj
Definition: RBSystem.java:144
double get_nominal_rho_LB()
Get the nominal stability factor lower bound.
RealVector RB_solution
The RB solution vector.
Definition: RBSystem.java:201
double getEulerTheta()
Get/set euler_theta, parameter that determines the temporal discretization.
double getdt()
Gets dt, the time-step size.
Provides a Log class imitating the Android Log class when not used on android systems.
Definition: Log.java:11
int get_n_newton_steps()
Set the maximum number of Newton steps for both the truth and RB solves.
double eval_theta_c()
Evaluate theta_c (for the quadratic nonlinearity) at the current parameter.
double[][] RB_output_error_bounds_all_k
The output error bounds at all time levels.
Definition: RBSystem.java:183
double get_nonlinear_tolerance()
Get the nonlinear tolerance for Newton&#39;s method.
RealMatrix[] RB_A_q_vector
Dense matrices for the RB computations.
Definition: RBSystem.java:163
double[][] RB_outputs_all_k
The outputs at all time levels.
Definition: RBSystem.java:197
int getQa()
Definition: RBSystem.java:628
RealVector[][] RB_output_vectors
The vectors storing the RB output vectors.
Definition: RBSystem.java:187
double RB_solve(int N)
Perform online solve for current_params with the N basis functions.
double[] error_bound_all_k
The error bound for the field variable at each time level.
RealVector[] RB_F_q_vector
Dense vector for the RHS.
Definition: RBSystem.java:168
void set_nominal_rho_max(double nominal_rho_LB_in)
double thetaQm(int i)
Evaluate theta_q_m (for the q^th mass matrix term) at the current parameter.
void readConfigurationRBAppMIT(GetPot infile)
int getNBF()
Definition: RBSystem.java:605
RBSCMSystem mRbScmSystem
A reference to the SCM system.
Definition: RBSystem.java:124
double[][][][] Mq_C_representor_norms
void set_n_newton_steps(int n_newton_steps_in)
Set the maximum number of Newton steps for both the truth and RB solves.
int getQl(int output_index)
TODO: if all affine_functions implement the IAffineFunctions interface, just call the getQl method of...
Definition: RBSystem.java:650
int fTotalTimesteps
Total number of time-steps.
This class provides the Online reduced basis functionality for quadratically nonlinear time-dependent...