Skip to content

Commit

Permalink
use bash shell
Browse files Browse the repository at this point in the history
  • Loading branch information
jhdark committed Oct 11, 2023
1 parent d166b73 commit c1f2b25
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions festim/material.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import ufl
from dolfinx import fem
import festim as F

Check warning on line 3 in festim/material.py

View check run for this annotation

Codecov / codecov/patch

festim/material.py#L1-L3

Added lines #L1 - L3 were not covered by tests


class Material:

Check warning on line 6 in festim/material.py

View check run for this annotation

Codecov / codecov/patch

festim/material.py#L6

Added line #L6 was not covered by tests
"""
Material class
"""

def __init__(self, D_0=None, E_D=None, name=None) -> None:

Check warning on line 11 in festim/material.py

View check run for this annotation

Codecov / codecov/patch

festim/material.py#L11

Added line #L11 was not covered by tests
"""Inits Material
Args:
D_0 (float): the diffusion coefficient at 0 K
E_D (float): the activation energy for diffusion
name (str): the name of the material
"""
self.D_0 = D_0
self.E_D = E_D
self.name = name

Check warning on line 20 in festim/material.py

View check run for this annotation

Codecov / codecov/patch

festim/material.py#L18-L20

Added lines #L18 - L20 were not covered by tests

def define_diffusion_coefficient(self, mesh, temperature):

Check warning on line 22 in festim/material.py

View check run for this annotation

Codecov / codecov/patch

festim/material.py#L22

Added line #L22 was not covered by tests
"""Defines the diffusion coefficient
Args:
temperature (dolfinx.fem.Constant): the temperature
Returns:
float: the diffusion coefficient
"""

if isinstance(self.D_0, float):
self.D_0 = fem.Constant(mesh, self.D_0)
if isinstance(self.E_D, float):
self.E_D = fem.Constant(mesh, self.E_D)

Check warning on line 33 in festim/material.py

View check run for this annotation

Codecov / codecov/patch

festim/material.py#L30-L33

Added lines #L30 - L33 were not covered by tests

return self.D_0 * ufl.exp(-self.E_D / F.k_B / temperature)

Check warning on line 35 in festim/material.py

View check run for this annotation

Codecov / codecov/patch

festim/material.py#L35

Added line #L35 was not covered by tests

0 comments on commit c1f2b25

Please sign in to comment.