Commit e30b0b3b authored by Cody Permann's avatar Cody Permann

Transfer from Nek probably working

parent b2b78c46
...@@ -51,7 +51,7 @@ ...@@ -51,7 +51,7 @@
[Kernels] [Kernels]
[./HeatSource] [./HeatSource]
type = HeatSource type = HeatSource
function = '1.0' function = '100.0'
variable = temp variable = temp
[../] [../]
[./HeatDiff] [./HeatDiff]
...@@ -294,6 +294,7 @@ ...@@ -294,6 +294,7 @@
[Outputs] [Outputs]
exodus = true exodus = true
csv = true
print_perf_log = true print_perf_log = true
[] []
...@@ -308,11 +309,19 @@ ...@@ -308,11 +309,19 @@
[] []
[Transfers] [Transfers]
[./u_to_sub] [./to_nek]
type = MultiAppPolynomialToNek type = MultiAppPolynomialToNek
direction = to_multiapp direction = to_multiapp
multi_app = sub multi_app = sub
source_variable = 'heat_flux_scalar_f_0_l heat_flux_scalar_f_1_l' source_variable = 'heat_flux_scalar_f_0_l heat_flux_scalar_f_1_l'
to_aux_scalar = 'foo' to_aux_scalar = 'foo'
[../] [../]
[./from_nek]
type = MultiAppPolynomialToNek
direction = from_multiapp
multi_app = sub
source_variable = 'foo'
to_aux_scalar = 'temp_bc_scalar_f_0_l temp_bc_scalar_f_1_l'
[../]
[] []
...@@ -65,6 +65,7 @@ namespace Nek5000 ...@@ -65,6 +65,7 @@ namespace Nek5000
void FORTRAN_CALL(nek_init_step)(); void FORTRAN_CALL(nek_init_step)();
void FORTRAN_CALL(nek_step)(); void FORTRAN_CALL(nek_step)();
void FORTRAN_CALL(nek_finalize_step)(); void FORTRAN_CALL(nek_finalize_step)();
void FORTRAN_CALL(nek_expansion)();
} }
} }
......
...@@ -58,7 +58,7 @@ MultiAppPolynomialToNek::execute() ...@@ -58,7 +58,7 @@ MultiAppPolynomialToNek::execute()
_console << _source_variable_names[i] << '\n'; _console << _source_variable_names[i] << '\n';
auto & solution_values = source_variables[i]->sln(); auto & solution_values = source_variables[i]->sln();
for (auto j = beginIndex(solution_values); j < solution_values.size(); ++j) for (auto j = beginIndex(solution_values); j < solution_values.size(); ++j)
{ {
_console << solution_values[j] << ' '; _console << solution_values[j] << ' ';
Nek5000::expansion_fcoef_.coeff_fij[i*100+j] = solution_values[j]; Nek5000::expansion_fcoef_.coeff_fij[i*100+j] = solution_values[j];
...@@ -73,29 +73,38 @@ MultiAppPolynomialToNek::execute() ...@@ -73,29 +73,38 @@ MultiAppPolynomialToNek::execute()
// SubApp -> MasterApp // SubApp -> MasterApp
case FROM_MULTIAPP: case FROM_MULTIAPP:
{ {
FORTRAN_CALL(Nek5000::nek_expansion)();
// The number of sub applications // The number of sub applications
unsigned int num_apps = _multi_app->numGlobalApps(); unsigned int num_apps = _multi_app->numGlobalApps();
// // The AuxVariable for storing the postprocessor values from the sub app std::vector<MooseVariableScalar *> to_variables(_to_aux_names.size());
// MooseVariableScalar & scalar = _multi_app->problem().getScalarVariable(_tid, _to_aux_name); for (auto i = beginIndex(_to_aux_names); i < _to_aux_names.size(); ++i)
// {
// // Ensure that the variable is up to date to_variables[i] = &_multi_app->problem().getScalarVariable(_tid, _to_aux_names[i]);
// scalar.reinit(); to_variables[i]->reinit();
// }
// // The dof indices for the scalar variable of interest
// std::vector<dof_id_type> & dof = scalar.dofIndices(); for (auto i = beginIndex(_to_aux_names); i < _to_aux_names.size(); ++i)
// {
// The dof indices for the scalar variable of interest
std::vector<dof_id_type> & dof = to_variables[i]->dofIndices();
// // Error if there is a size mismatch between the scalar AuxVariable and the number of sub apps // // Error if there is a size mismatch between the scalar AuxVariable and the number of sub apps
// if (num_apps != scalar.sln().size()) // if (num_apps != scalar.sln().size())
// mooseError("The number of sub apps (" << num_apps << ") must be equal to the order of the scalar AuxVariable (" << scalar.order() << ")"); // mooseError("The number of sub apps (" << num_apps << ") must be equal to the order of the scalar AuxVariable (" << scalar.order() << ")");
//
// // Loop over each sub-app and populate the AuxVariable values from the postprocessors // Loop over each sub-app and populate the AuxVariable values from the postprocessors
// for (unsigned int i=0; i<_multi_app->numGlobalApps(); i++) // for (unsigned int i=0; i<_multi_app->numGlobalApps(); i++)
// if (_multi_app->hasLocalApp(i) && _multi_app->isRootProcessor()) // if (_multi_app->hasLocalApp(i) && _multi_app->isRootProcessor())
// // Note: This can't be done using MooseScalarVariable::insert() because different processors will be setting dofs separately. // Note: This can't be done using MooseScalarVariable::insert() because different processors will be setting dofs separately.
// scalar.sys().solution().set(dof[i], _multi_app->appProblem(i).getPostprocessorValue(_from_pp_name)); auto & solution_values = to_variables[i]->sln();
// for (auto j = beginIndex(solution_values); j < solution_values.size(); ++j)
// scalar.sys().solution().close(); {
to_variables[i]->sys().solution().set(dof[j], Nek5000::expansion_tcoef_.coeff_tij[i*100+j]);
to_variables[i]->sys().solution().close();
}
}
break; break;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment