diff --git a/compressible_flow/NICFD_nozzle/DataDriven/Generate_Dataset.py b/compressible_flow/NICFD_nozzle/DataDriven/Generate_Dataset.py new file mode 100644 index 0000000..c8549a1 --- /dev/null +++ b/compressible_flow/NICFD_nozzle/DataDriven/Generate_Dataset.py @@ -0,0 +1,141 @@ +#!/usr/bin/env python + +## \file Generate_Dataset.py +# \brief Example python script for generating training data for +# data-driven fluid model in SU2 +# \author E.C.Bunschoten +# \version 7.5.1 "Blackbird" +# +# SU2 Project Website: https://su2code.github.io +# +# The SU2 Project is maintained by the SU2 Foundation +# (http://su2foundation.org) +# +# Copyright 2012-2023, SU2 Contributors (cf. AUTHORS.md) +# +# SU2 is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# SU2 is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with SU2. If not, see . + +# make print(*args) function available in PY2.6+, does'nt work on PY < 2.6 + +import CoolProp +import numpy as np +from tqdm import tqdm +import csv + +# Name of the fluid in the CoolProp library. +fluidName = 'Air' + +# Type of equation of state to be used by CoolProp. +CP_eos = "HEOS" + +# Minimum and maximum dataset temperatures [K]. +T_min = 280 +T_max = 1000 + +# Minimum and maximum dataset pressures [Pa]. +P_min = 5e4 +P_max = 2e6 + +# Number of data points along each axis. +Np_grid = 500 + +# Fraction of data points to be used as training data for MLP training (0-1). +f_train = 0.8 + +# Fraction of data poins to be used as test data for MLP validation (0-1). +f_test = 0.1 + + +# Prepare data grid +T_range = np.linspace(T_min, T_max, Np_grid) +P_range = np.linspace(P_min, P_max, Np_grid) + +T_grid, P_grid = np.meshgrid(T_range, P_range) + +T_dataset = T_grid.flatten() +P_dataset = P_grid.flatten() + +density_dataset = np.zeros(np.shape(T_dataset)) +energy_dataset = np.zeros(np.shape(T_dataset)) +s_dataset = np.zeros(np.shape(T_dataset)) +dsde_dataset = np.zeros(np.shape(T_dataset)) +dsdrho_dataset = np.zeros(np.shape(T_dataset)) +d2sde2_dataset = np.zeros(np.shape(T_dataset)) +d2sdedrho_dataset = np.zeros(np.shape(T_dataset)) +d2sdrho2_dataset = np.zeros(np.shape(T_dataset)) + +# Evaluate CoolProp on data grid. +fluid = CoolProp.AbstractState(CP_eos, fluidName) +idx_failed_below = [] +idx_failed_above = [] +print("Generating CoolProp data set...") +for i in tqdm(range(len(T_dataset))): + try: + fluid.update(CoolProp.PT_INPUTS, P_dataset[i], T_dataset[i]) + + density_dataset[i] = fluid.rhomass() + energy_dataset[i] = fluid.umass() + s_dataset[i] = fluid.smass() + dsde_dataset[i] = fluid.first_partial_deriv(CoolProp.iSmass, CoolProp.iUmass, CoolProp.iDmass) + dsdrho_dataset[i] = fluid.first_partial_deriv(CoolProp.iSmass, CoolProp.iDmass, CoolProp.iUmass) + d2sde2_dataset[i] = fluid.second_partial_deriv(CoolProp.iSmass, CoolProp.iUmass, CoolProp.iDmass, CoolProp.iUmass, CoolProp.iDmass) + d2sdedrho_dataset[i] = fluid.second_partial_deriv(CoolProp.iSmass, CoolProp.iUmass, CoolProp.iDmass, CoolProp.iDmass, CoolProp.iUmass) + d2sdrho2_dataset[i] = fluid.second_partial_deriv(CoolProp.iSmass, CoolProp.iDmass, CoolProp.iUmass, CoolProp.iDmass, CoolProp.iUmass) + except: + idx_failed_below.append(i) + print("CoolProp failed at temperature "+str(T_dataset[i]) + ", pressure "+str(P_dataset[i])) +print("Done!") + +# Collect all data arrays and fill in failed data points. +collected_data = np.vstack([density_dataset, + energy_dataset, + s_dataset, + dsde_dataset, + dsdrho_dataset, + d2sde2_dataset, + d2sdedrho_dataset, + d2sdrho2_dataset]).T +for i_failed in idx_failed_below: + collected_data[i_failed, :] = 0.5*(collected_data[i_failed+1, :] + collected_data[i_failed-1, :]) + +# Shuffle data set and extract training, validation, and test data. +np.random.shuffle(collected_data) +np_train = int(f_train*len(density_dataset)) +np_val = int(f_test*len(density_dataset)) +np_test = len(density_dataset) - np_train - np_val + +train_data = collected_data[:np_train, :] +dev_data = collected_data[np_train:(np_train+np_val), :] +test_data = collected_data[(np_train+np_val):, :] + +# Write output files. +with open(fluidName + "_dataset_full.csv", "w+") as fid: + fid.write("Density,Energy,s,dsde_rho,dsdrho_e,d2sde2,d2sdedrho,d2sdrho2\n") + csvWriter = csv.writer(fid,delimiter=',') + csvWriter.writerows(collected_data) + +with open(fluidName + "_dataset_train.csv", "w+") as fid: + fid.write("Density,Energy,s,dsde_rho,dsdrho_e,d2sde2,d2sdedrho,d2sdrho2\n") + csvWriter = csv.writer(fid,delimiter=',') + csvWriter.writerows(train_data) + +with open(fluidName + "_dataset_dev.csv", "w+") as fid: + fid.write("Density,Energy,s,dsde_rho,dsdrho_e,d2sde2,d2sdedrho,d2sdrho2\n") + csvWriter = csv.writer(fid,delimiter=',') + csvWriter.writerows(dev_data) + +with open(fluidName + "_dataset_test.csv", "w+") as fid: + fid.write("Density,Energy,s,dsde_rho,dsdrho_e,d2sde2,d2sdedrho,d2sdrho2\n") + csvWriter = csv.writer(fid,delimiter=',') + csvWriter.writerows(test_data) \ No newline at end of file diff --git a/compressible_flow/NICFD_nozzle/DataDriven/LUTWriter.m b/compressible_flow/NICFD_nozzle/DataDriven/LUTWriter.m new file mode 100644 index 0000000..591f14b --- /dev/null +++ b/compressible_flow/NICFD_nozzle/DataDriven/LUTWriter.m @@ -0,0 +1,131 @@ +%!/usr/bin/env matlab + +%% \file LUTWriter.m +% \brief Example MATLAB script for generating a look-up table file +% compatible with the CDataDriven_Fluid class in SU2. +% \author E.C.Bunschoten +% \version 7.5.1 "Blackbird" +% +% SU2 Project Website: https://su2code.github.io +% +% The SU2 Project is maintained by the SU2 Foundation +% (http://su2foundation.org) +% +% Copyright 2012-2023, SU2 Contributors (cf. AUTHORS.md) +% +% SU2 is free software; you can redistribute it and/or +% modify it under the terms of the GNU Lesser General Public +% License as published by the Free Software Foundation; either +% version 2.1 of the License, or (at your option) any later version. +% +% SU2 is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +% Lesser General Public License for more details. +% +% You should have received a copy of the GNU Lesser General Public +% License along with SU2. If not, see . + +% make print(*args) function available in PY2.6+, does'nt work on PY < 2.6 + +% CoolProp input data file. +input_datafile = "Air_dataset_full.csv"; + +% Data point frequency (the larger, the coarser the table). +data_freq = 2; + +% LUT output file name. +output_LUTfile = "reftable.drg"; + +%% provide import data file +% space delimited +data_ref = importdata(input_datafile); + +% Identify data entries +rho = data_ref.data(1:data_freq:end, 1); +e = data_ref.data(1:data_freq:end, 2); +s = data_ref.data(1:data_freq:end, 3); +ds_de = data_ref.data(1:data_freq:end, 4); +ds_drho = data_ref.data(1:data_freq:end, 5); +d2s_de2 = data_ref.data(1:data_freq:end, 6); +d2s_dedrho = data_ref.data(1:data_freq:end, 7); +d2s_drho2 = data_ref.data(1:data_freq:end, 8); + +rho_min = min(rho); +rho_max = max(rho); +e_min = min(e); +e_max = max(e); + +% Normalize density and energy +rho_norm = (rho - rho_min)/(rho_max - rho_min); +e_norm = (e - e_min)/(e_max - e_min); + +%% Define table connectivity +T = delaunayTriangulation(rho_norm, e_norm); + +data_LUT = [rho, e, s, ds_de, ds_drho, d2s_de2, d2s_dedrho, d2s_drho2]; + +[~, boundNodes] = boundaryFacets(alphaShape(rho_norm, e_norm, 0.05)); +hullIDs = find(ismember([rho_norm, e_norm], boundNodes, "rows")); + +%% Write table data to output +fid = fopen(output_LUTfile, 'w+'); + +header = ['Dragon library' newline newline]; + +header = [header '
' newline]; + +header = [header '[Version]' newline '1.0.1' newline newline]; + +header = [header '[Number of points]' newline]; +header = [header sprintf('%3d',length(rho)) newline newline]; + +header = [header '[Number of triangles]' newline]; +header = [header sprintf('%3d',length(T.ConnectivityList)) newline newline]; + +header = [header '[Number of hull points]' newline]; +header = [header sprintf('%3d',length(hullIDs)) newline newline]; + +header = [header '[Number of variables]' newline]; +header = [header sprintf('%3d',8) newline newline]; + +header = [header '[Variable names]' newline]; +header = [header sprintf('1:Density\n2:Energy\n3:s\n4:dsde_rho\n5:dsdrho_e\n6:d2sde2\n7:d2sdedrho\n8:d2sdrho2\n')]; + +header = [header newline '
' newline newline]; +header = [header '']; + +fprintf(fid,'%s', header); +printformat = '\n'; +for iTabVar=1:8 + printformat = [printformat '%.14e\t']; +end +fprintf(fid,printformat,data_LUT'); +fprintf(fid,'%s', newline); +fprintf(fid,'%s', ''); + +fprintf(fid,'%s', newline); +fprintf(fid,'%s', newline); +fprintf(fid,'%s', ''); + +printformat = ['\n' '%5i\t' '%5i\t' '%5i\t']; + +fprintf(fid,printformat,T.ConnectivityList'); + +fprintf(fid,'%s', newline); +fprintf(fid,'%s', ''); + +%% print hull block +fprintf(fid,'%s', newline); +fprintf(fid,'%s', newline); +fprintf(fid,'%s', ''); + +printformat = ['\n' '%5i\t']; + +fprintf(fid,printformat,hullIDs); + +fprintf(fid,'%s', newline); +fprintf(fid,'%s', ''); + +%% close .dat file +fclose(fid); \ No newline at end of file diff --git a/compressible_flow/NICFD_nozzle/DataDriven/MLPTrainer.py b/compressible_flow/NICFD_nozzle/DataDriven/MLPTrainer.py new file mode 100644 index 0000000..4acd861 --- /dev/null +++ b/compressible_flow/NICFD_nozzle/DataDriven/MLPTrainer.py @@ -0,0 +1,476 @@ +#!/usr/bin/env python + +## \file Generate_Dataset.py +# \brief Example python script for training an MLP and writing an MLP +# input file formatted for the CDataDriven fluid model in SU2. +# \author E.C.Bunschoten +# \version 7.5.1 "Blackbird" +# +# SU2 Project Website: https://su2code.github.io +# +# The SU2 Project is maintained by the SU2 Foundation +# (http://su2foundation.org) +# +# Copyright 2012-2023, SU2 Contributors (cf. AUTHORS.md) +# +# SU2 is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# SU2 is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with SU2. If not, see . + +# make print(*args) function available in PY2.6+, does'nt work on PY < 2.6 + +seed_value = 2 +import os +from re import L +os.environ['PYTHONASHSEED'] = str(seed_value) +seed_value += 1 +import random +random.seed(seed_value) +seed_value += 1 +import numpy as np +np.random.seed(seed_value) +seed_value += 1 +import tensorflow as tf +tf.random.set_seed(seed_value) +config = tf.compat.v1.ConfigProto() +config.gpu_options.allow_growth = True +import time +from tensorflow import keras +import sys +import pickle +import matplotlib.pyplot as plt + +class Train_Flamelet_MLP: + # Description: + # Construct, train, and save an artificial neural network for data-driven NICFD simulations in SU2 + # + + # Training parameters: + n_epochs = 250 # Number of epochs to train for + alpha_expo = -3.0 # Alpha training exponent parameter + lr_decay = 1.0 # Learning rate decay parameter + batch_size = 10 # Mini-batch size exponent + + # Activation function options + activation_functions = [["relu"], + ["elu"], + ["selu"], + ["gelu"], + ["elu", "tanh"], + ["elu", "sigmoid"], + ["tanh"], + ["sigmoid"], + ["swish"]] + + i_activation_function = 0 # Activation function index + + hidden_layers = [] # Hidden layer architecture + train_name = "" + + # Hardware info: + kind_device = "CPU" # Device type used to train (CPU or GPU) + device_index = 0 # Device index (node index or GPU card index) + + # Controlling variables + controlling_vars = ["Density", + "Energy"] + + # Variable names to train for + train_vars = [] + + # Input data files: + Full_file = "" # Full data set file name + Train_file = "" # Train data set file name + Test_file = "" # Test data set file name + Val_file = "" # Validation data set file name + + save_dir = "/" # Directory to save trained network information to + + def __init__(self, kind_train): + + # Set train variables based on what kind of network is trained + self.train_name = kind_train + self.train_vars = ['s','dsde_rho','dsdrho_e','d2sde2','d2sdedrho','d2sdrho2'] + + # Setters/Getters: + def SetNEpochs(self, n_input): + self.n_epochs = n_input + def SetActivationIndex(self, i_input): + self.i_activation_function = i_input + def SetFullInputFile(self, input_file): + self.Full_file = input_file + def SetTrainInputFile(self, input_file): + self.Train_file = input_file + def SetTestInputFile(self, input_file): + self.Test_file = input_file + def SetValInputFile(self, input_file): + self.Val_file = input_file + def SetSaveDir(self, input_dir): + self.save_dir = input_dir + def SetDeviceKind(self, kind_device): + self.kind_device = kind_device + def SetDeviceIndex(self, device_index): + self.device_index = device_index + def SetControllingVariables(self, x_vars): + self.controlling_vars = x_vars + def SetLRDecay(self, lr_decay): + self.lr_decay = lr_decay + def SetAlphaExpo(self, alpha_expo): + self.alpha_expo = alpha_expo + def SetBatchSize(self, batch_size): + self.batch_size = batch_size + def SetHiddenLayers(self, hidden_layer_neurons): + self.hidden_layers = hidden_layer_neurons + def SetFreeFlameDir(self, freeflame_dir): + self.freeflame_dir = freeflame_dir + def SetBurnerFlameDir(self, burnerflame_dir): + self.burnerflame_dir = burnerflame_dir + def SetEquilibriumDir(self, equilibrium_dir): + self.equilibrium_dir = equilibrium_dir + def GetTestScore(self): + return self.test_score[0] + def GetTestTime(self): + return self.test_time + + # Obtain controlling variable data and train data from input file for + # a given set of variable names. + def GetReferenceData(self, dataset_file, x_vars, train_variables): + + # Open data file and get variable names from the first line + fid = open(dataset_file, 'r') + line = fid.readline() + fid.close() + line = line.strip() + line_split = line.split(',') + if(line_split[0][0] == '"'): + varnames = [s[1:-1] for s in line_split] + else: + varnames = line_split + + # Get indices of controlling and train variables + iVar_x = [varnames.index(v) for v in x_vars] + iVar_y = [varnames.index(v) for v in train_variables] + + # Retrieve respective data from data set + D = np.loadtxt(dataset_file, delimiter=',', skiprows=1) + X_data = D[:, iVar_x] + Y_data = D[:, iVar_y] + + return X_data, Y_data + + # Obtain and preprocess train, test, and validation data + def GetTrainData(self): + + # Retrieve full, train, test, and validation data + print("Reading train, test, and validation data...") + X_full, Y_full = self.GetReferenceData(self.Full_file, self.controlling_vars, self.train_vars) + self.X_train, self.Y_train = self.GetReferenceData(self.Train_file, self.controlling_vars, self.train_vars) + self.X_test, self.Y_test = self.GetReferenceData(self.Test_file, self.controlling_vars, self.train_vars) + self.X_val, self.Y_val = self.GetReferenceData(self.Val_file, self.controlling_vars, self.train_vars) + print("Done!") + + # Calculate normalization bounds of full data set + self.X_min, self.X_max = np.min(X_full, 0), np.max(X_full, 0) + self.Y_min, self.Y_max = np.min(Y_full, 0), np.max(Y_full, 0) + + # Free up memory + del X_full + del Y_full + + + # Normalize train, test, and validation controlling variables + self.X_train_norm = (self.X_train - self.X_min) / (self.X_max - self.X_min) + self.X_test_norm = (self.X_test - self.X_min) / (self.X_max - self.X_min) + self.X_val_norm = (self.X_val - self.X_min) / (self.X_max - self.X_min) + + # Normalize train, test, and validation data + self.Y_train_norm = (self.Y_train - self.Y_min) / (self.Y_max - self.Y_min) + self.Y_test_norm = (self.Y_test - self.Y_min) / (self.Y_max - self.Y_min) + self.Y_val_norm = (self.Y_val - self.Y_min) / (self.Y_max - self.Y_min) + + # Construct MLP based on architecture information + def DefineMLP(self): + + # Construct MLP on specified device + with tf.device("/"+self.kind_device+":"+str(self.device_index)): + + # Initialize sequential model + self.model = keras.models.Sequential() + self.history = None + + # Retrieve activation function(s) for the hidden layers + activation_functions_in_MLP = self.activation_functions[self.i_activation_function] + + # Add input layer + self.model.add(keras.layers.Dense(self.hidden_layers[0], input_dim=self.X_train.shape[1], activation=activation_functions_in_MLP[0], kernel_initializer='he_uniform')) + + # Add hidden layers + iLayer = 1 + while iLayer < len(self.hidden_layers): + activation_function = activation_functions_in_MLP[iLayer % len(activation_functions_in_MLP)] + self.model.add(keras.layers.Dense(self.hidden_layers[iLayer], activation=activation_function, kernel_initializer="he_uniform")) + iLayer += 1 + + # Add output layer + self.model.add(keras.layers.Dense(self.Y_train.shape[1], activation='linear')) + + # Define learning rate schedule and optimizer + lr_schedule = keras.optimizers.schedules.ExponentialDecay(10**self.alpha_expo, decay_steps=10000, + decay_rate=self.lr_decay, staircase=False) + opt = keras.optimizers.Adam(learning_rate=lr_schedule, beta_1=0.9, beta_2=0.999, epsilon=1e-8, amsgrad=False) + + # Compile model on device + self.model.compile(optimizer=opt, loss="mean_squared_error", metrics=["mape"]) + self.cp_callback = tf.keras.callbacks.ModelCheckpoint(filepath=self.save_dir, + save_weights_only=True, + verbose=0) + + # Load previously trained MLP (did not try this yet!) + def LoadMLP(self, model_filename): + with tf.device("/"+self.kind_device+":"+str(self.device_index)): + self.model = tf.keras.models.load_model(model_filename, compile=False) + lr_schedule = keras.optimizers.schedules.ExponentialDecay(10**self.alpha_expo, decay_steps=10000, + decay_rate=self.lr_decay, staircase=False) + opt = keras.optimizers.Adam(learning_rate=lr_schedule, beta_1=0.9, beta_2=0.999, epsilon=1e-8, amsgrad=False) + self.model.compile(optimizer=opt, loss="mean_squared_error", metrics=["mape"]) + + # Initialize MLP training + def Train_MLP(self): + with tf.device("/"+self.kind_device+":"+str(self.device_index)): + t_start = time.time() + self.history = self.model.fit(self.X_train_norm, self.Y_train_norm, epochs=self.n_epochs, batch_size=2**self.batch_size, + verbose=2, validation_data=(self.X_val_norm, self.Y_val_norm), shuffle=True,callbacks=[self.cp_callback]) + t_end = time.time() + # Store training time in minutes + self.train_time = (t_end - t_start) / 60 + + # Evaluate test set + def Evaluate_TestSet(self): + with tf.device("/"+self.kind_device+":"+str(self.device_index)): + t_start_test = time.time() + self.test_score = self.model.evaluate(self.X_test_norm, self.Y_test_norm, verbose=0) + t_end_test = time.time() + self.test_time = (t_end_test - t_start_test) + + # Write MLP input file for SU2 simulations + def write_SU2_MLP(self, file_out): + # This function writes the MLP to a format which can be read by the SU2 MLP import tool + # Inputs: + # - file_out: output file name without extension + # - input_names: list of strings with the variable names of the MLP input(s) + # - output names: list of strings with the variable names of the MLP output(s) + # - model: tensorflow.keras.model; the trained model + + # MLP config + model_config = self.model.get_config() + + # Number of input variables in the model + n_inputs = model_config['layers'][0]['config']['batch_input_shape'][1] + # Number of output variables in the model + n_outputs = model_config['layers'][-1]['config']['units'] + + # Checking if number of provided input and output names are equal to those in the model + # if not n_inputs == len(input_names): + # raise Exeption("Number of input names unequal to the number of inputs in the model") + # if not n_outputs == len(output_names): + # raise Exeption("Number of output names unequal to the number of outputs in the model") + + # Opening output file + fid = open(file_out+'.mlp', 'w+') + fid.write("
\n\n") + n_layers = len(model_config['layers']) + + # Writing number of neurons per layer + fid.write('[number of layers]\n%i\n\n' % n_layers) + fid.write('[neurons per layer]\n') + activation_functions = [] + + for iLayer in range(n_layers-1): + layer_class = model_config['layers'][iLayer]['class_name'] + if layer_class == 'InputLayer': + # In case of the input layer, the input shape is written instead of the number of units + activation_functions.append('linear') + n_neurons = model_config['layers'][iLayer]['config']['batch_input_shape'][1] + else: + # try: + # activation_functions.append(model_config['layers'][iLayer]['config']['activation']['config']['activation']) + # except: + activation_functions.append(model_config['layers'][iLayer]['config']['activation'])#['config']['activation']) + #pass + + n_neurons = model_config['layers'][iLayer]['config']['units'] + + fid.write('%i\n' % n_neurons) + fid.write('%i\n' % n_outputs) + + activation_functions.append('linear') + + # Writing the activation function for each layer + fid.write('\n[activation function]\n') + for iLayer in range(n_layers): + fid.write(activation_functions[iLayer] + '\n') + + # Writing the input and output names + fid.write('\n[input names]\n') + for input in self.controlling_vars: + fid.write(input + '\n') + + fid.write('\n[input normalization]\n') + for i in range(len(self.controlling_vars)): + fid.write('%+.16e\t%+.16e\n' % (self.X_min[i], self.X_max[i])) + + fid.write('\n[output names]\n') + for output in self.train_vars: + fid.write(output+'\n') + + fid.write('\n[output normalization]\n') + for i in range(len(self.train_vars)): + fid.write('%+.16e\t%+.16e\n' % (self.Y_min[i], self.Y_max[i])) + + fid.write("\n
\n") + # Writing the weights of each layer + fid.write('\n[weights per layer]\n') + for layer in self.model.layers: + fid.write('\n') + weights = layer.get_weights()[0] + for i in range(np.shape(weights)[0]): + weights_of_neuron = weights[i, :] + for j in range(len(weights_of_neuron)): + fid.write('%+.16e\t' % weights_of_neuron[j]) + fid.write('\n') + fid.write('\n') + + # Writing the biases of each layer + fid.write('\n[biases per layer]\n') + + # Input layer biases are set to zero + fid.write('%+.16e\t%+.16e\t%+.16e\n' % (0.0, 0.0, 0.0)) + + for layer in self.model.layers: + biases = layer.get_weights()[1] + for i in range(len(biases)): + fid.write('%+.16e\t' % biases[i]) + fid.write('\n') + + + fid.close() + + # Write an output file containing relevant training outcomes and network information + def Save_Relevant_Data(self): + + pickle.dump(self.history.history, open(self.save_dir + "/training_history_"+self.train_name, "wb")) + self.model.save(self.save_dir + "/MLP_"+self.train_name) + + fid = open(self.save_dir + "/MLP_"+self.train_name+"_performance.txt", "w+") + fid.write("Training time[minutes]: %+.3e\n" % self.train_time) + fid.write("Validation score: %+.16e\n" % self.test_score[0]) + fid.write("Total neuron count: %i\n" % np.sum(np.array(self.hidden_layers))) + fid.write("Evaluation time[seconds]: %+.3e\n" % (self.test_time)) + fid.write("Alpha exponent: %+.4e\n" % self.alpha_expo) + fid.write("Learning rate decay: %+.4e\n" % self.lr_decay) + fid.write("Batch size exponent: %i\n" % self.batch_size) + fid.write("Activation function index: %i\n" % self.i_activation_function) + fid.write("Number of hidden layers: %i\n" % len(self.hidden_layers)) + fid.write("Architecture: " + " ".join(str(n) for n in self.hidden_layers) + "\n") + fid.close() + + self.write_SU2_MLP(self.save_dir + "/MLP_"+self.train_name) + + # Plot training history trend + def Plot_and_Save_History(self): + History = pickle.load(open(self.save_dir + "/training_history_"+self.train_name, 'rb')) + + fig = plt.figure() + ax = plt.axes() + ax.plot(np.log10(History['loss']), 'b', label='Training score') + ax.plot(np.log10(History['val_loss']), 'r', label="Test score") + ax.plot([0, len(History['loss'])], [np.log10(self.test_score[0]), np.log10(self.test_score[0])], 'm--', label=r"Validation score") + ax.grid() + ax.legend(fontsize=20) + ax.set_xlabel("Iteration[-]", fontsize=20) + ax.set_ylabel("Training loss function [-]", fontsize=20) + ax.set_title(""+self.train_name+" Training History", fontsize=22) + ax.tick_params(axis='both', which='major', labelsize=18) + fig.savefig(self.save_dir + "/History_Plot_"+self.train_name+".png", format='png', bbox_inches='tight') + + # Visualize network architecture + def Plot_Architecture(self): + fig = plt.figure() + plt.plot(np.zeros(len(self.controlling_vars)), np.arange(len(self.controlling_vars)) - 0.5*len(self.controlling_vars), 'bo') + for i in range(len(self.hidden_layers)): + plt.plot((i+1)*np.ones(int(self.hidden_layers[i])), np.arange(int(self.hidden_layers[i])) - 0.5*self.hidden_layers[i], 'ko') + plt.plot((i+2)*np.ones(len(self.train_vars)), np.arange(len(self.train_vars)) - 0.5*len(self.train_vars), 'go') + plt.axis('equal') + fig.savefig(self.save_dir +"/"+self.train_name+"_architecture.png",format='png', bbox_inches='tight') + plt.close(fig) + + +# Define save directory +save_dir = "./" +# Directory containing full, train, test, and validation data +train_data_dir = "./" + +# Hardware to train on (CPU / GPU) +device = "CPU" + +# Hardware device index +device_index = 0 + +# Retrieve training parameters +alpha_expo = -3.1 +lr_decay = 0.99 +batch_size = 6 +i_activation_function = 2 + +# Network hidden layer architecture information (perceptron count per hidden layer) +NN = [15, 20, 10] + +fluidName = "Air" + +# Define MLP trainer object +T = Train_Flamelet_MLP(fluidName) + +# Set training parameters +T.SetNEpochs(350) +T.SetActivationIndex(i_activation_function) +T.SetBatchSize(batch_size) +T.SetLRDecay(lr_decay) +T.SetAlphaExpo(alpha_expo) +T.SetControllingVariables(["Density", "Energy"]) + +# Set train data file names +T.SetFullInputFile(train_data_dir + fluidName + "_dataset_full.csv") +T.SetTrainInputFile(train_data_dir + fluidName + "_dataset_train.csv") +T.SetTestInputFile(train_data_dir + fluidName + "_dataset_test.csv") +T.SetValInputFile(train_data_dir + fluidName + "_dataset_dev.csv") + + +T.SetSaveDir(save_dir) + +T.SetDeviceKind(device) +T.SetHiddenLayers(NN) +T.SetDeviceIndex(device_index) + +# Retrieve relevant data +T.GetTrainData() + +# Compile MLP on device +T.DefineMLP() + +# Start training and evaluate performance +T.Train_MLP() +T.Evaluate_TestSet() + +# Save relevant data and postprocess +T.Save_Relevant_Data() +T.Plot_and_Save_History() +T.Plot_Architecture() diff --git a/compressible_flow/NICFD_nozzle/DataDriven/MLP_Air.mlp b/compressible_flow/NICFD_nozzle/DataDriven/MLP_Air.mlp new file mode 100644 index 0000000..f16fa96 --- /dev/null +++ b/compressible_flow/NICFD_nozzle/DataDriven/MLP_Air.mlp @@ -0,0 +1,108 @@ +
+ +[number of layers] +5 + +[neurons per layer] +2 +15 +20 +10 +6 + +[activation function] +linear +gelu +gelu +gelu +linear + +[input names] +Density +Energy + +[input normalization] ++1.7415915518881592e-01 +2.5111225166498802e+01 ++3.2165306317505747e+05 +8.8539465646401467e+05 + +[output names] +s +dsde_rho +dsdrho_e +d2sde2 +d2sdedrho +d2sdrho2 + +[output normalization] ++2.9463614822899408e+03 +5.3560903213437250e+03 ++9.9999999999999980e-04 +3.5714285714285722e-03 +-1.6484560987282607e+03 -1.1327554484124706e+01 +-1.7789150880939358e-08 -1.1703687702199641e-09 +-3.1439422348520776e-06 -1.0887304013742184e-07 ++4.5412175143804584e-01 +9.4637571910618462e+03 + +
+ +[weights per layer] + ++8.3189833164215088e-01 +2.4360325187444687e-02 +9.7707062959671021e-01 -1.2345232069492340e-02 -2.9215031862258911e-01 -2.9611685276031494e+00 +2.0383414626121521e-01 -9.9647676944732666e-01 -6.6573948860168457e+00 -2.0399811267852783e+00 -4.2854586243629456e-01 -1.0035426616668701e+00 -1.3616700172424316e+01 -1.6206993103027344e+01 -1.6444923877716064e+00 +-3.1028425693511963e-01 -8.0309319496154785e-01 +1.2440043687820435e+00 +6.7310041189193726e-01 +3.3015012741088867e-01 +7.7720489352941513e-03 -2.7469534873962402e+00 +1.0604603290557861e+00 +4.1311588883399963e-01 +4.2180567979812622e-01 -1.7606079578399658e+00 -1.2516785860061646e+00 -1.7313229618594050e-03 +1.8466904759407043e-02 +9.4342261552810669e-01 + + ++1.2671764194965363e-01 -1.8266780376434326e+00 +4.5098075270652771e-01 -4.1970783472061157e-01 +2.2262683138251305e-02 -1.3785655498504639e+00 -2.2929574549198151e-01 +7.0164126157760620e-01 -2.0857352018356323e-01 +1.3381133079528809e+00 -5.4946625232696533e-01 +1.1290591210126877e-01 -2.5393629074096680e-01 +4.3327644467353821e-01 -2.5811696052551270e-01 -5.4948449134826660e-01 +1.9658945798873901e+00 -2.3211978375911713e-01 +7.0470392704010010e-01 +1.0347775369882584e-01 +-4.7119098901748657e-01 -9.4768993556499481e-02 +6.3686430454254150e-01 -2.1410700678825378e-01 +5.0014472007751465e-01 +4.5773684978485107e-01 -3.2236999273300171e-01 +3.9864891767501831e-01 -4.7597566246986389e-01 +2.3050796985626221e+00 +6.6121703386306763e-01 +5.9183914214372635e-02 -7.2147786617279053e-02 +1.5147539973258972e-01 +5.0518357753753662e-01 +1.6456981003284454e-01 +1.4601304531097412e+00 +7.3865301907062531e-02 +8.8795572519302368e-02 +5.1658850908279419e-01 ++2.8539058566093445e-01 -3.3595198392868042e-01 -7.7873903512954712e-01 +4.8598745465278625e-01 +3.2090932130813599e-01 -1.8747586011886597e-01 +2.6564034819602966e-01 -4.5581549406051636e-01 +4.1367557644844055e-01 -1.3443436622619629e+00 -4.0652289986610413e-01 -4.3078523874282837e-01 -6.4736980199813843e-01 +1.4654091000556946e-01 +2.4033172428607941e-01 -5.0277596712112427e-01 -7.5689059495925903e-01 -3.6107480525970459e-01 +7.3940621223300695e-04 -6.6149485111236572e-01 +-1.9496695697307587e-01 +2.8244624845683575e-03 -1.4492729306221008e-01 +3.9252611994743347e-01 -4.3490674346685410e-02 +3.1034186482429504e-01 +7.2382897138595581e-02 -9.4509638845920563e-02 +4.0807878971099854e-01 -1.9424710273742676e+00 -5.5980741977691650e-02 +1.1419963836669922e-01 -1.7739479243755341e-01 -3.7055251002311707e-01 +2.2675377130508423e-01 -4.1521918773651123e-01 +1.2799455225467682e-01 -1.2624530494213104e-01 -1.9770638644695282e-01 -1.9654132425785065e-01 ++4.2571529746055603e-01 +5.8648675680160522e-01 +6.3656000420451164e-03 -3.4227845072746277e-01 -6.8164592981338501e-01 -3.2352665066719055e-01 -1.2425225973129272e-01 -6.4097113907337189e-02 +1.1482629925012589e-01 -8.3119380474090576e-01 +2.9075515270233154e-01 -4.6910610795021057e-01 +4.1692364215850830e-01 -3.8320121169090271e-01 +5.3708368539810181e-01 +1.2222218513488770e-01 +2.9225397109985352e-01 -3.6609309911727905e-01 +3.0321422964334488e-02 -1.8383499979972839e-01 ++1.0946505516767502e-01 +2.3443622887134552e-01 +1.6104626655578613e-01 -4.9523472785949707e-01 -2.0512697100639343e-01 +1.0504413396120071e-01 +5.7075685262680054e-01 -2.1702742576599121e-01 -4.2540195584297180e-01 +3.4554854035377502e-01 -1.2561812996864319e-01 -1.6924200057983398e+00 +8.2237142324447632e-01 -2.2598077356815338e-01 -4.5798552036285400e-01 +1.0085639953613281e+00 -3.2769978046417236e-01 +6.2984257936477661e-01 -3.2380005717277527e-01 +3.2018640637397766e-01 +-5.0133413076400757e-01 +1.7135469913482666e+00 +3.4703001976013184e+00 -4.4624549150466919e-01 -3.4907063841819763e-01 -1.9941161572933197e-01 +3.6381298303604126e-01 +1.0495340824127197e+00 +9.3154743313789368e-02 +1.6024160385131836e+00 +5.9023177623748779e-01 +4.4321373105049133e-02 +3.2297858595848083e-01 +1.0061268806457520e+00 +4.0516072511672974e-01 +1.5158954262733459e-01 +3.1624364852905273e-01 +2.3541492223739624e-01 -8.2202929258346558e-01 +8.9111083745956421e-01 +-1.3641531765460968e-01 +2.4177990853786469e-01 -3.7618672847747803e-01 -3.4604027867317200e-01 -5.3753757476806641e-01 -2.6926660537719727e-01 -2.2961834073066711e-01 +3.2282969355583191e-01 -3.8071197271347046e-01 -6.6386234760284424e-01 +5.2901147864758968e-03 +4.2451430112123489e-02 -3.4727483987808228e-01 -4.1438218951225281e-01 +7.3989324271678925e-02 -3.1189326196908951e-02 -4.8651853203773499e-01 -1.7309622466564178e-01 +1.8827030062675476e-01 +3.7244164943695068e-01 +-1.1871234327554703e-01 +7.9447120428085327e-02 -2.2181269526481628e-01 -1.0935883969068527e-01 +5.6829992681741714e-02 +8.9580744504928589e-02 +2.0029288530349731e-01 +5.5052900314331055e-01 -1.9459363818168640e-01 -2.0172870159149170e-01 +3.7621203064918518e-01 +4.7160428762435913e-01 -1.0610114336013794e+00 -1.6349175572395325e-01 -7.8070771694183350e-01 +9.5123392343521118e-01 -1.2587261199951172e-01 -2.0239561796188354e-01 +2.6128085330128670e-02 +8.6509060859680176e-01 +-6.6607564687728882e-01 +6.8815660476684570e-01 -1.2259326875209808e-01 -4.1641753911972046e-01 -1.6845415532588959e-01 +6.2125480175018311e-01 +5.1497584581375122e-01 +6.7546433210372925e-01 +4.2517700791358948e-01 +2.3134332895278931e-01 +8.4953106939792633e-02 +2.6244616508483887e-01 +6.2022322416305542e-01 +1.8996278941631317e-01 +3.2571993768215179e-02 +2.9725074768066406e-01 -5.6376576423645020e-01 +7.1910697221755981e-01 -7.3800019919872284e-02 +8.7421797215938568e-02 ++1.9196066260337830e-01 -2.5707763433456421e-01 +1.2028281688690186e+00 -4.9794372916221619e-01 -5.7221579551696777e-01 -1.6068166494369507e-01 -3.0058667063713074e-01 +4.0411502122879028e-01 -6.7706561088562012e-01 +7.9482120275497437e-01 +8.4778390824794769e-02 +3.2887285947799683e-01 +8.1174862384796143e-01 +4.2346477508544922e-01 -2.0472085475921631e-01 +5.0644415616989136e-01 +7.6849955320358276e-01 -9.3665689229965210e-01 -4.8341527581214905e-01 +1.4117115736007690e-01 +-2.9069364070892334e-01 +1.3675889968872070e+00 +7.9628318548202515e-01 +5.5777251720428467e-01 -4.9216035008430481e-01 -3.9364516735076904e-01 +6.2846845388412476e-01 -1.0596232116222382e-01 -4.0042385458946228e-01 +7.2991651296615601e-01 -2.9488256573677063e-01 +4.7022944688796997e-01 +6.7533230781555176e-01 -2.4376918375492096e-01 +4.9040398001670837e-01 -3.0182367190718651e-02 +1.6438471078872681e+00 +1.0786532163619995e+00 +2.6507875323295593e-01 +1.8865522742271423e-01 ++5.8844089508056641e-01 -6.7196071147918701e-01 +4.7722464799880981e-01 +1.4196334779262543e-01 -7.3014509677886963e-01 +1.4272706210613251e-01 +7.0519083738327026e-01 -7.3207497596740723e-01 -5.5828666687011719e-01 +4.7240239381790161e-01 +4.8759069442749023e+00 +3.1473405361175537e+00 -1.6073256731033325e+00 +8.0116525292396545e-02 -7.2653526067733765e-01 +1.3131177425384521e+00 +8.7977267801761627e-02 -4.6832773089408875e-01 -1.3739584386348724e-01 +1.1401559114456177e+00 ++6.1726832389831543e-01 +5.5695962905883789e-01 -4.9429216980934143e-01 +1.6674274206161499e-01 -1.8071268498897552e-01 -6.2956020236015320e-02 +6.8190127611160278e-01 +1.0376520156860352e+00 -4.9343284964561462e-01 -5.1102572679519653e-01 +3.8847734928131104e+00 +3.8089091777801514e+00 +3.7172675132751465e-01 -6.2955417670309544e-03 -1.6707984209060669e+00 +2.5282790660858154e+00 +1.4855794608592987e-01 -2.8840228915214539e-01 -4.1574388742446899e-01 +7.4686273932456970e-02 +-1.9936434924602509e-01 -3.2982286810874939e-01 -4.2284306883811951e-01 -6.0190027952194214e-01 -3.6192491650581360e-02 +1.0197895765304565e-01 -2.5287309661507607e-02 -3.0848196148872375e-01 +4.9089935421943665e-01 -9.8292624950408936e-01 +4.9323087930679321e-01 +3.5580074787139893e-01 +6.6490244865417480e-01 -3.3077242970466614e-01 +5.7284835726022720e-02 +5.3051674365997314e-01 -9.6007549762725830e-01 +7.5076526403427124e-01 +4.6473911404609680e-01 -1.5601371228694916e-01 + + +-3.0170837044715881e-01 +7.6915688812732697e-02 -3.6323380470275879e-01 -8.1987410783767700e-02 +5.8737164735794067e-01 +2.1288475394248962e-01 +1.3999734818935394e-01 -1.4477537944912910e-02 -3.8366195559501648e-01 +2.7628245949745178e-01 +-4.9298065900802612e-01 +7.1744211018085480e-02 -9.1140484809875488e-01 +4.0871703624725342e-01 -7.2638124227523804e-01 +5.1287900656461716e-02 -5.8719980716705322e-01 -2.8210255503654480e-01 +1.2065146863460541e-01 -1.5844403207302094e-01 ++1.5045787394046783e-01 +2.1475519239902496e-01 -2.3714277148246765e-01 +9.0225833654403687e-01 -6.6289794445037842e-01 -2.1841837465763092e-01 +1.1645921468734741e+00 -2.6369076967239380e-01 +1.0150812864303589e+00 -4.3610000610351562e-01 +-3.8243392109870911e-01 +5.2422040700912476e-01 -1.0354539155960083e+00 -2.1356192231178284e-01 -2.7603408694267273e-01 +7.8330852091312408e-02 -4.4389730691909790e-01 +2.3024851083755493e-01 -4.9227750301361084e-01 -3.6274331808090210e-01 +-4.4488561153411865e-01 +1.3431280851364136e-01 -6.8945783376693726e-01 -5.3909307718276978e-01 +5.6848633289337158e-01 +2.5814577937126160e-01 -4.0482479333877563e-01 -1.4690902829170227e-01 +3.8733616471290588e-01 +4.1191309690475464e-01 ++9.5030784606933594e-01 +4.9329441040754318e-02 +6.2590652704238892e-01 -6.0731992125511169e-02 +3.0356884002685547e-01 +8.0745350569486618e-03 +1.0205841064453125e-01 +3.1406331062316895e-01 +4.1173595190048218e-01 -2.1476952731609344e-01 ++1.3379637897014618e-01 +1.5142989158630371e-01 -2.7185001969337463e-01 -3.8880314677953720e-02 -1.4730513095855713e-01 +3.4330704808235168e-01 -4.3363025784492493e-01 +4.7468748688697815e-01 +1.0036426782608032e-01 -3.2720685005187988e-01 +-2.9784267768263817e-02 -4.0209764242172241e-01 +4.3699020147323608e-01 +6.2906965613365173e-02 -3.8217192888259888e-01 -1.6591273248195648e-01 +8.8514155149459839e-01 +2.9556000232696533e-01 +8.5957425832748413e-01 -3.8072612881660461e-01 +-1.6700486838817596e-01 +3.7050578743219376e-02 -4.0714105963706970e-01 -5.5191898345947266e-01 +1.4483349025249481e-01 -8.7701179087162018e-02 -5.1860904693603516e-01 +1.7401486635208130e-01 -3.8173541426658630e-01 -5.2513760328292847e-01 +-4.6101239323616028e-01 -4.8938244581222534e-02 +1.3286030292510986e+00 +3.3797380328178406e-01 -9.2495359480381012e-02 +5.6875848770141602e-01 -1.1768547296524048e+00 -5.4860256612300873e-02 -1.0419830083847046e+00 -6.0084092617034912e-01 +-3.1412798166275024e-01 -2.0672358572483063e-01 +5.5496263504028320e-01 +2.2195336818695068e+00 -1.4060457050800323e-01 +9.1957867145538330e-01 -1.5775939822196960e-01 +4.5764753222465515e-01 +2.8174147009849548e-01 -4.5313954353332520e-02 ++2.9646211862564087e-01 -1.3258739374577999e-02 -2.4994933605194092e-01 +1.6421346664428711e+00 +2.1416942775249481e-01 +2.6032069325447083e-01 +1.9962693750858307e-01 -3.3637472987174988e-01 -2.8390151262283325e-01 +1.3316956162452698e-01 ++4.5846441388130188e-01 -8.6484462022781372e-01 +3.9236262440681458e-01 +2.6110070943832397e-01 -4.3285474181175232e-01 -2.3915094137191772e-01 -1.1928474903106689e-01 +3.4878674149513245e-01 +9.5887236297130585e-02 -2.7723997831344604e-02 +-5.7017827033996582e-01 +4.0155231952667236e-01 -7.1631860733032227e-01 +1.3063825666904449e-01 -5.5929476022720337e-01 -2.8212028741836548e-01 +7.2395575046539307e-01 -4.8445662856101990e-01 +3.5177272558212280e-01 +2.2905287146568298e-01 ++1.0999987833201885e-02 +3.1594970822334290e-01 -5.8221399784088135e-01 -1.1045650243759155e+00 -1.7205716669559479e-01 -5.1228982210159302e-01 +2.8194218873977661e-01 +1.8113629519939423e-01 +2.0927965641021729e-02 +1.5049912035465240e-02 ++6.1268042773008347e-02 -3.2032114267349243e-01 +4.5359694957733154e-01 -4.6679916977882385e-01 +8.8585443794727325e-02 +7.2091686725616455e-01 -1.0289754718542099e-01 -3.5061910748481750e-01 +1.1756399273872375e-01 -5.5597525089979172e-02 ++7.5021207332611084e-02 -7.6903682947158813e-01 +1.3238885439932346e-02 +1.6645556688308716e-01 -1.9177964329719543e-01 +6.3669621944427490e-02 -9.2113125324249268e-01 +9.6912138164043427e-02 -6.0029613971710205e-01 -1.3521659374237061e-01 ++3.3675971627235413e-01 -1.6087009012699127e-01 -1.0906817913055420e+00 +1.0048210620880127e-01 -4.2005112767219543e-01 -1.0576992481946945e-01 +7.1304939687252045e-02 -6.1840909719467163e-01 +9.0885944664478302e-02 -1.9212763011455536e-01 ++4.0743720531463623e-01 +2.9516917467117310e-01 -6.9643086194992065e-01 -4.5082813501358032e-01 +1.9877274334430695e-01 +2.3463843762874603e-01 +1.5944747626781464e-01 -1.6860195994377136e-01 -2.5292521715164185e-01 +2.2777123749256134e-01 +-2.3857752978801727e-01 +3.4513697028160095e-01 +1.8312393128871918e-01 -3.0646869912743568e-02 -6.1918503046035767e-01 -3.0041000247001648e-01 +5.8370064944028854e-02 -4.7104901075363159e-01 -6.0988360643386841e-01 +3.0400118231773376e-01 + + ++9.3217974901199341e-01 -2.2209948301315308e-01 -4.8535454273223877e-01 +2.5663039088249207e-01 +2.6703682541847229e-01 -2.8267901390790939e-02 +-2.5217276811599731e-01 +2.9466016218066216e-02 +5.8569425344467163e-01 +1.0606556385755539e-01 +9.0765081346035004e-02 -2.5554147362709045e-01 ++4.0240854024887085e-01 -1.0234528779983521e-01 -7.5306856632232666e-01 +1.5750269591808319e-01 +2.5551918148994446e-01 -3.1681455671787262e-02 ++5.5021122097969055e-02 -2.4351221509277821e-03 -4.3899568915367126e-01 -1.4826707541942596e-02 -1.0359151288866997e-02 +1.2408523559570312e+00 ++4.3519809842109680e-01 +1.6852436959743500e-01 +3.1545510888099670e-01 +4.3038123846054077e-01 +5.1619994640350342e-01 +8.8630527257919312e-02 +-9.9793449044227600e-02 +9.9180685356259346e-03 -4.5305061340332031e-01 -2.9788592830300331e-02 -6.9941937923431396e-02 +1.1063648462295532e+00 ++8.6284118879120797e-05 +6.4865452051162720e-01 +4.9347317218780518e-01 -9.4013345241546631e-01 -9.8375785350799561e-01 +1.0046683996915817e-01 ++5.4859185218811035e-01 -1.5914392471313477e-01 +1.7106632888317108e-01 +2.4464827775955200e-01 +3.1630045175552368e-01 +3.7722098827362061e-01 +-4.6650316566228867e-02 +7.6701915264129639e-01 -2.1900288760662079e-01 -5.2809679508209229e-01 -6.4607077836990356e-01 +2.2924181818962097e-01 +-9.2180609703063965e-01 +9.0118980407714844e-01 +1.3119752705097198e-01 -5.5733013153076172e-01 -2.3821175098419189e-01 +6.1467997729778290e-02 + + +[biases per layer] ++0.0000000000000000e+00 +0.0000000000000000e+00 +0.0000000000000000e+00 ++2.8398973867297173e-02 -5.2653890103101730e-02 +7.2251282632350922e-02 -1.5008391439914703e-01 -2.4311138689517975e-01 +2.4922281503677368e-02 -2.9253277182579041e-01 -3.8977432250976562e-01 -1.2477821111679077e-01 -2.5386825203895569e-01 +2.3223572969436646e-01 -8.2743084430694580e-01 +1.0815679281949997e-01 +2.2254261374473572e-01 -1.9538600742816925e-01 +-2.4459753185510635e-02 -5.3442329168319702e-01 +5.2759334444999695e-02 -1.0009699314832687e-01 +4.4059060513973236e-02 +5.6026265025138855e-02 -1.1409015953540802e-01 +1.6972656548023224e-01 -1.0456599295139313e-02 -8.6772751808166504e-01 -1.9689893722534180e-01 -3.6817491054534912e-01 -2.4563239514827728e-01 -3.9886855520308018e-03 +3.2684877514839172e-02 +3.1463623046875000e-01 -8.6215591430664062e-01 -4.4767320156097412e-01 -1.4762860536575317e-01 -3.5506153106689453e-01 ++2.4384185671806335e-01 +1.1348700523376465e-01 +7.0070214569568634e-02 -1.3836091756820679e-01 +2.5818932056427002e-01 +4.3969273567199707e-02 +2.3830464482307434e-01 +1.7758463323116302e-01 +1.9545859098434448e-01 -8.2950294017791748e-02 ++2.2509382665157318e-01 +2.7680635452270508e-01 +1.4246858656406403e-01 +2.6635000109672546e-01 +2.1496956050395966e-01 +1.4866390824317932e-01 diff --git a/compressible_flow/NICFD_nozzle/DataDriven/Tensorflow2SU2.py b/compressible_flow/NICFD_nozzle/DataDriven/Tensorflow2SU2.py new file mode 100644 index 0000000..8f02f4a --- /dev/null +++ b/compressible_flow/NICFD_nozzle/DataDriven/Tensorflow2SU2.py @@ -0,0 +1,69 @@ +#!/usr/bin/env python + +## \file Tensroflow2SU2.py +# \brief Example of converting a trained Tensorflow MLP to SU2 .mlp +# format. +# \author E.C.Bunschoten +# \version 7.5.0 "Blackbird" +# +# SU2 Project Website: https://su2code.github.io +# +# The SU2 Project is maintained by the SU2 Foundation +# (http://su2foundation.org) +# +# Copyright 2012-2022, SU2 Contributors (cf. AUTHORS.md) +# +# SU2 is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# SU2 is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with SU2. If not, see . + +import tensorflow as tf +from write_SU2_MLP import * + +# Input names for the SU2 MLP. For the CDataDrivenFluid class, these have to be "Density" and "Energy" +MLP_input_names = ["Density", "Energy"] +# The order of the input names should correspond to that of the trained model inputs. + +# Optional: give minimum and maximum input normalization values. These are required in case the MLP +# was trained on normalized input data. +input_min = [2.81038e-1, 1.79956e5] +input_max = [2.72979e+01, 4.48318e+05] + +# Output names for the SU2 MLP. For the CDataDrivenFluid class, these have to include the following: +MLP_output_names = ["s", # Entropy + "dsde_rho", # First entropy derivative w.r.t static energy + "dsdrho_e", # First entropy derivative w.r.t density + "d2sde2", # Second entropy derivative w.r.t static energy + "d2sdedrho",# Second entropy derivative w.r.t static energy and density + "d2sdrho2"] # Second entropy derivative w.r.t density +# The order of the output names should correspond to that of the trained model outputs. + +# Optional: give minimum and maximum output normalization values. These are required in case the MLP +# was trained on normalized training data. +output_min = [ 5.74729e+03, 1.66861e-03, -1.05632e+03, -2.15459e-08, + -4.20494e-06, 3.96917e-01] + +output_max = [ 7.77852e+03, 4.00000e-03, -1.07148e+01, -3.57370e-09, + -4.93767e-07, 3.75786e+03] + +# Saved Tensorflow model file name, saved with the "model.save" function after training. +Tensorflow_model_file = "MLP_Air" + +# SU2 MLP output file name (wo extension) +SU2_MLP_output_file = "MLP_Air_SU2" + +# Load the MLP trained through Tensorflow +Tensorflow_model = tf.keras.models.load_model(Tensorflow_model_file) + +# Write SU2 MLP input file +write_SU2_MLP(SU2_MLP_output_file, MLP_input_names, MLP_output_names, Tensorflow_model, input_min, input_max, output_min, output_max) + diff --git a/compressible_flow/NICFD_nozzle/DataDriven/datadriven_nozzle.cfg b/compressible_flow/NICFD_nozzle/DataDriven/datadriven_nozzle.cfg new file mode 100644 index 0000000..e534e81 --- /dev/null +++ b/compressible_flow/NICFD_nozzle/DataDriven/datadriven_nozzle.cfg @@ -0,0 +1,139 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% % +% SU2 configuration file % +% Case description: Non-ideal compressible fluid flow in a converging- % +% diverging supersonic nozzle using a multi-layer perceptron % +% for thermodynamic state calculations. % +% Author: Evert Bunschoten % +% Institution: Delft University of Technology % +% Date: 2022.10.8 % +% File Version 7.4.0 Blackbird % +% % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% ------------- DIRECT, ADJOINT, AND LINEARIZED PROBLEM DEFINITION ------------% +SOLVER= RANS +KIND_TURB_MODEL= SST +MATH_PROBLEM= DIRECT +RESTART_SOL= NO +SYSTEM_MEASUREMENTS= SI +% +% -------------------- COMPRESSIBLE FREE-STREAM DEFINITION --------------------% +% +% Mach number (non-dimensional, based on the free-stream values) +MACH_NUMBER= 1E-9 +AOA= 0.0 +SIDESLIP_ANGLE= 0.0 +INIT_OPTION= TD_CONDITIONS +FREESTREAM_OPTION= TEMPERATURE_FS +FREESTREAM_PRESSURE= 1.0e6 +% +% Free-stream temperature (288.15 K, 518.67 R by default) +FREESTREAM_TEMPERATURE= 400.0 +FREESTREAM_DENSITY= 2.0 +REF_DIMENSIONALIZATION= DIMENSIONAL + +% ---- DATADRIVEN FLUID MODEL DEFINITION -------% +% +FLUID_MODEL = DATADRIVEN_FLUID + +% Regression method for data set evaluation (MLP for multi-layer perceptron, +% LUT for look-up table). +INTERPOLATION_METHOD = MLP + +% List of input files defining MLP architecture(s) or LUT geometry. +FILENAMES_INTERPOLATOR = (MLP_Air.mlp) + +% Newton solver relaxation factor for data-driven fluid model. +DATADRIVEN_NEWTON_RELAXATION = 0.99 + +% Initial guess values for density and static energy in data-driven fluid model +% Newton solver functions. +DATADRIVEN_FLUID_INITIAL_DENSITY = 8.8657 +DATADRIVEN_FLUID_INITIAL_ENERGY = 411176.41 + +% --------------------------- VISCOSITY MODEL ---------------------------------% +VISCOSITY_MODEL= CONSTANT_VISCOSITY +MU_CONSTANT= 1.21409E-05 + +% --------------------------- THERMAL CONDUCTIVITY MODEL ----------------------% +CONDUCTIVITY_MODEL= CONSTANT_CONDUCTIVITY +THERMAL_CONDUCTIVITY_CONSTANT= 0.030542828 + +% -------------------- BOUNDARY CONDITION DEFINITION --------------------------% +MARKER_SYM= ( SYMMETRY, WALL ) +MARKER_RIEMANN= ( INFLOW, TOTAL_CONDITIONS_PT, 1.8e6, 500, 1.0, 0.0, 0.0, OUTFLOW, STATIC_PRESSURE, 6e5, 0.0, 0.0, 0.0, 0.0 ) + +% ------------- COMMON PARAMETERS DEFINING THE NUMERICAL METHOD ---------------% +NUM_METHOD_GRAD= GREEN_GAUSS +CFL_NUMBER= 15 +CFL_ADAPT= YES +CFL_ADAPT_PARAM= ( 0.1, 2.0, 10.0, 1000.0 ) +MAX_DELTA_TIME= 1E6 + +% ----------- SLOPE LIMITER AND DISSIPATION SENSOR DEFINITION -----------------% +MUSCL_FLOW= NO +SLOPE_LIMITER_FLOW= NONE +MUSCL_TURB= NO + +% ------------------------ LINEAR SOLVER DEFINITION ---------------------------% +LINEAR_SOLVER= FGMRES +LINEAR_SOLVER_PREC= ILU +LINEAR_SOLVER_ILU_FILL_IN= 0 +LINEAR_SOLVER_ERROR= 1E-6 +LINEAR_SOLVER_ITER= 10 + +% -------------------------- MULTIGRID PARAMETERS -----------------------------% +% +% Multi-grid levels (0 = no multi-grid) +MGLEVEL= 0 + +% -------------------- FLOW NUMERICAL METHOD DEFINITION -----------------------% +CONV_NUM_METHOD_FLOW= ROE +ENTROPY_FIX_COEFF= 0.1 +TIME_DISCRE_FLOW= EULER_IMPLICIT + +% -------------------- TURBULENT NUMERICAL METHOD DEFINITION ------------------% +CONV_NUM_METHOD_TURB= SCALAR_UPWIND +TIME_DISCRE_TURB= EULER_IMPLICIT +CFL_REDUCTION_TURB= 1.0 + +% --------------------------- CONVERGENCE PARAMETERS --------------------------% +% +% Number of total iterations +ITER= 1000 +CONV_RESIDUAL_MINVAL= -24 +CONV_STARTITER= 10 + +% ------------------------- INPUT/OUTPUT INFORMATION --------------------------% +% +% Mesh input file +MESH_FILENAME= ../NICFD_nozzle.su2 +% +% Mesh input file format (SU2, CGNS) +MESH_FORMAT= SU2 +% +% Mesh output file +MESH_OUT_FILENAME= mesh_out.su2 +% +% Restart flow input file +SOLUTION_FILENAME= solution_flow.dat +TABULAR_FORMAT= CSV +% +% Output file convergence history (w/o extension) +CONV_FILENAME= history +% +% Output file restart flow +RESTART_FILENAME= restart_flow.dat +% +% Output file flow (w/o extension) variables +VOLUME_FILENAME= flow +% +% Output file surface flow coefficient (w/o extension) +SURFACE_FILENAME= surface_flow +% +% Writing solution file frequency +OUTPUT_WRT_FREQ= 100 +% +% Screen output +SCREEN_OUTPUT= (INNER_ITER, RMS_DENSITY, RMS_TKE, RMS_DISSIPATION, LIFT, DRAG) diff --git a/compressible_flow/NICFD_nozzle/DataDriven/write_SU2_MLP.py b/compressible_flow/NICFD_nozzle/DataDriven/write_SU2_MLP.py new file mode 100644 index 0000000..902fca5 --- /dev/null +++ b/compressible_flow/NICFD_nozzle/DataDriven/write_SU2_MLP.py @@ -0,0 +1,137 @@ +#!/usr/bin/env python + +## \file write_SU2_MLP.py +# \brief Python script for translating a trained Tensorflow model +# to an SU2 MLP input file. +# \author E.C.Bunschoten +# \version 7.5.0 "Blackbird" +# +# SU2 Project Website: https://su2code.github.io +# +# The SU2 Project is maintained by the SU2 Foundation +# (http://su2foundation.org) +# +# Copyright 2012-2022, SU2 Contributors (cf. AUTHORS.md) +# +# SU2 is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# SU2 is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with SU2. If not, see . + + +def write_SU2_MLP(file_out, input_names, output_names, model, input_min=[], input_max=[], output_min=[], output_max=[]): + # This function writes the MLP to a format which can be read by the SU2 MLP import tool + # Inputs: + # - file_out: output file name without extension + # - input_names: list of strings with the variable names of the MLP input(s) + # - output names: list of strings with the variable names of the MLP output(s) + # - model: tensorflow.keras.model; the trained model + # - input_min: lower normalization values for the input + # - input_max: upper normalization values for the input + # - output_min: lower normalization values for the output + # - output_max: upper normalization values for the output + + # MLP config + model_config = model.get_config() + + # Number of input variables in the model + n_inputs = model_config['layers'][0]['config']['batch_input_shape'][1] + # Number of output variables in the model + n_outputs = model_config['layers'][-1]['config']['units'] + + # Checking if number of provided input and output names are equal to those in the model + if not n_inputs == len(input_names): + raise Exception("Number of provided input names unequal to the number of inputs in the model") + if not n_outputs == len(output_names): + raise Exception("Number of provided output names unequal to the number of outputs in the model") + + if len(input_max) != len(input_min): + raise Exception("Upper and lower input normalizations should have the same length") + if len(output_max) != len(output_min): + raise Exception("Upper and lower output normalizations should have the same length") + + if len(input_max) > 0 and len(input_min) != n_inputs: + raise Exception("Input normalization not provided for all inputs") + + if len(output_max) > 0 and len(output_min) != n_outputs: + raise Exception("Output normalization not provided for all outputs") + + + # Creating output file + fid = open(file_out+'.mlp', 'w+') + fid.write("
\n\n") + n_layers = len(model_config['layers']) + + # Writing number of neurons per layer + fid.write('[number of layers]\n%i\n\n' % n_layers) + fid.write('[neurons per layer]\n') + activation_functions = [] + + for iLayer in range(n_layers-1): + layer_class = model_config['layers'][iLayer]['class_name'] + if layer_class == 'InputLayer': + # In case of the input layer, the input shape is written instead of the number of units + activation_functions.append('linear') + n_neurons = model_config['layers'][iLayer]['config']['batch_input_shape'][1] + else: + activation_functions.append(model_config['layers'][iLayer]['config']['activation']) + n_neurons = model_config['layers'][iLayer]['config']['units'] + + fid.write('%i\n' % n_neurons) + fid.write('%i\n' % n_outputs) + + activation_functions.append('linear') + + # Writing the activation function for each layer + fid.write('\n[activation function]\n') + for iLayer in range(n_layers): + fid.write(activation_functions[iLayer] + '\n') + + # Writing the input and output names + fid.write('\n[input names]\n') + for input in input_names: + fid.write(input + '\n') + + if len(input_min) > 0: + fid.write('\n[input normalization]\n') + for i in range(len(input_names)): + fid.write('%+.16e\t%+.16e\n' % (input_min[i], input_max[i])) + + fid.write('\n[output names]\n') + for output in output_names: + fid.write(output+'\n') + + if len(output_min) > 0: + fid.write('\n[output normalization]\n') + for i in range(len(output_names)): + fid.write('%+.16e\t%+.16e\n' % (output_min[i], output_max[i])) + + fid.write("\n
\n") + # Writing the weights of each layer + fid.write('\n[weights per layer]\n') + for layer in model.layers: + fid.write('\n') + weights = layer.get_weights()[0] + for row in weights: + fid.write("\t".join(f'{w:+.16e}' for w in row) + "\n") + fid.write('\n') + + # Writing the biases of each layer + fid.write('\n[biases per layer]\n') + + # Input layer biases are set to zero + fid.write('%+.16e\t%+.16e\t%+.16e\n' % (0.0, 0.0, 0.0)) + + for layer in model.layers: + biases = layer.get_weights()[1] + fid.write("\t".join([f'{b:+.16e}' for b in biases]) + "\n") + + fid.close() \ No newline at end of file diff --git a/compressible_flow/NICFD_nozzle/NICFD_nozzle.cfg b/compressible_flow/NICFD_nozzle/NICFD_nozzle.cfg index dd28e9d..23c4381 100644 --- a/compressible_flow/NICFD_nozzle/NICFD_nozzle.cfg +++ b/compressible_flow/NICFD_nozzle/NICFD_nozzle.cfg @@ -18,8 +18,9 @@ % POISSON_EQUATION) SOLVER= RANS % -% Specify turbulence model (NONE, SA, SA_NEG, SST, SA_E, SA_COMP, SA_E_COMP) +% Specify turbulence model (NONE, SA, SST) KIND_TURB_MODEL= SST +SST_OPTIONS= V1994m % % Mathematical problem (DIRECT, CONTINUOUS_ADJOINT, DISCRETE_ADJOINT) MATH_PROBLEM= DIRECT diff --git a/compressible_flow/QuickStart/Makefile b/compressible_flow/QuickStart/Makefile new file mode 100644 index 0000000..3f3d1b5 --- /dev/null +++ b/compressible_flow/QuickStart/Makefile @@ -0,0 +1,73 @@ +## \file Makefile +# \brief Makefile for the QuickStart tutorial +# \author F. Poli +# \version 7.5.1 "Blackbird" +# +# SU2 Project Website: https://su2code.github.io +# +# The SU2 Project is maintained by the SU2 Foundation +# (http://su2foundation.org) +# +# Copyright 2023, SU2 Contributors (cf. AUTHORS.md) +# +# SU2 is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# SU2 is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with SU2. If not, see . + +TIME=/usr/bin/time + +all: restart_flow.dat NACA0012_coef_pres.pdf NACA0012_pressure_field.png \ + adj/restart_adj_cd.dat dadj/restart_adj_cd.dat \ + NACA0012_surf_sens.pdf \ + NACA0012_coef_pres.png NACA0012_surf_sens.png + +restart_flow.dat: inv_NACA0012.cfg mesh_NACA0012_inv.su2 + $(TIME) -o su2_cfd_time.out SU2_CFD $< | tee su2_cfd.log + +NACA0012_coef_pres.pdf: NACA0012_coef_pres.tex restart_flow.dat surface_flow.csv + texfot -q lualatex $< + +NACA0012_pressure_field.png: make_field_shots.py restart_flow.dat flow.vtu + python3 make_field_shots.py + +adj/restart_adj_cd.dat: adj/inv_adj_NACA0012.cfg mesh_NACA0012_inv.su2 \ + restart_flow.dat + cd adj \ + && ln -sf ../mesh_NACA0012_inv.su2 ./mesh_NACA0012_inv.su2 \ + && ln -sf ../restart_flow.dat ./solution_flow.dat \ + && $(TIME) -o su2_cfd_adj_time.out \ + SU2_CFD inv_adj_NACA0012.cfg | tee su2_cfd_adj.log + +dadj/restart_adj_cd.dat: dadj/inv_dadj_NACA0012.cfg mesh_NACA0012_inv.su2 \ + restart_flow.dat + cd dadj \ + && ln -sf ../mesh_NACA0012_inv.su2 ./mesh_NACA0012_inv.su2 \ + && ln -sf ../restart_flow.dat ./solution_flow.dat \ + && $(TIME) -o su2_cfd_ad_dadj_time.out \ + SU2_CFD_AD inv_dadj_NACA0012.cfg | tee su2_cfd_ad_dadj.log + +NACA0012_surf_sens.pdf: NACA0012_surf_sens.tex \ + adj/restart_adj_cd.dat dadj/restart_adj_cd.dat \ + adj/surface_adjoint.csv dadj/surface_adjoint.csv + texfot -q lualatex $< + +%.png: %.pdf + convert -density 154x154 $< $@ + +.PHONY: clean +clean: + -rm -f *.log *.aux *.out *adj/*.log *adj/*.out + -rm -f *adj/solution_flow.dat *adj/mesh_NACA0012_inv.su2 + +.PHONY: distclean +distclean: clean + -rm -f *.vtu *.csv *.dat *adj/*.csv *adj/*.dat *.png *.pdf diff --git a/compressible_flow/QuickStart/NACA0012_coef_pres.tex b/compressible_flow/QuickStart/NACA0012_coef_pres.tex new file mode 100644 index 0000000..c0695a4 --- /dev/null +++ b/compressible_flow/QuickStart/NACA0012_coef_pres.tex @@ -0,0 +1,72 @@ +\documentclass[tikz,margin=1pt]{standalone} + +%% \file NACA0012_coef_pres.tex +% \brief LaTeX code for the C_p plot in the QuickStart tutorial +% \author F. Poli +% \version 7.5.1 "Blackbird" +% +% SU2 Project Website: https://su2code.github.io +% +% The SU2 Project is maintained by the SU2 Foundation +% (http://su2foundation.org) +% +% Copyright 2023, SU2 Contributors (cf. AUTHORS.md) +% +% SU2 is free software; you can redistribute it and/or +% modify it under the terms of the GNU Lesser General Public +% License as published by the Free Software Foundation; either +% version 2.1 of the License, or (at your option) any later version. +% +% SU2 is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +% Lesser General Public License for more details. +% +% You should have received a copy of the GNU Lesser General Public +% License along with SU2. If not, see . + +\usepackage{pgfplots} +\pgfplotsset{compat=1.17,trig format plots=rad,tick scale binop=\times, + /pgf/number format/sci generic={mantissa sep=\times,exponent={10^{#1}}}, + /pgf/number format/1000 sep={\,}} +%\usepgfplotslibrary{groupplots} +%\usepgfplotslibrary{patchplots} +\usepackage{pgfplotstable} +\begin{document} + \begin{tikzpicture} + \pagecolor{white} + \begin{axis} + [ + title={Coefficient of pressure for the NACA 0012 airfoil}, + width=108mm, + height=88mm, + xlabel={$x/c$}, + ylabel={$C_p$}, + enlarge x limits=false, + %enlarge y limits=true, + ymin=-1.5,ymax=1.5, + y dir=reverse, + %ymajorgrids=true, + legend cell align=left, + legend pos=south east, + table/col sep=comma, + ] + \addplot%+ + [ + blue!50!black, + thick, + mark=*, + mark size=0.7, + ] + table + [ + x="x", + y="Pressure_Coefficient", + ] + {surface_flow.csv}; + \addlegendentry{SU2} + \end{axis} + \end{tikzpicture} +\end{document} + + diff --git a/compressible_flow/QuickStart/NACA0012_surf_sens.tex b/compressible_flow/QuickStart/NACA0012_surf_sens.tex new file mode 100644 index 0000000..425e3fd --- /dev/null +++ b/compressible_flow/QuickStart/NACA0012_surf_sens.tex @@ -0,0 +1,85 @@ +\documentclass[tikz,margin=1pt]{standalone} + +%% \file NACA0012_surf_sens.tex +% \brief LaTeX code for the sensitivity plot in the QuickStart tutorial +% \author F. Poli +% \version 7.5.1 "Blackbird" +% +% SU2 Project Website: https://su2code.github.io +% +% The SU2 Project is maintained by the SU2 Foundation +% (http://su2foundation.org) +% +% Copyright 2023, SU2 Contributors (cf. AUTHORS.md) +% +% SU2 is free software; you can redistribute it and/or +% modify it under the terms of the GNU Lesser General Public +% License as published by the Free Software Foundation; either +% version 2.1 of the License, or (at your option) any later version. +% +% SU2 is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +% Lesser General Public License for more details. +% +% You should have received a copy of the GNU Lesser General Public +% License along with SU2. If not, see . + +\usepackage{pgfplots} +\pgfplotsset{compat=1.17,trig format plots=rad,tick scale binop=\times, + /pgf/number format/sci generic={mantissa sep=\times,exponent={10^{#1}}}, + /pgf/number format/1000 sep={\,}} +%\usepgfplotslibrary{groupplots} +%\usepgfplotslibrary{patchplots} +\usepackage{pgfplotstable} +\begin{document} + \begin{tikzpicture} + \pagecolor{white} + \begin{axis} + [ + title={Surface sensitivities for the NACA 0012 airfoil}, + width=108mm, + height=88mm, + xlabel={$x/c$}, + ylabel={surface sensitivity}, + enlarge x limits=false, + %enlarge y limits=true, + ymin=-2,ymax=2, + %ymajorgrids=true, + legend cell align=left, + legend pos=south west, + table/col sep=comma, + ] + \addplot%+ + [ + blue!50!black, + thick, + mark=*, + mark size=0.7, + ] + table + [ + x="x", + y="Surface_Sensitivity", + ] + {adj/surface_adjoint.csv}; + \addlegendentry{SU2 continuous adjoint} + \addplot%+ + [ + blue!40!white, + thick, + mark=*, + mark size=0.7, + ] + table + [ + x="x", + y="Surface_Sensitivity", + ] + {dadj/surface_adjoint.csv}; + \addlegendentry{SU2 discrete adjoint} + \end{axis} + \end{tikzpicture} +\end{document} + + diff --git a/compressible_flow/QuickStart/adj/inv_adj_NACA0012.cfg b/compressible_flow/QuickStart/adj/inv_adj_NACA0012.cfg new file mode 100644 index 0000000..575236a --- /dev/null +++ b/compressible_flow/QuickStart/adj/inv_adj_NACA0012.cfg @@ -0,0 +1,135 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% % +% SU2 configuration file % +% Case description: Transonic inviscid flow around a NACA0012 airfoil % +% Author: Thomas D. Economon % +% Institution: Stanford University % +% Date: 2014.06.11 % +% File Version 7.5.1 "Blackbird" % +% % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% ------------- DIRECT, ADJOINT, AND LINEARIZED PROBLEM DEFINITION ------------% + +SOLVER= EULER +MATH_PROBLEM= CONTINUOUS_ADJOINT +RESTART_SOL= NO + +% ----------- COMPRESSIBLE AND INCOMPRESSIBLE FREE-STREAM DEFINITION ----------% + +MACH_NUMBER= 0.8 +AOA= 1.25 +FREESTREAM_PRESSURE= 101325.0 +FREESTREAM_TEMPERATURE= 273.15 + +% -------------- COMPRESSIBLE AND INCOMPRESSIBLE FLUID CONSTANTS --------------% + +GAMMA_VALUE= 1.4 +GAS_CONSTANT= 287.87 + +% ---------------------- REFERENCE VALUE DEFINITION ---------------------------% + +REF_ORIGIN_MOMENT_X = 0.25 +REF_ORIGIN_MOMENT_Y = 0.00 +REF_ORIGIN_MOMENT_Z = 0.00 +REF_LENGTH= 1.0 +REF_AREA= 1.0 +REF_DIMENSIONALIZATION= DIMENSIONAL + +% ----------------------- BOUNDARY CONDITION DEFINITION -----------------------% + +MARKER_EULER= ( airfoil ) +MARKER_FAR= ( farfield ) + +% ------------------------ SURFACES IDENTIFICATION ----------------------------% + +MARKER_PLOTTING = ( airfoil ) +MARKER_MONITORING = ( airfoil ) +MARKER_DESIGNING = ( airfoil ) + +% ------------- COMMON PARAMETERS TO DEFINE THE NUMERICAL METHOD --------------% + +NUM_METHOD_GRAD= WEIGHTED_LEAST_SQUARES +OBJECTIVE_FUNCTION= DRAG +CFL_NUMBER= 1e3 +CFL_ADAPT= NO +CFL_ADAPT_PARAM= ( 0.1, 2.0, 10.0, 1e10 ) +ITER= 250 + +% ------------------------ LINEAR SOLVER DEFINITION ---------------------------% + +LINEAR_SOLVER= FGMRES +LINEAR_SOLVER_PREC= ILU +LINEAR_SOLVER_ERROR= 1E-10 +LINEAR_SOLVER_ITER= 10 + +% -------------------------- MULTIGRID PARAMETERS -----------------------------% + +MGLEVEL= 3 +MGCYCLE= W_CYCLE +MG_PRE_SMOOTH= ( 1, 2, 3, 3 ) +MG_POST_SMOOTH= ( 0, 0, 0, 0 ) +MG_CORRECTION_SMOOTH= ( 0, 0, 0, 0 ) +MG_DAMP_RESTRICTION= 1.0 +MG_DAMP_PROLONGATION= 1.0 + +% -------------------- FLOW NUMERICAL METHOD DEFINITION -----------------------% + +CONV_NUM_METHOD_FLOW= JST +JST_SENSOR_COEFF= ( 0.5, 0.02 ) +TIME_DISCRE_FLOW= EULER_IMPLICIT + +% ---------------- ADJOINT-FLOW NUMERICAL METHOD DEFINITION -------------------% + +CONV_NUM_METHOD_ADJFLOW= JST +CFL_REDUCTION_ADJFLOW= 0.01 +TIME_DISCRE_ADJFLOW= EULER_IMPLICIT + +% ----------------------- DESIGN VARIABLE PARAMETERS --------------------------% + +DV_KIND= HICKS_HENNE +DV_MARKER= ( airfoil ) +DV_PARAM= ( 1, 0.5 ) +DV_VALUE= 0.01 + +% ------------------------ GRID DEFORMATION PARAMETERS ------------------------% + +DEFORM_LINEAR_SOLVER_ITER= 500 +DEFORM_NONLINEAR_ITER= 1 +DEFORM_LINEAR_SOLVER_ERROR= 1E-14 +DEFORM_CONSOLE_OUTPUT= YES +DEFORM_STIFFNESS_TYPE= INVERSE_VOLUME + +% --------------------------- CONVERGENCE PARAMETERS --------------------------% + +CONV_FIELD= RMS_DENSITY +CONV_RESIDUAL_MINVAL= -8 +CONV_STARTITER= 10 +CONV_CAUCHY_ELEMS= 100 +CONV_CAUCHY_EPS= 1E-6 +SCREEN_OUTPUT=(INNER_ITER, WALL_TIME, RMS_RES, LIFT, DRAG, CAUCHY_SENS_PRESS, CAUCHY_DRAG RMS_ADJ_DENSITY RMS_ADJ_ENERGY) + +% ------------------------- INPUT/OUTPUT INFORMATION --------------------------% + +MESH_FILENAME= mesh_NACA0012_inv.su2 +MESH_FORMAT= SU2 +MESH_OUT_FILENAME= mesh_out.su2 +SOLUTION_FILENAME= solution_flow.dat +SOLUTION_ADJ_FILENAME= solution_adj.dat +TABULAR_FORMAT= CSV +CONV_FILENAME= history +RESTART_FILENAME= restart_flow.dat +RESTART_ADJ_FILENAME= restart_adj.dat +VOLUME_FILENAME= flow +VOLUME_ADJ_FILENAME= adjoint +GRAD_OBJFUNC_FILENAME= of_grad.dat +SURFACE_FILENAME= surface_flow +SURFACE_ADJ_FILENAME= surface_adjoint +OUTPUT_WRT_FREQ= 250 +OUTPUT_FILES= (RESTART, SURFACE_CSV) + +% --------------------- OPTIMAL SHAPE DESIGN DEFINITION -----------------------% + +OPT_OBJECTIVE= DRAG * 0.001 +OPT_CONSTRAINT= ( LIFT > 0.328188 ) * 0.001; ( MOMENT_Z > 0.034068 ) * 0.001; ( AIRFOIL_THICKNESS > 0.11 ) * 0.001 +DEFINITION_DV= ( 30, 1.0 | airfoil | 0, 0.05 ); ( 30, 1.0 | airfoil | 0, 0.10 ); ( 30, 1.0 | airfoil | 0, 0.15 ); ( 30, 1.0 | airfoil | 0, 0.20 ); ( 30, 1.0 | airfoil | 0, 0.25 ); ( 30, 1.0 | airfoil | 0, 0.30 ); ( 30, 1.0 | airfoil | 0, 0.35 ); ( 30, 1.0 | airfoil | 0, 0.40 ); ( 30, 1.0 | airfoil | 0, 0.45 ); ( 30, 1.0 | airfoil | 0, 0.50 ); ( 30, 1.0 | airfoil | 0, 0.55 ); ( 30, 1.0 | airfoil | 0, 0.60 ); ( 30, 1.0 | airfoil | 0, 0.65 ); ( 30, 1.0 | airfoil | 0, 0.70 ); ( 30, 1.0 | airfoil | 0, 0.75 ); ( 30, 1.0 | airfoil | 0, 0.80 ); ( 30, 1.0 | airfoil | 0, 0.85 ); ( 30, 1.0 | airfoil | 0, 0.90 ); ( 30, 1.0 | airfoil | 0, 0.95 ); ( 30, 1.0 | airfoil | 1, 0.05 ); ( 30, 1.0 | airfoil | 1, 0.10 ); ( 30, 1.0 | airfoil | 1, 0.15 ); ( 30, 1.0 | airfoil | 1, 0.20 ); ( 30, 1.0 | airfoil | 1, 0.25 ); ( 30, 1.0 | airfoil | 1, 0.30 ); ( 30, 1.0 | airfoil | 1, 0.35 ); ( 30, 1.0 | airfoil | 1, 0.40 ); ( 30, 1.0 | airfoil | 1, 0.45 ); ( 30, 1.0 | airfoil | 1, 0.50 ); ( 30, 1.0 | airfoil | 1, 0.55 ); ( 30, 1.0 | airfoil | 1, 0.60 ); ( 30, 1.0 | airfoil | 1, 0.65 ); ( 30, 1.0 | airfoil | 1, 0.70 ); ( 30, 1.0 | airfoil | 1, 0.75 ); ( 30, 1.0 | airfoil | 1, 0.80 ); ( 30, 1.0 | airfoil | 1, 0.85 ); ( 30, 1.0 | airfoil | 1, 0.90 ); ( 30, 1.0 | airfoil | 1, 0.95 ) diff --git a/compressible_flow/QuickStart/dadj/inv_dadj_NACA0012.cfg b/compressible_flow/QuickStart/dadj/inv_dadj_NACA0012.cfg new file mode 100644 index 0000000..f0f3db2 --- /dev/null +++ b/compressible_flow/QuickStart/dadj/inv_dadj_NACA0012.cfg @@ -0,0 +1,135 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% % +% SU2 configuration file % +% Case description: Transonic inviscid flow around a NACA0012 airfoil % +% Author: Thomas D. Economon % +% Institution: Stanford University % +% Date: 2014.06.11 % +% File Version 7.5.1 "Blackbird" % +% % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% ------------- DIRECT, ADJOINT, AND LINEARIZED PROBLEM DEFINITION ------------% + +SOLVER= EULER +MATH_PROBLEM= DISCRETE_ADJOINT +RESTART_SOL= NO + +% ----------- COMPRESSIBLE AND INCOMPRESSIBLE FREE-STREAM DEFINITION ----------% + +MACH_NUMBER= 0.8 +AOA= 1.25 +FREESTREAM_PRESSURE= 101325.0 +FREESTREAM_TEMPERATURE= 273.15 + +% -------------- COMPRESSIBLE AND INCOMPRESSIBLE FLUID CONSTANTS --------------% + +GAMMA_VALUE= 1.4 +GAS_CONSTANT= 287.87 + +% ---------------------- REFERENCE VALUE DEFINITION ---------------------------% + +REF_ORIGIN_MOMENT_X = 0.25 +REF_ORIGIN_MOMENT_Y = 0.00 +REF_ORIGIN_MOMENT_Z = 0.00 +REF_LENGTH= 1.0 +REF_AREA= 1.0 +REF_DIMENSIONALIZATION= DIMENSIONAL + +% ----------------------- BOUNDARY CONDITION DEFINITION -----------------------% + +MARKER_EULER= ( airfoil ) +MARKER_FAR= ( farfield ) + +% ------------------------ SURFACES IDENTIFICATION ----------------------------% + +MARKER_PLOTTING = ( airfoil ) +MARKER_MONITORING = ( airfoil ) +MARKER_DESIGNING = ( airfoil ) + +% ------------- COMMON PARAMETERS TO DEFINE THE NUMERICAL METHOD --------------% + +NUM_METHOD_GRAD= WEIGHTED_LEAST_SQUARES +OBJECTIVE_FUNCTION= DRAG +CFL_NUMBER= 1e3 +CFL_ADAPT= NO +CFL_ADAPT_PARAM= ( 0.1, 2.0, 10.0, 1e10 ) +ITER= 250 + +% ------------------------ LINEAR SOLVER DEFINITION ---------------------------% + +LINEAR_SOLVER= FGMRES +LINEAR_SOLVER_PREC= ILU +LINEAR_SOLVER_ERROR= 1E-10 +LINEAR_SOLVER_ITER= 10 + +% -------------------------- MULTIGRID PARAMETERS -----------------------------% + +MGLEVEL= 3 +MGCYCLE= W_CYCLE +MG_PRE_SMOOTH= ( 1, 2, 3, 3 ) +MG_POST_SMOOTH= ( 0, 0, 0, 0 ) +MG_CORRECTION_SMOOTH= ( 0, 0, 0, 0 ) +MG_DAMP_RESTRICTION= 1.0 +MG_DAMP_PROLONGATION= 1.0 + +% -------------------- FLOW NUMERICAL METHOD DEFINITION -----------------------% + +CONV_NUM_METHOD_FLOW= JST +JST_SENSOR_COEFF= ( 0.5, 0.02 ) +TIME_DISCRE_FLOW= EULER_IMPLICIT + +% ---------------- ADJOINT-FLOW NUMERICAL METHOD DEFINITION -------------------% + +CONV_NUM_METHOD_ADJFLOW= JST +CFL_REDUCTION_ADJFLOW= 0.01 +TIME_DISCRE_ADJFLOW= EULER_IMPLICIT + +% ----------------------- DESIGN VARIABLE PARAMETERS --------------------------% + +DV_KIND= HICKS_HENNE +DV_MARKER= ( airfoil ) +DV_PARAM= ( 1, 0.5 ) +DV_VALUE= 0.01 + +% ------------------------ GRID DEFORMATION PARAMETERS ------------------------% + +DEFORM_LINEAR_SOLVER_ITER= 500 +DEFORM_NONLINEAR_ITER= 1 +DEFORM_LINEAR_SOLVER_ERROR= 1E-14 +DEFORM_CONSOLE_OUTPUT= YES +DEFORM_STIFFNESS_TYPE= INVERSE_VOLUME + +% --------------------------- CONVERGENCE PARAMETERS --------------------------% + +CONV_FIELD= RMS_DENSITY +CONV_RESIDUAL_MINVAL= -8 +CONV_STARTITER= 10 +CONV_CAUCHY_ELEMS= 100 +CONV_CAUCHY_EPS= 1E-6 +SCREEN_OUTPUT=(INNER_ITER, WALL_TIME, RMS_RES, LIFT, DRAG, CAUCHY_SENS_PRESS, CAUCHY_DRAG RMS_ADJ_DENSITY RMS_ADJ_ENERGY) + +% ------------------------- INPUT/OUTPUT INFORMATION --------------------------% + +MESH_FILENAME= mesh_NACA0012_inv.su2 +MESH_FORMAT= SU2 +MESH_OUT_FILENAME= mesh_out.su2 +SOLUTION_FILENAME= solution_flow.dat +SOLUTION_ADJ_FILENAME= solution_adj.dat +TABULAR_FORMAT= CSV +CONV_FILENAME= history +RESTART_FILENAME= restart_flow.dat +RESTART_ADJ_FILENAME= restart_adj.dat +VOLUME_FILENAME= flow +VOLUME_ADJ_FILENAME= adjoint +GRAD_OBJFUNC_FILENAME= of_grad.dat +SURFACE_FILENAME= surface_flow +SURFACE_ADJ_FILENAME= surface_adjoint +OUTPUT_WRT_FREQ= 250 +OUTPUT_FILES= (RESTART, SURFACE_CSV) + +% --------------------- OPTIMAL SHAPE DESIGN DEFINITION -----------------------% + +OPT_OBJECTIVE= DRAG * 0.001 +OPT_CONSTRAINT= ( LIFT > 0.328188 ) * 0.001; ( MOMENT_Z > 0.034068 ) * 0.001; ( AIRFOIL_THICKNESS > 0.11 ) * 0.001 +DEFINITION_DV= ( 30, 1.0 | airfoil | 0, 0.05 ); ( 30, 1.0 | airfoil | 0, 0.10 ); ( 30, 1.0 | airfoil | 0, 0.15 ); ( 30, 1.0 | airfoil | 0, 0.20 ); ( 30, 1.0 | airfoil | 0, 0.25 ); ( 30, 1.0 | airfoil | 0, 0.30 ); ( 30, 1.0 | airfoil | 0, 0.35 ); ( 30, 1.0 | airfoil | 0, 0.40 ); ( 30, 1.0 | airfoil | 0, 0.45 ); ( 30, 1.0 | airfoil | 0, 0.50 ); ( 30, 1.0 | airfoil | 0, 0.55 ); ( 30, 1.0 | airfoil | 0, 0.60 ); ( 30, 1.0 | airfoil | 0, 0.65 ); ( 30, 1.0 | airfoil | 0, 0.70 ); ( 30, 1.0 | airfoil | 0, 0.75 ); ( 30, 1.0 | airfoil | 0, 0.80 ); ( 30, 1.0 | airfoil | 0, 0.85 ); ( 30, 1.0 | airfoil | 0, 0.90 ); ( 30, 1.0 | airfoil | 0, 0.95 ); ( 30, 1.0 | airfoil | 1, 0.05 ); ( 30, 1.0 | airfoil | 1, 0.10 ); ( 30, 1.0 | airfoil | 1, 0.15 ); ( 30, 1.0 | airfoil | 1, 0.20 ); ( 30, 1.0 | airfoil | 1, 0.25 ); ( 30, 1.0 | airfoil | 1, 0.30 ); ( 30, 1.0 | airfoil | 1, 0.35 ); ( 30, 1.0 | airfoil | 1, 0.40 ); ( 30, 1.0 | airfoil | 1, 0.45 ); ( 30, 1.0 | airfoil | 1, 0.50 ); ( 30, 1.0 | airfoil | 1, 0.55 ); ( 30, 1.0 | airfoil | 1, 0.60 ); ( 30, 1.0 | airfoil | 1, 0.65 ); ( 30, 1.0 | airfoil | 1, 0.70 ); ( 30, 1.0 | airfoil | 1, 0.75 ); ( 30, 1.0 | airfoil | 1, 0.80 ); ( 30, 1.0 | airfoil | 1, 0.85 ); ( 30, 1.0 | airfoil | 1, 0.90 ); ( 30, 1.0 | airfoil | 1, 0.95 ) diff --git a/compressible_flow/QuickStart/make_field_shots.py b/compressible_flow/QuickStart/make_field_shots.py new file mode 100755 index 0000000..52c02dd --- /dev/null +++ b/compressible_flow/QuickStart/make_field_shots.py @@ -0,0 +1,117 @@ +#!/usr/bin/python3 + +## \file make_field_shots.py +# \brief Paraview script for the visualizations in the QuickStart tutorial +# \author F. Poli +# \version 7.5.1 "Blackbird" +# +# SU2 Project Website: https://su2code.github.io +# +# The SU2 Project is maintained by the SU2 Foundation +# (http://su2foundation.org) +# +# Copyright 2023, SU2 Contributors (cf. AUTHORS.md) +# +# SU2 is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# SU2 is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with SU2. If not, see . + +import paraview.simple as pvs + +# load data file +flowdata = pvs.OpenDataFile('flow.vtu') + +# create rendering view +renderview = pvs.GetActiveViewOrCreate('RenderView') +renderview.SetPropertyWithName('UseFXAA', 0) +pvs.SetActiveView(renderview) + +# set 2D mode and camera +renderview.InteractionMode = '2D' +renderview.CameraFocalPoint = [0.4, 0.16, 0.0] +renderview.CameraParallelScale = 1.0 + +# set layout +layout = pvs.GetLayout() +layout.SetSize(820, 620) + +# set quantity to be shown +flowdisplay = pvs.Show() +pvs.ColorBy(flowdisplay, ('POINTS', 'Pressure')) + +# set range and color preset for quantity +pressurelut = pvs.GetColorTransferFunction('Pressure') +pressurelut.RescaleTransferFunction(50000.0, 155000.0) +pressurelut.NumberOfTableValues = 21 +pressurelut.ApplyPreset('Jet', True) + +# enable colorbar legend +flowdisplay.SetScalarBarVisibility(renderview, True) + +# customize colorbar legend +pressurelutbar = pvs.GetScalarBar(pressurelut, renderview) +pressurelutbar.WindowLocation = 'Upper Right Corner' +pressurelutbar.Title = 'Pressure [Pa]' +pressurelutbar.AutomaticLabelFormat = 0 +pressurelutbar.LabelFormat = '%-#.1f' +pressurelutbar.RangeLabelFormat = '%-#.1f' + +# create contours +pressurecontour = pvs.Contour(registrationName='pContour', Input=flowdata) +pressurecontour.ContourBy = ['POINTS', 'Pressure'] +pressurecontour.Isosurfaces = \ + [ 50e3, 55e3, 60e3, 65e3, 70e3, 75e3, 80e3, 85e3, 90e3, 95e3, 100e3, + 105e3, 110e3, 115e3, 120e3, 125e3, 130e3, 135e3, 140e3, 145e3, 150e3, 155e3] +pcontourdisplay = pvs.Show(pressurecontour, renderview, + 'GeometryRepresentation') + +# save screenshot +pvs.SaveScreenshot('NACA0012_pressure_field.png', renderview, + ImageResolution=[665, 500]) + +# hide what we no longer need +pvs.Hide(pressurecontour) +flowdisplay.SetScalarBarVisibility(renderview, False) + +# set quantity to be shown +pvs.ColorBy(flowdisplay, ('POINTS', 'Mach')) + +# set range and color preset for quantity +machlut = pvs.GetColorTransferFunction('Mach') +machlut.RescaleTransferFunction(0.0, 2.0) +machlut.NumberOfTableValues = 20 +machlut.ApplyPreset('Blue Orange (divergent)', True) + +# enable colorbar legend +flowdisplay.SetScalarBarVisibility(renderview, True) + +# customize colorbar legend +machlutbar = pvs.GetScalarBar(machlut, renderview) +machlutbar.WindowLocation = 'Upper Right Corner' +machlutbar.Title = 'Mach number' +machlutbar.AutomaticLabelFormat = 0 +machlutbar.LabelFormat = '%-#.1f' +machlutbar.RangeLabelFormat = '%-#.1f' + +# create contours +machcontour = pvs.Contour(registrationName='mContour', Input=flowdata) +machcontour.ContourBy = ['POINTS', 'Mach'] +machcontour.Isosurfaces = \ + [ 0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, + 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0 ] +mcontourdisplay = pvs.Show(machcontour, renderview, + 'GeometryRepresentation') + +# save screenshot +pvs.SaveScreenshot('NACA0012_mach_field.png', renderview, + ImageResolution=[665, 500]) + diff --git a/compressible_flow/Transitional_Airfoil/Langtry_and_Menter/E387/transitional_SST_LM_model_ConfigFile.cfg b/compressible_flow/Transitional_Airfoil/Langtry_and_Menter/E387/transitional_SST_LM_model_ConfigFile.cfg index 06b538b..7b7357f 100644 --- a/compressible_flow/Transitional_Airfoil/Langtry_and_Menter/E387/transitional_SST_LM_model_ConfigFile.cfg +++ b/compressible_flow/Transitional_Airfoil/Langtry_and_Menter/E387/transitional_SST_LM_model_ConfigFile.cfg @@ -14,6 +14,7 @@ SOLVER= RANS % KIND_TURB_MODEL= SST +SST_OPTIONS= V1994m KIND_TRANS_MODEL= LM FREESTREAM_TURBULENCEINTENSITY= 0.001 % diff --git a/compressible_flow/Transitional_Flat_Plate/Langtry_and_Menter/T3A-/transitional_LM_model_ConfigFile.cfg b/compressible_flow/Transitional_Flat_Plate/Langtry_and_Menter/T3A-/transitional_LM_model_ConfigFile.cfg index 1d86c2e..e1de701 100644 --- a/compressible_flow/Transitional_Flat_Plate/Langtry_and_Menter/T3A-/transitional_LM_model_ConfigFile.cfg +++ b/compressible_flow/Transitional_Flat_Plate/Langtry_and_Menter/T3A-/transitional_LM_model_ConfigFile.cfg @@ -13,7 +13,7 @@ SOLVER= RANS % KIND_TURB_MODEL= SST % -SST_OPTIONS= NONE +SST_OPTIONS= V1994m KIND_TRANS_MODEL= LM % MATH_PROBLEM= DIRECT diff --git a/compressible_flow/Transitional_Flat_Plate/Langtry_and_Menter/T3A/transitional_LM_model_ConfigFile.cfg b/compressible_flow/Transitional_Flat_Plate/Langtry_and_Menter/T3A/transitional_LM_model_ConfigFile.cfg index 8b5a848..eae87d3 100644 --- a/compressible_flow/Transitional_Flat_Plate/Langtry_and_Menter/T3A/transitional_LM_model_ConfigFile.cfg +++ b/compressible_flow/Transitional_Flat_Plate/Langtry_and_Menter/T3A/transitional_LM_model_ConfigFile.cfg @@ -13,7 +13,7 @@ SOLVER= RANS % KIND_TURB_MODEL= SST % -SST_OPTIONS= NONE +SST_OPTIONS= V1994m KIND_TRANS_MODEL= LM % MATH_PROBLEM= DIRECT diff --git a/compressible_flow/Turbulent_ONERAM6/turb_ONERAM6.cfg b/compressible_flow/Turbulent_ONERAM6/turb_ONERAM6.cfg index 88aaafc..bb50a15 100644 --- a/compressible_flow/Turbulent_ONERAM6/turb_ONERAM6.cfg +++ b/compressible_flow/Turbulent_ONERAM6/turb_ONERAM6.cfg @@ -185,22 +185,9 @@ MG_DAMP_PROLONGATION= 0.7 % -------------------- FLOW NUMERICAL METHOD DEFINITION -----------------------% % -% Convective numerical method (JST, LAX-FRIEDRICH, CUSP, ROE, AUSM, HLLC, -% TURKEL_PREC, MSW) +% Convective numerical method CONV_NUM_METHOD_FLOW= JST % -% Spatial numerical order integration (1ST_ORDER, 2ND_ORDER, 2ND_ORDER_LIMITER) -MUSCL_FLOW= YES -% -% Slope limiter (NONE, VENKATAKRISHNAN, VENKATAKRISHNAN_WANG, -% BARTH_JESPERSEN, VAN_ALBADA_EDGE) -SLOPE_LIMITER_FLOW= VENKATAKRISHNAN -% -% Coefficient for the Venkat's limiter (upwind scheme). A larger values decrease -% the extent of limiting, values approaching zero cause -% lower-order approximation to the solution (0.05 by default) -VENKAT_LIMITER_COEFF= 0.05 -% % 2nd and 4th order artificial dissipation coefficients for % the JST method ( 0.5, 0.02 by default ) JST_SENSOR_COEFF= ( 0.5, 0.02 ) diff --git a/design/Inviscid_2D_Unconstrained_NACA0012/inv_NACA0012_basic.cfg b/design/Inviscid_2D_Unconstrained_NACA0012/inv_NACA0012_basic.cfg index 8224e98..18039e9 100644 --- a/design/Inviscid_2D_Unconstrained_NACA0012/inv_NACA0012_basic.cfg +++ b/design/Inviscid_2D_Unconstrained_NACA0012/inv_NACA0012_basic.cfg @@ -133,9 +133,6 @@ MG_DAMP_PROLONGATION= 1.0 % ROE-2ND_ORDER) CONV_NUM_METHOD_FLOW= JST % -% Slope limiter (VENKATAKRISHNAN) -SLOPE_LIMITER_FLOW= VENKATAKRISHNAN -% % 2nd and 4th order artificial dissipation coefficients JST_SENSOR_COEFF= ( 0.5, 0.02 ) % @@ -154,9 +151,6 @@ OBJECTIVE_FUNCTION= DRAG % ROE-2ND_ORDER) CONV_NUM_METHOD_ADJFLOW= JST % -% Slope limiter (VENKATAKRISHNAN, SHARP_EDGES) -SLOPE_LIMITER_ADJFLOW= VENKATAKRISHNAN -% % 2nd, and 4th order artificial dissipation coefficients ADJ_JST_SENSOR_COEFF= ( 0.0, 0.02 ) % @@ -278,7 +272,6 @@ SURFACE_FILENAME= surface_flow % Output file surface adjoint coefficient (w/o extension) SURFACE_ADJ_FILENAME= surface_adjoint % -% % Screen output SCREEN_OUTPUT= (INNER_ITER, RMS_DENSITY, RMS_ENERGY, LIFT, DRAG) % diff --git a/design/Turbulent_2D_Constrained_RAE2822/turb_SA_RAE2822.cfg b/design/Turbulent_2D_Constrained_RAE2822/turb_SA_RAE2822.cfg index 28aa434..54edd22 100644 --- a/design/Turbulent_2D_Constrained_RAE2822/turb_SA_RAE2822.cfg +++ b/design/Turbulent_2D_Constrained_RAE2822/turb_SA_RAE2822.cfg @@ -109,7 +109,7 @@ OBJECTIVE_FUNCTION= DRAG % % Monotonic Upwind Scheme for Conservation Laws (TVD) in the flow equations. % Required for 2nd order upwind schemes (NO, YES) -MUSCL_FLOW= YES +MUSCL_FLOW= NO % % Slope limiter (NONE, VENKATAKRISHNAN, VENKATAKRISHNAN_WANG, % BARTH_JESPERSEN, VAN_ALBADA_EDGE) @@ -125,7 +125,7 @@ SLOPE_LIMITER_TURB= VENKATAKRISHNAN % % Monotonic Upwind Scheme for Conservation Laws (TVD) in the adjoint flow equations. % Required for 2nd order upwind schemes (NO, YES) -MUSCL_ADJFLOW= YES +MUSCL_ADJFLOW= NO % % Slope limiter (NONE, VENKATAKRISHNAN, BARTH_JESPERSEN, VAN_ALBADA_EDGE, % SHARP_EDGES, WALL_DISTANCE) diff --git a/design/Unsteady_Shape_Opt_NACA0012/unsteady_naca0012_opt.cfg b/design/Unsteady_Shape_Opt_NACA0012/unsteady_naca0012_opt.cfg index 284266b..b04aa84 100644 --- a/design/Unsteady_Shape_Opt_NACA0012/unsteady_naca0012_opt.cfg +++ b/design/Unsteady_Shape_Opt_NACA0012/unsteady_naca0012_opt.cfg @@ -136,10 +136,6 @@ LINEAR_SOLVER_ITER= 5 % TURKEL_PREC, MSW) CONV_NUM_METHOD_FLOW= JST % -% Spatial numerical order integration (1ST_ORDER, 2ND_ORDER, 2ND_ORDER_LIMITER) -% -% MUSCL_FLOW= YES -% % 1st, 2nd and 4th order artificial dissipation coefficients JST_SENSOR_COEFF= ( 0.5, 0.01 ) % diff --git a/incompressible_flow/Inc_Species_Transport/1__FFD-box-writing/species3_primitiveVenturi.cfg b/incompressible_flow/Inc_Species_Transport/1__FFD-box-writing/species3_primitiveVenturi.cfg index 188aed9..721808d 100644 --- a/incompressible_flow/Inc_Species_Transport/1__FFD-box-writing/species3_primitiveVenturi.cfg +++ b/incompressible_flow/Inc_Species_Transport/1__FFD-box-writing/species3_primitiveVenturi.cfg @@ -50,7 +50,7 @@ INLET_FILENAME= inlet_venturi.dat INC_INLET_TYPE= VELOCITY_INLET VELOCITY_INLET MARKER_INLET= ( gas_inlet, 300, 1.0, 1.0, 0.0, 0.0,\ air_axial_inlet, 300, 1.0, 0.0, -1.0, 0.0 ) -SPECIES_USE_STRONG_BC= NO + MARKER_INLET_SPECIES= (gas_inlet, 0.5, 0.5,\ air_axial_inlet, 0.6, 0.0 ) % diff --git a/incompressible_flow/Inc_Species_Transport/2__mesh-deform-test/species3_primitiveVenturi_deform.cfg b/incompressible_flow/Inc_Species_Transport/2__mesh-deform-test/species3_primitiveVenturi_deform.cfg index 97cd2fd..f90050f 100644 --- a/incompressible_flow/Inc_Species_Transport/2__mesh-deform-test/species3_primitiveVenturi_deform.cfg +++ b/incompressible_flow/Inc_Species_Transport/2__mesh-deform-test/species3_primitiveVenturi_deform.cfg @@ -51,7 +51,7 @@ INLET_FILENAME= inlet_venturi.dat INC_INLET_TYPE= VELOCITY_INLET VELOCITY_INLET MARKER_INLET= ( gas_inlet, 300, 1.0, 1.0, 0.0, 0.0,\ air_axial_inlet, 300, 1.0, 0.0, -1.0, 0.0 ) -SPECIES_USE_STRONG_BC= NO + MARKER_INLET_SPECIES= (gas_inlet, 0.5, 0.5,\ air_axial_inlet, 0.6, 0.0 ) % diff --git a/incompressible_flow/Inc_Species_Transport/3__gradient-validation/species3_primitiveVenturi.cfg b/incompressible_flow/Inc_Species_Transport/3__gradient-validation/species3_primitiveVenturi.cfg index 735308c..3601908 100644 --- a/incompressible_flow/Inc_Species_Transport/3__gradient-validation/species3_primitiveVenturi.cfg +++ b/incompressible_flow/Inc_Species_Transport/3__gradient-validation/species3_primitiveVenturi.cfg @@ -54,7 +54,7 @@ INLET_FILENAME= inlet_venturi.dat INC_INLET_TYPE= VELOCITY_INLET VELOCITY_INLET MARKER_INLET= ( gas_inlet, 300, 1.0, 1.0, 0.0, 0.0,\ air_axial_inlet, 300, 1.0, 0.0, -1.0, 0.0 ) -SPECIES_USE_STRONG_BC= NO + MARKER_INLET_SPECIES= (gas_inlet, 0.5, 0.5,\ air_axial_inlet, 0.6, 0.0 ) % diff --git a/incompressible_flow/Inc_Species_Transport/4__optimization/species3_primitiveVenturi.cfg b/incompressible_flow/Inc_Species_Transport/4__optimization/species3_primitiveVenturi.cfg index c4e6e1d..18d9e81 100644 --- a/incompressible_flow/Inc_Species_Transport/4__optimization/species3_primitiveVenturi.cfg +++ b/incompressible_flow/Inc_Species_Transport/4__optimization/species3_primitiveVenturi.cfg @@ -54,7 +54,7 @@ INLET_FILENAME= inlet_venturi.dat INC_INLET_TYPE= VELOCITY_INLET VELOCITY_INLET MARKER_INLET= ( gas_inlet, 300, 1.0, 1.0, 0.0, 0.0,\ air_axial_inlet, 300, 1.0, 0.0, -1.0, 0.0 ) -SPECIES_USE_STRONG_BC= NO + MARKER_INLET_SPECIES= (gas_inlet, 0.5, 0.5,\ air_axial_inlet, 0.6, 0.0 ) % diff --git a/incompressible_flow/Inc_Species_Transport/DAspecies3_primitiveVenturi.cfg b/incompressible_flow/Inc_Species_Transport/DAspecies3_primitiveVenturi.cfg index 306294a..b568b6e 100644 --- a/incompressible_flow/Inc_Species_Transport/DAspecies3_primitiveVenturi.cfg +++ b/incompressible_flow/Inc_Species_Transport/DAspecies3_primitiveVenturi.cfg @@ -5,7 +5,7 @@ % Author: T. Kattmann % % Institution: Bosch Thermotechniek B.V. % % Date: 2021/10/14 % -% File Version 7.2.1 "Blackbird" % +% File Version 7.5.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -13,8 +13,14 @@ % SOLVER= INC_RANS KIND_TURB_MODEL= SST -% -OBJECTIVE_FUNCTION= SURFACE_SPECIES_VARIANCE +SST_OPTIONS= V1994m +% +CUSTOM_OUTPUTS= 'avg_species_0 : AreaAvg{SPECIES[0]}[outlet];\ + avg_species_1 : AreaAvg{SPECIES[1]}[outlet];\ + var_species : AreaAvg{pow(SPECIES[0] - avg_species_0, 2) +\ + pow(SPECIES[1] - avg_species_1, 2)}[outlet]' +CUSTOM_OBJFUNC= 'var_species' +OBJECTIVE_FUNCTION= CUSTOM_OBJFUNC OBJECTIVE_WEIGHT= 1.0 % % ---------------- INCOMPRESSIBLE FLOW CONDITION DEFINITION -------------------% @@ -53,7 +59,7 @@ INLET_FILENAME= inlet_venturi.dat INC_INLET_TYPE= VELOCITY_INLET VELOCITY_INLET MARKER_INLET= ( gas_inlet, 300, 1.0, 1.0, 0.0, 0.0,\ air_axial_inlet, 300, 1.0, 0.0, -1.0, 0.0 ) -SPECIES_USE_STRONG_BC= NO + MARKER_INLET_SPECIES= (gas_inlet, 0.5, 0.5,\ air_axial_inlet, 0.6, 0.0 ) % @@ -80,7 +86,7 @@ LINEAR_SOLVER= FGMRES LINEAR_SOLVER_PREC= ILU LINEAR_SOLVER_ERROR= 1E-8 LINEAR_SOLVER_ITER= 20 - +% % -------------------- FLOW NUMERICAL METHOD DEFINITION -----------------------% % CONV_NUM_METHOD_FLOW= FDS @@ -119,7 +125,6 @@ CONV_STARTITER= 10 % ------------------------- INPUT/OUTPUT INFORMATION --------------------------% % MESH_FILENAME= primitiveVenturi.su2 -% SCREEN_OUTPUT= INNER_ITER WALL_TIME RMS_ADJ_PRESSURE RMS_ADJ_VELOCITY-X RMS_ADJ_VELOCITY-Y RMS_ADJ_TKE RMS_ADJ_DISSIPATION RMS_ADJ_SPECIES_0 RMS_ADJ_SPECIES_1 SCREEN_WRT_FREQ_INNER= 10 % @@ -140,3 +145,4 @@ RESTART_FILENAME= restart SOLUTION_FILENAME= solution % WRT_PERFORMANCE= YES + diff --git a/incompressible_flow/Inc_Species_Transport/species3_primitiveVenturi.cfg b/incompressible_flow/Inc_Species_Transport/species3_primitiveVenturi.cfg index c8137a9..06a6ad3 100644 --- a/incompressible_flow/Inc_Species_Transport/species3_primitiveVenturi.cfg +++ b/incompressible_flow/Inc_Species_Transport/species3_primitiveVenturi.cfg @@ -5,7 +5,7 @@ % Author: T. Kattmann % % Institution: Bosch Thermotechniek B.V. % % Date: 2021/10/14 % -% File Version 7.2.1 "Blackbird" % +% File Version 7.5.1 "Blackbird" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -13,6 +13,7 @@ % SOLVER= INC_RANS KIND_TURB_MODEL= SST +SST_OPTIONS= V1994m % % ---------------- INCOMPRESSIBLE FLOW CONDITION DEFINITION -------------------% % @@ -50,7 +51,7 @@ INLET_FILENAME= inlet_venturi.dat INC_INLET_TYPE= VELOCITY_INLET VELOCITY_INLET MARKER_INLET= ( gas_inlet, 300, 1.0, 1.0, 0.0, 0.0,\ air_axial_inlet, 300, 1.0, 0.0, -1.0, 0.0 ) -SPECIES_USE_STRONG_BC= NO + MARKER_INLET_SPECIES= (gas_inlet, 0.5, 0.5,\ air_axial_inlet, 0.6, 0.0 ) % diff --git a/incompressible_flow/Inc_Species_Transport_Composition_Dependent_Model/kenics_mixer_tutorial.cfg b/incompressible_flow/Inc_Species_Transport_Composition_Dependent_Model/kenics_mixer_tutorial.cfg index 06bc801..1a67e24 100644 --- a/incompressible_flow/Inc_Species_Transport_Composition_Dependent_Model/kenics_mixer_tutorial.cfg +++ b/incompressible_flow/Inc_Species_Transport_Composition_Dependent_Model/kenics_mixer_tutorial.cfg @@ -16,6 +16,7 @@ % SOLVER= INC_RANS KIND_TURB_MODEL= SST +SST_OPTIONS= V1994m % % ---------------- INCOMPRESSIBLE FLOW CONDITION DEFINITION -------------------% % @@ -60,7 +61,7 @@ SPECIFIED_INLET_PROFILE= NO % INC_INLET_TYPE= VELOCITY_INLET VELOCITY_INLET MARKER_INLET= ( inlet_gas, 300, 5.0, 0.0, 0.0, 1.0, inlet_air, 300, 5.0, 0.0, 0.0, 1.0 ) -SPECIES_USE_STRONG_BC= NO + MARKER_INLET_SPECIES= ( inlet_gas, 1.0, inlet_air, 0.0 ) % MARKER_INLET_TURBULENT= ( inlet_gas, 0.05, 10, inlet_air, 0.05, 10 ) diff --git a/incompressible_flow/Inc_Streamwise_Periodic/sp_pinArray_2d_dp_hf_tp.cfg b/incompressible_flow/Inc_Streamwise_Periodic/sp_pinArray_2d_dp_hf_tp.cfg index 0e94605..e63b744 100644 --- a/incompressible_flow/Inc_Streamwise_Periodic/sp_pinArray_2d_dp_hf_tp.cfg +++ b/incompressible_flow/Inc_Streamwise_Periodic/sp_pinArray_2d_dp_hf_tp.cfg @@ -12,6 +12,7 @@ % SOLVER= INC_RANS KIND_TURB_MODEL= SST +SST_OPTIONS= V1994m % % ---------------- INCOMPRESSIBLE FLOW CONDITION DEFINITION -------------------% % diff --git a/incompressible_flow/Inc_Streamwise_Periodic/sp_pinArray_2d_mf_hf.cfg b/incompressible_flow/Inc_Streamwise_Periodic/sp_pinArray_2d_mf_hf.cfg index 8ebe723..c129a0e 100644 --- a/incompressible_flow/Inc_Streamwise_Periodic/sp_pinArray_2d_mf_hf.cfg +++ b/incompressible_flow/Inc_Streamwise_Periodic/sp_pinArray_2d_mf_hf.cfg @@ -12,6 +12,7 @@ % SOLVER= INC_RANS KIND_TURB_MODEL= SST +SST_OPTIONS= V1994m % % ---------------- INCOMPRESSIBLE FLOW CONDITION DEFINITION -------------------% % diff --git a/multiphysics/unsteady_fsi_python/Ma01/fluid.cfg b/multiphysics/unsteady_fsi_python/Ma01/fluid.cfg index 15dbd83..bcfb42c 100644 --- a/multiphysics/unsteady_fsi_python/Ma01/fluid.cfg +++ b/multiphysics/unsteady_fsi_python/Ma01/fluid.cfg @@ -121,18 +121,10 @@ LINEAR_SOLVER_ITER= 10 % % -------------------- FLOW NUMERICAL METHOD DEFINITION -----------------------% % -% Convective numerical method (JST, LAX-FRIEDRICH, CUSP, ROE, AUSM, HLLC, +% Convective numerical method (JST, LAX-FRIEDRICH, ROE, AUSM, HLLC, % TURKEL_PREC, MSW) CONV_NUM_METHOD_FLOW= JST % -% Spatial numerical order integration (1ST_ORDER, 2ND_ORDER, 2ND_ORDER_LIMITER) -% -% Monotonic Upwind Scheme for Conservation Laws (TVD) in the flow equations. -% Required for 2nd order upwind schemes (NO, YES) -MUSCL_FLOW= YES -% Slope limiter (VENKATAKRISHNAN, MINMOD) -SLOPE_LIMITER_FLOW= VENKATAKRISHNAN -% JST_SENSOR_COEFF= ( 0.5, 0.01 ) % Time discretization (RUNGE-KUTTA_EXPLICIT, EULER_IMPLICIT, EULER_EXPLICIT) TIME_DISCRE_FLOW= EULER_IMPLICIT diff --git a/multiphysics/unsteady_fsi_python/Ma02/fluid.cfg b/multiphysics/unsteady_fsi_python/Ma02/fluid.cfg index 0ad3f6f..80bd6f1 100644 --- a/multiphysics/unsteady_fsi_python/Ma02/fluid.cfg +++ b/multiphysics/unsteady_fsi_python/Ma02/fluid.cfg @@ -125,14 +125,6 @@ LINEAR_SOLVER_ITER= 10 % TURKEL_PREC, MSW) CONV_NUM_METHOD_FLOW= JST % -% Spatial numerical order integration (1ST_ORDER, 2ND_ORDER, 2ND_ORDER_LIMITER) -% -% Monotonic Upwind Scheme for Conservation Laws (TVD) in the flow equations. -% Required for 2nd order upwind schemes (NO, YES) -MUSCL_FLOW= YES -% Slope limiter (VENKATAKRISHNAN, MINMOD) -SLOPE_LIMITER_FLOW= VENKATAKRISHNAN -% JST_SENSOR_COEFF= ( 0.5, 0.01 ) % Time discretization (RUNGE-KUTTA_EXPLICIT, EULER_IMPLICIT, EULER_EXPLICIT) TIME_DISCRE_FLOW= EULER_IMPLICIT diff --git a/multiphysics/unsteady_fsi_python/Ma03/fluid.cfg b/multiphysics/unsteady_fsi_python/Ma03/fluid.cfg index d7b86c5..4913d24 100644 --- a/multiphysics/unsteady_fsi_python/Ma03/fluid.cfg +++ b/multiphysics/unsteady_fsi_python/Ma03/fluid.cfg @@ -125,14 +125,6 @@ LINEAR_SOLVER_ITER= 10 % TURKEL_PREC, MSW) CONV_NUM_METHOD_FLOW= JST % -% Spatial numerical order integration (1ST_ORDER, 2ND_ORDER, 2ND_ORDER_LIMITER) -% -% Monotonic Upwind Scheme for Conservation Laws (TVD) in the flow equations. -% Required for 2nd order upwind schemes (NO, YES) -MUSCL_FLOW= YES -% Slope limiter (VENKATAKRISHNAN, MINMOD) -SLOPE_LIMITER_FLOW= VENKATAKRISHNAN -% JST_SENSOR_COEFF= ( 0.5, 0.01 ) % Time discretization (RUNGE-KUTTA_EXPLICIT, EULER_IMPLICIT, EULER_EXPLICIT) TIME_DISCRE_FLOW= EULER_IMPLICIT diff --git a/multiphysics/unsteady_fsi_python/Ma0357/fluid.cfg b/multiphysics/unsteady_fsi_python/Ma0357/fluid.cfg index baa2370..f2d14ea 100644 --- a/multiphysics/unsteady_fsi_python/Ma0357/fluid.cfg +++ b/multiphysics/unsteady_fsi_python/Ma0357/fluid.cfg @@ -125,14 +125,6 @@ LINEAR_SOLVER_ITER= 10 % TURKEL_PREC, MSW) CONV_NUM_METHOD_FLOW= JST % -% Spatial numerical order integration (1ST_ORDER, 2ND_ORDER, 2ND_ORDER_LIMITER) -% -% Monotonic Upwind Scheme for Conservation Laws (TVD) in the flow equations. -% Required for 2nd order upwind schemes (NO, YES) -MUSCL_FLOW= YES -% Slope limiter (VENKATAKRISHNAN, MINMOD) -SLOPE_LIMITER_FLOW= VENKATAKRISHNAN -% JST_SENSOR_COEFF= ( 0.5, 0.01 ) % Time discretization (RUNGE-KUTTA_EXPLICIT, EULER_IMPLICIT, EULER_EXPLICIT) TIME_DISCRE_FLOW= EULER_IMPLICIT diff --git a/multiphysics/unsteady_fsi_python/Ma0364/fluid.cfg b/multiphysics/unsteady_fsi_python/Ma0364/fluid.cfg index 8d1584c..6c3f9c7 100644 --- a/multiphysics/unsteady_fsi_python/Ma0364/fluid.cfg +++ b/multiphysics/unsteady_fsi_python/Ma0364/fluid.cfg @@ -125,14 +125,6 @@ LINEAR_SOLVER_ITER= 10 % TURKEL_PREC, MSW) CONV_NUM_METHOD_FLOW= JST % -% Spatial numerical order integration (1ST_ORDER, 2ND_ORDER, 2ND_ORDER_LIMITER) -% -% Monotonic Upwind Scheme for Conservation Laws (TVD) in the flow equations. -% Required for 2nd order upwind schemes (NO, YES) -MUSCL_FLOW= YES -% Slope limiter (VENKATAKRISHNAN, MINMOD) -SLOPE_LIMITER_FLOW= VENKATAKRISHNAN -% JST_SENSOR_COEFF= ( 0.5, 0.01 ) % Time discretization (RUNGE-KUTTA_EXPLICIT, EULER_IMPLICIT, EULER_EXPLICIT) TIME_DISCRE_FLOW= EULER_IMPLICIT