Skip to content

Commit

Permalink
Merge pull request #6008 from bobmyhill/move_eta_averaging
Browse files Browse the repository at this point in the history
move viscosity averaging function
  • Loading branch information
bobmyhill authored Aug 21, 2024
2 parents 5148ea0 + f2c8f6c commit a3f187a
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 30 deletions.
12 changes: 11 additions & 1 deletion include/aspect/material_model/interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -754,8 +754,18 @@ namespace aspect
const FullMatrix<double> &projection_matrix,
const FullMatrix<double> &expansion_matrix,
std::vector<double> &values_out);
}

/**
* Parse an AveragingOperation and alias to an AveragingOperation
* that only averages viscosity. If the input to this function is an
* AveragingOperation that averages all properties
* (e.g. 'harmonic_average'), the function returns the corresponding
* AveragingOperation that only operates on the viscosity
* (e.g. 'harmonic_average_only_viscosity'). This is useful in places
* where averaging is performed on only the viscosity property.
*/
AveragingOperation get_averaging_operation_for_viscosity(const AveragingOperation operation);
}

/**
* Some material and heating models need more than just the basic material
Expand Down
27 changes: 27 additions & 0 deletions source/material_model/interface.cc
Original file line number Diff line number Diff line change
Expand Up @@ -916,6 +916,33 @@ namespace aspect
for (unsigned int i=0; i<values_out.additional_outputs.size(); ++i)
values_out.additional_outputs[i]->average (operation, projection_matrix, expansion_matrix);
}



AveragingOperation
get_averaging_operation_for_viscosity(const AveragingOperation operation)
{
AveragingOperation operation_for_viscosity = operation;
switch (operation)
{
case harmonic_average:
operation_for_viscosity = harmonic_average_only_viscosity;
break;

case geometric_average:
operation_for_viscosity = geometric_average_only_viscosity;
break;

case project_to_Q1:
operation_for_viscosity = project_to_Q1_only_viscosity;
break;

default:
operation_for_viscosity = operation;
}

return operation_for_viscosity;
}
}


Expand Down
29 changes: 0 additions & 29 deletions source/material_model/rheology/elasticity.cc
Original file line number Diff line number Diff line change
Expand Up @@ -244,35 +244,6 @@ namespace aspect
}


namespace
{
MaterialAveraging::AveragingOperation
get_averaging_operation_for_viscosity(const MaterialAveraging::AveragingOperation operation)
{
MaterialAveraging::AveragingOperation operation_for_viscosity = operation;
switch (operation)
{
case MaterialAveraging::harmonic_average:
operation_for_viscosity = MaterialAveraging::harmonic_average_only_viscosity;
break;

case MaterialAveraging::geometric_average:
operation_for_viscosity = MaterialAveraging::geometric_average_only_viscosity;
break;

case MaterialAveraging::project_to_Q1:
operation_for_viscosity = MaterialAveraging::project_to_Q1_only_viscosity;
break;

default:
operation_for_viscosity = operation;
}

return operation_for_viscosity;
}
}



template <int dim>
void
Expand Down

0 comments on commit a3f187a

Please sign in to comment.