Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
LDD-for-two-phase-flow-systems
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
David Seus
LDD-for-two-phase-flow-systems
Commits
5eb6bfee
Commit
5eb6bfee
authored
Oct 19, 2018
by
David Seus
Browse files
Options
Downloads
Patches
Plain Diff
testing atom staging
parent
6cf2d404
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
domain_layered_soil.py
+14
-86
14 additions, 86 deletions
domain_layered_soil.py
with
14 additions
and
86 deletions
domain_layered_soil.py
+
14
−
86
View file @
5eb6bfee
"""
This demo program demonstrates how to mark sub domains of a mesh
#!/usr/bin/python3
and store the sub domain markers as a mesh function to a DOLFIN XML
"""
This program sets up a domain together with a decomposition into subdomains
file.
modelling layered soil. This is used for our LDD article with tp-tp and tp-r
coupling.
T
he sub
domain
markers produced by this demo program are the ones
use
d
Along with t
he subdomain
s and the mesh domain markers are set
u
p
se
lf.
for the Stokes demo programs
.
The resulting mesh is saved into files for later use
.
"""
"""
# Copyright (C) 2007 Kristian B. Oelgaard
import
dolfin
as
df
#
import
mshr
# This file is part of DOLFIN.
#
# DOLFIN is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# DOLFIN is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
#
# Modified by Anders Logg, 2008.
#
# First added: 2007-11-15
# Last changed: 2011-01-25
# Begin demo
from
dolfin
import
*
set_log_level
(
1
)
set_log_level
(
1
)
# Sub domain for no-slip (mark whole boundary, inflow and outflow will overwrite)
class
Noslip
(
SubDomain
):
def
inside
(
self
,
x
,
on_boundary
):
return
on_boundary
# Sub domain for inflow (right)
class
Inflow
(
SubDomain
):
def
inside
(
self
,
x
,
on_boundary
):
return
x
[
0
]
>
1.0
-
DOLFIN_EPS
and
on_boundary
# Sub domain for outflow (left)
class
Outflow
(
SubDomain
):
def
inside
(
self
,
x
,
on_boundary
):
return
x
[
0
]
<
DOLFIN_EPS
and
on_boundary
# Read mesh
mesh
=
Mesh
(
"
../dolfin_fine.xml.gz
"
)
# Create mesh functions over the cell facets
sub_domains
=
MeshFunction
(
"
size_t
"
,
mesh
,
mesh
.
topology
().
dim
()
-
1
)
sub_domains_bool
=
MeshFunction
(
"
bool
"
,
mesh
,
mesh
.
topology
().
dim
()
-
1
)
sub_domains_double
=
MeshFunction
(
"
double
"
,
mesh
,
mesh
.
topology
().
dim
()
-
1
)
# Mark all facets as sub domain 3
sub_domains
.
set_all
(
3
)
sub_domains_bool
.
set_all
(
False
)
sub_domains_double
.
set_all
(
0.3
)
# Mark no-slip facets as sub domain 0, 0.0
noslip
=
Noslip
()
noslip
.
mark
(
sub_domains
,
0
)
noslip
.
mark
(
sub_domains_double
,
0.0
)
# Mark inflow as sub domain 1, 01
inflow
=
Inflow
()
inflow
.
mark
(
sub_domains
,
1
)
inflow
.
mark
(
sub_domains_double
,
0.1
)
# Mark outflow as sub domain 2, 0.2, True
outflow
=
Outflow
()
outflow
.
mark
(
sub_domains
,
2
)
outflow
.
mark
(
sub_domains_double
,
0.2
)
outflow
.
mark
(
sub_domains_bool
,
True
)
# Save sub domains to file
# Save sub domains to file
file
=
File
(
"
subdomains.xml
"
)
#file = File("subdomains_layered_soil.xml")
file
<<
sub_domains
#file << sub_domains
# FIXME: Not implemented
#file_bool = File("subdomains_bool.xml")
#file_bool << sub_domains_bool
file_double
=
File
(
"
subdomains_double.xml
"
)
#
file_double = File("subdomains_double.xml")
file_double
<<
sub_domains_double
#
file_double << sub_domains_double
# Save sub domains to VTK files
# Save sub domains to VTK files
file
=
File
(
"
subdomains.pvd
"
)
#file = File("subdomains_layered_soil.pvd")
file
<<
sub_domains
#file << sub_domains
file
=
File
(
"
subdomains_double.pvd
"
)
file
<<
sub_domains_double
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
sign in
to comment