{"action":"opened","issue":{"url":"https://api.github.com/repos/geodynamics/aspect/issues/589","labels_url":"https://api.github.com/repos/geodynamics/aspect/issues/589/labels{/name}","comments_url":"https://api.github.com/repos/geodynamics/aspect/issues/589/comments","events_url":"https://api.github.com/repos/geodynamics/aspect/issues/589/events","html_url":"https://github.com/geodynamics/aspect/issues/589","id":103069610,"number":589,"title":"Fix sinking velocity depth average","user":{"login":"bangerth","id":7504421,"avatar_url":"https://avatars.githubusercontent.com/u/7504421?v=3","gravatar_id":"","url":"https://api.github.com/users/bangerth","html_url":"https://github.com/bangerth","followers_url":"https://api.github.com/users/bangerth/followers","following_url":"https://api.github.com/users/bangerth/following{/other_user}","gists_url":"https://api.github.com/users/bangerth/gists{/gist_id}","starred_url":"https://api.github.com/users/bangerth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bangerth/subscriptions","organizations_url":"https://api.github.com/users/bangerth/orgs","repos_url":"https://api.github.com/users/bangerth/repos","events_url":"https://api.github.com/users/bangerth/events{/privacy}","received_events_url":"https://api.github.com/users/bangerth/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-08-25T16:47:37Z","updated_at":"2015-08-25T16:47:37Z","closed_at":null,"body":"As noticed in #569, the sinking velocity depth average unconditionally multiplies by `year_in_seconds`:\r\n```\r\n    template <int dim>\r\n    class FunctorDepthAverageSinkingVelocity\r\n    {\r\n      public:\r\n        FunctorDepthAverageSinkingVelocity(const FEValuesExtractors::Vector &field, GravityModel::Interface<dim> *gravity)\r\n          : field_(field), gravity_(gravity) {}\r\n\r\n        bool need_material_properties() const\r\n        {\r\n          // this is needed because we want to access in.position in operator()\r\n          return true;\r\n        }\r\n\r\n        void setup(const unsigned int q_points)\r\n        {\r\n          velocity_values.resize(q_points);\r\n        }\r\n\r\n        void operator()(const MaterialModel::MaterialModelInputs<dim> &in,\r\n                        const MaterialModel::MaterialModelOutputs<dim> &,\r\n                        FEValues<dim> &fe_values,\r\n                        const LinearAlgebra::BlockVector &solution,\r\n                        std::vector<double> &output)\r\n        {\r\n          fe_values[field_].get_function_values (solution, velocity_values);\r\n          for (unsigned int q=0; q<output.size(); ++q)\r\n            {\r\n              const Tensor<1,dim> g = gravity_->gravity_vector(in.position[q]);\r\n              const Tensor<1,dim> vertical = (g.norm() > 0 ? g/g.norm() : Tensor<1,dim>());\r\n\r\n              output[q] = std::fabs(std::min(0.0, velocity_values[q] * vertical))*year_in_seconds;\r\n            }\r\n        }\r\n```\r\nThis should be made conditional on whether we actually do want to output in years or seconds."}}