Commit e30b0b3b authored by Cody Permann's avatar Cody Permann

Transfer from Nek probably working

parent b2b78c46
......@@ -51,7 +51,7 @@
[Kernels]
[./HeatSource]
type = HeatSource
function = '1.0'
function = '100.0'
variable = temp
[../]
[./HeatDiff]
......@@ -294,6 +294,7 @@
[Outputs]
exodus = true
csv = true
print_perf_log = true
[]
......@@ -308,11 +309,19 @@
[]
[Transfers]
[./u_to_sub]
[./to_nek]
type = MultiAppPolynomialToNek
direction = to_multiapp
multi_app = sub
source_variable = 'heat_flux_scalar_f_0_l heat_flux_scalar_f_1_l'
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
void FORTRAN_CALL(nek_init_step)();
void FORTRAN_CALL(nek_step)();
void FORTRAN_CALL(nek_finalize_step)();
void FORTRAN_CALL(nek_expansion)();
}
}
......
......@@ -58,7 +58,7 @@ MultiAppPolynomialToNek::execute()
_console << _source_variable_names[i] << '\n';
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] << ' ';
Nek5000::expansion_fcoef_.coeff_fij[i*100+j] = solution_values[j];
......@@ -73,29 +73,38 @@ MultiAppPolynomialToNek::execute()
// SubApp -> MasterApp
case FROM_MULTIAPP:
{
FORTRAN_CALL(Nek5000::nek_expansion)();
// The number of sub applications
unsigned int num_apps = _multi_app->numGlobalApps();
// // The AuxVariable for storing the postprocessor values from the sub app
// MooseVariableScalar & scalar = _multi_app->problem().getScalarVariable(_tid, _to_aux_name);
//
// // Ensure that the variable is up to date
// scalar.reinit();
//
// // The dof indices for the scalar variable of interest
// std::vector<dof_id_type> & dof = scalar.dofIndices();
//
std::vector<MooseVariableScalar *> to_variables(_to_aux_names.size());
for (auto i = beginIndex(_to_aux_names); i < _to_aux_names.size(); ++i)
{
to_variables[i] = &_multi_app->problem().getScalarVariable(_tid, _to_aux_names[i]);
to_variables[i]->reinit();
}
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
// 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() << ")");
//
// // Loop over each sub-app and populate the AuxVariable values from the postprocessors
// for (unsigned int i=0; i<_multi_app->numGlobalApps(); i++)
// Loop over each sub-app and populate the AuxVariable values from the postprocessors
// for (unsigned int i=0; i<_multi_app->numGlobalApps(); i++)
// 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.
// scalar.sys().solution().set(dof[i], _multi_app->appProblem(i).getPostprocessorValue(_from_pp_name));
//
// scalar.sys().solution().close();
// Note: This can't be done using MooseScalarVariable::insert() because different processors will be setting dofs separately.
auto & solution_values = to_variables[i]->sln();
for (auto j = beginIndex(solution_values); j < solution_values.size(); ++j)
{
to_variables[i]->sys().solution().set(dof[j], Nek5000::expansion_tcoef_.coeff_tij[i*100+j]);
to_variables[i]->sys().solution().close();
}
}
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