Part I (An Example): It's easy to construct examples Now that the question has been changed so extensively, the remarks that I made for the old version are no longer of such pairs $(g,X)$ on an unbounded polygonal domain whose boundaryany interest. Here is connectedwhat I understand the problem to look like now:
LetFirst, $\Omega$ be such$\Omega\subset\mathbb{R}^2$ is a domain, and letconvex open set in the plane whose boundary is $w = u+iv:\Omega\to\mathbb{C}$ bepolygonal, i.e., a Schwarz-Christoffel transformationunion of line segements or rays that mapsmeet at a discrete set of 'corners'. In what I am going to discuss, these hypotheses seem a bit restrictive. Most or all of what I have to say would apply if $\Omega$ one-towere simply-one onto the upper half planeconnected (and hence contractible) and sends the point at infinity to the point at infinityits boundary $\partial\Omega$ minus a discrete set $C\subset\partial\Omega$ were a union of embedded (smooth) arcs. Then
Second, we are given a $v$ vanishes(smooth) function $\lambda>0$ on the boundary of $\Omega$ and is positive onthat limits to $0$ at every smooth point of $\partial\Omega$. (We don't further specify the interiorbehavior of $\Omega$$\lambda$ near the corner points $C\subset\partial\Omega$. Let) We use $g = \mathrm{d}u^2 + \mathrm{d}v^2$$\lambda$ to define a metric $g = \lambda\,(\mathrm{d}{x_1}^2+\mathrm{d}{x_2}^2)$.
Then, which iswe ask the following question: When does there exist a positive definite form(smooth) foliation $\mathcal{F}$ by curves on an open set in $\mathbb{R}^2$ containing $\Omega\cup (\partial\Omega\setminus C)$ with the following two properties: First, in the interior of $\Omega$, the leaves of (in fact$\mathcal{F}$ are $g$-geodesics. Second, conformal tofor each point $p\in \partial\Omega\setminus C$, the standard metric onboundary of $\Omega$ and the leaf of $\mathcal{F}$ through $p$ meet orthogonally (at $p$).
LetHere are a few examples:
Let $\Omega$ be the first quadrant, i.e., defined by $x_1>0$ and $x_2>0$. Then $\partial\Omega$ is the union of two rays, the positive $x_i$-axes, which meet at right angles at the origin (which is the unique corner point). Let $\lambda = {x_1}^2{x_2}^2({x_1}^2{+}{x_2}^2)$. Then a solution to the problem is defined by letting $\mathcal{F}$ be the foliation given by the level sets of the function $F = {x_1}^2-{x_2}^2$.
Let $\Omega$ be defined by $x_1>0$ and $x_2>{x_1}^2$. Then $\partial\Omega$ is the union of a ray (the positive $x_2$-axis) and the right half of the parabola $x_2-{x_1}^2=0$. These meet at right angles at the origin (which is the unique corner point). Let $\lambda = {x_1}^2(x_2{-}{x_1}^2)^2({x_1}^2{+}(x_2{-}3{x_1}^2)^2)$. Then a solution to the problem is defined by letting $\mathcal{F}$ be the foliation given by the level sets of the function $F = \mathrm{e}^{6x_1}(1-6x_1+18x_2)$.
Again, let $\Omega$ be the first quadrant, i.e., defined by $x_1>0$ and $x_2>0$. Then $\partial\Omega$ is the union of two rays, the positive $x_i$-axes, which meet at right angles at the origin (which is the unique corner point). Let $\lambda = {x_1}^2{x_2}^2/({x_1}^2{+}{x_2}^2)^{3}$. Then a solution to the problem is defined by letting $\mathcal{F}$ be the foliation given by the level sets of the function $F = {x_1}^2+{x_2}^2$. (Some interesting features of this example will be explained below, but note, already, that $\lambda$ does not limit to $0$ as one approaches the corner, although it does limit to $0$ as one approaches any smooth boundary point.)
To understand how these examples were constructed and to get an idea of some of the restrictions that the existence of a foliation $X=-\partial/\partial v$. This solves$\mathcal{F}$ satisfying the problemtwo conditions places on the function $\lambda$, sincesuppose that we have a given pair $X$ is perpendicular to$(\Omega,\lambda)$ satisfying the boundary of $\Omega$ and it clearly has divergence zeroabove conditions and lengththat there exists a foliation $1$$\mathcal{F}$ with respect to $g$the desired properties.
Of course,Since $X$$\Omega$ is not continuous at the corner points. Howevercontractible, the metricwe can write $g$ is smooth and conformalon (in fact, flat)$\Omega$ in the interior ofform $\Omega$$g=\eta_1^2+\eta_2^2$, where $\eta_1$ and it extends smoothly to an open set $\Omega^+$ that contains$\eta_2$ are $1$-forms and where the smooth pointsleaves of $\mathcal{F}$ are the boundarynull curves of $\Omega$$\eta_2$. Then the condition that these leaves be (but not$g$-geodesics is equivalent to the corners, in general)condition that $\mathrm{d}\eta_1 = 0$. In fact Since $\Omega$ is simply-connected, you don't even need that the boundary be polygonal; just beingthere will exist a finite union of smoothfunction $S:\Omega\to\mathbb{R}$, embedded curves that meet at 'corners' is sufficientunique up to construct an exampleadditive constant, such that $\mathrm{d}S = \eta_1$.
Part II (The PDE system):
Any (smooth) metric $g$ admits unit divergence-free vector fields locally: If Write $p$ is a point in$\mathrm{d}S = S_1\,\mathrm{d}x_1 + S_2\,\mathrm{d}x_2$. Since $\Omega$$g = \lambda\,({\mathrm{d}x_1}^2+{\mathrm{d}x_2}^2)=\eta_1^2+\eta_2^2$, let $c:[-\epsilon,\epsilon]\to\Omega$ be an embedded smooth curve with $c(0)=p$ and letit follows that $C:[-\epsilon,\epsilon]\times[-\delta,\delta]\to\Omega$ be defined$\eta_2 = \pm (S_2\,\mathrm{d}x_1 - S_1\,\mathrm{d}x_2)$, so thatwe have $$ g = \bigl(S_1^2+S_2^2\bigr)\,({\mathrm{d}x_1}^2+{\mathrm{d}x_2}^2) = \lambda\,({\mathrm{d}x_1}^2+{\mathrm{d}x_2}^2). $$ In other words, for each $t\in[-\epsilon,\epsilon]$$\lambda = \bigl(S_1^2+S_2^2\bigr)$. From this, the curveit is not difficult to see that $c_t:[-\delta,\delta]\to\Omega$ defined by$S$ extends continuously to the smooth part of $c_t(s) = C(t,s)$$\partial\Omega$ and is constant on each connected component of the unit speed geodesic satisfyingsmooth part of the boundary, while it has no critical points within $c_t(0)=c(t)$ and with initial velocity$\Omega$ itself.
Because of the hypothesis that the foliation $c'_t(0)$ perpendicular$\mathcal{F}$ extends smoothly to an open set $c'(t)$. Then, for$U$ containing $\delta>0$ sufficiently small$\Omega$ and the smooth part of its boundary, $C$it follows that there is a smooth embeddingfunction $\theta:U\to S^1$ such that the leaves of a rectangle into $\Omega$, and$\mathcal{F}$ in $U$ are the null curves of the smooth $1$-form $\mathrm{d}s$ is a closed unit$\sin\theta\,\mathrm{d}x_1-\cos\theta\,\mathrm{d}x_2$ and so that $\eta_2 = \sqrt{\lambda}\bigl(\sin\theta\,\mathrm{d}x_1-\cos\theta\,\mathrm{d}x_2\bigr)$ in $1$-form on$\Omega$, and this extends at least continuously to the imagesmooth part of the boundary of $C$$\Omega$ by extending $\lambda$ to be $0$ on the smooth part. As such
Conversely, the function $S:\Omega\to\mathbb{R}$ gives enough information to recover both the metric $g$ can be writtenand the foliation $\mathcal{F}$. If, as the OP has asked, one has $g = \mathrm{d}s^2 + \alpha^2$ for some$\lambda$ already specified, then $1$$S$ must satisfy the first-formorder scalar PDE $\alpha$$|\nabla S|^2 = \lambda$ on $\Omega$ plus the smooth part of the boundary. Now
Sometimes, letsuch an $X$ be$S$ exists (as the vector field that satisfiesexamples above show, although they were found by starting with a candidate $\mathrm{d}s(X) = 0$$S$), and $\alpha(X)=1$sometimes it does not. Then $X$ is a unit vector field and, since I suspect that the area form isOP would like an effectively computable necessary and sufficient condition for a given $dA = \mathrm{d}s\wedge\alpha$$\lambda$ to possess an admissable solution $S$, we can computebut that $$ \mathrm{div}_g(X)\,dA = \mathscr{L}_X\,dA = \mathrm{d}(\iota_X\,dA) = \mathrm{d}\bigl(\iota_X\,(\mathrm{d}s\wedge\alpha)\bigr) = \mathrm{d}(-\mathrm{d}s) = 0. $$ Thus, $X$ is divergence-free and unit size with respectlikely to $g$. (This isbe hard to determine, because it really depends on delicate information about the standard argumentgeodesic flow in dimension $2$$\Omega$ endowed with the metric $g$.)
ConverselyFor an example of an definitive condition, if $X$suppose that there is a unit, divergencesimple closed $g$-free vector field ongeodesic $\gamma$ in $\Omega$, then. Then $\sigma = -\iota_X\,dA$ is$\gamma$ cannot be a closed unitleaf of any geodesic foliation $1$-form on$\mathcal{F}$ of $\Omega$, and, since the function $\Omega$ is simply-connected,$S$ that corresponds to $\sigma = \mathrm{d}s$ for some function$\mathcal{F}$ could not then have a critical point on $s$$\gamma$, which it must. Moreover Thus, $\gamma$ would have to be transverse to all of the leaves of the$\mathcal{F}$, and we would then have a foliation byof the curves orthogonal todisk $X$ are geodesics that are calibrated$D\subset\Omega$ bounded by $\mathrm{d}s$.
In particular, if $g$$\gamma$ that is smooth and positive definite alongtransverse to the 'edges'boundary of $D$, an obvious impossibility (except possibly at the cornersby degree theory) and $X$ extends smoothly to the 'edges' . (butProbably, this argument works even if $\gamma$ is closed but not necessarily to the corners)simple, thenbut I leave that for the edges haveinterested.)
It is certianly possible to be geodesics inchose an admissable $\lambda$ for which the metric $g$-metric. (If would have a simple closed geodesic, thus showing that there are $\lambda$ for which there is no $g$ goes to zero on the edges-geodesic foliation, thenand hence no function $X$ has to blow up as you approach$S$ with the boundarydesired properties. However, so I'm not sure what it would mean for a given $X$ to be 'orthogonal'$\lambda$, it is not clear how to tell whether there exists a simple closed $g$-geodesic in $\Omega$. There are checkable conditions that guarantee one and checkable conditions that forbid one, but the boundarygap between these is large.)
I am dubious that an effectively checkable necessary and sufficient condition for the solvability of the problem of given $\lambda$ exists.