Commit 121623a3 authored by Heinrich Schindler's avatar Heinrich Schindler
Browse files

Add Ansys121 example.

parent 238cf495
cmake_minimum_required(VERSION 3.9 FATAL_ERROR)
project(Ansys121)
if(NOT TARGET Garfield::Garfield)
find_package(Garfield REQUIRED)
endif()
# ---Build executable------------------------------------------------------------
add_executable(strip strip.C)
target_link_libraries(strip Garfield::Garfield)
# ---Copy all files locally to the build directory-------------------------------
foreach(_file ELIST.lis MPLIST.lis NLIST.lis PRNSOL.lis)
configure_file(fieldmaps/strip/${_file} ${CMAKE_CURRENT_BINARY_DIR}/fieldmap/${_file} COPYONLY)
endforeach()
This diff is collapsed.
LIST MATERIALS 1 TO 2 BY 1
PROPERTY= ALL
MATERIAL NUMBER 1
TEMP RSVX
0.000000
TEMP PERX
0.1000000E+11
MATERIAL NUMBER 2
TEMP PERX
4.500000
This diff is collapsed.
This diff is collapsed.
FINISH
/CLEAR,START
/PREP7
KEYW,PR_ELMAG,1
KEYW,MAGELC,1
! Disable the p-method solution options.
/PMETH,OFF,1
! Select the quadrilateral as element:
ET,1,PLANE121
! Material properties
MP, PERX, 1, 1e10 ! Metal
MP, RSVX, 1, 0.0
MP, PERX, 2, 4.5 ! Bulk dielectric constant
! Define some dimensions, in microns
halfpitch = 50
thickbulk = 200
halfstrip = 20
thickstrip = 5
BLC4, 0, 0, halfpitch, thickbulk ! Area 1: dielectricum
BLC4, 0, 0, halfstrip, thickstrip ! Area 2: conductor
ASBA, 1, 2, , , KEEP ! Area 1 becomes area 3
AGLUE, ALL ! Glue everything
! Assign material properties
ASEL, S, , , 3 ! Select the dielectricum
AATT, 2 ! Properties of material 2
ASEL, S, , , 2 ! Select the conductor
AATT, 1 ! Properties of material 1
! Set boundary conditions
ASEL, S, , , 2 ! Select the metal
LSLA, S ! Select all its border lines
DL, ALL, 2, VOLT, 1000 ! Set the borders to 1000 V
ASEL, S, , , 3 ! Select the dielectricum
LSLA, S ! Select all its border lines
LSEL, R, LOC, Y, thickbulk ! Sub-select lines at y=thickbulk
DL, ALL, 3, VOLT, 0 ! Set this line to 0 V
ASEL, S, , , 3
LSLA, S
LSEL, R, LOC, X, 0 ! Select the lines at x=0
DL, ALL, 3, SYMM ! Impose a symmetry condition
ASEL, S, , , 3
LSLA, S
LSEL, R, LOC, X, halfpitch ! Idem for y=halfpitch
DL, ALL, 3, SYMM
! Mesh the problem.
LSEL,ALL
ASEL, ALL
MSHKEY,0
SMRT, 3
AMESH, 2,3
! Solve the problem
/SOLU
SOLVE
FINISH
! Visualise the solution
/POST1
/EFACET,1
PLNSOL, VOLT,, 0
! Write the solution to files
/OUTPUT, PRNSOL, lis
PRNSOL
/OUTPUT
/OUTPUT, NLIST, lis
NLIST,,,,COORD
/OUTPUT
/OUTPUT, ELIST, lis
ELIST
/OUTPUT
/OUTPUT, MPLIST, lis
MPLIST
/OUTPUT
#include <iostream>
#include <TApplication.h>
#include <TCanvas.h>
#include "Garfield/ComponentAnsys121.hh"
#include "Garfield/ViewField.hh"
#include "Garfield/ViewFEMesh.hh"
using namespace Garfield;
int main(int argc, char * argv[]) {
TApplication app("app", &argc, argv);
// Load the field map.
ComponentAnsys121 fm;
fm.Initialise("fieldmap/ELIST.lis", "fieldmap/NLIST.lis",
"fieldmap/MPLIST.lis", "fieldmap/PRNSOL.lis", "micron");
fm.EnableMirrorPeriodicityX();
fm.PrintRange();
ViewField fieldView;
fieldView.SetComponent(&fm);
// Set the plot limits in the current viewing plane.
fieldView.SetArea(-0.01, 0., 0.01, 0.02);
fieldView.PlotContour();
app.Run();
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment