예제 #1
0
    def _BuildVariableList(self):
        with tf.name_scope("Variables"):
            with tf.name_scope("LinearElasticModelVariables"):
                var_type_le = getattr(ConLawL.ModelVariables(), self.le_model_type)
                self.vars_le = var_type_le(self.init_var_values).Variables
                self.vars_le_plot = var_type_le(self.init_var_values).Vars4Print
                self.vars_le_limit = var_type_le.ConstrainVariables(self.vars_le, self.init_var_values)
            
            with tf.name_scope("DamageModelVariables"):
                if self.bezier_energy_approach == "On" and self.bezier_applied =="Yes":
                    var_type_nl = getattr(ConLawL.ModelVariables(), self.damage_model_type + "WithFractureEnergy")
                    self.vars_nl_plot = var_type_nl(self.init_var_values).Vars4Print
                    if bezier_train_controllers =="No":
                        self.vars_nl_plot = self.vars_nl_plot[:-3]
                elif self.bezier_energy_approach =="Off" and self.bezier_applied=="Yes":
                    var_type_nl = getattr(ConLawL.ModelVariables(), self.damage_model_type)
                    self.vars_nl_plot = var_type_nl(self.init_var_values).Vars4Print
                else:
                    if self.bezier_applied == "Yes":
                        print(" WARNING: Error in ModelSettings.Json !!!", "\n",\
                        "Please define the comp_energy_approach in ModelSettings.json as On or Off!")
                        sys.exit()
                    else:
                        var_type_nl = getattr(ConLawL.ModelVariables(), self.damage_model_type)
                        self.vars_nl_plot = var_type_nl(self.init_var_values).Vars4Print

                self.vars_nl = var_type_nl(self.init_var_values).Variables
            
                if self.bezier_applied == "Yes":
                    self.vars_nl_limit = var_type_nl.ConstrainVariables(self.vars_nl, self.vars_le_limit,  self.init_var_values)
                else:
                    self.vars_nl_limit = var_type_nl.ConstrainVariables(vars_nl)
예제 #2
0
 def _CallPredictedStresses(self):
     with tf.name_scope("LinearElasticLaw"):
         le_model = getattr(ConLawL.ConstitutiveLaw(), self.le_model_name)
         with tf.name_scope('PredictedStress'):
             self.SIG_PRED_LE = le_model.GetStress(self.EPS, self.vars_le_limit)
             SIG_EFF = le_model.GetStress(self.EPS, self.vars_le_limit)
     with tf.name_scope("DamageLaw"):    
         nl_model = getattr(ConLawL.ConstitutiveLaw(), self.damage_model_name)
         with tf.name_scope('PredictedStress'):
             self.SIG_PRED_NL = nl_model(SIG_EFF, self.vars_le_limit, self.vars_nl_limit).GetStress
예제 #3
0
 def _ConstructSummaryWriter(self):
     with tf.name_scope('AllSummaries'):
         sum_writer_le = getattr(ConLawL.ModelVariables(), self.le_model_type + "Summary")
         sum_writer_le(self.vars_le_limit)
         if self.bezier_applied == "Yes" and self.bezier_energy_approach == "On":
             sum_writer_nl = getattr(ConLawL.ModelVariables(), self.damage_model_type + \
                                 "WithFractureEnergy" + "Summary")
         else:
             sum_writer_nl = getattr(ConLawL.ModelVariables(), self.damage_model_type + \
                             "Summary")
         sum_writer_nl(self.vars_nl_limit)
예제 #4
0
    def _ImportTrainingData(self):
        Inputs = ConLawL.TrainingInput(self.input_settings)
        self.eps_le = Inputs.GetStrainsLinearElastic
        self.sig_le = Inputs.GetStressesLinearElastic
        #self.eps_nl = Inputs.GetStrainsNonlinear
        #self.sig_nl = Inputs.GetStressesNonlinear

        self.eps_le_train, self.eps_le_test, self.sig_le_train, self.sig_le_test = \
                              Inputs.SplitTrainingAndTesting(self.eps_le, self.sig_le)
예제 #5
0
 def _BuildVariableList(self):
     with tf.name_scope("Variables"):
         with tf.name_scope("LinearElasticModelVariables"):
             var_type_le = getattr(ConLawL.ModelVariables(),
                                   self.le_model_type)
             self.vars_le = var_type_le(self.init_var_values).Variables
             self.vars_le_plot = var_type_le(
                 self.init_var_values).Vars4Print
             self.vars_le_limit = var_type_le.ConstrainVariables(
                 self.vars_le, self.init_var_values)
예제 #6
0
 def _ConstructSummaryWriter(self):
     with tf.name_scope('AllSummaries'):
         sum_writer_le = getattr(ConLawL.ModelVariables(),
                                 self.le_model_type + "Summary")
         sum_writer_le(self.vars_le_limit)