From 4ab89b5fa31e7d64d2a82d13e7e07fc5703684ab Mon Sep 17 00:00:00 2001 From: Paul Dechamps <paul.dechamps@uliege.be> Date: Wed, 26 Feb 2025 11:50:15 +0100 Subject: [PATCH] (tests) Modidy SU2 test Return 0 for pipeline --- blast/tests/su2/blisu2.py | 97 --------------------------------------- 1 file changed, 97 deletions(-) delete mode 100644 blast/tests/su2/blisu2.py diff --git a/blast/tests/su2/blisu2.py b/blast/tests/su2/blisu2.py deleted file mode 100644 index 92f810a..0000000 --- a/blast/tests/su2/blisu2.py +++ /dev/null @@ -1,97 +0,0 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Copyright 2022 University of Liège -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - - -# @author Paul Dechamps -# @date 2022 reworked 2025 -# Test the vii implementation using SU2 as the inviscid solver - -# Imports. -import blast.blUtils as vutils -from fwk.wutils import parseargs - -def cfgSu2(verb): - import os - return { - 'filename' : os.path.abspath(os.path.join(os.path.split(os.path.abspath(__file__))[0], "config.cfg")), - 'meshfile': os.path.abspath(os.path.join(os.path.split(os.path.abspath(__file__))[0], "../../models/su2/n0012_su2.su2")), - 'wingTags' : ['airfoil', 'airfoil_'], - 'Verb': verb, # Verbosity level - } - -def cfgBlast(): - return { - 'Re' : 1e7, # Freestream Reynolds number - 'CFL0' : 2, # Inital CFL number of the calculation - 'couplIter': 2, # Maximum number of iterations - 'sections': {'airfoil': [0.0]}, - 'spans': {'airfoil': 1.0}, - 'couplTol' : 1e-4, # Tolerance of the VII methodology - 'iterPrint': 1, # int, number of iterations between outputs - 'resetInv' : True, # bool, flag to reset the inviscid calculation at every iteration. - 'xtrF' : [None, 0.4], # Forced transition locations - 'interpolator' : 'Matching',# Interpolator for the coupling - } - -def main(): - args = parseargs() - icfg = cfgSu2(args.verb) - vcfg = cfgBlast() - coupler, isol, vsol = vutils.initBlast(icfg, vcfg, iSolver='SU2', task='analysis') - coupler.run() - - import numpy as np - cpi = np.loadtxt('Cp_inviscid.dat') - cpCorrected = np.loadtxt('Cp_viscous.dat') - import matplotlib.pyplot as plt - # Clear plt - plt.close('all') - plt.figure() - plt.plot(cpCorrected[:,0], cpCorrected[:,1], lw=3) - plt.plot(cpi[:,0], cpi[:,1], '--', lw=3) - plt.gca().invert_yaxis() - plt.show() - #plt.savefig('cp.png') - quit() - - # Extract solution - - # Display results - from matplotlib import pyplot as plt - fig, (ax1, ax2) = plt.subplots(1, 2) - ax1.plot(cpCorrected[:,0], cpCorrected[:,1], lw=3) - ax1.plot(su2API.cp0[:,0], su2API.cp0[:,1], '--', lw=1.5, color='black') - ax1.invert_yaxis() - ax1.set_ylabel('$c_p$') - ax2.plot(solsu2['xoc'], solsu2['Cf'], lw=3) - ax2.set_ylabel('$c_f$') - ax2.set_xlim([0,1]) - plt.show() - - plt.plot(cpCorrected[:,0], cpCorrected[:,1], lw=3, color='darkblue') - plt.plot(su2API.cp0[:,0], su2API.cp0[:,1], '--', lw=3, color='black') - plt.xticks([0, 1]) - plt.yticks([-1, 0, 1]) - plt.gca().invert_yaxis() - - for i, spine in enumerate(plt.gca().spines.values()): - if i%2 != 0: - spine.set_visible(False) - plt.show() - -if __name__ == "__main__": - main() -- GitLab