Beispiel #1
0
    def __init__(self, data):

        # input data
        self.pipe = Pipe(data["pipe"])
        self.brine = Fluid(data["fluid"])
        self.water = Fluid({"fluid-name": "water"})
        self.coil_dia = data["diameter"]
        self.dx = data["horizontal-spacing"]
        self.dy = data["vertical-spacing"]

        # other member data
        self.include_inside_fouling = False
        self.include_outside_fouling = False
Beispiel #2
0
 def test_pg(self):
     f = Fluid({"fluid-name": "pg", "concentration": 20})
     self.assertAlmostEqual(f.conductivity(20), 0.492, delta=1e-3)
     self.assertAlmostEqual(f.density(20), 1014.7, delta=0.1)
     self.assertAlmostEqual(f.specific_heat(20), 3976.7, delta=0.1)
     self.assertAlmostEqual(f.viscosity(20), 2.0300e-3, delta=1e-6)
     self.assertAlmostEqual(f.prandtl(20), 16.40, delta=1e-2)
Beispiel #3
0
def test_diagnostics():
    flow = Fluid(64, 64, 1.)
    flow.init_solver()
    flow.init_field(McWilliams)
    flow._get_psih()
    assert np.isclose(np.round(flow.tke(),1), 0.5, atol=1e-3),\
           "Error: TKE do not match"
    assert flow.enstrophy!=0.0, "Error: Enstrophy is zero"
    flow._compute_spectrum(200)
Beispiel #4
0
 def test_water(self):
     f = Fluid({"fluid-name": "water"})
     self.assertAlmostEqual(f.conductivity(20), 0.598, delta=1e-3)
     self.assertAlmostEqual(f.density(20), 998.2, delta=0.1)
     self.assertAlmostEqual(f.specific_heat(20), 4184.0, delta=0.1)
     self.assertAlmostEqual(f.viscosity(20), 1.00159e-3, delta=1e-6)
     self.assertAlmostEqual(f.prandtl(20), 7.00, delta=1e-2)
     self.assertAlmostEqual(f.beta(20), 2.0680e-4, delta=1e-2)
     self.assertAlmostEqual(f.alpha(20), 2.0680e-4, delta=1e-2)
Beispiel #5
0
def test_plots():
    flow = Fluid(16, 16, 1.)
    flow.init_solver()
    flow.init_field(ShearLayer)
    plt.ion()
    flow.plot_spec()
    plt.close()
    flow.display()
    plt.close()
    flow.display_vel()
    plt.close()
def test_update():
    # build field
    flow = Fluid(32, 32, 1.)
    flow.init_solver()
    flow.init_field("Taylor-Green")
    # start update
    while (flow.time <= 0.1):
        flow.update()
    # get final results
    w_n = flow.w.copy()
    # exact solution
    flow.init_field("Taylor-Green", t=flow.time)
    assert np.allclose(w_n, flow.w, atol=1e-6), "Error: solver diverged."
Beispiel #7
0
def test_update():
    # build field
    flow = Fluid(32, 32, 1.)
    flow.init_solver()
    flow.init_field(TaylorGreen)
    # start update
    while(flow.time<=0.1):
        flow.update()
    # get final results
    flow.wh_to_w()
    w_n = flow.w.copy()
    # exact solution
    w_e  = TaylorGreen(flow.x, flow.y,flow.Re, time=flow.time)
    assert np.allclose(w_n, w_e, atol=1e-6), "Error: solver diverged."
# -*- coding: utf-8 -*-

__author__ = "Marin Lauber"
__copyright__ = "Copyright 2019, Marin Lauber"
__license__ = "GPL"
__version__ = "1.0.1"
__email__ = "*****@*****.**"

import time as t
import numpy as np
from src.fluid import Fluid

if __name__ == "__main__":

    # build fluid and solver
    flow = Fluid(512, 512, 2000, pad=1.)
    flow.init_solver()
    flow.init_field("McWilliams")

    print("Starting integrating on field.\n")
    start_time = t.time()
    finish = 30.0

    # loop to solve
    while (flow.time <= finish):
        flow.update()
        if (flow.it % 3000 == 0):
            print(
                "Iteration \t %d, time \t %f, time remaining \t %f. TKE: %f, ENS: %f"
                % (flow.it, flow.time, finish - flow.time, flow.tke(),
                   flow.enstrophy()))
Beispiel #9
0
__author__ = "Marin Lauber"
__copyright__ = "Copyright 2019, Marin Lauber"
__license__ = "GPL"
__version__ = "1.0.1"
__email__ = "*****@*****.**"

import time as t
import numpy as np
from src.fluid import Fluid
from src.field import TaylorGreen, ShearLayer, ConvectiveVortex, McWilliams

if __name__ == "__main__":

    # build fluid and solver
    flow = Fluid(64, 64, 100, pad=1.)
    flow.init_solver()
    flow.init_field(field=McWilliams(flow.x, flow.y))

    print("Starting integrating on field.\n")
    start_time = t.time()
    finish = 3.0

    # # loop to solve
    # while(flow.time<=finish):
    #     flow.update()
    #     if(flow.it % 3000 == 0):
    #         print("Iteration \t %d, time \t %f, time remaining \t %f. TKE: %f, ENS: %f" %(flow.it,
    #               flow.time, finish-flow.time, flow.tke(), flow.enstrophy()))
    #         # flow.write(folder="Dat/", iter=flow.it/3000)
    flow.run_live(finish, every=200)
__author__ = "Marin Lauber"
__copyright__ = "Copyright 2019, Marin Lauber"
__license__ = "GPL"
__version__ = "1.0.1"
__email__  = "*****@*****.**"

import time as t
import numpy as np
from src.fluid import Fluid
from src.field import TaylorGreen,L2,Linf

if __name__=="__main__":

    # build fluid and solver
    flow = Fluid(128, 128, 1.)
    flow.init_solver()
    flow.init_field(TaylorGreen)

    print("Starting integration on field.\n")
    start_time = t.time()
    finish = 0.1

    # loop to solve
    while(flow.time<=finish):

        #  update using RK
        flow.update()

        #  print every 100 iterations
        if (flow.it % 100 == 0):
Beispiel #11
0
 def __init__(self, data: dict):
     super().__init__()
     self.cop = data["cop"]
     self.fluid = Fluid(data["fluid"])