Commit fba586b9 authored by Benoît LÉ's avatar Benoît LÉ

Revert "Splitted updateMaterialVariables into two functions:...

Revert "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)"

This reverts commit 857b3d0c.
parent 857b3d0c
......@@ -129,10 +129,12 @@ void Formulation::declareMaterialVariables(std::string name) {
OldAndCurrent_c::current();
}
void Formulation::updateMaterialVariables(std::string name) {
void Formulation::updateMaterialVariables(const xEvalTLSDamageFunction& eval_damage, std::string name) {
OldAndCurrent_c::current();
SetMaterialVariablesVisitor_c<xEvalTLSDamageFunction> set_visitor("d", eval_damage);
UpdateMaterialVariablesVisitor_c update_visitor("all");
VisitMaterialVariablesCommand_c visit_command(update_visitor, variab_manager);
xeCompositeMaterialVariablesVisitor_c composite_visitor(set_visitor, update_visitor);
VisitMaterialVariablesCommand_c visit_command(composite_visitor, variab_manager);
ApplyCommandOnIntegrationRule(visit_command, geom.getIntegRuleSmart(), geom.begin(name), geom.end(name));
}
......
......@@ -55,13 +55,10 @@ public:
// Declares material variables on integration points.
void declareMaterialVariables(std::string="all");
// 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
// Writes (restores) material variables values from phi.
// Writes first damage, then eventually others material variables by
// calling the special updateCurrentState("all") method of material.
void updateMaterialVariables(std::string="all");
void updateMaterialVariables(const xtls::xEvalTLSDamageFunction&, std::string="all");
// Writes current material variables to old ones.
void writeCurrentToOldMaterialVariables();
......@@ -143,6 +140,4 @@ protected:
std::vector<std::function<void (int)> > measure_fcts;
};
#include "Formulation_imp.h"
#endif
......@@ -82,8 +82,7 @@ void DynFormulation::updateCurrentState(double time, double time_step) {
computeLSAdvanceMeanFields();
computeDeltaLevelSetField(time_step);
updateLevelSetField(time);
updateMaterialVariablesFromLevelSet("d",tls_solver.getDamageEval());
updateMaterialVariables();
updateMaterialVariables(tls_solver.getDamageEval());
}
void DynFormulation::computeLSAdvanceMeanFields() {
......
......@@ -123,8 +123,7 @@ void QSFormulation::declareDispMeasField() {
void QSFormulation::updateCurrentState() {
computeDeltaLevelSetField();
updateLevelSetField();
updateMaterialVariablesFromLevelSet("d",tls_solver.getDamageEval());
updateMaterialVariables();
updateMaterialVariables(tls_solver.getDamageEval());
if(is_nonlinear) {
geom.buildLinearAndNonLinear(tls_solver.getPhiEval());
}
......@@ -137,8 +136,7 @@ bool QSFormulation::updateCurrentStateForced() {
}
tls_solver.writeOldToCurrentLevelSetField();
updateLevelSetFieldForced();
updateMaterialVariablesFromLevelSet("d",tls_solver.getDamageEval());
updateMaterialVariables();
updateMaterialVariables(tls_solver.getDamageEval());
if(is_nonlinear) {
geom.buildLinearAndNonLinear(tls_solver.getPhiEval());
}
......@@ -509,8 +507,7 @@ 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();
updateMaterialVariablesFromLevelSet("d",tls_solver.getDamageEval());
updateMaterialVariables();
updateMaterialVariables(tls_solver.getDamageEval());
writeStrain("eps_ref");
tls_solver.swapOldAndCurrentLevelSetField();
......@@ -522,8 +519,7 @@ void QSFormulation::restoreStep(PreProcessing& pre_pro) {
cutCrack();
}
tls_solver.delocalizeMeanField();
updateMaterialVariablesFromLevelSet("d",tls_solver.getDamageEval());
updateMaterialVariables();
updateMaterialVariables(tls_solver.getDamageEval());
SmoothMaterialVariable_c<double> eval("d", variab_manager);
post_pro.exportOnSpace("restored_d", pre_pro.getStep(), eval, geom.getIntegRuleBasic(0), geom.begin(), geom.end());
......
......@@ -100,8 +100,7 @@ void QSFormulRemeshAniso::updateLevelSetField() {
tls_solver.transferLevelSetField();
transferDispField();
transferMaterialVariables();
updateMaterialVariablesFromLevelSet("d",tls_solver.getDamageEval(),"duplicated");
updateMaterialVariables("duplicated");
updateMaterialVariables(tls_solver.getDamageEval(),"duplicated");
declareDispMeasField();
}
tls_solver.delocalizeMeanField();
......@@ -735,8 +734,7 @@ void QSFormulRemeshAniso::remesh() {
geom.buildBndMeas();
declareDispMeasField();
// tls_solver.swapOldAndCurrentLevelSetField();
updateMaterialVariablesFromLevelSet("d",tls_solver.getDamageEval());
updateMaterialVariables();
updateMaterialVariables(tls_solver.getDamageEval());
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