halbux / sparselizard

C++ FEM library | user-friendly | multi-physics | hp-adaptive | HPC
http://www.sparselizard.org
Other
332 stars 62 forks source link

Great work! Can the code been built in Visual Studio 2013 + Windows 7 64bit system? #10

Closed TangLaoya closed 4 years ago

TangLaoya commented 4 years ago

Dear halbux, Thank you very much for providing so great work. I am used to configure and build the code by Cmake. Could you please provide the make file that can be used by Cmake, i.e., the cmakelists.txt?

On the other hand, I am trying to calculating induction voltage by receive coil in ground in the electric field created by transmit coil, i.e., the induction well-logging problem. I need to solve the following eddy current equation:

\bigtriangledown \times (\mu ^{-1}\bigtriangledown \times E)+(i \omega \sigma -\omega^{2}\varepsilon )E=-i\omega J where J is the AC current source from transmit coil, \omega is the angular frequency of current source, \sigma is the conductivity of ground, and \varepsilon is the dielectric constant. Beside the transmit coil, there are receive coils and the inducted voltage is measured in these coils. Therefore I need to calculate the electric field and integrate the electric field along coil loop.

Is there any similar example to solve this kindly of problem?

Thanks, Tang laoya

halbux commented 4 years ago

Hi Tang, I have never tried that so: it is possible but you will have to compile petsc yourself on windows (which probably is a pain, but if you do it please let me know how!). In any case I can only recommend using a full Linux install. The formula does not appear correctly but as far as I can understand you can have a look at the "MAGNETIC INDUCTION, SKIN EFFECT", the "MAGNETIC SHIELDING OF A DC CURRENT" and the "HIGH TEMPERATURE SUPERCONDUCTOR" examples, they do more than what you want. Alex

TangLaoya commented 4 years ago

Dear Alex, Thank you very much for your kindly reply. Do you use the solver in petsc? Can I replace the solver by some other ones, such as MUMPS or Intel's PARDISO? I will study the examples you suggested. Could you correct the formula for me? On the other hand, do you have your own mesher or use external mesher such as Gmsh?

Thanks, Tang Laoya

halbux commented 4 years ago

Dear Tang, Yes I call.the solver from petsc so you should be able to switch easily to pardiso (and superlu as well I think). Just reconfigure petsc with pardiso and change the MATSOLVERMUMPS at line 817 in src/mathop.cpp. I have a very simple structured mesher only so I rely on gmsh .msh format or nastran .nas format as input. .msh version up to gmsh 3 included is natively supported, gmsh 4 .msh format must be loaded via petsc (just an extra bool flag, see documentation). From a quick diagonal look at the equation it seems correct. To implement de complex number in sparselizard it must be replaced by a time derivative: i.e. provide the equation in its time form (see magnetic induction, skin effect example) as sparselizard relies only on real arithmetic (it implements the harmonic balance FEM method and can work with complex numbers using real arithmetic).

Alex

TangLaoya commented 4 years ago

Dear Alex, Thank you very much for your kindly reply. So I have more questions:) 1) suppose I have transmit coil at (0,0,0) with radius 0.03 m and receive coil at (0,0,0.2) with radius 0.03 m, the coils are placed in well with radius 0.1 m and conductivity 1 S/m, outside the well the conductivity of ground is 0.1 S/m, the relative dielectric constants of all regions are set to be 10. The amplitude of current in transmit coil is 1 A and frequency is 1 MHz. I need to calculate the induced voltage in receive coil. Suppose both coils have 1 turn and suppose the mesh is done by gmsh and the region number inside well is 1 and outside well is 2. Could you please figure the simple example to solve this problem?

2) have you provided functions to call external gmsh functions to generate mesh for the given input models, and directly read meshes from the function instead by file, or just read mesh files output by gmsh (i.e., we should generate mesh by gmsh beforehand)?

Thanks, Tang Laoya

halbux commented 4 years ago

Dear Tang,

  1. It seems to me that the magnetic induction 3D example is a very good start for the magnetic part. For the capacitive part please have a look at the resistance and capacitance example, it shows you how to take into account displacement currents (if you need them at all)
  2. I just read gmsh/nastran files. For now you can either: a. Use the gmsh api, write the .msh then read it in in sparselizard b. Write a .geo file from sparselizard, let run the gmsh binary from c++ to mesh the .geo file then import in sparselizard. There is no direct interface with gmsh at the moment but it is something planned to be added.

Alex

hbadi commented 4 years ago

Hello Tang and Alex,

Did you manage do compile Sparcelizard within Visual Studio using cmake and customizing your own solver ? If yes, i'd be great to share this improvment ?

Best regards.

halbux commented 4 years ago

Hi,

Based on the details in a recent opened discussion for compiling on native windows I can now close this issue and refer to that post. Now at least 2 users have reported successfull compiling on windows. One user without any change to the source code and including MUMPS and all other 3rd party libraries.

Alex