Can Gmsh2D read a 1D gmsh mesh?
Hello, Can Gmsh2D read a 1D gmsh mesh? I have tried a similar script to the FiPy diffusion example circle.py: SCRIPT BEGINS import fipy as fp from IPython import embed import sys #I created this gmsh .geo file in gmsh GUI, then copied and pasted here; I cannot see a syntax error if it exists??? geo=""" L_Sample=%(L_Sample)g; L_Substrate=%(L_Substrate)g; cellSize=%(cellSize)g; Point(1) = {0, 0, 0, cellSize}; Point(2) = {L_Substrate, 0, 0, cellSize}; Point(3) = {L_Substrate+L_Sample, 0, 0, cellSize}; Line(1) = {1, 2}; Line(2) = {2, 3}; Physical Point("SubstrateEnd") = {1}; Physical Point("SampleEnd") = {3}; Physical Point("ThermalContact") = {2}; Physical Line("Substrate") = {1}; Physical Line("Sample") = {2}; """ % locals() #I am not having success with: mesh = fp.Gmsh2D(geo,coordDimensions=1) #TODO throwing error about there being no cells; is it a problem that mesh is 1D and Gmsh2D is called 2D? mesh = fp.Gmsh2D(geo) #TODO throwing error about there being no cells #then I went into gmsh GUI and saved to .msh, but still no luck: mesh = fp.Gmsh2D('OneDimensionalSampleAndSubstrate.msh') #TODO throwing error about there being no cells mesh = fp.Gmsh2D('OneDimensionalSampleAndSubstrate.msh',coordDimensions=1) #TODO throwing error about there being no cells SCRIPT ENDS If coordDimensions=1 is unsupported or meaningless, it would be great if FiPy printed a message saying so. I believe my FiPy installation is OK and was downloaded from github 6/30/2018 (fipy-develop). I can run circle.py, although I have never gotten it to plot the mesh. I can run anisotropy.py from diffusivity examples. Nearly all fipy tests pass (setup.py). Can you please check if Gmsh2D is capable of reading a 1D gmsh mesh? Or is there another FiPy class which can do it, and how? gmsh –version returns 3.0.6. Installation is system-wide via download method in Ubuntu 16.04. If I cannot read in a parameterized 1D gmsh mesh using FiPy functionality, I am at a loss as to how to have a single Python script that allows me to set cellSize, L_Sample, and L_Substrate, produce a mesh, and efficiently conduct a parameter study with FiPy. Gmsh is desirable because I want to go to a more complicated nonuniform/graded mesh, and would rather not write code to make a mesh myself. Thanks. ___ fipy mailing list fipy@nist.gov http://www.ctcms.nist.gov/fipy [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]
Re: thermal contact between two regions
I think you can do this by aligning the mesh with the contact region and specifying the diffusion coefficient at the contact faces. On Thu, Jul 12, 2018 at 12:28 PM, Drew Davidson wrote: > Hello, > > > I’m sorry for not being more specific. I was trying to incorporate > https://www.mail-archive.com/fipy@nist.gov/msg02626.html by reference. -- Daniel Wheeler ___ fipy mailing list fipy@nist.gov http://www.ctcms.nist.gov/fipy [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]
Re: thermal contact between two regions
On Wed, Jul 11, 2018 at 7:00 PM, Drew Davidson wrote: > > 1. Transient heat conduction rather than steady state. Same boundary > conditions but initial condition can be zero temperature eveywhere. Add a TransientTerm to the equation and step through the solution with time steps and sweeps if necessary. > 2. The two regions have differing properties (thermal conductivity, mass > density, specific heat) The coefficients can have spatially varying values in FiPy. Define the coefficients as face or cell variables. > 3. The thermal contact is a true thermal contact resistance (a pure > resistance); it has zero thickness, and it has zero heat capacity. I need to see it defined mathematically to understand how to implement it in FiPy, but I'm confident it's possible to define it. -- Daniel Wheeler ___ fipy mailing list fipy@nist.gov http://www.ctcms.nist.gov/fipy [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]
Integral term
Hello, I would like to find a steady-state solution of an integro-differential equation with a spacial variable in the integration limit. So far it does not work. The minimal working example below gives wrong result. I understand that M1 and M2 are not updated in sweeps at all. If I set up M1 and M2 initially with the correct solution then the f1 solution is also correct. if I plug the integration directly to the term "fp.DiffusionTerm(coeff=fp.numerix.cumsum(f1*mesh.cellVolumes))” the error is: "IndexError: diffusion coefficent tensor is not an appropriate shape for this mesh" How should such equation be arranged? --- import fipy as fp mesh = fp.Grid1D(dx=0.002, nx=100) mesh = mesh + [0.002] f1 = fp.CellVariable(name = "solution",mesh = mesh,value = 1.,hasOld=True) x = mesh.x M1 = fp.numerix.cumsum(f1*mesh.cellVolumes) M2 = fp.numerix.cumsum(x**2*f1*mesh.cellVolumes) Conv_pf = [[1.0]] * (M1/x**2) Diff_pf = (M2/x**3) eq_steady1 = fp.DiffusionTerm(coeff=Diff_pf) + fp.PowerLawConvectionTerm(coeff=Conv_pf) f1.constrain(1,mesh.facesLeft) for sweep in range(10): eq_steady1.eq.sweep(var=f1) f1.updateOld() Thank you, Pavel ___ fipy mailing list fipy@nist.gov http://www.ctcms.nist.gov/fipy [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]
Re: thermal contact between two regions
Hello, I’m sorry for not being more specific. I was trying to incorporate https://www.mail-archive.com/fipy@nist.gov/msg02626.html by reference. Sketch of problem: (1) Region 1 --* thermal contact resistance * -- Region 2 (2) Temperature at (1) is zero. Heat flux at (2) is constant. At time zero, temperature is everywhere zero. ** What is a thermal contact resistance? https://en.wikipedia.org/wiki/Thermal_contact_conductance A dissertation available free online: Thermal contact resistance Author: Mikic, B. B.; Rohsenow, Warren M. Citable URI: http://hdl.handle.net/1721.1/61449 It’s equation (1.1) on page 12 of this dissertation. Thermal contact resistance is directly analogous to an electrical resistor in a simple circuit: (temperature drop across thermal contact resistance) = (heat flux) * (its unit-area thermal resistance) Units: Kelvin = W/m^2 times Kelvin/(W/m^2) Mathematically, the thermal contact resistance has no thickness and no heat capacity (it does not store energy). ** Please look at https://www.mail-archive.com/fipy@nist.gov/msg02641.html. Dr. Guyer and Dr. Wheeler considered the case of steady heat flow (steady state problem with no transient term), and their thermal contact has a finite thickness ‘dx’. They derived an expression for effective thermal conductivity at the thermal contact location, and provided FiPy code. How do things change in a transient problem? What is the effective thermal diffusivity (thermal diffusivity = thermal conductivity/(mass density * specific heat)) at the interface location, given that Region 1 and Region 2 have different thermal conductivities, mass densities, and specific heats? How is it written in FiPy? This is the point at which my knowledge of the finite volume method and FiPy is too weak. A solution where the thermal contact has a finite thickness ‘dx’ is also of interest, since it seems like a thermal contact resistance can be approximated by setting ‘dx’ very small. Trying to get on the same page: thermal diffusivity m^2/s thermal conductivity W/m/K mass density kg/m^3 specific heat J/kg/K Thanks On Thu, Jul 12, 2018 at 9:49 AM Daniel Wheeler wrote: > On Wed, Jul 11, 2018 at 7:00 PM, Drew Davidson > wrote: > > > > 1. Transient heat conduction rather than steady state. Same boundary > > conditions but initial condition can be zero temperature eveywhere. > > Add a TransientTerm to the equation and step through the solution with > time steps and sweeps if necessary. > > > 2. The two regions have differing properties (thermal conductivity, mass > > density, specific heat) > > The coefficients can have spatially varying values in FiPy. Define the > coefficients as face or cell variables. > > > 3. The thermal contact is a true thermal contact resistance (a pure > > resistance); it has zero thickness, and it has zero heat capacity. > > I need to see it defined mathematically to understand how to implement > it in FiPy, but I'm confident it's possible to define it. > > -- > Daniel Wheeler > ___ > fipy mailing list > fipy@nist.gov > http://www.ctcms.nist.gov/fipy > [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ] > ___ fipy mailing list fipy@nist.gov http://www.ctcms.nist.gov/fipy [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]