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

Additional Stokes RHS #1547

Merged
merged 1 commit into from May 11, 2017
Merged

Conversation

tjhei
Copy link
Member

@tjhei tjhei commented May 9, 2017

Latest idea on how to do force vector for the Stokes system.

supersedes #1300

@bangerth bangerth mentioned this pull request May 9, 2017
@bangerth
Copy link
Contributor

bangerth commented May 9, 2017

Can you update the test?

@@ -711,6 +711,9 @@ namespace aspect
public SimulatorAccess<dim>
{
public:

virtual void create_additional_material_model_outputs(MaterialModel::MaterialModelOutputs<dim> &outputs) const;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's this function gonna do?

* dim components for velocity, 1 component for pressure, 1 component
* for compaction pressure (if melt transport is enabled).
*/
std::vector<std::vector<double> > rhs;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You call this class StokesRHS, so I suspect that the force terms should be Tensor<1,dim> objects, assuming you're talking about the force balance equation. If you want additional terms for the mass balance equation, maybe have another std::vector<double>.

If you really wanted to be generic and add terms for other equations as well, I would suggest to not document the order here, but use the same ordering as used by the introspection object (to which both the material models and assemblers have access).

create_additional_material_model_outputs(MaterialModel::MaterialModelOutputs<dim> &outputs) const
{
if (this->get_parameters().enable_additional_stokes_rhs
&& !outputs.template get_additional_output<MaterialModel::AdditionalMaterialOutputsStokesRHS<dim> >())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll keep fighting against using operator ! to compare pointers for non-Null-ness till I die! :-)

Please write the second condition as

         && (outputs.template get_additional_output<MaterialModel::AdditionalMaterialOutputsStokesRHS<dim> >() != NULL)

or similar.

{
public:
AdditionalMaterialOutputsStokesRHS(const unsigned int n_points,
const unsigned int n_stokes_components)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how could n_stokes_components ever be different than dim+1?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Normally dim+1 but dim+2 if you have melt transport enabled. That is also the reason I did not want to use

Tensor<1,dim> u;
double p;
double p_c;

or something of that matter.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But then it's not just Stokes but everything.

@@ -113,6 +130,9 @@ namespace aspect
const unsigned int stokes_dofs_per_cell = data.local_dof_indices.size();
const unsigned int n_q_points = scratch.finite_element_values.n_quadrature_points;

MaterialModel::AdditionalMaterialOutputsStokesRHS<dim>
*force = scratch.material_model_outputs.template get_additional_output<MaterialModel::AdditionalMaterialOutputsStokesRHS<dim> >();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make it const.

@@ -88,6 +89,17 @@ namespace aspect
MeltEquations<dim>::create_additional_material_model_outputs(MaterialModel::MaterialModelOutputs<dim> &outputs) const
{
MeltHandler<dim>::create_material_model_outputs(outputs);

if (this->get_parameters().enable_additional_stokes_rhs
&& !outputs.template get_additional_output<MaterialModel::AdditionalMaterialOutputsStokesRHS<dim> >())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

&& !outputs.template get_additional_output<MaterialModel::AdditionalMaterialOutputsStokesRHS<dim> >())
{
const unsigned int n_points = outputs.viscosities.size();
const unsigned int n_stokes_comp = dim + 2;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why this many?

@@ -215,6 +227,8 @@ namespace aspect
const unsigned int p_c_component_index = introspection.variable("compaction pressure").first_component_index;

MaterialModel::MeltOutputs<dim> *melt_outputs = scratch.material_model_outputs.template get_additional_output<MaterialModel::MeltOutputs<dim> >();
MaterialModel::AdditionalMaterialOutputsStokesRHS<dim>
*force = scratch.material_model_outputs.template get_additional_output<MaterialModel::AdditionalMaterialOutputsStokesRHS<dim> >();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make const.

: std::numeric_limits<double>::quiet_NaN();
const double force_pc = (force!=NULL) ?
force->rhs[q][dim+1]
: std::numeric_limits<double>::quiet_NaN();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

signaling NaN?

"Whether to ask the material model for additional terms for the right-hand side "
"of the Stokes equation. This can be used to implement force vectors for "
"manufactured solution problems. The assembler for the Stokes system will "
"create an additional output of type AdditionalMaterialOutputsStokesRHS.");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the last sentence seems like a very detailed description of internals. there are many levels of knowledge to reach for a user to understand what this means.

@tjhei tjhei force-pushed the force_vector_the_return branch 2 times, most recently from 05f36fc to 4d1c692 Compare May 10, 2017 19:00
@tjhei
Copy link
Member Author

tjhei commented May 10, 2017

okay, ready for another round!

Copy link
Member Author

@tjhei tjhei left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is @bangerth commenting on @tjhei's computer: all fine to merge if you can add the assertion.

const FullMatrix<double> &/*projection_matrix*/,
const FullMatrix<double> &/*expansion_matrix*/)
{
// TODO: not implemented
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need assert

@tjhei
Copy link
Member Author

tjhei commented May 11, 2017

W writing: After further consideration, I'm merging from @tjhei's computer. The assertion cannot be added because the function is actually called.

@tjhei tjhei merged commit 1ed2a12 into geodynamics:master May 11, 2017
@tjhei tjhei deleted the force_vector_the_return branch May 11, 2017 02:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants