Skip to content

Commit

Permalink
solve with different solver - might work with Robin bcs + removing as…
Browse files Browse the repository at this point in the history
…sertion for the cellular cases (unecessesary)
  • Loading branch information
aashildte committed Sep 26, 2024
1 parent d97d28a commit 5a296b6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
11 changes: 5 additions & 6 deletions emimechanicalmodel/cardiac_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -405,9 +405,8 @@ def _define_kinematic_variables(self):

if self.experiment_str == "contraction":
state, test_state = self.state, self.test_state
weak_form += self._remove_rigid_motion_term(u, r, state, test_state)
#weak_form += self._add_robin_bnd_term()
#weak_form += df.inner(self.u, self.v)*self.ds
#weak_form += self._remove_rigid_motion_term(u, r, state, test_state)
weak_form += self._add_robin_bnd_term()

(self.F, self.E, self.sigma, self.P, self.u, self.weak_form,) = (
F,
Expand Down Expand Up @@ -497,7 +496,7 @@ def _add_robin_bnd_term(self):
"""
robin_value = df.Constant(1.0)
robin_bcs_term = df.inner(robin_value * self.u, self.v) * self.ds(1) # in all directions
robin_bcs_term = df.inner(robin_value * self.u, self.v) * df.ds

return robin_bcs_term

Expand All @@ -519,7 +518,7 @@ def solve(self, project=False):
# as per default we are using the manual implementation which
# should be at least as fast; however, we will
# just keep a simple version here for easy comparison:

"""
df.solve(
self.weak_form == 0,
self.state,
Expand All @@ -535,7 +534,7 @@ def solve(self, project=False):
"""
self._solver.solve(self.problem, self.state.vector())
"""

# save stress and strain to fenics functions
if project:
for proj_fun in self.projections:
Expand Down
6 changes: 2 additions & 4 deletions emimechanicalmodel/emi_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,7 @@ def evaluate_cellular_strain_magnitude(self):
Returns:
..math:: || \overline{E} || integrated over the extracellular space
"""
assert isinstance(self.mat_model, EMIMatrixHolzapfelMaterial), "Error: Collagen fibers not defined."


e1, e2 = self.fiber_dir, self.sheet_dir

E11 = df.inner(e1, self.E * e1)**2
Expand All @@ -235,8 +234,7 @@ def evaluate_cellular_stress_magnitude(self):
..math:: || \overline{E} || integrated over the extracellular space
"""
assert isinstance(self.mat_model, EMIMatrixHolzapfelMaterial), "Error: Collagen fibers not defined."


e1, e2 = self.fiber_dir, self.sheet_dir

sigma11 = df.inner(e1, self.sigma * e1)**2
Expand Down

0 comments on commit 5a296b6

Please sign in to comment.