Skip to content
Snippets Groups Projects
Commit 404e8859 authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

pp

parent 13c4fcef
Branches
Tags
No related merge requests found
Include "magnetometer_data.geo"; Include "magnetometer_data.geo";
Solver.AutoShowLastStep=0; Solver.AutoShowLastStep=0;
View.DisplacementFactor = 20 * b;
DefineConstant[ s = {1, Name "Input/Geometry/00Mesh size factor", DefineConstant[ s = {1, Name "Input/Geometry/00Mesh size factor",
Min 0.1, Max 2, Step 0.1} ]; Min 0.1, Max 2, Step 0.1} ];
...@@ -48,8 +47,8 @@ Physical Volume(CONDUCTOR_RIGHT) = {8, 9}; ...@@ -48,8 +47,8 @@ Physical Volume(CONDUCTOR_RIGHT) = {8, 9};
Physical Surface(VOLTAGE_LEFT) = {168, 190}; Physical Surface(VOLTAGE_LEFT) = {168, 190};
Physical Surface(VOLTAGE_RIGHT) = {234, 212}; Physical Surface(VOLTAGE_RIGHT) = {234, 212};
/* FIXME: show how we could select the mode ti visuzalize interactively without going through /* FIXME: show how we could select the mode ti visuzalize interactively without
the whole option menu going through the whole option menu
DefineConstant[ DefineConstant[
ts = { View.TimeStep, Name "Selected mode", Choices {0="Eigen mode 0", 1="Eigen mode 1"}, ts = { View.TimeStep, Name "Selected mode", Choices {0="Eigen mode 0", 1="Eigen mode 1"},
AutoCheck 0, GmshOption "View.TimeStep" AutoCheck 0, GmshOption "View.TimeStep"
...@@ -72,4 +71,3 @@ DefineConstant[ ...@@ -72,4 +71,3 @@ DefineConstant[
Name StrCat(pInOpt,"Structured grid?"),Visible 0} Name StrCat(pInOpt,"Structured grid?"),Visible 0}
]; ];
Merge "perturb.geo"; Merge "perturb.geo";
...@@ -171,14 +171,16 @@ def printOptProblem(xval,xmin,xmax,fmax,opt): ...@@ -171,14 +171,16 @@ def printOptProblem(xval,xmin,xmax,fmax,opt):
opt['optimization']['iterMax'])) opt['optimization']['iterMax']))
print('='*80) print('='*80)
def printCurrIterate(xval,fval,change,loop,opt): def printCurrIterate(client,xval,fval,change,loop,opt):
if opt['printLevel'] >= 1: if opt['printLevel'] >= 1:
print('It. {:4d},'.format(loop)), client.sendInfo('='*60)
client.sendInfo('It. {:4d},'.format(loop))
for k,xk in enumerate(xval): for k,xk in enumerate(xval):
print('x{}: {:.3e},'.format(k,xk)), client.sendInfo('x{}: {:.3e},'.format(k,xk))
for k,fk in enumerate(fval): for k,fk in enumerate(fval):
print('f{}: {:.3e},'.format(k,fk)), client.sendInfo('f{}: {:.3e},'.format(k,fk))
print('change: {:.3e}'.format(change)) client.sendInfo('change: {:.3e}'.format(change))
client.sendInfo('='*60)
def optimLoop(clientOnelab, clientOpt, xval, xmin, xmax, fmax, opt): def optimLoop(clientOnelab, clientOpt, xval, xmin, xmax, fmax, opt):
# Summary of the optimization problem # Summary of the optimization problem
...@@ -221,7 +223,7 @@ def optimLoop(clientOnelab, clientOpt, xval, xmin, xmax, fmax, opt): ...@@ -221,7 +223,7 @@ def optimLoop(clientOnelab, clientOpt, xval, xmin, xmax, fmax, opt):
change = np.linalg.norm(xmma-xval,np.inf) change = np.linalg.norm(xmma-xval,np.inf)
# Print the current iterate # Print the current iterate
printCurrIterate(xval,fval,change,loop,opt['optimization']) printCurrIterate(clientOnelab,xval,fval,change,loop,opt['optimization'])
# update design variables # update design variables
xold2 = np.copy(xold1) xold2 = np.copy(xold1)
...@@ -230,7 +232,7 @@ def optimLoop(clientOnelab, clientOpt, xval, xmin, xmax, fmax, opt): ...@@ -230,7 +232,7 @@ def optimLoop(clientOnelab, clientOpt, xval, xmin, xmax, fmax, opt):
loop = loop + 1 loop = loop + 1
# print the final iteration # print the final iteration
printCurrIterate(xval,fval,change,loop,opt['optimization']) printCurrIterate(clientOnelab,xval,fval,change,loop,opt['optimization'])
# output data # output data
xopt = np.copy(xval) xopt = np.copy(xval)
......
2.9.1: small improvements and bug fixes.
2.9.0: new ONELAB 1.2 protocol with native support for lists; simple C++ and 2.9.0: new ONELAB 1.2 protocol with native support for lists; simple C++ and
Python API for exchanging (lists of) numbers and strings; extended .pro language Python API for exchanging (lists of) numbers and strings; extended .pro language
for the construction of extensible problem definitions ("Append"); new for the construction of extensible problem definitions ("Append"); new
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment