# General Discussion

**URL:** https://community.freefem.org/c/general-discussion/7.md?page=41

[Latest](https://community.freefem.org/latest.md) · [Categories](https://community.freefem.org/categories.md)

**Page:** 42

---

## [Need help assembling parallelization results](https://community.freefem.org/t/need-help-assembling-parallelization-results/1992)

<div class="topic-metadata">

**Author:** [@ydm](https://community.freefem.org/u/ydm)\
**Replies:** 14\
**Last updated:** [September 12, 2022, 6:30pm UTC](https://community.freefem.org/t/need-help-assembling-parallelization-results/1992 "2022-09-12T18:30:10Z")

</div>

Hello, I am new to parallel computing. I wonder how can I assemble the results of different processors to the global field, in order to continue the calculations after. For example, I ran the file stokes-fieldsplit-3d-…

---

## [Export solution results](https://community.freefem.org/t/export-solution-results/1972)

<div class="topic-metadata">

**Author:** [@liang](https://community.freefem.org/u/liang)\
**Replies:** 10\
**Last updated:** [September 12, 2022, 3:05pm UTC](https://community.freefem.org/t/export-solution-results/1972 "2022-09-12T15:05:21Z")

</div>

How can I get the result at the specified coordinate point after the solve is done？

---

## [Integrating a variable over a line, and returning nodewise value](https://community.freefem.org/t/integrating-a-variable-over-a-line-and-returning-nodewise-value/1993)

<div class="topic-metadata">

**Author:** [@mahdi](https://community.freefem.org/u/mahdi)\
**Replies:** 5\
**Last updated:** [September 12, 2022, 8:03am UTC](https://community.freefem.org/t/integrating-a-variable-over-a-line-and-returning-nodewise-value/1993 "2022-09-12T08:03:52Z")

</div>

Dear Colleagues; I want to solve an equation like \\nabla \\Psi=0 with a Dirichlet boundary condition on the dashed-blue line border, where ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\\Psi(y)=\\int\_0^y f(y) dy Indeed I want…

---

## [Topology optimization based on variable density method](https://community.freefem.org/t/topology-optimization-based-on-variable-density-method/1969)

<div class="topic-metadata">

**Author:** [@Yangshen](https://community.freefem.org/u/Yangshen)\
**Replies:** 2\
**Last updated:** [September 9, 2022, 10:18am UTC](https://community.freefem.org/t/topology-optimization-based-on-variable-density-method/1969 "2022-09-09T10:18:25Z")

</div>

Dear all, I want to apply an initial density field with freefem, which works when my design domain is rectangular. And the resulting density matrix is a matrix related to the number of nodes. The code is as follows. me…

---

## [Efficient interpolation technique](https://community.freefem.org/t/efficient-interpolation-technique/1711)

<div class="topic-metadata">

**Author:** [@kallol](https://community.freefem.org/u/kallol)\
**Replies:** 5\
**Last updated:** [September 9, 2022, 8:36am UTC](https://community.freefem.org/t/efficient-interpolation-technique/1711 "2022-09-09T08:36:23Z")

</div>

Dear all, I want to interpolate a function u from one finite element space Vh to another finite element space Wh. I have used the operator “=” for interpolation. But it is not providing good results. Can anyone suggest …

---

## [3D discrete fourier transform](https://community.freefem.org/t/3d-discrete-fourier-transform/1983)

<div class="topic-metadata">

**Author:** [@abanderam](https://community.freefem.org/u/abanderam)\
**Replies:** 2\
**Last updated:** [September 8, 2022, 9:21am UTC](https://community.freefem.org/t/3d-discrete-fourier-transform/1983 "2022-09-08T09:21:22Z")

</div>

I am trying to perform a 3D discrete fourier transform of a three dimensional data set (x component of the velocity in a cube. However, i have found no information regarding this. Is there a package or command to perfor…

---

## [Calling a macro inside a loop error](https://community.freefem.org/t/calling-a-macro-inside-a-loop-error/1988)

<div class="topic-metadata">

**Author:** [@Stefanosv](https://community.freefem.org/u/Stefanosv)\
**Replies:** 3\
**Last updated:** [September 7, 2022, 9:12am UTC](https://community.freefem.org/t/calling-a-macro-inside-a-loop-error/1988 "2022-09-07T09:12:15Z")

</div>

Hello, I want to call multiple macros inside a loop but the macros only run at the first iteration and then they just get skipped every time they get called again. I think the issue might be with the way I set up the ma…

---

## [Piecewise 𝑃2 discontinuous finite element is not applicable to 1D problem](https://community.freefem.org/t/piecewise-2-discontinuous-finite-element-is-not-applicable-to-1d-problem/1986)

<div class="topic-metadata">

**Author:** [@Qianrui](https://community.freefem.org/u/Qianrui)\
**Replies:** 1\
**Last updated:** [September 6, 2022, 4:09pm UTC](https://community.freefem.org/t/piecewise-2-discontinuous-finite-element-is-not-applicable-to-1d-problem/1986 "2022-09-06T16:09:08Z")

</div>

Hello, load “element\_p1dc1” is applicable to 1D problem, while p2dc is not applicable to 1D problem. What are the commands for high-order interpolation, quadratic interpolation and cubic interpolation of 1D discontinuous…

---

## [Hello, about high-order interpolation of 1D DG finite element](https://community.freefem.org/t/hello-about-high-order-interpolation-of-1d-dg-finite-element/1989)

<div class="topic-metadata">

**Author:** [@Qianrui](https://community.freefem.org/u/Qianrui)\
**Replies:** 1\
**Last updated:** [September 6, 2022, 3:27pm UTC](https://community.freefem.org/t/hello-about-high-order-interpolation-of-1d-dg-finite-element/1989 "2022-09-06T15:27:27Z")

</div>

Hello, about the 1DDG high-level interpolation command, I am in FreeFem Documentation Release 4.8, did not find, where can I find? Low-order interpolation P1dcl

---

## [Local discontinuous finite element](https://community.freefem.org/t/local-discontinuous-finite-element/1990)

<div class="topic-metadata">

**Author:** [@Qianrui](https://community.freefem.org/u/Qianrui)\
**Replies:** 1\
**Last updated:** [September 6, 2022, 3:18pm UTC](https://community.freefem.org/t/local-discontinuous-finite-element/1990 "2022-09-06T15:18:23Z")

</div>

Hello, can freefem + + do local discontinuous finite element 1D analysis? For the adjacent element e1 and element e2, the values on the adjacent element e1 need to be used when calculating on the element e2. Freefem + + …

---

## [PETSc reports an error](https://community.freefem.org/t/petsc-reports-an-error/1987)

<div class="topic-metadata">

**Author:** [@Qianrui](https://community.freefem.org/u/Qianrui)\
**Replies:** 5\
**Last updated:** [September 5, 2022, 5:52am UTC](https://community.freefem.org/t/petsc-reports-an-error/1987 "2022-09-05T05:52:02Z")

</div>

Hello. When I use PETSc, when I use PETSc, the program can run smoothly when calculating the coarse grid(getARGV(“-global”, 128)). When the grid is refined(getARGV(“-global”, 2048)), PETSc calculates very slowly and repo…

---

## [Output the files of .vtk (Savevtk) with varying name in the loop](https://community.freefem.org/t/output-the-files-of-vtk-savevtk-with-varying-name-in-the-loop/1984)

<div class="topic-metadata">

**Author:** [@SHENG](https://community.freefem.org/u/SHENG)\
**Replies:** 5\
**Last updated:** [September 5, 2022, 12:12am UTC](https://community.freefem.org/t/output-the-files-of-vtk-savevtk-with-varying-name-in-the-loop/1984 "2022-09-05T00:12:25Z")

</div>

Hi everyone, I don’t know how to name the \*. vtk file in a loop. Please help me. For example, "int t=0, dt=0.01; for(int i=0;i\<61;++i) { t=t+dt; Lame; if (i%20==0) savevtk(“u.vtk”, Th1, \[u1,u2,u3\], dataname=“u1,…

---

## [Local numbering and Global numbering in PETSc](https://community.freefem.org/t/local-numbering-and-global-numbering-in-petsc/1985)

<div class="topic-metadata">

**Author:** [@Qianrui](https://community.freefem.org/u/Qianrui)\
**Replies:** 3\
**Last updated:** [September 4, 2022, 5:44am UTC](https://community.freefem.org/t/local-numbering-and-global-numbering-in-petsc/1985 "2022-09-04T05:44:57Z")

</div>

Hello, in PETSc, my understanding is that distributed data is a local number, that is, the number reordered in each CPU, so I think that in the above code fespace Vh(Th, Pk); Vh u; u = 0:Vh. ndof - 1; plotD(Th, u, c…

---

## [Argument out of range](https://community.freefem.org/t/argument-out-of-range/1980)

<div class="topic-metadata">

**Author:** [@SHENG](https://community.freefem.org/u/SHENG)\
**Replies:** 3\
**Last updated:** [September 1, 2022, 11:48am UTC](https://community.freefem.org/t/argument-out-of-range/1980 "2022-09-01T11:48:54Z")

</div>

Dear all, I performed the elastic simulation on a three-dimensional cube in FF++, using parallel computing mode (load “PETSc”). When I used two processors, the FF++ code is normal. However, as I used four or more proces…

---

## [3d mesh problem using readmesh3/savemesh in Windows 10](https://community.freefem.org/t/3d-mesh-problem-using-readmesh3-savemesh-in-windows-10/1978)

<div class="topic-metadata">

**Author:** [@ydm](https://community.freefem.org/u/ydm)\
**Replies:** 2\
**Last updated:** [September 1, 2022, 9:51am UTC](https://community.freefem.org/t/3d-mesh-problem-using-readmesh3-savemesh-in-windows-10/1978 "2022-09-01T09:51:49Z")

</div>

Hello, I am trying to import 3d mesh files from GMSH to FF++ and export the calculation results to Matlab for plotting. However, I found that under Windows 10, the program ends at the readmesh3 or savemesh function, eve…

---

## [Elements with several labels](https://community.freefem.org/t/elements-with-several-labels/1979)

<div class="topic-metadata">

**Author:** [@AdrienLer](https://community.freefem.org/u/AdrienLer)\
**Replies:** 4\
**Last updated:** [September 1, 2022, 8:03am UTC](https://community.freefem.org/t/elements-with-several-labels/1979 "2022-09-01T08:03:46Z")

</div>

Hello, I have been trying to compute integral on a label surface Sr using imported mesh from GMSH. There are 2 surfaces : Sr and Si. Several elements are on Sr AND Si and other only on Sr or Si. They are (normally) w…

---

## [Mixed finite element(PETSc),how to solve](https://community.freefem.org/t/mixed-finite-element-petsc-how-to-solve/1960)

<div class="topic-metadata">

**Author:** [@Qianrui](https://community.freefem.org/u/Qianrui)\
**Replies:** 5\
**Last updated:** [August 30, 2022, 6:12pm UTC](https://community.freefem.org/t/mixed-finite-element-petsc-how-to-solve/1960 "2022-08-30T18:12:19Z")

</div>

Hello, I have seen the following example of mixed finite element. In fact, there are two unknowns, u and p, but this example does not solve p, varf vMixedLaplace(\[u1, u2, p\], \[v1, v2, q\]) = int2d(Th)(u1 \* v1 + u2 \* v2 +…

---

## [How to calculate adaptive meshing time?](https://community.freefem.org/t/how-to-calculate-adaptive-meshing-time/1973)

<div class="topic-metadata">

**Author:** [@sosome](https://community.freefem.org/u/sosome)\
**Replies:** 0\
**Last updated:** [August 30, 2022, 12:35am UTC](https://community.freefem.org/t/how-to-calculate-adaptive-meshing-time/1973 "2022-08-30T00:35:12Z")

</div>

Dear all, I create an adaptmesh for Poisson’s equation and linear elasticity problem using the CG solver provided by Freefem. I want to calculate the time taken to create the adaptive mesh. Is it possible to calculate …

---

## [Proyection from a mesh to another](https://community.freefem.org/t/proyection-from-a-mesh-to-another/1970)

<div class="topic-metadata">

**Author:** [@miguelpicos](https://community.freefem.org/u/miguelpicos)\
**Replies:** 0\
**Last updated:** [August 29, 2022, 8:23am UTC](https://community.freefem.org/t/proyection-from-a-mesh-to-another/1970 "2022-08-29T08:23:54Z")

</div>

Hi everyone, I would like to know if FreeFEM has some proyection routine between two meshes. The named “A Fast Finite Element Interpolator” computes a interpolation of the meshes but that does not satisfy properties as: …

---

## [How does freefem select trial functions](https://community.freefem.org/t/how-does-freefem-select-trial-functions/1968)

<div class="topic-metadata">

**Author:** [@Yangshen](https://community.freefem.org/u/Yangshen)\
**Replies:** 0\
**Last updated:** [August 29, 2022, 3:07am UTC](https://community.freefem.org/t/how-does-freefem-select-trial-functions/1968 "2022-08-29T03:07:58Z")

</div>

Dear all， According to my understanding, freefem uses Galerkin method to solve the field function (such as displacement field). When we use it, we only need to write the weak form of the problem, divide the grid, and d…

---

## [File of .mesh from GMSH (INRIA Medit) cannot be opened](https://community.freefem.org/t/file-of-mesh-from-gmsh-inria-medit-cannot-be-opened/1961)

<div class="topic-metadata">

**Author:** [@SHENG](https://community.freefem.org/u/SHENG)\
**Replies:** 7\
**Last updated:** [August 27, 2022, 12:45am UTC](https://community.freefem.org/t/file-of-mesh-from-gmsh-inria-medit-cannot-be-opened/1961 "2022-08-27T00:45:36Z")

</div>

Dear all, I faced a problem. The file of .mesh from GMSH (INRIA Medit) cannot be opened by freefem++. FreeFem reminded that " Return type false, your mesh is MeshS type, use gmshloadS function". However, the 3D geometr…

---

## [3D discontinuous Galerkin method](https://community.freefem.org/t/3d-discontinuous-galerkin-method/1963)

<div class="topic-metadata">

**Author:** [@kallol](https://community.freefem.org/u/kallol)\
**Replies:** 2\
**Last updated:** [August 26, 2022, 10:41am UTC](https://community.freefem.org/t/3d-discontinuous-galerkin-method/1963 "2022-08-26T10:41:28Z")

</div>

Dear all, Can we write 3D discontinuous Galerkin method FreeFem++ code?

---

## [Variable boundary condition](https://community.freefem.org/t/variable-boundary-condition/1964)

<div class="topic-metadata">

**Author:** [@sumantkr](https://community.freefem.org/u/sumantkr)\
**Replies:** 1\
**Last updated:** [August 26, 2022, 9:58am UTC](https://community.freefem.org/t/variable-boundary-condition/1964 "2022-08-26T09:58:43Z")

</div>

Hello, I want to apply a functional base boundary condition to a section of the domain. Kindly comment for the correctness on the given code: func f1= x\*y; //// boundary condition …+ on( boundary, var = f1) ; // …

---

## [Problem reading/writing mesh file](https://community.freefem.org/t/problem-reading-writing-mesh-file/455)

<div class="topic-metadata">

**Author:** [@david9333](https://community.freefem.org/u/david9333)\
**Replies:** 4\
**Last updated:** [August 24, 2022, 10:51am UTC](https://community.freefem.org/t/problem-reading-writing-mesh-file/455 "2022-08-24T10:51:03Z")

</div>

Hi! I am working on both my computer and distant computing resources provided by my lab and I seem to have a compatibility issue. I have created a .mesh file in the distant computer (using what is called v.4.4-2-nopetsc…

---

## [How to define the label of boundary(3D cylinder with hole)](https://community.freefem.org/t/how-to-define-the-label-of-boundary-3d-cylinder-with-hole/1322)

<div class="topic-metadata">

**Author:** [@Yikouyi](https://community.freefem.org/u/Yikouyi)\
**Replies:** 5\
**Last updated:** [August 24, 2022, 10:19am UTC](https://community.freefem.org/t/how-to-define-the-label-of-boundary-3d-cylinder-with-hole/1322 "2022-08-24T10:19:15Z")

</div>

Hi, I have question towards 3d mesh. I want to build a mesh of 3d cylinder with a hole. So I build a 2d mesh of the circle with a hole first and then use buildlayers() to expand it to 3d. how to define the label of bo…

---

## [Has anyone ever done a topology optimization example like 99 line with FF + +?](https://community.freefem.org/t/has-anyone-ever-done-a-topology-optimization-example-like-99-line-with-ff/1956)

<div class="topic-metadata">

**Author:** [@Yangshen](https://community.freefem.org/u/Yangshen)\
**Replies:** 2\
**Last updated:** [August 24, 2022, 10:18am UTC](https://community.freefem.org/t/has-anyone-ever-done-a-topology-optimization-example-like-99-line-with-ff/1956 "2022-08-24T10:18:31Z")

</div>

Hello everyone， I’m a novice and just got to know FF + +. I want to get some examples about topology optimization.

---

## [Interpolation operator](https://community.freefem.org/t/interpolation-operator/1952)

<div class="topic-metadata">

**Author:** [@fotkara](https://community.freefem.org/u/fotkara)\
**Replies:** 1\
**Last updated:** [August 24, 2022, 8:11am UTC](https://community.freefem.org/t/interpolation-operator/1952 "2022-08-24T08:11:54Z")

</div>

Good morning, I am new in FreeFem and I would like to get some information on the interpolation used between two meshes. Given a problem with a Lagrange multiplier (e.g. the divergence free condition for the time-depe…

---

## [How to calculate the normal of a 3D surface mesh](https://community.freefem.org/t/how-to-calculate-the-normal-of-a-3d-surface-mesh/1955)

<div class="topic-metadata">

**Author:** [@zcwang6](https://community.freefem.org/u/zcwang6)\
**Replies:** 0\
**Last updated:** [August 23, 2022, 6:34pm UTC](https://community.freefem.org/t/how-to-calculate-the-normal-of-a-3d-surface-mesh/1955 "2022-08-23T18:34:53Z")

</div>

Dear Freefem team, is there any way we can calculate the normal of the surface mesh? I also attached the files here. thank you so much. 9T\_MOTOR\_R.mesh (229.0 KB) surface\_mesh.edp (216 Bytes)

---

## [Save a FreeFEM Matrix in Python format](https://community.freefem.org/t/save-a-freefem-matrix-in-python-format/1954)

<div class="topic-metadata">

**Author:** [@Loic](https://community.freefem.org/u/Loic)\
**Replies:** 1\
**Last updated:** [August 23, 2022, 7:16am UTC](https://community.freefem.org/t/save-a-freefem-matrix-in-python-format/1954 "2022-08-23T07:16:50Z")

</div>

Hello all, I would like to know how to save a FreeFEM matrix, to open it with Python ? Now, I save my matrix like this: string MatrixAglobal="Aglobal.txt"; ofstream saveA(MatrixAglobal); saveA \<\< Aglobal \<\< endl; And…

---

## [How to calculate potential energy in 2d linear elasticity?](https://community.freefem.org/t/how-to-calculate-potential-energy-in-2d-linear-elasticity/1951)

<div class="topic-metadata">

**Author:** [@sosome](https://community.freefem.org/u/sosome)\
**Replies:** 1\
**Last updated:** [August 22, 2022, 2:12pm UTC](https://community.freefem.org/t/how-to-calculate-potential-energy-in-2d-linear-elasticity/1951 "2022-08-22T14:12:32Z")

</div>

Dear all, I am trying to calculate the potential energy in a linear elasticity problem. In this code, How to calculate potential energy in 2d linear elasticity? //Parameters real Rho = 8000.; //Density real E = 210.e…

[Previous page](https://community.freefem.org/c/general-discussion/7.md?page=40)

[Next page](https://community.freefem.org/c/general-discussion/7.md?page=42)
