Dear Yves, dear Getfem users

I was wondering about the general strategy for first order transient
problems in Getfem.
If some problem is described by

    C*du/dt + K*u = RHS

then something like K is conveniently taken into account with time
dispatchers (either theta or midpoint).
What I don't understand is the general strategy for an arbitrary C brick.
Getfem has functionality like add_basic_d_on_dt_brick.
But this function is specific to a mass matrix. I find it a bit not general
enough to build a brick for every C like matrix.

The manual on time dispatchers also says that
"The same brick as for the [image: \theta]-method can be used to represent
a first order time derivative."
but I"m not completely sure how this can be achieved. In the beginning I
thought that I can create a list of
bricks that go into C and pass them to

 getfem::add_theta_method_dispatcher(model,transient_bricks_derivative,"1/dt");
but this is not entirely correct, because in that case Getfem will be
setting the coefficients like this:

      md.matrix_coeff_of_brick(ib) = 1/dT;
      md.rhs_coeffs_of_brick(ib)[0] = 1/dT;
      md.rhs_coeffs_of_brick(ib)[1] = *1- 1/dT*;

while I need something like this:

      md.matrix_coeff_of_brick(ib) = 1/dT;
      md.rhs_coeffs_of_brick(ib)[0] = 1/dT;
      md.rhs_coeffs_of_brick(ib)[1] = *- 1/dT*;

Well, this is all easy to solve by creating another dispatcher which allows
me
to add any C-like brick (which is being multiplied by first order
derivative du/dt )
(I used this solution to develop poroelastic formulation for
structural-flow coupling)

struct first_order_derivative_dispatcher: public theta_method_dispatcher{
    void set_dispatch_coeff(const model &md, size_type ib) const {
      scalar_type dt;
      if (md.is_complex())
        dt = gmm::real(md.complex_variable(param_names[0])[0]);
      else
        dt = md.real_variable(param_names[0])[0];
      md.matrix_coeff_of_brick(ib) = 1.0/dt;
      md.rhs_coeffs_of_brick(ib)[0] = 1.0/dt;
      md.rhs_coeffs_of_brick(ib)[1] = -1.0/dt;
    }

  void add_first_order_derivative_dispatcher
  (model &md, dal::bit_vector ibricks, const std::string &dt) {
    pdispatcher pdispatch = new first_order_derivative_dispatcher(dt);
    for (dal::bv_visitor i(ibricks); !i.finished(); ++i)
      md.add_time_dispatcher(i, pdispatch);
  }


but I resent the fact if I might be re-inventing a wheel in this case.

Thanks in advance,
                               Andriy
_______________________________________________
Getfem-users mailing list
[email protected]
https://mail.gna.org/listinfo/getfem-users

Reply via email to