Step-29

28 views
Skip to first unread message

Muhammad Adil

unread,
Aug 16, 2019, 3:01:05 AM8/16/19
to deal.II User Group
Accroding to my understanding:
When we get the solution of Helmoltz equation using the function UltrasoundProblem<dim>::solve ()

template <int dim>
void UltrasoundProblem<dim>::solve ()
{
deallog << "Solving linear system... ";
Timer timer;
timer.start ();
A_direct.initialize(system_matrix);
A_direct.vmult (solution, system_rhs);
timer.stop ();
deallog << "done ("
<< timer ()
<< "s)"
<< std::endl;
}

The output solution will be alpha and Beta from the function UltrasoundProblem<dim>::solve ().  It will become of the input of the class
class ComputeIntensity : public DataPostprocessorScalar<dim>.
Using this class we will calculate the uh, duh, dduh etc.
Anyone can explain to me how it is calculating the uh? I don't understand what is the input to this class after calculating the coeeficients Alpha nad Beta in the tutorial.

template <int dim>
class ComputeIntensity : public DataPostprocessorScalar<dim>
{
public:
ComputeIntensity ();
virtual
void
const std::vector<std::vector<Tensor<1, dim> > > &duh,
const std::vector<std::vector<Tensor<2, dim> > > &dduh,
const std::vector<Point<dim> > &normals,
const std::vector<Point<dim> > &evaluation_points,
std::vector<Vector<double> > &computed_quantities) const;
};
template <int dim>
ComputeIntensity<dim>::ComputeIntensity ()
:
DataPostprocessorScalar<dim> ("Intensity",
{}
template <int dim>
void
ComputeIntensity<dim>::compute_derived_quantities_vector (
const std::vector<Vector<double> > &uh,
const std::vector<std::vector<Tensor<1, dim> > > & /*duh*/,
const std::vector<std::vector<Tensor<2, dim> > > & /*dduh*/,
const std::vector<Point<dim> > & /*normals*/,
const std::vector<Point<dim> > & /*evaluation_points*/,
std::vector<Vector<double> > &computed_quantities
) const
{
Assert(computed_quantities.size() == uh.size(),
ExcDimensionMismatch (computed_quantities.size(), uh.size()));
for (unsigned int i=0; i<computed_quantities.size(); i++)
{
Assert(computed_quantities[i].size() == 1,
ExcDimensionMismatch (computed_quantities[i].size(), 1));
Assert(uh[i].size() == 2, ExcDimensionMismatch (uh[i].size(), 2));
computed_quantities[i](0) = std::sqrt(uh[i](0)*uh[i](0) + uh[i](1)*uh[i](1));
}
}

Wolfgang Bangerth

unread,
Aug 17, 2019, 7:00:53 PM8/17/19
to dea...@googlegroups.com

Muhammad,

> When we get the solution of Helmoltz equation using the function
> UltrasoundProblem<dim>::solve ()
> [...]
>
> The output solution will be alpha and Beta from the function
> UltrasoundProblem<dim>::solve (). It will become of the input of the class
> class ComputeIntensity : public DataPostprocessorScalar
> <https://www.dealii.org/8.3.0/doxygen/deal.II/classDataPostprocessorScalar.html><dim>.
> Using this class we will calculate the uh, duh, dduh etc.
> Anyone can explain to me how it is calculating the uh? I don't understand what
> is the input to this class after calculating the coeeficients Alpha nad Beta
> in the tutorial.

The input uh to ComputeIntensity::compute_derived_quantities_vector() *is* the
solution at the points where we want to create output. You don't need to
compute it.

uh is of type std::vector<Vector<double> >. Specifically, the outer vector is
over all of the points on one cell where we want to create output; the inner
vector will, in your case, have size 2 and contain the pairs {alpha, beta} at
the output point.

I hope this makes it clear why the implementation of the function makes sense!

Best
W.


--
------------------------------------------------------------------------
Wolfgang Bangerth email: bang...@colostate.edu
www: http://www.math.colostate.edu/~bangerth/

Muhammad Adil

unread,
Aug 18, 2019, 4:46:28 AM8/18/19
to dea...@googlegroups.com
Thank you Wolfgang Bangerth:
It means if I want to use duh, dduh or normal etc I don't need to compute just update the flags using get_needed_update_flags().
Please respond on this.

--
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see https://groups.google.com/d/forum/dealii?hl=en
---
You received this message because you are subscribed to the Google Groups "deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dealii+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dealii/40516218-b971-948b-3ed4-867508bbea67%40colostate.edu.

Wolfgang Bangerth

unread,
Aug 18, 2019, 10:24:06 PM8/18/19
to dea...@googlegroups.com
On 8/18/19 2:46 AM, Muhammad Adil wrote:
> It means if I want to use duh, dduh or normal etc I don't need to compute just
> update the flags using get_needed_update_flags().

Yes, that is correct!
Reply all
Reply to author
Forward
0 new messages