38 #include "unsteady_heat.h" 41 #include "meshes/rectangular_quadmesh.h" 44 using namespace oomph;
55 template<
unsigned DIM>
57 public virtual QUnsteadyHeatElement<DIM,3>
72 QUnsteadyHeatElement<DIM,3>()
74 Alpha_pt = &Default_Physical_Constant_Value;
81 {
return (QUnsteadyHeatElement<DIM,3>::required_nvalue(n) +
82 QPVDElement<DIM,3>::required_nvalue(n));}
85 const double &
alpha()
const {
return *Alpha_pt;}
91 void output(ostream &outfile) {FiniteElement::output(outfile);}
96 void output(ostream &outfile,
const unsigned &nplot)
99 Vector<double> s(DIM);
100 Vector<double> xi(DIM);
103 outfile << this->tecplot_zone_string(nplot);
106 unsigned num_plot_points=this->nplot_points(nplot);
107 for (
unsigned iplot=0;iplot<num_plot_points;iplot++)
110 this->get_s_plot(iplot,nplot,s);
113 this->interpolated_xi(s,xi);
116 for(
unsigned i=0;i<DIM;i++)
117 {outfile << this->interpolated_x(s,i) <<
" ";}
120 outfile << this->interpolated_u_ust_heat(s) << std::endl;
122 outfile << std::endl;
125 this->write_tecplot_zone_footer(outfile,nplot);
130 {FiniteElement::output(file_pt);}
133 void output(FILE* file_pt,
const unsigned &n_plot)
134 {FiniteElement::output(file_pt,n_plot);}
138 FiniteElement::SteadyExactSolutionFctPt
140 {FiniteElement::output_fct(outfile,Nplot,exact_soln_pt);}
147 FiniteElement::UnsteadyExactSolutionFctPt
151 output_fct(outfile,Nplot,time,exact_soln_pt);
158 QUnsteadyHeatElement<DIM,3>::compute_norm(el_norm);
167 FiniteElement::UnsteadyExactSolutionFctPt exact_soln_pt,
169 double& error,
double& norm)
170 {FiniteElement::compute_error(outfile,exact_soln_pt,
179 FiniteElement::SteadyExactSolutionFctPt exact_soln_pt,
180 double& error,
double& norm)
181 {FiniteElement::compute_error(outfile,exact_soln_pt,error,norm);}
186 const Vector<double>& xi,
double &gamma)
const 190 gamma = 1.0 + (*Alpha_pt)*this->interpolated_u_ust_heat(s);
199 UnsteadyHeatEquations<DIM>::
200 fill_in_contribution_to_residuals(residuals);
203 fill_in_contribution_to_residuals(residuals);
210 DenseMatrix<double> &jacobian)
214 SolidFiniteElement::fill_in_contribution_to_jacobian(residuals,jacobian);
253 template<
class ELEMENT>
280 ElasticRectangularQuadMesh<ELEMENT>*
mesh_pt()
282 return dynamic_cast<ElasticRectangularQuadMesh<ELEMENT>*
>(
296 template<
class ELEMENT>
300 Doc_info.set_directory(
"RESLT");
316 new ElasticRectangularQuadMesh<ELEMENT>(n_x,n_y,l_x,l_y);
323 unsigned n_boundary_node = mesh_pt()->nboundary_node(0);
324 for(
unsigned n=0;n<n_boundary_node;n++)
327 Node* nod_pt = mesh_pt()->boundary_node_pt(0,n);
331 nod_pt->set_value(0,0.0);
335 n_boundary_node = mesh_pt()->nboundary_node(2);
336 for(
unsigned n=0;n<n_boundary_node;n++)
338 Node* nod_pt = mesh_pt()->boundary_node_pt(2,n);
342 nod_pt->set_value(0,1.0);
346 n_boundary_node = mesh_pt()->nboundary_node(1);
347 for(
unsigned n=0;n<n_boundary_node;n++)
349 static_cast<SolidNode*
>(mesh_pt()->boundary_node_pt(1,n))->pin_position(0);
354 static_cast<SolidNode*
>(mesh_pt()->boundary_node_pt(1,0))->pin_position(1);
362 unsigned n_element = mesh_pt()->nelement();
363 for(
unsigned int i=0;i<n_element;i++)
366 ELEMENT *el_pt =
dynamic_cast<ELEMENT*
>(mesh_pt()->element_pt(i));
372 el_pt->constitutive_law_pt() =
377 cout <<
"Number of equations: " << assign_eqn_numbers() << endl;
385 template<
class ELEMENT>
397 sprintf(filename,
"%s/soln%i.dat",Doc_info.directory().c_str(),
399 some_file.open(filename);
400 mesh_pt()->output(some_file,npts);
410 int main(
int argc,
char **argv)
422 unsigned n_steps = 11;
424 if(argc > 1) {n_steps = 2;}
425 for(
unsigned i=0;i<n_steps;i++)
431 problem.newton_solve();
const double & alpha() const
Access function for the thermal expansion coefficient (const version)
void output_fct(ostream &outfile, const unsigned &Nplot, FiniteElement::SteadyExactSolutionFctPt exact_soln_pt)
Output function for an exact solution: Broken default.
void compute_error(ostream &outfile, FiniteElement::SteadyExactSolutionFctPt exact_soln_pt, double &error, double &norm)
Validate against exact solution. Solution is provided via function pointer. Plot at a given number of...
void actions_before_newton_solve()
Update the problem specs before solve (empty)
void actions_before_adapt()
Actions before adapt:(empty)
double * Alpha_pt
Pointer to a private data member, the thermal expansion coefficient.
unsigned required_nvalue(const unsigned &n) const
The required number of values stored at the nodes is the sum of the required values of the two single...
void actions_after_newton_solve()
Update the problem after solve (empty)
void get_isotropic_growth(const unsigned &ipt, const Vector< double > &s, const Vector< double > &xi, double &gamma) const
Overload the growth function in the advection-diffusion equations. to be temperature-dependent.
ConstitutiveLaw * Constitutive_law_pt
We need a constitutive law for the solid mechanics.
void fill_in_contribution_to_residuals(Vector< double > &residuals)
Calculate the contribution to the residual vector. We assume that the vector has been initialised to ...
void output(ostream &outfile)
Overload the standard output function with the broken default.
ElasticRectangularQuadMesh< ELEMENT > * mesh_pt()
Overloaded version of the problem's access function to the mesh. Recasts the pointer to the base Mesh...
void output_fct(ostream &outfile, const unsigned &Nplot, const double &time, FiniteElement::UnsteadyExactSolutionFctPt exact_soln_pt)
Output function for a time-dependent exact solution: Broken default.
DocInfo Doc_info
DocInfo object.
void output(ostream &outfile, const unsigned &nplot)
Output function: Output x, y, u, v, p, theta at Nplot^DIM plot points.
void doc_solution()
Doc the solution.
void compute_error(ostream &outfile, FiniteElement::UnsteadyExactSolutionFctPt exact_soln_pt, const double &time, double &error, double &norm)
Validate against exact solution at given time Solution is provided via function pointer. Plot at a given number of plot points and compute L2 error and L2 norm of velocity solution over element Call the broken default.
void output(FILE *file_pt)
C-style output function: Broken default.
Namespace for the physical parameters in the problem.
int main(int argc, char **argv)
Driver code for 2D Thermoelasticity problem.
static double Default_Physical_Constant_Value
The static default value of Alpha.
ThermalProblem()
Constructor.
void compute_norm(double &el_norm)
Compute norm of solution: use the version in the unsteady heat class.
void output(FILE *file_pt, const unsigned &n_plot)
C-style output function: Broken default.
QThermalPVDElement()
Constructor: call the underlying constructors and initialise the pointer to Alpha to point to the def...
double *& alpha_pt()
Access function for the pointer to the thermal expansion coefficientr.
~ThermalProblem()
Destructor. Empty.
void fill_in_contribution_to_jacobian(Vector< double > &residuals, DenseMatrix< double > &jacobian)
Compute the element's residual Vector and the jacobian matrix We assume that the residuals vector and...
double Nu
Poisson ratio for solid mechanics.
double Alpha
Thermal expansion coefficient.
double E
Young's modulus for solid mechanics.