karthikmn commited on
Commit
aa4c877
·
verified ·
1 Parent(s): 72b796b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -18,7 +18,7 @@ def simulation_workflow(use_case, simulator, **kwargs):
18
  MP,EX,1,2E11 ! Elastic modulus
19
  MP,PRXY,1,0.3 ! Poisson's ratio
20
  BLOCK,0,{kwargs["length"]},0,{kwargs["width"]},0,{kwargs["thickness"]} ! Main block geometry
21
- CYLIND,0,{kwargs["hole_diameter"]/2},0,0,{kwargs["thickness"]} ! Circular hole geometry
22
  VSUB,ALL ! Subtract the hole from the block
23
  ET,1,SOLID185 ! Define element type as SOLID185
24
  ESIZE,5 ! Mesh element size
@@ -75,7 +75,7 @@ PRNSOL,U,SUM ! Print total deformation results
75
  part = Part("block", model)
76
  part.make_box(0, kwargs["length"], 0, kwargs["width"], 0, kwargs["thickness"])
77
  if use_case == "plate":
78
- part.cut_cylinder(0, kwargs["hole_diameter"] / 2, 0, kwargs["hole_diameter"] / 2, kwargs["thickness"])
79
  model.make_step_static(kwargs.get("force", kwargs.get("load", 0)))
80
  model.run()
81
  stress = model.results().max_stress()
@@ -119,9 +119,9 @@ interface = gr.Interface(
119
  gr.Slider(10, 50, step=1, label="Thickness (mm)"), # Input: Thickness
120
  gr.Slider(100, 500, step=10, label="Length (mm)"), # Input: Length
121
  gr.Slider(50, 200, step=10, label="Width (mm)"), # Input: Width
122
- gr.Slider(5, 25, step=1, label="Hole Diameter (mm)", optional=True), # Input: Hole Diameter (for plate)
123
- gr.Slider(1000, 10000, step=500, label="Force (N)", optional=True), # Input: Force (for plate)
124
- gr.Slider(1000, 20000, step=1000, label="Load (N)", optional=True) # Input: Load (for beam)
125
  ],
126
  outputs=[
127
  gr.Textbox(label="Simulation Results"), # Output: Simulation text results
 
18
  MP,EX,1,2E11 ! Elastic modulus
19
  MP,PRXY,1,0.3 ! Poisson's ratio
20
  BLOCK,0,{kwargs["length"]},0,{kwargs["width"]},0,{kwargs["thickness"]} ! Main block geometry
21
+ CYLIND,0,{kwargs.get("hole_diameter", 0) / 2},0,0,{kwargs["thickness"]} ! Circular hole geometry
22
  VSUB,ALL ! Subtract the hole from the block
23
  ET,1,SOLID185 ! Define element type as SOLID185
24
  ESIZE,5 ! Mesh element size
 
75
  part = Part("block", model)
76
  part.make_box(0, kwargs["length"], 0, kwargs["width"], 0, kwargs["thickness"])
77
  if use_case == "plate":
78
+ part.cut_cylinder(0, kwargs.get("hole_diameter", 0) / 2, 0, kwargs.get("hole_diameter", 0) / 2, kwargs["thickness"])
79
  model.make_step_static(kwargs.get("force", kwargs.get("load", 0)))
80
  model.run()
81
  stress = model.results().max_stress()
 
119
  gr.Slider(10, 50, step=1, label="Thickness (mm)"), # Input: Thickness
120
  gr.Slider(100, 500, step=10, label="Length (mm)"), # Input: Length
121
  gr.Slider(50, 200, step=10, label="Width (mm)"), # Input: Width
122
+ gr.Slider(5, 25, step=1, label="Hole Diameter (mm)", default=None), # Input: Hole Diameter (for plate)
123
+ gr.Slider(1000, 10000, step=500, label="Force (N)", default=None), # Input: Force (for plate)
124
+ gr.Slider(1000, 20000, step=1000, label="Load (N)", default=None) # Input: Load (for beam)
125
  ],
126
  outputs=[
127
  gr.Textbox(label="Simulation Results"), # Output: Simulation text results