Updated added adiabaticwall and doxyfile.
This commit is contained in:
parent
119214800d
commit
c4ffca4640
@ -20,7 +20,7 @@ add_definitions(-DARMA_DONT_USE_WRAPPER)
|
||||
#====================================================
|
||||
|
||||
# Always required make flags in case of both compilers
|
||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -pipe -fPIC -Wall -Wextra -Wno-unused-parameter -Wno-unused-variable ")
|
||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -g -pipe -fPIC -Wall -Wextra -Wno-unused-parameter -Wno-unused-variable ")
|
||||
# set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wfatal-errors -pipe -fPIC -Wall -Wextra -Wno-unused-parameter -Wno-unused-variable ")
|
||||
#========Qt5 Stuff ==================================
|
||||
find_package(Qt5Widgets)
|
||||
@ -47,7 +47,7 @@ set(CMAKE_AUTORCC ON)
|
||||
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX)FLAGS} -g -ggdb")
|
||||
|
||||
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2 -march=native -mtune=native")
|
||||
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2 -march=native -mtune=native")
|
||||
# set(CMAKE_CLANG "${CMAKE_GCC} -march=native -mtune=native -fopenmp")
|
||||
|
||||
|
||||
@ -132,5 +132,5 @@ add_subdirectory(testing)
|
||||
|
||||
add_executable(tasmet src/main.cpp src/gui/tasmet_resources.qrc)
|
||||
add_executable(tasmet_solvemodel src/tasmet_solvemodel.cpp)
|
||||
target_link_libraries(tasmet tasmet_gui tasmet_src messages PythonQt Qt5::Widgets openblas)
|
||||
target_link_libraries(tasmet tasmet_gui tasmet_src messages PythonQt Qt5::Widgets openblas tcmalloc)
|
||||
target_link_libraries(tasmet_solvemodel tasmet_src messages PythonQt openblas)
|
||||
|
@ -32,7 +32,7 @@ add_library(tasmet_src
|
||||
tasmet_assert.cpp
|
||||
tasmet_pyeval.cpp
|
||||
|
||||
protobuf/system_tools.cpp
|
||||
protobuf/message_tools.cpp
|
||||
|
||||
duct/grid.cpp
|
||||
duct/geom.cpp
|
||||
@ -40,6 +40,7 @@ add_library(tasmet_src
|
||||
|
||||
ductbc/ductbc.cpp
|
||||
ductbc/pressurebc.cpp
|
||||
ductbc/adiabaticwall.cpp
|
||||
|
||||
funcs/bessel.cpp
|
||||
funcs/cbessj.cpp
|
||||
|
65
src/ductbc/adiabaticwall.cpp
Normal file
65
src/ductbc/adiabaticwall.cpp
Normal file
@ -0,0 +1,65 @@
|
||||
// adiabaticwall.cpp
|
||||
//
|
||||
// last-edit-by: J.A. de Jong
|
||||
//
|
||||
// Description:
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
#include "adiabaticwall.h"
|
||||
#include "ductbc.pb.h"
|
||||
#include "tasmet_tracer.h"
|
||||
#include "tasmet_assert.h"
|
||||
|
||||
|
||||
AdiabaticWall::AdiabaticWall(const us id,
|
||||
const TaSystem& sys,
|
||||
const pb::DuctBc& dbc):
|
||||
Segment(id,dbc.name()),
|
||||
_side(dbc.side()),
|
||||
_duct_id(dbc.duct_id())
|
||||
{
|
||||
TRACE(15,"AdiabaticWall(id,sys,dbc)");
|
||||
tasmet_assert(dbc.type() == pb::AdiabaticWall,"Wrong type given to constructor");
|
||||
|
||||
|
||||
}
|
||||
AdiabaticWall::AdiabaticWall(const AdiabaticWall& o):
|
||||
Segment(o) {
|
||||
|
||||
TRACE(15,"AdiabaticWall(o)");
|
||||
|
||||
}
|
||||
AdiabaticWall::~AdiabaticWall() {
|
||||
|
||||
}
|
||||
AdiabaticWall* AdiabaticWall::copy() const {
|
||||
return new AdiabaticWall(*this);
|
||||
}
|
||||
vd AdiabaticWall::initialSolution(const TaSystem& sys) const {
|
||||
return vd();
|
||||
}
|
||||
|
||||
void AdiabaticWall::residual(const TaSystem&,
|
||||
arma::subview_col<d>&& residual
|
||||
) const {
|
||||
|
||||
TRACE(15,"AdiabaticWall::residual()");
|
||||
|
||||
|
||||
}
|
||||
|
||||
us AdiabaticWall::getNEqs(const TaSystem&) const {
|
||||
TRACE(15,"AdiabaticWall::getNEqs()");
|
||||
|
||||
|
||||
}
|
||||
void AdiabaticWall::show(const TaSystem&,us verbosity_level) const {
|
||||
TRACE(15,"AdiabaticWall::show()");
|
||||
}
|
||||
void AdiabaticWall::jac(const TaSystem&,Jacobian&,
|
||||
us dof_start,us eq_start) const {
|
||||
|
||||
TRACE(15,"AdiabaticWall::jac()");
|
||||
|
||||
}
|
||||
//////////////////////////////////////////////////////////////////////
|
60
src/ductbc/adiabaticwall.h
Normal file
60
src/ductbc/adiabaticwall.h
Normal file
@ -0,0 +1,60 @@
|
||||
// adiabaticwall.h
|
||||
//
|
||||
// Author: J.A. de Jong
|
||||
//
|
||||
// Description:
|
||||
// Adiabatic wall boundary condition on one side of the duct
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
#pragma once
|
||||
#ifndef ADIABATICWALL_H
|
||||
#define ADIABATICWALL_H
|
||||
#include "segment.h"
|
||||
#include "ductbc.pb.h"
|
||||
|
||||
class TaSystem;
|
||||
class Variable;
|
||||
|
||||
/**
|
||||
* The adiabaticWall class represents a Duct boundary condition, which
|
||||
* blocks the flow and does not allow any axial heat conduction.
|
||||
*/
|
||||
|
||||
class AdiabaticWall: public Segment {
|
||||
pb::DuctSide _side; /**< Duct side at which this b.c. works */
|
||||
us _duct_id; /**< ID of Duct for this b.c. */
|
||||
|
||||
protected:
|
||||
AdiabaticWall(const AdiabaticWall&);
|
||||
public:
|
||||
AdiabaticWall(const us id,
|
||||
const TaSystem& sys,
|
||||
const pb::DuctBc&);
|
||||
~AdiabaticWall();
|
||||
AdiabaticWall* copy() const;
|
||||
|
||||
vd initialSolution(const TaSystem&) const;
|
||||
|
||||
virtual void residual(const TaSystem&,
|
||||
arma::subview_col<d>&& residual
|
||||
) const;
|
||||
|
||||
// Return the total number of equations in this segment
|
||||
virtual us getNEqs(const TaSystem&) const;
|
||||
|
||||
// Return the current mass in this segment
|
||||
virtual d getMass(const TaSystem&) const { return 0;};
|
||||
|
||||
virtual void show(const TaSystem&,us verbosity_level) const;
|
||||
|
||||
// Reset amplitude data in higher harmonics
|
||||
// virtual void resetHarmonics() = 0;
|
||||
|
||||
// Fill Jacobian with values from the equations in this
|
||||
// segment/connector.
|
||||
virtual void jac(const TaSystem&,Jacobian&,us dof_start,us eq_start) const;
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif // ADIABATICWALL_H
|
||||
//////////////////////////////////////////////////////////////////////
|
@ -10,6 +10,7 @@
|
||||
#include "tasmet_tracer.h"
|
||||
#include "tasmet_assert.h"
|
||||
#include "pressurebc.h"
|
||||
#include "adiabaticwall.h"
|
||||
|
||||
Segment* DuctBc::newDuctBc(const us id,
|
||||
const TaSystem& sys,
|
||||
@ -22,6 +23,10 @@ Segment* DuctBc::newDuctBc(const us id,
|
||||
return new PressureBc(id,sys,dbc);
|
||||
break;
|
||||
}
|
||||
case pb::AdiabaticWall: {
|
||||
return new AdiabaticWall(id,sys,dbc);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
tasmet_assert(false,"Not implemented DuctBc");
|
||||
break;
|
||||
|
@ -18,6 +18,8 @@ class Variable;
|
||||
|
||||
class PressureBc: public Segment {
|
||||
Variable *_p,*_T,*_Ts;
|
||||
us _duct_id; /**< ID of Duct for this b.c. */
|
||||
pb::DuctSide _side; /**< Duct side at which this b.c. works */
|
||||
protected:
|
||||
PressureBc(const PressureBc&);
|
||||
public:
|
||||
|
@ -43,19 +43,32 @@ AddDuctDialog::AddDuctDialog(const std::string& name,QWidget* parent):
|
||||
_plot = _dialog->plot;
|
||||
|
||||
// Put validators on pure numeric fields
|
||||
_dialog->L->setValidator(new QDoubleValidator(constants::min_L,
|
||||
constants::max_L,
|
||||
constants::field_decimals));
|
||||
_dialog->ngp->setValidator(new QIntValidator(constants::min_ngp,
|
||||
constants::max_ngp
|
||||
));
|
||||
_dialog->dxb->setValidator(new QDoubleValidator(1e-16,
|
||||
1e6,
|
||||
constants::field_decimals));
|
||||
QValidator* l_validator = new QDoubleValidator(constants::min_L,
|
||||
constants::max_L,
|
||||
constants::field_decimals);
|
||||
if(!l_validator) throw TaSMETBadAlloc();
|
||||
l_validator->setParent(this);
|
||||
_dialog->L->setValidator(l_validator);
|
||||
|
||||
_dialog->dxmid->setValidator(new QDoubleValidator(1e-16,
|
||||
1e6,
|
||||
constants::field_decimals));
|
||||
QValidator* ngp_validator = new QIntValidator(constants::min_ngp,
|
||||
constants::max_ngp);
|
||||
ngp_validator->setParent(this);
|
||||
_dialog->ngp->setValidator(ngp_validator);
|
||||
|
||||
|
||||
QValidator* dxb_validator = new QDoubleValidator(1e-16,
|
||||
1e6,
|
||||
constants::field_decimals);
|
||||
if(!dxb_validator) throw TaSMETBadAlloc();
|
||||
dxb_validator->setParent(this);
|
||||
_dialog->dxb->setValidator(dxb_validator);
|
||||
|
||||
QValidator* dxmid_validator = new QDoubleValidator(1e-16,
|
||||
1e6,
|
||||
constants::field_decimals);
|
||||
if(!dxmid_validator) throw TaSMETBadAlloc();
|
||||
dxmid_validator->setParent(this);
|
||||
_dialog->dxmid->setValidator(dxmid_validator);
|
||||
|
||||
|
||||
for(const PreviewShow& t: PreviewShow_vec){
|
||||
|
BIN
src/gui/images/tasmet_small.png
Executable file
BIN
src/gui/images/tasmet_small.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 29 KiB |
@ -29,14 +29,14 @@
|
||||
|
||||
#include "about_dialog.h"
|
||||
#include "solver_dialog.h"
|
||||
#include "system_tools.h"
|
||||
#include "message_tools.h"
|
||||
|
||||
const QString default_system_name = QString("Unsaved TaSMET Model") +
|
||||
constants::system_fileext;
|
||||
const QString default_model_name = QString("Unsaved TaSMET Model") +
|
||||
constants::model_fileext;
|
||||
const QString default_segment_name = "Unnamed segment";
|
||||
const QString start_file_location = QStandardPaths::
|
||||
writableLocation(QStandardPaths::DocumentsLocation);
|
||||
const QString filetype = QString("TaSMET Model files (*") + constants::system_fileext + ")";
|
||||
const QString filetype = QString("TaSMET Model files (*") + constants::model_fileext + ")";
|
||||
const QString window_title_part = "TaSMET Model Builder - ";
|
||||
namespace {
|
||||
|
||||
@ -54,7 +54,8 @@ namespace {
|
||||
|
||||
TaSMETMainWindow::TaSMETMainWindow():
|
||||
_window(new Ui::MainWindow()),
|
||||
_system(pb::System::default_instance())
|
||||
_model(pb::Model::default_instance())
|
||||
_system(*_model.mutable_sytem())
|
||||
{
|
||||
|
||||
if(!_window) throw TaSMETBadAlloc();
|
||||
@ -76,20 +77,30 @@ TaSMETMainWindow::TaSMETMainWindow():
|
||||
}
|
||||
|
||||
// TODO: change from omg to freq
|
||||
_window->freq->setValidator(new QDoubleValidator(constants::min_omg,
|
||||
constants::max_omg,
|
||||
constants::field_decimals));
|
||||
QValidator *omg_validator = new QDoubleValidator(constants::min_omg,
|
||||
constants::max_omg,
|
||||
constants::field_decimals);
|
||||
if(!omg_validator) throw TaSMETBadAlloc();
|
||||
omg_validator->setParent(this);
|
||||
_window->freq->setValidator(omg_validator);
|
||||
|
||||
|
||||
QValidator* T0_validator = new QDoubleValidator(constants::min_T0,
|
||||
constants::max_T0,
|
||||
constants::field_decimals);
|
||||
if(!T0_validator) throw TaSMETBadAlloc();
|
||||
T0_validator->setParent(this);
|
||||
_window->T0->setValidator(T0_validator);
|
||||
_window->T0->setText(QString::number(constants::default_T0));
|
||||
_window->T0->setValidator(new QDoubleValidator(constants::min_T0,
|
||||
constants::max_T0,
|
||||
constants::field_decimals));
|
||||
|
||||
QValidator *p0_validator = new QDoubleValidator(constants::min_p0,
|
||||
constants::max_p0,
|
||||
constants::field_decimals);
|
||||
if(!p0_validator) throw TaSMETBadAlloc();
|
||||
p0_validator->setParent(this);
|
||||
_window->p0->setValidator(p0_validator);
|
||||
_window->p0->setText(QString::number(constants::default_p0));
|
||||
_window->p0->setValidator(new QDoubleValidator(constants::min_p0,
|
||||
constants::max_p0,
|
||||
constants::field_decimals));
|
||||
|
||||
_window->segmentname->setText(default_segment_name);
|
||||
|
||||
_window->segmentid->setMaximum(constants::max_segs);
|
||||
@ -108,9 +119,9 @@ TaSMETMainWindow::~TaSMETMainWindow(){
|
||||
|
||||
void TaSMETMainWindow::newModel() {
|
||||
TRACE(15,"newModel");
|
||||
_system = pb::System::default_instance();
|
||||
_model = pb::Model::default_instance();
|
||||
_filepath = "";
|
||||
set(_system);
|
||||
set(_model);
|
||||
}
|
||||
void TaSMETMainWindow::loadModel() {
|
||||
TRACE(15,"loadModel");
|
||||
@ -129,9 +140,9 @@ void TaSMETMainWindow::loadModel() {
|
||||
string filepath_s = filepath.toStdString();
|
||||
if(filepath.size()!=0) {
|
||||
try {
|
||||
TRACE(15,"Setting loaded system");
|
||||
TRACE(15,"Setting loaded model");
|
||||
_filepath = filepath_s;
|
||||
set(loadSystem(filepath_s));
|
||||
set(loadMessage<pb::Model>(filepath_s));
|
||||
}
|
||||
catch(TaSMETError &e) {
|
||||
_filepath = "";
|
||||
@ -154,7 +165,7 @@ void TaSMETMainWindow::saveModel(string* filepath) {
|
||||
filepath = &_filepath;
|
||||
}
|
||||
try {
|
||||
saveSystem(*filepath,_system);
|
||||
saveMessage(*filepath,_model);
|
||||
_filepath = *filepath;
|
||||
changed();
|
||||
}
|
||||
@ -172,7 +183,7 @@ void TaSMETMainWindow::saveAsModel() {
|
||||
QString suggested_file;
|
||||
|
||||
if(_filepath.size()==0) {
|
||||
suggested_file = QDir(start_file_location).filePath(default_system_name);
|
||||
suggested_file = QDir(start_file_location).filePath(default_model_name);
|
||||
}
|
||||
else {
|
||||
suggested_file.fromStdString(_filepath);
|
||||
|
@ -10,7 +10,7 @@
|
||||
#define MAINWINDOW_H
|
||||
#include "tasmet_config.h"
|
||||
#include <QMainWindow>
|
||||
#include "protobuf/system.pb.h"
|
||||
#include "protobuf/model.pb.h"
|
||||
#include "tasmet_types.h"
|
||||
|
||||
namespace Ui{
|
||||
@ -23,8 +23,9 @@ class TaSMETMainWindow: public QMainWindow {
|
||||
|
||||
Ui::MainWindow *_window;
|
||||
|
||||
// In-memory system
|
||||
pb::System _system;
|
||||
// In-memory model
|
||||
pb::Model _model;
|
||||
pb::System& _system;
|
||||
|
||||
// Where the file is stored
|
||||
string _filepath = "";
|
||||
@ -43,7 +44,7 @@ private:
|
||||
// When the user interacts, we call this function to update the
|
||||
// internal state and set the widget status accordingly
|
||||
void changed();
|
||||
void set(const pb::System&);
|
||||
void set(const pb::Model&);
|
||||
|
||||
// Check whether the filepath contents agree with the system in
|
||||
// memory
|
||||
|
@ -1,24 +1,26 @@
|
||||
// system_tools.cpp
|
||||
// message_tools.cpp
|
||||
//
|
||||
// last-edit-by: J.A. de Jong
|
||||
//
|
||||
// Description:
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
#include "system_tools.h"
|
||||
#include "message_tools.h"
|
||||
#include <fstream>
|
||||
#include <google/protobuf/text_format.h>
|
||||
#include "tasmet_types.h"
|
||||
#include "tasmet_io.h"
|
||||
#include "tasmet_exception.h"
|
||||
#include "model.pb.h"
|
||||
|
||||
#include <google/protobuf/text_format.h>
|
||||
|
||||
using google::protobuf::TextFormat;
|
||||
|
||||
pb::System loadSystem(const string& filepath) {
|
||||
template<typename T>
|
||||
T loadMessage(const string& filepath) {
|
||||
|
||||
TRACE(15,"loadSystem()");
|
||||
TRACE(15,"loadMessage()");
|
||||
VARTRACE(15,filepath);
|
||||
std::ifstream myfile(filepath,ios::binary);
|
||||
|
||||
@ -29,7 +31,7 @@ pb::System loadSystem(const string& filepath) {
|
||||
|
||||
}
|
||||
|
||||
pb::System sys;
|
||||
T sys;
|
||||
|
||||
std::stringstream strStream;
|
||||
strStream << myfile.rdbuf(); //read the file
|
||||
@ -45,7 +47,8 @@ pb::System loadSystem(const string& filepath) {
|
||||
|
||||
|
||||
}
|
||||
void saveSystem(const string& filepath,const pb::System& sys) {
|
||||
template<typename T>
|
||||
void saveMessage(const string& filepath,const T& sys) {
|
||||
|
||||
std::ofstream sfile(filepath,ios::binary);
|
||||
if(!sfile.good()){
|
||||
@ -67,10 +70,16 @@ void saveSystem(const string& filepath,const pb::System& sys) {
|
||||
|
||||
}
|
||||
}
|
||||
// // Returns true when the two systems are equal
|
||||
bool compareSys(const pb::System& s1,const pb::System& s2) {
|
||||
|
||||
// // Returns true when the two messages are equal
|
||||
template<typename T>
|
||||
bool compareMessage(const T& s1,const T& s2) {
|
||||
return (s1.SerializeAsString()==s2.SerializeAsString());
|
||||
}
|
||||
|
||||
template <>
|
||||
bool compareMessage<pb::Model>(const pb::Model& s1,const pb::Model& s2);
|
||||
template <>
|
||||
pb::Model loadMessage(const string& filepath);
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
@ -8,18 +8,20 @@
|
||||
#pragma once
|
||||
#ifndef SYSTEM_TOOLS_H
|
||||
#define SYSTEM_TOOLS_H
|
||||
#include "system.pb.h"
|
||||
#include "tasmet_tracer.h"
|
||||
#include "tasmet_types.h"
|
||||
|
||||
// Load a system from a filepath
|
||||
pb::System loadSystem(const string& filepath);
|
||||
template<typename T>
|
||||
T loadMessage(const string& filepath);
|
||||
|
||||
// Save a system to a filepath
|
||||
void saveSystem(const string& filepath,const pb::System& sys);
|
||||
template<typename T>
|
||||
void saveMessage(const string& filepath,const T& sys);
|
||||
|
||||
// Returns true when the two systems are equal
|
||||
bool compareSys(const pb::System& s1,const pb::System& s2);
|
||||
template<typename T>
|
||||
bool compareSys(const T& s1,const T& s2);
|
||||
|
||||
|
||||
|
18
src/protobuf/model.proto
Normal file
18
src/protobuf/model.proto
Normal file
@ -0,0 +1,18 @@
|
||||
syntax = "proto2";
|
||||
package pb;
|
||||
|
||||
import "system.proto";
|
||||
import "solver.proto";
|
||||
|
||||
message Model {
|
||||
|
||||
required System system = 1;
|
||||
required SolverParams sparams = 2;
|
||||
|
||||
optional string backlog = 3 [default="Type your info here"];
|
||||
|
||||
repeated double solution = 4;
|
||||
|
||||
|
||||
|
||||
}
|
@ -18,6 +18,4 @@ message System {
|
||||
required double T0 = 6 [default = 293.15];
|
||||
map<uint32,Duct> ducts = 7;
|
||||
map<uint32,DuctBc> ductbcs = 8;
|
||||
repeated double solution = 9;
|
||||
optional SolverParams solverparams = 10;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user