//========================= // constructors //========================= public Simulation(Codend Codend, Catch Catch, Towing Towing) { this.Codend = Codend; this.Catch = Catch; this.Towing = Towing; SolverSettings = new SolverSettings(); // start with default settings Codend.SetCylInitialShape(); Codend.RestrainEntrance(); CalculateBoundaryDOF(); }
static void Main(string[] args) { CultureInfo.DefaultThreadCurrentCulture = new CultureInfo("en-US"); try { Console.WindowWidth = 100; Console.WindowHeight = 50; } catch { } Console.WindowHeight = 50; //========================= // INPUT //========================= var inputReader = new InputReader(); inputReader.PrintInfo(); var nPanels = inputReader.CountPanels(); var nPanelMaterials = inputReader.CountPanelMaterials(); //========================================= // INITIALIZE PANEL MATERIALS //========================================= List <PanelMaterial> PanelMaterialList = new List <PanelMaterial>(); for (int i = 0; i < nPanelMaterials; i++) { PanelMaterialList.Add(new PanelMaterial(i + 1, inputReader)); } //foreach (var m in PanelMaterialList) //{ // m.PrintInfo(); //} //========================================= // INITIALIZE PANELS //========================================= List <Panel> PanelList = new List <Panel>(); for (int i = 0; i < nPanels; i++) { var panelInput = inputReader.ReadPanelInput(i + 1); if (panelInput.type.Equals("DiamondPanel", StringComparison.InvariantCultureIgnoreCase)) { PanelList.Add(new DiamondMeshPanel( LengthInMeshes: panelInput.meshesAlong, WidthInMeshes: panelInput.meshesAcross, Orientation: panelInput.orientation, Material: PanelMaterialList[panelInput.materialID - 1])); } else if (panelInput.type.Equals("SquarePanel", StringComparison.InvariantCultureIgnoreCase)) { PanelList.Add(new SquareMeshPanel( LengthInMeshes: panelInput.meshesAlong, WidthInMeshes: panelInput.meshesAcross, Orientation: panelInput.orientation, Material: PanelMaterialList[panelInput.materialID - 1])); } else { throw new ArgumentException("Panel types should be ither \'DiamondPanel\' or \'SquarePanel\'"); } } //foreach (var p in PanelList) //{ // p.PrintInfo(); //} //========================================= // INITIALIZE SELVEDGES //========================================= List <Selvedge> SelvedgeList = new List <Selvedge>(); if (inputReader.SelvedgesIncluded()) { for (int i = 0; i < nPanels; i++) { SelvedgeList.Add(new Selvedge(i, inputReader)); } } //========================================= // INITIALIZE ROUND STRAPS //========================================= List <RoundStrap> RoundStrapList = new List <RoundStrap>(); if (inputReader.RoundStrapsIncluded()) { int strapCount = inputReader.CountRoundStraps(); for (int i = 0; i < strapCount; i++) { RoundStrapList.Add(new RoundStrap(i + 1, inputReader)); } } //========================================= // INITIALIZE CODEND //========================================= double R = inputReader.ReadCodendEntranceRadius(); var Codend = new Codend(PanelList, R) { SelvedgeList = SelvedgeList, StrapList = RoundStrapList, MeshSettings = new MeshSettings(inputReader) }; //========================================= // INITIALIZE CATCH //========================================= var Catch = new Catch(inputReader); //========================================= // INITIALIZE TOWING //========================================= var TowingAlongY = new Towing(inputReader); //========================================= // INITIALIZE SIMULATION //========================================= var TowingSimulation = new Simulation(Codend, Catch, TowingAlongY) { SolverSettings = new SolverSettings(inputReader), FilePaths = inputReader }; TowingSimulation.Simulate(); ////TowingSimulation.ConvergenceStudy(); //Console.ReadKey(); }
public void SetAxiInitialShape(InputReader filePaths, Catch Catch, int catchNumber, Towing towing) { InitializeFemLists(); if (Catch.applyMethod.Equals("ByBlockedMeshes", StringComparison.InvariantCultureIgnoreCase)) { WriteAxiInput(filePaths, PanelList[0].Material, Catch.BlockedMeshes[catchNumber], towing.Speed); } else if (Catch.applyMethod.Equals("ByBlockingRatio", StringComparison.InvariantCultureIgnoreCase)) { double ratio = Catch.BlockingRatio[catchNumber]; double blockedMeshes = Math.Floor(PanelList[0].LengthInMeshes * ratio); WriteAxiInput(filePaths, PanelList[0].Material, blockedMeshes, towing.Speed); } else { throw new ArgumentException("Unknown catch application method"); } Process p = new Process(); //p.StartInfo.WindowStyle = ProcessWindowStyle.Hidden; p.StartInfo.FileName = filePaths.AxiExe; p.Start(); p.WaitForExit(); double[] AxiX = RemoveAxiKnots(ReadAxiOutput(filePaths.OutputAxiShapes)); double totalAngle = 2 * Math.PI / PanelCount; for (int i = 0; i < PanelCount; i++) { PanelList[i].CreateUnitMesh(MeshSettings); if (StrapList.Count != 0) { for (int j = 0; j < StrapList.Count; j++) { PanelList[i].LabelNodesForStrap(StrapList[j]); } } PanelList[i].MapToAxiModel(AxiX, -totalAngle, totalAngle / 2 - i * totalAngle); } if (SelvedgeList.Count != 0) { CreateAllSelvedges(); } if (StrapList.Count != 0) { CreateAllStraps(); } JoinMeshedPanels(); UpdateTotalLength(); }