Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

move viscosity averaging function #6008

Merged
merged 2 commits into from
Aug 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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