5 #ifndef COUPLEDELEMENT_H
6 #define COUPLEDELEMENT_H
17 #ifndef VCOUPLEDELEMENT_H
18 #define VCOUPLEDELEMENT_H
27 template<
class ELEMENT>
82 const unsigned DIM = this->dim();
93 unsigned n_intpt = this->integral_pt()->nweight();
99 const unsigned n_node = this->nnode();
102 const unsigned n_position_type = this->nnodal_position_type();
105 Shape psi(n_node, n_position_type);
106 DShape dpsidxi(n_node, n_position_type,
DIM);
109 double lambda_sq = this->lambda_sq();
112 for (
unsigned ipt = 0; ipt < n_intpt; ipt++)
115 for (
unsigned i = 0;
i <
DIM;
i++)
116 {
s[
i] = this->integral_pt()->knot(ipt,
i); }
119 double w = this->integral_pt()->weight(ipt);
122 double J = this->dshape_lagrangian_at_knot(ipt, psi, dpsidxi);
125 double coupling_w = 0;
126 for (
unsigned l = 0; l < n_node; l++)
128 double nodal_coupling_w =
dynamic_cast<CoupledSolidNode*
>(this->node_pt(l))->get_coupling_weight();
129 double psi_ = psi(l);
130 coupling_w += psi_ * nodal_coupling_w;
138 for (
unsigned l = 0; l < n_node; l++)
141 for (
unsigned k = 0;
k < n_position_type;
k++)
144 for (
unsigned i = 0;
i <
DIM;
i++)
147 interpolated_xi[
i] += this->lagrangian_position_gen(l,
k,
i) * psi(l,
k);
152 veloc[
i] += this->dnodal_position_gen_dt(l,
k,
i) * psi(l,
k);
160 this->get_isotropic_growth(ipt,
s, interpolated_xi,
gamma);
164 double W =
gamma *
w * ( 1.0 - coupling_w ) *
J;
170 this->get_stress(
s,
sigma);
173 for (
unsigned i = 0;
i <
DIM;
i++)
175 for (
unsigned j = 0;
j <
DIM;
j++)
177 sigma(
i,
j) += this->prestress(
i,
j, interpolated_xi);
182 this->get_strain(
s, strain);
185 double local_pot_en = 0;
189 for (
unsigned i = 0;
i <
DIM;
i++)
191 for (
unsigned j = 0;
j <
DIM;
j++)
193 local_pot_en +=
sigma(
i,
j) * strain(
i,
j);
195 veloc_sq += veloc[
i] * veloc[
i];
199 mass += lambda_sq *
W;
203 for (
unsigned i = 0;
i <
DIM;
i++)
205 lin_mo[
i] += lambda_sq * veloc[
i] *
W;
206 ang_mo[
i] += lambda_sq * cross_product[
i] *
W;
209 pot_en += 0.5 * local_pot_en *
W;
211 kin_en += lambda_sq * 0.5 * veloc_sq *
W;
219 const unsigned& flag)
override
223 const unsigned DIM = this->dim();
226 if (this->Solid_ic_pt != 0)
228 this->fill_in_residuals_for_solid_ic(residuals);
233 const unsigned n_node = this->nnode();
236 const unsigned n_position_type = this->nnodal_position_type();
239 Shape psi(n_node, n_position_type);
240 DShape dpsidxi(n_node, n_position_type,
DIM);
243 const unsigned n_intpt = this->integral_pt()->nweight();
249 double lambda_sq = this->lambda_sq();
252 double time_factor = 0.0;
255 time_factor = this->node_pt(0)->position_time_stepper_pt()->weight(2, 0);
262 for (
unsigned ipt = 0; ipt < n_intpt; ipt++)
265 for (
unsigned i = 0;
i <
DIM; ++
i)
266 {
s[
i] = this->integral_pt()->knot(ipt,
i); }
269 double w = this->integral_pt()->weight(ipt);
272 double J = this->dshape_lagrangian_at_knot(ipt, psi, dpsidxi);
275 double coupling_w = 0;
276 for (
unsigned l = 0; l < n_node; l++)
278 double nodal_coupling_w =
dynamic_cast<CoupledSolidNode*
>(this->node_pt(l))->get_coupling_weight();
279 double psi_ = psi(l);
280 coupling_w += psi_ * nodal_coupling_w;
291 for (
unsigned i = 0;
i <
DIM;
i++)
295 for (
unsigned j = 0;
j <
DIM;
j++)
297 interpolated_G(
i,
j) = 0.0;
305 for (
unsigned l = 0; l < n_node; l++)
308 for (
unsigned k = 0;
k < n_position_type;
k++)
310 double psi_ = psi(l,
k);
312 for (
unsigned i = 0;
i <
DIM;
i++)
315 interpolated_xi[
i] += this->lagrangian_position_gen(l,
k,
i) * psi_;
318 if (( lambda_sq > 0.0 ) && ( this->Unsteady ))
320 accel[
i] += this->dnodal_position_gen_dt(2, l,
k,
i) * psi_;
324 for (
unsigned j = 0;
j <
DIM;
j++)
326 interpolated_G(
j,
i) +=
327 this->nodal_position_gen(l,
k,
i) * dpsidxi(l,
k,
j);
335 this->get_isotropic_growth(ipt,
s, interpolated_xi,
gamma);
347 for (
unsigned i = 0;
i <
DIM;
i++)
349 for (
unsigned j = 0;
j <
DIM;
j++)
352 { g(
i,
j) = diag_entry; }
360 double W =
gamma *
w * ( 1.0 - coupling_w ) *
J;
366 for (
unsigned i = 0;
i <
DIM;
i++)
369 for (
unsigned j =
i;
j <
DIM;
j++)
374 for (
unsigned k = 0;
k <
DIM;
k++)
376 G(
i,
j) += interpolated_G(
i,
k) * interpolated_G(
j,
k);
380 for (
unsigned j = 0;
j <
i;
j++)
388 ELEMENT::get_stress(g,
G,
sigma);
391 for (
unsigned i = 0;
i <
DIM;
i++)
393 for (
unsigned j = 0;
j <
DIM;
j++)
395 sigma(
i,
j) += this->prestress(
i,
j, interpolated_xi);
415 for (
unsigned ll = 0; ll < n_node; ll++)
417 for (
unsigned kk = 0; kk < n_position_type; kk++)
419 for (
unsigned ii = 0; ii <
DIM; ii++)
421 for (
unsigned aa = 0; aa <
DIM; aa++)
423 for (
unsigned bb = aa; bb <
DIM; bb++)
425 d_G_dX(ll, kk, ii, aa, bb) =
426 interpolated_G(aa, ii) * dpsidxi(ll, kk, bb) +
427 interpolated_G(bb, ii) * dpsidxi(ll, kk, aa);
436 this->get_d_stress_dG_upper(g,
G,
sigma, d_stress_dG);
442 for (
unsigned l = 0; l < n_node; l++)
445 for (
unsigned k = 0;
k < n_position_type;
k++)
448 const unsigned offset5 = dpsidxi.
offset(l,
k);
451 for (
unsigned i = 0;
i <
DIM;
i++)
454 local_eqn = this->position_local_eqn(l,
k,
i);
463 sum += ( lambda_sq * accel[
i] -
b[
i] ) * psi(l,
k);
466 for (
unsigned a = 0;
a <
DIM;
a++)
468 unsigned count = offset5;
469 for (
unsigned b = 0;
b <
DIM;
b++)
472 sum +=
sigma(
a,
b) * interpolated_G(
a,
i) *
477 residuals[local_eqn] +=
W * sum;
483 const unsigned offset1 = d_G_dX.
offset(l,
k,
i);
486 for (
unsigned ll = 0; ll < n_node; ll++)
489 for (
unsigned kk = 0; kk < n_position_type; kk++)
492 for (
unsigned ii = 0; ii <
DIM; ii++)
495 int local_unknown = this->position_local_eqn(ll, kk, ii);
498 if (local_unknown >= 0)
501 const unsigned offset2 = d_G_dX.
offset(ll, kk, ii);
502 const unsigned offset4 = dpsidxi.
offset(ll, kk);
507 unsigned count1 = offset1;
508 for (
unsigned a = 0;
a <
DIM;
a++)
513 for (
unsigned b =
a;
b <
DIM;
b++)
516 if (
a ==
b) factor *= 0.5;
519 unsigned offset3 = d_stress_dG.
offset(
a,
b);
520 unsigned count2 = offset2;
521 unsigned count3 = offset3;
523 for (
unsigned aa = 0; aa <
DIM; aa++)
531 for (
unsigned bb = aa; bb <
DIM; bb++)
547 jacobian(local_eqn, local_unknown) += sum *
W;
551 if ((
i == ii ) && ( local_unknown >= local_eqn ))
557 sum += lambda_sq * time_factor * psi(ll, kk) * psi(l,
k);
560 unsigned count4 = offset4;
561 for (
unsigned a = 0;
a <
DIM;
a++)
564 const double factor =
568 unsigned count5 = offset5;
569 for (
unsigned b = 0;
b <
DIM;
b++)
577 jacobian(local_eqn, local_unknown) += sum *
W;
579 if (local_eqn != local_unknown)
581 jacobian(local_unknown, local_eqn) += sum *
W;
602 const unsigned& flag)
608 const unsigned n_node = this->nnode();
609 const unsigned DIM = this->dim();
612 unsigned n_position_type = this->nnodal_position_type();
620 for (
unsigned l = 0; l < n_node; l++)
623 for (
unsigned k = 0;
k < n_position_type;
k++)
626 for (
unsigned i = 0;
i <
DIM;
i++)
629 local_eqn = this->position_local_eqn(l,
k,
i);
643 for (
unsigned ll = 0; ll < n_node; ll++)
646 for (
unsigned kk = 0; kk < n_position_type; kk++)
649 for (
unsigned ii = 0; ii <
DIM; ii++)
652 int local_unknown = this->position_local_eqn(ll, kk, ii);
654 if (( local_unknown >= 0 ) && (
i == ii ) && ( local_unknown >= local_eqn ))
658 if (local_eqn != local_unknown)
672 void output(std::ostream& outfile,
const unsigned& n_plot)
override
674 const unsigned DIM = this->dim();
680 outfile << this->tecplot_zone_string(n_plot);
683 unsigned num_plot_points = this->nplot_points(n_plot);
684 for (
unsigned iplot = 0; iplot < num_plot_points; iplot++)
687 this->get_s_plot(iplot, n_plot,
s);
690 this->interpolated_x(
s,
x);
698 for (
unsigned i = 0;
i <
DIM;
i++)
702 for (
unsigned i = 0;
i <
DIM;
i++)
709 const unsigned n_node = this->nnode();
711 const unsigned n_position_type = this->nnodal_position_type();
713 Shape psi(n_node, n_position_type);
719 for (
unsigned l = 0; l < n_node; l++)
721 double nodal_coupling_w =
dynamic_cast<CoupledSolidNode*
>(this->node_pt(l))->get_coupling_weight();
722 w += nodal_coupling_w * psi(l);
727 outfile << std::endl;
731 this->write_tecplot_zone_footer(outfile, n_plot);
732 outfile << std::endl;
750 template<
class ELEMENT>
int i
Definition: BiCGSTAB_step_by_step.cpp:9
JacobiRotation< float > G
Definition: Jacobi_makeGivens.cpp:2
JacobiRotation< float > J
Definition: Jacobi_makeJacobi.cpp:3
RowVector3d w
Definition: Matrix_resize_int.cpp:3
Scalar * b
Definition: benchVecAdd.cpp:17
Definition: CoupledSolidNodes.h:20
unsigned offset(const unsigned long &i, const unsigned long &j) const
Definition: shape.h:487
double & raw_direct_access(const unsigned long &i)
Definition: shape.h:469
FaceGeometry()
Constructor [this was only required explicitly from gcc 4.5.2 onwards...].
Definition: VCoupledElement.h:758
Definition: elements.h:4998
virtual double interpolated_dxdt(const Vector< double > &s, const unsigned &i, const unsigned &t)
Definition: elements.cc:4596
static DenseMatrix< double > Dummy_matrix
Definition: elements.h:227
A Rank 5 Tensor class.
Definition: matrices.h:2113
T & raw_direct_access(const unsigned long &i)
Definition: matrices.h:2545
unsigned offset(const unsigned long &i, const unsigned long &j, const unsigned long &k) const
Definition: matrices.h:2564
A Rank 4 Tensor class.
Definition: matrices.h:1701
T & raw_direct_access(const unsigned long &i)
Definition: matrices.h:2078
unsigned offset(const unsigned long &i, const unsigned long &j) const
Definition: matrices.h:2096
Definition: elements.h:3561
void initialise(const _Tp &__value)
Iterate over all values and set to the desired value.
Definition: oomph-lib/src/generic/Vector.h:167
Definition: VCoupledElement.h:29
void add_internal_coupling_forces_to_residuals(Vector< double > &residuals, DenseMatrix< double > &jacobian, const unsigned &flag)
Add the point source contribution to the residual vector.
Definition: VCoupledElement.h:600
Vector< Vector< double > > nodal_coupling_residual
Nodal coupling forces.
Definition: VCoupledElement.h:736
Vector< Vector< double > > nodal_coupling_jacobian
Nodal coupling jacobian.
Definition: VCoupledElement.h:739
void fill_in_contribution_to_residuals(Vector< double > &residuals) override
Add the element's contribution to its residual vector (wrapper)
Definition: VCoupledElement.h:42
VolumeCoupledElement()
Constructor: Call constructor of underlying element.
Definition: VCoupledElement.h:34
double & getCouplingStiffness(const unsigned &m, const unsigned &l)
Definition: VCoupledElement.h:76
void setCouplingStiffness(Vector< Vector< double > > &cStiffness)
Definition: VCoupledElement.h:73
void fill_in_generic_contribution_to_residuals_pvd(Vector< double > &residuals, DenseMatrix< double > &jacobian, const unsigned &flag) override
Definition: VCoupledElement.h:217
double & get_nodal_coupling_jacobian(const unsigned &l, const unsigned &ll)
Definition: VCoupledElement.h:70
void set_nodal_coupling_jacobian(Vector< Vector< double > > &cJacobian)
Definition: VCoupledElement.h:67
void set_nodal_coupling_residual(Vector< Vector< double > > &cResidual)
Definition: VCoupledElement.h:61
double & get_nodal_coupling_residual(const unsigned &l, const unsigned &i)
Definition: VCoupledElement.h:64
Vector< Vector< double > > couplingStiffness
Coupling stiffness to discrete particles (FIXME: should be moved into DPMVCoupledElement)
Definition: VCoupledElement.h:742
void output(std::ostream &outfile, const unsigned &n_plot) override
Definition: VCoupledElement.h:672
~VolumeCoupledElement()
Destructor (empty)
Definition: VCoupledElement.h:38
void fill_in_contribution_to_jacobian(Vector< double > &residuals, DenseMatrix< double > &jacobian) override
Add the element's contribution to its residual vector and Jacobian matrix (wrapper)
Definition: VCoupledElement.h:52
void get_momentum_and_energy(double &mass, Vector< double > &lin_mo, Vector< double > &ang_mo, double &pot_en, double &kin_en)
Definition: VCoupledElement.h:79
RealScalar s
Definition: level1_cplx_impl.h:130
const Scalar * a
Definition: level2_cplx_impl.h:32
int * m
Definition: level2_cplx_impl.h:294
char char char int int * k
Definition: level2_impl.h:374
#define DIM
Definition: linearised_navier_stokes_elements.h:44
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC bfloat16 pow(const bfloat16 &a, const bfloat16 &b)
Definition: BFloat16.h:625
void body_force(const double &time, const Vector< double > &x, Vector< double > &result)
Definition: axisym_linear_elasticity/cylinder/cylinder.cc:96
Global variables.
Definition: TwenteMeshGluing.cpp:60
double lenScale
Length scale.
Definition: VCoupledElement.h:10
double timeScale
Time scale.
Definition: VCoupledElement.h:13
int sigma
Definition: calibrate.py:179
Mdouble gamma(Mdouble gamma_in)
This is the gamma function returns the true value for the half integer value.
Definition: ExtendedMath.cc:116
void shape(const double &s, double *Psi)
Definition: shape.h:564
@ W
Definition: quadtree.h:63
void cross(const Vector< double > &A, const Vector< double > &B, Vector< double > &C)
Definition: oomph-lib/src/generic/Vector.h:319
DRAIG: Change all instances of (SPATIAL_DIM) to (DIM-1).
Definition: AnisotropicHookean.h:10
list x
Definition: plotDoE.py:28
std::ptrdiff_t j
Definition: tut_arithmetic_redux_minmax.cpp:2