Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
cim
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
getdp
cim
Commits
df4c533c
Commit
df4c533c
authored
8 years ago
by
Nicolas Marsic
Browse files
Options
Downloads
Patches
Plain Diff
allow -setnumber
parent
05f6351b
No related branches found
No related tags found
No related merge requests found
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
bin/args.py
+28
-3
28 additions, 3 deletions
bin/args.py
bin/beyn.py
+1
-1
1 addition, 1 deletion
bin/beyn.py
bin/cim.py
+9
-2
9 additions, 2 deletions
bin/cim.py
bin/solver.py
+20
-15
20 additions, 15 deletions
bin/solver.py
example/maxwell_sibc/Makefile
+1
-1
1 addition, 1 deletion
example/maxwell_sibc/Makefile
with
59 additions
and
22 deletions
bin/args.py
+
28
−
3
View file @
df4c533c
...
@@ -4,7 +4,7 @@ Copyright (C) 2017 N. Marsic, F. Wolf, S. Schoeps and H. De Gersem,
...
@@ -4,7 +4,7 @@ Copyright (C) 2017 N. Marsic, F. Wolf, S. Schoeps and H. De Gersem,
Institut fuer Theorie Elektromagnetischer Felder (TEMF),
Institut fuer Theorie Elektromagnetischer Felder (TEMF),
Technische Universitaet Darmstadt.
Technische Universitaet Darmstadt.
See the LICENSE.txt and README.
txt
for more license and copyright information.
See the LICENSE.txt and README.
md
for more license and copyright information.
"""
"""
import
argparse
import
argparse
...
@@ -17,6 +17,7 @@ def parse():
...
@@ -17,6 +17,7 @@ def parse():
# Initialise
# Initialise
parser
=
argparse
.
ArgumentParser
(
prog
=
"
cim.py
"
,
parser
=
argparse
.
ArgumentParser
(
prog
=
"
cim.py
"
,
description
=
desc
,
description
=
desc
,
formatter_class
=
MyFormatter
,
epilog
=
"
authors:
"
+
epilog
=
"
authors:
"
+
"
N. Marsic, F. Wolf,
"
+
"
N. Marsic, F. Wolf,
"
+
"
S. Schoeps and H. De Gersem
"
)
"
S. Schoeps and H. De Gersem
"
)
...
@@ -44,6 +45,9 @@ def parse():
...
@@ -44,6 +45,9 @@ def parse():
help
=
"
step size for increasing col(A0)
"
)
help
=
"
step size for increasing col(A0)
"
)
parser
.
add_argument
(
"
-rankTol
"
,
type
=
float
,
default
=
1e-4
,
parser
.
add_argument
(
"
-rankTol
"
,
type
=
float
,
default
=
1e-4
,
help
=
"
relative tolerance for rank test
"
)
help
=
"
relative tolerance for rank test
"
)
parser
.
add_argument
(
"
-setnumber
"
,
type
=
str
,
default
=
[],
action
=
'
append
'
,
nargs
=
2
,
metavar
=
(
'
NAME
'
,
'
VALUE
'
),
help
=
"
set constant number NAME=VALUE
"
)
parser
.
add_argument
(
"
-quiet
"
,
action
=
'
store_true
'
,
parser
.
add_argument
(
"
-quiet
"
,
action
=
'
store_true
'
,
help
=
"
should I be quiet?
"
)
help
=
"
should I be quiet?
"
)
...
@@ -51,10 +55,31 @@ def parse():
...
@@ -51,10 +55,31 @@ def parse():
return
parser
.
parse_args
()
return
parser
.
parse_args
()
## Import only parse (other functions are just helpers)
__all__
=
[
'
parse
'
]
## Helper
desc
=
(
"
a non-linear eigenvalue solver
"
+
desc
=
(
"
a non-linear eigenvalue solver
"
+
"
using the contour integral method proposed by W.-J. Beyn
"
+
"
using the contour integral method proposed by W.-J. Beyn
"
+
"
coupled with a GetDP formulation.
"
)
"
coupled with a GetDP formulation.
"
)
## Import only parse (other functions are just helpers)
class
MyFormatter
(
argparse
.
HelpFormatter
):
__all__
=
[
'
parse
'
]
"""
Custom Formatter
"""
def
__init__
(
self
,
prog
):
super
(
MyFormatter
,
self
).
__init__
(
prog
,
indent_increment
=
2
,
max_help_position
=
30
,
width
=
None
)
def
_get_help_string
(
self
,
action
):
help
=
action
.
help
if
'
%(default)
'
not
in
action
.
help
:
if
action
.
default
is
not
argparse
.
SUPPRESS
:
defaulting_nargs
=
[
argparse
.
OPTIONAL
,
argparse
.
ZERO_OR_MORE
]
if
action
.
option_strings
or
action
.
nargs
in
defaulting_nargs
:
help
+=
'
(default: %(default)s)
'
return
help
This diff is collapsed.
Click to expand it.
bin/beyn.py
+
1
−
1
View file @
df4c533c
...
@@ -4,7 +4,7 @@ Copyright (C) 2017 N. Marsic, F. Wolf, S. Schoeps and H. De Gersem,
...
@@ -4,7 +4,7 @@ Copyright (C) 2017 N. Marsic, F. Wolf, S. Schoeps and H. De Gersem,
Institut fuer Theorie Elektromagnetischer Felder (TEMF),
Institut fuer Theorie Elektromagnetischer Felder (TEMF),
Technische Universitaet Darmstadt.
Technische Universitaet Darmstadt.
See the LICENSE.txt and README.
txt
for more license and copyright information.
See the LICENSE.txt and README.
md
for more license and copyright information.
"""
"""
import
solver
as
Solver
import
solver
as
Solver
...
...
This diff is collapsed.
Click to expand it.
bin/cim.py
+
9
−
2
View file @
df4c533c
...
@@ -5,7 +5,7 @@ Copyright (C) 2017 N. Marsic, F. Wolf, S. Schoeps and H. De Gersem,
...
@@ -5,7 +5,7 @@ Copyright (C) 2017 N. Marsic, F. Wolf, S. Schoeps and H. De Gersem,
Institut fuer Theorie Elektromagnetischer Felder (TEMF),
Institut fuer Theorie Elektromagnetischer Felder (TEMF),
Technische Universitaet Darmstadt.
Technische Universitaet Darmstadt.
See the LICENSE.txt and README.
txt
for more license and copyright information.
See the LICENSE.txt and README.
md
for more license and copyright information.
"""
"""
import
solver
as
Solver
import
solver
as
Solver
...
@@ -16,8 +16,15 @@ import args as args
...
@@ -16,8 +16,15 @@ import args as args
# Parse arguments
# Parse arguments
arg
=
args
.
parse
()
arg
=
args
.
parse
()
# Prepare variables of -setnumber for GetDP
setnumber
=
[]
for
i
in
arg
.
setnumber
:
setnumber
.
append
(
"
-setnumber
"
)
for
j
in
i
:
setnumber
.
append
(
j
)
# Initialise GetDP
# Initialise GetDP
operator
=
Solver
.
GetDPWave
(
arg
.
pro
,
arg
.
mesh
,
arg
.
resolution
)
operator
=
Solver
.
GetDPWave
(
arg
.
pro
,
arg
.
mesh
,
arg
.
resolution
,
setnumber
)
# Compute
# Compute
l
,
V
,
r
=
Beyn
.
simple
(
operator
,
arg
.
origin
,
arg
.
radius
,
l
,
V
,
r
=
Beyn
.
simple
(
operator
,
arg
.
origin
,
arg
.
radius
,
...
...
This diff is collapsed.
Click to expand it.
bin/solver.py
+
20
−
15
View file @
df4c533c
...
@@ -4,7 +4,7 @@ Copyright (C) 2017 N. Marsic, F. Wolf, S. Schoeps and H. De Gersem,
...
@@ -4,7 +4,7 @@ Copyright (C) 2017 N. Marsic, F. Wolf, S. Schoeps and H. De Gersem,
Institut fuer Theorie Elektromagnetischer Felder (TEMF),
Institut fuer Theorie Elektromagnetischer Felder (TEMF),
Technische Universitaet Darmstadt.
Technische Universitaet Darmstadt.
See the LICENSE.txt and README.
txt
for more license and copyright information.
See the LICENSE.txt and README.
md
for more license and copyright information.
"""
"""
import
getdp
as
GetDP
import
getdp
as
GetDP
...
@@ -26,24 +26,29 @@ class GetDPWave:
...
@@ -26,24 +26,29 @@ class GetDPWave:
fileName -- post-processing file name
fileName -- post-processing file name
"""
"""
def
__init__
(
self
,
pro
,
mesh
,
resolution
):
def
__init__
(
self
,
pro
,
mesh
,
resolution
,
optional
=
[]
):
"""
Instanciates a new SolverGetDP with a full
'
-solve
'
"""
Instanciates a new SolverGetDP with a full
'
-solve
'
Keyword arguments:
Keyword arguments:
pro -- the .pro file to use
pro -- the .pro file to use
mesh -- the .msh file to use
mesh -- the .msh file to use
resolution -- the resolution (from the .pro file) to use
resolution -- the resolution (from the .pro file) to use
optional -- optional arguments for GetDP (default value = [])
Optional argument has the following structure:
[
"
GetDP option
"
,
"
value 1
"
,
"
value 2
"
, ...,
"
GetDP option
"
, ...]
"""
"""
# Save
# Save
self
.
__pro
=
pro
self
.
__pro
=
pro
self
.
__mesh
=
mesh
self
.
__mesh
=
mesh
self
.
__resolution
=
resolution
self
.
__resolution
=
resolution
self
.
__optional
=
optional
# Generate DoFs and initialise RHS and solution vectors in GetDP
# Generate DoFs and initialise RHS and solution vectors in GetDP
GetDP
.
GetDP
([
"
getdp
"
,
self
.
__pro
,
GetDP
.
GetDP
([
"
getdp
"
,
self
.
__pro
,
"
-msh
"
,
self
.
__mesh
,
"
-msh
"
,
self
.
__mesh
,
"
-solve
"
,
self
.
__resolution
,
"
-solve
"
,
self
.
__resolution
,
"
-v
"
,
"
2
"
])
"
-v
"
,
"
2
"
]
+
self
.
__optional
)
def
solution
(
self
):
def
solution
(
self
):
"""
Returns the solution
"""
"""
Returns the solution
"""
...
@@ -64,7 +69,7 @@ class GetDPWave:
...
@@ -64,7 +69,7 @@ class GetDPWave:
GetDP
.
GetDPSetNumber
(
"
doApply
"
,
1
)
GetDP
.
GetDPSetNumber
(
"
doApply
"
,
1
)
GetDP
.
GetDP
([
"
getdp
"
,
self
.
__pro
,
GetDP
.
GetDP
([
"
getdp
"
,
self
.
__pro
,
"
-msh
"
,
self
.
__mesh
,
"
-msh
"
,
self
.
__mesh
,
"
-cal
"
])
"
-cal
"
]
+
self
.
__optional
)
GetDP
.
GetDPSetNumber
(
"
doApply
"
,
0
)
GetDP
.
GetDPSetNumber
(
"
doApply
"
,
0
)
def
solve
(
self
,
b
,
w
):
def
solve
(
self
,
b
,
w
):
...
@@ -75,7 +80,7 @@ class GetDPWave:
...
@@ -75,7 +80,7 @@ class GetDPWave:
GetDP
.
GetDPSetNumber
(
"
imposeRHS
"
,
1
)
GetDP
.
GetDPSetNumber
(
"
imposeRHS
"
,
1
)
GetDP
.
GetDP
([
"
getdp
"
,
self
.
__pro
,
GetDP
.
GetDP
([
"
getdp
"
,
self
.
__pro
,
"
-msh
"
,
self
.
__mesh
,
"
-msh
"
,
self
.
__mesh
,
"
-cal
"
])
"
-cal
"
]
+
self
.
__optional
)
GetDP
.
GetDPSetNumber
(
"
imposeRHS
"
,
0
)
GetDP
.
GetDPSetNumber
(
"
imposeRHS
"
,
0
)
def
view
(
self
,
x
,
fileName
):
def
view
(
self
,
x
,
fileName
):
...
@@ -92,7 +97,7 @@ class GetDPWave:
...
@@ -92,7 +97,7 @@ class GetDPWave:
GetDP
.
GetDPSetString
(
"
fileName
"
,
fileName
)
GetDP
.
GetDPSetString
(
"
fileName
"
,
fileName
)
GetDP
.
GetDP
([
"
getdp
"
,
self
.
__pro
,
GetDP
.
GetDP
([
"
getdp
"
,
self
.
__pro
,
"
-msh
"
,
self
.
__mesh
,
"
-msh
"
,
self
.
__mesh
,
"
-cal
"
])
"
-cal
"
]
+
self
.
__optional
)
GetDP
.
GetDPSetNumber
(
"
doPostpro
"
,
0
)
GetDP
.
GetDPSetNumber
(
"
doPostpro
"
,
0
)
@staticmethod
@staticmethod
...
...
This diff is collapsed.
Click to expand it.
example/maxwell_sibc/Makefile
+
1
−
1
View file @
df4c533c
...
@@ -6,7 +6,7 @@ init:
...
@@ -6,7 +6,7 @@ init:
gmsh sphere.geo
-3
gmsh sphere.geo
-3
cim
:
cim
:
python
${
BIN
}
/cim.py sphere.pro sphere.msh Solve 8.22543e9+2.46361e1j 1e8
-nodes
10
-lStart
4
python
${
BIN
}
/cim.py sphere.pro sphere.msh Solve 8.22543e9+2.46361e1j 1e8
-nodes
10
-lStart
4
-setnumber
isSC 0
clean
:
clean
:
rm
-f
*
.pos
rm
-f
*
.pos
...
...
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
register
or
sign in
to comment