-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
com py que permite continuar a partir de simulação
- Loading branch information
1 parent
7a5f369
commit 2218ad2
Showing
7 changed files
with
185 additions
and
58 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
# -*- coding: utf-8 -*- | ||
""" | ||
Spyder Editor | ||
Este é um arquivo de script temporário. | ||
""" | ||
from glob import glob | ||
import os, shutil | ||
import configparser | ||
|
||
dirname = os.getcwd() #os.path.dirname(os.path.abspath(__file__)) | ||
dirlist = glob(dirname + "/*/") | ||
print("Choose a folder there the results are contained:\nNo | Folder") | ||
for a in range(len(dirlist)): | ||
print("{} | {}\n".format(a,dirlist[a])) | ||
a = int(input("Enter the number of the folder\n")) | ||
res_dir = dirlist[a] | ||
|
||
config = configparser.ConfigParser() | ||
list_files = os.listdir(res_dir) | ||
|
||
if os.path.isfile(res_dir + 'settings.txt'): | ||
config.read(res_dir + 'settings.txt') | ||
nimpre = int(config['global']['nimpre'].split()[0]) | ||
else: | ||
print('The still not converted to vtk. Probable incomplete simulation.\n'+\ | ||
'settings.ini will be used.\n') | ||
config.read(dirname + '/settings.ini') | ||
nimpre = len(list_files)/2 | ||
|
||
|
||
N = int(config['global']['N'].split()[0]) | ||
ntype = int(config['global']['Ntype'].split()[0]) | ||
quant = [] | ||
x_files = [] | ||
v_files =[] | ||
|
||
for i in range(ntype): | ||
quant.append(int(config['par_'+str(i)]['quantidade'].split()[0])) | ||
x_files.append(config['par_'+str(i)]['x'].split()[0]) | ||
x_files[-1] = x_files[-1][1:len(x_files[-1])-1] | ||
v_files.append(config['par_'+str(i)]['v_file'].split()[0]) | ||
v_files[-1] = v_files[-1][1:len(v_files[-1])-1] | ||
|
||
step = input('Extract step no. (max {}) '.format(nimpre-1)) | ||
|
||
positions = [] | ||
with open(res_dir + 'position.csv.'+step) as file: | ||
for line in file: | ||
positions.append(line) | ||
velocities = [] | ||
with open(res_dir + 'velocity.csv.'+step) as file: | ||
for line in file: | ||
velocities.append(line) | ||
|
||
# verificar se não é desejavel fazer backup de arquivos de posição e velocidade | ||
a == 'n' | ||
i = 0 | ||
for f in x_files + v_files: | ||
if os.path.isfile(f) and a == 'n': | ||
a = input('Old positions files exist. Backup? y/n') | ||
if a != 'n' or a != 'N': | ||
try: | ||
if i == 0: | ||
bkp = 'bkp' | ||
os.mkdir(bkp) | ||
i = -1 | ||
except: | ||
while i >= 0: | ||
try: | ||
bkp = 'bkp'+str(i) | ||
os.mkdir(bkp) | ||
i = -1 | ||
except: | ||
i += 1 | ||
try: | ||
shutil.move(dirname + '/' + f, dirname + '/' + bkp + '/' + f) | ||
except: | ||
print('file ' +f+ ' not found!') | ||
|
||
k = 0 | ||
for i in range(ntype): | ||
with open(x_files[i],'w') as file: | ||
for j in range(quant[i]): | ||
file.write(positions[k]) | ||
k += 1 | ||
|
||
k = 0 | ||
for i in range(ntype): | ||
with open(v_files[i],'w') as file: | ||
for j in range(quant[i]): | ||
file.write(velocities[k]) | ||
k += 1 | ||
|
||
|
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 |
---|---|---|
@@ -1,60 +1,61 @@ | ||
# PARAMETROS GLOBAIS | ||
[global] | ||
nimpre = 150 # quntidade de saidas | ||
N = 1940 # número de partículas | ||
Ntype = 3 # número de tipos de partícula | ||
t_fim = 1000 # tempo de execução | ||
nimpre = 200 # quntidade de saidas | ||
N = 1089 # número de partículas | ||
Ntype = 1 # número de tipos de partícula | ||
t_fim = 50 # tempo de execução | ||
nimpre_init = 0 # começa a simular a partir no tempo referente ao snapshot (nimpre). | ||
dt = 0.0001 # passo de tempo | ||
dimX = 1200 # Dimensões da região de cálculo | ||
dimY = 600 # | ||
mesh = 96 48 # malha(elementos) | ||
rcut = 2.5 # *sigma | ||
dimX = 410 # Dimensões da região de cálculo | ||
dimY = 410 # | ||
mesh = 82 82 # malha(elementos) | ||
rcut = 5 # *sigma | ||
wall = 'eeee' # condição Elastica ou Periodica nas paredes norte, sul, leste, oeste | ||
Td = -1 # 2.897189213660259e+24 #temperatura desejada global constante (-1 = não aplicar) kb = 1.38064852E-23, Td = (2/(3*kb))*E | ||
temp_Td = 0 1000 100 # Tempo de velocity scaling [inicial, final, iterações_por_scaling] | ||
cold_cells = 1 5 1 52 # [cellx_ini, cellx_fin, celly_ini, celly_fin] | ||
hot_cells = 145 150 1 52 # [cellx_ini, cellx_fin, celly_ini, celly_fin] | ||
Td_hot = 100e+23 # temperatura nas cold cells constante. Td_hot = -1 desliga termostato | ||
Td_cold = 10e+23 # temperatura nas hot cells constante. Td_cold = -1 desliga termostato | ||
vd = 1 1 # velocidade distribuida com Maxwell Boltzmann | ||
NMPT = 500 # Número máximo de partículas que poderá mudar de process. Se não souber estimar, usar -1 ou o valor de N. | ||
Td_hot = -1 #100e+23 # temperatura nas cold cells constante. Td_hot = -1 desliga termostato | ||
Td_cold = -1 #10e+23 # temperatura nas hot cells constante. Td_cold = -1 desliga termostato | ||
vd = 2 2 # velocidade distribuida com Maxwell Boltzmann | ||
NMPT = 100 # Número máximo de partículas que poderá mudar de process. Se não souber estimar, usar -1 ou o valor de N. | ||
GField = 0 0 # Campo de força gravitacional que afeta todas as partículas | ||
# PARTICLE PROPERTIES | ||
# v é velocidade global, entrar dois número correspondentes ao vetor vx vy que serão aplicadas em todas as partículas | ||
# se v_file é dada, então ela será usada para dar a velocidade às partículas. Deve ser arquivo .csv. Deixar "%" se não usar. | ||
[par_0] | ||
x = 'grupo0.csv' | ||
x = 'bin_peq1.csv' | ||
v = 0 0 # velocidade global | ||
v_file = '%vgrupo0.csv' # velocidade de cada partícula | ||
m = 1 | ||
nome = 'g1' | ||
sigma = 1 # Lennard Jones | ||
sigma = 2 # Lennard Jones | ||
epsilon = 1 # Lennard Jones | ||
quantidade = 1900 | ||
quantidade = 1089 | ||
x_lockdelay = 0 # só vai poder mudar de posição a partir de t = x_lockdelay | ||
rs = 0 # raio sólido. Posição de partículas na superfície de um sólido de raio rs | ||
fric_term = 0 # fricção artifical | ||
[par_1] | ||
x = 'p_p.csv' | ||
v = 0 0 | ||
v_file = "%vp_p.csv" | ||
m = 20 | ||
nome = 'g3' | ||
sigma = 1 # Lennard Jones | ||
epsilon = 1 # Lennard Jones | ||
quantidade = 20 | ||
x_lockdelay = 300 # só vai poder mudar de posição a partir de t = x_lockdelay | ||
rs = 5 | ||
fric_term = 0 # fricção artifical | ||
[par_2] | ||
x = 'p_g.csv' | ||
v = 0 0 | ||
v_file = "%vp_g.csv" | ||
m = 20 | ||
nome = 'g3' | ||
sigma = 1 # Lennard Jones | ||
epsilon = 1 # Lennard Jones | ||
quantidade = 20 | ||
x_lockdelay = 300 # só vai poder mudar de posição a partir de t = x_lockdelay | ||
rs = 5 | ||
fric_term = 0 # fricção artifical | ||
#[par_1] | ||
# x = 'p_p.csv' | ||
# v = 0 0 | ||
# v_file = "%vp_p.csv" | ||
# m = 20 | ||
# nome = 'g3' | ||
# sigma = 1 # Lennard Jones | ||
# epsilon = 1 # Lennard Jones | ||
# quantidade = 20 | ||
# x_lockdelay = 300 # só vai poder mudar de posição a partir de t = x_lockdelay | ||
# rs = 5 | ||
# fric_term = 0 # fricção artifical | ||
#[par_2] | ||
# x = 'p_g.csv' | ||
# v = 0 0 | ||
# v_file = "%vp_g.csv" | ||
# m = 20 | ||
# nome = 'g3' | ||
# sigma = 1 # Lennard Jones | ||
# epsilon = 1 # Lennard Jones | ||
# quantidade = 20 | ||
# x_lockdelay = 300 # só vai poder mudar de posição a partir de t = x_lockdelay | ||
# rs = 5 | ||
# fric_term = 0 # fricção artifical |
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