Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
HO_homog
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
14
Issues
14
List
Boards
Labels
Service Desk
Milestones
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Baptiste Durand
HO_homog
Commits
bd18a9a3
Commit
bd18a9a3
authored
Jan 20, 2020
by
Baptiste Durand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update definition of local_project
Possibility to use vertex values in DG elements for kind of interpolation
parent
8bd1c91d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
5 deletions
+17
-5
ho_homog/toolbox_FEniCS.py
ho_homog/toolbox_FEniCS.py
+17
-5
No files found.
ho_homog/toolbox_FEniCS.py
View file @
bd18a9a3
...
...
@@ -162,32 +162,43 @@ def function_errornorm(u, v, norm_type="L2", enable_diff_fspace=False):
return
fe
.
norm
(
difference
,
norm_type
)
def
local_project
(
v
,
fspace
,
solver_method
:
str
=
""
,
metadata
:
dict
=
{}
):
def
local_project
(
v
,
fspace
,
solver_method
:
str
=
""
,
**
kwargs
):
"""
Info : https://comet-fenics.readthedocs.io/en/latest/tips_and_tricks.html#efficient-projection-on-dg-or-quadrature-spaces #noqa
Parameters
----------
v : [type]
[description]
input field
fspace : [type]
[description]
solver_method : str, optional
"LU" or "Cholesky" factorization
"LU" or "Cholesky" factorization. LU method used by default.
keyword arguments
----------
metadata : dict, optional
This can be used to define different quadrature degrees for different
terms in a form, and to override other form compiler specific options
separately for different terms. By default {}
See UFL user manual for more information
** WARNING** : May be over ignored if dx argument is also used. (Non étudié)
dx : Measure
Impose the dx measure for the projection.
This is for example useful to do some kind of interpolation on DG functionspaces.
Returns
-------
Function
"""
metadata
=
kwargs
.
get
(
"metadata"
,
{})
dX
=
kwargs
.
get
(
"dx"
,
fe
.
dx
(
metadata
=
metadata
))
dv
=
fe
.
TrialFunction
(
fspace
)
v_
=
fe
.
TestFunction
(
fspace
)
a_proj
=
fe
.
inner
(
dv
,
v_
)
*
fe
.
dx
(
metadata
=
metadata
)
b_proj
=
fe
.
inner
(
v
,
v_
)
*
fe
.
dx
(
metadata
=
metadata
)
a_proj
=
fe
.
inner
(
dv
,
v_
)
*
dX
b_proj
=
fe
.
inner
(
v
,
v_
)
*
dX
if
solver_method
==
"LU"
:
solver
=
fe
.
LocalSolver
(
a_proj
,
b_proj
,
solver_type
=
fe
.
cpp
.
fem
.
LocalSolver
.
SolverType
.
LU
...
...
@@ -305,3 +316,4 @@ def xdmf_mesh(mesh_file, import_subdomains=False, facet_file="", physical_file="
subdomains
=
fe
.
cpp
.
mesh
.
MeshFunctionSizet
(
mesh
,
cell_vc
)
return
mesh
,
subdomains
,
facet_regions
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment