Skip to content
Permalink
Browse files

Merge pull request #13342 from aeslaughter/reset-13320

Support batch running of SamplerFullSolveMultiApp
  • Loading branch information...
permcody committed May 9, 2019
2 parents c1f5f90 + 64eace2 commit 58029272a2d7622cc17b655365b2627a59d344df
Showing with 17,852 additions and 234 deletions.
  1. +5 −0 framework/doc/content/css/moose.css
  2. +7 −1 framework/include/multiapps/MultiApp.h
  3. +6 −0 framework/include/problems/FEProblemBase.h
  4. +34 −11 framework/include/samplers/Sampler.h
  5. +8 −1 framework/include/transfers/MultiAppTransfer.h
  6. +1 −1 framework/src/base/MooseApp.C
  7. +16 −15 framework/src/multiapps/MultiApp.C
  8. +15 −3 framework/src/problems/FEProblemBase.C
  9. +39 −2 framework/src/samplers/Sampler.C
  10. +8 −2 framework/src/transfers/MultiAppTransfer.C
  11. +1 −1 modules/doc/content/newsletter/2019_02.md
  12. +129 −0 modules/stochastic_tools/doc/content/batch_mode.md
  13. +1,467 −0 modules/stochastic_tools/doc/content/media/full_solve_memory_mpi.svg
  14. +1,278 −0 modules/stochastic_tools/doc/content/media/full_solve_memory_serial.svg
  15. +1,074 −0 modules/stochastic_tools/doc/content/media/full_solve_serial_time.svg
  16. +1,231 −0 modules/stochastic_tools/doc/content/media/full_solve_time_mpi.svg
  17. +1,086 −0 modules/stochastic_tools/doc/content/media/full_solve_time_serial.svg
  18. +1,335 −0 modules/stochastic_tools/doc/content/media/transient_memory_mpi.svg
  19. +1,209 −0 modules/stochastic_tools/doc/content/media/transient_memory_serial.svg
  20. +1,122 −0 modules/stochastic_tools/doc/content/media/transient_mpi_time.svg
  21. +1,125 −0 modules/stochastic_tools/doc/content/media/transient_serial_time.svg
  22. +6 −6 modules/stochastic_tools/doc/content/modules/stochastic_tools/examples/monte_carlo.md
  23. +4 −4 modules/stochastic_tools/doc/content/source/controls/MultiAppCommandLineControl.md
  24. +7 −3 modules/stochastic_tools/doc/content/source/multiapps/SamplerFullSolveMultiApp.md
  25. +4 −1 modules/stochastic_tools/doc/content/source/multiapps/SamplerTransientMultiApp.md
  26. +61 −0 modules/stochastic_tools/examples/batch/execute.py
  27. +81 −0 modules/stochastic_tools/examples/batch/full_solve.i
  28. +1,153 −0 modules/stochastic_tools/examples/batch/full_solve_mpi_memory.svg
  29. +1,004 −0 modules/stochastic_tools/examples/batch/full_solve_mpi_time.svg
  30. +1,074 −0 modules/stochastic_tools/examples/batch/full_solve_serial_memory.svg
  31. +1,002 −0 modules/stochastic_tools/examples/batch/full_solve_serial_time.svg
  32. +13 −0 modules/stochastic_tools/examples/batch/gold/full_solve_memory_batch-reset.csv
  33. +13 −0 modules/stochastic_tools/examples/batch/gold/full_solve_memory_batch-restore.csv
  34. +11 −0 modules/stochastic_tools/examples/batch/gold/full_solve_memory_mpi_batch-reset.csv
  35. +11 −0 modules/stochastic_tools/examples/batch/gold/full_solve_memory_mpi_batch-restore.csv
  36. +11 −0 modules/stochastic_tools/examples/batch/gold/full_solve_memory_mpi_normal.csv
  37. +13 −0 modules/stochastic_tools/examples/batch/gold/full_solve_memory_normal.csv
  38. +12 −0 modules/stochastic_tools/examples/batch/gold/full_solve_memory_serial_batch-reset.csv
  39. +12 −0 modules/stochastic_tools/examples/batch/gold/full_solve_memory_serial_batch-restore.csv
  40. +12 −0 modules/stochastic_tools/examples/batch/gold/full_solve_memory_serial_normal.csv
  41. +11 −0 modules/stochastic_tools/examples/batch/gold/transient_memory_mpi_batch-restore.csv
  42. +11 −0 modules/stochastic_tools/examples/batch/gold/transient_memory_mpi_normal.csv
  43. +12 −0 modules/stochastic_tools/examples/batch/gold/transient_memory_serial_batch-restore.csv
  44. +12 −0 modules/stochastic_tools/examples/batch/gold/transient_memory_serial_normal.csv
  45. +60 −0 modules/stochastic_tools/examples/batch/plot.py
  46. +65 −0 modules/stochastic_tools/examples/batch/sub.i
  47. +83 −0 modules/stochastic_tools/examples/batch/transient.i
  48. +10 −0 modules/stochastic_tools/include/base/StochasticToolsApp.h
  49. +21 −0 modules/stochastic_tools/include/base/StochasticToolsTypes.h
  50. +26 −1 modules/stochastic_tools/include/multiapps/SamplerFullSolveMultiApp.h
  51. +37 −1 modules/stochastic_tools/include/multiapps/SamplerTransientMultiApp.h
  52. +4 −2 modules/stochastic_tools/include/samplers/MonteCarloSampler.h
  53. +23 −3 modules/stochastic_tools/include/transfers/SamplerPostprocessorTransfer.h
  54. +25 −5 modules/stochastic_tools/include/transfers/SamplerTransfer.h
  55. +34 −0 modules/stochastic_tools/include/transfers/StochasticToolsTransfer.h
  56. +28 −1 modules/stochastic_tools/src/controls/MultiAppCommandLineControl.C
  57. +111 −2 modules/stochastic_tools/src/multiapps/SamplerFullSolveMultiApp.C
  58. +115 −2 modules/stochastic_tools/src/multiapps/SamplerTransientMultiApp.C
  59. +16 −8 modules/stochastic_tools/src/samplers/MonteCarloSampler.C
  60. +56 −11 modules/stochastic_tools/src/transfers/SamplerPostprocessorTransfer.C
  61. +37 −14 modules/stochastic_tools/src/transfers/SamplerTransfer.C
  62. +89 −0 modules/stochastic_tools/src/transfers/StochasticToolsTransfer.C
  63. +2 −0 modules/stochastic_tools/src/vectorpostprocessors/StochasticResults.C
  64. +4 −0 ...ic_tools/test/tests/multiapps/batch_commandline_control/gold/master_multiple_out_storage_0002.csv
  65. +4 −0 ...stic_tools/test/tests/multiapps/batch_commandline_control/gold/master_single_out_storage_0002.csv
  66. +69 −0 modules/stochastic_tools/test/tests/multiapps/batch_commandline_control/master_multiple.i
  67. +70 −0 modules/stochastic_tools/test/tests/multiapps/batch_commandline_control/master_single.i
  68. +49 −0 modules/stochastic_tools/test/tests/multiapps/batch_commandline_control/master_wrong_num_params.i
  69. +48 −0 modules/stochastic_tools/test/tests/multiapps/batch_commandline_control/master_wrong_size.i
  70. +29 −0 modules/stochastic_tools/test/tests/multiapps/batch_commandline_control/sub.i
  71. +54 −0 modules/stochastic_tools/test/tests/multiapps/batch_commandline_control/tests
  72. +6 −0 ..._tools/test/tests/multiapps/batch_full_solve_multiapp/gold/master_full_solve_out_storage_0002.csv
  73. +58 −0 modules/stochastic_tools/test/tests/multiapps/batch_full_solve_multiapp/master_full_solve.i
  74. +55 −0 modules/stochastic_tools/test/tests/multiapps/batch_full_solve_multiapp/sub.i
  75. +56 −0 modules/stochastic_tools/test/tests/multiapps/batch_full_solve_multiapp/tests
  76. +6 −0 .../test/tests/multiapps/batch_sampler_transient_multiapp/gold/master_transient_out_storage_0000.csv
  77. +6 −0 .../test/tests/multiapps/batch_sampler_transient_multiapp/gold/master_transient_out_storage_0001.csv
  78. +6 −0 .../test/tests/multiapps/batch_sampler_transient_multiapp/gold/master_transient_out_storage_0002.csv
  79. +6 −0 .../test/tests/multiapps/batch_sampler_transient_multiapp/gold/master_transient_out_storage_0003.csv
  80. +66 −0 modules/stochastic_tools/test/tests/multiapps/batch_sampler_transient_multiapp/master_transient.i
  81. +58 −0 modules/stochastic_tools/test/tests/multiapps/batch_sampler_transient_multiapp/sub.i
  82. +25 −0 modules/stochastic_tools/test/tests/multiapps/batch_sampler_transient_multiapp/tests
  83. +1 −1 modules/stochastic_tools/test/tests/multiapps/commandline_control/master_wrong_num_params.i
  84. +1 −1 modules/stochastic_tools/test/tests/multiapps/commandline_control/master_wrong_size.i
  85. 0 ...c_tools/test/tests/multiapps/{sampler_multiapp → sampler_full_solve_multiapp}/master_full_solve.i
  86. 0 modules/stochastic_tools/test/tests/multiapps/{sampler_multiapp → sampler_full_solve_multiapp}/sub.i
  87. +10 −0 modules/stochastic_tools/test/tests/multiapps/sampler_full_solve_multiapp/tests
  88. +0 −17 modules/stochastic_tools/test/tests/multiapps/sampler_multiapp/tests
  89. 0 ...tic_tools/test/tests/multiapps/{sampler_multiapp → sampler_transient_multiapp}/master_transient.i
  90. +51 −0 modules/stochastic_tools/test/tests/multiapps/sampler_transient_multiapp/sub.i
  91. +10 −0 modules/stochastic_tools/test/tests/multiapps/sampler_transient_multiapp/tests
  92. +11 −0 modules/stochastic_tools/test/tests/transfers/batch_sampler_transfer/gold/master_out_data_0002.csv
  93. +6 −0 ...les/stochastic_tools/test/tests/transfers/batch_sampler_transfer/gold/master_out_storage_0002.csv
  94. +74 −0 modules/stochastic_tools/test/tests/transfers/batch_sampler_transfer/master.i
  95. +61 −0 modules/stochastic_tools/test/tests/transfers/batch_sampler_transfer/sub.i
  96. +52 −0 modules/stochastic_tools/test/tests/transfers/batch_sampler_transfer/tests
  97. 0 ...tools/test/tests/transfers/{gold/sobol_out_sub00.csv → monte_carlo/gold/monte_carlo_out_sub0.csv}
  98. 0 ...tools/test/tests/transfers/{gold/sobol_out_sub01.csv → monte_carlo/gold/monte_carlo_out_sub1.csv}
  99. 0 ...tools/test/tests/transfers/{gold/sobol_out_sub02.csv → monte_carlo/gold/monte_carlo_out_sub2.csv}
  100. +8 −0 modules/stochastic_tools/test/tests/transfers/monte_carlo/gold/monte_carlo_out_sub3.csv
  101. +8 −0 modules/stochastic_tools/test/tests/transfers/monte_carlo/gold/monte_carlo_out_sub4.csv
  102. 0 modules/stochastic_tools/test/tests/transfers/{ → monte_carlo}/monte_carlo.i
  103. 0 modules/stochastic_tools/test/tests/transfers/{ → monte_carlo}/sub.i
  104. +10 −0 modules/stochastic_tools/test/tests/transfers/monte_carlo/tests
  105. +2 −2 modules/stochastic_tools/test/tests/transfers/sampler_transfer/monte_carlo.i
  106. +8 −0 modules/stochastic_tools/test/tests/transfers/sobol/gold/sobol_out_sub00.csv
  107. +8 −0 modules/stochastic_tools/test/tests/transfers/sobol/gold/sobol_out_sub01.csv
  108. +8 −0 modules/stochastic_tools/test/tests/transfers/sobol/gold/sobol_out_sub02.csv
  109. 0 modules/stochastic_tools/test/tests/transfers/{ → sobol}/gold/sobol_out_sub03.csv
  110. 0 modules/stochastic_tools/test/tests/transfers/{ → sobol}/gold/sobol_out_sub04.csv
  111. 0 modules/stochastic_tools/test/tests/transfers/{ → sobol}/gold/sobol_out_sub05.csv
  112. 0 modules/stochastic_tools/test/tests/transfers/{ → sobol}/gold/sobol_out_sub06.csv
  113. 0 modules/stochastic_tools/test/tests/transfers/{ → sobol}/gold/sobol_out_sub07.csv
  114. 0 modules/stochastic_tools/test/tests/transfers/{ → sobol}/gold/sobol_out_sub08.csv
  115. 0 modules/stochastic_tools/test/tests/transfers/{ → sobol}/gold/sobol_out_sub09.csv
  116. 0 modules/stochastic_tools/test/tests/transfers/{ → sobol}/gold/sobol_out_sub10.csv
  117. 0 modules/stochastic_tools/test/tests/transfers/{ → sobol}/gold/sobol_out_sub11.csv
  118. 0 modules/stochastic_tools/test/tests/transfers/{ → sobol}/sobol.i
  119. +68 −0 modules/stochastic_tools/test/tests/transfers/sobol/sub.i
  120. +10 −0 modules/stochastic_tools/test/tests/transfers/sobol/tests
  121. +0 −15 modules/stochastic_tools/test/tests/transfers/tests
  122. +1 −1 python/MooseDocs/extensions/floats.py
  123. +2 −1 python/MooseDocs/extensions/graph.py
  124. +1 −1 python/MooseDocs/test/gold/html/extensions/acronym.html
  125. +2 −2 python/MooseDocs/test/gold/html/extensions/alert.html
  126. +1 −1 python/MooseDocs/test/gold/html/extensions/amendments.html
  127. +2 −2 python/MooseDocs/test/gold/html/extensions/appsyntax.html
  128. +2 −2 python/MooseDocs/test/gold/html/extensions/autolink.html
  129. +2 −2 python/MooseDocs/test/gold/html/extensions/bibtex.html
  130. +1 −1 python/MooseDocs/test/gold/html/extensions/common.html
  131. +1 −1 python/MooseDocs/test/gold/html/extensions/config.html
  132. +1 −1 python/MooseDocs/test/gold/html/extensions/content.html
  133. +2 −2 python/MooseDocs/test/gold/html/extensions/core.html
  134. +2 −2 python/MooseDocs/test/gold/html/extensions/devel.html
  135. +1 −1 python/MooseDocs/test/gold/html/extensions/example.template.html
  136. +1 −1 python/MooseDocs/test/gold/html/extensions/first.html
  137. +1 −1 python/MooseDocs/test/gold/html/extensions/folder/folder.html
  138. +1 −1 python/MooseDocs/test/gold/html/extensions/folder/index.html
  139. +1 −1 python/MooseDocs/test/gold/html/extensions/gallery.html
  140. +2 −2 python/MooseDocs/test/gold/html/extensions/graph.html
  141. +1 −1 python/MooseDocs/test/gold/html/extensions/include.html
  142. +1 −1 python/MooseDocs/test/gold/html/extensions/katex.html
  143. +1 −1 python/MooseDocs/test/gold/html/extensions/katex_include.html
  144. +1 −1 python/MooseDocs/test/gold/html/extensions/layout.html
  145. +2 −2 python/MooseDocs/test/gold/html/extensions/listing.html
  146. +1 −1 python/MooseDocs/test/gold/html/extensions/listing_include.html
  147. +1 −1 python/MooseDocs/test/gold/html/extensions/materialicon.html
  148. +1 −1 python/MooseDocs/test/gold/html/extensions/media.html
  149. +1 −1 python/MooseDocs/test/gold/html/extensions/navigation.html
  150. +2 −2 python/MooseDocs/test/gold/html/extensions/package.html
  151. +1 −1 python/MooseDocs/test/gold/html/extensions/preamble.html
  152. +1 −1 python/MooseDocs/test/gold/html/extensions/second.html
  153. +2 −2 python/MooseDocs/test/gold/html/extensions/sqa.html
  154. +1 −1 python/MooseDocs/test/gold/html/extensions/style.html
  155. +1 −1 python/MooseDocs/test/gold/html/extensions/table.html
  156. +1 −1 python/MooseDocs/test/gold/html/extensions/template.html
  157. +1 −1 python/MooseDocs/test/gold/html/index.html
  158. +1 −1 python/MooseDocs/test/gold/html/mega.menu.html
  159. +1 −1 python/MooseDocs/test/gold/materialize/extensions/acronym.html
  160. +2 −2 python/MooseDocs/test/gold/materialize/extensions/alert.html
  161. +1 −1 python/MooseDocs/test/gold/materialize/extensions/amendments.html
  162. +2 −2 python/MooseDocs/test/gold/materialize/extensions/appsyntax.html
  163. +2 −2 python/MooseDocs/test/gold/materialize/extensions/autolink.html
  164. +2 −2 python/MooseDocs/test/gold/materialize/extensions/bibtex.html
  165. +1 −1 python/MooseDocs/test/gold/materialize/extensions/common.html
  166. +1 −1 python/MooseDocs/test/gold/materialize/extensions/config.html
  167. +1 −1 python/MooseDocs/test/gold/materialize/extensions/content.html
  168. +2 −2 python/MooseDocs/test/gold/materialize/extensions/core.html
  169. +2 −2 python/MooseDocs/test/gold/materialize/extensions/devel.html
  170. +2 −2 python/MooseDocs/test/gold/materialize/extensions/example.template.html
  171. +1 −1 python/MooseDocs/test/gold/materialize/extensions/first.html
  172. +1 −1 python/MooseDocs/test/gold/materialize/extensions/folder/folder.html
  173. +1 −1 python/MooseDocs/test/gold/materialize/extensions/folder/index.html
  174. +1 −1 python/MooseDocs/test/gold/materialize/extensions/gallery.html
  175. +3 −3 python/MooseDocs/test/gold/materialize/extensions/graph.html
  176. +1 −1 python/MooseDocs/test/gold/materialize/extensions/include.html
  177. +1 −1 python/MooseDocs/test/gold/materialize/extensions/katex.html
  178. +1 −1 python/MooseDocs/test/gold/materialize/extensions/katex_include.html
  179. +1 −1 python/MooseDocs/test/gold/materialize/extensions/layout.html
  180. +3 −3 python/MooseDocs/test/gold/materialize/extensions/listing.html
  181. +1 −1 python/MooseDocs/test/gold/materialize/extensions/listing_include.html
  182. +1 −1 python/MooseDocs/test/gold/materialize/extensions/materialicon.html
  183. +1 −1 python/MooseDocs/test/gold/materialize/extensions/media.html
  184. +1 −1 python/MooseDocs/test/gold/materialize/extensions/navigation.html
  185. +2 −2 python/MooseDocs/test/gold/materialize/extensions/package.html
  186. +1 −1 python/MooseDocs/test/gold/materialize/extensions/preamble.html
  187. +1 −1 python/MooseDocs/test/gold/materialize/extensions/second.html
  188. +2 −2 python/MooseDocs/test/gold/materialize/extensions/sqa.html
  189. +1 −1 python/MooseDocs/test/gold/materialize/extensions/style.html
  190. +1 −1 python/MooseDocs/test/gold/materialize/extensions/table.html
  191. +2 −2 python/MooseDocs/test/gold/materialize/extensions/template.html
  192. +1 −1 python/MooseDocs/test/gold/materialize/index.html
  193. +1 −1 python/MooseDocs/test/gold/materialize/mega.menu.html
  194. +1 −1 python/mooseutils/mooseutils.py
  195. +36 −0 test/tests/multiapps/full_solve_multiapp_reset/master.i
  196. +48 −0 test/tests/multiapps/full_solve_multiapp_reset/sub.i
@@ -50,6 +50,11 @@ main {
margin-left:5px;
}

.moose-float{
box-shadow:unset;
-webkit-box-shadow:unset;
}

.moose-col-icon{
font-size: 32pt;
display:inline-block;
@@ -307,6 +307,13 @@ class MultiApp : public MooseObject, public SetupInterface, public Restartable
/// call back executed right before app->runInputFile()
virtual void preRunInputFile();

/** Method to aid in getting the "cli_args" parameters.
*
* The method is virtual because it is needed to allow for batch runs within the stochastic tools
* module, see SamplerFullSolveMultiApp for an example.
*/
virtual std::string getCommandLineArgsParamHelper(unsigned int local_app);

/**
* Initialize the MultiApp by creating the provided number of apps.
*
@@ -446,4 +453,3 @@ dataLoad(std::istream & stream, SubAppBackups & backups, void * context)

multi_app->restore();
}

@@ -928,6 +928,12 @@ class FEProblemBase : public SubProblem, public Restartable
std::vector<std::shared_ptr<Transfer>> getTransfers(ExecFlagType type,
MultiAppTransfer::DIRECTION direction) const;

/**
* Return the complete warehouse for MultiAppTransfer object for the given direction
*/
const ExecuteMooseObjectWarehouse<Transfer> &
getMultiAppTransferWarehouse(MultiAppTransfer::DIRECTION direction) const;

/**
* Execute MultiAppTransfers associate with execution flag and direction.
* @param type The execution flag to execute.
@@ -50,22 +50,22 @@ class Sampler : public MooseObject, public SetupInterface, public DistributionIn
*/
struct Location
{
Location(const unsigned int & s, const unsigned int & r) : _sample(s), _row(r) {}
Location(const dof_id_type & s, const dof_id_type & r) : _sample(s), _row(r) {}

///@{
/**
* Accessors for the sample and row numbers.
* Methods for the sample and row numbers.
*/
unsigned int sample() const { return _sample; }
unsigned int row() const { return _row; }
dof_id_type sample() const { return _sample; }
dof_id_type row() const { return _row; }
///@}

private:
/// Sample number (i.e., the index in the matrix)
const unsigned int _sample;
const dof_id_type _sample;

/// Row number for the given sample matrix
const unsigned int _row;
const dof_id_type _row;
};

/**
@@ -114,13 +114,28 @@ class Sampler : public MooseObject, public SetupInterface, public DistributionIn
* SamplerFullSolveMultiApp the global_index is the MultiApp global index.
* @return The location which includes the DenseMatrix index and the row within that matrix.
*/
Sampler::Location getLocation(unsigned int global_index);
Sampler::Location getLocation(dof_id_type global_index);

/**
* Return the number of samples.
* @return The total number of rows that exist in all DenseMatrix values from getSamples()
*/
unsigned int getTotalNumberOfRows();
dof_id_type getTotalNumberOfRows();

/**
* Return the number of rows local to this processor.
*/
dof_id_type getLocalNumerOfRows();

/**
* Return the beginning local row index for this processor
*/
dof_id_type getLocalRowBegin();

/**
* Return the ending local row index for this processor
*/
dof_id_type getLocalRowEnd();

protected:
/**
@@ -173,10 +188,18 @@ class Sampler : public MooseObject, public SetupInterface, public DistributionIn
/// Initial random number seed
const unsigned int & _seed;

/// Data offsets for computing location based on global index
/// Data offsets for computing location based on global row index
std::vector<unsigned int> _offsets;

/// Total number of rows
unsigned int _total_rows;
};
dof_id_type _total_rows;

/// Number of global rows for this processor
dof_id_type _local_rows;

/// Global row index for start of data for this processor
dof_id_type _local_row_begin;

/// Global row index for end of data for this processor
dof_id_type _local_row_end;
};
@@ -111,5 +111,12 @@ class MultiAppTransfer : public Transfer

// Given local app index, returns global app index.
std::vector<unsigned int> _local2global_map;
};

/**
* Helper method for checking the 'check_multiapp_execute_on' flag.
*
* This method was added to allow the check to be delayed by child classes,
* see StochasticToolsTransfer for an example.
*/
void checkMultiAppExecuteOn();
};
@@ -344,7 +344,7 @@ MooseApp::MooseApp(InputParameters parameters)
if (_check_input && isParamValid("recover"))
mooseError("Cannot run --check-input with --recover. Recover files might not exist");
if (isParamValid("start_in_debugger"))
if (isParamValid("start_in_debugger") && _multiapp_level == 0)
{
auto command = getParam<std::string>("start_in_debugger");
@@ -399,7 +399,7 @@ MultiApp::postExecute()
void
MultiApp::backup()
{
_console << "Begining backing up MultiApp " << name() << std::endl;
_console << "Beginning backing up MultiApp " << name() << std::endl;
for (unsigned int i = 0; i < _my_num_apps; i++)
_backups[i] = _apps[i]->backup();
_console << "Finished backing up MultiApp " << name() << std::endl;
@@ -611,21 +611,9 @@ MultiApp::createApp(unsigned int i, Real start_time)
app_params.set<FEProblemBase *>("_parent_fep") = &_fe_problem;
app_params.set<std::shared_ptr<CommandLine>>("_command_line") = _app.commandLine();

// Single set of "cli_args" to be applied to all sub apps
if (_cli_args.size() == 1)
{
for (const std::string & str : MooseUtils::split(_cli_args[0], ";"))
{
std::ostringstream oss;
oss << full_name << ":" << str;
app_params.get<std::shared_ptr<CommandLine>>("_command_line")->addArgument(oss.str());
}
}

// Unique set of "cli_args" to be applied to each sub apps
else if (_cli_args.size() > 1)
if (_cli_args.size() > 0)
{
for (const std::string & str : MooseUtils::split(_cli_args[i + _first_local_app], ";"))
for (const std::string & str : MooseUtils::split(getCommandLineArgsParamHelper(i), ";"))
{
std::ostringstream oss;
oss << full_name << ":" << str;
@@ -696,6 +684,19 @@ MultiApp::createApp(unsigned int i, Real start_time)
}
}

std::string
MultiApp::getCommandLineArgsParamHelper(unsigned int local_app)
{

// Single set of "cli_args" to be applied to all sub apps
if (_cli_args.size() == 1)
return _cli_args[0];

// Unique set of "cli_args" to be applied to each sub apps
else
return _cli_args[local_app + _first_local_app];
}

void
MultiApp::buildComm()
{
@@ -3498,6 +3498,15 @@ FEProblemBase::getTransfers(ExecFlagType type, MultiAppTransfer::DIRECTION direc
return wh.getActiveObjects();
}

const ExecuteMooseObjectWarehouse<Transfer> &
FEProblemBase::getMultiAppTransferWarehouse(MultiAppTransfer::DIRECTION direction) const
{
if (direction == MultiAppTransfer::TO_MULTIAPP)
return _to_multi_app_transfers;
else
return _from_multi_app_transfers;
}

bool
FEProblemBase::execMultiApps(ExecFlagType type, bool auto_advance)
{
@@ -3694,10 +3703,13 @@ FEProblemBase::addTransfer(const std::string & transfer_name,
parameters.set<SystemBase *>("_sys") = _aux.get();
}

// Handle the "SAME_AS_MULTIAPP" execute option
ExecFlagEnum & exec_enum = parameters.set<ExecFlagEnum>("execute_on", true);
if (exec_enum.contains(EXEC_SAME_AS_MULTIAPP))
// Handle the "SAME_AS_MULTIAPP" execute option. The get method is used to test for the
// flag so the set by user flag is not reset, calling set with the true flag causes the set
// by user status to be reset, which should only be done if the EXEC_SAME_AS_MULTIAPP is
// being applied to the object.
if (parameters.get<ExecFlagEnum>("execute_on").contains(EXEC_SAME_AS_MULTIAPP))
{
ExecFlagEnum & exec_enum = parameters.set<ExecFlagEnum>("execute_on", true);
std::shared_ptr<MultiApp> multiapp = getMultiApp(parameters.get<MultiAppName>("multi_app"));
exec_enum = multiapp->getParam<ExecFlagEnum>("execute_on");
}
@@ -70,6 +70,10 @@ Sampler::reinit(const std::vector<DenseMatrix<Real>> & data)
_total_rows += mat.m();
_offsets.push_back(_total_rows);
}

// Update parallel information
MooseUtils::linearPartitionItems(
_total_rows, n_processors(), processor_id(), _local_rows, _local_row_begin, _local_row_end);
}

std::vector<DenseMatrix<Real>>
@@ -143,16 +147,49 @@ Sampler::getLocation(unsigned int global_index)
// The lower_bound method returns the first value "which does not compare less than" the value and
// upper_bound performs "which compares greater than." The upper_bound -1 method is used here
// because lower_bound will provide the wrong index, but the method here will provide the correct
// index, set the Sampler.GetLocation test in moose/unit/src/Sampler.C for an example.
// index, see the Sampler.GetLocation test in moose/unit/src/Sampler.C for an example.
std::vector<unsigned int>::iterator iter =
std::upper_bound(_offsets.begin(), _offsets.end(), global_index) - 1;
return Sampler::Location(std::distance(_offsets.begin(), iter), global_index - *iter);
}

unsigned int
dof_id_type
Sampler::getTotalNumberOfRows()
{
if (_total_rows == 0)
reinit(getSamples());
return _total_rows;
}

/**
* Return the number of rows local to this processor.
*/
dof_id_type
Sampler::getLocalNumerOfRows()
{
if (_total_rows == 0)
reinit(getSamples());
return _local_rows;
}

/**
* Return the beginning local row index for this processor
*/
dof_id_type
Sampler::getLocalRowBegin()
{
if (_total_rows == 0)
reinit(getSamples());
return _local_row_begin;
}

/**
* Return the ending local row index for this processor
*/
dof_id_type
Sampler::getLocalRowEnd()
{
if (_total_rows == 0)
reinit(getSamples());
return _local_row_end;
}
@@ -58,8 +58,14 @@ MultiAppTransfer::MultiAppTransfer(const InputParameters & parameters)
_displaced_source_mesh(getParam<bool>("displaced_source_mesh")),
_displaced_target_mesh(getParam<bool>("displaced_target_mesh"))
{
bool check = getParam<bool>("check_multiapp_execute_on");
if (check && (getExecuteOnEnum() != _multi_app->getExecuteOnEnum()))
if (getParam<bool>("check_multiapp_execute_on"))
checkMultiAppExecuteOn();
}

void
MultiAppTransfer::checkMultiAppExecuteOn()
{
if (getExecuteOnEnum() != _multi_app->getExecuteOnEnum())
mooseDoOnce(mooseWarning("MultiAppTransfer execute_on flags do not match associated Multiapp "
"execute_on flags"));
}
@@ -41,4 +41,4 @@ For example, within the [stochastic tools module](stochastic_tools/index.md) the
demonstrates the ability to set input parameters within the sub-applications with values from a
distribution.
!listing master_multiple.i
!listing multiapps/commandline_control/master_multiple.i
Oops, something went wrong.

0 comments on commit 5802927

Please sign in to comment.
You can’t perform that action at this time.