34 #include "unsteady_heat.h"
37 #include "meshes/rectangular_quadmesh.h"
40 using namespace oomph;
51 template<
unsigned DIM>
53 public virtual QUnsteadyHeatElement<DIM,3>
68 QUnsteadyHeatElement<DIM,3>()
70 Alpha_pt = &Default_Physical_Constant_Value;
77 {
return (QUnsteadyHeatElement<DIM,3>::required_nvalue(n) +
78 QPVDElement<DIM,3>::required_nvalue(n));}
81 const double &
alpha()
const {
return *Alpha_pt;}
87 void output(ostream &outfile) {FiniteElement::output(outfile);}
92 void output(ostream &outfile,
const unsigned &nplot)
95 Vector<double> s(DIM);
96 Vector<double> xi(DIM);
99 outfile << this->tecplot_zone_string(nplot);
102 unsigned num_plot_points=this->nplot_points(nplot);
103 for (
unsigned iplot=0;iplot<num_plot_points;iplot++)
106 this->get_s_plot(iplot,nplot,s);
109 this->interpolated_xi(s,xi);
112 for(
unsigned i=0;i<DIM;i++)
113 {outfile << this->interpolated_x(s,i) <<
" ";}
116 outfile << this->interpolated_u_ust_heat(s) << std::endl;
118 outfile << std::endl;
121 this->write_tecplot_zone_footer(outfile,nplot);
126 {FiniteElement::output(file_pt);}
129 void output(FILE* file_pt,
const unsigned &n_plot)
130 {FiniteElement::output(file_pt,n_plot);}
134 FiniteElement::SteadyExactSolutionFctPt
136 {FiniteElement::output_fct(outfile,Nplot,exact_soln_pt);}
143 FiniteElement::UnsteadyExactSolutionFctPt
147 output_fct(outfile,Nplot,time,exact_soln_pt);
154 QUnsteadyHeatElement<DIM,3>::compute_norm(el_norm);
163 FiniteElement::UnsteadyExactSolutionFctPt exact_soln_pt,
165 double& error,
double& norm)
166 {FiniteElement::compute_error(outfile,exact_soln_pt,
175 FiniteElement::SteadyExactSolutionFctPt exact_soln_pt,
176 double& error,
double& norm)
177 {FiniteElement::compute_error(outfile,exact_soln_pt,error,norm);}
182 const Vector<double>& xi,
double &gamma)
const
186 gamma = 1.0 + (*Alpha_pt)*this->interpolated_u_ust_heat(s);
195 UnsteadyHeatEquations<DIM>::
196 fill_in_contribution_to_residuals(residuals);
199 fill_in_contribution_to_residuals(residuals);
206 DenseMatrix<double> &jacobian)
210 SolidFiniteElement::fill_in_contribution_to_jacobian(residuals,jacobian);
249 template<
class ELEMENT>
276 ElasticRectangularQuadMesh<ELEMENT>*
mesh_pt()
278 return dynamic_cast<ElasticRectangularQuadMesh<ELEMENT>*
>(
292 template<
class ELEMENT>
296 Doc_info.set_directory(
"RESLT");
312 new ElasticRectangularQuadMesh<ELEMENT>(n_x,n_y,l_x,l_y);
319 unsigned n_boundary_node = mesh_pt()->nboundary_node(0);
320 for(
unsigned n=0;n<n_boundary_node;n++)
323 Node* nod_pt = mesh_pt()->boundary_node_pt(0,n);
327 nod_pt->set_value(0,0.0);
331 n_boundary_node = mesh_pt()->nboundary_node(2);
332 for(
unsigned n=0;n<n_boundary_node;n++)
334 Node* nod_pt = mesh_pt()->boundary_node_pt(2,n);
338 nod_pt->set_value(0,1.0);
342 n_boundary_node = mesh_pt()->nboundary_node(1);
343 for(
unsigned n=0;n<n_boundary_node;n++)
345 static_cast<SolidNode*
>(mesh_pt()->boundary_node_pt(1,n))->pin_position(0);
350 static_cast<SolidNode*
>(mesh_pt()->boundary_node_pt(1,0))->pin_position(1);
358 unsigned n_element = mesh_pt()->nelement();
359 for(
unsigned int i=0;i<n_element;i++)
362 ELEMENT *el_pt =
dynamic_cast<ELEMENT*
>(mesh_pt()->element_pt(i));
368 el_pt->constitutive_law_pt() =
373 cout <<
"Number of equations: " << assign_eqn_numbers() << endl;
381 template<
class ELEMENT>
393 sprintf(filename,
"%s/soln%i.dat",Doc_info.directory().c_str(),
395 some_file.open(filename);
396 mesh_pt()->output(some_file,npts);
406 int main(
int argc,
char **argv)
418 unsigned n_steps = 11;
420 if(argc > 1) {n_steps = 2;}
421 for(
unsigned i=0;i<n_steps;i++)
427 problem.newton_solve();
A class that solves the equations of steady thermoelasticity by combining the UnsteadyHeat and PVD eq...
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.
QThermalPVDElement()
Constructor: call the underlying constructors and initialise the pointer to Alpha to point to the def...
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.
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...
double *& alpha_pt()
Access function for the pointer to the thermal expansion coefficientr.
const double & alpha() const
Access function for the thermal expansion coefficient (const version)
void output(FILE *file_pt, const unsigned &n_plot)
C-style output function: Broken default.
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....
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...
void compute_norm(double &el_norm)
Compute norm of solution: use the version in the unsteady heat class.
double * Alpha_pt
Pointer to a private data member, the thermal expansion coefficient.
void output(ostream &outfile)
Overload the standard output function with the broken default.
void output(ostream &outfile, const unsigned &nplot)
Output function: Output x, y, u, v, p, theta at Nplot^DIM plot points.
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 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 output_fct(ostream &outfile, const unsigned &Nplot, FiniteElement::SteadyExactSolutionFctPt exact_soln_pt)
Output function for an exact solution: Broken default.
static double Default_Physical_Constant_Value
The static default value of Alpha.
void output(FILE *file_pt)
C-style output function: Broken default.
/////////////////////////////////////////////////////////////////// /////////////////////////////////...
ThermalProblem()
Constructor.
void actions_before_adapt()
Actions before adapt:(empty)
void doc_solution()
Doc the solution.
void actions_before_newton_solve()
Update the problem specs before solve (empty)
ElasticRectangularQuadMesh< ELEMENT > * mesh_pt()
Overloaded version of the problem's access function to the mesh. Recasts the pointer to the base Mesh...
void actions_after_newton_solve()
Update the problem after solve (empty)
DocInfo Doc_info
DocInfo object.
~ThermalProblem()
Destructor. Empty.
Namespace for the physical parameters in the problem.
double E
Young's modulus for solid mechanics.
ConstitutiveLaw * Constitutive_law_pt
We need a constitutive law for the solid mechanics.
double Nu
Poisson ratio for solid mechanics.
double Alpha
Thermal expansion coefficient.
int main(int argc, char **argv)
Driver code for 2D Thermoelasticity problem.