Inbetween, need good saving strategy
This commit is contained in:
parent
1a699b6bc0
commit
d1cfd774fe
@ -23,14 +23,15 @@ set (CMAKE_GENERAL "${CMAKE_GENERAL} -std=c++11 -pipe -O2 -fPIC -Wall \
|
||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_GENERAL} ${CMAKE_GCC}")
|
||||
|
||||
# link_directories(${link_directories} /usr/local/lib)
|
||||
set (tdir /home/anne/wip/tmtubes/src)
|
||||
include_directories(
|
||||
../tmtubes/src/nonlinear/sys
|
||||
../tmtubes/src/nonlinear/seg
|
||||
../tmtubes/src/nonlinear/geom
|
||||
../tmtubes/src/nonlinear/geom/grid
|
||||
../tmtubes/src/common
|
||||
../tmtubes/src/common/gas
|
||||
../tmtubes/src/common/solid
|
||||
${tdir}/nonlinear/sys
|
||||
${tdir}/nonlinear/seg
|
||||
${tdir}/nonlinear/geom
|
||||
${tdir}/nonlinear/geom/grid
|
||||
${tdir}/common
|
||||
${tdir}/common/gas
|
||||
${tdir}/common/solid
|
||||
src
|
||||
)
|
||||
AUX_SOURCE_DIRECTORY(src src)
|
||||
|
54
src/solution.cpp
Normal file
54
src/solution.cpp
Normal file
@ -0,0 +1,54 @@
|
||||
#include "solution.h"
|
||||
#include "geom.h"
|
||||
#include "tube.h"
|
||||
|
||||
|
||||
|
||||
namespace td{
|
||||
SolutionAtGp::SolutionAtGp() {
|
||||
rho_=gc.rho0();
|
||||
}
|
||||
SolutionInstance::SolutionInstance(d time,int gp):
|
||||
time(time)
|
||||
{
|
||||
TRACE(15,"SolutionInstance::SolutionInstance()");
|
||||
gps.resize(gp);
|
||||
}
|
||||
void SolutionInstance::setrho(d rho) {
|
||||
TRACE(15,"SolutionInstance::setrho()");
|
||||
|
||||
for(auto gp=gps.begin();gp!=gps.end();gp++){
|
||||
gp->set(rho);
|
||||
}
|
||||
} // setrho()
|
||||
int SolutionInstance::safe(const char* dir){
|
||||
TRACE(15,"SolutionInstance::safe()");
|
||||
std::stringstream pfilename,ufilename,rhofilename;
|
||||
pfilename.str(""); ufilename.str(""); rhofilename.str("");
|
||||
pfilename << dir;
|
||||
ufilename << dir;
|
||||
rhofilename << dir;
|
||||
|
||||
pfilename << "/p" << nr << ".dat";
|
||||
ufilename << "/u" << nr << ".dat";
|
||||
rhofilename << "/rho" << nr << ".dat";
|
||||
cout << pfilename.str() << "\n";
|
||||
|
||||
std::ofstream p(pfilename.str());
|
||||
std::ofstream u(ufilename.str());
|
||||
std::ofstream rho(rhofilename.str());
|
||||
|
||||
// Writing results for pressure to file
|
||||
p << "#Pressure data vs gridpoint: t=" << time << "\n";
|
||||
u << "#Velocity data vs gridpoint: t=" << time << "\n";
|
||||
rho << "#Density data vs gridpoint: t=" << time << "\n";
|
||||
for(us j=0;j<gps.size();j++){
|
||||
SolutionAtGp& solgp=get(j);
|
||||
p << j << "\t" <<solgp.p() << "\n";
|
||||
u << j << "\t" <<solgp.u() << "\n";
|
||||
rho << j << "\t" <<solgp.rho() << "\n";
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
} // namespace td
|
||||
|
@ -46,10 +46,7 @@ int main(int argc,char *argv[]){
|
||||
initothertrace(10,nltracer);
|
||||
|
||||
|
||||
|
||||
// Create results dir, put all stuff in
|
||||
|
||||
// Create a directory for results
|
||||
mkdir(dir,S_IRWXU | S_IRWXG);
|
||||
// Empty this directory
|
||||
system("rm results/*");
|
||||
@ -57,9 +54,6 @@ int main(int argc,char *argv[]){
|
||||
td::Tube t(L,gp);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int nsaves_per_period=50;
|
||||
int nr=0;
|
||||
d time=0;
|
||||
|
Loading…
Reference in New Issue
Block a user