5 #ifndef SCALECOUPLEDELEMENT_H
6 #define SCALECOUPLEDELEMENT_H
15 template<
class ELEMENT>
82 const unsigned& flag)
override
86 const unsigned DIM = this->dim();
89 if (this->Solid_ic_pt!=0)
91 this->fill_in_residuals_for_solid_ic(residuals);
96 const unsigned n_node = this->nnode();
99 const unsigned n_position_type = this->nnodal_position_type();
102 Shape psi(n_node,n_position_type);
103 DShape dpsidxi(n_node,n_position_type,
DIM);
106 const unsigned n_intpt = this->integral_pt()->nweight();
112 double lambda_sq = this->lambda_sq();
115 double time_factor=0.0;
118 time_factor=this->node_pt(0)->position_time_stepper_pt()->weight(2,0);
125 for(
unsigned ipt=0;ipt<n_intpt;ipt++)
128 for(
unsigned i=0;
i<
DIM;++
i) {
s[
i] = this->integral_pt()->knot(ipt,
i);}
131 double w = this->integral_pt()->weight(ipt);
134 double J = this->dshape_lagrangian_at_knot(ipt,psi,dpsidxi);
137 double coupling_w = 0;
139 for (
unsigned l = 0; l < n_node; l++) {
140 double psi_ = psi(l);
153 for(
unsigned i=0;
i<
DIM;
i++)
157 for(
unsigned j=0;
j<
DIM;
j++)
159 interpolated_G(
i,
j) = 0.0;
167 for(
unsigned l=0;l<n_node;l++)
170 for(
unsigned k=0;
k<n_position_type;
k++)
172 double psi_ = psi(l,
k);
174 for(
unsigned i=0;
i<
DIM;
i++)
177 interpolated_xi[
i] += this->lagrangian_position_gen(l,
k,
i)*psi_;
180 if ((lambda_sq>0.0)&&(this->Unsteady))
182 accel[
i] += this->dnodal_position_gen_dt(2,l,
k,
i)*psi_;
186 for(
unsigned j=0;
j<
DIM;
j++)
188 interpolated_G(
j,
i) +=
189 this->nodal_position_gen(l,
k,
i)*dpsidxi(l,
k,
j);
197 this->get_isotropic_growth(ipt,
s,interpolated_xi,
gamma);
209 for(
unsigned i=0;
i<
DIM;
i++)
211 for(
unsigned j=0;
j<
DIM;
j++)
213 if(
i==
j) {g(
i,
j) = diag_entry;}
220 double W =
gamma*
w*(1.0-coupling_w)*
J;
226 for(
unsigned i=0;
i<
DIM;
i++)
234 for(
unsigned k=0;
k<
DIM;
k++)
236 G(
i,
j) += interpolated_G(
i,
k)*interpolated_G(
j,
k);
240 for(
unsigned j=0;
j<
i;
j++)
248 ELEMENT::get_stress(g,
G,
sigma);
251 for(
unsigned i=0;
i<
DIM;
i++)
253 for(
unsigned j=0;
j<
DIM;
j++)
255 sigma(
i,
j) += this->prestress(
i,
j,interpolated_xi);
275 for (
unsigned ll=0;ll<n_node;ll++)
277 for (
unsigned kk=0;kk<n_position_type;kk++)
279 for (
unsigned ii=0;ii<
DIM;ii++)
281 for (
unsigned aa=0;aa<
DIM;aa++)
283 for (
unsigned bb=aa;bb<
DIM;bb++)
285 d_G_dX(ll,kk,ii,aa,bb)=
286 interpolated_G(aa,ii)*dpsidxi(ll,kk,bb)+
287 interpolated_G(bb,ii)*dpsidxi(ll,kk,aa);
296 this->get_d_stress_dG_upper(g,
G,
sigma,d_stress_dG);
302 for(
unsigned l=0;l<n_node;l++)
305 for(
unsigned k=0;
k<n_position_type;
k++)
308 const unsigned offset5=dpsidxi.
offset(l ,
k);
311 for(
unsigned i=0;
i<
DIM;
i++)
314 local_eqn = this->position_local_eqn(l,
k,
i);
323 sum+=(lambda_sq*accel[
i]-
b[
i])*psi(l,
k);
326 for(
unsigned a=0;
a<
DIM;
a++)
328 unsigned count=offset5;
329 for(
unsigned b=0;
b<
DIM;
b++)
337 residuals[local_eqn] +=
W*sum;
343 const unsigned offset1=d_G_dX.
offset( l,
k,
i);
346 for(
unsigned ll=0;ll<n_node;ll++)
349 for(
unsigned kk=0;kk<n_position_type;kk++)
352 for(
unsigned ii=0;ii<
DIM;ii++)
355 int local_unknown = this->position_local_eqn(ll,kk,ii);
358 if(local_unknown >= 0)
361 const unsigned offset2=d_G_dX.
offset( ll, kk, ii);
362 const unsigned offset4=dpsidxi.
offset(ll, kk);
367 unsigned count1=offset1;
368 for(
unsigned a=0;
a<
DIM;
a++)
376 if (
a==
b) factor*=0.5;
379 unsigned offset3=d_stress_dG.
offset(
a,
b);
380 unsigned count2=offset2;
381 unsigned count3=offset3;
383 for(
unsigned aa=0;aa<
DIM;aa++)
391 for(
unsigned bb=aa;bb<
DIM;bb++)
407 jacobian(local_eqn,local_unknown)+=sum*
W;
411 if((
i==ii) && (local_unknown >= local_eqn))
417 sum+=lambda_sq*time_factor*psi(ll,kk)*psi(l,
k);
420 unsigned count4=offset4;
421 for(
unsigned a=0;
a<
DIM;
a++)
428 unsigned count5=offset5;
429 for(
unsigned b=0;
b<
DIM;
b++)
437 jacobian(local_eqn,local_unknown) += sum*
W;
439 if(local_eqn != local_unknown)
441 jacobian(local_unknown,local_eqn) += sum*
W;
462 const unsigned& flag)
468 const unsigned n_node = this->nnode();
469 const unsigned DIM = this->dim();
472 unsigned n_position_type = this->nnodal_position_type();
478 for(
unsigned l=0;l<n_node;l++)
481 for(
unsigned k=0;
k<n_position_type;
k++)
484 for(
unsigned i=0;
i<
DIM;
i++)
487 int local_eqn = this->position_local_eqn(l,
k,
i);
501 for(
unsigned ll=0;ll<n_node;ll++)
504 for(
unsigned kk=0;kk<n_position_type;kk++)
507 for(
unsigned ii=0;ii<
DIM;ii++)
510 int local_unknown = this->position_local_eqn(ll,kk,ii);
512 if ((local_unknown >= 0) && (
i==ii) && (local_unknown >= local_eqn))
516 if(local_eqn != local_unknown)
int i
Definition: BiCGSTAB_step_by_step.cpp:9
const unsigned n
Definition: CG3DPackingUnitTest.cpp:11
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
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
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
Wrapper class for solid elements to be coupled with discrete solid particles on the surfaces.
Definition: ScaleCoupledElement.h:16
void set_coupling_jacobian(Vector< Vector< double >> &jacobian)
Sets the coupling residual.
Definition: ScaleCoupledElement.h:41
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: ScaleCoupledElement.h:460
double get_coupling_weight(const unsigned &n)
Sets the coupling weight.
Definition: ScaleCoupledElement.h:51
Vector< Vector< double > > coupling_jacobian
Contribution of coupling to jacobian (jacobian(local_eqn,local_unknown) += coupling_jacobian[node0][n...
Definition: ScaleCoupledElement.h:539
void clear_coupling_residual()
Empties the coupling residual.
Definition: ScaleCoupledElement.h:20
void fill_in_contribution_to_residuals(Vector< double > &residuals) override
Adds the elements contribution to its residual vector (wrapper)
Definition: ScaleCoupledElement.h:56
void set_coupling_weight(Vector< double > &weight)
Sets the coupling weight.
Definition: ScaleCoupledElement.h:46
Vector< Vector< double > > coupling_residual
Contribution of coupling to residual (residuals[local_eqn] += coupling_residual[node][dim];)
Definition: ScaleCoupledElement.h:534
void set_coupling_residual(Vector< Vector< double >> &residual)
Sets the coupling residual.
Definition: ScaleCoupledElement.h:25
void fill_in_generic_contribution_to_residuals_pvd(Vector< double > &residuals, DenseMatrix< double > &jacobian, const unsigned &flag) override
Definition: ScaleCoupledElement.h:80
double get_coupling_residual(const unsigned &n, const unsigned &d)
Returns the coupling residual.
Definition: ScaleCoupledElement.h:30
void fill_in_contribution_to_jacobian(Vector< double > &residuals, DenseMatrix< double > &jacobian) override
Add the elements contribution to its residual vector and Jacobian matrix (wrapper)
Definition: ScaleCoupledElement.h:68
Vector< double > coupling_weight
Nodal coupling weight (interpolated to compute coupling weight at integration points)
Definition: ScaleCoupledElement.h:542
void clear_coupling_jacobian()
Empties the coupling Jacobian.
Definition: ScaleCoupledElement.h:36
Definition: oomph-lib/src/generic/Vector.h:58
RealScalar s
Definition: level1_cplx_impl.h:130
const Scalar * a
Definition: level2_cplx_impl.h:32
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
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
@ W
Definition: quadtree.h:63
DRAIG: Change all instances of (SPATIAL_DIM) to (DIM-1).
Definition: AnisotropicHookean.h:10
std::ptrdiff_t j
Definition: tut_arithmetic_redux_minmax.cpp:2