fixed visualization
This commit is contained in:
parent
ae0e19baf9
commit
2d407097db
4 changed files with 77 additions and 22 deletions
|
|
@ -314,6 +314,7 @@ void Mesh::Visualize_matlab(vector<double> const &v) const
|
||||||
//const string exec_m("matlab -nosplash < visualize_results.m"); // Matlab
|
//const string exec_m("matlab -nosplash < visualize_results.m"); // Matlab
|
||||||
//const string exec_m("octave --no-window-system --no-gui visualize_results.m"); // Octave
|
//const string exec_m("octave --no-window-system --no-gui visualize_results.m"); // Octave
|
||||||
//const string exec_m("flatpak run org.octave.Octave visualize_results.m"); // Octave (flatpak): desktop GH
|
//const string exec_m("flatpak run org.octave.Octave visualize_results.m"); // Octave (flatpak): desktop GH
|
||||||
|
|
||||||
const string exec_m("octave visualize_results.m");
|
const string exec_m("octave visualize_results.m");
|
||||||
|
|
||||||
const string fname("uv.txt");
|
const string fname("uv.txt");
|
||||||
|
|
|
||||||
|
|
@ -2,20 +2,22 @@ CMAKE_MINIMUM_REQUIRED(VERSION 3.10.2)
|
||||||
SET(TARGET "ownSolver")
|
SET(TARGET "ownSolver")
|
||||||
PROJECT(${TARGET} LANGUAGES CXX DESCRIPTION "ownSolver")
|
PROJECT(${TARGET} LANGUAGES CXX DESCRIPTION "ownSolver")
|
||||||
|
|
||||||
# The ownSolver requires c++17
|
|
||||||
SET(CMAKE_CXX_STANDARD 17)
|
|
||||||
SET(CMAKE_CXX_EXTENSIONS OFF)
|
|
||||||
SET(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
||||||
|
|
||||||
file(GLOB MGRID_2_SOURCES
|
add_library(mgrid_2_library
|
||||||
../mgrid_2/binaryIO.cpp
|
../mgrid_2/binaryIO.cpp
|
||||||
../mgrid_2/cuthill_mckee_ordering.cpp
|
../mgrid_2/cuthill_mckee_ordering.cpp
|
||||||
../mgrid_2/elements.cpp
|
../mgrid_2/elements.cpp
|
||||||
../mgrid_2/geom.cpp
|
../mgrid_2/geom.cpp
|
||||||
../mgrid_2/getmatrix.cpp
|
../mgrid_2/getmatrix.cpp
|
||||||
../mgrid_2/jacsolve.cpp
|
../mgrid_2/jacsolve.cpp
|
||||||
../mgrid_2/userset.cpp
|
../mgrid_2/userset.cpp
|
||||||
../mgrid_2/vdop.cpp)
|
../mgrid_2/vdop.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
target_include_directories(mgrid_2_library PUBLIC
|
||||||
|
${CMAKE_CURRENT_LIST_DIR}/../mgrid_2
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
FIND_PACKAGE(precice 3.0 REQUIRED CONFIG)
|
FIND_PACKAGE(precice 3.0 REQUIRED CONFIG)
|
||||||
|
|
@ -23,8 +25,12 @@ FIND_PACKAGE(OpenMP REQUIRED)
|
||||||
ADD_EXECUTABLE(
|
ADD_EXECUTABLE(
|
||||||
${TARGET}
|
${TARGET}
|
||||||
${TARGET}.cpp
|
${TARGET}.cpp
|
||||||
${MGRID_2_SOURCES}
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
target_compile_features(mgrid_2_library PUBLIC cxx_std_17)
|
||||||
|
target_compile_features(${TARGET} PUBLIC cxx_std_17)
|
||||||
|
|
||||||
TARGET_LINK_LIBRARIES(${TARGET} PRIVATE precice::precice
|
TARGET_LINK_LIBRARIES(${TARGET} PRIVATE precice::precice
|
||||||
OpenMP::OpenMP_CXX)
|
OpenMP::OpenMP_CXX
|
||||||
|
PRIVATE mgrid_2_library
|
||||||
|
)
|
||||||
|
|
|
||||||
43
solid-cpp/ascii_read_meshvector.m
Normal file
43
solid-cpp/ascii_read_meshvector.m
Normal file
|
|
@ -0,0 +1,43 @@
|
||||||
|
function [ xc, ia, v ] = ascii_read_meshvector( fname )
|
||||||
|
%
|
||||||
|
% Loads the 2D triangular mesh (coordinates, vertex connectivity)
|
||||||
|
% together with values on its vertices from an ASCII file.
|
||||||
|
% Matlab indexing is stored (starts with 1).
|
||||||
|
%
|
||||||
|
% The input file format is compatible
|
||||||
|
% with Mesh_2d_3_matlab:Write_ascii_matlab(..) in jacobi_oo_stl/geom.h
|
||||||
|
%
|
||||||
|
%
|
||||||
|
% IN: fname - filename
|
||||||
|
% OUT: xc - coordinates
|
||||||
|
% ia - mesh connectivity
|
||||||
|
% v - solution vector
|
||||||
|
|
||||||
|
DELIMETER = ' ';
|
||||||
|
|
||||||
|
fprintf('Read file %s\n',fname)
|
||||||
|
|
||||||
|
% Read mesh constants
|
||||||
|
nn = dlmread(fname,DELIMETER,[0 0 0 3]); %% row_1, col_1, row_2, col_2 in C indexing!!!
|
||||||
|
nnode = nn(1);
|
||||||
|
ndim = nn(2);
|
||||||
|
nelem = nn(3);
|
||||||
|
nvert = nn(4);
|
||||||
|
|
||||||
|
% Read coordinates
|
||||||
|
row_start = 0+1;
|
||||||
|
row_end = 0+nnode;
|
||||||
|
xc = dlmread(fname,DELIMETER,[row_start 0 row_end ndim-1]);
|
||||||
|
|
||||||
|
% Read connectivity
|
||||||
|
row_start = row_end+1;
|
||||||
|
row_end = row_end+nelem;
|
||||||
|
ia = dlmread(fname,DELIMETER,[row_start 0 row_end nvert-1]);
|
||||||
|
|
||||||
|
% Read solution
|
||||||
|
row_start = row_end+1;
|
||||||
|
row_end = row_end+nnode;
|
||||||
|
v = dlmread(fname,DELIMETER,[row_start 0 row_end 0]);
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,8 +1,13 @@
|
||||||
#include "../mgrid_2/geom.h"
|
// #include "../mgrid_2/geom.h"
|
||||||
#include "../mgrid_2/getmatrix.h"
|
// #include "../mgrid_2/getmatrix.h"
|
||||||
#include "../mgrid_2/jacsolve.h"
|
// #include "../mgrid_2/jacsolve.h"
|
||||||
#include "../mgrid_2/userset.h"
|
// #include "../mgrid_2/userset.h"
|
||||||
#include "../mgrid_2/vdop.h"
|
// #include "../mgrid_2/vdop.h"
|
||||||
|
#include "geom.h"
|
||||||
|
#include "getmatrix.h"
|
||||||
|
#include "jacsolve.h"
|
||||||
|
#include "userset.h"
|
||||||
|
#include "vdop.h"
|
||||||
|
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <chrono> // timing
|
#include <chrono> // timing
|
||||||
|
|
@ -166,7 +171,7 @@ int main(int argc, char **argv )
|
||||||
int nodeIndex = wetNodes[i];
|
int nodeIndex = wetNodes[i];
|
||||||
uv[nodeIndex] = temperature[i] - 273.15;
|
uv[nodeIndex] = temperature[i] - 273.15;
|
||||||
}
|
}
|
||||||
mesh_c.Visualize(uv);
|
//mesh_c.Visualize(uv);
|
||||||
|
|
||||||
|
|
||||||
// ----- solve time step -----
|
// ----- solve time step -----
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue