template<int dim>class Postprocessor: public DataPostprocessor<dim>{
public:
Postprocessor ();
void compute_derived_quantities_vector (const std::vector<Vector<double> > &uh, const std::vector<std::vector<Tensor<1, dim> > > &duh, const std::vector<std::vector<Tensor<2, dim> > > &dduh, const std::vector< Point<dim> > &normals, const std::vector<Point<dim> > &evaluation_points, std::vector<Vector<double> > &computed_quantities) const;
virtual std::vector<std::string> get_names () const;
virtual std::vector<DataComponentInterpretation::DataComponentInterpretation> get_data_component_interpretation () const;
virtual UpdateFlags get_needed_update_flags () const;
private:
void print_tensor (const Tensor<2, dim>& tensor, char* name) const;};
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
template<int dim>Postprocessor<dim>::Postprocessor (){}
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
template<int dim>void Postprocessor<dim>::compute_derived_quantities_vector (const std::vector<Vector<double> > &uh, const std::vector<std::vector<Tensor<1, dim> > > &duh, const std::vector< std::vector<Tensor<2, dim> > > &/*dduh*/, const std::vector<Point<dim> > &/*normals*/, const std::vector<Point<dim> > &evaluation_points, std::vector< Vector<double> > &computed_quantities) const{ //TODO: Postprocessing has not been optimized for 3D yet.
// Number of quadrature points (interior) const unsigned int n_q_points = uh.size();
// CHECK: Evaluation points const std::vector<Point<dim> > EP = evaluation_points;
// std::cout << "\nEVALUATION POINTS\n" << std::endl;// for (unsigned int i = 0; i < n_q_points; ++i)// {// for (unsigned int j = 0; j < dim; ++j)// std::cout << " " << EP[i][j] << " ";// std::cout << std::endl;// }// std::cout << std::endl;
// Constitutive matrix SymmetricTensor<4, dim> C = Tensors::get_elasticity_tensor<dim>(FractureMechanics<dim>::public_lambda, FractureMechanics<dim>::public_mu);
for (unsigned int q = 0; q < n_q_points; ++q) { std::cout << "\n - in EVALUATION point " << q + 1 << " - \n" << std::endl;
Tensor<2, dim> grad_u; SymmetricTensor<2, dim> eps, sigma; double eps_ii, eps_ij, sigma_ii, sigma_ij;
// ===========================[ STRAINS ]============================ for (unsigned int i = 0; i < dim; ++i) { int j = i + 1;
grad_u[i] = duh[q][i];
std::cout << "DUH 0: " << duh[q][0] << std::endl; std::cout << "DUH 1: " << duh[q][1] << std::endl;
eps = 0.5 * (grad_u + transpose(grad_u));
eps_ii = eps[i][i];
if ( j < dim ) eps_ij = eps[i][j];// eps_ij = 2.0 * eps[i][j];
// std::cout << "STRAIN " << i << i << ": " << eps_ii << std::endl;// std::cout << "STRAIN " << i << j << ": " << eps_ij << std::endl;
computed_quantities[q](i) = eps_ii; computed_quantities[q](j) = eps_ij; }
// ==========================[ STRESSES ]============================ for (unsigned int i = 0; i < dim; ++i) { int j = i + 1;
sigma = C * eps;
sigma_ii = sigma[i][i];
if ( j < dim ) sigma_ij = sigma[i][j];
computed_quantities[q](dim + i + 1) = sigma_ii; computed_quantities[q](dim + j + 1) = sigma_ij; }
// =======================[ ELASTIC ENERGY ]=========================// double psi = 0.5 * FractureMechanics<dim>::public_lambda * trace(eps) * trace(eps) + FractureMechanics<dim>::public_mu * eps * eps; double psi = 0.5 * (eps[0][0] * sigma[0][0] + eps[1][1] * sigma[1][1] + 2.0 * eps[0][1] * sigma[0][1]);// double psi = 0.5 * scalar_product(sigma,eps);
// std::cout << std::endl << "DISPLACEMENT GRADIENT" << std::endl;// for (unsigned int i = 0; i < dim; ++i)// {// for (unsigned int j = 0; j < dim; ++j)// std::cout << " " << std::setprecision(6) << std::fixed << grad_u[i][j] << " ";// std::cout << std::endl;// }// std::cout << std::endl;
// print_tensor(eps, "STRAIN TENSOR");// print_tensor(sigma, "STRESS TENSOR");
computed_quantities[q](dim * 2 + 2) = psi; }}
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
template<int dim>std::vector<std::string> Postprocessor<dim>::get_names () const{ std::vector<std::string> names;
std::string xyz = "xyz";
// =================[ STRAIN NAMES ]==================
// Diagonal strain components for (int i = 0; i < dim; i++) { std::stringstream ss; ss << "strain_" << xyz[i] << xyz[i]; std::string s = ss.str();
names.push_back(s); }
// Symmetric strain components (3d may not work!) for (int i = 0, j = 1; j < dim; j++) { std::stringstream ss; ss << "strain_" << xyz[i] << xyz[j]; std::string s = ss.str();
names.push_back(s); }
// =================[ STRESS NAMES ]==================
// Diagonal stress components for (int i = 0; i < dim; i++) { std::stringstream ss; ss << "stress_" << xyz[i] << xyz[i]; std::string s = ss.str();
names.push_back(s); }
// Symmetric stress components (3d may not work!) for (int i = 0, j = 1; j < dim; j++) { std::stringstream ss; ss << "stress_" << xyz[i] << xyz[j]; std::string s = ss.str();
names.push_back(s); }
// ==================[ ENERGY NAME ]==================
names.push_back("elastic_energy");
return names;}
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
template<int dim>std::vector<DataComponentInterpretation::DataComponentInterpretation> Postprocessor<dim>::get_data_component_interpretation () const{ std::vector<DataComponentInterpretation::DataComponentInterpretation> interpretation(dim, DataComponentInterpretation::component_is_scalar);
interpretation.push_back(DataComponentInterpretation::component_is_scalar);
interpretation.push_back(DataComponentInterpretation::component_is_scalar);
return interpretation;}
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
template<int dim>UpdateFlags Postprocessor<dim>::get_needed_update_flags () const{ return update_values | update_gradients | update_quadrature_points;}
Dear Thomas Wick, Dear Timo Heister,
I wrote an additional postprocessor in your existing phase-field code to allow postprocessing of strain, stress or elastic energy. Unfortunately, it seems like the STRAIN_XX and STRAIN_XY is not increasing in each step while the STRAIN_YY increases correctly.
The numerical example is a simple 2d cube of length and width 1.0 consisting of 1 linear element only. The material properties are the same from the Miehe tension example. The specimen is loaded exactly the same way as in the tension experiment.
Of course, I am aware of the fact that the element size is totally wrong for a phase-field simulation. I am merely trying to check the strain in a purely elastic case before crack initiation.
Is it due to the predictor-corrector nature or something which causes this problem?
--
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see https://groups.google.com/d/forum/dealii?hl=en
---
You received this message because you are subscribed to the Google Groups "deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dealii+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
-- ++--------------------------------------------++ Dr. Thomas Wick Maitre de conferences / Assistant Professor Centre de Mathematiques Appliquees (CMAP) Ecole Polytechnique 91128 Palaiseau cedex, France Email: thoma...@cmap.polytechnique.fr Phone: 0033 1 69 33 4579 www: http://www.cmap.polytechnique.fr/~wick/ ++--------------------------------------------++ --
Dear Thomas,
I already run the example with uniform mesh, hence global refinement with 0 refinement cycles.The problem is, a specimen with 100 or 1000 elements is difficult to check due to the terminal output being flooded.
I could just output the result for one element, but then wheres the difference.
Don't you ever do some simple FE patch examples?
Kind regards,S. A. Mohseni
--
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see https://groups.google.com/d/forum/dealii?hl=en
---
You received this message because you are subscribed to the Google Groups "deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dealii+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
I already run the example with uniform mesh, hence global refinement with 0 refinement cycles.The problem is, a specimen with 100 or 1000 elements is difficult to check due to the terminal output being flooded.
I could just output the result for one element, but then wheres the difference.
--
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see https://groups.google.com/d/forum/dealii?hl=en
---
You received this message because you are subscribed to the Google Groups "deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dealii+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
I hope you could explain me what could cause such a behavior in your implementation that deal.II gives different values for duh although the same postprocessor implementation is being used.Is it because of the coupled formulation?
Thank you for your help so far.
Kind regards,Seyed Ali
--
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see https://groups.google.com/d/forum/dealii?hl=en
---
You received this message because you are subscribed to the Google Groups "deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dealii+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
I did another trick: Increasing G_c has the same effect to achieve purely elastic behavior. So, I chose a high enough G_c value and it works!I obtain the same results and the duh values grow correctly.
Still I cannot understand fully why when cracking is initiated, there is no increase of the strains except the strain in the loaded direction.Maybe you are right, I try to compare a bigger example, but I already compared two phase-field codes.I have my own version with staggered scheme and it was not identical to your results after crack initiation.As mentioned before, in the elastic regime everything is identical and fine.
The only thing I changed a bit is the integration from quadratic to linear, but I am not sure, if seeting quadrature_formula(2) alone is enough for linear shape functions. You also had face_quadrature_formula or this Lobatto integration.Would you be so kind and explain what lines I have to change in order to obtain linear shape functions and not quadratic like set in the original version?
How many changes and the code would help a lot.Just to be sure I did it correct.
Thank you.
Best,Seyed Ali
--
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see https://groups.google.com/d/forum/dealii?hl=en
---
You received this message because you are subscribed to the Google Groups "deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dealii+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
The only thing I changed a bit is the integration from quadratic to linear, but I am not sure, if seeting quadrature_formula(2)
alone is enough for linear shape functions. You also had face_quadrature_formula or this Lobatto integration.Would you be so kind and explain what lines I have to change in order to obtain linear shape functions and not quadratic like set in the original version?How many changes and the code would help a lot.Just to be sure I did it correct.
Thank you.
Best,Seyed Ali
--
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see https://groups.google.com/d/forum/dealii?hl=en
---
You received this message because you are subscribed to the Google Groups "deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dealii+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see https://groups.google.com/d/forum/dealii?hl=en
---
You received this message because you are subscribed to the Google Groups "deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dealii+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.