Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Theresa Pollinger
MoSIS
Commits
b0cf065b
Commit
b0cf065b
authored
Apr 13, 2018
by
Theresa Pollinger
Browse files
visualize ephemeral mpd even though there is a weird error for miniscule unknown specifiers
parent
d251aca2
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
interview_kernel/example_interview.ipynb
View file @
b0cf065b
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
interview_kernel/interview_kernel.py
View file @
b0cf065b
...
...
@@ -46,7 +46,7 @@ Let's set up a model and simulation together.
To get explanations, enter `explain <optional keyword>`.
To see a recap of what we know so far, enter `recap <optional keyword>`.
To interactively visualize the
r
current theory graph, enter `tgwiev` or `tgview mpd`.
To interactively visualize the current theory graph, enter `tgwiev` or `tgview mpd`.
Otherwise, you can always answer with \LaTeX-type input.
...
...
interview_kernel/mmtinterface.py
View file @
b0cf065b
# to run mmt server : cf. https://docs.python.org/3/library/subprocess.html
import
subprocess
import
psutil
import
time
# for now, running
# java -jar /home/freifrau/Desktop/masterarbeit/mmt/deploy/mmt.jar --file=server-interview.msl --keepalive
# or
# mmt
# extension info.kwarc.mmt.interviews.InterviewServer
# server on 8080
import
threading
# TODO ask dennis on whether and how to delete modules
...
...
@@ -32,7 +25,7 @@ def start_mmt_server(port_number, mmtjar):
def
exit_mmt_server
(
port_number
,
mmtjar
,
timeout
=
3.0
):
"""tries to shutdown the mmt server process"""
"""tries to shut
down the mmt server process"""
completed
=
subprocess
.
run
([
"/usr/bin/java"
,
"-jar"
,
mmtjar
,
":send"
,
str
(
port_number
),
"exit"
],
stdin
=
subprocess
.
PIPE
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
STDOUT
)
...
...
@@ -263,7 +256,7 @@ class MMTInterface:
except
ConnectionError
as
error
:
# this seems to never be called
print
(
error
)
print
(
"Are you sure the mmt server is running?"
)
raise
SystemExit
raise
# print(req.text) if self.debugprint else 0
if
req
.
text
.
startswith
(
'<'
):
root
=
etree
.
fromstring
(
req
.
text
)
...
...
interview_kernel/pde_state_machine.py
View file @
b0cf065b
...
...
@@ -791,7 +791,7 @@ class PDE_States:
# self.Display(Javascript(script + div)) # show the results
def
generate_mpd_theories
(
self
):
with
CriticalSubdict
(
{}
,
self
.
poutput
):
with
CriticalSubdict
(
self
.
simdata
[
self
.
state
]
,
self
.
poutput
):
# generate the Quantity of a hypothetical solution to an unknown
for
unknownentry
in
string_handling
.
get_recursively
(
self
.
simdata
[
"unknowns"
],
"theoryname"
):
mpd_theory_name
=
"MPD_"
+
unknownentry
...
...
@@ -813,7 +813,7 @@ class PDE_States:
+
string_handling
.
object_delimiter
+
" role Law"
])
# generate the Laws that define it, namely boundary conditions and PDEs
#TODO BCs
# generate the Laws that define it, namely boundary conditions and PDEs
pde_names
=
string_handling
.
get_recursively
(
self
.
simdata
[
"pdes"
],
"theoryname"
)
for
pde_number
in
range
(
len
(
pde_names
)):
mpd_theory_name
=
"MPD_pde"
+
str
(
pde_number
)
...
...
@@ -821,7 +821,7 @@ class PDE_States:
self
.
mmtinterface
.
mmt_new_theory
(
mpd_theory_name
)
self
.
include_in
(
mpd_theory_name
,
pde_names
[
pde_number
])
#include all the mpd_unknowns, parameters and bcs
#TODO
#
include all the mpd_unknowns, parameters and bcs
for
unknownentry
in
string_handling
.
get_recursively
(
self
.
simdata
[
"unknowns"
],
"theoryname"
):
self
.
include_in
(
mpd_theory_name
,
"MPD_"
+
unknownentry
)
...
...
@@ -834,6 +834,7 @@ class PDE_States:
string_handling
.
object_delimiter
+
" role Law"
)
])
with
CriticalSubdict
(
self
.
simdata
[
self
.
state
],
self
.
poutput
):
mpd_theory_name
=
"MPD_bcs"
self
.
mmtinterface
.
mmt_new_theory
(
mpd_theory_name
)
for
unknownentry
in
string_handling
.
get_recursively
(
self
.
simdata
[
"unknowns"
],
"theoryname"
):
...
...
@@ -849,11 +850,11 @@ class PDE_States:
string_handling
.
object_delimiter
+
" role BoundaryCondition"
)
])
with
CriticalSubdict
(
self
.
simdata
[
self
.
state
],
self
.
poutput
):
# make an actual model theory that includes all of the Laws declared so far,
# which in turn include the Quantities
modelname
=
"MPD_Model"
self
.
mmtinterface
.
mmt_new_theory
(
modelname
)
# include all the mpd_parameters, mpd_pdes and mpd_bcs #TODO
for
paramentry
in
string_handling
.
get_recursively
(
self
.
simdata
[
"parameters"
],
"theoryname"
):
self
.
include_in
(
modelname
,
"MPD_"
+
paramentry
)
for
pde_number
in
range
(
len
(
pde_names
)):
...
...
Write
Preview
Supports
Markdown
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