41 const Vector<double>& s)
44 unsigned n_node = this->nnode();
56 for (
unsigned l = 0; l < n_node; l++)
58 C += this->nodal_value(l, this->
C_index[l]) * psi(l);
68 const unsigned& l)
const
71 TimeStepper* time_stepper_pt = this->node_pt(l)->time_stepper_pt();
76 if (time_stepper_pt->type() !=
"Steady")
79 const unsigned n_time = time_stepper_pt->ntstorage();
81 for (
unsigned t = 0; t < n_time; t++)
83 dcdt += time_stepper_pt->weight(1, t) *
84 this->nodal_value(t, l, this->
C_index[l]);
98 const unsigned n_node = this->nnode();
105 for (
unsigned l = 0; l < n_node; l++)
107 C += this->nodal_value(l, this->
C_index[l]) * psi(l);
111 double Beta = this->
beta();
113 return (1.0 - Beta * (C - 1.0));
122 Vector<double>& residuals,
123 DenseMatrix<double>& jacobian,
124 const unsigned& flag,
126 const DShape& dpsifds,
127 const DShape& dpsifdS,
128 const DShape& dpsifdS_div,
129 const Vector<double>& s,
130 const Vector<double>& interpolated_x,
131 const Vector<double>& interpolated_n,
136 unsigned n_node = this->nnode();
139 int local_eqn = 0, local_unknown = 0;
147 const double Pe_s = this->
peclet_s();
155 const unsigned n_dim = this->node_pt(0)->ndim();
157 Vector<double> mesh_velocity(n_dim, 0.0);
158 Vector<double> interpolated_grad_C(n_dim, 0.0);
159 double interpolated_div_u = 0.0;
162 for (
unsigned l = 0; l < n_node; l++)
164 const double psi = psif(l);
165 const double C_ = this->nodal_value(l, this->
C_index[l]);
170 for (
unsigned j = 0; j < n_dim; j++)
172 const double u_ = this->nodal_value(l, u_index[j]);
174 mesh_velocity[j] += this->dnodal_position_dt(l, j) * psi;
175 interpolated_grad_C[j] += C_ * dpsifdS(l, j);
176 interpolated_div_u += u_ * dpsifdS_div(l, j);
181 double interpolated_advection_term =
interpolated_C * interpolated_div_u;
182 for (
unsigned i = 0; i < n_dim; i++)
184 interpolated_advection_term +=
190 for (
unsigned l = 0; l < n_node; l++)
193 local_eqn = this->nodal_local_eqn(l, this->
C_index[l]);
199 residuals[local_eqn] += dCdt * psif(l) * W * J;
202 residuals[local_eqn] += interpolated_advection_term * psif(l) * W * J;
205 double diffusion_term = 0.0;
206 for (
unsigned i = 0; i < n_dim; i++)
208 diffusion_term += interpolated_grad_C[i] * dpsifdS(l, i);
210 residuals[local_eqn] += (1.0 / Pe_s) * diffusion_term * W * J;
216 for (
unsigned l2 = 0; l2 < n_node; l2++)
219 TimeStepper* time_stepper_pt = this->node_pt(l2)->time_stepper_pt();
222 local_unknown = this->nodal_local_eqn(l2, this->
C_index[l2]);
224 if (local_unknown >= 0)
226 jacobian(local_eqn, local_unknown) +=
227 time_stepper_pt->weight(1, 0) * psif(l2) * psif(l) * W * J;
229 jacobian(local_eqn, local_unknown) +=
230 psif(l2) * interpolated_div_u * psif(l) * W * J;
232 for (
unsigned i = 0; i < n_dim; i++)
234 jacobian(local_eqn, local_unknown) +=
239 for (
unsigned i = 0; i < n_dim; i++)
241 jacobian(local_eqn, local_unknown) +=
242 (1.0 / Pe_s) * dpsifdS(l2, i) * dpsifdS(l, i) * W * J;
248 for (
unsigned i2 = 0; i2 < n_dim; i2++)
251 local_unknown = this->nodal_local_eqn(l2, u_index[i2]);
255 if (local_unknown >= 0)
258 jacobian(local_eqn, local_unknown) +=
260 psif(l2) * interpolated_grad_C[i2]) *
270 const double dsigma = this->
dsigma_dC(s);
271 const double Ca = this->
ca();
272 for (
unsigned l2 = 0; l2 < n_node; l2++)
274 local_unknown = this->nodal_local_eqn(l2, this->
C_index[l2]);
275 if (local_unknown >= 0)
277 const double psi_ = psif(l2);
278 for (
unsigned i = 0; i < n_dim; i++)
281 local_eqn = this->nodal_local_eqn(l, u_index[i]);
284 jacobian(local_eqn, local_unknown) -=
285 (dsigma / Ca) * psi_ * dpsifdS_div(l, i) * J * W;
299 const unsigned& n_plot)
301 outfile.precision(16);
303 const unsigned el_dim = this->dim();
304 const unsigned n_dim = this->nodal_dimension();
308 Vector<double> s(el_dim);
309 Vector<double> n(n_dim);
310 Vector<double>
u(n_velocity);
313 outfile << this->tecplot_zone_string(n_plot);
316 unsigned num_plot_points = this->nplot_points(n_plot);
317 for (
unsigned iplot = 0; iplot < num_plot_points; iplot++)
320 this->get_s_plot(iplot, n_plot, s);
322 this->outer_unit_normal(s, n);
325 for (
unsigned i = 0; i < n_velocity; i++)
331 for (
unsigned i = 0; i < n_dim; i++)
337 for (
unsigned i = 0; i < n_dim; i++)
338 outfile << this->interpolated_x(s, i) <<
" ";
339 for (
unsigned i = 0; i < n_dim; i++) outfile <<
u[i] <<
" ";
341 outfile << 0.0 <<
" ";
345 outfile <<
sigma(s) <<
" ";
346 for (
unsigned i = 0; i < n_dim; i++)
348 outfile <<
u[i] - u_n * n[i] <<
" ";
350 outfile << std::endl;
352 outfile << std::endl;
361 unsigned n_node = this->nnode();
363 const unsigned el_dim = this->dim();
364 const unsigned n_dim = this->nodal_dimension();
368 DShape dpsifds(n_node, el_dim);
369 DShape dpsifdS(n_node, n_dim);
370 DShape dpsifdS_div(n_node, n_dim);
373 unsigned n_intpt = this->integral_pt()->nweight();
376 Vector<double> s(el_dim);
382 for (
unsigned ipt = 0; ipt < n_intpt; ipt++)
385 for (
unsigned i = 0; i < el_dim; i++)
387 s[i] = this->integral_pt()->knot(ipt, i);
391 double W = this->integral_pt()->weight(ipt);
394 this->dshape_local_at_knot(ipt, psif, dpsifds);
396 Vector<double> interpolated_x(n_dim, 0.0);
397 DenseMatrix<double> interpolated_t(el_dim, n_dim, 0.0);
398 double interpolated_c = 0.0;
401 for (
unsigned l = 0; l < n_node; l++)
403 const double psi_ = psif(l);
404 interpolated_c += this->nodal_value(l, this->
C_index[l]) * psi_;
406 for (
unsigned i = 0; i < n_dim; i++)
409 interpolated_x[i] += this->nodal_position(l, i) * psi_;
412 for (
unsigned j = 0; j < el_dim; j++)
414 interpolated_t(j, i) += this->nodal_position(l, i) * dpsifds(l, j);
421 psif, dpsifds, interpolated_t, interpolated_x, dpsifdS, dpsifdS_div);
423 mass += interpolated_c * W * J;
virtual double compute_surface_derivatives(const Shape &psi, const DShape &dpsids, const DenseMatrix< double > &interpolated_t, const Vector< double > &interpolated_x, DShape &dpsidS, DShape &dpsidS_div)=0
Compute the surface gradient and surface divergence operators given the shape functions,...
double u(const unsigned &j, const unsigned &i)
Return the i-th velocity component at local node j.
Vector< unsigned > U_index_interface
Nodal index at which the i-th velocity component is stored.
double interpolated_u(const Vector< double > &s, const unsigned &i)
Calculate the i-th velocity component at the local coordinate s.
const double & ca() const
The value of the Capillary number.
double sigma(const Vector< double > &s)
The surface tension function is linear in the concentration with constant of proportionality equal to...
Vector< unsigned > C_index
Index at which the surfactant concentration is stored at the nodes.
void output(std::ostream &outfile)
Overload the output function.
virtual double dsigma_dC(const Vector< double > &s)
Return the derivative of sigma with respect to C For use in computing the Jacobian.
double integrate_c()
Compute the concentration intergated over the surface area.
double beta()
Return the Elasticity number.
double dcdt_surface(const unsigned &l) const
The time derivative of the surface concentration.
double interpolated_C(const Vector< double > &s)
Get the surfactant concentration.
double peclet_s()
Return the surface peclect number.
void add_additional_residual_contributions_interface(Vector< double > &residuals, DenseMatrix< double > &jacobian, const unsigned &flag, const Shape &psif, const DShape &dpsifds, const DShape &dpsifdS, const DShape &dpsifdS_div, const Vector< double > &s, const Vector< double > &interpolated_x, const Vector< double > &interpolated_n, const double &W, const double &J)
Overload the Helper function to calculate the residuals and jacobian entries. This particular functio...
static double Default_Physical_Constant_Value
Default value of the physical constants.