Explore chapters and articles related to this topic
Higher-Level Programming
Published in Syed R. Rizvi, Microcontroller Programming, 2016
In the code above, EOF is a special return value which is defined in stdio.h. When an end-of-file marker is encountered by a getchar() function, EOF is returned. The code above counts the number of characters in the input stream. This is done by reading characters from standard input and adding them to the “counter,” until it encounters the EOF. The output is performed by printf statement where the number of characters is displayed to the user. The above program can be rewritten as shown here: #include <stdio.h> void main() { int c, counter = 0; while ( (c = getchar()) != EOF ) counter++; printf(“Number of characters in file = %d\n”, counter); }
Simulation study on the electro-osmotic characteristic of a dehumidification fin
Published in Science and Technology for the Built Environment, 2022
Shanshan Cai, Xuan Sun, Xu Li, Song Li, Xue Xue
The simulation of EOF involves multiple physical fields, including potential field, flow field and other physical fields. Some scholars (Kamali, Soloklou, and Hadidi 2018) constructed the EOF model based on the coupled lattice Boltzmann method, used Poisson equation and Nernst Planck equation to describe the potential distribution and ion concentration (NP model) respectively, and studied the influence of two-dimensional planar microchannel roughness on EOF. NP model is normally applicable to the case where convection effect cannot be ignored or EDL overlaps (Mohammadipoor, Niazmand, and Mirbozorgi 2014). However, for the cases of low flow velocity, low external electric field intensity, uniform wall charge distribution and large channel height relative to EDL thickness, Poisson Boltzmann equation (PB model), which weakens the coupling between various physical fields can simplify the solution process and improve the calculation efficiency. Based on the finite difference method, some scholars (Arulanandam and Li 2000) used PB model to numerically simulate the EOF in rectangular microchannels, and studied the relationship between EOF rate and solution ion concentration, zeta potential, channel height and other factors. Some other research (Li 2016) used the dissipative particle dynamics (DPD) method of energy conservation to simulate the mass and heat transfer of EOF in microchannel, studied the pure EOF in infinite flat microchannel and the mixed EOF driven by pressure difference. In such method, the PB equation describing electric field is discretized by finite volume method and the electric field force acts on the DPD particles in the form of volume force. Based on the DPD method, the effects of electric field intensity, geometric size and Joule thermal parameters on the velocity distribution, temperature distribution and mass flow of EOF are analyzed. In order to simplify the three-dimensional model, some scholars (Chen, Chen, and Wu 2013) proposed a solution to the EOF model in wide and shallow microchannels under the coupling of multiple physical fields in COMSOL. The average thickness predicted by the two-dimensional model is consistent with the predicted result of the three-dimensional model with slip boundary, which can be used to simplify the three-dimensional calculation of complex EOF. However, for the simulation of EOF in porous desiccant, the lattice Boltzmann method (LBM) is one efficient mesoscopic numerical approach with high parallel computing efficiency and the ability to deal with complex geometries (Yoshida, Kinjo, and Washizu 2014, Zhang and Wang 2017).