Skip to content
Snippets Groups Projects

params/mirrors cleaning + usable test suite (issues #11 and #10)

Merged Boman Romain requested to merge testsuite into master
4 files
+ 70
27
Compare changes
  • Side-by-side
  • Inline
Files
4
+ 38
21
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Simple 2D wave-propagation test in 1 material
# simplified model of a mirror and a holder
# (two rectangular blocks on top of each other)
import mirrors as m
import tbox
@@ -9,31 +9,46 @@ import tbox.gmsh as gmsh
def model(p={}):
# configure/build mesh
pars={ 'L' : p['L'] , 'L_1' : p['L_1'], 'H' : p['H'], 'H_1' : p['H_1'], 'W' : p['W'], 'nL' : p['nL'], 'nL_1' : p['nL_1'], 'nH' : p['nH'], 'nH_1' : p['nH_1'], 'nW' : p['nW'] }
msh = gmsh.MeshLoader("mirror.geo",__file__).execute(**pars)
pbl = m.Problem(msh,"thermomechanical",22)
# [RB] what is the purpose of this dictionnary
# why couldn't we use "p" instead??
pars = { 'L' : p['L'] ,
'L_1' : p['L_1'],
'H' : p['H'],
'H_1' : p['H_1'],
'W' : p['W'],
'nL' : p['nL'],
'nL_1' : p['nL_1'],
'nH' : p['nH'],
'nH_1' : p['nH_1'],
'nW' : p['nW'] }
msh = gmsh.MeshLoader("mirror.geo", __file__).execute(**pars)
pbl = m.Problem(msh, "thermomechanical", 22)
# configure pbl
m.Medium(pbl, "Holder", "TZM",330000,0.36,0.114,0.5E-05)
m.Medium(pbl, "Mirror", "ScMo",330000,0.36,0.114,0.4E-05)
m.Medium(pbl, "Holder", "TZM", 330000, 0.36, 0.114, 0.5E-05)
m.Medium(pbl, "Mirror", "ScMo", 330000, 0.36, 0.114, 0.4E-05)
clamped = tbox.Pt(1,1,1)
values_clamped = tbox.Pt(0,0,0)
clamped = tbox.Pt(1, 1, 1)
values_clamped = tbox.Pt(0, 0, 0)
xyclamped = tbox.Pt(1,1,0)
xzclamped = tbox.Pt(1,0,1)
xyclamped = tbox.Pt(1, 1, 0)
xzclamped = tbox.Pt(1, 0, 1)
T = p['T']
m.uDirichlet(pbl, "Vertical clamped line", "Vertical clamped line_name",xyclamped,values_clamped)
m.uDirichlet(pbl, "Horizontal clamped line", "Horizontal clamped line_name",xzclamped,values_clamped)
m.TDirichlet(pbl, "Clamped Side", "Clamped",T)
m.uDirichlet(pbl, "Vertical clamped line",
"Vertical clamped line_name",
xyclamped, values_clamped)
m.uDirichlet(pbl, "Horizontal clamped line",
"Horizontal clamped line_name",
xzclamped, values_clamped)
m.TDirichlet(pbl, "Clamped Side", "Clamped", T)
return (pbl, msh) # retourner pbl sinon il semble detruit...
def runmodel(**d):
from fwk.wutils import parseargs
args=parseargs()
p={}
p['L'] = 250.0
@@ -49,18 +64,20 @@ def runmodel(**d):
p['T'] = 70.
p.update(d)
# builds an instance of the model with given parameters
(pbl, msh) = model(p)
# retrieves command-line arguments
from fwk.wutils import parseargs
args=parseargs()
args = parseargs()
solver = m.Solver(pbl,args.k)
# creates a solver and runs it
solver = m.Solver(pbl, args.k)
solver.start()
if not args.nogui:
from mirrors.viewer import GUI
GUI().open( 'mirror')
GUI().open('mirror')
return pbl.Sol
Loading