19 import java.io.BufferedReader;
20 import java.io.IOException;
21 import java.io.InputStream;
22 import java.lang.reflect.InvocationTargetException;
23 import java.lang.reflect.Method;
24 import java.util.ArrayList;
25 import java.util.Arrays;
26 import java.util.List;
28 import org.apache.commons.math.complex.Complex;
29 import org.apache.commons.math.linear.Array2DRowRealMatrix;
30 import org.apache.commons.math.linear.ArrayFieldVector;
31 import org.apache.commons.math.linear.ArrayRealVector;
32 import org.apache.commons.math.linear.DecompositionSolver;
33 import org.apache.commons.math.linear.FieldVector;
34 import org.apache.commons.math.linear.LUDecompositionImpl;
35 import org.apache.commons.math.linear.RealMatrix;
36 import org.apache.commons.math.linear.RealVector;
57 private static final String DEBUG_TAG =
"RBSystem";
62 private static final int MAX_SWEEP_POINTS = 10;
83 private int fNumOutputs;
110 private int fQuL = 0;
129 private double[][] mSweepParam;
134 private int numBasisFuncs;
158 private int[] Ql_values;
173 private RealVector[] RB_initial_coeffs;
211 private double sweepIncrement = 0;
213 private double[][] sweepOutputBounds;
214 private double[][] sweepOutputs;
216 private Method transformationMethod = null;
246 Class<?> partypes[] =
new Class[1];
247 partypes[0] =
double[].class;
249 meth = oldAffFcnCl.getMethod(
"evaluateA_array", partypes);
250 }
catch (NoSuchMethodException nsme) {
251 FieldVector<Complex> c =
new ArrayFieldVector<Complex>(fQa,
new Complex(0d, 0d));
252 for (
int i = 0; i < fQa; i++)
259 double[][] theta_val;
261 Object arglist[] =
new Object[1];
262 arglist[0] = params.getCurrent();
264 theta_val = (
double[][]) theta_obj;
265 }
catch (IllegalAccessException iae) {
266 throw new RuntimeException(iae);
267 }
catch (InvocationTargetException ite) {
268 throw new RuntimeException(ite.getCause());
270 FieldVector<Complex> c =
new ArrayFieldVector<Complex>(fQa,
new Complex(0d, 0d));
271 for (
int i = 0; i < fQa; i++)
272 c.setEntry(i,
new Complex(theta_val[i][0], theta_val[i][1]));
285 Class<?> partypes[] =
new Class[3];
286 partypes[0] = Integer.TYPE;
287 partypes[1] =
double[].class;
288 partypes[2] = boolean.class;
290 meth = oldAffFcnCl.getMethod(
"evaluateA", partypes);
291 }
catch (NoSuchMethodException nsme) {
292 throw new RuntimeException(
"getMethod for evaluateA failed", nsme);
295 Double theta_val_r, theta_val_i;
297 Object arglist[] =
new Object[3];
298 arglist[0] =
new Integer(q);
299 arglist[1] = params.getCurrent();
303 theta_val_r = (Double) theta_obj;
306 theta_val_i = (Double) meth.invoke(oldAffFcnObj, arglist);
307 }
catch (IllegalAccessException iae) {
308 throw new RuntimeException(iae);
309 }
catch (InvocationTargetException ite) {
310 throw new RuntimeException(ite.getCause());
312 Complex c =
new Complex(theta_val_r.doubleValue(), theta_val_i.doubleValue());
325 Class<?> partypes[] =
new Class[3];
326 partypes[0] = Integer.TYPE;
327 partypes[1] =
double[].class;
328 partypes[2] = boolean.class;
330 meth = oldAffFcnCl.getMethod(
"evaluateF", partypes);
331 }
catch (NoSuchMethodException nsme) {
332 throw new RuntimeException(
"getMethod for evaluateF failed", nsme);
335 Double theta_val_r, theta_val_i;
337 Object arglist[] =
new Object[3];
338 arglist[0] =
new Integer(q);
339 arglist[1] = params.getCurrent();
343 theta_val_r = (Double) theta_obj;
346 theta_val_i = (Double) meth.invoke(oldAffFcnObj, arglist);
347 }
catch (IllegalAccessException iae) {
348 throw new RuntimeException(iae);
349 }
catch (InvocationTargetException ite) {
350 throw new RuntimeException(ite.getCause());
352 Complex c =
new Complex(theta_val_r.doubleValue(), theta_val_i.doubleValue());
365 Class<?> partypes[] =
new Class[4];
366 partypes[0] = Integer.TYPE;
367 partypes[1] = Integer.TYPE;
368 partypes[2] =
double[].class;
369 partypes[3] = boolean.class;
371 meth = oldAffFcnCl.getMethod(
"evaluateL", partypes);
372 }
catch (NoSuchMethodException nsme) {
373 throw new RuntimeException(
"getMethod for evaluateL failed", nsme);
376 Double theta_val_r, theta_val_i;
378 Object arglist[] =
new Object[4];
379 arglist[0] =
new Integer(n);
380 arglist[1] =
new Integer(q);
381 arglist[2] = params.getCurrent();
385 theta_val_r = (Double) theta_obj;
388 theta_val_i = (Double) meth.invoke(oldAffFcnObj, arglist);
389 }
catch (IllegalAccessException iae) {
390 throw new RuntimeException(iae);
391 }
catch (InvocationTargetException ite) {
392 throw new RuntimeException(ite.getCause());
394 Complex c =
new Complex(theta_val_r.doubleValue(), theta_val_i.doubleValue());
406 double output_norm_sq = 0.;
409 for (
int q_l1 = 0; q_l1 <
getQl(i); q_l1++) {
410 for (
int q_l2 = q_l1; q_l2 <
getQl(i); q_l2++) {
411 double delta = (q_l1 == q_l2) ? 1. : 2.;
417 return Math.sqrt(output_norm_sq);
427 double residual_norm_sq = 0.;
430 for (
int q_f1 = 0; q_f1 <
getQf(); q_f1++) {
431 for (
int q_f2 = q_f1; q_f2 <
getQf(); q_f2++) {
432 double delta = (q_f1 == q_f2) ? 1. : 2.;
439 for (
int q_f = 0; q_f <
getQf(); q_f++) {
440 for (
int q_a = 0; q_a <
getQa(); q_a++) {
441 for (
int i = 0; i < N; i++) {
450 for (
int q_a1 = 0; q_a1 <
getQa(); q_a1++) {
451 for (
int q_a2 = q_a1; q_a2 <
getQa(); q_a2++) {
452 double delta = (q_a1 == q_a2) ? 1. : 2.;
454 for (
int i = 0; i < N; i++) {
455 for (
int j = 0; j < N; j++) {
465 if (residual_norm_sq < 0.) {
469 residual_norm_sq = Math.abs(residual_norm_sq);
472 return Math.sqrt(residual_norm_sq);
512 return new double[][] { RB_solution.toArray() };
524 Class<?> partypes[] =
new Class[1];
525 partypes[0] =
double[].class;
527 meth = oldAffFcnCl.getMethod(
"get_SCM_LB", partypes);
528 }
catch (NoSuchMethodException nsme) {
529 throw new RuntimeException(
"getMethod for get_SCM_LB failed", nsme);
534 Object arglist[] =
new Object[1];
538 SCM_val = (Double) SCM_obj;
539 }
catch (IllegalAccessException iae) {
540 throw new RuntimeException(iae);
541 }
catch (InvocationTargetException ite) {
542 throw new RuntimeException(ite.getCause());
545 return SCM_val.doubleValue();
554 return mRbScmSystem.get_SCM_LB();
566 return mRbScmSystem.get_SCM_UB();
576 return RB_solution.getEntry(i);
590 RealVector res =
new ArrayRealVector(N);
592 for (
int i = 0; i < a.getQu0(); i++) {
593 res = res.add(RB_initial_coeffs[i].getSubVector(0, N).mapMultiply(
598 return RB_initial_coeffs[0].getSubVector(0, N);
606 return numBasisFuncs;
650 protected int getQl(
int output_index) {
651 return Ql_values[output_index];
673 int N = RB_solution.getDimension();
679 throw new RuntimeException(
"Too many output fields used by current "
680 +
"SolutionFieldTypes set in RBSystem. Check your model.xml.");
683 switch (sftype.Type) {
684 case Displacement3D: {
686 for (
int nodenr = 0; nodenr < numDoF; nodenr++) {
687 double x = 0, y = 0, z = 0;
688 for (
int rbdim = 0; rbdim < N; rbdim++) {
694 d.setDisplacement(nodenr, (float) x, (
float) y, (float) z);
699 case Displacement2D: {
701 for (
int nodenr = 0; nodenr < numDoF; nodenr++) {
703 for (
int rbdim = 0; rbdim < N; rbdim++) {
708 d.setDisplacement(nodenr, (float) x, (
float) y);
715 for (
int nodenr = 0; nodenr < numDoF; nodenr++) {
717 for (
int rbdim = 0; rbdim < N; rbdim++) {
720 f.setValue(nodenr, (float) x);
726 throw new RuntimeException(
"Invalid/unimplemented solution field type '" + sftype +
"'");
733 fnumcnt += sftype.Type.requiredDoFFields;
747 return sweepIncrement;
751 return sweepOutputBounds;
760 int numSweeps = RB_sweep_solution.length;
765 int currentDoFField = 0;
767 if (currentDoFField + sftype.Type.requiredDoFFields >
getNumDoFFields()) {
768 throw new RuntimeException(
"Too many output fields used by current "
769 +
"SolutionFieldTypes set in RBSystem. Check your model.xml.");
772 Log.d(
"RBSystem",
"Creating sweep solution field of type " + sftype.Type +
", sweeps:" + numSweeps
773 +
", Dofs: " + numDoFs);
774 switch (sftype.Type) {
775 case Displacement3D: {
777 for (
int iSweep = 0; iSweep < numSweeps; iSweep++) {
778 for (
int nodenr = 0; nodenr < numDoFs; nodenr++) {
779 double x = 0, y = 0, z = 0;
780 for (
int rbdim = 0; rbdim < N; rbdim++) {
783 * RB_sweep_solution[iSweep][0][rbdim];
785 * RB_sweep_solution[iSweep][0][rbdim];
787 d.setDisplacement(iSweep * numDoFs + nodenr, (float) x, (
float) y, (float) z);
793 case Displacement2D: {
795 for (
int iSweep = 0; iSweep < numSweeps; iSweep++) {
796 for (
int nodenr = 0; nodenr < numDoFs; nodenr++) {
798 for (
int rbdim = 0; rbdim < N; rbdim++) {
801 * RB_sweep_solution[iSweep][0][rbdim];
803 d.setDisplacement(iSweep * numDoFs + nodenr, (float) x, (
float) y);
811 for (
int sweepNr = 0; sweepNr < numSweeps; sweepNr++) {
812 for (
int i = 0; i < numDoFs; i++) {
814 for (
int j = 0; j < N; j++) {
817 f.setValue(sweepNr * numDoFs + i, (float) tmpval);
824 throw new RuntimeException(
"Invalid/unimplemented solution field type '" + sftype.Type +
"' for sweep.");
853 assert transformationMethod != null;
854 if (transformationMethod != null) {
856 return (
float[][]) transformationMethod.invoke(
oldAffFcnObj,
new Object[] { mu });
857 }
catch (IllegalAccessException iae) {
858 throw new RuntimeException(iae);
859 }
catch (InvocationTargetException ite) {
860 throw new RuntimeException(ite.getCause());
877 Class<?> partypes[] = null;
878 meth = oldAffFcnCl.getMethod(
"is_custom_mesh_transform", partypes);
879 }
catch (NoSuchMethodException nsme) {
884 Object arglist[] = null;
886 boolean val = (Boolean) theta_obj;
888 }
catch (IllegalAccessException iae) {
889 throw new RuntimeException(iae);
890 }
catch (InvocationTargetException ite) {
891 throw new RuntimeException(ite.getCause());
896 return transformationMethod != null;
916 super.loadOfflineData(m);
934 BufferedReader reader = m.getBufReader(
"n_bfs.dat");
936 String line = reader.readLine();
937 numBasisFuncs = Integer.parseInt(line);
941 Log.d(DEBUG_TAG,
"Finished reading n_bfs.dat");
947 RB_initial_coeffs =
new RealVector[1];
948 RB_initial_coeffs[0] =
new ArrayRealVector(numBasisFuncs);
956 String[] dual_norms_tokens;
959 BufferedReader reader = m
960 .getBufReader(
"output_" + String.format(
"%03d", i) +
"_dual_norms.dat");
962 String line1 = reader.readLine();
965 dual_norms_tokens = line1.split(
" ");
971 for (
int q = 0; q < Q_l_hat; q++) {
977 String[] output_i_tokens;
978 for (
int q_l = 0; q_l <
getQl(i); q_l++) {
981 BufferedReader reader_i = m.getBufReader(
"output_" + String.format(
"%03d", i) +
"_"
982 + String.format(
"%03d", q_l) +
".dat");
984 String line_i = reader_i.readLine();
986 output_i_tokens = line_i.split(
" ");
990 for (
int j = 0; j < numBasisFuncs; j++) {
999 Log.d(DEBUG_TAG,
"Finished reading output data");
1005 for (
int q_f = 0; q_f <
getQf(); q_f++) {
1007 BufferedReader reader = m.getBufReader(
"RB_F_" + String.format(
"%03d", q_f) +
".dat");
1008 String line = reader.readLine();
1011 tokens = line.split(
" ");
1018 for (
int i = 0; i < numBasisFuncs; i++) {
1019 RB_F_q_vector[q_f].setEntry(i, Double.parseDouble(tokens[i]));
1023 Log.d(DEBUG_TAG,
"Finished reading RB_F_q data");
1030 for (
int q_a = 0; q_a <
getQa(); q_a++) {
1032 BufferedReader reader = m.getBufReader(
"RB_A_" + String.format(
"%03d", q_a) +
".dat");
1033 String line = reader.readLine();
1036 tokens = line.split(
" ");
1040 RB_A_q_vector[q_a] =
new Array2DRowRealMatrix(numBasisFuncs, numBasisFuncs);
1044 for (
int i = 0; i < numBasisFuncs; i++)
1045 for (
int j = 0; j < numBasisFuncs; j++) {
1046 RB_A_q_vector[q_a].setEntry(i, j, Double.parseDouble(tokens[count]));
1051 Log.d(DEBUG_TAG,
"Finished reading RB_A_q data");
1056 BufferedReader reader = m.getBufReader(
"Fq_norms.dat");
1058 String line = reader.readLine();
1061 String[] tokens = line.split(
" ");
1068 for (
int i = 0; i < Q_f_hat; i++) {
1072 Log.d(DEBUG_TAG,
"Finished reading Fq_norms.dat");
1077 BufferedReader reader = m.getBufReader(
"Fq_Aq_norms.dat");
1078 String line = reader.readLine();
1081 String[] tokens = line.split(
" ");
1088 for (
int q_f = 0; q_f <
getQf(); q_f++)
1089 for (
int q_a = 0; q_a <
getQa(); q_a++)
1090 for (
int i = 0; i < numBasisFuncs; i++) {
1091 Fq_Aq_representor_norms[q_f][q_a][i] = Double.parseDouble(tokens[count]);
1095 Log.d(DEBUG_TAG,
"Finished reading Fq_Aq_norms.dat");
1108 for (
int i = 0; i <
getQa(); i++) {
1109 for (
int j = i; j <
getQa(); j++) {
1110 file =
"Aq_Aq_" + String.format(
"%03d", i) +
"_" + String.format(
"%03d", j) +
"_norms.bin";
1111 InputStream in = m.getInStream(file);
1120 Log.d(DEBUG_TAG,
"Finished reading Aq_Aq_norms.dat");
1129 for (
int imf = 0; imf < mf; imf++)
1130 for (
int inbfs = 0; inbfs < numBasisFuncs; inbfs++) {
1131 in = m.getInStream(
"Z_" + String.format(
"%03d", imf) +
"_" + String.format(
"%03d", inbfs)
1141 Log.d(DEBUG_TAG,
"Finished reading Z.dat");
1149 for (
int q_uL = 0; q_uL <
getQuL(); q_uL++) {
1150 in = m.getInStream(
"uL_" + String.format(
"%03d", q_uL) +
".bin");
1158 Log.d(DEBUG_TAG,
"Finished reading uL.dat");
1165 transformationMethod = oldAffFcnCl.getMethod(
"get_local_transformation",
new Class[] {
double[].class });
1166 }
catch (NoSuchMethodException nsme) {
1167 transformationMethod = null;
1184 RB_initial_coeffs =
new RealVector[Qu0];
1185 for (
int i = 0; i < Qu0; i++) {
1186 filename =
"RB_initial_" + String.format(
"%03d", i) +
".bin";
1187 RB_initial_coeffs[i] = mr.readVector(m.getInStream(filename));
1189 Log.d(DEBUG_TAG,
"Finished initial value data");
1196 for (
int i = 0; i < fNumOutputs; i++) {
1197 filename =
"output_" + String.format(
"%03d", i) +
"_dual_norms.bin";
1207 RB_output_vectors[i] =
new RealVector[Ql_values[i]];
1208 for (
int q_l = 0; q_l < Ql_values[i]; q_l++) {
1209 filename =
"output_" + String.format(
"%03d", i) +
"_" + String.format(
"%03d", q_l) +
".bin";
1211 RB_output_vectors[i][q_l] = mr.readVector(m.getInStream(filename));
1214 Log.d(DEBUG_TAG,
"Finished reading output data");
1220 for (
int q_f = 0; q_f < fQf; q_f++) {
1221 filename =
"RB_F_" + String.format(
"%03d", q_f) +
".bin";
1222 RB_F_q_vector[q_f] = mr.readVector(m.getInStream(filename));
1224 Log.d(DEBUG_TAG,
"Finished reading RB_F_q data");
1230 for (
int q_a = 0; q_a <
getQa(); q_a++) {
1231 filename =
"RB_A_" + String.format(
"%03d", q_a) +
".bin";
1232 RB_A_q_vector[q_a] = mr.readMatrix(m.getInStream(filename));
1234 Log.d(DEBUG_TAG,
"Finished reading RB_A_q data");
1246 for (
int q_a = 0; q_a <
getQa(); q_a++) {
1247 for (
int q_f = 0; q_f < fQf; q_f++) {
1248 filename =
"Fq_Aq_" + String.format(
"%03d", q_f) +
"_" + String.format(
"%03d", q_a) +
".bin";
1252 Log.d(DEBUG_TAG,
"Finished reading Fq_Aq_norms.dat");
1259 for (
int i = 0; i <
getQa(); i++) {
1260 for (
int j = 0; j <
getQa() - i; j++) {
1261 filename =
"Aq_Aq_" + String.format(
"%03d", i) +
"_" + String.format(
"%03d", j) +
"_norms.bin";
1265 Log.d(DEBUG_TAG,
"Finished reading Aq_Aq_norms.dat");
1272 for (
int q_uL = 0; q_uL < fQuL; q_uL++) {
1273 filename =
"uL_" + String.format(
"%03d", q_uL) +
".bin";
1274 uL_vector[q_uL] = mr.readRawFloatVector(m.getInStream(filename));
1276 Log.d(DEBUG_TAG,
"Finished reading uL.dat");
1285 for (
int bfNr = 0; bfNr < numBasisFuncs; bfNr++) {
1286 filename =
"Z_" + String.format(
"%03d", fieldNr) +
"_" + String.format(
"%03d", bfNr) +
".bin";
1287 fullBasisVectors[fieldNr][bfNr] = mr.readRawFloatVector(m.getInStream(filename));
1289 Log.d(DEBUG_TAG,
"Finished reading Z data");
1307 Class<?> partypes[] =
new Class[2];
1308 partypes[0] =
double[].class;
1309 partypes[1] =
float[].class;
1311 meth = oldAffFcnCl.getMethod(
"mesh_transform", partypes);
1312 }
catch (NoSuchMethodException nsme) {
1313 throw new RuntimeException(
"getMethod for mesh_transform failed", nsme);
1318 Object arglist[] =
new Object[2];
1323 xt = (
float[]) theta_obj;
1324 }
catch (IllegalAccessException iae) {
1325 throw new RuntimeException(iae);
1326 }
catch (InvocationTargetException ite) {
1327 throw new RuntimeException(ite.getCause());
1341 Log.d(
"RBSystem",
"Starting sweep: sweepIdx:" + sweepIndex +
", N:" + N +
", NumDoFs:" +
getNumDoFFields()
1342 +
", vertices:" +
getGeometry().getNumVertices());
1360 Log.d(
"RBSystem",
"Dividing numSweepPts by three.");
1363 if (numSweepPts > MAX_SWEEP_POINTS) {
1364 Log.e(
"RBSystem",
"Too large number of sweep points, allowed: " + MAX_SWEEP_POINTS +
", requested: "
1366 numSweepPts = MAX_SWEEP_POINTS;
1370 mSweepParam =
new double[numSweepPts][];
1380 sweepOutputs =
new double[n_outputs][numSweepPts];
1381 sweepOutputBounds =
new double[n_outputs][numSweepPts];
1383 double sweepParamRange = p.getMaxValue(sweepIndex) - p.
getMinValue(sweepIndex);
1384 sweepIncrement = sweepParamRange / (numSweepPts - 1);
1387 for (
int sweepNr = 0; sweepNr < numSweepPts; sweepNr++) {
1388 double new_param = p.getMinValue(sweepIndex) + sweepNr * sweepIncrement;
1389 mSweepParam[sweepNr] = p.getCurrent().clone();
1390 Log.d(DEBUG_TAG,
"ParamSweep: New param " + Arrays.toString(p.getCurrent()));
1391 p.setCurrent(sweepIndex, new_param);
1395 for (
int n = 0; n < n_outputs; n++) {
1400 for (
int n = 0; n < n_outputs / 2; n++) {
1402 sweepOutputs[n + n_outputs / 2][sweepNr] =
get_RB_output(n,
false);
1434 throw new RuntimeException(
"ERROR: N cannot be larger than the number " +
"of basis functions in RB_solve");
1437 throw new RuntimeException(
"ERROR: N must be greater than 0 in RB_solve");
1441 RealMatrix RB_system_matrix_N =
new Array2DRowRealMatrix(N, N);
1443 for (
int q_a = 0; q_a <
getQa(); q_a++) {
1444 RB_system_matrix_N = RB_system_matrix_N.add(
RB_A_q_vector[q_a].getSubMatrix(0, N - 1, 0, N - 1)
1445 .scalarMultiply(
thetaQa(q_a)));
1451 for (
int q_f = 0; q_f < fQf; q_f++) {
1455 RB_rhs_N = RB_rhs_N.add(
RB_F_q_vector[q_f].getSubVector(0, N).mapMultiplyToSelf(
thetaQf(q_f)));
1459 DecompositionSolver solver =
new LUDecompositionImpl(RB_system_matrix_N).getSolver();
1469 if (alpha_LB <= 0) {
1477 double RB_solution_norm = RB_solution.getNorm();
1480 RealVector RB_output_vector_N =
new ArrayRealVector(N);
1484 for (
int q_l = 0; q_l <
getQl(i); q_l++) {
1507 fQa = affineFunctionsInstance.getQa();
1508 Log.d(
"RBBase",
"Q_a = " + fQa);
1513 Log.d(
"RBBase",
"Created GetPot object");
1515 }
catch (IOException e) {
1516 Log.e(
"RBBase",
"Error opening input.in", e);
1526 params = m.getParameters();
1529 numBasisFuncs = Integer.parseInt(m.getModelXMLAttribute(
"num_basisfcn",
"rb_model"));
1532 fNumOutputs = affineFunctionsInstance.getNumOutputs();
1534 Ql_values = affineFunctionsInstance.getQl();
1535 fQf = affineFunctionsInstance.getQf();
1543 int n_parameters = infile.call(
"n_parameters", 1);
1544 Log.d(
"RBBase",
"n_parameters = " + n_parameters);
1545 if (n_parameters > 0) {
1547 for (
int i = 0; i < n_parameters; i++) {
1548 String label = infile.call(
"param" + Integer.toString(i) +
"_label",
"mu_" + i);
1550 String min_string =
new String(
"mu" + i +
"_min");
1551 double mu_i_min = infile.call(min_string, 0.);
1552 String max_string =
new String(
"mu" + i +
"_max");
1553 double mu_i_max = infile.call(max_string, 0.);
1554 params.addParam(label, mu_i_min, mu_i_max);
1555 Log.d(
"RBBase",
"Parameter " + i +
": Min = " + mu_i_min +
", Max = " + mu_i_max);
1564 int return_rel_error_bound_in = infile.call(
"return_rel_error_bound", 1);
1572 Ql_values = affineFunctionsInstance.getQl();
1573 fQf = affineFunctionsInstance.getQf();
1574 Log.d(DEBUG_TAG,
"Q_f = " + fQf);
1579 fNumOutputs = affineFunctionsInstance.getNumOutputs();
1580 Log.d(DEBUG_TAG,
"n_outputs = " + fNumOutputs);
1588 return Math.sqrt(alpha_LB);
1627 Log.d(
"RBSystem",
"Storing AffLinTrafo: " + Log.dumpArr(tmp));
1692 return affineFunctionsInstance.thetaQa(q, params.getCurrent(), t);
1711 return affineFunctionsInstance.thetaQf(i, params.getCurrent(), t);
1732 return affineFunctionsInstance.thetaQl(k, i,
getParams().getCurrent(), t);
Interface for models using the mQ_uL fields.
double computeRBSolution(int N)
Performs a reduced basis simulation and stores the results locally.
GeometryData getGeometry()
The model's geometry data.
double[] RB_output_error_bounds
The vector storing the RB error bounds in the steady-state case.
The displacement field is a logical solution field describing displacements of geometry nodes/vertice...
double compute_output_dual_norm(int i, double t)
Compute the dual norm of the i^th output function at the current parameter value. ...
Complex complex_eval_theta_q_f(int q)
double[][] output_dual_norms
This array stores the dual norms for each output.
float[][][] fullBasisVectors
int getNumDoFFields()
Returns the number of degree-of-freedom fields generated/computed by the model.
double getSweepIncrement()
Returns the increment used during the last parameter sweep or zero if there hasn't been any...
Utility helper class from rbAppMIT included for compatibility of rbAppMIT model loading.
int getVisualNumTimesteps()
Class< IAffineFunctions > affineFunctionsClass
The Class object for the affine functions class.
This class provides the Online stage for the reduced basis method for elliptic steady state problems...
double get_RB_output(int n_output, boolean Rpart)
The default solution field containing an array of real values.
double[][][] Fq_Aq_representor_norms
Represents the results of a simulation.
final boolean readConfiguration(AModelManager m)
This class provides the Online reduced basis functionality for linear parabolic problems.
void loadOfflineData(AModelManager m)
Loads the offline data for the RBSystem.
An rbappmit-model of old data format, compatible with JRB models.
double get_RB_output_error_bound(int n_output, boolean Rpart)
Reading matrices and vectors with a bunch of convenient overloads for different sources and output fo...
RealVector getInitialCoefficients(int N)
Returns the initial conditions solution coefficients for RB size N.
double RB_solve(int N)
Perform online solve with the N RB basis functions, for the set of parameters in current_params, where 1 <= N <= RB_size.
void readConfigurationRBAppMIT(GetPot infile)
double[] getCurrent()
Gets the current parameter.
Parameters getParams()
Returns the system's parameters object.
double[][][] Aq_Aq_representor_norms
Base interface for any affine functions used as an externally loaded class.
This class implements the Online stage of the Successive Constraint Method for coercive problems...
void loadOfflineData_rbappmit(AModelManager m)
double getMinValue(int i)
final InputStream getInStream(String filename)
Returns an InputStream instance streaming the contents of the file given by filename.
double thetaQl(int k, int i)
IAffineFunctions affineFunctionsInstance
The member object that defines the parameter-dependent functions for the affine expansion of the left...
boolean return_rel_error_bound
Boolean flag to indicate whether RB_solve returns an absolute or relative error bound.
FieldVector< Complex > complex_eval_theta_q_a()
double[] Fq_representor_norms
Arrays storing the residual representor inner products to be used in computing the residuals in the O...
double get_SCM_from_AffineFunction()
A private helper function to get the SCM from AffineFunctions in the case that SCM_TYPE = NONE...
void set_n_basis_functions(int _N)
double thetaQa(int q)
Evaluate theta_q_a (for the q^th bilinear form) at the current parameter.
Known model types within the JaRMoSBase project.
double[] RB_outputs
The vector storing the RB output values in the steady-state case.
This class serves as base class for accessing various types of models at different locations...
A class for model parameters.
int performSweep(int sweepIndex, int N, int numSweepPts)
Performs a parameter sweep for the current RB system.
boolean hasCustomMeshTransform()
int getQf()
TODO: if all affine_functions implement the IAffineFunctions interface, just call the getQf method of...
void initialize_data_vectors()
Resize the vectors that store solution data and output data.
void setParams(Parameters p)
Only used to set the current parameters object for an SCMSystem, as this also inherits from the RBBas...
SimulationResult getSimulationResults()
Constructs the true solution from the most recent RB reduced solution using the full Z data and curre...
double[][] getSweepOutputBounds()
RealVector RB_solution
The RB solution vector.
double[][] get_RBsolution()
FieldDescriptor[] logicalFieldTypes
The logical output fields of the model, each collecting one ore more model DoF's into a related unit...
double thetaQa(int q, double t)
ModelType getModelType()
Returns the model type as given in the model.xml attribute "type" of the "model" tag.
void readConfigurationJRB(AModelManager m)
boolean hasAffLinTransformationData()
int getTotalTimesteps()
TODO check where this is used.
Provides a Log class imitating the Android Log class when not used on android systems.
This Exception gets thrown when an error occurs regarding the functionality of the ModelManager...
double[][] RB_output_error_bounds_all_k
The output error bounds at all time levels.
float[][] getAffLinTransformationData(double[] mu)
Returns a float array of transformation data for each node, using the specified parameter mu...
double compute_residual_dual_norm(int N)
Compute the dual norm of the residual for the solution saved in RB_solution_vector.
void setPrimarySCM(RBSCMSystem scm_system)
Set the primary SCM.
RealMatrix[] RB_A_q_vector
Dense matrices for the RB computations.
double get_SCM_upper_bound()
double[][][] RB_sweep_solution
double thetaQf(int i, double t)
double[][] RB_outputs_all_k
The outputs at all time levels.
Complex complex_eval_theta_q_a(int q)
RealVector[][] RB_output_vectors
The vectors storing the RB output vectors.
static final String parameters_filename
Inherited from the rbAppMIT models to read the model parameters.
double get_soln_coeff(int i)
RealVector[] RB_F_q_vector
Dense vector for the RHS.
double residual_scaling_denom(double alpha_LB)
Specifies the residual scaling on the denominator to be used in the a posteriori error bound...
double[][] getSweepOutputs()
Interface for affinely decomposed initial value conditions.
int performSweep(int sweepIndex, int N)
Performs a parameter sweep with automatic guess of the number of parameter sweeps.
double thetaQu0(int i, double[] p)
Evaluates ^{u0}_i for the current parameter p.
RBSCMSystem mRbScmSystem
A reference to the SCM system.
Complex complex_eval_theta_q_l(int n, int q)
float[] rbappmitCustomMeshTransform(double[] mu, float[] x)
Custom mesh transformation method of old rbappmit-models.
List< MeshTransform > transforms
Contains information about the logical solution fields.
double thetaQl(int k, int i, double t)
Class with constants used throughout JRB.
int getQl(int output_index)
TODO: if all affine_functions implement the IAffineFunctions interface, just call the getQl method of...
Base class for all JaRMoSBase models.
SimulationResult getSweepSimResults()
double get_SCM_lower_bound()
void loadOfflineDataJRB(AModelManager m)