Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
giraffe
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
3
Issues
3
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nek5000
giraffe
Commits
21bd7fcb
Commit
21bd7fcb
authored
Oct 19, 2016
by
Cody Permann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Checking in start of NekTransfer
parent
ed7b5f5a
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
140 additions
and
15 deletions
+140
-15
examples/integration_example/coefficient_integration.i
examples/integration_example/coefficient_integration.i
+3
-11
include/transfers/MultiAppPolynomialToNek.h
include/transfers/MultiAppPolynomialToNek.h
+32
-0
src/base/MoonApp.C
src/base/MoonApp.C
+5
-4
src/transfers/MultiAppPolynomialToNek.C
src/transfers/MultiAppPolynomialToNek.C
+100
-0
No files found.
examples/integration_example/coefficient_integration.i
View file @
21bd7fcb
...
...
@@ -309,18 +309,10 @@
[
Transfers
]
[
.
/
u_to_sub
]
type
=
MultiApp
NearestNodeTransfer
type
=
MultiApp
PolynomialToNek
direction
=
to_multiapp
multi_app
=
sub
source_variable
=
u
variable
=
aux
[
..
/
]
[
.
/
u_from_sub
]
type
=
MultiAppNearestNodeTransfer
direction
=
from_multiapp
multi_app
=
sub
source_variable
=
u
variable
=
aux
source_variable
=
'
heat_flux_scalar_f_0_l
heat_flux_scalar_f_1_l
'
to_aux_scalar
=
'
foo
'
[
..
/
]
[]
include/transfers/MultiAppPolynomialToNek.h
0 → 100644
View file @
21bd7fcb
#ifndef MULTIAPPPOLYNOMIALTONEK_H
#define MULTIAPPPOLYNOMIALTONEK_H
// MOOSE includes
#include "MultiAppTransfer.h"
// Forward declerations
class
MultiAppPolynomialToNek
;
template
<
>
InputParameters
validParams
<
MultiAppPolynomialToNek
>
();
/**
* Copies the value of a Postprocessor from one app to a scalar AuxVariable in another.
*/
class
MultiAppPolynomialToNek
:
public
MultiAppTransfer
{
public:
MultiAppPolynomialToNek
(
const
InputParameters
&
parameters
);
/**
* Execute the transfer
*/
virtual
void
execute
()
override
;
protected:
std
::
vector
<
VariableName
>
_source_variable_names
;
std
::
vector
<
VariableName
>
_to_aux_names
;
};
#endif
/* MULTIAPPPOLYNOMIALTONEK_H */
src/base/MoonApp.C
View file @
21bd7fcb
...
...
@@ -21,6 +21,7 @@
#include "MoonRevision.h"
#include "NekExecutioner.h"
#include "NekTimeStepper.h"
#include "MultiAppPolynomialToNek.h"
template
<>
InputParameters
validParams
<
MoonApp
>
()
...
...
@@ -75,19 +76,19 @@ extern "C" void MoonApp__registerObjects(Factory & factory) { MoonApp::registerO
void
MoonApp
::
registerObjects
(
Factory
&
factory
)
{
// AuxKernels registration
registerAuxKernel
(
CoupledGradAux
);
// Functions registration
registerFunction
(
LegendrePolynomial
);
registerFunction
(
FourierPolynomial
);
registerFunction
(
FourierLegendreReconstruction
);
// UserObjects registration
registerUserObject
(
NekSideIntegralVariableUserObject
);
registerExecutioner
(
NekExecutioner
);
registerTimeStepper
(
NekTimeStepper
);
registerTransfer
(
MultiAppPolynomialToNek
);
}
// External entry point for dynamic syntax association
...
...
src/transfers/MultiAppPolynomialToNek.C
0 → 100644
View file @
21bd7fcb
#include "MultiAppPolynomialToNek.h"
// MOOSE includes
#include "MooseTypes.h"
#include "FEProblem.h"
#include "MultiApp.h"
// libMesh includes
#include "libmesh/meshfree_interpolation.h"
#include "libmesh/system.h"
// Define the input parameters
template
<>
InputParameters
validParams
<
MultiAppPolynomialToNek
>
()
{
InputParameters
params
=
validParams
<
MultiAppTransfer
>
();
params
.
addRequiredParam
<
std
::
vector
<
VariableName
>
>
(
"source_variable"
,
"The auxiliary scalar variable to read values from"
);
params
.
addRequiredParam
<
std
::
vector
<
VariableName
>
>
(
"to_aux_scalar"
,
"The name of the scalar Aux variable in the MultiApp to transfer the value to."
);
return
params
;
}
MultiAppPolynomialToNek
::
MultiAppPolynomialToNek
(
const
InputParameters
&
parameters
)
:
MultiAppTransfer
(
parameters
),
_source_variable_names
(
getParam
<
std
::
vector
<
VariableName
>
>
(
"source_variable"
)),
_to_aux_names
(
getParam
<
std
::
vector
<
VariableName
>
>
(
"to_aux_scalar"
))
{
}
void
MultiAppPolynomialToNek
::
execute
()
{
_console
<<
"Beginning PolynomialToNekTransfer "
<<
name
()
<<
std
::
endl
;
// Perform action based on the transfer direction
switch
(
_direction
)
{
// MasterApp -> SubApp
case
TO_MULTIAPP
:
{
FEProblem
&
from_problem
=
_multi_app
->
problem
();
std
::
vector
<
MooseVariableScalar
*>
source_variables
(
_source_variable_names
.
size
());
for
(
auto
i
=
beginIndex
(
_source_variable_names
);
i
<
_source_variable_names
.
size
();
++
i
)
{
source_variables
[
i
]
=
&
from_problem
.
getScalarVariable
(
_tid
,
_source_variable_names
[
i
]);
source_variables
[
i
]
->
reinit
();
}
// Loop through each of the sub apps
for
(
unsigned
int
i
=
0
;
i
<
_multi_app
->
numGlobalApps
();
i
++
)
if
(
_multi_app
->
hasLocalApp
(
i
))
{
// TODO: Access Nek Common blocks and write values
for
(
auto
i
=
beginIndex
(
_source_variable_names
);
i
<
_source_variable_names
.
size
();
++
i
)
{
_console
<<
_source_variable_names
[
i
]
<<
'\n'
;
auto
&
solution_values
=
source_variables
[
i
]
->
sln
();
for
(
auto
j
=
beginIndex
(
solution_values
);
j
<
solution_values
.
size
();
++
j
)
_console
<<
solution_values
[
j
]
<<
' '
;
_console
<<
'\n'
;
}
}
break
;
}
// SubApp -> MasterApp
case
FROM_MULTIAPP
:
{
// 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();
//
// // 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++)
// 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();
break
;
}
}
_console
<<
"Finished PolynomialToNekTransfer"
<<
name
()
<<
std
::
endl
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment