recherche:softs:neper:exemples

Générer un maillage du triangle stéréographique standard et y tracer un champ scalaire

neper -T -n 1 -domain "stdtriangle(10)" -dim 2 -o stdtri
neper -M stdtri.tess -cl 0.04 -mesh2dalgo fron -statnode x,y
awk '{print $2}' stdtri.stnode > data
neper -V stdtri.msh -showelt1d all -dataelt1drad 0.001           \
         -dataelt2dedgerad 0.0005 -cameraangle 3.4 -print stdtri \
         -datanodecol scal:data -dataeltcol from_nodes           \
         -datanodescale 0.0:0.1:0.2:0.3:0.4                      \
         -print stdtri-col

Convertir un maillage périodique pour Zebulon

neper -T -n 10 -dim 3 -per 1 -oriformat geof -o polyper 
neper -M polyper.tess -for geof

Convertir un fichier .per en format Zebulon

  1. from collections import defaultdict
  2.  
  3. def do_mpc(per_filename):
  4. pairs = np.loadtxt('per_filename', usecols=[0,1])
  5. pairs_dir = np.loadtxt('per_filename', usecols=[2,3,4])
  6. pair_counter = 0
  7. cells = ""
  8. bc_u = []
  9. mpc = defaultdict(list)
  10. for idx, n in enumerate(pairs):
  11. mpc[n[1]].append(n[0])
  12.  
  13. for slave, master in mpc.iteritems():
  14. cells += "**nset cell{:0d}\n".format(pair_counter)
  15. if len(master)==1:
  16. n = [slave, master[0]]
  17. cells += "{:.0f} {:.0f}\n".format(n[0], n[1])
  18. bc_u.append('**mpc2 {:.0f} U1 {:.0f} U1\n**mpc2 {:.0f} U2 {:.0f} U2\n**mpc2 {:.0f} U3 {:.0f} U3'.format(n[0], n[1], n[0], n[1], n[0], n[1]))
  19. else:
  20. cells += " ".join(["{:.0f}".format(i) for i in master]) + " {:.0f}\n".format(slave)
  21. bc_u.append('**mpc1 cell{:0d} U1\n**mpc1 cell{:0d} U2\n**mpc1 cell{:0d} U3'.format(pair_counter, pair_counter, pair_counter))
  22.  
  23. pair_counter += 1
  24.  
  25. with open('cells_geof', 'w') as cell_geof:
  26. cell_geof.write(cells)
  27. with open('mpc_for_inp', 'w') as mpc_file:
  28. mpc_file.write('\n'.join(bc_u))
  29.  
  30. return '\n'.join(bc_u)

Référents

- Romain Quey - Aurélien Villani

  • recherche/softs/neper/exemples.txt
  • Dernière modification : 03/07/2018 13:15
  • de aurelien.villani