From c972274b254b595ad378ec0fa76fd70f60df0a3f Mon Sep 17 00:00:00 2001 From: Jeremy Bleyer Date: Sun, 15 Nov 2020 22:14:35 +0100 Subject: [PATCH] Remove dimension assertion and fix missing time step in behaviour --- bindings/python/mgis/fenics/gradient_flux.py | 4 ++-- bindings/python/mgis/fenics/nonlinear_problem.py | 8 +++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/bindings/python/mgis/fenics/gradient_flux.py b/bindings/python/mgis/fenics/gradient_flux.py index f329b73ec..3c1541ae6 100644 --- a/bindings/python/mgis/fenics/gradient_flux.py +++ b/bindings/python/mgis/fenics/gradient_flux.py @@ -78,12 +78,12 @@ def __init__(self, variable, expression, name, symmetric=None): if symmetric is None: self.expression = expression elif symmetric: - if self.variable.geometric_dimension() == 2: + if ufl.shape(expression) == (2, 2): self.expression = as_vector([symmetric_tensor_to_vector(expression)[i] for i in range(4)]) else: self.expression = symmetric_tensor_to_vector(expression) else: - if self.variable.geometric_dimension() == 2: + if ufl.shape(expression) == (2, 2): self.expression = as_vector([nonsymmetric_tensor_to_vector(expression)[i] for i in range(5)]) else: self.expression = nonsymmetric_tensor_to_vector(expression) diff --git a/bindings/python/mgis/fenics/nonlinear_problem.py b/bindings/python/mgis/fenics/nonlinear_problem.py index 3ff470773..cd28dfeb1 100644 --- a/bindings/python/mgis/fenics/nonlinear_problem.py +++ b/bindings/python/mgis/fenics/nonlinear_problem.py @@ -66,9 +66,11 @@ def __init__(self, u, material, quadrature_degree=2, bcs=None): self._dummy_function = Function(self.W0) if self.material.hypothesis == mgis_bv.Hypothesis.Tridimensional: - assert self.u.geometric_dimension()==3, "Conflicting geometric dimension and material hypothesis" + if self.u.geometric_dimension()!=3: + warning("Conflicting geometric dimension and material hypothesis") else: - assert self.u.geometric_dimension()==2, "Conflicting geometric dimension and material hypothesis" + if self.u.geometric_dimension()!=2: + warning("Conflicting geometric dimension and material hypothesis") if bcs is None: self.bcs = [] @@ -383,7 +385,7 @@ def update_constitutive_law(self): self.material.update_external_state_variables(self.state_variables["external"]) # integrate the behaviour mgis_bv.integrate(self.material.data_manager, self.integration_type, - 0, 0, self.material.data_manager.n); + self.dt, 0, self.material.data_manager.n); # getting the stress and consistent tangent operator back to # the FEniCS world. self.update_fluxes()