Commit 42de92ce authored by delcmo's avatar delcmo
Browse files

tested the files on Apollo, added a setup file, added a restart file, cleaned...

tested the files on Apollo, added a setup file, added a restart file, cleaned up postprocessing script
parent 3999abf3
Loading
Loading
Loading
Loading
+11 −9
Original line number Diff line number Diff line
### Application block ###
application "/ascldap/users/lpswile/Workbench-Linux/rte/entry.sh /ascldap/users/lpswile/Workbench-Linux/rte/nek4nuc.py -i pipe_3840.parn -e srun -v 0 -nek '/ascldap/users/lpswile/Nek5000'"
    input_file 'pipe_3840.parn'
    input_tmpl 'pipe_3840.tmpl'

### Extract block ###
# Extract friction velocity
extract_from 'pipe_3840.dragLogic/pipe_3840.frctVel.txt' find last_line 
column 1 delimiter ' '
# Compute L2 error norm between Nek5000 data and experimental data
extract_from 'pipe_3840.linePlots/pipe_3840.avg.txt' using "/ascldap/users/lpswile/Workbench-Linux/rte/entry.sh pipe_3840_postprocess.py"
extract_from 'pipe_3840.linePlots/pipe_3840.avg.txt' using "/ascldap/users/lpswile/Workbench-Linux/rte/entry.sh pipe_3840_postprocess.py pipe_3840_pipe_exp_data.txt pipe_3840.linePlots/pipe_3840.avg.txt"

### Scheduler block ###
scheduler
    header = "#!/bin/bash"
    scheduler_header = "#!/bin/bash"
                       "#SBATCH --nodes=2"
                       "#SBATCH --ntasks=72"
                       "#SBATCH --time=03:00:00"
                       "#SBATCH --account=FY200018"
             "#SBATCH --job-name=nektry"
                       "#SBATCH --job-name=DakNek"
                       "module purge"
                       "module load sparc-dev/intel"
    submit_path = '/usr/bin/sbatch'
+7 −6
Original line number Diff line number Diff line
@@ -3,10 +3,11 @@
environment
  tabular_graphics_data
    tabular_graphics_file = 'pipe_3840_tabular_output.dat'
    write_restart = "pipe_3840_restart.dat"

method
  multidim_parameter_study
    partition 2 5 2
    partitions 2 5 2

variables
  active all
@@ -14,22 +15,22 @@ variables
    integer 2
      num_set_values 3 6 
      set_values 5 10 15 4 6 8 10 12 14
	  descriptor 'filterWeight' 'lx1'
	  descriptors 'filterWeight' 'lx1'
    real 1
      num_set_values 3 
      set_values 0.1 0.5 0.9
	  descriptor 'filterCutoffRatio'
	  descriptors 'filterCutoffRatio'

interface
  analysis_drivers = 'python dakota_driver.py'
  fork
  work_directory
    named 'pipe_3841_workdir'
    named 'pipe_3840_workdir'
    directory_tag
    directory_save
  copy_files = "pipe_3840.re2"
              "pipe_3840.tmpl"
              "pipe_3840_31000.fld"
              "pipe_3840_restart.fld"
              "dakota_driver.py"
              "pipe_3840.drive"
              "pipe_3840.txt"
@@ -44,6 +45,6 @@ interface

responses
	response_functions = 2 
        descriptors = 'L2_error_norm' 'Friction_velocity'
        descriptors = 'Friction_velocity' 'L2_error_norm'
	no_gradients
	no_hessians

pipe_3840.setup

0 → 100644
+15 −0
Original line number Diff line number Diff line
setup_properties {

    runtime_command = "/home/mxd/NEAMS+VisIt-rev67bd6a14e-Linux/rte/entry.sh /home/mxd/NEAMS+VisIt-rev67bd6a14e-Linux/rte/dakota.py"
    application_path = "/home/mxd/packages/dakota-6.10.0.Linux.x86_64/bin/dakota"
    hostname = "apollo.ornl.gov"
    username = "mxd"
    remote_execution_home = "/home/mxd"
    application_name = "dakota_nek4nuc_pipe_apollo"
    upload_patterns = ["${BASENAME}.re2", "${BASENAME}.in", "${BASENAME}.drive", "${BASENAME}.tmpl", "${BASENAME}.txt", "pipe_3840_postprocess.py", "pipe_3840_restart.fld", "pipe_3840_exp_xyz_coord.txt", "pipe_3840_pipe_exp_data.txt"]
    download_patterns = ["pipe_3840_tabular_output.dat", "pipe_3840_restart.dat"]

    version_number = "1.0.0"

    scheduler_type = single_box
}
 No newline at end of file
+1 −1
Original line number Diff line number Diff line
@@ -9,7 +9,7 @@ variableDt = yes
targetCFL = 0.8
timeStepper = bdf3
writeInterval = 1000000
startFrom = pipe_3840_31000
startFrom = "pipe_3840_restart"
filtering=hpfrt
filterWeight=<filterWeight>
filterCutoffRatio=<filterCutoffRatio>
+43 −58
Original line number Diff line number Diff line
@@ -7,41 +7,30 @@
import sys
import os
import math
import numpy as np

exp_data_file = '/ascldap/users/lpswile/Workbench-Linux/rte/full-3d/longPipeReTest.txt'
sim_data_file = 'pipe_3840.linePlots/pipe_3840.avg.txt'
# Get input arguments
exp_data_file = sys.argv[1]
sim_data_file = sys.argv[2]

#---------------------------------------------------------------#
############ post-processing Nek5000 simulation data ############
############ Post-processing Nek5000 simulation data ############
#---------------------------------------------------------------#
# Extract data from the Nek5000 line plot.
nb_head=5 # number of line to skip before reading Nek5000 data
exp_nb_head=2 # number of line to skip before reading experimental data
head=[] # list storing the head file
num_lines = sum(1 for line in open(sim_data_file, 'r')) # number of lines in the file

# read data file
data=open(sim_data_file, 'r')
for i in xrange(0,nb_head,1):
    line=data.readline()
    head.append(line.split())

# set and print information from head file
numlines = nb_points=int(head[3][0])

# declare variables to store data
t = []
head = [] # header
x = [] # x
y = [] # y
z = [] # z
vx = [] # velocity x 
vy = [] # velocity y
vz = [] # velocity z
vel_norm = [] # L2 norm of velocity 

# loop over the remaining of the file, make them float and store them
for i in xrange(0,numlines,1):
  line=data.readline()
with open(sim_data_file) as fp:
    lines = fp.readlines()
    # Extract header content
    for line in lines[0:nb_head]:
        head.append(line.split())
    # Extract numerical data
    for line in lines[nb_head:]:
        row = line.split()
        x.append(float(row[1]))
        y.append(float(row[2]))
@@ -51,44 +40,40 @@ for i in xrange(0,numlines,1):
        vz.append(float(row[6]))

# Compute norm of the velocity vector
for i in xrange(0,numlines,1):
vel_norm = [] # L2 norm of velocity
for i in xrange(0,len(x),1):
    temp1 = math.sqrt(vx[i]**2 + vy[i]**2 + vz[i]**2)
    vel_norm.append(temp1)

#---------------------------------------------------------------#
############### post-processing experimental data ###############
############### Post-processing experimental data ###############
#---------------------------------------------------------------#
# Read experimental data
# Read experimental data and store values in 'exp_vel'
exp_nb_head=2 # number of line to skip before reading experimental data
exp_vel = []
num_lines=sum(1 for line in open(exp_data_file, 'r')) # number of lines in the file
exp_data=open(exp_data_file, 'r')
for line in xrange(0, exp_nb_head, 1):
  exp_data.readline()
for line in xrange(exp_nb_head,num_lines,1):
  line=exp_data.readline()
with open(exp_data_file) as fp:
    for line in fp.readlines()[exp_nb_head:]:
        row = line.split()
        exp_vel.append(float(row[0]))

# Check experimental data consistency
if len(vel_norm) != len(exp_vel):
  print 'ERROR: the number of experimental nodes and the number of nodal velocity do not match.'
    msg = "ERROR: the number of experimental nodes and the number of nodal velocity do not match."
    print msg
    sys.exit()

res=[]
#---------------------------------------------------------------#
##################### Compute L2 error norm #####################
#---------------------------------------------------------------#

# Compute total L2 error norm
total = 0.0
for i in xrange(0,numlines,1):
for i in xrange(0,len(x),1):
    temp2 = exp_vel[i]-vel_norm[i]
  res.append(temp2)
    total += (temp2*temp2)

total = math.sqrt(total)

res_data=open("sumres.txt", 'w')
res_data.write(str(total))
# Print the total value
print total
data.close()
exp_data.close()
res_data.close()
sys.exit()
Loading