forked from PHengLEI/PHengLEI-TestCases
更新昇腾分支算例
This commit is contained in:
parent
9668b8d060
commit
edfcc04ada
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,97 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# @Author: sun
|
||||
# @Date: 2022-03-23 19:31:47
|
||||
# @Last Modified by: sun
|
||||
# @Last Modified time: 2022-03-23 19:32:05
|
||||
import sys
|
||||
import os
|
||||
|
||||
import acl
|
||||
|
||||
_ACL_DEBUG = 0
|
||||
_ACL_INFO = 1
|
||||
_ACL_WARNING = 2
|
||||
_ACL_ERROR = 3
|
||||
|
||||
def log_error(*log_msg):
|
||||
"""Recode error level log to file
|
||||
Args:
|
||||
*log_msg: format string and args list
|
||||
"""
|
||||
log_str = [str(i) for i in log_msg]
|
||||
log_str = "".join(log_str)
|
||||
|
||||
print(log_str)
|
||||
|
||||
caller_frame = sys._getframe().f_back
|
||||
# caller file
|
||||
filename = caller_frame.f_code.co_filename
|
||||
# caller line no
|
||||
line_no = caller_frame.f_lineno
|
||||
# caller function
|
||||
func_name = caller_frame.f_code.co_name
|
||||
|
||||
message = "[" + filename + ":" + str(line_no) + \
|
||||
" " + func_name + "]" + log_str
|
||||
acl.app_log(_ACL_ERROR, message)
|
||||
|
||||
def log_warning(*log_msg):
|
||||
"""Recode warning level log to file
|
||||
Args:
|
||||
*log_msg: format string and args list
|
||||
"""
|
||||
log_str = [str(i) for i in log_msg]
|
||||
log_str = "[WARNING]"+"".join(log_str)
|
||||
|
||||
print(log_str)
|
||||
|
||||
caller_frame = sys._getframe().f_back
|
||||
# caller file
|
||||
filename = caller_frame.f_code.co_filename
|
||||
# caller line no
|
||||
line_no = caller_frame.f_lineno
|
||||
# caller function
|
||||
func_name = caller_frame.f_code.co_name
|
||||
|
||||
message = "[" + filename + ":" + str(line_no) + \
|
||||
" " + func_name + "]" + log_str
|
||||
acl.app_log(_ACL_WARNING, message)
|
||||
|
||||
def log_info(*log_msg):
|
||||
"""Recode info level log to file
|
||||
Args:
|
||||
*log_msg: format string and args list
|
||||
"""
|
||||
log_str = [str(i) for i in log_msg]
|
||||
log_str = "".join(log_str)
|
||||
print(log_str)
|
||||
caller_frame = sys._getframe().f_back
|
||||
# caller file
|
||||
filename = caller_frame.f_code.co_filename
|
||||
# caller line no
|
||||
line_no = caller_frame.f_lineno
|
||||
# caller function
|
||||
func_name = caller_frame.f_code.co_name
|
||||
|
||||
message = "[" + filename + ":" + str(line_no) + \
|
||||
" " + func_name + "]" + log_str
|
||||
acl.app_log(_ACL_INFO, message)
|
||||
|
||||
def log_debug(*log_msg):
|
||||
"""Recode debug level log to file
|
||||
Args:
|
||||
*log_msg: format string and args list
|
||||
"""
|
||||
log_str = [str(i) for i in log_msg]
|
||||
log_str = "".join(log_str)
|
||||
caller_frame = sys._getframe().f_back
|
||||
# caller file
|
||||
filename = caller_frame.f_code.co_filename
|
||||
# caller line no
|
||||
line_no = caller_frame.f_lineno
|
||||
# caller function
|
||||
func_name = caller_frame.f_code.co_name
|
||||
|
||||
message = "[" + filename + ":" + str(line_no) + \
|
||||
" " + func_name + "]" + log_str
|
||||
acl.app_log(_ACL_DEBUG, message)
|
|
@ -0,0 +1,116 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# @Author: sun
|
||||
# @Date: 2022-03-23 19:32:36
|
||||
# @Last Modified by: sun
|
||||
# @Last Modified time: 2022-03-23 19:32:51
|
||||
"""
|
||||
Copyright (R) @huawei.com, all rights reserved
|
||||
-*- coding:utf-8 -*-
|
||||
CREATED: 2021-01-20 20:12:13
|
||||
MODIFIED: 2021-02-03 14:04:45
|
||||
"""
|
||||
import threading
|
||||
import acl
|
||||
|
||||
import acllite_utils as utils
|
||||
|
||||
REGISTER = 0
|
||||
UNREGISTER = 1
|
||||
|
||||
class _ResourceList(object):
|
||||
"""Acl resources of current application
|
||||
This class provide register inferace of acl resource, when application
|
||||
exit, all register resource will release befor acl.rt.reset_device to
|
||||
avoid program abnormal
|
||||
"""
|
||||
_instance_lock = threading.Lock()
|
||||
|
||||
def __init__(self):
|
||||
self.resources = []
|
||||
|
||||
def __new__(cls, *args, **kwargs):
|
||||
if not hasattr(_ResourceList, "_instance"):
|
||||
with _ResourceList._instance_lock:
|
||||
if not hasattr(_ResourceList, "_instance"):
|
||||
_ResourceList._instance = object.__new__(
|
||||
cls, *args, **kwargs)
|
||||
return _ResourceList._instance
|
||||
|
||||
def register(self, resource):
|
||||
"""Resource register interface
|
||||
Args:
|
||||
resource: object with acl resource, the object must be has
|
||||
method destroy()
|
||||
"""
|
||||
item = {"resource": resource, "status": REGISTER}
|
||||
self.resources.append(item)
|
||||
|
||||
def unregister(self, resource):
|
||||
"""Resource unregister interface
|
||||
If registered resource release by self and no need _ResourceList
|
||||
release, the resource object should unregister self
|
||||
Args:
|
||||
resource: registered resource
|
||||
"""
|
||||
for item in self.resources:
|
||||
if resource == item["resource"]:
|
||||
item["status"] = UNREGISTER
|
||||
|
||||
def destroy(self):
|
||||
"""Destroy all register resource"""
|
||||
for item in self.resources:
|
||||
if item["status"] == REGISTER:
|
||||
item["resource"].destroy()
|
||||
item["status"] = UNREGISTER
|
||||
|
||||
resource_list = _ResourceList()
|
||||
|
||||
class AclLiteResource(object):
|
||||
"""
|
||||
AclLiteResource
|
||||
"""
|
||||
|
||||
def __init__(self, device_id=0):
|
||||
self.device_id = device_id
|
||||
self.context = None
|
||||
self.stream = None
|
||||
self.run_mode = None
|
||||
|
||||
def init(self):
|
||||
"""
|
||||
init resource
|
||||
"""
|
||||
print("init resource stage:")
|
||||
ret = acl.init()
|
||||
print(f"resource ret:{ret}")
|
||||
utils.check_ret("acl.init", ret)
|
||||
|
||||
ret = acl.rt.set_device(self.device_id)
|
||||
utils.check_ret("acl.rt.set_device", ret)
|
||||
|
||||
self.context, ret = acl.rt.create_context(self.device_id)
|
||||
utils.check_ret("acl.rt.create_context", ret)
|
||||
|
||||
self.stream, ret = acl.rt.create_stream()
|
||||
utils.check_ret("acl.rt.create_stream", ret)
|
||||
|
||||
self.run_mode, ret = acl.rt.get_run_mode()
|
||||
utils.check_ret("acl.rt.get_run_mode", ret)
|
||||
|
||||
print("Init resource success")
|
||||
|
||||
def __del__(self):
|
||||
print("acl resource release all resource")
|
||||
resource_list.destroy()
|
||||
if self.stream:
|
||||
print("acl resource release stream")
|
||||
acl.rt.destroy_stream(self.stream)
|
||||
|
||||
if self.context:
|
||||
print("acl resource release context")
|
||||
acl.rt.destroy_context(self.context)
|
||||
|
||||
print("Reset acl device ", self.device_id)
|
||||
acl.rt.reset_device(self.device_id)
|
||||
acl.finalize()
|
||||
print("Release acl resource success")
|
|
@ -0,0 +1,252 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# @Author: sun
|
||||
# @Date: 2022-03-23 19:31:05
|
||||
# @Last Modified by: sun
|
||||
# @Last Modified time: 2022-03-23 19:31:26
|
||||
import numpy as np
|
||||
import acl
|
||||
import constants as const
|
||||
from acllite_logger import log_error, log_info
|
||||
import time
|
||||
|
||||
from functools import wraps
|
||||
DEBUG = True
|
||||
|
||||
def check_ret(message, ret_int):
|
||||
"""Check int value is 0 or not
|
||||
Args:
|
||||
message: output log str
|
||||
ret_int: check value that type is int
|
||||
"""
|
||||
if ret_int != 0:
|
||||
raise Exception("{} failed ret_int={}"
|
||||
.format(message, ret_int))
|
||||
|
||||
def check_none(message, ret_none):
|
||||
"""Check object is None or not
|
||||
Args:
|
||||
message: output log str
|
||||
ret_none: check object
|
||||
"""
|
||||
if ret_none is None:
|
||||
raise Exception("{} failed"
|
||||
.format(message))
|
||||
|
||||
def copy_data_device_to_host(device_data, data_size):
|
||||
"""Copy device data to host
|
||||
Args:
|
||||
device_data: data that to be copyed
|
||||
data_size: data size
|
||||
Returns:
|
||||
None: copy failed
|
||||
others: host data which copy from device_data
|
||||
"""
|
||||
host_buffer, ret = acl.rt.malloc_host(data_size)
|
||||
if ret != const.ACL_SUCCESS:
|
||||
log_error("Malloc host memory failed, error: ", ret)
|
||||
return None
|
||||
|
||||
ret = acl.rt.memcpy(host_buffer, data_size,
|
||||
device_data, data_size,
|
||||
const.ACL_MEMCPY_DEVICE_TO_HOST)
|
||||
if ret != const.ACL_SUCCESS:
|
||||
log_error("Copy device data to host memory failed, error: ", ret)
|
||||
acl.rt.free_host(host_buffer)
|
||||
return None
|
||||
|
||||
return host_buffer
|
||||
|
||||
def copy_data_device_to_device(device_data, data_size):
|
||||
"""Copy device data to device
|
||||
Args:
|
||||
device_data: data that to be copyed
|
||||
data_size: data size
|
||||
Returns:
|
||||
None: copy failed
|
||||
others: device data which copy from device_data
|
||||
"""
|
||||
device_buffer, ret = acl.rt.malloc(data_size,
|
||||
const.ACL_MEM_MALLOC_NORMAL_ONLY)
|
||||
if ret != const.ACL_SUCCESS:
|
||||
log_error("Malloc device memory failed, error: ", ret)
|
||||
return None
|
||||
|
||||
ret = acl.rt.memcpy(device_buffer, data_size,
|
||||
device_data, data_size,
|
||||
const.ACL_MEMCPY_DEVICE_TO_DEVICE)
|
||||
if ret != const.ACL_SUCCESS:
|
||||
log_error("Copy device data to device memory failed, error: ", ret)
|
||||
acl.rt.free(device_buffer)
|
||||
return None
|
||||
|
||||
return device_buffer
|
||||
|
||||
def copy_data_host_to_device(host_data, data_size):
|
||||
"""Copy host data to device
|
||||
Args:
|
||||
host_data: data that to be copyed
|
||||
data_size: data size
|
||||
Returns:
|
||||
None: copy failed
|
||||
others: device data which copy from host_data
|
||||
"""
|
||||
device_buffer, ret = acl.rt.malloc(data_size,
|
||||
const.ACL_MEM_MALLOC_NORMAL_ONLY)
|
||||
if ret != const.ACL_SUCCESS:
|
||||
log_error("Malloc device memory failed, error: ", ret)
|
||||
return None
|
||||
|
||||
ret = acl.rt.memcpy(device_buffer, data_size,
|
||||
host_data, data_size,
|
||||
const.ACL_MEMCPY_HOST_TO_DEVICE)
|
||||
if ret != const.ACL_SUCCESS:
|
||||
log_error("Copy device data to device memory failed, error: ", ret)
|
||||
acl.rt.free(device_buffer)
|
||||
return None
|
||||
|
||||
return device_buffer
|
||||
|
||||
def copy_data_host_to_host(host_data, data_size):
|
||||
"""Copy host data to host
|
||||
Args:
|
||||
host_data: data that to be copyed
|
||||
data_size: data size
|
||||
Returns:
|
||||
None: copy failed
|
||||
others: host data which copy from host_data
|
||||
"""
|
||||
host_buffer, ret = acl.rt.malloc_host(data_size)
|
||||
if ret != const.ACL_SUCCESS:
|
||||
log_error("Malloc host memory failed, error: ", ret)
|
||||
return None
|
||||
|
||||
ret = acl.rt.memcpy(host_buffer, data_size,
|
||||
host_data, data_size,
|
||||
const.ACL_MEMCPY_HOST_TO_HOST)
|
||||
if ret != const.ACL_SUCCESS:
|
||||
log_error("Copy host data to host memory failed, error: ", ret)
|
||||
acl.rt.free_host(host_buffer)
|
||||
return None
|
||||
|
||||
return host_buffer
|
||||
|
||||
def copy_data_to_dvpp(data, size, run_mode):
|
||||
"""Copy data to dvpp
|
||||
Args:
|
||||
data: data that to be copyed
|
||||
data_size: data size
|
||||
run_mode: device run mode
|
||||
Returns:
|
||||
None: copy failed
|
||||
others: data which copy from host_data
|
||||
"""
|
||||
policy = const.ACL_MEMCPY_HOST_TO_DEVICE
|
||||
if run_mode == const.ACL_DEVICE:
|
||||
policy = const.ACL_MEMCPY_DEVICE_TO_DEVICE
|
||||
|
||||
dvpp_buf, ret = acl.media.dvpp_malloc(size)
|
||||
check_ret("acl.rt.malloc_host", ret)
|
||||
|
||||
ret = acl.rt.memcpy(dvpp_buf, size, data, size, policy)
|
||||
check_ret("acl.rt.memcpy", ret)
|
||||
|
||||
return dvpp_buf
|
||||
|
||||
def copy_data_as_numpy(data, size, data_mem_type, run_mode):
|
||||
"""Copy data as numpy array
|
||||
Args:
|
||||
data: data that to be copyed
|
||||
size: data size
|
||||
data_mem_type: src data memory type
|
||||
run_mode: device run mode
|
||||
Returns:
|
||||
None: copy failed
|
||||
others: numpy array whoes data copy from host_data
|
||||
"""
|
||||
np_data = np.zeros(size, dtype=np.byte)
|
||||
np_data_ptr = acl.util.numpy_to_ptr(np_data)
|
||||
|
||||
policy = const.ACL_MEMCPY_DEVICE_TO_DEVICE
|
||||
if run_mode == const.ACL_HOST:
|
||||
if ((data_mem_type == const.MEMORY_DEVICE) or
|
||||
(data_mem_type == const.MEMORY_DVPP)):
|
||||
policy = const.ACL_MEMCPY_DEVICE_TO_HOST
|
||||
elif data_mem_type == const.MEMORY_HOST:
|
||||
policy = const.ACL_MEMCPY_HOST_TO_HOST
|
||||
|
||||
ret = acl.rt.memcpy(np_data_ptr, size, data, size, policy)
|
||||
check_ret("acl.rt.memcpy", ret)
|
||||
|
||||
return np_data
|
||||
|
||||
def align_up(value, align):
|
||||
"""Align up int value
|
||||
Args:
|
||||
value:input data
|
||||
align: align data
|
||||
Return:
|
||||
aligned data
|
||||
"""
|
||||
return int(int((value + align - 1) / align) * align)
|
||||
|
||||
def align_up16(value):
|
||||
"""Align up data with 16
|
||||
Args:
|
||||
value:input data
|
||||
Returns:
|
||||
16 aligned data
|
||||
"""
|
||||
return align_up(value, 16)
|
||||
|
||||
def align_up128(value):
|
||||
"""Align up data with 128
|
||||
Args:
|
||||
value:input data
|
||||
Returns:
|
||||
128 aligned data
|
||||
"""
|
||||
return align_up(value, 128)
|
||||
|
||||
def align_up2(value):
|
||||
"""Align up data with 2
|
||||
Args:
|
||||
value:input data
|
||||
Returns:
|
||||
2 aligned data
|
||||
"""
|
||||
return align_up(value, 2)
|
||||
|
||||
def yuv420sp_size(width, height):
|
||||
"""Calculate yuv420sp image size
|
||||
Args:
|
||||
width: image width
|
||||
height: image height
|
||||
Returns:
|
||||
image data size
|
||||
"""
|
||||
return int(width * height * 3 / 2)
|
||||
|
||||
def rgbu8_size(width, height):
|
||||
"""Calculate rgb 24bit image size
|
||||
Args:
|
||||
width: image width
|
||||
height: image height
|
||||
Returns:
|
||||
rgb 24bit image data size
|
||||
"""
|
||||
return int(width * height * 3)
|
||||
|
||||
def display_time(func):
|
||||
"""print func execute time"""
|
||||
@wraps(func)
|
||||
def wrapper(*args, **kwargs):
|
||||
"""wrapper caller"""
|
||||
if DEBUG:
|
||||
btime = time.time()
|
||||
res = func(*args, **kwargs)
|
||||
use_time = time.time() - btime
|
||||
print("in %s, use time:%s" % (func.__name__, use_time))
|
||||
return res
|
||||
else:
|
||||
return func(*args, **kwargs)
|
||||
return wrapper
|
|
@ -0,0 +1,697 @@
|
|||
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
// PPPPP H H EEEEE N N GGGGG L EEEEE III +
|
||||
// P P H H E NN N G L E I +
|
||||
// PPPPP HHHHH EEEEE N N N G GG L EEEEE I +
|
||||
// P H H E N N N G G L E I +
|
||||
// P H H EEEEE N N GGGGG LLLLL EEEEE III +
|
||||
//------------------------------------------------------------------------+
|
||||
// Platform for Hybrid Engineering Simulation of Flows +
|
||||
// China Aerodynamics Research and Development Center +
|
||||
// (C) Copyright, Since 2010 +
|
||||
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
#########################################################################
|
||||
# Default parameters for Grid conversion #
|
||||
#########################################################################
|
||||
// gridtype: Grid type for generation, conversion, reconstruction, merging.
|
||||
// 0 -- Unstructured grid.
|
||||
// 1 -- Structured grid.
|
||||
// 2 -- Hybrid grid, include both of unstructured and structured grid.
|
||||
// gridobj: Task type of grid treatment.
|
||||
// 0 -- Grid generation of typical case, such as cylinder, flat plate, etc.
|
||||
// 1 -- Grid conversion, from other grid data to PHenglEI( HyperFLOW ), such as Fluent, CGNS.
|
||||
// 2 -- Grid refinement.
|
||||
// 3 -- Grid merging, merge two blocks into one block.
|
||||
// 5 -- Grid repairing, repair the original grid in order to remove the negative volume cells.
|
||||
// 6 -- Grid mirroring, mirror a symmetry grid to whole grid.
|
||||
// multiblock: Multi-block grid or not, only for structured grid conversion.
|
||||
// 0 -- Not.
|
||||
// 1 -- Yes.
|
||||
// grid_database_index: Case of typical case, only for gridobj=0.
|
||||
// 1 - Laminar flat plate of subsonic flow.
|
||||
// 2 - Laminar flat plate of supersonic flow.
|
||||
// 3 - Turbulent flat plate of subsonic flow.
|
||||
// 4 - Turbulent flat plate of supersonic flow.
|
||||
// iadapt: Adaptation number for unstructure grid.
|
||||
// iovrlap: Overlapping( overset ) grid or not.
|
||||
// 0 -- NON-overlapping grid.
|
||||
// 1 -- Overlapping grid.
|
||||
// SymmetryFaceVector: The vector of symmetry face.
|
||||
// 0 -- X axis.
|
||||
// 1 -- Y axis.
|
||||
// 2 -- Z axis.
|
||||
int gridtype = 0;
|
||||
int gridobj = 1;
|
||||
int multiblock = 1;
|
||||
int grid_database_index = 3;
|
||||
int iadapt = 0;
|
||||
int iovrlap = 0;
|
||||
int SymmetryFaceVector = 1;
|
||||
|
||||
// axisup: Type of Cartisien coordinates system, used in grid conversion.
|
||||
// 1 -- Y upward. (default)
|
||||
// 2 -- Z upward.
|
||||
int axisup = 1;
|
||||
|
||||
// omit_no_bound_bc: What's boundary condition for the type of "no_boundary_condition".
|
||||
// 0 -- Interface. (default)
|
||||
// 1 -- Physical boundary condition, used in Hybrid solver.
|
||||
int omit_no_bound_bc = 0;
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
# Grid data type #
|
||||
//-----------------------------------------------------------------------
|
||||
// from_gtype/to_gtype: Type of grid data type in grid conversion process.
|
||||
// -1 -- MULTI_TYPE
|
||||
// 1 -- HyperFLOW( PHengLEI ), *.fts.
|
||||
// 2 -- CGNS, *.cgns.
|
||||
// 3 -- Plot3D type of structured grid, *.dat/*.grd.
|
||||
// 4 -- Fieldview type of unstructured grid, *.dat/*.inp.
|
||||
// 5 -- Fluent, *.cas/*.msh.
|
||||
// 6 -- Ustar, mgrid.in.
|
||||
// 7 -- Hybrid, include both of unstructured and structured grid, *.fts.
|
||||
// 8 -- GMSH, *.msh.
|
||||
int from_gtype = 2;
|
||||
int to_gtype = 1;
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
# File path #
|
||||
//-----------------------------------------------------------------------
|
||||
// from_gfile: path of original data file for unstructure grid convert from.
|
||||
// out_gfile: path of target file for grid convert to, *.fts type of file usually.
|
||||
string from_gfile = "./grid/rae2822_hybrid2d.cas";
|
||||
string out_gfile = "./grid/flat_laminr_133_85_2d.fts";
|
||||
|
||||
// ---------------- some advanced choices -----------------------------
|
||||
// iunsteady: The Grid is for unsteady simulation or not.
|
||||
int iunsteady = 0;
|
||||
int iale = 0;
|
||||
|
||||
// fileformat : Ustar Grid file format.
|
||||
// 0 --- ASCII
|
||||
// 1 --- BINARY
|
||||
int fileformat = 0;
|
||||
|
||||
// .skl meaning skeleton.
|
||||
string original_grid_info_file = "./grid/FLUENT_test.skl";
|
||||
|
||||
// Parameters for hybrid solver.
|
||||
string mixgrid_uns = "./grid/rae2822_uns2d_4.fts";
|
||||
string mixgrid_str = "./grid/flat_laminr_133_85_2d.fts";
|
||||
string mixgrid_str_bc = "./grid/flat_laminr_133_85_2d.inp";
|
||||
|
||||
// Some parameters for structured overlapping grid of GuoYongHeng start.
|
||||
int codeOfDigHoles = 1;
|
||||
string holeBasicFileName = "./oversetGridView/holeBasicFile.inp";
|
||||
string holeFullFileName = "./oversetGridView/holeFullFile.dat";
|
||||
string linkFileName = "./oversetGridView/topology.dat";
|
||||
string zoneInverseFileName = "./oversetGridView/zoneInverseMapping.inp";
|
||||
|
||||
#########################################################################
|
||||
# Default parameters for Partition #
|
||||
#########################################################################
|
||||
// pgridtype: The grid type.
|
||||
// 0 -- unstruct grid
|
||||
// 1 -- struct grid
|
||||
// 2 -- refine structured grid.
|
||||
// maxproc: The number of partition zones that want to be divided into.
|
||||
int pgridtype = 0;
|
||||
int maxproc = 4;
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
# File path #
|
||||
//-----------------------------------------------------------------------
|
||||
// original_grid_file : original grid file that want to be divided(HyperFLOW/PHengLEI type, *.fts).
|
||||
// partition_grid_file : target partition grid file(HyperFLOW/PHengLEI type, *.fts).
|
||||
string original_grid_file = "./grid/rae2822_hybrid2d.fts";
|
||||
string partition_grid_file = "./grid/rae2822_hybrid2d__4.fts";
|
||||
|
||||
// ------------------ Sompe advanced parameters ------------------------
|
||||
// omit_no_bound_bc: What's boundary condition for the type of "no_boundary_condition".
|
||||
// 0 -- Interface. (default)
|
||||
// 1 -- Physical boundary condition, used in Hybrid solver.
|
||||
// npartmethod: Method of interface reconstruction, default 1.
|
||||
// parallelPartMethod: Method of parallel partition, this is set only when execute parallel partition.It would be skipped when serial partition.
|
||||
// 1 -- Using ParMetis for homogeneous MPI.
|
||||
// 2 -- Using Metis for homogeneous MPI.
|
||||
// 3 -- using METIS partition for homogeneous OpenMP.
|
||||
// parmetisBalance: is used to specify the imbalance tolerance.
|
||||
// 1 -- perfect balance;
|
||||
// maxproc -- perfect imbalance;
|
||||
// 1.05 -- recommended.
|
||||
|
||||
int omit_no_bound_bc = 0;
|
||||
int npartmethod = 1;
|
||||
int parallelPartitionMethod = 2;
|
||||
double parmetisBalance = 1.05;
|
||||
|
||||
// Number of multi-grid levels, ONLY used for structured grid.
|
||||
// 1 -- single level, 2 -- 2 level, N -- N level, ..., et all.
|
||||
int numberOfMultigrid = 1;
|
||||
|
||||
|
||||
#########################################################################
|
||||
# Default parameters for CFD simulation #
|
||||
#########################################################################
|
||||
// maxsimustep: the max simulation step, don't care simulation is restart or not.
|
||||
// ndisk: the step intervals for 'flow.dat ' saved.
|
||||
// nplotsave: the step intervals for 'tecflow.dat ' saved.
|
||||
// nforcsave: the step intervals for 'aircoef.dat ' saved.
|
||||
// nressave: the step intervals for 'res.dat ' saved.
|
||||
// precon: precondition process to accelerate convergence for low speed flow.
|
||||
// 0 -- no precondition process. (default)
|
||||
// 1 -- carry out precondition process.
|
||||
|
||||
int ndisk = 1000;
|
||||
int maxsimustep = 20000;
|
||||
|
||||
int nplotsave = 1000;
|
||||
int nforcsave = 100;
|
||||
int nressave = 10;
|
||||
int precon = 0;
|
||||
|
||||
// m_block_proc: Method of grid zone distribution among different processors.
|
||||
// 0 -- Each zone is distributed by grid partition. (default)
|
||||
// 1 -- Each zone is distributed randomly.
|
||||
//compressible: 0 for incompressible flow, 1 for compressible flow (default).
|
||||
|
||||
int compressible = 1;
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
# CFD Control Parameter #
|
||||
//-----------------------------------------------------------------------
|
||||
// attackd: Angle of attack.
|
||||
// sideslipd: Angle of yaw.
|
||||
// reference_mach_number: Mach number.
|
||||
// reynolds: Reynolds number, which is based unit length, unit of 1/m.
|
||||
// reference_temperature_dimensional: dimensional reference temperature, or the total temperature only for the experiment condition.
|
||||
// reference_pressure_dimensional: dimensional reference pressure , or the total pressure only for the experiment condition.
|
||||
// height: Fly height, unit of km.
|
||||
// inflowParaType: the type of inflow parameters.
|
||||
// 0 - the nondimensional conditions.
|
||||
// 1 - the flight conditions.
|
||||
// 2 - the experiment conditions.
|
||||
// 3 - the subsonic boundary conditions.
|
||||
// twall: Temprature of the solid wall, minus value is for adiabatic boundary condition.
|
||||
// dump_Q: Dump out thermal flux Q of solid wall.
|
||||
// 0 - no dump out.
|
||||
// 1 - dump out wall Q only.
|
||||
// 2 - dump out wall Q & the typical position Q of ball.
|
||||
// 3 - dump out wall Q & the typical position Q of cone.
|
||||
// 4 - dump out wall Q & the typical position Q of double sphere.
|
||||
// Qstag: The Q of the stagnation point, calculated by Fay-Riddle formula.
|
||||
// gridUnit: The unit of the grid.
|
||||
// 0 - meter.
|
||||
// 1 - decimeter, 1 dm = 0.1 m.
|
||||
// 2 - centimeter, 1 cm = 0.01 m.
|
||||
// 3 - millimeter, 1 mm = 0.001m.
|
||||
// 4 - inch, 1 inch = 0.0254m.
|
||||
// 5 - foot, 1 foot = 12 inches = 0.3048m.
|
||||
// 6 - yard, 1 yard = 3 feet = 0.9144m.
|
||||
// forceRefenenceLength, forceRefenenceArea: Reference length and area, independent of grid unit.
|
||||
// forceRefenenceX, forceRefenenceY, forceRefenenceZ: Reference point, independent of grid unit.
|
||||
|
||||
double reference_mach_number = 0.73;
|
||||
double attackd = 2.79;
|
||||
double sideslipd = 0.00;
|
||||
|
||||
int inflowParaType = 0;
|
||||
double reynolds = 6.5e6;
|
||||
double reference_temperature_dimensional = 288.15;
|
||||
|
||||
//int inflowParaType = 1;
|
||||
//double height = 0.001;
|
||||
|
||||
//int inflowParaType = 2;
|
||||
//double reference_temperature_dimensional = 6051.024; //the total temperature, T*(1+(gama0-1)*M*M/2).
|
||||
//double reference_pressure_dimensional = 4.299696E09; //the total pressure, p*(T0/T)^(gama0/(gama0-1)).
|
||||
|
||||
//int inflowParaType = 3;
|
||||
//int nsubsonicInlet = 1;
|
||||
//int nsubsonicOutlet = 1;
|
||||
//string inLetFileName = "./bin/subsonicInlet.hypara";
|
||||
//string outLetFileName = "./bin/subsonicOutlet.hypara";
|
||||
//double reference_temperature_dimensional = 288.144;
|
||||
//double reference_pressure_dimensional = 1.01313E05;
|
||||
|
||||
|
||||
double twall = -1.0 ;
|
||||
int dump_Q = 0;
|
||||
double Qstag = 1.825e-3;
|
||||
|
||||
int gridUnit = 0;
|
||||
|
||||
double forceRefenenceLength = 1.0;
|
||||
double forceRefenenceLengthSpanWise = 1.0;
|
||||
double forceRefenenceArea = 1.0;
|
||||
double forceRefenenceX = 0.0;
|
||||
double forceRefenenceY = 0.0;
|
||||
double forceRefenenceZ = 0.0;
|
||||
|
||||
int directionMethod = 2; // 1 -- using direciton; 2 -- using face normal.
|
||||
double totalP_inlet = 1.2e6;
|
||||
double totalT_inlet = 1300;
|
||||
double direction_inlet[3] = 1, 0, 0;
|
||||
|
||||
double totalP_outlet = 17.8571428;
|
||||
double totalT_outlet = 1.0;
|
||||
double direction_outlet[3] = 1, 0, 0;
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
# Spatial Discretisation #
|
||||
//-----------------------------------------------------------------------
|
||||
#*******************************************************************
|
||||
# Struct Solver *
|
||||
#*******************************************************************
|
||||
// str_scheme_name: Spatial discretisation scheme of struct grid
|
||||
// Using this when solve structered grid or hybrid.
|
||||
// - "vanleer", "steger", "hlle", "lax_f"
|
||||
// - "roe","modified_roe"
|
||||
// - "ausm+", "ausm+w", "ausm+up", "ausmdv", "ausmpw"
|
||||
// str_limiter_name: Limiter of struct grid
|
||||
// - "vanalbada", "vanleer", "minmod", "smooth" "minvan" "3rdsmooth" "3rd_minmod_smooth"
|
||||
// - "nolim" - no limiter
|
||||
// - "vanalbada_clz" clz supersonic version
|
||||
string str_scheme_name = "roe";
|
||||
string str_limiter_name = "vanalbada";
|
||||
|
||||
#*******************************************************************
|
||||
# UnStruct Solver or Common *
|
||||
#*******************************************************************
|
||||
// iviscous: Viscous model
|
||||
// 0 - Euler
|
||||
// 1 - Lamilar
|
||||
// 2 - Algebraic
|
||||
// 3 - 1eq turbulent
|
||||
// 4 - 2eq turbulent
|
||||
// visname : Laminar or tubulent model
|
||||
// - "0eq-bl"
|
||||
// - "1eq-sa"
|
||||
// - "2eq-kw-menter-sst"
|
||||
// - "2eq-kw-menter-bsl"
|
||||
// - "2eq-kw-wilcox-1988"
|
||||
// - "2eq-kw-wilcox-1998"
|
||||
// - "2eq-kw-kok-tnt"
|
||||
// - "2eq-kw-wilcox-2006"
|
||||
// - "easm-kw-2003"
|
||||
// - "easm-kw-2005"
|
||||
// codeofDES : Type of DES
|
||||
// 0 - RANS (default);
|
||||
// 1 - DES;
|
||||
// 2 - DDES;
|
||||
// 3 - IDDES;
|
||||
// uns_scheme_name: Spatial discretisation scheme of Unstruct grid
|
||||
// Using this when solve Unstructered grid or hybrid.
|
||||
// - "vanleer", "roe", "steger", "kfvs", "lax_f", "hlle"
|
||||
// - "ausm+", "ausmdv", "ausm+w", "ausmpw", "ausmpwplus"
|
||||
// uns_limiter_name: Limiter of Unstruct grid
|
||||
// - "barth", "vencat", "vanleer", "minmod"
|
||||
// - "vanalbada", "smooth", "nnd", "lpz", "1st",
|
||||
// - "nolim" - no limiter
|
||||
// uns_vis_name: Discretisation method of viscous term.
|
||||
// - "std", "test", "aver", "new1", "new2"
|
||||
// uns_gradient: Gradient reconstruction method
|
||||
// - "default", "ggcell", "ggnode", "lsq"
|
||||
// ivencat: Variation of vencat limiter
|
||||
// 0 - org method, it is independent of grid scale
|
||||
// 1 - new method, it is dependent of grid scale
|
||||
// 4 - Ustar limiter model, without grid size unitary.
|
||||
// 7 - default used.
|
||||
// eps_vencat: Cofficient of vencat, when using vencat limter
|
||||
// limit_mode: limit model.
|
||||
// 0 - limit only for pressure and denstiny, then get the min value
|
||||
// 1 - limit for every variables, then get the min value
|
||||
// limiter_vec:
|
||||
// 0 - Each variable use the same limiter coefficient.
|
||||
// 1 - Each variable use the respective limiter coefficients.
|
||||
// reconmeth:
|
||||
// 0 - When reconstruct face value, Q+, Q- use respective limiter coefficients.
|
||||
// 1 - Q+, Q- use the min limiter coefficients of left and right cell.
|
||||
// nentrfix: Entropy fix.
|
||||
// 1 - common entropy fix.
|
||||
// 2 - Harte's method, to be continued.
|
||||
// 3 - Method in ZYB 's Doctor thesis, to be continued.
|
||||
// 4 - Method in Ustar.
|
||||
// alf_l, alf_n: Entropy fix cofficient for Roe scheme.
|
||||
|
||||
//int iviscous = 0;
|
||||
//string visname = "Euler";
|
||||
|
||||
//int iviscous = 1;
|
||||
//string visname = "laminar";
|
||||
|
||||
int iviscous = 3;
|
||||
string visname = "1eq-sa";
|
||||
|
||||
//int iviscous = 4;
|
||||
//string visname = "2eq-kw-menter-sst";
|
||||
|
||||
int codeofDES = 0;
|
||||
|
||||
string uns_scheme_name = "roe";
|
||||
string uns_limiter_name = "vencat";
|
||||
string uns_vis_name = "test";
|
||||
string uns_gradient_name = "ggnode";
|
||||
|
||||
int ivencat = 7;
|
||||
double eps_vencat = 5.0;
|
||||
int reconmeth = 1;
|
||||
int limit_mode = 0;
|
||||
int limiter_vec = 0;
|
||||
double limit_angle = 0;
|
||||
double skewnessAngle = 60.0;
|
||||
|
||||
int nentrfix = 1;
|
||||
double alf_l = 0.0001;
|
||||
double alf_n = 0.0001;
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
# Temporal Discretisation #
|
||||
//-----------------------------------------------------------------------
|
||||
// iunsteady: Steady or unsteady.
|
||||
// 0 - steady
|
||||
// 1 - unsteay
|
||||
// physicalTimeStep: the nondimensional physical time step.
|
||||
// startFromSteady: the unsteady simulation is start from steady flowfield or not, 0 is for no and else is for yes.
|
||||
// statisticsDES: Statistical variables for DES simulation.
|
||||
// startStatisticStep: Outer step when start statistics.
|
||||
// when the value is larger than "maxsimustep", it is useless.
|
||||
// min_sub_iter: the min sub iteration of unsteady simulation.
|
||||
// max_sub_iter: the max sub iteration of unsteady simulation.
|
||||
// tol_sub_iter: the tolerance of sub iteration of unsteady simulation.
|
||||
// tscheme: Temporal Discretisation method
|
||||
// 1 - Runge-Kutta Multi-State
|
||||
// 2 - Point implicit
|
||||
// 3 - Full implicit
|
||||
// 4 - LU-SGS
|
||||
// 5 - Block LU-SGS
|
||||
// 6 - Jacobian iteration
|
||||
// 7 - Lower G-S iteration
|
||||
// 8 - Upper G-S iteration
|
||||
// 9 - Lower/Upper G-S iteration
|
||||
// iSimplifyViscousTerm: Simplify the computation of viscous term in the Block LU-SGS method. The default value assigns 1 that could speed up the computation.
|
||||
// Otherwise, the viscous Jacobian matrix Mv should be computed that will increase the memory and time in iteration of the BLUSGS method.
|
||||
// cfl_start: Started cfl
|
||||
// cfl_end: End cfl
|
||||
// cfl_nstep: The number of step when cfl increase from cfl_start to cfl_end
|
||||
// ktmax: Dtratio. dt[i] = MIN( dt[i], ktmax * dtmin / vol[i] )
|
||||
// swapDq: Communication dq between forward/backward sweep of LUSGS or not, default 0.
|
||||
// sweeps: Sub iteration of LU-SGS or Block LU-SGS.
|
||||
// epsilon: Sub iter tolerance of LU-SGS or Block LU-SGS.
|
||||
// ntmst: Time step method
|
||||
// 0 - Local
|
||||
// 1 - Gloable
|
||||
// n_state: The number of Runge-Kutta step
|
||||
// lamda: Cofficient of Runge-Kutta step
|
||||
|
||||
int iunsteady = 0;
|
||||
double physicalTimeStep = 0.01;
|
||||
int startFromSteady = 0;
|
||||
int statisticsDES = 0;
|
||||
int startStatisticStep = 800000;
|
||||
|
||||
int min_sub_iter = 50;
|
||||
int max_sub_iter = 50;
|
||||
double tol_sub_iter = 0.01;
|
||||
|
||||
int tscheme = 1;
|
||||
int iSimplifyViscousTerm = 1;
|
||||
double cfl_start = 0.001;
|
||||
double cfl_end = 0.1;
|
||||
int cfl_nstep = 500;
|
||||
|
||||
double ktmax = 1.0e10;
|
||||
|
||||
int swapDq = 1;
|
||||
|
||||
int sweeps = 1;
|
||||
double epsilon = 0.1;
|
||||
int turb_sweeps = 1;
|
||||
double turb_epsilon = 0.1;
|
||||
|
||||
int ismooth_ns = 0;
|
||||
int icalvis = 1;
|
||||
int vis_run = 1;
|
||||
int iupdate = 1;
|
||||
int order = 2;
|
||||
|
||||
double limit_p = 3.0;
|
||||
double limit_r = 3.0;
|
||||
double visl_min = 0.01;
|
||||
int nnegtive_max = 0;
|
||||
|
||||
double cflturb = 1.0;
|
||||
double timemax = 1.0e10;
|
||||
double dtsave = -1.0;
|
||||
int iale = 0;
|
||||
int ialetype = 2;
|
||||
int maxale = 10;
|
||||
int ntmst = 0;
|
||||
double dtau = 0.001;
|
||||
double dtau_max = 1E-01;
|
||||
|
||||
int iwallfunction = 0;
|
||||
|
||||
|
||||
int n_stage = 2;
|
||||
double lamda[2] = 0.5, 1.0;
|
||||
|
||||
//int n_stage = 1;
|
||||
//double lamda[1] = 1.0;
|
||||
|
||||
//int n_stage = 4;
|
||||
//double lamda[4] = 0.25,0.33333333333,0.5,1.0;
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
# File In or Out #
|
||||
//-----------------------------------------------------------------------
|
||||
// gridfile: The partitioned Grid file path, using relative path,
|
||||
// which is relative to the working directory.
|
||||
// IMPORTANT WARNNING: the file index should be ignored,
|
||||
// e.g. if the partitioned grid is rae2822_hybrid2d__4_0.fts,
|
||||
// Please use 'rae2822_hybrid2d__4.fts' here!
|
||||
// visual_field: If dump out the field results to visulization
|
||||
// walldistMethod: The method to compute wall distance.
|
||||
// 0 - accurate but not fast enough.
|
||||
// 1 - fast but not accurate enough.
|
||||
// 2 - Super fast but more non-accurate!
|
||||
|
||||
int numberOfGridGroups = 1;
|
||||
string gridfile = "./grid/rae2822_hybrid2d__4.fts";
|
||||
|
||||
int walldistMethod = 1;
|
||||
|
||||
string resfile = "results/res.dat";
|
||||
string turbresfile = "results/turbres.dat";
|
||||
string aircoeffile = "results/aircoef.dat";
|
||||
|
||||
string flowfile = "results/flow.dat";
|
||||
string turbfile = "results/turb.dat";
|
||||
|
||||
string visualfile = "results/tecflow.plt";
|
||||
string Qwall_file = "results/Qwall.dat";
|
||||
string wall_aircoefile = "results/wall_aircoef.dat";
|
||||
|
||||
string surfacefile = "";
|
||||
|
||||
string wall_varfile = "";
|
||||
|
||||
string componentDefineFile = "bin/component.hypara";
|
||||
string jetDefineFile = "bin/jet.hypara";
|
||||
|
||||
string componentforcefile = "results/component_aircoef.dat";
|
||||
|
||||
string overset_gridfile = "iblank.ovs";
|
||||
|
||||
int visual_field = 0;
|
||||
|
||||
//visualSlice: The slice of tecflow
|
||||
// 0 - Do not save slice data
|
||||
// 1 - comput and save it to sliceFile
|
||||
//sliceAxis: Normal vector of slice
|
||||
// 1 - X_DIR
|
||||
// 2 - Y_DIR
|
||||
// 3 - Z_DIR
|
||||
//slicePostion: Coordinate of slice
|
||||
|
||||
int visualSlice = 0;
|
||||
int sliceAxis = 1;
|
||||
double slicePostion = -0.5;
|
||||
string sliceFile = "results/Slice.plt";
|
||||
|
||||
// min-max box of the visual block.
|
||||
double visual_block_min[3] = [0.0 0.0 0.0];
|
||||
double visual_block_max[3] = [1.0 1.0 1.0];
|
||||
|
||||
// nVisualVariables: number of variables want to be dumped for tecplot visualization.
|
||||
// visualVariables : variable types dumped, listed as following:
|
||||
// -- density(0), u(1), v(2), w(3), pressure(4), temperature(5), mach(6)
|
||||
// -- viscosityLaminar(7), viscosityTurbulent(8)
|
||||
// -- vorticity_x(9), vorticity_y(10), vorticity_z(11), vorticityMagnitude(12), strain_rate(13), Q_criteria(14)
|
||||
// -- Cp(15), timeStep(16), volume(17)
|
||||
// -- modeledTKE(18),modeleddissipationrate(19), SSTF1(20), SSTF2(21)
|
||||
// Important Warning: Array size of visualVariables MUST be equal to nVisualVariables!!!.
|
||||
// Arriables order must from small to larger.
|
||||
int nVisualVariables = 8;
|
||||
int visualVariables[8] = 0, 1, 2, 3, 4, 5, 6, 15;
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
# Turbulence Parameter #
|
||||
//-----------------------------------------------------------------------
|
||||
//turb_vis_kind :
|
||||
// const int VIS_STD = 0;
|
||||
// const int VIS_AVER = 1;
|
||||
// const int VIS_TEST = 2;
|
||||
// const int VIS_NEW1 = 3;
|
||||
// const int VIS_NEW2 = 4;
|
||||
// const int VIS_ERIC = 5;
|
||||
int turbInterval = 1;
|
||||
int turb_vis_kind = 2;
|
||||
int turb_s_kind = 0; //turb_s_kind = 0:original 1:edwards 2:new
|
||||
int mod_turb_res = 0;
|
||||
double turb_relax = 1.0;
|
||||
double turb_min_coef = 1.0e-1;
|
||||
double vistoo = 1.0e-3;
|
||||
double muoo = 1.0e-1;
|
||||
double kwoo = 1.0;
|
||||
|
||||
|
||||
# maximum eddy viscosity (myt/my)max
|
||||
double mytmax = 1.0e10;
|
||||
double sdilim = 1.0e20;
|
||||
double coef_kvist = 1.0;
|
||||
int monitor_vistmax = 0;
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
# Other Parameter #
|
||||
//-----------------------------------------------------------------------
|
||||
// iapplication: 0 - NS
|
||||
// 1 - MHD
|
||||
// nm: equation number of the physics , but is out of commision now.
|
||||
// 4 - for 2D
|
||||
// 5 - for 3D
|
||||
//ncatamod: 0 - full non-catalytic wall boundary condition;
|
||||
// 1 - full catalytic wall boundary condition;
|
||||
|
||||
int dg_high_order = 0; //0 常规精度 , 1 DG 高阶精度
|
||||
int iapplication = 0;
|
||||
int nm = 5;
|
||||
|
||||
//MHD相关
|
||||
double bxoo = 0.0;
|
||||
double byoo = 0.0;
|
||||
double bzoo = 0.0;
|
||||
|
||||
double gama0 = 1.4;
|
||||
double prl = 0.72;
|
||||
double prt = 0.90;
|
||||
double sc_l = 0.5;
|
||||
double sc_t = 0.5;
|
||||
|
||||
int nchem = 0;
|
||||
int nchemsrc = 0;
|
||||
int nchemrad = 0;
|
||||
int ntmodel = 1;
|
||||
string gasfile = "./chemical/Gupta_air5s6r.dat";
|
||||
int ncatamod = 0;
|
||||
|
||||
#########################################################################
|
||||
// Multi-Grid parameters.
|
||||
// mgrid: The number of level of Multi-Grid
|
||||
// <= 1 : Single level.
|
||||
// > 1 : multi-level.
|
||||
// npre : for each grid, the number of pre-smoothing steps
|
||||
// npost : for each grid, the number of post-smoothing steps
|
||||
// n_solve: for the coarest grid the number of smoothing steps
|
||||
// n_fas : V-multi cycle or W-multi cycle.
|
||||
// 1 : V-multi cycle
|
||||
// 2 : W-multi cycle
|
||||
// mgvisl : If calculate the viscous term on coarse grid
|
||||
// 0 : No
|
||||
// 1 : Yes
|
||||
// mgvist : If consideration the turbulent model on coarse grid.
|
||||
// 0 : No
|
||||
// 1 : Yes
|
||||
// mgInitStep: Number of step computing on coarse grid, during flow initialization.
|
||||
// cflMGTimes: CFL number enlarge times for coarse grid.
|
||||
// mprol: Multi-grid interpolation method, interpolation from coarse cell to fine grid:
|
||||
// 1: zero order;
|
||||
// 2: first-order(default).
|
||||
int mgrid = 1;
|
||||
int n_solve = 1;
|
||||
int n_pre = 1;
|
||||
int n_fas = 1;
|
||||
int n_post = 0;
|
||||
int mgvisl = 1;
|
||||
int mgvist = 0;
|
||||
int mgInitStep = 100;
|
||||
int mprol = 2;
|
||||
double cflMGTimes = 1.0;
|
||||
double correctionLimit= 0.01;
|
||||
|
||||
//----------------------- Some parameter for turbulent model. -----------------------------
|
||||
int neasm = -3; // the variation of kw turbulent model
|
||||
int ivortsource = 0;
|
||||
int ismooth_turb = 0; // Residual smooth for turb or not.
|
||||
|
||||
int isplt = 2;
|
||||
|
||||
int inflowtype = 0;
|
||||
|
||||
//string n_turb_scheme = "roe","center","nnd";
|
||||
string n_turb_scheme = "nnd";
|
||||
|
||||
// ---------------- Overset Grid parameter -------------------------------------
|
||||
int codeOfDigHoles = 1;
|
||||
int codeOfTurbulentModel = 0;
|
||||
string masterFileName = "./grid/searchFile.inp";
|
||||
string holeBasicFileName = "./grid/holeBasicFile.inp";
|
||||
string holeFullFileName = "./grid/holeFullFile.dat";
|
||||
string linkFileName = "./grid/topology.dat";
|
||||
string zoneInverseFileName = "./grid/zoneInverseMapping.inp";
|
||||
|
||||
#########################################################################
|
||||
# High Order Struct Solver #
|
||||
#########################################################################
|
||||
// ifvfd : 0 - NSSolverStruct using Finite Volume Method;
|
||||
// 1 - NSSolverStruct using Finite Differ Method;
|
||||
// =0 default
|
||||
// SolverStructOrder: Spatial discretisation order of NS equations with struct grid
|
||||
// =<2 finite volume method
|
||||
// >=3 finite difference order (to be completed)
|
||||
// =0 default
|
||||
// str_highorder_interpolation_name: interpolation method: "prim", "char"
|
||||
// str_highorder_flux_name: flux evaluation method: "roe", "steger", "godunov", "hllc"
|
||||
int ifvfd = 0;
|
||||
int SolverStructOrder = 0;
|
||||
string str_highorder_interpolation_name = "char";
|
||||
string str_highorder_flux_name = "steger";
|
||||
|
||||
|
||||
|
||||
// ---------------- advanced choices -------------------------------------------
|
||||
// xkmuscl: the parameter of MUSCL interpolations, belongs to [-1,1].
|
||||
// -1 - seconde-order fully-upwind differencing
|
||||
// 0 - seconde-order upwind-biased differencing
|
||||
// 0.333333 - third-order upwind-biased differencing
|
||||
// 1 - seconde-order central differencing
|
||||
// xbmuscl: the limiter parameter.
|
||||
// 0 - the effect of the limiter is cancelled, means the first-order interpolations.
|
||||
// allReduceStep: iteration intervals for MPI AllReduce operation, default '1'.
|
||||
string outtimesc = "impbd2";
|
||||
double unxk1 = 1.0;
|
||||
double unxk2 = 0.0;
|
||||
double xkmuscl = -1;
|
||||
double xbmuscl = 1.0;
|
||||
int allReduceStep = 1;
|
||||
|
||||
|
||||
// --------------- ATP read ----------------------------------------------------
|
||||
//@int inflowParaType = 0;
|
||||
//@double reynolds = 2.329418E08;
|
||||
//@double reference_temperature_dimensional = 288.144;
|
||||
//@double reference_pressure_dimensional = 1.01313E05;
|
||||
//@double height = -0.001;
|
||||
//@int nsubsonicInlet = 0;
|
||||
//@int nsubsonicOutlet = 0;
|
||||
//@string inLetFileName = "./bin/subsonicInlet.hypara";
|
||||
//@string outLetFileName = "./bin/subsonicOutlet.hypara";
|
|
@ -0,0 +1,210 @@
|
|||
#########################################################################
|
||||
# General Control Parameter #
|
||||
#########################################################################
|
||||
// maxSimuStep: The max simulation step, don't care simulation is restart or not.
|
||||
// intervalStepFlow: The step intervals for flow variables file 'flow.dat' saved.
|
||||
// intervalStepPlot: The step intervals for tecplot visual file 'tecflow.dat' saved.
|
||||
// intervalStepForce: The step intervals for aerodynamics coefficients file 'aircoef.dat' saved.
|
||||
// intervalStepRes: The step intervals for residual 'res.dat' saved.
|
||||
|
||||
int maxSimuStep = 10000;
|
||||
|
||||
int intervalStepFlow = 10000;
|
||||
int intervalStepPlot = 10000;
|
||||
int intervalStepForce = 100;
|
||||
int intervalStepRes = 500;
|
||||
|
||||
#########################################################################
|
||||
# Inflow Parameter #
|
||||
#########################################################################
|
||||
// refMachNumber: Mach number.
|
||||
// attackd: Angle of attack.
|
||||
// angleSlide: Angle of sideslip.
|
||||
// inflowParaType: The type of inflow parameters.
|
||||
// 0 -- the nondimensional conditions.
|
||||
// 1 -- the flight conditions.
|
||||
// 2 -- the experiment conditions.
|
||||
// 3 -- the subsonic boundary conditions.
|
||||
// refReNumber: Reynolds number, which is based unit length, unit of 1/m.
|
||||
// refDimensionalTemperature: Dimensional reference temperature, or the total temperature only for the experiment condition.
|
||||
// refDimensionalPressure: Dimensional reference pressure, or the total pressure only for the experiment condition.
|
||||
// height: Fly height, unit of km.
|
||||
// gridScaleFactor: The customizable unit of the grid, default value is 1.0 for meter.Common dimensions like:
|
||||
// 1 dm = 0.1 m.
|
||||
// 1 cm = 0.01 m.
|
||||
// 1 mm = 0.001m.
|
||||
// 1 inch = 0.0254m.
|
||||
// 1 foot = 12 inches = 0.3048m.
|
||||
// 1 yard = 3 feet = 0.9144m.
|
||||
// forceRefenenceLength, forceRefenenceLengthSpanWise, forceRefenenceArea: Reference length, SpanWise length and area, independent of grid unit.
|
||||
// TorqueRefX, TorqueRefY, TorqueRefZ: Reference point, independent of grid unit.
|
||||
|
||||
double refMachNumber = 0.76;
|
||||
double attackd = 1.25;
|
||||
double angleSlide = 0.00;
|
||||
|
||||
int inflowParaType = 0;
|
||||
double refReNumber = 1.171e7;
|
||||
double refDimensionalTemperature = 288.15;
|
||||
|
||||
//int inflowParaType = 1;
|
||||
//double height = 0.001;
|
||||
|
||||
//int inflowParaType = 2;
|
||||
//double refDimensionalTemperature = 6051.024; // The total temperature, T*(1+(refGama-1)*M*M/2).
|
||||
//double refDimensionalPressure = 4.299696E09; // The total pressure, p*(T0/T)^(refGama/(refGama-1)).
|
||||
|
||||
double gridScaleFactor = 1.0;
|
||||
|
||||
double forceRefenenceLengthSpanWise = 1.0; // unit of meter.
|
||||
double forceRefenenceLength = 1.0; // unit of meter.
|
||||
double forceRefenenceArea = 1.0; // unit of meter^2.
|
||||
double TorqueRefX = 0.0; // unit of meter.
|
||||
double TorqueRefY = 0.0; // unit of meter.
|
||||
double TorqueRefZ = 0.0; // unit of meter.
|
||||
|
||||
#########################################################################
|
||||
# Physical models #
|
||||
#########################################################################
|
||||
// viscousType : Viscous model.
|
||||
// 0 -- Euler.
|
||||
// 1 -- Lamilar.
|
||||
// 3 -- 1eq turbulent.
|
||||
// 4 -- 2eq turbulent.
|
||||
// viscousName: Laminar or tubulent model.
|
||||
// -- "1eq-sa", when viscousType = 3.
|
||||
// -- "2eq-kw-menter-sst", when viscousType = 4.
|
||||
// DESType: Type of DES.
|
||||
// 0 -- RANS.(default)
|
||||
// 1 -- DES.
|
||||
// 2 -- DDES.
|
||||
// 3 -- IDDES.
|
||||
|
||||
//int viscousType = 0;
|
||||
//string viscousName = "Euler";
|
||||
|
||||
//int viscousType = 1;
|
||||
//string viscousName = "laminar";
|
||||
|
||||
int viscousType = 3;
|
||||
string viscousName = 1eq-sa;
|
||||
|
||||
//int viscousType = 4;
|
||||
//string viscousName = "2eq-kw-menter-sst";
|
||||
|
||||
//int viscousType = 5;
|
||||
//string viscousName = DNN;
|
||||
//double TimeBeta = 0.8;
|
||||
//double SpaceBeta = 1.0;
|
||||
|
||||
int DESType = 0;
|
||||
|
||||
int roeEntropyFixMethod = 3;
|
||||
double roeEntropyScale = 1.0;
|
||||
#########################################################################
|
||||
# Spatial Discretisation #
|
||||
#########################################################################
|
||||
#*******************************************************************
|
||||
# Struct Solver *
|
||||
#*******************************************************************
|
||||
// inviscidSchemeName: Spatial discretisation scheme of struct grid.
|
||||
// Using this when solve structered grid or hybrid.
|
||||
// -- "roe", "vanleer", "ausm+up", "ausmpw".
|
||||
// str_limiter_name: Limiter of struct grid.
|
||||
// -- "3rdsmooth", "smooth".
|
||||
// -- "nolim", no limiter.
|
||||
|
||||
string inviscidSchemeName = "roe";
|
||||
string str_limiter_name = "smooth";
|
||||
|
||||
#*******************************************************************
|
||||
# UnStruct Solver *
|
||||
#*******************************************************************
|
||||
// uns_scheme_name: Spatial discretisation scheme of Unstruct grid.
|
||||
// Using this when solve Unstructered grid or hybrid.
|
||||
// -- "vanleer", "roe", "steger", "kfvs", "lax_f", "hlle".
|
||||
// -- "ausm+", "ausmdv", "ausm+w", "ausmpw", "ausmpwplus".
|
||||
// uns_limiter_name: Limiter of Unstruct grid.
|
||||
// -- "vencat", "barth".
|
||||
// -- "1st", meaning accuracy of first-order.
|
||||
// -- "nolim", no limiter.
|
||||
// venkatCoeff: Coefficient of vencat limiter, when uns_limiter_name = 'vencat'.
|
||||
// The smaller the value, the more robust it is.
|
||||
|
||||
string uns_scheme_name = "roe";
|
||||
string uns_limiter_name = "vencat";
|
||||
double venkatCoeff = 50.0;
|
||||
|
||||
#########################################################################
|
||||
# Temporal Discretisation #
|
||||
#########################################################################
|
||||
// iunsteady: Steady or unsteady.
|
||||
// 0 -- steady.
|
||||
// 1 -- unsteay.
|
||||
// CFLEnd: The CFL number, [0.1, 100].
|
||||
// The bigger the value, the convergence faster but lower robustness.
|
||||
// nLUSGSSweeps: Number of Sub-iteration of LU-SGS.
|
||||
// 1 -- is recommended for structured solver.
|
||||
// 1-3 -- is recommended for unstructured solver.
|
||||
|
||||
int iunsteady = 0;
|
||||
|
||||
double CFLEnd = 100.0;
|
||||
|
||||
int nLUSGSSweeps = 5;
|
||||
|
||||
#########################################################################
|
||||
# Multi-Grid parameters #
|
||||
#########################################################################
|
||||
// nMGLevel: The number of Multi-Grid level.
|
||||
// = 1 -- single-level.
|
||||
// > 1 -- multi-level.
|
||||
// flowInitStep: Flow initialization step, 0 - 500 is suggested.
|
||||
// Multi-Grid : Number of steps computing on coarse grid, during flow initialization.
|
||||
// Single-Grid: Number of steps computing using first-order with vanleer, during flow initialization.
|
||||
|
||||
int nMGLevel = 1;
|
||||
int flowInitStep = 100;
|
||||
|
||||
#########################################################################
|
||||
# File In or Out #
|
||||
#########################################################################
|
||||
// gridfile: The partitioned Grid file path, using relative path,
|
||||
// which is relative to the working directory.
|
||||
// IMPORTANT WARNING: The file index should be ignored,
|
||||
// e.g. if the partitioned grid is rae2822_hybrid2d__4_0.fts,
|
||||
// Please use 'rae2822_hybrid2d__4.fts' here!
|
||||
// plotFieldType: If dump out the whole field results to tecplot or not, 0 / 1.
|
||||
|
||||
string gridfile = ./grid/M6__48.fts;
|
||||
int plotFieldType = 1;
|
||||
|
||||
// ----------------- Advanced Parameters, DO NOT care it ----------------
|
||||
// nVisualVariables: Number of variables want to be dumped for tecplot visualization.
|
||||
// visualVariables: Variable types dumped, listed as following:
|
||||
// -- density(0), u(1), v(2), w(3), pressure(4), temperature(5), mach(6),
|
||||
// -- viscosityLaminar(7), viscosityTurbulent(8),
|
||||
// -- vorticity_x(9), vorticity_y(10), vorticity_z(11), vorticityMagnitude(12),
|
||||
// -- strain_rate(13), Q_criteria(14), Cp(15), timeStep(16), volume(17),
|
||||
// -- modeledTKE(18), modeleddissipationrate(19), SSTF1(20), SSTF2(21), iblank(81).
|
||||
// Important Warning: Array size of visualVariables MUST be equal to nVisualVariables!!!
|
||||
// Variables order must from small to big.
|
||||
|
||||
int nVisualVariables = 9;
|
||||
int visualVariables[] = [0, 1, 2, 3, 4, 5, 6, 8, 15];
|
||||
|
||||
// limitVariables: Limit model (It is useful only if limitVector is 0).
|
||||
// 0 -- limit only for pressure and denstiny, then get the min value.
|
||||
// 1 -- limit for every variables, then get the min value.
|
||||
// limitVector:
|
||||
// 0 -- Each variable use the same limiter coefficient.
|
||||
// 1 -- Each variable use the respective limiter coefficients.
|
||||
// reconmeth:
|
||||
// 0 -- When reconstruct face value, Q+, Q- use respective limiter coefficients.
|
||||
// 1 -- Q+, Q- use the min limiter coefficients of left and right cell.
|
||||
|
||||
int reconmeth = 1;
|
||||
int limitVariables = 0;
|
||||
int limitVector = 0;
|
||||
|
||||
double MUSCLCoefXk = 0.333333;
|
|
@ -0,0 +1,30 @@
|
|||
#########################################################################
|
||||
# Grid data type #
|
||||
#########################################################################
|
||||
// gridtype: Grid type for generation, conversion, reconstruction, merging.
|
||||
// 0 -- Unstructured grid.
|
||||
// 1 -- Structured grid.
|
||||
// axisup: Type of Cartisien coordinates system, used in grid conversion.
|
||||
// 1 -- Y upward. (default)
|
||||
// 2 -- Z upward.
|
||||
// from_gtype: Type of grid data type in grid conversion process.
|
||||
// -1 -- MULTI_TYPE.
|
||||
// 1 -- PHengLEI, *.fts.
|
||||
// 2 -- CGNS, *.cgns.
|
||||
// 3 -- Plot3D type of structured grid, *.dat/*.grd.
|
||||
// 4 -- Fieldview type of unstructured grid, *.dat/*.inp.
|
||||
// 5 -- Fluent, *.cas/*.msh.
|
||||
// 6 -- Ustar, mgrid.in.
|
||||
// 7 -- Hybrid, include both of unstructured and structured grid, *.fts.
|
||||
// 8 -- GMSH, *.msh.
|
||||
int gridtype = 0;
|
||||
int axisup = 1;
|
||||
int from_gtype = 5;
|
||||
|
||||
#########################################################################
|
||||
# File path #
|
||||
#########################################################################
|
||||
// from_gfile: path of original data file for unstructure grid convert from.
|
||||
// out_gfile: path of target file for grid convert to, *.fts type of file usually.
|
||||
string from_gfile = "./grid/M6_240w.cas";
|
||||
string out_gfile = "./grid/M6.fts";
|
|
@ -0,0 +1,59 @@
|
|||
string title = "PHengLEI Main Parameter Control File";
|
||||
|
||||
// IMPORTANT NOTICE: DON NOT MODIFY THE FOWLLOWING LINE.
|
||||
string defaultParaFile = "./bin/cfd_para.hypara";
|
||||
|
||||
// ndim: Dimensional of the grid, 2 or 3.
|
||||
// nparafile: the number of parameter files.
|
||||
// nsimutask: simulation task type.
|
||||
// 0 -- CFD Solver of NS or Turbulation.
|
||||
// 1 -- Grid generation: for special typical cases, such as cylinder, flat plate, etc.
|
||||
// Grid conversion: from other format to PHengLEI format (.fts).
|
||||
// Grid reconstruction: such as grid adaptation.
|
||||
// Grid merging: merge two blocks into one block.
|
||||
// Grid repairing: repair the original grid in order to remove the negative volume cells.
|
||||
// 2 -- Wall distance computation for turb-solver.
|
||||
// 3 -- Grid partition.
|
||||
// 4 -- Knowledge repository / examples of PHengLEI-API.
|
||||
int ndim = 3;
|
||||
int nparafile = 1;
|
||||
|
||||
int nsimutask = 0;
|
||||
//string parafilename = "./bin/cfd_para_subsonic.hypara";
|
||||
string parafilename = "./bin/cfd_para_transonic.hypara";
|
||||
//string parafilename = "./bin/cfd_para_supersonic.hypara";
|
||||
//string parafilename = "./bin/cfd_para_hypersonic.hypara";
|
||||
//string parafilename = "./bin/cfd_para_incompressible.hypara";
|
||||
|
||||
//int nsimutask = 1;
|
||||
//string parafilename = "./bin/grid_para.hypara";
|
||||
|
||||
//int nsimutask = 2;
|
||||
//string parafilename = "./bin/cfd_para.hypara";
|
||||
|
||||
//int nsimutask = 3;
|
||||
//string parafilename = "./bin/partition.hypara";
|
||||
|
||||
//int nsimutask = 1;
|
||||
//string parafilename = "./bin/grid_deform_para.hypara";
|
||||
|
||||
//int nsimutask = 4;
|
||||
//string parafilename = "./bin/repository.hypara";
|
||||
|
||||
//int nsimutask = 5;
|
||||
//string parafilename = "./bin/overset_grid_view.hypara";
|
||||
|
||||
//int nsimutask = 13;
|
||||
//string parafilename = "./bin/lbm_para.hypara";
|
||||
|
||||
//int nsimutask = 14;
|
||||
//string parafilename = "./bin/integrative_solver.hypara";
|
||||
|
||||
//int nsimutask = 99;
|
||||
//string parafilename = "./bin/post_processing.hypara";
|
||||
|
||||
// ---------------- Advanced Parameters, DO NOT care it ----------------
|
||||
int numberOfGridProcessor = 0;
|
||||
// ATP read
|
||||
//@string parafilename1 = ""
|
||||
//@string parafilename2 = "";
|
|
@ -0,0 +1,44 @@
|
|||
31
|
||||
1.000000000000000e+00 1.000000000000000e+00 0.000000000000000e+00
|
||||
9.333333333333333e-01 1.000000000000000e+00 0.000000000000000e+00
|
||||
8.666666666666667e-01 1.000000000000000e+00 0.000000000000000e+00
|
||||
8.000000000000000e-01 1.000000000000000e+00 0.000000000000000e+00
|
||||
7.333333333333334e-01 1.000000000000000e+00 0.000000000000000e+00
|
||||
6.666666666666667e-01 1.000000000000000e+00 0.000000000000000e+00
|
||||
6.000000000000001e-01 1.000000000000000e+00 0.000000000000000e+00
|
||||
5.333333333333332e-01 1.000000000000000e+00 0.000000000000000e+00
|
||||
4.666666666666667e-01 1.000000000000000e+00 0.000000000000000e+00
|
||||
4.000000000000000e-01 1.000000000000000e+00 0.000000000000000e+00
|
||||
3.333333333333334e-01 1.000000000000000e+00 0.000000000000000e+00
|
||||
2.666666666666667e-01 1.000000000000000e+00 0.000000000000000e+00
|
||||
2.000000000000000e-01 1.000000000000000e+00 0.000000000000000e+00
|
||||
1.333333333333333e-01 1.000000000000000e+00 0.000000000000000e+00
|
||||
6.666666666666665e-02 1.000000000000000e+00 0.000000000000000e+00
|
||||
0.000000000000000e+00 1.000000000000000e+00 0.000000000000000e+00
|
||||
-6.666666666666665e-02 1.000000000000000e+00 0.000000000000000e+00
|
||||
-1.333333333333333e-01 1.000000000000000e+00 0.000000000000000e+00
|
||||
-2.000000000000000e-01 1.000000000000000e+00 0.000000000000000e+00
|
||||
-2.666666666666666e-01 1.000000000000000e+00 0.000000000000000e+00
|
||||
-3.333333333333333e-01 1.000000000000000e+00 0.000000000000000e+00
|
||||
-3.999999999999999e-01 1.000000000000000e+00 0.000000000000000e+00
|
||||
-4.666666666666666e-01 1.000000000000000e+00 0.000000000000000e+00
|
||||
-5.333333333333332e-01 1.000000000000000e+00 0.000000000000000e+00
|
||||
-6.000000000000001e-01 1.000000000000000e+00 0.000000000000000e+00
|
||||
-6.666666666666667e-01 1.000000000000000e+00 0.000000000000000e+00
|
||||
-7.333333333333334e-01 1.000000000000000e+00 0.000000000000000e+00
|
||||
-8.000000000000000e-01 1.000000000000000e+00 0.000000000000000e+00
|
||||
-8.666666666666667e-01 1.000000000000000e+00 0.000000000000000e+00
|
||||
-9.333333333333333e-01 1.000000000000000e+00 0.000000000000000e+00
|
||||
-1.000000000000000e+00 1.000000000000000e+00 0.000000000000000e+00
|
||||
11
|
||||
-1.000000000000000e+00 1.000000000000000e+00 0.000000000000000e+00
|
||||
-1.000000000000000e+00 1.000000000000000e+00 1.000000000000000e-01
|
||||
-1.000000000000000e+00 1.000000000000000e+00 2.000000000000000e-01
|
||||
-1.000000000000000e+00 1.000000000000000e+00 3.000000000000000e-01
|
||||
-1.000000000000000e+00 1.000000000000000e+00 4.000000000000000e-01
|
||||
-1.000000000000000e+00 1.000000000000000e+00 5.000000000000000e-01
|
||||
-1.000000000000000e+00 1.000000000000000e+00 6.000000000000000e-01
|
||||
-1.000000000000000e+00 1.000000000000000e+00 7.000000000000000e-01
|
||||
-1.000000000000000e+00 1.000000000000000e+00 7.999999999999999e-01
|
||||
-1.000000000000000e+00 1.000000000000000e+00 8.999999999999999e-01
|
||||
-1.000000000000000e+00 1.000000000000000e+00 9.999999999999999e-01
|
|
@ -0,0 +1,21 @@
|
|||
// pgridtype: The grid type.
|
||||
// 0 -- unstruct grid.
|
||||
// 1 -- struct grid.
|
||||
// maxproc: The number of partition zones that want to be divided into,
|
||||
// which is equal to the number of CPU processors you want.
|
||||
// Usually, 50~100 thousands structured cells per CPU-Core is suggested.
|
||||
// 30~70 thousands unstructured cells per CPU-Core is suggested.
|
||||
// original_grid_file: Original grid file that want to be divided(PHengLEI type, *.fts).
|
||||
// partition_grid_file: Target partition grid file(PHengLEI type, *.fts).
|
||||
|
||||
int pgridtype = 0;
|
||||
int maxproc = 94;
|
||||
|
||||
string original_grid_file = "./grid/M6.fts";
|
||||
string partition_grid_file = "./grid/M6__94.fts";
|
||||
|
||||
// numberOfMultigrid: Number of multi-grid levels, ONLY used for structured grid.
|
||||
// 1 -- single level.
|
||||
// 2 -- 2 level.
|
||||
// N -- N level,..., et al.
|
||||
int numberOfMultigrid = 1;
|
|
@ -0,0 +1,15 @@
|
|||
#########################################################################
|
||||
# General Control Parameter #
|
||||
#########################################################################
|
||||
// gridfile: The partitioned Grid file path, using relative path,
|
||||
// which is relative to the working directory.
|
||||
// gridfile: The flow data file.
|
||||
|
||||
string gridfile = "./grid/rae2822_vis2d.fts";
|
||||
string restartNSFile = "results/flow.dat";
|
||||
string turbfile = "results/turb.dat";
|
||||
|
||||
|
||||
// isFVMOrFDM : 0 - NSSolverStruct using Finite Volume Method;
|
||||
// 1 - NSSolverStruct using Finite Differ Method.
|
||||
int isFVMOrFDM = 0;
|
|
@ -0,0 +1,11 @@
|
|||
#----------------------------------#
|
||||
# Total Probes Number #
|
||||
#----------------------------------#
|
||||
3
|
||||
#----------------------------------#
|
||||
# Probes Coordinate,unit of m. #
|
||||
# x y z #
|
||||
#----------------------------------#
|
||||
0.0254 0.0253 0.0
|
||||
0.0508 0.0253 0.0
|
||||
0.0762 0.0253 0.0
|
|
@ -0,0 +1,342 @@
|
|||
31 11
|
||||
1.000000000000000e+00 1.000000000000000e+00 0.000000000000000e+00
|
||||
1.000000000000000e+00 1.000000000000000e+00 1.000000000000000e-01
|
||||
1.000000000000000e+00 1.000000000000000e+00 2.000000000000000e-01
|
||||
1.000000000000000e+00 1.000000000000000e+00 3.000000000000000e-01
|
||||
1.000000000000000e+00 1.000000000000000e+00 4.000000000000000e-01
|
||||
1.000000000000000e+00 1.000000000000000e+00 5.000000000000000e-01
|
||||
1.000000000000000e+00 1.000000000000000e+00 6.000000000000000e-01
|
||||
1.000000000000000e+00 1.000000000000000e+00 7.000000000000000e-01
|
||||
1.000000000000000e+00 1.000000000000000e+00 7.999999999999999e-01
|
||||
1.000000000000000e+00 1.000000000000000e+00 8.999999999999999e-01
|
||||
1.000000000000000e+00 1.000000000000000e+00 9.999999999999999e-01
|
||||
9.333333333333333e-01 1.000000000000000e+00 0.000000000000000e+00
|
||||
9.333333333333333e-01 1.000000000000000e+00 1.000000000000000e-01
|
||||
9.333333333333333e-01 1.000000000000000e+00 2.000000000000000e-01
|
||||
9.333333333333333e-01 1.000000000000000e+00 3.000000000000000e-01
|
||||
9.333333333333333e-01 1.000000000000000e+00 4.000000000000000e-01
|
||||
9.333333333333333e-01 1.000000000000000e+00 5.000000000000000e-01
|
||||
9.333333333333333e-01 1.000000000000000e+00 6.000000000000000e-01
|
||||
9.333333333333333e-01 1.000000000000000e+00 7.000000000000000e-01
|
||||
9.333333333333333e-01 1.000000000000000e+00 7.999999999999999e-01
|
||||
9.333333333333333e-01 1.000000000000000e+00 8.999999999999999e-01
|
||||
9.333333333333333e-01 1.000000000000000e+00 9.999999999999999e-01
|
||||
8.666666666666667e-01 1.000000000000000e+00 0.000000000000000e+00
|
||||
8.666666666666667e-01 1.000000000000000e+00 1.000000000000000e-01
|
||||
8.666666666666667e-01 1.000000000000000e+00 2.000000000000000e-01
|
||||
8.666666666666667e-01 1.000000000000000e+00 3.000000000000000e-01
|
||||
8.666666666666667e-01 1.000000000000000e+00 4.000000000000000e-01
|
||||
8.666666666666667e-01 1.000000000000000e+00 5.000000000000000e-01
|
||||
8.666666666666667e-01 1.000000000000000e+00 6.000000000000000e-01
|
||||
8.666666666666667e-01 1.000000000000000e+00 7.000000000000000e-01
|
||||
8.666666666666667e-01 1.000000000000000e+00 7.999999999999999e-01
|
||||
8.666666666666667e-01 1.000000000000000e+00 8.999999999999999e-01
|
||||
8.666666666666667e-01 1.000000000000000e+00 9.999999999999999e-01
|
||||
8.000000000000000e-01 1.000000000000000e+00 0.000000000000000e+00
|
||||
8.000000000000000e-01 1.000000000000000e+00 1.000000000000000e-01
|
||||
8.000000000000000e-01 1.000000000000000e+00 2.000000000000000e-01
|
||||
8.000000000000000e-01 1.000000000000000e+00 3.000000000000000e-01
|
||||
8.000000000000000e-01 1.000000000000000e+00 4.000000000000000e-01
|
||||
8.000000000000000e-01 1.000000000000000e+00 5.000000000000000e-01
|
||||
8.000000000000000e-01 1.000000000000000e+00 6.000000000000000e-01
|
||||
8.000000000000000e-01 1.000000000000000e+00 7.000000000000000e-01
|
||||
8.000000000000000e-01 1.000000000000000e+00 7.999999999999999e-01
|
||||
8.000000000000000e-01 1.000000000000000e+00 8.999999999999999e-01
|
||||
8.000000000000000e-01 1.000000000000000e+00 9.999999999999999e-01
|
||||
7.333333333333334e-01 1.000000000000000e+00 0.000000000000000e+00
|
||||
7.333333333333334e-01 1.000000000000000e+00 1.000000000000000e-01
|
||||
7.333333333333334e-01 1.000000000000000e+00 2.000000000000000e-01
|
||||
7.333333333333334e-01 1.000000000000000e+00 3.000000000000000e-01
|
||||
7.333333333333334e-01 1.000000000000000e+00 4.000000000000000e-01
|
||||
7.333333333333334e-01 1.000000000000000e+00 5.000000000000000e-01
|
||||
7.333333333333334e-01 1.000000000000000e+00 6.000000000000000e-01
|
||||
7.333333333333334e-01 1.000000000000000e+00 7.000000000000000e-01
|
||||
7.333333333333334e-01 1.000000000000000e+00 7.999999999999999e-01
|
||||
7.333333333333334e-01 1.000000000000000e+00 8.999999999999999e-01
|
||||
7.333333333333334e-01 1.000000000000000e+00 9.999999999999999e-01
|
||||
6.666666666666667e-01 1.000000000000000e+00 0.000000000000000e+00
|
||||
6.666666666666667e-01 1.000000000000000e+00 1.000000000000000e-01
|
||||
6.666666666666667e-01 1.000000000000000e+00 2.000000000000000e-01
|
||||
6.666666666666667e-01 1.000000000000000e+00 3.000000000000000e-01
|
||||
6.666666666666667e-01 1.000000000000000e+00 4.000000000000000e-01
|
||||
6.666666666666667e-01 1.000000000000000e+00 5.000000000000000e-01
|
||||
6.666666666666667e-01 1.000000000000000e+00 6.000000000000000e-01
|
||||
6.666666666666667e-01 1.000000000000000e+00 7.000000000000000e-01
|
||||
6.666666666666667e-01 1.000000000000000e+00 7.999999999999999e-01
|
||||
6.666666666666667e-01 1.000000000000000e+00 8.999999999999999e-01
|
||||
6.666666666666667e-01 1.000000000000000e+00 9.999999999999999e-01
|
||||
6.000000000000001e-01 1.000000000000000e+00 0.000000000000000e+00
|
||||
6.000000000000001e-01 1.000000000000000e+00 1.000000000000000e-01
|
||||
6.000000000000001e-01 1.000000000000000e+00 2.000000000000000e-01
|
||||
6.000000000000001e-01 1.000000000000000e+00 3.000000000000000e-01
|
||||
6.000000000000001e-01 1.000000000000000e+00 4.000000000000000e-01
|
||||
6.000000000000001e-01 1.000000000000000e+00 5.000000000000000e-01
|
||||
6.000000000000001e-01 1.000000000000000e+00 6.000000000000000e-01
|
||||
6.000000000000001e-01 1.000000000000000e+00 7.000000000000000e-01
|
||||
6.000000000000001e-01 1.000000000000000e+00 7.999999999999999e-01
|
||||
6.000000000000001e-01 1.000000000000000e+00 8.999999999999999e-01
|
||||
6.000000000000001e-01 1.000000000000000e+00 9.999999999999999e-01
|
||||
5.333333333333332e-01 1.000000000000000e+00 0.000000000000000e+00
|
||||
5.333333333333332e-01 1.000000000000000e+00 1.000000000000000e-01
|
||||
5.333333333333332e-01 1.000000000000000e+00 2.000000000000000e-01
|
||||
5.333333333333332e-01 1.000000000000000e+00 3.000000000000000e-01
|
||||
5.333333333333332e-01 1.000000000000000e+00 4.000000000000000e-01
|
||||
5.333333333333332e-01 1.000000000000000e+00 5.000000000000000e-01
|
||||
5.333333333333332e-01 1.000000000000000e+00 6.000000000000000e-01
|
||||
5.333333333333332e-01 1.000000000000000e+00 7.000000000000000e-01
|
||||
5.333333333333332e-01 1.000000000000000e+00 7.999999999999999e-01
|
||||
5.333333333333332e-01 1.000000000000000e+00 8.999999999999999e-01
|
||||
5.333333333333332e-01 1.000000000000000e+00 9.999999999999999e-01
|
||||
4.666666666666667e-01 1.000000000000000e+00 0.000000000000000e+00
|
||||
4.666666666666667e-01 1.000000000000000e+00 1.000000000000000e-01
|
||||
4.666666666666667e-01 1.000000000000000e+00 2.000000000000000e-01
|
||||
4.666666666666667e-01 1.000000000000000e+00 3.000000000000000e-01
|
||||
4.666666666666667e-01 1.000000000000000e+00 4.000000000000000e-01
|
||||
4.666666666666667e-01 1.000000000000000e+00 5.000000000000000e-01
|
||||
4.666666666666667e-01 1.000000000000000e+00 6.000000000000000e-01
|
||||
4.666666666666667e-01 1.000000000000000e+00 7.000000000000000e-01
|
||||
4.666666666666667e-01 1.000000000000000e+00 7.999999999999999e-01
|
||||
4.666666666666667e-01 1.000000000000000e+00 8.999999999999999e-01
|
||||
4.666666666666667e-01 1.000000000000000e+00 9.999999999999999e-01
|
||||
4.000000000000000e-01 1.000000000000000e+00 0.000000000000000e+00
|
||||
4.000000000000000e-01 1.000000000000000e+00 1.000000000000000e-01
|
||||
4.000000000000000e-01 1.000000000000000e+00 2.000000000000000e-01
|
||||
4.000000000000000e-01 1.000000000000000e+00 3.000000000000000e-01
|
||||
4.000000000000000e-01 1.000000000000000e+00 4.000000000000000e-01
|
||||
4.000000000000000e-01 1.000000000000000e+00 5.000000000000000e-01
|
||||
4.000000000000000e-01 1.000000000000000e+00 6.000000000000000e-01
|
||||
4.000000000000000e-01 1.000000000000000e+00 7.000000000000000e-01
|
||||
4.000000000000000e-01 1.000000000000000e+00 7.999999999999999e-01
|
||||
4.000000000000000e-01 1.000000000000000e+00 8.999999999999999e-01
|
||||
4.000000000000000e-01 1.000000000000000e+00 9.999999999999999e-01
|
||||
3.333333333333334e-01 1.000000000000000e+00 0.000000000000000e+00
|
||||
3.333333333333334e-01 1.000000000000000e+00 1.000000000000000e-01
|
||||
3.333333333333334e-01 1.000000000000000e+00 2.000000000000000e-01
|
||||
3.333333333333334e-01 1.000000000000000e+00 3.000000000000000e-01
|
||||
3.333333333333334e-01 1.000000000000000e+00 4.000000000000000e-01
|
||||
3.333333333333334e-01 1.000000000000000e+00 5.000000000000000e-01
|
||||
3.333333333333334e-01 1.000000000000000e+00 6.000000000000000e-01
|
||||
3.333333333333334e-01 1.000000000000000e+00 7.000000000000000e-01
|
||||
3.333333333333334e-01 1.000000000000000e+00 7.999999999999999e-01
|
||||
3.333333333333334e-01 1.000000000000000e+00 8.999999999999999e-01
|
||||
3.333333333333334e-01 1.000000000000000e+00 9.999999999999999e-01
|
||||
2.666666666666667e-01 1.000000000000000e+00 0.000000000000000e+00
|
||||
2.666666666666667e-01 1.000000000000000e+00 1.000000000000000e-01
|
||||
2.666666666666667e-01 1.000000000000000e+00 2.000000000000000e-01
|
||||
2.666666666666667e-01 1.000000000000000e+00 3.000000000000000e-01
|
||||
2.666666666666667e-01 1.000000000000000e+00 4.000000000000000e-01
|
||||
2.666666666666667e-01 1.000000000000000e+00 5.000000000000000e-01
|
||||
2.666666666666667e-01 1.000000000000000e+00 6.000000000000000e-01
|
||||
2.666666666666667e-01 1.000000000000000e+00 7.000000000000000e-01
|
||||
2.666666666666667e-01 1.000000000000000e+00 7.999999999999999e-01
|
||||
2.666666666666667e-01 1.000000000000000e+00 8.999999999999999e-01
|
||||
2.666666666666667e-01 1.000000000000000e+00 9.999999999999999e-01
|
||||
2.000000000000000e-01 1.000000000000000e+00 0.000000000000000e+00
|
||||
2.000000000000000e-01 1.000000000000000e+00 1.000000000000000e-01
|
||||
2.000000000000000e-01 1.000000000000000e+00 2.000000000000000e-01
|
||||
2.000000000000000e-01 1.000000000000000e+00 3.000000000000000e-01
|
||||
2.000000000000000e-01 1.000000000000000e+00 4.000000000000000e-01
|
||||
2.000000000000000e-01 1.000000000000000e+00 5.000000000000000e-01
|
||||
2.000000000000000e-01 1.000000000000000e+00 6.000000000000000e-01
|
||||
2.000000000000000e-01 1.000000000000000e+00 7.000000000000000e-01
|
||||
2.000000000000000e-01 1.000000000000000e+00 7.999999999999999e-01
|
||||
2.000000000000000e-01 1.000000000000000e+00 8.999999999999999e-01
|
||||
2.000000000000000e-01 1.000000000000000e+00 9.999999999999999e-01
|
||||
1.333333333333333e-01 1.000000000000000e+00 0.000000000000000e+00
|
||||
1.333333333333333e-01 1.000000000000000e+00 1.000000000000000e-01
|
||||
1.333333333333333e-01 1.000000000000000e+00 2.000000000000000e-01
|
||||
1.333333333333333e-01 1.000000000000000e+00 3.000000000000000e-01
|
||||
1.333333333333333e-01 1.000000000000000e+00 4.000000000000000e-01
|
||||
1.333333333333333e-01 1.000000000000000e+00 5.000000000000000e-01
|
||||
1.333333333333333e-01 1.000000000000000e+00 6.000000000000000e-01
|
||||
1.333333333333333e-01 1.000000000000000e+00 7.000000000000000e-01
|
||||
1.333333333333333e-01 1.000000000000000e+00 7.999999999999999e-01
|
||||
1.333333333333333e-01 1.000000000000000e+00 8.999999999999999e-01
|
||||
1.333333333333333e-01 1.000000000000000e+00 9.999999999999999e-01
|
||||
6.666666666666665e-02 1.000000000000000e+00 0.000000000000000e+00
|
||||
6.666666666666665e-02 1.000000000000000e+00 1.000000000000000e-01
|
||||
6.666666666666665e-02 1.000000000000000e+00 2.000000000000000e-01
|
||||
6.666666666666665e-02 1.000000000000000e+00 3.000000000000000e-01
|
||||
6.666666666666665e-02 1.000000000000000e+00 4.000000000000000e-01
|
||||
6.666666666666665e-02 1.000000000000000e+00 5.000000000000000e-01
|
||||
6.666666666666665e-02 1.000000000000000e+00 6.000000000000000e-01
|
||||
6.666666666666665e-02 1.000000000000000e+00 7.000000000000000e-01
|
||||
6.666666666666665e-02 1.000000000000000e+00 7.999999999999999e-01
|
||||
6.666666666666665e-02 1.000000000000000e+00 8.999999999999999e-01
|
||||
6.666666666666665e-02 1.000000000000000e+00 9.999999999999999e-01
|
||||
0.000000000000000e+00 1.000000000000000e+00 0.000000000000000e+00
|
||||
0.000000000000000e+00 1.000000000000000e+00 1.000000000000000e-01
|
||||
0.000000000000000e+00 1.000000000000000e+00 2.000000000000000e-01
|
||||
0.000000000000000e+00 1.000000000000000e+00 3.000000000000000e-01
|
||||
0.000000000000000e+00 1.000000000000000e+00 4.000000000000000e-01
|
||||
0.000000000000000e+00 1.000000000000000e+00 5.000000000000000e-01
|
||||
0.000000000000000e+00 1.000000000000000e+00 6.000000000000000e-01
|
||||
0.000000000000000e+00 1.000000000000000e+00 7.000000000000000e-01
|
||||
0.000000000000000e+00 1.000000000000000e+00 7.999999999999999e-01
|
||||
0.000000000000000e+00 1.000000000000000e+00 8.999999999999999e-01
|
||||
0.000000000000000e+00 1.000000000000000e+00 9.999999999999999e-01
|
||||
-6.666666666666665e-02 1.000000000000000e+00 0.000000000000000e+00
|
||||
-6.666666666666665e-02 1.000000000000000e+00 1.000000000000000e-01
|
||||
-6.666666666666665e-02 1.000000000000000e+00 2.000000000000000e-01
|
||||
-6.666666666666665e-02 1.000000000000000e+00 3.000000000000000e-01
|
||||
-6.666666666666665e-02 1.000000000000000e+00 4.000000000000000e-01
|
||||
-6.666666666666665e-02 1.000000000000000e+00 5.000000000000000e-01
|
||||
-6.666666666666665e-02 1.000000000000000e+00 6.000000000000000e-01
|
||||
-6.666666666666665e-02 1.000000000000000e+00 7.000000000000000e-01
|
||||
-6.666666666666665e-02 1.000000000000000e+00 7.999999999999999e-01
|
||||
-6.666666666666665e-02 1.000000000000000e+00 8.999999999999999e-01
|
||||
-6.666666666666665e-02 1.000000000000000e+00 9.999999999999999e-01
|
||||
-1.333333333333333e-01 1.000000000000000e+00 0.000000000000000e+00
|
||||
-1.333333333333333e-01 1.000000000000000e+00 1.000000000000000e-01
|
||||
-1.333333333333333e-01 1.000000000000000e+00 2.000000000000000e-01
|
||||
-1.333333333333333e-01 1.000000000000000e+00 3.000000000000000e-01
|
||||
-1.333333333333333e-01 1.000000000000000e+00 4.000000000000000e-01
|
||||
-1.333333333333333e-01 1.000000000000000e+00 5.000000000000000e-01
|
||||
-1.333333333333333e-01 1.000000000000000e+00 6.000000000000000e-01
|
||||
-1.333333333333333e-01 1.000000000000000e+00 7.000000000000000e-01
|
||||
-1.333333333333333e-01 1.000000000000000e+00 7.999999999999999e-01
|
||||
-1.333333333333333e-01 1.000000000000000e+00 8.999999999999999e-01
|
||||
-1.333333333333333e-01 1.000000000000000e+00 9.999999999999999e-01
|
||||
-2.000000000000000e-01 1.000000000000000e+00 0.000000000000000e+00
|
||||
-2.000000000000000e-01 1.000000000000000e+00 1.000000000000000e-01
|
||||
-2.000000000000000e-01 1.000000000000000e+00 2.000000000000000e-01
|
||||
-2.000000000000000e-01 1.000000000000000e+00 3.000000000000000e-01
|
||||
-2.000000000000000e-01 1.000000000000000e+00 4.000000000000000e-01
|
||||
-2.000000000000000e-01 1.000000000000000e+00 5.000000000000000e-01
|
||||
-2.000000000000000e-01 1.000000000000000e+00 6.000000000000000e-01
|
||||
-2.000000000000000e-01 1.000000000000000e+00 7.000000000000000e-01
|
||||
-2.000000000000000e-01 1.000000000000000e+00 7.999999999999999e-01
|
||||
-2.000000000000000e-01 1.000000000000000e+00 8.999999999999999e-01
|
||||
-2.000000000000000e-01 1.000000000000000e+00 9.999999999999999e-01
|
||||
-2.666666666666666e-01 1.000000000000000e+00 0.000000000000000e+00
|
||||
-2.666666666666666e-01 1.000000000000000e+00 1.000000000000000e-01
|
||||
-2.666666666666666e-01 1.000000000000000e+00 2.000000000000000e-01
|
||||
-2.666666666666666e-01 1.000000000000000e+00 3.000000000000000e-01
|
||||
-2.666666666666666e-01 1.000000000000000e+00 4.000000000000000e-01
|
||||
-2.666666666666666e-01 1.000000000000000e+00 5.000000000000000e-01
|
||||
-2.666666666666666e-01 1.000000000000000e+00 6.000000000000000e-01
|
||||
-2.666666666666666e-01 1.000000000000000e+00 7.000000000000000e-01
|
||||
-2.666666666666666e-01 1.000000000000000e+00 7.999999999999999e-01
|
||||
-2.666666666666666e-01 1.000000000000000e+00 8.999999999999999e-01
|
||||
-2.666666666666666e-01 1.000000000000000e+00 9.999999999999999e-01
|
||||
-3.333333333333333e-01 1.000000000000000e+00 0.000000000000000e+00
|
||||
-3.333333333333333e-01 1.000000000000000e+00 1.000000000000000e-01
|
||||
-3.333333333333333e-01 1.000000000000000e+00 2.000000000000000e-01
|
||||
-3.333333333333333e-01 1.000000000000000e+00 3.000000000000000e-01
|
||||
-3.333333333333333e-01 1.000000000000000e+00 4.000000000000000e-01
|
||||
-3.333333333333333e-01 1.000000000000000e+00 5.000000000000000e-01
|
||||
-3.333333333333333e-01 1.000000000000000e+00 6.000000000000000e-01
|
||||
-3.333333333333333e-01 1.000000000000000e+00 7.000000000000000e-01
|
||||
-3.333333333333333e-01 1.000000000000000e+00 7.999999999999999e-01
|
||||
-3.333333333333333e-01 1.000000000000000e+00 8.999999999999999e-01
|
||||
-3.333333333333333e-01 1.000000000000000e+00 9.999999999999999e-01
|
||||
-3.999999999999999e-01 1.000000000000000e+00 0.000000000000000e+00
|
||||
-3.999999999999999e-01 1.000000000000000e+00 1.000000000000000e-01
|
||||
-3.999999999999999e-01 1.000000000000000e+00 2.000000000000000e-01
|
||||
-3.999999999999999e-01 1.000000000000000e+00 3.000000000000000e-01
|
||||
-3.999999999999999e-01 1.000000000000000e+00 4.000000000000000e-01
|
||||
-3.999999999999999e-01 1.000000000000000e+00 5.000000000000000e-01
|
||||
-3.999999999999999e-01 1.000000000000000e+00 6.000000000000000e-01
|
||||
-3.999999999999999e-01 1.000000000000000e+00 7.000000000000000e-01
|
||||
-3.999999999999999e-01 1.000000000000000e+00 7.999999999999999e-01
|
||||
-3.999999999999999e-01 1.000000000000000e+00 8.999999999999999e-01
|
||||
-3.999999999999999e-01 1.000000000000000e+00 9.999999999999999e-01
|
||||
-4.666666666666666e-01 1.000000000000000e+00 0.000000000000000e+00
|
||||
-4.666666666666666e-01 1.000000000000000e+00 1.000000000000000e-01
|
||||
-4.666666666666666e-01 1.000000000000000e+00 2.000000000000000e-01
|
||||
-4.666666666666666e-01 1.000000000000000e+00 3.000000000000000e-01
|
||||
-4.666666666666666e-01 1.000000000000000e+00 4.000000000000000e-01
|
||||
-4.666666666666666e-01 1.000000000000000e+00 5.000000000000000e-01
|
||||
-4.666666666666666e-01 1.000000000000000e+00 6.000000000000000e-01
|
||||
-4.666666666666666e-01 1.000000000000000e+00 7.000000000000000e-01
|
||||
-4.666666666666666e-01 1.000000000000000e+00 7.999999999999999e-01
|
||||
-4.666666666666666e-01 1.000000000000000e+00 8.999999999999999e-01
|
||||
-4.666666666666666e-01 1.000000000000000e+00 9.999999999999999e-01
|
||||
-5.333333333333332e-01 1.000000000000000e+00 0.000000000000000e+00
|
||||
-5.333333333333332e-01 1.000000000000000e+00 1.000000000000000e-01
|
||||
-5.333333333333332e-01 1.000000000000000e+00 2.000000000000000e-01
|
||||
-5.333333333333332e-01 1.000000000000000e+00 3.000000000000000e-01
|
||||
-5.333333333333332e-01 1.000000000000000e+00 4.000000000000000e-01
|
||||
-5.333333333333332e-01 1.000000000000000e+00 5.000000000000000e-01
|
||||
-5.333333333333332e-01 1.000000000000000e+00 6.000000000000000e-01
|
||||
-5.333333333333332e-01 1.000000000000000e+00 7.000000000000000e-01
|
||||
-5.333333333333332e-01 1.000000000000000e+00 7.999999999999999e-01
|
||||
-5.333333333333332e-01 1.000000000000000e+00 8.999999999999999e-01
|
||||
-5.333333333333332e-01 1.000000000000000e+00 9.999999999999999e-01
|
||||
-6.000000000000001e-01 1.000000000000000e+00 0.000000000000000e+00
|
||||
-6.000000000000001e-01 1.000000000000000e+00 1.000000000000000e-01
|
||||
-6.000000000000001e-01 1.000000000000000e+00 2.000000000000000e-01
|
||||
-6.000000000000001e-01 1.000000000000000e+00 3.000000000000000e-01
|
||||
-6.000000000000001e-01 1.000000000000000e+00 4.000000000000000e-01
|
||||
-6.000000000000001e-01 1.000000000000000e+00 5.000000000000000e-01
|
||||
-6.000000000000001e-01 1.000000000000000e+00 6.000000000000000e-01
|
||||
-6.000000000000001e-01 1.000000000000000e+00 7.000000000000000e-01
|
||||
-6.000000000000001e-01 1.000000000000000e+00 7.999999999999999e-01
|
||||
-6.000000000000001e-01 1.000000000000000e+00 8.999999999999999e-01
|
||||
-6.000000000000001e-01 1.000000000000000e+00 9.999999999999999e-01
|
||||
-6.666666666666667e-01 1.000000000000000e+00 0.000000000000000e+00
|
||||
-6.666666666666667e-01 1.000000000000000e+00 1.000000000000000e-01
|
||||
-6.666666666666667e-01 1.000000000000000e+00 2.000000000000000e-01
|
||||
-6.666666666666667e-01 1.000000000000000e+00 3.000000000000000e-01
|
||||
-6.666666666666667e-01 1.000000000000000e+00 4.000000000000000e-01
|
||||
-6.666666666666667e-01 1.000000000000000e+00 5.000000000000000e-01
|
||||
-6.666666666666667e-01 1.000000000000000e+00 6.000000000000000e-01
|
||||
-6.666666666666667e-01 1.000000000000000e+00 7.000000000000000e-01
|
||||
-6.666666666666667e-01 1.000000000000000e+00 7.999999999999999e-01
|
||||
-6.666666666666667e-01 1.000000000000000e+00 8.999999999999999e-01
|
||||
-6.666666666666667e-01 1.000000000000000e+00 9.999999999999999e-01
|
||||
-7.333333333333334e-01 1.000000000000000e+00 0.000000000000000e+00
|
||||
-7.333333333333334e-01 1.000000000000000e+00 1.000000000000000e-01
|
||||
-7.333333333333334e-01 1.000000000000000e+00 2.000000000000000e-01
|
||||
-7.333333333333334e-01 1.000000000000000e+00 3.000000000000000e-01
|
||||
-7.333333333333334e-01 1.000000000000000e+00 4.000000000000000e-01
|
||||
-7.333333333333334e-01 1.000000000000000e+00 5.000000000000000e-01
|
||||
-7.333333333333334e-01 1.000000000000000e+00 6.000000000000000e-01
|
||||
-7.333333333333334e-01 1.000000000000000e+00 7.000000000000000e-01
|
||||
-7.333333333333334e-01 1.000000000000000e+00 7.999999999999999e-01
|
||||
-7.333333333333334e-01 1.000000000000000e+00 8.999999999999999e-01
|
||||
-7.333333333333334e-01 1.000000000000000e+00 9.999999999999999e-01
|
||||
-8.000000000000000e-01 1.000000000000000e+00 0.000000000000000e+00
|
||||
-8.000000000000000e-01 1.000000000000000e+00 1.000000000000000e-01
|
||||
-8.000000000000000e-01 1.000000000000000e+00 2.000000000000000e-01
|
||||
-8.000000000000000e-01 1.000000000000000e+00 3.000000000000000e-01
|
||||
-8.000000000000000e-01 1.000000000000000e+00 4.000000000000000e-01
|
||||
-8.000000000000000e-01 1.000000000000000e+00 5.000000000000000e-01
|
||||
-8.000000000000000e-01 1.000000000000000e+00 6.000000000000000e-01
|
||||
-8.000000000000000e-01 1.000000000000000e+00 7.000000000000000e-01
|
||||
-8.000000000000000e-01 1.000000000000000e+00 7.999999999999999e-01
|
||||
-8.000000000000000e-01 1.000000000000000e+00 8.999999999999999e-01
|
||||
-8.000000000000000e-01 1.000000000000000e+00 9.999999999999999e-01
|
||||
-8.666666666666667e-01 1.000000000000000e+00 0.000000000000000e+00
|
||||
-8.666666666666667e-01 1.000000000000000e+00 1.000000000000000e-01
|
||||
-8.666666666666667e-01 1.000000000000000e+00 2.000000000000000e-01
|
||||
-8.666666666666667e-01 1.000000000000000e+00 3.000000000000000e-01
|
||||
-8.666666666666667e-01 1.000000000000000e+00 4.000000000000000e-01
|
||||
-8.666666666666667e-01 1.000000000000000e+00 5.000000000000000e-01
|
||||
-8.666666666666667e-01 1.000000000000000e+00 6.000000000000000e-01
|
||||
-8.666666666666667e-01 1.000000000000000e+00 7.000000000000000e-01
|
||||
-8.666666666666667e-01 1.000000000000000e+00 7.999999999999999e-01
|
||||
-8.666666666666667e-01 1.000000000000000e+00 8.999999999999999e-01
|
||||
-8.666666666666667e-01 1.000000000000000e+00 9.999999999999999e-01
|
||||
-9.333333333333333e-01 1.000000000000000e+00 0.000000000000000e+00
|
||||
-9.333333333333333e-01 1.000000000000000e+00 1.000000000000000e-01
|
||||
-9.333333333333333e-01 1.000000000000000e+00 2.000000000000000e-01
|
||||
-9.333333333333333e-01 1.000000000000000e+00 3.000000000000000e-01
|
||||
-9.333333333333333e-01 1.000000000000000e+00 4.000000000000000e-01
|
||||
-9.333333333333333e-01 1.000000000000000e+00 5.000000000000000e-01
|
||||
-9.333333333333333e-01 1.000000000000000e+00 6.000000000000000e-01
|
||||
-9.333333333333333e-01 1.000000000000000e+00 7.000000000000000e-01
|
||||
-9.333333333333333e-01 1.000000000000000e+00 7.999999999999999e-01
|
||||
-9.333333333333333e-01 1.000000000000000e+00 8.999999999999999e-01
|
||||
-9.333333333333333e-01 1.000000000000000e+00 9.999999999999999e-01
|
||||
-1.000000000000000e+00 1.000000000000000e+00 0.000000000000000e+00
|
||||
-1.000000000000000e+00 1.000000000000000e+00 1.000000000000000e-01
|
||||
-1.000000000000000e+00 1.000000000000000e+00 2.000000000000000e-01
|
||||
-1.000000000000000e+00 1.000000000000000e+00 3.000000000000000e-01
|
||||
-1.000000000000000e+00 1.000000000000000e+00 4.000000000000000e-01
|
||||
-1.000000000000000e+00 1.000000000000000e+00 5.000000000000000e-01
|
||||
-1.000000000000000e+00 1.000000000000000e+00 6.000000000000000e-01
|
||||
-1.000000000000000e+00 1.000000000000000e+00 7.000000000000000e-01
|
||||
-1.000000000000000e+00 1.000000000000000e+00 7.999999999999999e-01
|
||||
-1.000000000000000e+00 1.000000000000000e+00 8.999999999999999e-01
|
||||
-1.000000000000000e+00 1.000000000000000e+00 9.999999999999999e-01
|
|
@ -0,0 +1,27 @@
|
|||
ACL_SUCCESS = 0
|
||||
|
||||
# rule for mem
|
||||
ACL_MEM_MALLOC_HUGE_FIRST = 0
|
||||
ACL_MEM_MALLOC_HUGE_ONLY = 1
|
||||
ACL_MEM_MALLOC_NORMAL_ONLY = 2
|
||||
|
||||
# rule for memory copy
|
||||
ACL_MEMCPY_HOST_TO_HOST = 0
|
||||
ACL_MEMCPY_HOST_TO_DEVICE = 1
|
||||
ACL_MEMCPY_DEVICE_TO_HOST = 2
|
||||
ACL_MEMCPY_DEVICE_TO_DEVICE = 3
|
||||
|
||||
#numpy data type
|
||||
NPY_FLOAT32 = 11
|
||||
NPY_FLOAT16 = 23
|
||||
|
||||
#profile para
|
||||
ACL_PROF_ACL_API = 1
|
||||
ACL_PROF_TASK_TIME = 2
|
||||
ACL_PROF_AICPU_TRACE = 4
|
||||
ACL_PROF_AICORE_METRICS = 8
|
||||
ACL_PROF_L2CACHE = 16
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,222 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# @Author: sun
|
||||
# @Date: 2022-03-23 19:25:46
|
||||
# @Last Modified by: sun
|
||||
# @Last Modified time: 2022-03-23 19:26:10
|
||||
"""
|
||||
Copyright (R) @huawei.com, all rights reserved
|
||||
-*- coding:utf-8 -*-
|
||||
CREATED: 2020-6-04 20:12:13
|
||||
MODIFIED: 2020-6-06 14:04:45
|
||||
"""
|
||||
SUCCESS = 0
|
||||
FAILED = 1
|
||||
|
||||
ACL_DEVICE = 0
|
||||
ACL_HOST = 1
|
||||
|
||||
MEMORY_NORMAL = 0
|
||||
MEMORY_HOST = 1
|
||||
MEMORY_DEVICE = 2
|
||||
MEMORY_DVPP = 3
|
||||
MEMORY_CTYPES = 4
|
||||
|
||||
IMAGE_DATA_NUMPY = 0
|
||||
IMAGE_DATA_BUFFER = 1
|
||||
|
||||
READ_VIDEO_OK = 0
|
||||
|
||||
# error code
|
||||
ACL_SUCCESS = 0
|
||||
ACL_ERROR_INVALID_PARAM = 100000
|
||||
ACL_ERROR_UNINITIALIZE = 100001
|
||||
ACL_ERROR_REPEAT_INITIALIZE = 100002
|
||||
ACL_ERROR_INVALID_FILE = 100003
|
||||
ACL_ERROR_WRITE_FILE = 100004
|
||||
ACL_ERROR_INVALID_FILE_SIZE = 100005
|
||||
ACL_ERROR_PARSE_FILE = 100006
|
||||
ACL_ERROR_FILE_MISSING_ATTR = 100007
|
||||
ACL_ERROR_FILE_ATTR_INVALID = 100008
|
||||
ACL_ERROR_INVALID_DUMP_CONFIG = 100009
|
||||
ACL_ERROR_INVALID_PROFILING_CONFIG = 100010
|
||||
ACL_ERROR_INVALID_MODEL_ID = 100011
|
||||
ACL_ERROR_DESERIALIZE_MODEL = 100012
|
||||
ACL_ERROR_PARSE_MODEL = 100013
|
||||
ACL_ERROR_READ_MODEL_FAILURE = 100014
|
||||
ACL_ERROR_MODEL_SIZE_INVALID = 100015
|
||||
ACL_ERROR_MODEL_MISSING_ATTR = 100016
|
||||
ACL_ERROR_MODEL_INPUT_NOT_MATCH = 100017
|
||||
ACL_ERROR_MODEL_OUTPUT_NOT_MATCH = 100018
|
||||
ACL_ERROR_MODEL_NOT_DYNAMIC = 100019
|
||||
ACL_ERROR_OP_TYPE_NOT_MATCH = 100020
|
||||
ACL_ERROR_OP_INPUT_NOT_MATCH = 100021
|
||||
ACL_ERROR_OP_OUTPUT_NOT_MATCH = 100022
|
||||
ACL_ERROR_OP_ATTR_NOT_MATCH = 100023
|
||||
ACL_ERROR_OP_NOT_FOUND = 100024
|
||||
ACL_ERROR_OP_LOAD_FAILED = 100025
|
||||
ACL_ERROR_UNSUPPORTED_DATA_TYPE = 100026
|
||||
ACL_ERROR_FORMAT_NOT_MATCH = 100027
|
||||
ACL_ERROR_BIN_SELECTOR_NOT_REGISTERED = 100028
|
||||
ACL_ERROR_KERNEL_NOT_FOUND = 100029
|
||||
ACL_ERROR_BIN_SELECTOR_ALREADY_REGISTERED = 100030
|
||||
ACL_ERROR_KERNEL_ALREADY_REGISTERED = 100031
|
||||
ACL_ERROR_INVALID_QUEUE_ID = 100032
|
||||
ACL_ERROR_REPEAT_SUBSCRIBE = 100033
|
||||
ACL_ERROR_STREAM_NOT_SUBSCRIBE = 100034
|
||||
ACL_ERROR_THREAD_NOT_SUBSCRIBE = 100035
|
||||
ACL_ERROR_WAIT_CALLBACK_TIMEOUT = 100036
|
||||
ACL_ERROR_REPEAT_FINALIZE = 100037
|
||||
ACL_ERROR_BAD_ALLOC = 200000
|
||||
ACL_ERROR_API_NOT_SUPPORT = 200001
|
||||
ACL_ERROR_INVALID_DEVICE = 200002
|
||||
ACL_ERROR_MEMORY_ADDRESS_UNALIGNED = 200003
|
||||
ACL_ERROR_RESOURCE_NOT_MATCH = 200004
|
||||
ACL_ERROR_INVALID_RESOURCE_HANDLE = 200005
|
||||
ACL_ERROR_STORAGE_OVER_LIMIT = 300000
|
||||
ACL_ERROR_INTERNAL_ERROR = 500000
|
||||
ACL_ERROR_FAILURE = 500001
|
||||
ACL_ERROR_GE_FAILURE = 500002
|
||||
ACL_ERROR_RT_FAILURE = 500003
|
||||
ACL_ERROR_DRV_FAILURE = 500004
|
||||
# rule for mem
|
||||
ACL_MEM_MALLOC_HUGE_FIRST = 0
|
||||
ACL_MEM_MALLOC_HUGE_ONLY = 1
|
||||
ACL_MEM_MALLOC_NORMAL_ONLY = 2
|
||||
# rule for memory copy
|
||||
ACL_MEMCPY_HOST_TO_HOST = 0
|
||||
ACL_MEMCPY_HOST_TO_DEVICE = 1
|
||||
ACL_MEMCPY_DEVICE_TO_HOST = 2
|
||||
ACL_MEMCPY_DEVICE_TO_DEVICE = 3
|
||||
# input
|
||||
LAST_ONE = -1
|
||||
LAST_TWO = -2
|
||||
type_dict = {
|
||||
"bool": 0,
|
||||
"int8": 1,
|
||||
"int16": 2,
|
||||
"int32": 4,
|
||||
"int64": 8,
|
||||
"uint8": 1,
|
||||
"uint16": 2,
|
||||
"uint32": 4,
|
||||
"uint64": 8,
|
||||
"float16": 2,
|
||||
"float32": 4,
|
||||
"float64": 8,
|
||||
"float_": 8
|
||||
}
|
||||
NPY_BOOL = 0
|
||||
NPY_BYTE = 1
|
||||
NPY_UBYTE = 2
|
||||
NPY_SHORT = 3
|
||||
NPY_USHORT = 4
|
||||
NPY_INT = 5
|
||||
NPY_UINT = 6
|
||||
NPY_LONG = 7
|
||||
NPY_ULONG = 8
|
||||
NPY_LONGLONG = 9
|
||||
NPY_ULONGLONG = 10
|
||||
|
||||
ACL_DT_UNDEFINED = -1
|
||||
ACL_FLOAT = 0
|
||||
ACL_FLOAT16 = 1
|
||||
ACL_INT8 = 2
|
||||
ACL_INT32 = 3
|
||||
ACL_UINT8 = 4
|
||||
ACL_INT16 = 6
|
||||
ACL_UINT16 = 7
|
||||
ACL_UINT32 = 8
|
||||
ACL_INT64 = 9
|
||||
ACL_UINT64 = 10
|
||||
ACL_DOUBLE = 11
|
||||
ACL_BOOL = 12
|
||||
|
||||
# data format
|
||||
ACL_FORMAT_UNDEFINED = -1
|
||||
ACL_FORMAT_NCHW = 0
|
||||
ACL_FORMAT_NHWC = 1
|
||||
ACL_FORMAT_ND = 2
|
||||
ACL_FORMAT_NC1HWC0 = 3
|
||||
ACL_FORMAT_FRACTAL_Z = 4
|
||||
ACL_DT_UNDEFINED = -1
|
||||
ACL_FLOAT = 0
|
||||
ACL_FLOAT16 = 1
|
||||
ACL_INT8 = 2
|
||||
ACL_INT32 = 3
|
||||
ACL_UINT8 = 4
|
||||
ACL_INT16 = 6
|
||||
ACL_UINT16 = 7
|
||||
ACL_UINT32 = 8
|
||||
ACL_INT64 = 9
|
||||
ACL_UINT64 = 10
|
||||
ACL_DOUBLE = 11
|
||||
ACL_BOOL = 12
|
||||
acl_dtype = {
|
||||
"dt_undefined": -1,
|
||||
"float": 0,
|
||||
"float16": 1,
|
||||
"int8": 2,
|
||||
"int32": 3,
|
||||
"uint8": 4,
|
||||
"int16": 6,
|
||||
"uint16": 7,
|
||||
"uint32": 8,
|
||||
"int64": 9,
|
||||
"double": 11,
|
||||
"bool": 12
|
||||
}
|
||||
ACL_CALLBACK_NO_BLOCK = 0
|
||||
ACL_CALLBACK_BLOCK = 1
|
||||
PIXEL_FORMAT_YUV_400 = 0 # 0, YUV400 8bit
|
||||
PIXEL_FORMAT_YUV_SEMIPLANAR_420 = 1 # 1, YUV420SP NV12 8bit
|
||||
PIXEL_FORMAT_YVU_SEMIPLANAR_420 = 2 # 2, YUV420SP NV21 8bit
|
||||
PIXEL_FORMAT_YUV_SEMIPLANAR_422 = 3 # 3, YUV422SP NV12 8bit
|
||||
PIXEL_FORMAT_YVU_SEMIPLANAR_422 = 4 # 4, YUV422SP NV21 8bit
|
||||
PIXEL_FORMAT_YUV_SEMIPLANAR_444 = 5 # 5, YUV444SP NV12 8bit
|
||||
PIXEL_FORMAT_YVU_SEMIPLANAR_444 = 6 # 6, YUV444SP NV21 8bit
|
||||
PIXEL_FORMAT_YUYV_PACKED_422 = 7 # 7, YUV422P YUYV 8bit
|
||||
PIXEL_FORMAT_UYVY_PACKED_422 = 8 # 8, YUV422P UYVY 8bit
|
||||
PIXEL_FORMAT_YVYU_PACKED_422 = 9 # 9, YUV422P YVYU 8bit
|
||||
PIXEL_FORMAT_VYUY_PACKED_422 = 10 # 10, YUV422P VYUY 8bit
|
||||
PIXEL_FORMAT_YUV_PACKED_444 = 11 # 11, YUV444P 8bit
|
||||
PIXEL_FORMAT_RGB_888 = 12 # 12, RGB888
|
||||
PIXEL_FORMAT_BGR_888 = 13 # 13, BGR888
|
||||
PIXEL_FORMAT_ARGB_8888 = 14 # 14, ARGB8888
|
||||
PIXEL_FORMAT_ABGR_8888 = 15 # 15, ABGR8888
|
||||
PIXEL_FORMAT_RGBA_8888 = 16 # 16, RGBA8888
|
||||
PIXEL_FORMAT_BGRA_8888 = 17 # 17, BGRA8888
|
||||
PIXEL_FORMAT_YUV_SEMI_PLANNER_420_10BIT = 18 # 18, YUV420SP 10bit
|
||||
PIXEL_FORMAT_YVU_SEMI_PLANNER_420_10BIT = 19 # 19, YVU420sp 10bit
|
||||
PIXEL_FORMAT_YVU_PLANAR_420 = 20 # 20, YUV420P 8bit
|
||||
# images format
|
||||
IMG_EXT = ['.jpg', '.JPG', '.png', '.PNG', '.bmp', '.BMP', '.jpeg', '.JPEG']
|
||||
|
||||
ENCODE_FORMAT_UNKNOW = 0
|
||||
ENCODE_FORMAT_JPEG = 1
|
||||
ENCODE_FORMAT_PNG = 2
|
||||
ENCODE_FORMAT_YUV420_SP = 3
|
||||
|
||||
"""
|
||||
enType 0
|
||||
0 H265 main level
|
||||
1 H264 baseline level
|
||||
2 H264 main level
|
||||
3 H264 high level
|
||||
"""
|
||||
ENTYPE_H265_MAIN = 0
|
||||
ENTYPE_H264_BASE = 1
|
||||
ENTYPE_H264_MAIN = 2
|
||||
ENTYPE_H264_HIGH = 3
|
||||
|
||||
# h264 stream codec id
|
||||
AV_CODEC_ID_H264 = 27
|
||||
# h265 stream codec id
|
||||
AV_CODEC_ID_HEVC = 173
|
||||
# h264 baseline level
|
||||
FF_PROFILE_H264_BASELINE = 66
|
||||
# h264 main level profile
|
||||
FF_PROFILE_H264_MAIN = 77
|
||||
# h264 high level profile
|
||||
FF_PROFILE_H264_HIGH = 100
|
||||
# h265 main level profile
|
||||
FF_PROFILE_HEVC_MAIN = 1
|
|
@ -0,0 +1,5 @@
|
|||
红山开源风雷算例库原始网格获取百度网盘链接:
|
||||
链接:http://pan.baidu.com/s/1aZ9cdkp6CkT9il4fEpnTcA
|
||||
提取码:w47m
|
||||
|
||||
注:plot3D格式网格需同时下载.grd和.inp文件
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,11 @@
|
|||
1.758059999999999956e+00
|
||||
2.000000000000000000e+00
|
||||
2.439897850385851780e+04
|
||||
2.807202554172891773e-01
|
||||
1.568428388959923536e+00
|
||||
3.252984655737341745e+04
|
||||
6.350657835524052608e+00
|
||||
8.335128990177707919e+00
|
||||
2.718280000000000030e+00
|
||||
9.912202386492101613e-01
|
||||
8.296507258753202052e+01
|
|
@ -0,0 +1,11 @@
|
|||
-3.161399999999999766e-01
|
||||
1.000000000000000000e+00
|
||||
6.785513369607711652e-09
|
||||
-2.952159685173983972e-01
|
||||
-1.570732481737654673e+00
|
||||
9.089549089516115914e-08
|
||||
0.000000000000000000e+00
|
||||
0.000000000000000000e+00
|
||||
3.849111030207388786e-03
|
||||
-9.999999973001819642e-01
|
||||
8.539709649871904494e-07
|
|
@ -0,0 +1,615 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
Created on Sun Nov 10 18:13:57 2019
|
||||
|
||||
@author: sun
|
||||
|
||||
Fortran 调用Python时的模块,包含一些必要的函数和类。如果需要改动增加新的函数与类,则需要写好之后重新
|
||||
编译DLL,如果只是更改函数内部的处理方式,则不需要。
|
||||
|
||||
这个版本的程序传递过来的数据是最原始的流场变量数据,特征的构建和顺序需要在BuildFeatures函数里面完成
|
||||
模型的预测赋值也直接在pred函数里面完成,所以一定不要改pred函数里面x的值,否则数据可能会传递不过去
|
||||
这里只是不分区涡粘模型的写法,其他的类似
|
||||
如果需要提高运行速度,一个优化策略是有选择性的取消属性访问,比如把np.vstack改为form numpy import vstack,而且要尽量使用局部变量
|
||||
----2020.1.25s
|
||||
|
||||
调用华为om模型执行推理 2022.4.20
|
||||
"""
|
||||
import numpy as np
|
||||
import time
|
||||
import acl
|
||||
|
||||
import constants as const
|
||||
import acllite_utils as utils
|
||||
from acllite_logger import log_error, log_info, log_warning
|
||||
from acllite_resource import resource_list, AclLiteResource
|
||||
from omaclitemodel import AclLiteModel
|
||||
|
||||
from constant import ACL_MEM_MALLOC_HUGE_FIRST, \
|
||||
ACL_MEMCPY_HOST_TO_DEVICE, ACL_MEMCPY_DEVICE_TO_HOST, \
|
||||
NPY_FLOAT32, ACL_SUCCESS, NPY_FLOAT16,ACL_PROF_ACL_API, \
|
||||
ACL_PROF_TASK_TIME, ACL_PROF_AICPU_TRACE, ACL_PROF_AICORE_METRICS, ACL_PROF_L2CACHE
|
||||
|
||||
buffer_method = {
|
||||
"in": acl.mdl.get_input_size_by_index,
|
||||
"out": acl.mdl.get_output_size_by_index
|
||||
}
|
||||
|
||||
# create the dictionary mapping ctypes to np dtypes
|
||||
|
||||
ctype2dtype = {}
|
||||
|
||||
# Intertypes
|
||||
for prefix in ('int', 'uint'):
|
||||
for log_bytes in range(4):
|
||||
ctype = '%s%d_t' % (prefix, 8 * (2 ** log_bytes))
|
||||
dtype = '%s%d' % (prefix[0], 2 ** log_bytes)
|
||||
ctype2dtype[ctype] = np.dtype(dtype)
|
||||
|
||||
# Floating point types
|
||||
ctype2dtype['float'] = np.dtype('f4')
|
||||
ctype2dtype['double'] = np.dtype('f8')
|
||||
ctype2dtype['int'] = np.dtype('int32')
|
||||
|
||||
def check_ret(message, ret):
|
||||
if ret != ACL_SUCCESS:
|
||||
raise Exception("{} failed ret={}"
|
||||
.format(message, ret))
|
||||
|
||||
def GetDataFromPointer(ffi, pointer):
|
||||
"""
|
||||
将指针的数据获取出来
|
||||
"""
|
||||
T = ffi.getctype(ffi.typeof(pointer).item)
|
||||
value = np.frombuffer(ffi.buffer(pointer, ffi.sizeof(T)),
|
||||
ctype2dtype[T])
|
||||
value = value.item()
|
||||
return value
|
||||
|
||||
class BFNet(object):
|
||||
def __init__(self, device_id, model_path, model_path_2, model_path_3):
|
||||
self.device_id = device_id # int
|
||||
self.model_path = model_path # string
|
||||
self.model_path_2 = model_path_2
|
||||
self.model_path_3 = model_path_3
|
||||
self.model_id = None # pointer
|
||||
self.model_id_2 = None
|
||||
self.model_id_3 = None
|
||||
self.context = None # pointer
|
||||
|
||||
self.input_data = []
|
||||
self.output_data = []
|
||||
self.output_data_2 = []
|
||||
self.output_data_3 = []
|
||||
self.model_desc = None # pointer when using
|
||||
self.model_desc_2 = None
|
||||
self.model_desc_3 = None
|
||||
self.load_input_dataset = None
|
||||
self.load_output_dataset = None
|
||||
self.load_output_dataset_2 = None
|
||||
self.load_output_dataset_3 = None
|
||||
self.prof_config = None
|
||||
|
||||
self.init_resource()
|
||||
|
||||
def __del__(self):
|
||||
print("Releasing resources stage:")
|
||||
ret = acl.mdl.unload(self.model_id)
|
||||
# check_ret("acl.mdl.unload", ret)
|
||||
ret = acl.mdl.unload(self.model_id_2)
|
||||
# ret = acl.mdl.unload(self.model_id_3)
|
||||
if self.model_desc:
|
||||
acl.mdl.destroy_desc(self.model_desc)
|
||||
self.model_desc = None
|
||||
if self.model_desc_2:
|
||||
acl.mdl.destroy_desc(self.model_desc_2)
|
||||
self.model_desc_2 = None
|
||||
if self.model_desc_3:
|
||||
acl.mdl.destroy_desc(self.model_desc_3)
|
||||
self.model_desc_3 = None
|
||||
|
||||
while self.input_data:
|
||||
item = self.input_data.pop()
|
||||
ret = acl.rt.free(item["buffer"])
|
||||
# check_ret("acl.rt.free", ret)
|
||||
|
||||
while self.output_data:
|
||||
item = self.output_data.pop()
|
||||
ret = acl.rt.free(item["buffer"])
|
||||
# check_ret("acl.rt.free", ret)
|
||||
|
||||
while self.output_data_2:
|
||||
item = self.output_data_2.pop()
|
||||
ret = acl.rt.free(item["buffer"])
|
||||
# check_ret("acl.rt.free", ret)
|
||||
|
||||
while self.output_data_3:
|
||||
item = self.output_data_3.pop()
|
||||
ret = acl.rt.free(item["buffer"])
|
||||
# check_ret("acl.rt.free", ret)
|
||||
|
||||
if self.context:
|
||||
ret = acl.rt.destroy_context(self.context)
|
||||
# check_ret("acl.rt.destroy_context", ret)
|
||||
self.context = None
|
||||
|
||||
|
||||
ret = acl.rt.reset_device(self.device_id)
|
||||
# check_ret("acl.rt.reset_device", ret)
|
||||
ret = acl.finalize()
|
||||
# check_ret("acl.finalize", ret)
|
||||
# print('Resources released successfully.')
|
||||
|
||||
def init_resource(self):
|
||||
# print("init resource stage:")
|
||||
ret = acl.init()
|
||||
# check_ret("acl.init", ret)
|
||||
ret = acl.rt.set_device(self.device_id)
|
||||
# check_ret("acl.rt.set_device", ret)
|
||||
|
||||
self.context, ret = acl.rt.create_context(self.device_id)
|
||||
# check_ret("acl.rt.create_context", ret)
|
||||
|
||||
# load_model
|
||||
self.model_id, ret = acl.mdl.load_from_file(self.model_path)
|
||||
# check_ret("acl.mdl.load_from_file", ret)
|
||||
# print("model_id:{}".format(self.model_id))
|
||||
|
||||
self.model_id_2, ret = acl.mdl.load_from_file(self.model_path_2)
|
||||
# check_ret("acl.mdl.load_from_file", ret)
|
||||
# print("model_id_2:{}".format(self.model_id_2))
|
||||
|
||||
self.model_id_3, ret = acl.mdl.load_from_file(self.model_path_3)
|
||||
check_ret("acl.mdl.load_from_file", ret)
|
||||
# print("model_id_2:{}".format(self.model_id_2))
|
||||
|
||||
self.model_desc = acl.mdl.create_desc()
|
||||
self._get_model_info()
|
||||
|
||||
self.model_desc_2 = acl.mdl.create_desc()
|
||||
self._get_model_info_2()
|
||||
|
||||
self.model_desc_3 = acl.mdl.create_desc()
|
||||
self._get_model_info_3()
|
||||
# print("init resource success")
|
||||
|
||||
def _get_model_info(self,):
|
||||
ret = acl.mdl.get_desc(self.model_desc, self.model_id)
|
||||
# check_ret("acl.mdl.get_desc", ret)
|
||||
input_size = acl.mdl.get_num_inputs(self.model_desc)
|
||||
# print("input_size")
|
||||
# print(input_size)
|
||||
output_size = acl.mdl.get_num_outputs(self.model_desc)
|
||||
# print("output_size")
|
||||
# print(output_size)
|
||||
self._gen_data_buffer(input_size, des="in")
|
||||
self._gen_data_buffer(output_size, des="out")
|
||||
|
||||
def _get_model_info_2(self,):
|
||||
ret = acl.mdl.get_desc(self.model_desc_2, self.model_id_2)
|
||||
# check_ret("acl.mdl.get_desc", ret)
|
||||
input_size = acl.mdl.get_num_inputs(self.model_desc_2)
|
||||
# print("model_2_input_size")
|
||||
# print(input_size)
|
||||
output_size = acl.mdl.get_num_outputs(self.model_desc_2)
|
||||
# print("model2_output_size")
|
||||
# print(output_size)
|
||||
# self._gen_data_buffer(input_size, des="in")
|
||||
self._gen_data_buffer_2(output_size, des="out")
|
||||
|
||||
def _get_model_info_3(self,):
|
||||
ret = acl.mdl.get_desc(self.model_desc_3, self.model_id_3)
|
||||
# check_ret("acl.mdl.get_desc", ret)
|
||||
input_size = acl.mdl.get_num_inputs(self.model_desc_3)
|
||||
# print("model_3_input_size")
|
||||
# print(input_size)
|
||||
output_size = acl.mdl.get_num_outputs(self.model_desc_3)
|
||||
# print("model_3_output_size")
|
||||
# print(output_size)
|
||||
# self._gen_data_buffer(input_size, des="in")
|
||||
self._gen_data_buffer_3(output_size, des="out")
|
||||
|
||||
def _gen_data_buffer(self, size, des):
|
||||
func = buffer_method[des]
|
||||
for i in range(size):
|
||||
# check temp_buffer dtype
|
||||
temp_buffer_size = func(self.model_desc, i)
|
||||
temp_buffer, ret = acl.rt.malloc(temp_buffer_size,
|
||||
ACL_MEM_MALLOC_HUGE_FIRST)
|
||||
# check_ret("acl.rt.malloc", ret)
|
||||
|
||||
if des == "in":
|
||||
self.input_data.append({"buffer": temp_buffer,
|
||||
"size": temp_buffer_size})
|
||||
elif des == "out":
|
||||
self.output_data.append({"buffer": temp_buffer,
|
||||
"size": temp_buffer_size})
|
||||
|
||||
def _gen_data_buffer_2(self, size, des):
|
||||
func = buffer_method[des]
|
||||
for i in range(size):
|
||||
# check temp_buffer dtype
|
||||
temp_buffer_size = func(self.model_desc_2, i)
|
||||
temp_buffer, ret = acl.rt.malloc(temp_buffer_size,
|
||||
ACL_MEM_MALLOC_HUGE_FIRST)
|
||||
# check_ret("acl.rt.malloc", ret)
|
||||
#
|
||||
# if des == "in":
|
||||
# self.input_data.append({"buffer": temp_buffer,
|
||||
# "size": temp_buffer_size})
|
||||
# elif des == "out":
|
||||
self.output_data_2.append({"buffer": temp_buffer,
|
||||
"size": temp_buffer_size})
|
||||
|
||||
def _gen_data_buffer_3(self, size, des):
|
||||
func = buffer_method[des]
|
||||
for i in range(size):
|
||||
# check temp_buffer dtype
|
||||
temp_buffer_size = func(self.model_desc_3, i)
|
||||
temp_buffer, ret = acl.rt.malloc(temp_buffer_size,
|
||||
ACL_MEM_MALLOC_HUGE_FIRST)
|
||||
# check_ret("acl.rt.malloc", ret)
|
||||
#
|
||||
# if des == "in":
|
||||
# self.input_data.append({"buffer": temp_buffer,
|
||||
# "size": temp_buffer_size})
|
||||
# elif des == "out":
|
||||
self.output_data_3.append({"buffer": temp_buffer,
|
||||
"size": temp_buffer_size})
|
||||
|
||||
def _data_interaction(self, dataset, policy=ACL_MEMCPY_HOST_TO_DEVICE):
|
||||
temp_data_buffer = self.input_data \
|
||||
if policy == ACL_MEMCPY_HOST_TO_DEVICE \
|
||||
else self.output_data_3
|
||||
if len(dataset) == 0 and policy == ACL_MEMCPY_DEVICE_TO_HOST:
|
||||
for item in self.output_data_3:
|
||||
begin = time.time()
|
||||
temp, ret = acl.rt.malloc_host(item["size"])
|
||||
end = time.time()
|
||||
# print(f"ACL_MEMCPY_HOST_TO_DEVICE malloc = {end-begin}")
|
||||
# print("item[size]")
|
||||
# print(item["size"])
|
||||
if ret != 0:
|
||||
raise Exception("can't malloc_host ret={}".format(ret))
|
||||
dataset.append({"size": item["size"], "buffer": temp})
|
||||
|
||||
for i, item in enumerate(temp_data_buffer):
|
||||
if policy == ACL_MEMCPY_HOST_TO_DEVICE:
|
||||
# print(f"i is {i}")
|
||||
a = item["size"]
|
||||
# print(f"size is {a}")
|
||||
# print(i)
|
||||
# print(dataset.shape)
|
||||
ptr,_ = acl.util.numpy_contiguous_to_ptr(dataset[i])
|
||||
begin = time.time()
|
||||
ret = acl.rt.memcpy(item["buffer"],
|
||||
item["size"],
|
||||
ptr,
|
||||
item["size"],
|
||||
policy)
|
||||
end = time.time()
|
||||
# print(f"ACL_MEMCPY_HOST_TO_DEVICE = {end-begin}")
|
||||
check_ret("acl.rt.memcpy", ret)
|
||||
|
||||
else:
|
||||
# print(f"i is {i}")
|
||||
a = item["size"]
|
||||
# print(f"size is {a}")
|
||||
ptr = dataset[i]["buffer"]
|
||||
begin = time.time()
|
||||
ret = acl.rt.memcpy(ptr,
|
||||
item["size"],
|
||||
item["buffer"],
|
||||
item["size"],
|
||||
policy)
|
||||
end = time.time()
|
||||
# print(f"ACL_MEMCPY_DEVICE_TO_HOST = {end-begin}")
|
||||
check_ret("acl.rt.memcpy", ret)
|
||||
|
||||
def _gen_dataset(self, type_str="in"):
|
||||
dataset = acl.mdl.create_dataset()
|
||||
|
||||
temp_dataset = None
|
||||
if type_str == "in":
|
||||
self.load_input_dataset = dataset
|
||||
temp_dataset = self.input_data
|
||||
elif type_str == "out":
|
||||
self.load_output_dataset = dataset
|
||||
temp_dataset = self.output_data
|
||||
elif type_str == "out2":
|
||||
self.load_output_dataset_2 = dataset
|
||||
temp_dataset = self.output_data_2
|
||||
elif type_str == "out3":
|
||||
self.load_output_dataset_3 = dataset
|
||||
temp_dataset = self.output_data_3
|
||||
|
||||
for item in temp_dataset:
|
||||
data = acl.create_data_buffer(item["buffer"], item["size"])
|
||||
_, ret = acl.mdl.add_dataset_buffer(dataset, data)
|
||||
|
||||
if ret != ACL_SUCCESS:
|
||||
ret = acl.destroy_data_buffer(data)
|
||||
# check_ret("acl.destroy_data_buffer", ret)
|
||||
|
||||
def _data_from_host_to_device(self, images):
|
||||
# print("data interaction from host to device")
|
||||
# copy images to device
|
||||
|
||||
begin = time.time()
|
||||
# print("images is ", images)
|
||||
# print(len(images))
|
||||
self._data_interaction(images, ACL_MEMCPY_HOST_TO_DEVICE)
|
||||
|
||||
end = time.time()
|
||||
|
||||
# print(f"_data_from_host_to_device = {end-begin}")
|
||||
# load input data into model
|
||||
self._gen_dataset("in")
|
||||
# load output data into model
|
||||
self._gen_dataset("out")
|
||||
# load second output data into model
|
||||
self._gen_dataset("out2")
|
||||
# # load third output data into model
|
||||
self._gen_dataset("out3")
|
||||
# # print("data interaction from host to device success")
|
||||
|
||||
def _data_from_device_to_host(self):
|
||||
# print("data interaction from device to host")
|
||||
res = []
|
||||
# copy device to host
|
||||
begin = time.time()
|
||||
|
||||
self._data_interaction(res, ACL_MEMCPY_DEVICE_TO_HOST)
|
||||
|
||||
end = time.time()
|
||||
|
||||
# print(f"_data_from_device_to_host = {end-begin}")
|
||||
# print("data interaction from device to host success")
|
||||
# result = self.get_result(res,self.model_desc_3, NPY_FLOAT32)
|
||||
result = self.get_result(res, self.model_desc_3, NPY_FLOAT32)
|
||||
# self._print_result(result)
|
||||
# free host memory
|
||||
# for item in res:
|
||||
# ptr = item['buffer']
|
||||
# ret = acl.rt.free_host(ptr)
|
||||
# check_ret('acl.rt.free_host', ret)
|
||||
return result
|
||||
def run(self, images):
|
||||
start = time.time()
|
||||
self._data_from_host_to_device(images)
|
||||
end = time.time()
|
||||
# print(f"_data_from_host_to_device = {end-start}")
|
||||
# self.start_profile()
|
||||
self.forward()
|
||||
end2 = time.time()
|
||||
# print(f"forward = {end2-end}")
|
||||
# self.end_profile(self.prof_config)
|
||||
result = self._data_from_device_to_host()
|
||||
end3 = time.time()
|
||||
# print(f"_data_from_device_to_host = {end3-end2}")
|
||||
return result
|
||||
|
||||
def forward(self):
|
||||
# print('execute stage:')
|
||||
start = time.time()
|
||||
ret = acl.mdl.execute(self.model_id, self.load_input_dataset, self.load_output_dataset)
|
||||
end1 = time.time()
|
||||
# print(f"first om time={end1 - start}")
|
||||
# check_ret("acl.mdl.execute", ret)
|
||||
# start = time.time()
|
||||
ret = acl.mdl.execute(self.model_id_2, self.load_output_dataset, self.load_output_dataset_2)
|
||||
end2 = time.time()
|
||||
# print(f"second om time={end2 - end1}")
|
||||
# check_ret("acl.mdl.execute", ret)
|
||||
# start = time.time()
|
||||
ret = acl.mdl.execute(self.model_id_3, self.load_output_dataset_2, self.load_output_dataset_3)
|
||||
end3 = time.time()
|
||||
# print(f"third om time={end3 - end2}")
|
||||
# check_ret("acl.mdl.execute", ret)
|
||||
self._destroy_databuffer()
|
||||
# print('execute stage success')
|
||||
|
||||
def _print_result(self, result):
|
||||
print(result)
|
||||
|
||||
def _destroy_databuffer(self):
|
||||
# for dataset in [self.load_input_dataset, self.load_output_dataset, self.load_output_dataset_2, self.load_output_dataset_3]:
|
||||
for dataset in [self.load_input_dataset, self.load_output_dataset, self.load_output_dataset_2, self.load_output_dataset_3]:
|
||||
# for dataset in [self.load_input_dataset, self.load_output_dataset, self.load_output_dataset_2]:
|
||||
if not dataset:
|
||||
continue
|
||||
number = acl.mdl.get_dataset_num_buffers(dataset)
|
||||
for i in range(number):
|
||||
data_buf = acl.mdl.get_dataset_buffer(dataset, i)
|
||||
if data_buf:
|
||||
ret = acl.destroy_data_buffer(data_buf)
|
||||
# check_ret("acl.destroy_data_buffer", ret)
|
||||
ret = acl.mdl.destroy_dataset(dataset)
|
||||
# check_ret("acl.mdl.destroy_dataset", ret)
|
||||
|
||||
def get_result(self, output_data, model_desc, data_type):
|
||||
result = []
|
||||
dims, ret = acl.mdl.get_cur_output_dims(model_desc, 0)
|
||||
# check_ret("acl.mdl.get_cur_output_dims", ret)
|
||||
out_dim = dims['dims']
|
||||
# print(tuple(out_dim))
|
||||
for temp in output_data:
|
||||
ptr = temp["buffer"]
|
||||
# print(temp)
|
||||
# 转化为float32类型的数据
|
||||
data = acl.util.ptr_to_numpy(ptr, tuple(out_dim), data_type)
|
||||
# print(data)
|
||||
result.append(data)
|
||||
return result
|
||||
|
||||
def asarray(ffi, x_ptr, shape1_ptr, shape2_ptr):
|
||||
"""
|
||||
x_ptr : Fortran传递过来的数组的地址
|
||||
size_ptr : Fortran数组的大小的地址
|
||||
因为传递过来的都是地址,因此需要先把地址中的数值取出来,才可以进行数据处理
|
||||
"""
|
||||
shape = [GetDataFromPointer(ffi, pointer) for pointer in (shape1_ptr,
|
||||
shape2_ptr)]
|
||||
length = np.prod(shape)
|
||||
# Get the canonical C type of the elments of ptr as a string
|
||||
T = ffi.getctype(ffi.typeof(x_ptr).item)
|
||||
x = np.frombuffer(ffi.buffer(x_ptr, length * ffi.sizeof(T)),
|
||||
ctype2dtype[T]).reshape(shape, order='C')
|
||||
return x
|
||||
|
||||
def read_data(file_path):
|
||||
with open(file_path, 'r') as f:
|
||||
return np.array([float(x) for x in f.read().split()]).reshape(-1, 1)
|
||||
|
||||
class pythonmodel(object):
|
||||
def __init__(self):
|
||||
"""
|
||||
类初始化
|
||||
"""
|
||||
self.sca_min = np.loadtxt('./model/sca_min.dat').reshape(-1, 1)
|
||||
self.sca_max = np.loadtxt('./model/sca_max.dat').reshape(-1, 1)
|
||||
self.temp = np.ones((1300000, 17))
|
||||
self.model1_path = "./model/bf_op.om"
|
||||
self.model2_path = "./model/model16.om"
|
||||
self.model3_path = "./model/post_op.om"
|
||||
self.flag = 0
|
||||
print('model loaded!')
|
||||
|
||||
def modelInit(self, zone_id):
|
||||
"""
|
||||
om模型初始化
|
||||
"""
|
||||
self.dev_id = zone_id % 8
|
||||
# self.DSTURB_min = dis_min
|
||||
self.bfnet = BFNet(self.dev_id, self.model1_path, self.model2_path, self.model3_path)
|
||||
|
||||
def BuildFeatures(self, x):
|
||||
"""
|
||||
基于原始变量,构建模型需要的输入特征
|
||||
x : 包含原始变量,依次为:Ru, U, V, W, P, Ux, Uy, Uz, Vx, Vy, Vz, Wx, Wy, Wz, Px, Py, Pz, x, y, z, dis, ma, aoa, re
|
||||
"""
|
||||
ma = x[:, -2]
|
||||
self.Re = x[:, -1]
|
||||
print(self.Re.shape)
|
||||
# eps = 1e-13
|
||||
# aoa = x[:, -2]
|
||||
Ru, P = x[:, 0], x[:, 3] * ma ** 2
|
||||
U, V = x[:, 1], x[:, 2]
|
||||
Ux, Uy, Uz = x[:, 4], x[:, 5], x[:, 6]
|
||||
Vx, Vy, Vz = x[:, 7], x[:, 8], x[:, 9]
|
||||
Wx, Wy, Wz = x[:, 10], x[:, 11], x[:, 12]
|
||||
# Px, Py, Pz = x[:, 14] * ma ** 2, x[:, 15] * ma ** 2, x[:, 16] * ma ** 2
|
||||
Y = x[:, 13]
|
||||
dis = x[:, 14]
|
||||
self.dis = dis
|
||||
|
||||
# q1 = np.sqrt(U**2 + V**2 + W**2)
|
||||
q1 = U # / np.sqrt(U**2 + V**2 + W**2)
|
||||
# q1_2 = V / np.sqrt(U**2 + V**2 + W**2)
|
||||
|
||||
w1 = 0.5 * (Wy - Vz)
|
||||
w2 = 0.5 * (Uz - Wx)
|
||||
w3 = 0.5 * (Vx - Uy)
|
||||
RF = np.sqrt(w1 ** 2 + w2 ** 2 + w3 ** 2)
|
||||
# q2 = np.log(np.abs(RF) + 1.0)
|
||||
|
||||
q3 = (P / Ru ** 1.4) - 1.0
|
||||
|
||||
label = np.where(dis < 0.001, 1, 2)
|
||||
|
||||
sigY = np.sign(Y)
|
||||
q5 = np.arctan(sigY * V / U)
|
||||
|
||||
S11 = Ux
|
||||
S12 = 0.5 * (Uy + Vx)
|
||||
S13 = 0.5 * (Uz + Wx)
|
||||
S22 = Vy
|
||||
S23 = 0.5 * (Vz + Wy)
|
||||
S33 = Wz
|
||||
SF = np.sqrt(S11 ** 2 + S12 ** 2 + S13 ** 2 + S22 ** 2 + S23 ** 2 + S33 ** 2)
|
||||
# q7 = np.log(np.abs(SF) + 1.0)
|
||||
|
||||
q8 = dis ** 2 * RF * (1 - np.tanh(dis))
|
||||
q9 = dis ** 2 * SF * (1 - np.tanh(dis))
|
||||
|
||||
Dref0 = 1.0 / np.sqrt(self.Re)
|
||||
Dref1 = np.min([dis, Dref0], axis=0)
|
||||
Dref2 = np.max([dis, Dref0], axis=0)
|
||||
expfunc = 2.71828 ** (np.sqrt(Dref1 / (dis)))
|
||||
q10 = expfunc * np.sqrt(Dref0 / (Dref2))
|
||||
|
||||
q11 = (RF ** 2 - SF ** 2) / (RF ** 2 + SF ** 2)
|
||||
|
||||
data = np.vstack((q1, label, RF, q3, q5, SF, q8, q9, q10, q11)).T # 输入特征顺序
|
||||
|
||||
col = data.shape[1]
|
||||
x = (data - self.sca_min[0:col, 0]) / (self.sca_max[0:col, 0] - self.sca_min[0:col, 0])
|
||||
return x
|
||||
|
||||
def GetFueatures(self, x):
|
||||
ma = x[:, -3]
|
||||
self.Re = x[:, -1]
|
||||
aoa = x[:, -2]
|
||||
Ru, P = x[:, 0], x[:, 3]
|
||||
U, V = x[:, 1], x[:, 2]
|
||||
Ux, Uy = x[:, 4], x[:, 5]
|
||||
Vx, Vy = x[:, 6], x[:, 7]
|
||||
Y, self.dis = x[:, 8], x[:, 9]
|
||||
data = [ma, aoa, self.Re, self.dis, Ux, U, V, Uy, Vx, Vy, Y, P, Ru]
|
||||
return data
|
||||
|
||||
def ACT(self, x, low, up, length):
|
||||
"""
|
||||
调用om模型预测涡粘
|
||||
low: 归一化下界
|
||||
up: 归一化上界
|
||||
x: 输入特征,np.array格式
|
||||
"""
|
||||
x = x.astype(np.float32)
|
||||
ptr, data_out = acl.util.numpy_contiguous_to_ptr(x)
|
||||
pred = self.bfnet.run([data_out])[0]
|
||||
pred = pred[0:length]
|
||||
return pred
|
||||
|
||||
def Pred(self, x):
|
||||
"""
|
||||
模型预测涡粘
|
||||
"""
|
||||
start = time.time()
|
||||
length = x.shape[0]
|
||||
self.temp[0:length, :] = x[:, :]
|
||||
low, up = 0.0, 1.0
|
||||
pred = self.ACT(self.temp, low, up, length)
|
||||
x[:, 0] = pred[:].copy()
|
||||
end = time.time()
|
||||
|
||||
def post_op(pred, low, high) :
|
||||
sca_min = np.loadtxt('./model/sca_min.dat').reshape(-1, )
|
||||
sca_max = np.loadtxt('./model/sca_max.dat').reshape(-1, )
|
||||
|
||||
Re = 11710000
|
||||
|
||||
pred = np.clip(pred[:, 0], low, high).reshape(-1, 1)
|
||||
|
||||
mut_min = 8.539709649871904494e-07
|
||||
mut_max = 8.296507258753202052e+01
|
||||
pred = pred * (mut_max - mut_min) + mut_min
|
||||
pred = pred * (Re / 1e6)
|
||||
return pred
|
||||
|
||||
if __name__ == "__main__" :
|
||||
|
||||
model_2 = pythonmodel()
|
||||
model_2.modelInit(5)
|
||||
|
||||
np.random.seed(4)
|
||||
x = np.random.rand(1300000, 17).astype(np.float32)
|
||||
y = x.copy()
|
||||
model_2.Pred(y)
|
||||
pred_2 = y[:, 0]
|
||||
print("**********")
|
||||
print(pred_2)
|
||||
print(type(pred_2))
|
||||
print(pred_2.mean())
|
||||
print(pred_2.std())
|
||||
print(pred_2.shape)
|
|
@ -0,0 +1,347 @@
|
|||
"""
|
||||
Copyright (R) @huawei.com, all rights reserved
|
||||
-*- coding:utf-8 -*-
|
||||
CREATED: 2020-6-04 20:12:13
|
||||
MODIFIED: 2020-6-28 14:04:45
|
||||
"""
|
||||
import acl
|
||||
import struct
|
||||
import numpy as np
|
||||
import datetime
|
||||
import sys
|
||||
import os
|
||||
import time
|
||||
#from tqdm import tqdm
|
||||
|
||||
import constants as const
|
||||
import acllite_utils as utils
|
||||
from acllite_logger import log_error, log_info, log_warning
|
||||
from acllite_resource import resource_list, AclLiteResource
|
||||
|
||||
class AclLiteModel(object):
|
||||
"""
|
||||
wrap acl model inference interface, include input dataset construction,
|
||||
execute, and output transform to numpy array
|
||||
Attributes:
|
||||
model_path: om offline mode file path
|
||||
"""
|
||||
|
||||
def __init__(self, model_path):
|
||||
self._run_mode, ret = acl.rt.get_run_mode()
|
||||
utils.check_ret("acl.rt.get_run_mode", ret)
|
||||
self._copy_policy = const.ACL_MEMCPY_DEVICE_TO_DEVICE
|
||||
if self._run_mode == const.ACL_HOST:
|
||||
self._copy_policy = const.ACL_MEMCPY_DEVICE_TO_HOST
|
||||
|
||||
self._model_path = model_path # string
|
||||
self._model_id = None # pointer
|
||||
self._input_num = 0
|
||||
self._input_buffer = []
|
||||
self._input_dataset = None
|
||||
self._output_dataset = None
|
||||
self._model_desc = None # pointer when using
|
||||
self._output_size = 0
|
||||
self._is_destroyed = False
|
||||
self._init_resource()
|
||||
resource_list.register(self)
|
||||
|
||||
def _init_resource(self):
|
||||
log_info("Init model resource start...")
|
||||
if not os.path.isfile(self._model_path):
|
||||
log_error(
|
||||
"model_path failed, please check. model_path=%s" %
|
||||
self._model_path)
|
||||
return const.FAILED
|
||||
|
||||
self._model_id, ret = acl.mdl.load_from_file(self._model_path)
|
||||
print(self._model_id, ret)
|
||||
utils.check_ret("acl.mdl.load_from_file", ret)
|
||||
self._model_desc = acl.mdl.create_desc()
|
||||
ret = acl.mdl.get_desc(self._model_desc, self._model_id)
|
||||
utils.check_ret("acl.mdl.get_desc", ret)
|
||||
# get outputs num of model
|
||||
self._output_size = acl.mdl.get_num_outputs(self._model_desc)
|
||||
# create output dataset
|
||||
self._gen_output_dataset(self._output_size)
|
||||
# recode input data address,if need malloc memory,the memory will be
|
||||
# reuseable
|
||||
self._init_input_buffer()
|
||||
|
||||
log_info("Init model resource success")
|
||||
|
||||
return const.SUCCESS
|
||||
|
||||
def _gen_output_dataset(self, ouput_num):
|
||||
log_info("[AclLiteModel] create model output dataset:")
|
||||
dataset = acl.mdl.create_dataset()
|
||||
for i in range(ouput_num):
|
||||
# malloc device memory for output
|
||||
size = acl.mdl.get_output_size_by_index(self._model_desc, i)
|
||||
buf, ret = acl.rt.malloc(size, const.ACL_MEM_MALLOC_NORMAL_ONLY)
|
||||
utils.check_ret("acl.rt.malloc", ret)
|
||||
# crate oputput data buffer
|
||||
dataset_buffer = acl.create_data_buffer(buf, size)
|
||||
_, ret = acl.mdl.add_dataset_buffer(dataset, dataset_buffer)
|
||||
log_info("malloc output %d, size %d" % (i, size))
|
||||
if ret:
|
||||
acl.rt.free(buf)
|
||||
acl.destroy_data_buffer(dataset_buffer)
|
||||
utils.check_ret("acl.destroy_data_buffer", ret)
|
||||
self._output_dataset = dataset
|
||||
log_info("Create model output dataset success")
|
||||
|
||||
def _init_input_buffer(self):
|
||||
self._input_num = acl.mdl.get_num_inputs(self._model_desc)
|
||||
for i in range(self._input_num):
|
||||
item = {"addr": None, "size": 0}
|
||||
self._input_buffer.append(item)
|
||||
|
||||
def _gen_input_dataset(self, input_list):
|
||||
ret = const.SUCCESS
|
||||
if len(input_list) != self._input_num:
|
||||
log_error("Current input data num %d unequal to model "
|
||||
"input num %d" % (len(input_list), self._input_num))
|
||||
return const.FAILED
|
||||
|
||||
self._input_dataset = acl.mdl.create_dataset()
|
||||
for i in range(self._input_num):
|
||||
item = input_list[i]
|
||||
data, size = self._parse_input_data(item, i)
|
||||
if (data is None) or (size == 0):
|
||||
ret = const.FAILED
|
||||
log_error("The %d input is invalid" % (i))
|
||||
break
|
||||
|
||||
model_size = acl.mdl.get_input_size_by_index(self._model_desc, i)
|
||||
if size != model_size:
|
||||
log_warning(" Input[%d] size: %d not equal om size: %d" % (i, size, model_size) +\
|
||||
", may cause inference result error, please check model input")
|
||||
|
||||
|
||||
dataset_buffer = acl.create_data_buffer(data, size)
|
||||
_, ret = acl.mdl.add_dataset_buffer(self._input_dataset,
|
||||
dataset_buffer)
|
||||
if ret:
|
||||
log_error("Add input dataset buffer failed")
|
||||
acl.destroy_data_buffer(self._input_dataset)
|
||||
ret = const.FAILED
|
||||
break
|
||||
if ret == const.FAILED:
|
||||
self._release_dataset(self._input_dataset)
|
||||
self._input_dataset = None
|
||||
|
||||
return ret
|
||||
|
||||
def _parse_input_data(self, input_data, index):
|
||||
data = None
|
||||
size = 0
|
||||
if isinstance(input_data, np.ndarray):
|
||||
ptr = acl.util.numpy_to_ptr(input_data)
|
||||
size = input_data.size * input_data.itemsize
|
||||
data = self._copy_input_to_device(ptr, size, index)
|
||||
if data is None:
|
||||
size = 0
|
||||
log_error("Copy input to device failed")
|
||||
elif (isinstance(input_data, dict) and
|
||||
('data' in input_data.keys()) and ('size' in input_data.keys())):
|
||||
size = input_data['size']
|
||||
data = input_data['data']
|
||||
else:
|
||||
log_error("Unsupport input")
|
||||
|
||||
return data, size
|
||||
|
||||
def _copy_input_to_device(self, input_ptr, size, index):
|
||||
buffer_item = self._input_buffer[index]
|
||||
data = None
|
||||
if buffer_item['addr'] is None:
|
||||
if self._run_mode == const.ACL_HOST:
|
||||
data = utils.copy_data_host_to_device(input_ptr, size)
|
||||
else:
|
||||
data = utils.copy_data_device_to_device(input_ptr, size)
|
||||
if data is None:
|
||||
log_error("Malloc memory and copy model %dth "
|
||||
"input to device failed" % (index))
|
||||
return None
|
||||
buffer_item['addr'] = data
|
||||
buffer_item['size'] = size
|
||||
elif size == buffer_item['size']:
|
||||
if self._run_mode == const.ACL_HOST:
|
||||
ret = acl.rt.memcpy(buffer_item['addr'], size,
|
||||
input_ptr, size,
|
||||
const.ACL_MEMCPY_HOST_TO_DEVICE)
|
||||
else:
|
||||
ret = acl.rt.memcpy(buffer_item['addr'], size,
|
||||
input_ptr, size,
|
||||
const.ACL_MEMCPY_DEVICE_TO_DEVICE)
|
||||
if ret != const.ACL_SUCCESS:
|
||||
log_error("Copy model %dth input to device failed" % (index))
|
||||
return None
|
||||
data = buffer_item['addr']
|
||||
else:
|
||||
log_error("The model %dth input size %d is change,"
|
||||
" before is %d" % (index, size, buffer_item['size']))
|
||||
return None
|
||||
|
||||
return data
|
||||
|
||||
def execute(self, input_list):
|
||||
"""
|
||||
inference input data
|
||||
Args:
|
||||
input_list: input data list, support AclLiteImage,
|
||||
numpy array and {'data': ,'size':} dict
|
||||
returns:
|
||||
inference result data, which is a numpy array list,
|
||||
each corresponse to a model output
|
||||
"""
|
||||
ret = self._gen_input_dataset(input_list)
|
||||
if ret == const.FAILED:
|
||||
log_error("Gen model input dataset failed")
|
||||
return None
|
||||
|
||||
ret = acl.mdl.execute(self._model_id,
|
||||
self._input_dataset,
|
||||
self._output_dataset)
|
||||
if ret != const.ACL_SUCCESS:
|
||||
log_error("Execute model failed for acl.mdl.execute error ", ret)
|
||||
return None
|
||||
|
||||
self._release_dataset(self._input_dataset)
|
||||
self._input_dataset = None
|
||||
|
||||
return self._output_dataset_to_numpy()
|
||||
|
||||
def _output_dataset_to_numpy(self):
|
||||
dataset = []
|
||||
output_tensor_list = self._gen_output_tensor()
|
||||
num = acl.mdl.get_dataset_num_buffers(self._output_dataset)
|
||||
|
||||
for i in range(num):
|
||||
buf = acl.mdl.get_dataset_buffer(self._output_dataset, i)
|
||||
data = acl.get_data_buffer_addr(buf)
|
||||
size = int(acl.get_data_buffer_size(buf))
|
||||
output_ptr = output_tensor_list[i]["ptr"]
|
||||
output_tensor = output_tensor_list[i]["tensor"]
|
||||
ret = acl.rt.memcpy(output_ptr,
|
||||
output_tensor.size * output_tensor.itemsize,
|
||||
data, size, self._copy_policy)
|
||||
if ret != const.ACL_SUCCESS:
|
||||
log_error("Memcpy inference output to local failed")
|
||||
return None
|
||||
|
||||
dataset.append(output_tensor)
|
||||
|
||||
return dataset
|
||||
|
||||
def _gen_output_tensor(self):
|
||||
output_tensor_list = []
|
||||
for i in range(self._output_size):
|
||||
dims = acl.mdl.get_output_dims(self._model_desc, i)
|
||||
shape = tuple(dims[0]["dims"])
|
||||
datatype = acl.mdl.get_output_data_type(self._model_desc, i)
|
||||
size = acl.mdl.get_output_size_by_index(self._model_desc, i)
|
||||
|
||||
if datatype == const.ACL_FLOAT:
|
||||
np_type = np.float32
|
||||
output_tensor = np.zeros(
|
||||
size // 4, dtype=np_type).reshape(shape)
|
||||
elif datatype == const.ACL_INT32:
|
||||
np_type = np.int32
|
||||
output_tensor = np.zeros(
|
||||
size // 4, dtype=np_type).reshape(shape)
|
||||
elif datatype == const.ACL_UINT32:
|
||||
np_type = np.uint32
|
||||
output_tensor = np.zeros(
|
||||
size // 4, dtype=np_type).reshape(shape)
|
||||
elif datatype == const.ACL_FLOAT16:
|
||||
np_type = np.float16
|
||||
output_tensor = np.zeros(
|
||||
size // 2, dtype=np_type).reshape(shape)
|
||||
elif datatype == const.ACL_BOOL or datatype == const.ACL_UINT8:
|
||||
np_type = np.uint8
|
||||
output_tensor = np.zeros(
|
||||
size, dtype=np_type).reshape(shape)
|
||||
else:
|
||||
print("Unspport model output datatype ", datatype)
|
||||
return None
|
||||
|
||||
if not output_tensor.flags['C_CONTIGUOUS']:
|
||||
output_tensor = np.ascontiguousarray(output_tensor)
|
||||
|
||||
tensor_ptr = acl.util.numpy_to_ptr(output_tensor)
|
||||
output_tensor_list.append({"ptr": tensor_ptr,
|
||||
"tensor": output_tensor})
|
||||
|
||||
return output_tensor_list
|
||||
|
||||
def _release_dataset(self, dataset, free_memory=False):
|
||||
if not dataset:
|
||||
return
|
||||
|
||||
num = acl.mdl.get_dataset_num_buffers(dataset)
|
||||
for i in range(num):
|
||||
data_buf = acl.mdl.get_dataset_buffer(dataset, i)
|
||||
if data_buf:
|
||||
self._release_databuffer(data_buf, free_memory)
|
||||
|
||||
ret = acl.mdl.destroy_dataset(dataset)
|
||||
if ret != const.ACL_SUCCESS:
|
||||
log_error("Destroy data buffer error ", ret)
|
||||
|
||||
def _release_databuffer(self, data_buffer, free_memory=False):
|
||||
if free_memory:
|
||||
data_addr = acl.get_data_buffer_addr(data_buffer)
|
||||
if data_addr:
|
||||
acl.rt.free(data_addr)
|
||||
|
||||
ret = acl.destroy_data_buffer(data_buffer)
|
||||
if ret != const.ACL_SUCCESS:
|
||||
log_error("Destroy data buffer error ", ret)
|
||||
|
||||
def destroy(self):
|
||||
"""
|
||||
release resource of model inference
|
||||
Args:
|
||||
null
|
||||
Returns:
|
||||
null
|
||||
"""
|
||||
if self._is_destroyed:
|
||||
return
|
||||
|
||||
self._release_dataset(self._output_dataset, free_memory=True)
|
||||
if self._model_id:
|
||||
ret = acl.mdl.unload(self._model_id)
|
||||
if ret != const.ACL_SUCCESS:
|
||||
log_info("acl.mdl.unload error:", ret)
|
||||
|
||||
if self._model_desc:
|
||||
ret = acl.mdl.destroy_desc(self._model_desc)
|
||||
if ret != const.ACL_SUCCESS:
|
||||
log_info("acl.mdl.destroy_desc error:", ret)
|
||||
|
||||
self._is_destroyed = True
|
||||
resource_list.unregister(self)
|
||||
log_info("AclLiteModel release source success")
|
||||
|
||||
def __del__(self):
|
||||
self.destroy()
|
||||
|
||||
'''
|
||||
# 初始化模型
|
||||
model_path = './model/model.om'
|
||||
acl_resource = AclLiteResource()
|
||||
acl_resource.init()
|
||||
model = AclLiteModel(model_path)
|
||||
data = np.load('./data/data.npy').astype(np.float32)
|
||||
x = data[:, 0:8].copy()
|
||||
ptr = acl.util.numpy_to_ptr(x)
|
||||
y = data[:, -1]
|
||||
pred = model.execute([x])[0][:, 0]
|
||||
mse = mean_squared_error(y, pred)
|
||||
r2 = r2_score(y, pred)
|
||||
print("---------")
|
||||
print(f"mse = {mse}")
|
||||
print(f"r2 = {r2}")
|
||||
'''
|
Loading…
Reference in New Issue