Skip to content

Commit

Permalink
Use field variables in two transfers, add postprocessor FV tests, efs i…
Browse files Browse the repository at this point in the history
  • Loading branch information
GiudGiud committed Nov 6, 2020
1 parent dce7b1a commit eacc0fe
Show file tree
Hide file tree
Showing 16 changed files with 568 additions and 12 deletions.
2 changes: 2 additions & 0 deletions framework/include/problems/FEProblemBase.h
Expand Up @@ -225,6 +225,8 @@ class FEProblemBase : public SubProblem, public Restartable
Moose::VarKindType expected_var_type = Moose::VarKindType::VAR_ANY,
Moose::VarFieldType expected_var_field_type =
Moose::VarFieldType::VAR_FIELD_ANY) const override;
MooseVariableField<Real> &
getActualFieldVariable(THREAD_ID tid, const std::string & var_name);
virtual MooseVariable & getStandardVariable(THREAD_ID tid, const std::string & var_name) override;
virtual VectorMooseVariable & getVectorVariable(THREAD_ID tid,
const std::string & var_name) override;
Expand Down
11 changes: 11 additions & 0 deletions framework/src/problems/FEProblemBase.C
Expand Up @@ -4463,6 +4463,17 @@ FEProblemBase::getStandardVariable(THREAD_ID tid, const std::string & var_name)
return _aux->getFieldVariable<Real>(tid, var_name);
}

MooseVariableField<Real> &
FEProblemBase::getActualFieldVariable(THREAD_ID tid, const std::string & var_name)
{
if (_nl->hasVariable(var_name))
return _nl->getActualFieldVariable<Real>(tid, var_name);
else if (!_aux->hasVariable(var_name))
mooseError("Unknown variable " + var_name);

return _aux->getActualFieldVariable<Real>(tid, var_name);
}

VectorMooseVariable &
FEProblemBase::getVectorVariable(THREAD_ID tid, const std::string & var_name)
{
Expand Down
Expand Up @@ -59,7 +59,7 @@ MultiAppVariableValueSamplePostprocessorTransfer::execute()
case TO_MULTIAPP:
{
FEProblemBase & from_problem = _multi_app->problemBase();
MooseVariable & from_var = from_problem.getStandardVariable(0, _from_var_name);
MooseVariableField<Real> & from_var = from_problem.getActualFieldVariable(0, _from_var_name);
SystemBase & from_system_base = from_var.sys();
SubProblem & from_sub_problem = from_system_base.subproblem();

Expand Down
Expand Up @@ -66,7 +66,7 @@ MultiAppVariableValueSampleTransfer::execute()
case TO_MULTIAPP:
{
FEProblemBase & from_problem = _multi_app->problemBase();
MooseVariable & from_var = from_problem.getStandardVariable(0, _from_var_name);
MooseVariableField<Real> & from_var = from_problem.getActualFieldVariable(0, _from_var_name);
SystemBase & from_system_base = from_var.sys();
SubProblem & from_sub_problem = from_system_base.subproblem();

Expand Down
Expand Up @@ -37,7 +37,7 @@ PFCElementEnergyIntegral::PFCElementEnergyIntegral(const InputParameters & param
_u_dot(_var.uDot()),
_temp(getParam<Real>("temp")) // K
{
addMooseVariableDependency(mooseVariable());
addMooseVariableDependency(&mooseVariableField());
}

Real
Expand Down
Binary file not shown.
@@ -0,0 +1,84 @@
[Mesh]
type = GeneratedMesh
dim = 2
xmin = 0
xmax = 1
ymin = 0
ymax = 1
nx = 4
ny = 4
elem_type = QUAD4
[]

[Variables]
[./u]
order = CONSTANT
family = MONOMIAL
fv = true
initial_condition = 1
[../]
[]

[Functions]
[./force_fn]
type = ParsedFunction
value = '1'
[../]

[./exact_fn]
type = ParsedFunction
value = 't'
[../]
[]

[FVKernels]
[./diff_u]
type = FVDiffusion
variable = u
coeff = '1'
block = '0'
[../]

[./ffn_u]
type = FVBodyForce
variable = u
function = force_fn
[../]
[]

[FVBCs]
[./all_u]
type = FVFunctionDirichletBC
variable = u
boundary = '0 1 2 3'
function = exact_fn
[../]
[]

[Postprocessors]
[./a]
type = ElementIntegralVariablePostprocessor
variable = u
execute_on = 'initial timestep_end'
[../]

[./total_a]
type = TotalVariableValue
value = a
execute_on = 'initial timestep_end'
[../]
[]

[Problem]
kernel_coverage_check = false
[]

[Executioner]
type = Steady
solve_type = 'PJFNK'
[]

[Outputs]
execute_on = 'timestep_end'
exodus = true
[]
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,172 @@
[Mesh]
[gen]
type = GeneratedMeshGenerator
dim = 2
nx = 6
xmax = 3
ny = 9
ymax = 3
elem_type = QUAD4
[]
[./subdomain_id]
input = gen
type = SubdomainBoundingBoxGenerator
bottom_left = '0 0 0'
top_right = '2 1 0'
block_id = 1
[../]
[./interface]
input = subdomain_id
type = SideSetsBetweenSubdomainsGenerator
primary_block = '0'
paired_block = '1'
new_boundary = 'interface'
[../]
[]

[Functions]
[./fn_exact]
type = ParsedFunction
value = 'x*x+y*y'
[../]

[./ffn]
type = ParsedFunction
value = -4
[../]
[]

[Variables]
[./u]
family = MONOMIAL
order = CONSTANT
fv = true
[../]
[]


[FVKernels]
[./diff]
type = FVDiffusion
variable = u
coeff = '1'
[../]

[./ffn]
type = FVBodyForce
variable = u
function = ffn
[../]
[]

[FVBCs]
[./all]
type = FVFunctionDirichletBC
variable = u
boundary = '0 1 2 3'
function = fn_exact
[../]
[]

[Materials]
[./stateful1]
type = StatefulMaterial
block = 0
initial_diffusivity = 5
[../]
[./stateful2]
type = StatefulMaterial
block = 1
initial_diffusivity = 2
[../]
[]

[AuxKernels]
[./diffusivity_1]
type = MaterialRealAux
property = diffusivity
variable = diffusivity_1
[]
[./diffusivity_2]
type = MaterialRealAux
property = diffusivity
variable = diffusivity_2
[]
[]

[AuxVariables]
[./diffusivity_1]
family = MONOMIAL
order = CONSTANT
[]
[./diffusivity_2]
family = MONOMIAL
order = CONSTANT
[]
[]



[Postprocessors]
[./diffusivity_average]
type = InterfaceAverageVariableValuePostprocessor
interface_value_type = average
variable = diffusivity_1
neighbor_variable = diffusivity_2
execute_on = TIMESTEP_END
boundary = 'interface'
[../]
[./diffusivity_jump_primary_secondary]
type = InterfaceAverageVariableValuePostprocessor
interface_value_type = jump_primary_minus_secondary
variable = diffusivity_1
neighbor_variable = diffusivity_2
execute_on = TIMESTEP_END
boundary = 'interface'
[../]
[./diffusivity_jump_secondary_primary]
type = InterfaceAverageVariableValuePostprocessor
interface_value_type = jump_secondary_minus_primary
variable = diffusivity_1
neighbor_variable = diffusivity_2
execute_on = TIMESTEP_END
boundary = 'interface'
[../]
[./diffusivity_jump_abs]
type = InterfaceAverageVariableValuePostprocessor
interface_value_type = jump_abs
variable = diffusivity_1
neighbor_variable = diffusivity_2
execute_on = TIMESTEP_END
boundary = 'interface'
[../]
[./diffusivity_primary]
type = InterfaceAverageVariableValuePostprocessor
interface_value_type = primary
variable = diffusivity_1
neighbor_variable = diffusivity_2
execute_on = TIMESTEP_END
boundary = 'interface'
[../]
[./diffusivity_secondary]
type = InterfaceAverageVariableValuePostprocessor
interface_value_type = secondary
variable = diffusivity_1
neighbor_variable = diffusivity_2
execute_on = TIMESTEP_END
boundary = 'interface'
[../]
[]

[Problem]
kernel_coverage_check = false
[]

[Executioner]
type = Steady
solve_type = NEWTON
[]

[Outputs]
exodus = true
[]

0 comments on commit eacc0fe

Please sign in to comment.