Znn3bq.jpeg
ÉÇÍ·´óѧº£Ñó¿ÆÑ§½ÓÊܵ÷¼Á
²é¿´: 565  |  »Ø¸´: 2

zhaoyubosd

Í­³æ (СÓÐÃûÆø)

[ÇóÖú] ÇóÖúC++±à³Ì£¬²»Ê¤¸Ð¼¤

ÔËÐÐC++³ÌÐò£¬ÏÔʾÔËÐгɹ¦£¬ÀïÃæÓÐÕâÑùÒ»¾ä»°£¬ÇëÎÊÊÇʲôÒâ˼£¿The thread 0x2cb0 has exited with code 0 (0x0).ÈçºÎ½â¾ö¡£»¹ÓУ¬ºÚÉ«ÔËÐнçÃæÉÏΪʲôûÓÐÔËÐнá¹û£¬Çë¸÷λ´óÉñÖ¸½Ì¡£¸½ÉϳÌÐò´úÂë¡£
#include <iostream>
#include <fstream>
#include <iomanip>
#include <cmath>
#include <string>
using namespace std;

void fibermodel (double X[], int n0, double U[], int n1, double V[], int n2,
                                 double P[], int n3, double R[],int n4,
                                 double r, double l, double mu, double dp, double den,
                                 double converge, int n, double &dX);
int main ()
{       
//Hollow fiber

        double X[301],t[301], U[301], V[301], Pressure[301], R[301];
        double r, l, T,Rm, mu, dp, den, dX,converge,cp;
        double ResultP[51][51],ResultU[51][51],ResultV[51][51],ResultR[51][51];

        int n,m,IncrementT,IncrementX;
        string OutputFileName;

//Information about the software
        cout << "HOLLOW FIBER MEMBRANE SIMULATION SOFTWARE Version 1.0" << "\n"
                 << "developed by Dr. Lianfa Song, College of Engineering, Texas Tech University" << "\n"
                 << "APRIL 2015" << "\n" << "\n" << "\n";


// Open input file and read parameter values

        ifstream input_file("numeric.txt";
        input_file        >> r
                        >> l
                                >> T
                                >> Rm
                                >> mu  
                                >> dp
                                >> den
                                >> converge
                                >> n
                                >> m
                                >> IncrementX
                                >> IncrementT
                                >> cp
                                >> OutputFileName;
        cout << "The Name of Output File = " << OutputFileName << "\n" << "\n";

// Start calculation

// Call fibermodel
      
        int j,i;
        t[0]=0.0;
        for (j=1;j<=m;j++)
    {t[j]=t[j-1]+T/m;}

        for (j=0;j<=m;j++)
        {
            if (j=0)
        {
                   for(i=0;i<=n;i++)
                   { R=Rm;}
            }
                fibermodel (X, 301, U, 301, V, 301, Pressure, 301,
                                        R, 301, r, l, mu, dp, den, converge, n, dX);
        if (j%6==0)
        {
                   for(i=0;i<=n;i=i+6)
                          { ResultP[j]=Pressure;ResultU[j]=U;ResultV[j]=V;ResultR[j]=R;}
            }
        for(i=0;i<=n;i++)
                   { R=R+cp*V*T/m;}
        }
               
//Output results
// Open output file

        ofstream output_file(OutputFileName);
       
                output_file << "CONDITIONS" << "\n" ;
                output_file << fixed;
                output_file.precision(0);
                output_file  << setw(13) << "Space-Step="  << setw(13) << n << "\n";

                output_file << scientific;
                output_file.precision(4);
                output_file  << setw(13) << "InnerRadius="  << setw(13) << r << "\n";
                output_file  << setw(13) << "FiberLength="  << setw(13) << l << "\n";
                output_file  << setw(13) << "MemResisten="  << setw(13) << Rm << "\n";
                output_file  << setw(13) << "WaterViscos="  << setw(13) << mu << "\n";
                output_file  << setw(13) << "   Pressure="  << setw(13) << dp << "\n";
                output_file  << setw(13) << "ConvergeCre="  << setw(13) << converge << "\n" << "\n";
                output_file << fixed << "RESULTS1" << "\n";
//PµÄ·Ö²¼Çé¿ö
                output_file << fixed << "Pressure" << "\n";

                output_file << scientific;
                output_file.precision(3);
                output_file<< "X";
                for (int j=0; j<=m; j=j+IncrementT)
                {output_file<< setw(13) << "t="<< t[j] << setw(13);}
                output_file<< endl;

        for (int i=0; i<=n; i=i+IncrementX)
                {   
                        output_file<< X ;
                        for (int j=0; j<=n; j=j+IncrementT)
                        {
                                output_file<< setw(13) << ResultP[j] << setw(13);
                        }
                        output_file<< endl;
            }
                output_file<< endl;
//uµÄ·Ö²¼Çé¿ö
                output_file << fixed << "u" << "\n";

                output_file << scientific;
                output_file.precision(3);
                output_file<< "X";
                for (int j=0; j<=m; j=j+IncrementT)
                {output_file<< setw(13) << "t="<< t[j] << setw(13);}
                output_file<< endl;

        for (int i=0; i<=n; i=i+IncrementX)
                {   
                        output_file<< X ;
                        for (int j=0; j<=n; j=j+IncrementT)
                        {
                                output_file<< setw(13) << ResultU[j] << setw(13);
                        }
                        output_file<< endl;
            }
                output_file<< endl;

//vµÄ·Ö²¼Çé¿ö
          output_file << fixed << "v" << "\n";

                output_file << scientific;
                output_file.precision(3);
                output_file<< "X";
                for (int j=0; j<=m; j=j+IncrementT)
                {output_file<< setw(13) << "t="<< t[j] << setw(13);}
                output_file<< endl;

        for (int i=0; i<=n; i=i+IncrementX)
                {   
                        output_file<< X ;
                        for (int j=0; j<=n; j=j+IncrementT)
                        {
                                output_file<< setw(13) << ResultV[j] << setw(13);
                        }
                        output_file<< endl;
            }
                output_file<< endl;

//RµÄ·Ö²¼Çé¿ö
                output_file << fixed << "R" << "\n";

                output_file << scientific;
                output_file.precision(3);
                output_file<< "X";
                for (int j=0; j<=m; j=j+IncrementT)
                {output_file<< setw(13) << "t="<< t[j] << setw(13);}
                output_file<< endl;

        for (int i=0; i<=n; i=i+IncrementX)
                {   
                        output_file<< X ;
                        for (int j=0; j<=n; j=j+IncrementT)
                        {
                                output_file<< setw(13) << ResultR[j] << setw(13);
                        }
                        output_file<< endl;
            }
                output_file<< endl;
       
                system("PAUSE";
                return 0;
        }
// fibermodel defination

void fibermodel (double X[], int n0, double U[], int n1, double V[], int n2,
                                 double P[], int n3,double R[], int n4,
                                 double r, double l,  double mu, double dp, double den,
                                 double converge, int n, double &dX)
{
       
//Preparation

        double UP, LP, K, pi = 3.1415926;
        K=dX;
        dX = l/double(n);
        X[0]=0.0;
        for (int i=1; i<=n; i++)
                {X=X[i-1]+dX;}

//Start Calculation

        int iter=0;
        UP=dp;
        LP=0.0;
//
loop:        iter = iter +1;

        P[n] = 0.5*(UP+LP);
        U[n] =0.0;
        for (int i=n; i>=1; i--)
        {
                V = P/R;
                U[i-1] =U+2.0*dX*V/r;
                P[i-1]=P+8.0*mu*U[i-1]*dX/(r*r)+K*3.0*den*U[i-1]*V*dX/r;
                if (P[i-1] > dp)
                {UP=P[n]; goto loop;}
        }

                if (abs((P[0]-dp)/dp) > converge)
                {LP=P[n]; goto loop;}
        V[0] = dp/R[0];
               
        return;
        }
»Ø¸´´ËÂ¥

» ²ÂÄãϲ»¶

ÒÑÔÄ   »Ø¸´´ËÂ¥   ¹Ø×¢TA ¸øTA·¢ÏûÏ¢ ËÍTAºì»¨ TAµÄ»ØÌû

zzyµÎºÅ

½ð³æ (СÓÐÃûÆø)

´úÂëÌ«»ìÂÒÁË£¬¶¼²»Äܳɹ¦±àÒë¹ýÈ¥¡£Êý×éÓë±äÁ¿Ö±½ÓÏàµÈ£¬²»Í¬´óСµÄÊý×éÖ±½ÓÓÃ=²Ù×÷£¬»¹ÓÐ10¼¸¸ö²ÎÊýµÄº¯Êý¡£»¹ÊÇÈ·ÈÏÒ»ÏÂÕâÊDz»ÊÇÕýÈ·µÄ´úÂë°É¡£
ÌìµÀ³êÇÚ
2Â¥2015-10-21 22:58:08
ÒÑÔÄ   »Ø¸´´ËÂ¥   ¹Ø×¢TA ¸øTA·¢ÏûÏ¢ ËÍTAºì»¨ TAµÄ»ØÌû

leetcoder

гæ (³õÈëÎÄ̳)

ÏÈ˵ÄãÕâ¸ö³ÌÐòÓÃÀ´¸ÉÂï¡ú_¡ú

·¢×ÔСľ³æAndroid¿Í»§¶Ë
3Â¥2015-10-22 09:14:39
ÒÑÔÄ   »Ø¸´´ËÂ¥   ¹Ø×¢TA ¸øTA·¢ÏûÏ¢ ËÍTAºì»¨ TAµÄ»ØÌû
Ïà¹Ø°æ¿éÌø×ª ÎÒÒª¶©ÔÄÂ¥Ö÷ zhaoyubosd µÄÖ÷Ìâ¸üÐÂ
×î¾ßÈËÆøÈÈÌûÍÆ¼ö [²é¿´È«²¿] ×÷Õß »Ø/¿´ ×îºó·¢±í
[¿¼ÑÐ] 291 Çóµ÷¼Á +36 »¯¹¤2026½ì±ÏÒµÉ 2026-04-09 36/1800 2026-04-14 13:20 by µÚÒ»ÌìºÃ
[¿¼ÑÐ] 297¹¤¿Æµ÷¼Á? +12 ºÓÄÏũҵ´óѧ-ÄÜ 2026-04-13 12/600 2026-04-14 11:05 by ganguoaichi
[¿¼ÑÐ] »úе¹¤³Ì313·ÖÕÒ¹¤¿Æµ÷¼Á +4 ˫һÁ÷±¾¿Æ»úе 2026-04-08 4/200 2026-04-14 07:32 by Abskk
[¿¼ÑÐ] ²ÄÁÏÏà¹Ø×¨Òµ344Çóµ÷¼ÁË«·Ç¹¤¿ÆÑ§Ð£»ò¿ÎÌâ×é +19 hualkop 2026-04-12 20/1000 2026-04-14 07:02 by laoshidan
[¿¼ÑÐ] »¯Ñ§070300 Çóµ÷¼Á +21 ¹þ¹þ¹þ^_^ 2026-04-12 21/1050 2026-04-13 21:36 by nxybio2007
[¿¼ÑÐ] Ò»Ö¾Ô¸085802 323·ÖÇóµ÷¼Á +13 drizzle_9 2026-04-12 14/700 2026-04-13 10:26 by Faiz5552
[¿¼ÑÐ] Çóµ÷¼Á288 +7 ioodiiij 2026-04-10 9/450 2026-04-13 08:33 by Hayaay
[¿¼ÑÐ] 085410 273Çóµ÷¼Á +10 X1999 2026-04-09 10/500 2026-04-12 09:24 by ÄæË®³Ë·ç
[ÕÒ¹¤×÷] ɽ¶«¸ßУ½Ìʦ¿¼ºË³¬¼¶ÎÞµ×Ïߣ¬Ô±¹¤¹ý²»ÏÂÈ¥À² +4 qut2026 2026-04-09 9/450 2026-04-12 00:54 by qut2026
[¿¼ÑÐ] 343Çóµ÷¼Á +9 Íõ¹ú˧ 2026-04-10 9/450 2026-04-11 20:31 by dongdian1
[¿¼ÑÐ] ±¾ÈËÅ®º¢ +7 ºðºð£¬ 2026-04-10 9/450 2026-04-11 14:45 by ACS Nano¡ª¡ª
[¿¼ÑÐ] 085410 273·Öµ÷¼Á +4 X1999 2026-04-09 4/200 2026-04-11 13:05 by pies112
[¿¼ÑÐ] 0859£¬337Çóµ÷¼Á +4 ÑÐs. 2026-04-10 4/200 2026-04-11 11:34 by caotw2020
[¿¼ÑÐ] ũҵ¹ÜÀí302·ÖÇóµ÷¼Á +3 xuening1 2026-04-10 3/150 2026-04-11 10:18 by zhq0425
[¿¼ÑÐ] ²ÄÁÏÓ뻯¹¤µ÷¼Á +12 ·ñ¼«Ì©À´2026 2026-04-10 13/650 2026-04-11 00:28 by wangjihu
[¿¼ÑÐ] 083200 305·Ö Çó¶þÂÖµ÷¼Á ²»½ÓÊÜ¿çרҵ +9 Claireyyyy 2026-04-09 10/500 2026-04-10 21:21 by Claireyyyy
[¿¼ÑÐ] ²ÄÁÏרҵ344Çóµ÷¼Á +16 hualkop 2026-04-10 21/1050 2026-04-10 17:28 by laoshidan
[¿¼ÑÐ] Ò»Ö¾Ô¸¾©Çø985£¬085401µç×ÓÐÅÏ¢£¬±¾¿Æµç×ÓÐÅÏ¢ +3 Ñô¹â¿ªÀʵÄÄк¢ 2026-04-10 3/150 2026-04-10 16:29 by sophia_93
[¿¼ÑÐ] ²ÄÁÏר˶(0856) 339·ÖÇóµ÷¼Á +9 ¹þ¹þ¹þ¶ì¹þ¹þ¹þ 2026-04-09 10/500 2026-04-09 20:01 by Orcid
[¿¼ÑÐ] ¿¼Ñе÷¼Á +13 ±ù±ù£¬£¬£¬ 2026-04-07 13/650 2026-04-09 17:01 by Lilly_Li
ÐÅÏ¢Ìáʾ
ÇëÌî´¦ÀíÒâ¼û