Commit 857b3d0c authored by Benoît LÉ's avatar Benoît LÉ

Splitted updateMaterialVariables into two functions:...

Splitted updateMaterialVariables into two functions: updateMaterialVariablesFromLevelSet can be used to deal with any internal variable which depends on the level set (not only the damage variable), updateMaterialVariables must then be used to update the other material variables (like eps_ref for instance)
parent 89ca0c12
......@@ -129,12 +129,10 @@ void Formulation::declareMaterialVariables(std::string name) {
OldAndCurrent_c::current();
}
void Formulation::updateMaterialVariables(const xEvalTLSDamageFunction& eval_damage, std::string name) {
void Formulation::updateMaterialVariables(std::string name) {
OldAndCurrent_c::current();
SetMaterialVariablesVisitor_c<xEvalTLSDamageFunction> set_visitor("d", eval_damage);
UpdateMaterialVariablesVisitor_c update_visitor("all");
xeCompositeMaterialVariablesVisitor_c composite_visitor(set_visitor, update_visitor);
VisitMaterialVariablesCommand_c visit_command(composite_visitor, variab_manager);
VisitMaterialVariablesCommand_c visit_command(update_visitor, variab_manager);
ApplyCommandOnIntegrationRule(visit_command, geom.getIntegRuleSmart(), geom.begin(name), geom.end(name));
}
......
......@@ -55,10 +55,13 @@ public:
// Declares material variables on integration points.
void declareMaterialVariables(std::string="all");
// Writes (restores) material variables values from phi.
// Writes first damage, then eventually others material variables by
// Writes (restores) material variable value from phi.
template<typename EVAL>
void updateMaterialVariablesFromLevelSet(std::string, const EVAL&, std::string="all");
// Writes (restores) others material variables by
// calling the special updateCurrentState("all") method of material.
void updateMaterialVariables(const xtls::xEvalTLSDamageFunction&, std::string="all");
void updateMaterialVariables(std::string="all");
// Writes current material variables to old ones.
void writeCurrentToOldMaterialVariables();
......@@ -140,4 +143,6 @@ protected:
std::vector<std::function<void (int)> > measure_fcts;
};
#include "Formulation_imp.h"
#endif
......@@ -82,7 +82,8 @@ void DynFormulation::updateCurrentState(double time, double time_step) {
computeLSAdvanceMeanFields();
computeDeltaLevelSetField(time_step);
updateLevelSetField(time);
updateMaterialVariables(tls_solver.getDamageEval());
updateMaterialVariablesFromLevelSet("d",tls_solver.getDamageEval());
updateMaterialVariables();
}
void DynFormulation::computeLSAdvanceMeanFields() {
......
......@@ -123,7 +123,8 @@ void QSFormulation::declareDispMeasField() {
void QSFormulation::updateCurrentState() {
computeDeltaLevelSetField();
updateLevelSetField();
updateMaterialVariables(tls_solver.getDamageEval());
updateMaterialVariablesFromLevelSet("d",tls_solver.getDamageEval());
updateMaterialVariables();
if(is_nonlinear) {
geom.buildLinearAndNonLinear(tls_solver.getPhiEval());
}
......@@ -136,7 +137,8 @@ bool QSFormulation::updateCurrentStateForced() {
}
tls_solver.writeOldToCurrentLevelSetField();
updateLevelSetFieldForced();
updateMaterialVariables(tls_solver.getDamageEval());
updateMaterialVariablesFromLevelSet("d",tls_solver.getDamageEval());
updateMaterialVariables();
if(is_nonlinear) {
geom.buildLinearAndNonLinear(tls_solver.getPhiEval());
}
......@@ -507,7 +509,8 @@ void QSFormulation::restoreStep(PreProcessing& pre_pro) {
xEvalField<xIdentity<xVector> > eval_disp(disp_field);
post_pro.exportOnSpace("restored_disp_basic", pre_pro.getStep(), eval_disp, geom.getIntegRuleBasic(0), geom.begin(), geom.end());
tls_solver.swapOldAndCurrentLevelSetField();
updateMaterialVariables(tls_solver.getDamageEval());
updateMaterialVariablesFromLevelSet("d",tls_solver.getDamageEval());
updateMaterialVariables();
writeStrain("eps_ref");
tls_solver.swapOldAndCurrentLevelSetField();
......@@ -519,7 +522,8 @@ void QSFormulation::restoreStep(PreProcessing& pre_pro) {
cutCrack();
}
tls_solver.delocalizeMeanField();
updateMaterialVariables(tls_solver.getDamageEval());
updateMaterialVariablesFromLevelSet("d",tls_solver.getDamageEval());
updateMaterialVariables();
SmoothMaterialVariable_c<double> eval("d", variab_manager);
post_pro.exportOnSpace("restored_d", pre_pro.getStep(), eval, geom.getIntegRuleBasic(0), geom.begin(), geom.end());
......
......@@ -100,7 +100,8 @@ void QSFormulRemeshAniso::updateLevelSetField() {
tls_solver.transferLevelSetField();
transferDispField();
transferMaterialVariables();
updateMaterialVariables(tls_solver.getDamageEval(),"duplicated");
updateMaterialVariablesFromLevelSet("d",tls_solver.getDamageEval(),"duplicated");
updateMaterialVariables("duplicated");
declareDispMeasField();
}
tls_solver.delocalizeMeanField();
......@@ -734,7 +735,8 @@ void QSFormulRemeshAniso::remesh() {
geom.buildBndMeas();
declareDispMeasField();
// tls_solver.swapOldAndCurrentLevelSetField();
updateMaterialVariables(tls_solver.getDamageEval());
updateMaterialVariablesFromLevelSet("d",tls_solver.getDamageEval());
updateMaterialVariables();
writeStrain("eps_ref");
//export mesh in mesh_long.msh to read it in main for the restart in the case of the aniso
......
/*
This source code is subject to non-permissive licence,
see the TLSDuctile/LICENSE file for conditions.
*/
#ifndef _TLSDuctile_Formulation_imp_h_
#define _TLSDuctile_Formulation_imp_h_
#include "TLSGeom.h"
#include "xAlgorithm.h"
#include "MaterialCommand.h"
#include "NonUniformMaterialSensitivity.h"
template<typename EVAL>
void Formulation::updateMaterialVariablesFromLevelSet(std::string variable_name, const EVAL& eval_variable, std::string domain_name){
OldAndCurrent_c::current();
SetMaterialVariablesVisitor_c<EVAL> set_visitor(variable_name, eval_variable);
VisitMaterialVariablesCommand_c visit_command(set_visitor, variab_manager);
ApplyCommandOnIntegrationRule(visit_command, geom.getIntegRuleSmart(), geom.begin(domain_name), geom.end(domain_name));
}
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment