def WriteFluidMat(name, density, viscosity, gravity, projectname): newsection = FluidMat(name, density, viscosity, gravity) key = 'BOOK: Fluid_Material\n' file = projectname + '.mat' filecontent = basicfunctions.splitfile(key, basicfunctions.readfile(file)) newcontent = filecontent[0] + key + newsection + filecontent[1] basicfunctions.writefile(file, newcontent)
def WriteStructureMat(name, density, young_module, poisson_ratio, thickness, cross_section_area, projectname): newsection = StructureMat(name, density, young_module, poisson_ratio, thickness, cross_section_area, projectname) key = 'BOOK: Structure_Material\n' file = projectname + '.mat' filecontent = basicfunctions.splitfile(key, basicfunctions.readfile(file)) newcontent = filecontent[0] + key + newsection + filecontent[1] basicfunctions.writefile(file, newcontent)
def GenerateMatFile(filename, mode): if mode == 1: filecontent = 'BOOK: Fluid_Material\n' elif mode == 2: filecontent = 'BOOK: Structure_Material\n' elif mode == 3: filecontent = 'BOOK: Fluid_Material\n' filecontent = filecontent + 'BOOK: Structure_Material\n' basicfunctions.writefile(filename, filecontent)
def AddElemToCndFile(newsection, projectname, domaintype): if domaintype == 'Fluid': key = 'BOOK: Fluid_Element_Type\n' if domaintype == 'Structure': key = 'BOOK: Structure_Element_Type\n' file = projectname + '.cnd' filecontent = basicfunctions.splitfile(key, basicfunctions.readfile(file)) newcontent = filecontent[0] + key + newsection + filecontent[1] basicfunctions.writefile(file, newcontent)
def AddBCToCndFile(newsection, projectname, domaintype): if domaintype == 'Fluid': key = 'BOOK: Fluid_Boundary_Conditions\n' if domaintype == 'Structure': key = 'BOOK: Structure_Boundary_Conditions\n' file = projectname + '.cnd' filecontent = basicfunctions.splitfile(key, basicfunctions.readfile(file)) newcontent = filecontent[0] + key + newsection + filecontent[1] basicfunctions.writefile(file, newcontent)
def GenerateCndFile(filename, mode): if mode == 1: filecontent = 'BOOK: Fluid_Boundary_Conditions\n' filecontent = filecontent + 'BOOK: Fluid_Element_Type\n' elif mode == 2: filecontent = 'BOOK: Structure_Boundary_Conditions\n' filecontent = filecontent + 'BOOK: Structure_Element_Type\n' elif mode == 3: con1 = 'BOOK: Fluid_Boundary_Conditions\n' con2 = 'BOOK: Fluid_Element_Type\n' con3 = 'BOOK: Fluid_Domain\n' + CndFluidDomainContent() con4 = 'BOOK: Structure_Boundary_Conditions\n' con5 = 'BOOK: Structure_Element_Type\n' con6 = 'BOOK: Structure_Domain\n' + CndStructureDomainContent() filecontent = con1 + con2 + con3 + con4 + con5+con6 basicfunctions.writefile(filename, filecontent)
def GenerateCndFile(filename, mode): if mode == 1: filecontent = 'BOOK: Fluid_Boundary_Conditions\n' filecontent = filecontent + 'BOOK: Fluid_Element_Type\n' elif mode == 2: filecontent = 'BOOK: Structure_Boundary_Conditions\n' filecontent = filecontent + 'BOOK: Structure_Element_Type\n' elif mode == 3: con1 = 'BOOK: Fluid_Boundary_Conditions\n' con2 = 'BOOK: Fluid_Element_Type\n' con3 = 'BOOK: Fluid_Domain\n' + CndFluidDomainContent() con4 = 'BOOK: Structure_Boundary_Conditions\n' con5 = 'BOOK: Structure_Element_Type\n' con6 = 'BOOK: Structure_Domain\n' + CndStructureDomainContent() filecontent = con1 + con2 + con3 + con4 + con5 + con6 basicfunctions.writefile(filename, filecontent)
def ImportFiles(projectname, projectpath, mode, archivpath): quelle = archivpath + 'coupling.prb' ziel = projectpath + projectname + '.gid' + '/' + projectname + '.prb' basicfunctions.writefile(ziel, basicfunctions.readfile(quelle)) quelle = archivpath + 'coupling.bas' ziel = projectpath + projectname + '.gid' + '/' + projectname + '.bas' basicfunctions.writefile(ziel, basicfunctions.readfile(quelle)) if mode == 1: quelle = archivpath + '010_coupling.fluid.prop.bas' ziel = projectpath + projectname + '.gid' + '/010_' + projectname + '.fluid.prop.bas' basicfunctions.writefile(ziel, basicfunctions.readfile(quelle)) quelle = archivpath + '014_coupling.node.bas' ziel = projectpath + projectname + '.gid' + '/014_' + projectname + '.fluid.node.bas' basicfunctions.writefile(ziel, basicfunctions.readfile(quelle)) quelle = archivpath + 'fluid.win.bat' ziel = projectpath + projectname + '.gid' + '/' + projectname + '.win.bat' basicfunctions.writefile(ziel, basicfunctions.readfile(quelle)) quelle = archivpath + 'fluid.unix.bat' ziel = projectpath + projectname + '.gid' + '/' + projectname + '.unix.bat' basicfunctions.writefile(ziel, basicfunctions.readfile(quelle)) elif mode == 2: quelle = archivpath + '020_coupling.structure.prop.bas' ziel = projectpath + projectname + '.gid' + '/020_' + projectname + '.structure.prop.bas' basicfunctions.writefile(ziel, basicfunctions.readfile(quelle)) quelle = archivpath + '024_coupling.node.bas' ziel = projectpath + projectname + '.gid' + '/024_' + projectname + '.structure.node.bas' basicfunctions.writefile(ziel, basicfunctions.readfile(quelle)) quelle = archivpath + 'structure.win.bat' ziel = projectpath + projectname + '.gid' + '/' + projectname + '.win.bat' basicfunctions.writefile(ziel, basicfunctions.readfile(quelle)) elif mode == 3: quelle = archivpath + '010_coupling.fluid.prop.bas' ziel = projectpath + projectname + '.gid' + '/010_' + projectname + '.fluid.prop.bas' basicfunctions.writefile(ziel, basicfunctions.readfile(quelle)) quelle = archivpath + '014_coupling.fluid.node.bas' ziel = projectpath + projectname + '.gid' + '/014_' + projectname + '.fluid.node.bas' basicfunctions.writefile(ziel, basicfunctions.readfile(quelle)) quelle = archivpath + '020_coupling.structure.prop.bas' ziel = projectpath + projectname + '.gid' + '/020_' + projectname + '.structure.prop.bas' basicfunctions.writefile(ziel, basicfunctions.readfile(quelle)) quelle = archivpath + '024_coupling.structure.node.bas' ziel = projectpath + projectname + '.gid' + '/024_' + projectname + '.structure.node.bas' basicfunctions.writefile(ziel, basicfunctions.readfile(quelle)) quelle = archivpath + 'fluidstructure.win.bat' ziel = projectpath + projectname + '.gid' + '/' + projectname + '.win.bat' basicfunctions.writefile(ziel, basicfunctions.readfile(quelle)) quelle = archivpath + '030_coupling.coupling.bas' ziel = projectpath + projectname + '.gid' + '/030_' + projectname + '.coupling.bas' basicfunctions.writefile(ziel, basicfunctions.readfile(quelle))
def GenerateStructureInitBas(filename): filecontent = '// Fixing degrees of freedom in nodes\n\n' basicfunctions.writefile(filename, filecontent)
def GenerateFluidCondBas(filename): filecontent = '\n\n// Fixing degrees of freedom in nodes\n\n' basicfunctions.writefile(filename, filecontent)
def GenerateStructureElemBas(filename): filecontent = '// Reading Elements\n\nElementsGroup = structural_group;\n\n' basicfunctions.writefile(filename, filecontent)
def GenerateFluidElemBas(filename): filecontent = '// Reading Elements\n\nElementsGroup = fluid_group;\n\n' basicfunctions.writefile(filename, filecontent)
def ImportFiles(projectname, projectpath, mode, archivpath): quelle = archivpath + 'coupling.prb' ziel = projectpath + projectname + '.gid' + '/' + projectname+'.prb' basicfunctions.writefile(ziel, basicfunctions.readfile(quelle)) quelle = archivpath + 'coupling.bas' ziel = projectpath + projectname + '.gid' + '/' + projectname+'.bas' basicfunctions.writefile(ziel, basicfunctions.readfile(quelle)) if mode == 1: quelle = archivpath + '010_coupling.fluid.prop.bas' ziel = projectpath + projectname + '.gid' + '/010_' + projectname+'.fluid.prop.bas' basicfunctions.writefile(ziel, basicfunctions.readfile(quelle)) quelle = archivpath + '014_coupling.node.bas' ziel = projectpath + projectname + '.gid' + '/014_' + projectname+'.fluid.node.bas' basicfunctions.writefile(ziel, basicfunctions.readfile(quelle)) quelle = archivpath + 'fluid.win.bat' ziel = projectpath + projectname + '.gid' + '/' + projectname+'.win.bat' basicfunctions.writefile(ziel, basicfunctions.readfile(quelle)) quelle = archivpath + 'fluid.unix.bat' ziel = projectpath + projectname + '.gid' + '/' + projectname+'.unix.bat' basicfunctions.writefile(ziel, basicfunctions.readfile(quelle)) elif mode == 2: quelle = archivpath + '020_coupling.structure.prop.bas' ziel = projectpath + projectname + '.gid' + '/020_' + projectname+'.structure.prop.bas' basicfunctions.writefile(ziel, basicfunctions.readfile(quelle)) quelle = archivpath + '024_coupling.node.bas' ziel = projectpath + projectname + '.gid' + '/024_' + projectname+'.structure.node.bas' basicfunctions.writefile(ziel, basicfunctions.readfile(quelle)) quelle = archivpath + 'structure.win.bat' ziel = projectpath + projectname + '.gid' + '/' + projectname+'.win.bat' basicfunctions.writefile(ziel, basicfunctions.readfile(quelle)) elif mode == 3: quelle = archivpath + '010_coupling.fluid.prop.bas' ziel = projectpath + projectname + '.gid' + '/010_' + projectname+'.fluid.prop.bas' basicfunctions.writefile(ziel, basicfunctions.readfile(quelle)) quelle = archivpath + '014_coupling.fluid.node.bas' ziel = projectpath + projectname + '.gid' + '/014_' + projectname+'.fluid.node.bas' basicfunctions.writefile(ziel, basicfunctions.readfile(quelle)) quelle = archivpath + '020_coupling.structure.prop.bas' ziel = projectpath + projectname + '.gid' + '/020_' + projectname+'.structure.prop.bas' basicfunctions.writefile(ziel, basicfunctions.readfile(quelle)) quelle = archivpath + '024_coupling.structure.node.bas' ziel = projectpath + projectname + '.gid' + '/024_' + projectname+'.structure.node.bas' basicfunctions.writefile(ziel, basicfunctions.readfile(quelle)) quelle = archivpath + 'fluidstructure.win.bat' ziel = projectpath + projectname + '.gid' + '/' + projectname+'.win.bat' basicfunctions.writefile(ziel, basicfunctions.readfile(quelle)) quelle = archivpath + '030_coupling.coupling.bas' ziel = projectpath + projectname + '.gid' + '/030_' + projectname+'.coupling.bas' basicfunctions.writefile(ziel, basicfunctions.readfile(quelle))