Index: src_plugins/export_openems/export_openems.c =================================================================== --- src_plugins/export_openems/export_openems.c (revision 22987) +++ src_plugins/export_openems/export_openems.c (revision 22988) @@ -574,6 +574,7 @@ fprintf(ctx->f, "mesh.x = mesh.x .+ offset.x;\n"); fprintf(ctx->f, "mesh.y = offset.y .- mesh.y;\n"); fprintf(ctx->f, "mesh.z = z_bottom_copper .- mesh.z .+ offset.z;\n"); + fprintf(ctx->f, "mesh = AddPML(mesh, %d); %% add %d cells around the exterior of the existing mesh of \"perfectly matched\" impedance. 8 is just an example\n", mesh->pml, mesh->pml); fprintf(ctx->f, "CSX = DefineRectGrid(CSX, unit, mesh);\n"); fprintf(ctx->f, "\n"); } Index: src_plugins/export_openems/mesh.c =================================================================== --- src_plugins/export_openems/mesh.c (revision 22987) +++ src_plugins/export_openems/mesh.c (revision 22988) @@ -47,7 +47,7 @@ typedef struct { PCB_DAD_DECL_NOINIT(dlg) int dens_obj, dens_gap, min_space, smooth, hor, ver, noimpl; - int bnd[6], subslines, air_top, air_bot, dens_air, smoothz, max_air, def_subs_thick, def_copper_thick; + int bnd[6], pml, subslines, air_top, air_bot, dens_air, smoothz, max_air, def_subs_thick, def_copper_thick; unsigned active:1; } mesh_dlg_t; static mesh_dlg_t ia; @@ -959,6 +959,7 @@ mesh.layer = CURRENT; + mesh.pml = ia.dlg[ia.pml].default_val.int_value; mesh.dens_obj = ia.dlg[ia.dens_obj].default_val.coord_value; mesh.dens_gap = ia.dlg[ia.dens_gap].default_val.coord_value; mesh.min_space = ia.dlg[ia.min_space].default_val.coord_value; @@ -1141,6 +1142,13 @@ ia.bnd[n+1] = PCB_DAD_CURRENT(ia.dlg); PCB_DAD_END(ia.dlg); } + + PCB_DAD_BEGIN_HBOX(ia.dlg); + PCB_DAD_LABEL(ia.dlg, "PML cells:"); + PCB_DAD_INTEGER(ia.dlg, ""); + ia.pml = PCB_DAD_CURRENT(ia.dlg); + PCB_DAD_MINMAX(ia.dlg, 0, 32); + PCB_DAD_END(ia.dlg); PCB_DAD_END(ia.dlg); PCB_DAD_BEGIN_VBOX(ia.dlg); Index: src_plugins/export_openems/mesh.h =================================================================== --- src_plugins/export_openems/mesh.h (revision 22987) +++ src_plugins/export_openems/mesh.h (revision 22988) @@ -29,6 +29,7 @@ pcb_mesh_lines_t line[PCB_MESH_max]; /* actual lines of the mesh */ const char *bnd[6]; /* temporary: boundary conditions */ pcb_coord_t z_bottom_copper; /* z coordinate of the bottom copper layer, along the z-mesh (0 is the top copper) */ + int pml; /* add pml cells around the exterior of the existing mesh of "perfectly matched" impedance */ unsigned smooth:1; /* if set, avoid jumps in the meshing by gradually changing meshing distance */ unsigned noimpl:1; /* when set, do not add extra implicit mesh lines, keep the explicit ones only */ } pcb_mesh_t;