Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 9fda87d3 authored by ALI Olivier's avatar ALI Olivier :monkey_face:
Browse files

Fixed the _details methods for AbstractDomain and BVP, get the proper number of elements and dofs.

parent 6f5a5b63
No related branches found
No related tags found
1 merge request!10Draft: Feature/upgrade to fenicsx
...@@ -24,7 +24,10 @@ ...@@ -24,7 +24,10 @@
from functools import reduce from functools import reduce
import operator import operator
# OA: Order the imports from the most generic to the most local.
import ufl
from ufl.classes import Zero from ufl.classes import Zero
from dolfinx import fem
from typing import Union from typing import Union
...@@ -43,8 +46,7 @@ from bvpy.solvers.linear import LinearSolver ...@@ -43,8 +46,7 @@ from bvpy.solvers.linear import LinearSolver
from bvpy.solvers.nonlinear import NonLinearSolver from bvpy.solvers.nonlinear import NonLinearSolver
import ufl
from dolfinx import fem
class BVP(object): class BVP(object):
...@@ -192,7 +194,14 @@ class BVP(object): ...@@ -192,7 +194,14 @@ class BVP(object):
description += f'\t- {info}' + '\n' description += f'\t- {info}' + '\n'
description += '\nSystem to solve \n---------------\n' description += '\nSystem to solve \n---------------\n'
description += f" * Number of DOFs: {self.functionSpace.dim()}"
topo_dim = self.domain.mesh.topology.dim
all_cells = self.domain.mesh.topology.original_cell_index
dof_nbr = fem.locate_dofs_topological(self.functionSpace,
entity_dim=topo_dim,
entities=all_cells).shape[0]
description += f" * Number of DOFs: {dof_nbr}"
return description return description
...@@ -215,7 +224,7 @@ class BVP(object): ...@@ -215,7 +224,7 @@ class BVP(object):
if self.domain.mesh is None: if self.domain.mesh is None:
self.domain.discretize() self.domain.discretize()
def set_vform(self, vform: AbstractVform, constrain=None): def set_vform(self, vform:AbstractVform, constrain=None):
"""Instanciates the function space and the trial and test functions. """Instanciates the function space and the trial and test functions.
Parameters Parameters
......
...@@ -254,7 +254,7 @@ class AbstractDomain(ABC): ...@@ -254,7 +254,7 @@ class AbstractDomain(ABC):
------- -------
* Algorithm: {self._algorithm} * Algorithm: {self._algorithm}
* Cell type: {self._cell_type} * Cell type: {self._cell_type}
* Number: {self.mesh.ufl_cell().num_facets()} * Number of elements: {self.mesh.topology.original_cell_index.shape[0]}
* Resolution (i.e. prescribed element size): {self._cell_size:.2e} * Resolution (i.e. prescribed element size): {self._cell_size:.2e}
* Actual size (min, max): ({cell_min_diameter:.2e},\ * Actual size (min, max): ({cell_min_diameter:.2e},\
{cell_max_diameter:.2e}) {cell_max_diameter:.2e})
......
...@@ -167,7 +167,7 @@ def normal(domain, scale=1, interior=None, degree=1, name='normal'): ...@@ -167,7 +167,7 @@ def normal(domain, scale=1, interior=None, degree=1, name='normal'):
# u.rename(name, 'label') # u.rename(name, 'label')
u = ufl.FacetNormal(mesh) u = ufl.FacetNormal(mesh)
u.name = 'label' # u.name = 'label'
return u return u
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment