From 4479ccdc32fa39c7d3fc238ba8ab26419fdd6da3 Mon Sep 17 00:00:00 2001
From: Paul Dechamps <paul.dechamps@uliege.be>
Date: Wed, 13 Dec 2023 16:35:37 +0100
Subject: [PATCH] (feat) Added the ability to write surface Cps to file.

Dart interface is now able to write the surface pressure distribution.
---
 blast/interfaces/dart/DartInterface.py | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/blast/interfaces/dart/DartInterface.py b/blast/interfaces/dart/DartInterface.py
index 7b3752c..da0809b 100644
--- a/blast/interfaces/dart/DartInterface.py
+++ b/blast/interfaces/dart/DartInterface.py
@@ -76,6 +76,14 @@ class DartInterface(SolversInterface):
             np.savetxt('Cp'+sfx+'.dat', data, fmt='%1.6e', delimiter=', ', header='x, y, z, Cp', comments='')
         
         elif self.cfg['nDim'] == 3:
+                # Save surface cp
+                data = np.zeros((self.argOut['bnd'].nodes.size(), 4))
+                for i, n in enumerate(self.argOut['bnd'].nodes):
+                    data[i,0] = n.pos[0]
+                    data[i,1] = n.pos[1]
+                    data[i,2] = n.pos[2]
+                    data[i,3] = self.solver.Cp[n.row]
+                np.savetxt(self.argOut['msh'].name+'_Cp_surface'+sfx+'.dat', data, fmt='%1.6e', delimiter=', ', header='x, y, z, Cp', comments='')
                 import modules.dartflo.dart.utils as invUtils
                 if self.cfg['Format'] == 'vtk':
                     import os
-- 
GitLab