-
Notifications
You must be signed in to change notification settings - Fork 316
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'devel' of https://github.com/ElmerCSC/elmerfem into devel
- Loading branch information
Showing
46 changed files
with
2,510 additions
and
717 deletions.
There are no files selected for viewing
1 change: 1 addition & 0 deletions
1
ElmerWorkflows/FreeCADBatchFEMTools/tests/cylinders_thermo_structural/ELMERSOLVER_STARTINFO
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
sif/cylinders.sif |
75 changes: 75 additions & 0 deletions
75
ElmerWorkflows/FreeCADBatchFEMTools/tests/cylinders_thermo_structural/cylinders.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
# A test case for FreeCAD automatic scripting with thermo-structural (Elmer test is a modified fem/tests/ThermalBiMetal2) | ||
# original date: November 2019 | ||
# Author: Eelis Takala | ||
# email: eelis.takala@gmail.com | ||
doc = App.newDocument('Cylinders') | ||
import sys | ||
import os | ||
import time | ||
import math | ||
import FreeCAD | ||
import Part | ||
|
||
|
||
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', '..')) | ||
import FreeCADBatchFEMTools as FBFT | ||
|
||
script_directory = os.path.dirname(__file__) | ||
|
||
def cylinder(r1, r2, h, name='cyl', mesh_size=10.): | ||
|
||
cyl = doc.addObject("PartDesign::Body","Cylinder") | ||
sketch = cyl.newObject('Sketcher::SketchObject',name+' sketch') | ||
sketch.MapMode = 'FlatFace' | ||
sketch.addGeometry(Part.Circle(App.Vector(0.000000,0.000000,0),App.Vector(0,0,1),r2),False) | ||
sketch.addGeometry(Part.Circle(App.Vector(0.000000,0.000000,0),App.Vector(0,0,1),r1),False) | ||
doc.recompute() | ||
|
||
pad = cyl.newObject("PartDesign::Pad",name + " pad") | ||
pad.Profile = sketch | ||
pad.Length = h | ||
pad.Length2 = h | ||
pad.Type = 0 | ||
pad.UpToFace = None | ||
pad.Reversed = 0 | ||
pad.Midplane = 1 | ||
pad.Offset = 0.000000 | ||
doc.recompute() | ||
|
||
# create entities dict | ||
face_picks = [('b1', 0), ('b2', 1), ('b3', 2)] | ||
faces = FBFT.pick_faces_from_geometry(cyl, face_picks) | ||
solids = [] | ||
FBFT.add_entity_in_list(solids, name, cyl, {'mesh size': mesh_size}) | ||
entities_dict = FBFT.create_entities_dict(name, faces, solids, cyl) | ||
|
||
return entities_dict | ||
|
||
def create_geometry(): | ||
|
||
mesh_size_max = 100. | ||
cyl_entities_list = [] | ||
cyl_entities_list.append(cylinder(20, 10, 40., name='cyl1', mesh_size=3.)) | ||
cyl_entities_list.append(cylinder(30, 20, 20., name='cyl2', mesh_size=4.)) | ||
entities_dict = FBFT.merge_entities_dicts(cyl_entities_list, 'All', default_mesh_size=mesh_size_max, | ||
add_prefixes={'solids': False, 'faces': True}) | ||
solid_objects = FBFT.get_solids_from_entities_dict(entities_dict) | ||
|
||
mesh_object, compound_filter = FBFT.create_mesh_object_and_compound_filter(solid_objects, mesh_size_max, doc) | ||
|
||
FBFT.find_boundaries_with_entities_dict(mesh_object, compound_filter, entities_dict, doc) | ||
body_mesh_groups = FBFT.find_bodies_with_entities_dict(mesh_object, compound_filter, entities_dict, doc, point_search=False) | ||
FBFT.define_mesh_sizes(mesh_object, compound_filter, entities_dict, doc, point_search=False, ignore_list=['air']) | ||
|
||
FBFT.fit_view() | ||
FBFT.create_mesh(mesh_object) | ||
FBFT.export_unv(os.path.join(script_directory, 'cylinders.unv'), mesh_object) | ||
|
||
try: | ||
create_geometry() | ||
|
||
except Exception: | ||
import traceback | ||
print(str(traceback.format_exc())) | ||
|
||
exit() |
10 changes: 10 additions & 0 deletions
10
ElmerWorkflows/FreeCADBatchFEMTools/tests/cylinders_thermo_structural/run.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/bin/bash | ||
|
||
# A test case for FreeCAD automatic scripting with thermo-structural (Elmer test is a modified fem/tests/ThermalBiMetal2) | ||
# original date: November 2019 | ||
# Author: Eelis Takala | ||
# email: eelis.takala@gmail.com | ||
FreeCAD -c ${PWD}/cylinders.py | ||
ElmerGrid 8 2 cylinders.unv -autoclean | ||
ElmerSolver | ||
rm cylinders TEST.PASSED -r |
106 changes: 106 additions & 0 deletions
106
ElmerWorkflows/FreeCADBatchFEMTools/tests/cylinders_thermo_structural/sif/cylinders.sif
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
! A test case for FreeCAD automatic scripting with thermo-structural (Elmer test is a modified fem/tests/ThermalBiMetal2) | ||
! original date: November 2019 | ||
! Author: Eelis Takala | ||
! email: eelis.takala@gmail.com | ||
Check Keywords Warn | ||
INCLUDE "cylinders/mesh.names" | ||
Header | ||
Mesh DB "." "cylinders" | ||
End | ||
Simulation | ||
Max Output Level = 5 | ||
Coordinate System = Cartesian | ||
Simulation Type = Steady State | ||
Steady State Max Iterations = 1 | ||
! Post File = "case.ep" | ||
Post File = cylinders.vtu | ||
End | ||
Constants | ||
Permittivity Of Vacuum = 8.8542e-12 | ||
End | ||
Body 1 | ||
Name = cyl1 | ||
Target Bodies(1) = $ cyl1 | ||
Equation = 1 | ||
Material = 1 | ||
Initial Condition = 1 | ||
End | ||
Body 2 | ||
Name = cyl2 | ||
Target Bodies(1) = $ cyl2 | ||
Equation = 1 | ||
Material = 2 | ||
Body Force = 1 | ||
End | ||
Body Force 1 | ||
Heat Source = 1.0e3 | ||
End | ||
Equation 1 | ||
Active Solvers(2) = 1 2 | ||
Plane Stress = FALSE | ||
End | ||
Solver 1 | ||
Equation = HeatSolver | ||
Variable = Temperature | ||
Procedure = "HeatSolve" "HeatSolver" | ||
Steady State Convergence Tolerance = 1.0e-5 | ||
Nonlinear System Convergence Tolerance = 1.0e-4 | ||
Nonlinear System Max Iterations = 1 | ||
Nonlinear System Newton After Iterations = 3 | ||
Nonlinear System Newton After Tolerance = 1.0e-5 | ||
Nonlinear System Relaxation Factor = 1 | ||
Nonlinear System Convergence Measure = solution | ||
Linear System Solver = Iterative | ||
Linear System Iterative Method = BiCGStab | ||
Linear System Max Iterations = 500 | ||
Linear System Convergence Tolerance = 1.0e-8 | ||
Linear System Preconditioning = ILU1 | ||
Linear System ILUT Tolerance = 1.0e-3 | ||
Linear System Abort Not Converged = False | ||
Linear System Residual Output = 10 | ||
Linear System Precondition Recompute = 1 | ||
End | ||
Solver 2 | ||
Equation = "LinearDisp" | ||
Procedure = "StressSolve" "StressSolver" | ||
Variable = "Displacement" | ||
Variable DOFs = Integer 3 | ||
Linear System Solver = Direct | ||
Linear System Symmetric = Logical True | ||
Linear System Scaling = Logical False | ||
Linear System Iterative Method = BiCGStab | ||
Linear System Direct Method = UMFPACK | ||
Linear System Convergence Tolerance = 1.0e-8 | ||
Linear System Max Iterations = 200 | ||
Linear System Preconditioning = ILU2 | ||
Nonlinear System Convergence Tolerance = Real 1.0e-7 | ||
Nonlinear System Max Iterations = Integer 1 | ||
Nonlinear System Relaxation Factor = Real 1 | ||
Steady State Convergence Tolerance= 1.0e-6 | ||
Optimize Bandwidth = True | ||
End | ||
Material 1 | ||
Density = Real 1 | ||
Youngs Modulus = 1e9 | ||
Poisson Ratio = Real 0.3 | ||
Reference Temperature = 300.0 | ||
Heat Expansion Coefficient = 1.0e-4 | ||
Heat Conductivity = 1.0 | ||
End | ||
Material 2 | ||
Density = Real 1 | ||
Youngs Modulus = 1e9 | ||
Poisson Ratio = Real 0.3 | ||
Reference Temperature = 300.0 | ||
Heat Expansion Coefficient = 2.0e-4 | ||
Heat Conductivity = 10.0 | ||
End | ||
Boundary Condition 1 | ||
Name = cyl1_b1 | ||
Target Boundaries(1) = $ cyl1_b1 | ||
Displacement 1 = 0.0 | ||
Displacement 2 = 0.0 | ||
Temperature = 300.0 | ||
End | ||
Solver 1 :: Reference Norm = 1.016E+04 | ||
Solver 1 :: Reference Norm Tolerance = 1.0E-3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.