24СʱÈÈÃŰæ¿éÅÅÐаñ    

²é¿´: 703  |  »Ø¸´: 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 µÄÖ÷Ìâ¸üÐÂ
×î¾ßÈËÆøÈÈÌûÍÆ¼ö [²é¿´È«²¿] ×÷Õß »Ø/¿´ ×îºó·¢±í
[»ù½ðÉêÇë] ¿É¿¿ÏûÏ¢£¬8ÔÂ21ºÅ(Ã÷Ìì)·Å°ñ +9 ҽѧÀÏÄк¢ 2026-08-20 10/500 2026-08-20 10:21 by ҽѧÀÏÄк¢
[»ù½ðÉêÇë] Ö»ÓÐÿÄêÕâÖÖʱºòÀ´¹ä¹äСľ³æ +20 yaoyewhu2008 2026-08-20 20/1000 2026-08-20 09:41 by 2026Äê¹ú×ÔÈ»»ù½
[»ù½ðÉêÇë] »¶Ó­·¢À´filecodeµÄMz6ºóµÄ´úÂëÑéÖ¤Æä¹æÂÉ +55 ҽѧÀÏÄк¢ 2026-08-13 125/6250 2026-08-20 09:02 by ҽѧÀÏÄк¢
[»ù½ðÉêÇë] ½ñÌì»ù½ð»á³ö½á¹ûÂð£¿20260819 +14 kkkl_v 2026-08-19 15/750 2026-08-20 08:21 by sunzitan
[»ù½ðÉêÇë] ʱ¼ä´Á±äÁË£¬ÄÜ¿´³öʲôÎÊÌ⣿ +12 »ùŵßä¿Í 2026-08-17 16/800 2026-08-19 22:04 by kk µÄСľ³æ
[»ù½ðÉêÇë] filecode£¬4¸öjtjcÁË +11 ziyangfang 2026-08-19 13/650 2026-08-19 21:28 by aasahr
[½Ìʦ֮¼Ò] ΪʲôÓà¶î±¦µÄÄ껯ÀûÂÊÔ½À´Ô½µÍ£¿Ö÷ÒªÔ­ÒòÓÐÄÄЩ£¿ +5 ˲ϢÓîÖæ 2026-08-15 5/250 2026-08-19 20:23 by super2002521
[»ù½ðÉêÇë] ½ñÌì·Å°ñûϷÁ衃 +4 yuleib84 2026-08-19 5/250 2026-08-19 19:52 by hhs666
[»ù½ðÉêÇë] ½ñÌì·Å°ñÂ𣿠+14 ²¼²¼ºÍÒ»¶þ 2026-08-19 15/750 2026-08-19 18:07 by gltch
[»ù½ðÉêÇë] 2027¹ã¶«Ê¡½ÜÇà +4 ÄÌţСºÚ 2026-08-15 10/500 2026-08-19 11:02 by wanfengnew
[»ù½ðÉêÇë] ÅóÓÑȦ¿´µ½µÄ +6 wangzilk 2026-08-18 8/400 2026-08-19 10:55 by Haru815
[»ù½ðÉêÇë] ¿ìÅ©ÀúÆßϦ½ÚÁË£¬ÇáËÉһϣ¬ÄÐÈËÇÄÇÄ»°£¬Å®Ê©Ö÷Çë²»Òª½øÀ´¡£ +6 Tide man 2026-08-14 7/350 2026-08-19 09:56 by ZJTJZ
[»ù½ðÉêÇë] ʲôʱºò¿ª½±£¿ +6 CrisMessi 2026-08-18 6/300 2026-08-19 08:06 by Equinoxhua
[»ù½ðÉêÇë] ÖØÒªÏûÏ¢£¬ÖÐÎçϵͳÔÚά»¤ +10 yuleib84 2026-08-18 11/550 2026-08-19 07:30 by Óðë·ãf
[»ù½ðÉêÇë] Ã÷Ìì·Å°ñ£¿ +5 Shxjjxjkx 2026-08-18 5/250 2026-08-18 18:14 by -´ó´ó´ó´ó´ó-
[»ù½ðÉêÇë] ½ñÌìά»¤ÏµÍ³Î¬»¤ ×£ËùÓÐÈË ¸ßÖÐ +8 gjjjzhong 2026-08-18 9/450 2026-08-18 13:01 by ¼ÒÓëÔ¶·½
[»ù½ðÉêÇë] 93BebMhtakhǰºó11λ¿ªÍ·¶¼ÊÇ´óд +4 ÇÒÌý»¢Ð¥ 2026-08-17 5/250 2026-08-18 00:49 by ²Ì°ô°ôÇ…
[»ù½ðÉêÇë] ¸Ð¾õÊÇÏÂÖܷŰñÁË +6 angus9576 2026-08-17 11/550 2026-08-17 23:57 by angus9576
[»ù½ðÉêÇë] ½ñÌìϵͳ¶à´Îά»¤£¬Ã÷ÌìºÜ¿ÉÄܷŰñ£¡ +8 zju2000 2026-08-16 9/450 2026-08-17 12:20 by lmz0216
[»ù½ðÉêÇë] ¸÷λµÀÓÑ£¬ÎÒҪȥÀ¥Ã÷Íæ¼¸Ì죬»ØÀ´¼û¡£ +7 Tide man 2026-08-14 8/400 2026-08-15 01:11 by arzu_hma
ÐÅÏ¢Ìáʾ
ÇëÌî´¦ÀíÒâ¼û